GUAC-1170: Fix unchecked cast warnings.

This commit is contained in:
Michael Jumper
2015-04-26 15:28:20 -07:00
parent 5fc0ff66b5
commit 05a6127fca
3 changed files with 9 additions and 7 deletions

View File

@@ -112,7 +112,7 @@ public class GuacamoleSession {
// Add an instance of each class to the list
if (listenerClasses != null) {
for (Class listenerClass : listenerClasses) {
for (Class<?> listenerClass : listenerClasses) {
// Instantiate listener
Object listener = listenerClass.getConstructor().newInstance();

View File

@@ -55,11 +55,10 @@ public class TunnelModule extends ServletModule {
try {
// Attempt to find WebSocket module
Class<TunnelLoader> module = (Class<TunnelLoader>)
GuacamoleClassLoader.getInstance().findClass(classname);
Class<?> module = (Class<?>) GuacamoleClassLoader.getInstance().findClass(classname);
// Create loader
TunnelLoader loader = module.getConstructor().newInstance();
TunnelLoader loader = (TunnelLoader) module.getConstructor().newInstance();
// Install module, if supported
if (loader.isSupported()) {

View File

@@ -79,7 +79,7 @@ public class LanguageRESTService {
* filename.
*/
private static final Pattern LANGUAGE_KEY_PATTERN = Pattern.compile(".*/([a-z]+_[A-Z]+)\\.json");
/**
* Returns a map of all available language keys to their corresponding
* human-readable names.
@@ -104,7 +104,7 @@ public class LanguageRESTService {
@Context ServletContext servletContext) throws GuacamoleException {
// Get the paths of all the translation files
Set<String> resourcePaths = servletContext.getResourcePaths(TRANSLATION_PATH);
Set<?> resourcePaths = servletContext.getResourcePaths(TRANSLATION_PATH);
// If no translation files found, return an empty map
if (resourcePaths == null)
@@ -113,7 +113,10 @@ public class LanguageRESTService {
Map<String, String> languageMap = new HashMap<String, String>();
// Iterate through all the found language files and add them to the return map
for (String resourcePath : resourcePaths) {
for (Object resourcePathObject : resourcePaths) {
// Each resource path is guaranteed to be a string
String resourcePath = (String) resourcePathObject;
// Get input stream for language file
InputStream languageFileStream = servletContext.getResourceAsStream(resourcePath);