diff options
author | Jiri Vanek <[email protected]> | 2013-12-13 09:54:16 +0100 |
---|---|---|
committer | Jiri Vanek <[email protected]> | 2013-12-13 09:54:16 +0100 |
commit | 6256aac59275df0edd0feb4950272aa33573be9f (patch) | |
tree | adba1e61360cf9e18597a8736b8c50b5022605a0 | |
parent | 26e9ef073e4ba4e625c8596113e9138ec85162e4 (diff) |
unittests warning cleanup: fixed typechecks, rawtypes, redundant casts...
ScreenFinder fixed to work partially also in headless mode.
After this clean up only "internal proprietary API and may be removed in a future release" warnings remain fro make check. Please keep itw in this way :)
20 files changed, 120 insertions, 86 deletions
@@ -1,3 +1,27 @@ +2013-12-13 Jiri Vanek <[email protected]> + + unittests warning cleanup: fixed typechecks, rawtypes, redundant casts... + * tests/junit-runner/CommandLine.java + * tests/junit-runner/JunitLikeXmlOutputListener.java + * tests/junit-runner/LessVerboseTextListener.java + * tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java + * tests/netx/unit/net/sourceforge/jnlp/resources/MessagesPropertiesTest.java + * tests/netx/unit/net/sourceforge/jnlp/splashscreen/ErrorSplashUtilsTest.java + * tests/netx/unit/net/sourceforge/jnlp/splashscreen/SplashUtilsTest.java + * tests/netx/unit/net/sourceforge/jnlp/splashscreen/parts/DescriptionInfoItemTest.java + * tests/netx/unit/net/sourceforge/jnlp/util/UrlUtilsTest.java + * tests/netx/unit/net/sourceforge/jnlp/util/XDesktopEntryTest.java + * tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64EncoderTest.java + * tests/netx/unit/sun/applet/PluginAppletViewerTest.java + * tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java + * tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java + * tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java + * tests/test-extensions/net/sourceforge/jnlp/awt/AWTHelper.java + * tests/test-extensions/net/sourceforge/jnlp/awt/awtactions/KeyboardActions.java + * tests/test-extensions/net/sourceforge/jnlp/closinglisteners/RulesFolowingClosingListener.java + * netx/net/sourceforge/jnlp/util/ScreenFinder.java: centering of screen + fixed to work also in headless mode by returrning some defaults + 2013-12-09 Jiri Vanek <[email protected]> * Messages.properties: added "It will be granted unrestricted access to your computer." diff --git a/netx/net/sourceforge/jnlp/util/ScreenFinder.java b/netx/net/sourceforge/jnlp/util/ScreenFinder.java index b633ae2..5b5896c 100644 --- a/netx/net/sourceforge/jnlp/util/ScreenFinder.java +++ b/netx/net/sourceforge/jnlp/util/ScreenFinder.java @@ -39,12 +39,14 @@ package net.sourceforge.jnlp.util; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; +import java.awt.HeadlessException; import java.awt.Insets; import java.awt.MouseInfo; import java.awt.Point; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.Window; +import net.sourceforge.jnlp.util.logging.OutputController; public class ScreenFinder { @@ -54,8 +56,13 @@ public class ScreenFinder { } public static Rectangle getCurrentScreenSizeWithoutBounds() { - Point p = MouseInfo.getPointerInfo().getLocation(); - return getScreenOnCoordsWithutBounds(p); + try { + Point p = MouseInfo.getPointerInfo().getLocation(); + return getScreenOnCoordsWithoutBounds(p); + } catch (HeadlessException ex) { + OutputController.getLogger().log(ex); + return new Rectangle(800, 600); + } } @@ -89,11 +96,16 @@ public class ScreenFinder { return result; } - public static Rectangle getScreenOnCoordsWithutBounds(Point p) { - GraphicsDevice device = getScreenOnCoords(p); - Rectangle screenSize = device.getDefaultConfiguration().getBounds(); - Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(device.getDefaultConfiguration()); - return new Rectangle((int)screenSize.getX()+insets.left, (int)screenSize.getY()+insets.top, (int)screenSize.getWidth()-insets.left, (int)screenSize.getHeight()-insets.bottom); + public static Rectangle getScreenOnCoordsWithoutBounds(Point p) { + try { + GraphicsDevice device = getScreenOnCoords(p); + Rectangle screenSize = device.getDefaultConfiguration().getBounds(); + Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(device.getDefaultConfiguration()); + return new Rectangle((int) screenSize.getX() + insets.left, (int) screenSize.getY() + insets.top, (int) screenSize.getWidth() - insets.left, (int) screenSize.getHeight() - insets.bottom); + } catch (HeadlessException ex) { + OutputController.getLogger().log(ex); + return new Rectangle(800, 600); + } } diff --git a/tests/junit-runner/CommandLine.java b/tests/junit-runner/CommandLine.java index 07c6e19..52843e5 100644 --- a/tests/junit-runner/CommandLine.java +++ b/tests/junit-runner/CommandLine.java @@ -45,7 +45,7 @@ public class CommandLine extends JUnitCore { addListener(jXmlOutput); RunListener listener = new LessVerboseTextListener(system); addListener(listener); - Result result = run(classes.toArray(new Class[0])); + Result result = run(classes.toArray(new Class<?>[0])); for (Failure each : missingClasses) { result.getFailures().add(each); } diff --git a/tests/junit-runner/JunitLikeXmlOutputListener.java b/tests/junit-runner/JunitLikeXmlOutputListener.java index 5e39cf6..c395dca 100644 --- a/tests/junit-runner/JunitLikeXmlOutputListener.java +++ b/tests/junit-runner/JunitLikeXmlOutputListener.java @@ -80,7 +80,7 @@ public class JunitLikeXmlOutputListener extends RunListener { private class ClassStat { - Class c; + Class<?> c; int total; int failed; int passed; @@ -178,8 +178,9 @@ public class JunitLikeXmlOutputListener extends RunListener { } + @SuppressWarnings("unchecked") private void testDone(Description description, long testTime, double testTimeSeconds, boolean ignored) throws Exception { - Class testClass = null; + Class<?> testClass = null; Method testMethod = null; try { testClass = description.getTestClass(); @@ -305,6 +306,7 @@ public class JunitLikeXmlOutputListener extends RunListener { } @Override + @SuppressWarnings("unchecked") public void testRunFinished(Result result) throws Exception { writeElement(SOUT_ELEMENT, "@sout@"); @@ -335,7 +337,7 @@ public class JunitLikeXmlOutputListener extends RunListener { try { Bug b = null; if (entry.getValue().c != null) { - b = (Bug) entry.getValue().c.getAnnotation(Bug.class); + b = entry.getValue().c.getAnnotation(Bug.class); } if (b != null) { openElement(BUGS); diff --git a/tests/junit-runner/LessVerboseTextListener.java b/tests/junit-runner/LessVerboseTextListener.java index 34df9f3..6f8a7df 100644 --- a/tests/junit-runner/LessVerboseTextListener.java +++ b/tests/junit-runner/LessVerboseTextListener.java @@ -114,11 +114,12 @@ public class LessVerboseTextListener extends RunListener { } } - - public static <T extends Annotation> T getAnnotation(Class q, String methodName, Class<T> a) { + + @SuppressWarnings("unchecked") + public static <T extends Annotation> T getAnnotation(Class<?> q, String methodName, Class<T> a) { try { if (q != null) { - T rem = (T) q.getAnnotation(a); + T rem = q.getAnnotation(a); if (rem != null) { return rem; } @@ -140,11 +141,11 @@ public class LessVerboseTextListener extends RunListener { } public static KnownToFail getK2F(Description description) { - return (KnownToFail) getAnnotation(description.getTestClass(), description.getMethodName(), KnownToFail.class); + return getAnnotation(description.getTestClass(), description.getMethodName(), KnownToFail.class); } public static Remote getRemote(Description description) { - return (Remote) getAnnotation(description.getTestClass(), description.getMethodName(), Remote.class); + return getAnnotation(description.getTestClass(), description.getMethodName(), Remote.class); } diff --git a/tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java b/tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java index 951f9bf..2474d2a 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java @@ -32,10 +32,10 @@ import java.util.HashMap; import java.util.Map; import java.util.Hashtable; import java.util.List; -import junit.framework.Assert; import net.sourceforge.jnlp.cache.UpdatePolicy; import net.sourceforge.jnlp.util.replacements.BASE64Encoder; +import org.junit.Assert; import org.junit.Test; diff --git a/tests/netx/unit/net/sourceforge/jnlp/resources/MessagesPropertiesTest.java b/tests/netx/unit/net/sourceforge/jnlp/resources/MessagesPropertiesTest.java index e30d521..9724a74 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/resources/MessagesPropertiesTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/resources/MessagesPropertiesTest.java @@ -175,7 +175,7 @@ public class MessagesPropertiesTest { allLog("Checking for same items between " + resourceBundle1.getLocale() + " x " + resourceBundle2.getLocale() + " (should be " + resourceBundle1.getIdentifier() + " x " + resourceBundle2.getIdentifier() + ")"); int localErrors=0; while (keys1.hasMoreElements()) { - String key = (String) keys1.nextElement(); + String key = keys1.nextElement(); String val1 = getMissingResourceAsEmpty(resourceBundle1.getBundle(), key); String val2 = getMissingResourceAsEmpty(resourceBundle2.getBundle(), key); outLog("\""+val1+"\" x \""+val2); @@ -222,7 +222,7 @@ public class MessagesPropertiesTest { String id = secondary[i].getIdentifier(); allLog("Checking for missing strings in " + sec.getLocale() + " (should be " + id + ") compared with default"); while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); + String key = keys.nextElement(); String val1 = getMissingResourceAsEmpty(main.getBundle(), key); String val2 = getMissingResourceAsEmpty(sec, key); outLog("\""+val1+"\" x \""+val2); @@ -257,7 +257,7 @@ public class MessagesPropertiesTest { allLog("Checking for empty items in " + resourceBundle.getLocale() + " (should be " + id + ")"); int localErrors=0; while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); + String key = keys.nextElement(); String val = getMissingResourceAsEmpty(resourceBundle, key); outLog("\""+key+"\" = \""+val); if (val.trim().isEmpty()) { @@ -285,7 +285,7 @@ public class MessagesPropertiesTest { outLog("Checking for redundant keys in " + sec.getLocale() + " (should be " + id + ") compared with default"); errLog("Checking for redundant keys in " + sec.getLocale() + " (should be " + id + ") compared with default"); while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); + String key = keys.nextElement(); String val2 = getMissingResourceAsEmpty(main.getBundle(), key); String val1 = getMissingResourceAsEmpty(sec, key); outLog("\""+val1+"\" x \""+val2); diff --git a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/ErrorSplashUtilsTest.java b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/ErrorSplashUtilsTest.java index 650fd32..85ef2bc 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/ErrorSplashUtilsTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/ErrorSplashUtilsTest.java @@ -44,11 +44,11 @@ import org.junit.Test; public class ErrorSplashUtilsTest { - private void fakeEnvironment(Map original) throws Exception { + private void fakeEnvironment(Map<String,String> original) throws Exception { SplashUtilsTest.fakeEnvironment(original); } - private Map getEnvironment() throws Exception { + private Map<String,String> getEnvironment() throws Exception { return SplashUtilsTest.getEnvironment(); } @@ -64,8 +64,8 @@ public class ErrorSplashUtilsTest { @Test public void testgetErrorSplashScreen1() throws Exception { - Map fake1 = new HashMap(); - Map original = getEnvironment(); + Map<String,String> fake1 = new HashMap<String,String>(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -85,10 +85,10 @@ public class ErrorSplashUtilsTest { @Test public void testgetErrorSplashScreen2() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.DEFAULT); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -107,10 +107,10 @@ public class ErrorSplashUtilsTest { @Test public void testgetErrorSplashScreen3() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.NONE); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.DEFAULT); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -129,10 +129,10 @@ public class ErrorSplashUtilsTest { @Test public void testgetErrorSplashScreen4() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.NONE); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -151,10 +151,10 @@ public class ErrorSplashUtilsTest { @Test public void testgetErrorSplashScreen5() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.NONE); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.NONE); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -170,10 +170,10 @@ public class ErrorSplashUtilsTest { @Test public void testgetErrorSplashScreen6() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, "fgdthyfjtuk"); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -192,9 +192,9 @@ public class ErrorSplashUtilsTest { @Test public void testgetErrorSplashScreen7() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, "egtrutkyukl"); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); diff --git a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/SplashUtilsTest.java b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/SplashUtilsTest.java index 4d783d7..26a38e8 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/SplashUtilsTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/SplashUtilsTest.java @@ -59,10 +59,11 @@ public class SplashUtilsTest { Assert.assertEquals(SplashUtils.SplashReason.JAVAWS, p2.getSplashReason()); } + @SuppressWarnings("unchecked") public static Map<String, String> getEnvironment() throws Exception { - Class[] classes = Collections.class.getDeclaredClasses(); + Class<?>[] classes = Collections.class.getDeclaredClasses(); Map<String, String> env = System.getenv(); - for (Class cl : classes) { + for (Class<?> cl : classes) { if ("java.util.Collections$UnmodifiableMap".equals(cl.getName())) { Field field = cl.getDeclaredField("m"); field.setAccessible(true); @@ -74,10 +75,11 @@ public class SplashUtilsTest { return null; } + @SuppressWarnings("unchecked") public static void fakeEnvironment(Map<String, String> newenv) throws Exception { - Class[] classes = Collections.class.getDeclaredClasses(); + Class<?>[] classes = Collections.class.getDeclaredClasses(); Map<String, String> env = System.getenv(); - for (Class cl : classes) { + for (Class<?> cl : classes) { if ("java.util.Collections$UnmodifiableMap".equals(cl.getName())) { Field field = cl.getDeclaredField("m"); field.setAccessible(true); @@ -91,8 +93,8 @@ public class SplashUtilsTest { @Test public void testGetSplashScreen1() throws Exception { - Map fake1 = new HashMap(); - Map original = getEnvironment(); + Map<String,String> fake1 = new HashMap<String,String>(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -112,10 +114,10 @@ public class SplashUtilsTest { @Test public void testGetSplashScreen2() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.DEFAULT); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -134,10 +136,10 @@ public class SplashUtilsTest { @Test public void testGetSplashScreen3() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.NONE); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.DEFAULT); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -156,10 +158,10 @@ public class SplashUtilsTest { @Test public void testGetSplashScreen4() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.NONE); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -178,10 +180,10 @@ public class SplashUtilsTest { @Test public void testGetSplashScreen5() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.NONE); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.NONE); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -197,10 +199,10 @@ public class SplashUtilsTest { @Test public void testGetSplashScreen6() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, "fgdthyfjtuk"); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -219,9 +221,9 @@ public class SplashUtilsTest { @Test public void testGetSplashScreen7() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, "egtrutkyukl"); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); diff --git a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/parts/DescriptionInfoItemTest.java b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/parts/DescriptionInfoItemTest.java index abce413..17ac1d1 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/parts/DescriptionInfoItemTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/parts/DescriptionInfoItemTest.java @@ -36,8 +36,8 @@ obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ package net.sourceforge.jnlp.splashscreen.parts; -import junit.framework.Assert; import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; import org.junit.Test; public class DescriptionInfoItemTest { diff --git a/tests/netx/unit/net/sourceforge/jnlp/util/UrlUtilsTest.java b/tests/netx/unit/net/sourceforge/jnlp/util/UrlUtilsTest.java index 587915f..a5aa021 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/util/UrlUtilsTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/util/UrlUtilsTest.java @@ -42,8 +42,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.io.File; -import java.net.MalformedURLException; -import java.net.URISyntaxException; import java.net.URL; import org.junit.Test; @@ -134,7 +132,7 @@ public class UrlUtilsTest { for (String testPath : testPaths) { File testFile = new File(testPath); - URL notEncodedUrl = testFile.toURL(); + URL notEncodedUrl = testFile.toURI().toURL(); URL encodedUrl = testFile.toURI().toURL(); assertEquals(testFile, UrlUtils.decodeUrlAsFile(notEncodedUrl)); assertEquals(testFile, UrlUtils.decodeUrlAsFile(encodedUrl)); diff --git a/tests/netx/unit/net/sourceforge/jnlp/util/XDesktopEntryTest.java b/tests/netx/unit/net/sourceforge/jnlp/util/XDesktopEntryTest.java index 8985085..0e115fd 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/util/XDesktopEntryTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/util/XDesktopEntryTest.java @@ -84,7 +84,7 @@ public class XDesktopEntryTest { backupedEnv = null; } else { backupedEnv = env; - Map m = new HashMap(env); + Map<String,String> m = new HashMap<String,String>(env); m.put(HOME, System.getProperty("user.home")); fakeEnvironment(m); ServerAccess.logOutputReprint("Hacked environment"); @@ -102,7 +102,7 @@ public class XDesktopEntryTest { } } - private static void fakeEnvironment(Map m) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException, ClassNotFoundException { + private static void fakeEnvironment(Map<String,String> m) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException, ClassNotFoundException { Class<?> processEnvironmentClass = Class.forName("java.lang.ProcessEnvironment"); Field env = processEnvironmentClass.getDeclaredField("theUnmodifiableEnvironment"); env.setAccessible(true); diff --git a/tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64EncoderTest.java b/tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64EncoderTest.java index 4771085..27ee230 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64EncoderTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64EncoderTest.java @@ -108,7 +108,7 @@ public class BASE64EncoderTest { private static Object createInsatnce(String ofCalss) throws ClassNotFoundException, InstantiationException, IllegalAccessException { - Class classDefinition = Class.forName(ofCalss); + Class<?> classDefinition = Class.forName(ofCalss); return classDefinition.newInstance(); } diff --git a/tests/netx/unit/sun/applet/PluginAppletViewerTest.java b/tests/netx/unit/sun/applet/PluginAppletViewerTest.java index 1bf7e35..521c92b 100644 --- a/tests/netx/unit/sun/applet/PluginAppletViewerTest.java +++ b/tests/netx/unit/sun/applet/PluginAppletViewerTest.java @@ -42,11 +42,8 @@ import static org.junit.Assert.assertEquals; import static sun.applet.PluginPipeMockUtil.getPluginStoreId; import static sun.applet.PluginPipeMockUtil.getPluginStoreObject; -import java.net.URI; import java.util.concurrent.Callable; -import junit.framework.Assert; - import net.sourceforge.jnlp.AsyncCall; import net.sourceforge.jnlp.ServerAccess; diff --git a/tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java b/tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java index 20a73fe..2413acd 100644 --- a/tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java +++ b/tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java @@ -164,7 +164,7 @@ public class LoggingBottleneck { synchronized public String modifyMethodWithForBrowser(String methodBrowseredName, String className) { try { - Class clazz = Class.forName(className); + Class<?> clazz = Class.forName(className); /* * By using this isAssignable to ensure corect class before invocation, * then we lost possibility to track manualy set browsers, but it is correct, diff --git a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java index 6f45a23..027dcee 100644 --- a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java +++ b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java @@ -779,9 +779,9 @@ public class ServerAccess { } //probablky it is necessary to get out of net.sourceforge.jnlp. //package where are right now all test-extensions - //for now keeping exactly the three clases helping yo acces the log + //for now keeping exactly the three classes helping you access the log try { - Class clazz = Class.forName(stack[i].getClassName()); + Class<?> clazz = Class.forName(stack[i].getClassName()); String path = null; try { path = clazz.getProtectionDomain().getCodeSource().getLocation().getPath(); diff --git a/tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java b/tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java index a7f4a72..f41cd7d 100644 --- a/tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java +++ b/tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java @@ -118,9 +118,8 @@ public class ThreadedProcess extends Thread { } } catch (Exception ex) { ex.printStackTrace(); - } finally { - return commandLine; } + return commandLine; } public Process getP() { diff --git a/tests/test-extensions/net/sourceforge/jnlp/awt/AWTHelper.java b/tests/test-extensions/net/sourceforge/jnlp/awt/AWTHelper.java index 91e1ad5..4bf3c0b 100644 --- a/tests/test-extensions/net/sourceforge/jnlp/awt/AWTHelper.java +++ b/tests/test-extensions/net/sourceforge/jnlp/awt/AWTHelper.java @@ -42,7 +42,6 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; -import java.awt.event.InputEvent; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; @@ -239,18 +238,18 @@ public abstract class AWTHelper extends RulesFolowingClosingListener implements * * @return */ - public Rule getInitStrAsRule(){ + public Rule<String, String> getInitStrAsRule(){ if( initStr != null ){ return new ContainsRule(this.initStr); }else{ - return new Rule(){ + return new Rule<String, String>(){ @Override - public void setRule(Object rule) { + public void setRule(String rule) { } @Override - public boolean evaluate(Object upon) { + public boolean evaluate(String upon) { return true; } diff --git a/tests/test-extensions/net/sourceforge/jnlp/awt/awtactions/KeyboardActions.java b/tests/test-extensions/net/sourceforge/jnlp/awt/awtactions/KeyboardActions.java index 1841476..1335f0d 100644 --- a/tests/test-extensions/net/sourceforge/jnlp/awt/awtactions/KeyboardActions.java +++ b/tests/test-extensions/net/sourceforge/jnlp/awt/awtactions/KeyboardActions.java @@ -98,9 +98,9 @@ public class KeyboardActions { int key; if( ('0' <= ch) && ('9' >= ch) ){ - key = (int)(ch - '0') + KeyEvent.VK_0; + key = (ch - '0') + KeyEvent.VK_0; }else if( ( 'a' <= ch) && ('z' >= ch) ){ - key = (int)(ch - 'a') + KeyEvent.VK_A; + key = (ch - 'a') + KeyEvent.VK_A; }else{ key = KeyEvent.VK_SPACE; } diff --git a/tests/test-extensions/net/sourceforge/jnlp/closinglisteners/RulesFolowingClosingListener.java b/tests/test-extensions/net/sourceforge/jnlp/closinglisteners/RulesFolowingClosingListener.java index 3e88f06..31c2e06 100644 --- a/tests/test-extensions/net/sourceforge/jnlp/closinglisteners/RulesFolowingClosingListener.java +++ b/tests/test-extensions/net/sourceforge/jnlp/closinglisteners/RulesFolowingClosingListener.java @@ -42,7 +42,7 @@ import java.util.List; public class RulesFolowingClosingListener extends CountingClosingListener { - private List<Rule> rules = new ArrayList<Rule>(); + private List<Rule<?,String>> rules = new ArrayList<Rule<?,String>>(); public static class ContainsRule extends StringRule<String> { @@ -176,19 +176,19 @@ public class RulesFolowingClosingListener extends CountingClosingListener { public RulesFolowingClosingListener() { } - public RulesFolowingClosingListener(List<Rule> l) { + public RulesFolowingClosingListener(List<Rule<?,String>> l) { addRules(l); } - public RulesFolowingClosingListener(Rule... l) { + public RulesFolowingClosingListener(Rule<?,String>... l) { addRules(l); } - public List<Rule> getRules() { + public List<Rule<?,String>> getRules() { return rules; } - public void setRules(List<Rule> rules) { + public void setRules(List<Rule<?,String>> rules) { if (rules == null) { throw new NullPointerException("rules cant be null"); } @@ -199,14 +199,14 @@ public class RulesFolowingClosingListener extends CountingClosingListener { * no more rules will be possible to add by doing this * @param rules */ - public void setRules(Rule[] rules) { + public void setRules(Rule<?,String>[] rules) { if (rules == null) { throw new NullPointerException("rules cant be null"); } this.rules = Arrays.asList(rules); } - public RulesFolowingClosingListener addRules(List<Rule> rules) { + final public RulesFolowingClosingListener addRules(List<Rule<?,String>> rules) { if (rules == null) { throw new NullPointerException("rules cant be null"); } @@ -214,7 +214,7 @@ public class RulesFolowingClosingListener extends CountingClosingListener { return this; } - public RulesFolowingClosingListener addRules(Rule... rules) { + final public RulesFolowingClosingListener addRules(Rule<?,String>... rules) { if (rules == null) { throw new NullPointerException("rules cant be null"); } @@ -227,7 +227,7 @@ public class RulesFolowingClosingListener extends CountingClosingListener { if (rules == null || rules.size() < 1) { throw new IllegalStateException("No rules specified"); } - for (Rule rule : rules) { + for (Rule<?,String> rule : rules) { if (!rule.evaluate(content)) { return false; } |