# HG changeset patch # User Jiri Vanek # Date 1386937735 -3600 # Node ID 94ff58f33514687d7306321b8dadfc2611fa4bb6 # Parent f055f0ed886d1d88b71a9f1001a0fbf1e505893c Backported warnings cleanups from head itw itself warning cleanup: fixed rawtypes and unchecks, added braces and Override unittests warning cleanup: fixed typechecks, rawtypes, redundant casts... ScreenFinder fixed to work partially also in headless mode kept comaptible with jdk6 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 :) diff -r f055f0ed886d -r 94ff58f33514 ChangeLog --- a/ChangeLog Mon Dec 09 13:25:24 2013 +0100 +++ b/ChangeLog Fri Dec 13 13:28:55 2013 +0100 @@ -1,3 +1,74 @@ +2013-12-13 Jiri Vanek + + Made again compatible with JDK6.All JLists, JComboBoxs, and DefaultComboBoxModels + moved back to be not generics-like + * netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java + * netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java + * netx/net/sourceforge/jnlp/controlpanel/DesktopShortcutPanel.java + * netx/net/sourceforge/jnlp/controlpanel/TemporaryInternetFilesPanel.java + * netx/net/sourceforge/jnlp/controlpanel/UnsignedAppletsTrustingListPanel.java + * netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java + +2013-12-13 Jiri Vanek + + itw itself warning cleanup: fixed rawtypes and unchecks, added braces and Override + * netx/net/sourceforge/jnlp/JREDesc.java + * netx/net/sourceforge/jnlp/Launcher.java + * netx/net/sourceforge/jnlp/Node.java + * netx/net/sourceforge/jnlp/Parser.java + * netx/net/sourceforge/jnlp/PluginBridge.java + * netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java + * netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java + * netx/net/sourceforge/jnlp/controlpanel/CachePane.java + * netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java + * netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java + * netx/net/sourceforge/jnlp/controlpanel/DesktopShortcutPanel.java + * netx/net/sourceforge/jnlp/controlpanel/TemporaryInternetFilesPanel.java + * netx/net/sourceforge/jnlp/controlpanel/UnsignedAppletsTrustingListPanel.java + * netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java + * netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java + * netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java + * netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java + * netx/net/sourceforge/jnlp/security/CertWarningPane.java + * netx/net/sourceforge/jnlp/security/CertsInfoPane.java + * netx/net/sourceforge/jnlp/security/appletextendedsecurity/impl/UnsignedAppletActionStorageImpl.java + * netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java + * netx/net/sourceforge/jnlp/services/ServiceUtil.java + * netx/net/sourceforge/jnlp/splashscreen/impls/DefaultErrorSplashScreen2012.java + * netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/NatCubic.java + * netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/SplinesDefs.java + * netx/net/sourceforge/jnlp/util/Reflect.java + * netx/net/sourceforge/jnlp/util/ui/NonEditableTableModel.java + * netx/net/sourceforge/nanoxml/XMLElement.java + * plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java + * plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java + * plugin/icedteanp/java/sun/applet/PluginAppletViewer.java + * tests/netx/unit/net/sourceforge/jnlp/ParserCornerCases.java + +2013-12-13 Jiri Vanek + + 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 * Messages.properties: added "It will be granted unrestricted access to your computer." diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/JREDesc.java --- a/netx/net/sourceforge/jnlp/JREDesc.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/JREDesc.java Fri Dec 13 13:28:55 2013 +0100 @@ -30,22 +30,22 @@ public class JREDesc { /** the platform version or the product version if location is not null */ - private Version version; + final private Version version; /** the location of a JRE product or null */ - private URL location; + final private URL location; /** inital heap size */ - private String initialHeapSize; + final private String initialHeapSize; /** maximum head size */ - private String maximumHeapSize; + final private String maximumHeapSize; /** args to pass to the vm */ - private String vmArgs; + final private String vmArgs; /** list of ResourceDesc objects */ - private List resources; + final private List resources; /** * Create a JRE descriptor. @@ -59,7 +59,7 @@ */ public JREDesc(Version version, URL location, String vmArgs, String initialHeapSize, - String maximumHeapSize, List resources) throws ParseException { + String maximumHeapSize, List resources) throws ParseException { this.version = version; this.location = location; this.vmArgs = vmArgs; @@ -112,7 +112,7 @@ /** * Returns the resources defined for this JRE. */ - public List getResourcesDesc() { + public List getResourcesDesc() { return resources; } diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/Launcher.java --- a/netx/net/sourceforge/jnlp/Launcher.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/Launcher.java Fri Dec 13 13:28:55 2013 +0100 @@ -46,7 +46,6 @@ import javax.swing.SwingUtilities; import javax.swing.text.html.parser.ParserDelegator; -import net.sourceforge.jnlp.runtime.AppletEnvironment; import net.sourceforge.jnlp.splashscreen.SplashUtils; import sun.awt.AppContext; @@ -94,8 +93,9 @@ public Launcher() { this(null, null); - if (handler == null) + if (handler == null) { handler = JNLPRuntime.getDefaultLaunchHandler(); + } } /** @@ -107,8 +107,9 @@ public Launcher(boolean exitOnFailure) { this(null, null); - if (handler == null) + if (handler == null) { handler = JNLPRuntime.getDefaultLaunchHandler(); + } this.exitOnFailure = exitOnFailure; } @@ -143,8 +144,9 @@ * Sets the update policy used by launched applications. */ public void setUpdatePolicy(UpdatePolicy policy) { - if (policy == null) + if (policy == null) { throw new IllegalArgumentException(R("LNullUpdatePolicy")); + } this.updatePolicy = policy; } @@ -239,12 +241,15 @@ } } - if (file instanceof PluginBridge && cont != null) + if (file instanceof PluginBridge && cont != null) { tg = new TgThread(file, cont, true); - else if (cont == null) + } + else if (cont == null) { tg = new TgThread(file); - else + } + else { tg = new TgThread(file, cont); + } tg.start(); @@ -255,11 +260,13 @@ throw launchWarning(new LaunchException(file, ex, R("LSMinor"), R("LCSystem"), R("LThreadInterrupted"), R("LThreadInterruptedInfo"))); } - if (tg.getException() != null) - throw tg.getException(); // passed to handler when first created + if (tg.getException() != null) { + throw tg.getException(); + } // passed to handler when first created - if (handler != null) + if (handler != null) { handler.launchCompleted(tg.getApplication()); + } return tg.getApplication(); } @@ -380,12 +387,15 @@ public void launchExternal(List vmArgs, JNLPFile file, List javawsArgs) throws LaunchException { List updatedArgs = new LinkedList(javawsArgs); - if (file.getFileLocation() != null) + if (file.getFileLocation() != null) { + updatedArgs.add(file.getFileLocation().toString()); + } + else if (file.getSourceLocation() != null) { updatedArgs.add(file.getFileLocation().toString()); - else if (file.getSourceLocation() != null) - updatedArgs.add(file.getFileLocation().toString()); - else + } + else { launchError(new LaunchException(file, null, R("LSFatal"), R("LCExternalLaunch"), R("LNullLocation"), R("LNullLocationInfo"))); + } launchExternal(vmArgs, updatedArgs); @@ -447,9 +457,7 @@ private JNLPFile fromUrl(URL location) throws LaunchException { try { - JNLPFile file = null; - - file = new JNLPFile(location, parserSettings.isStrict()); + JNLPFile file = new JNLPFile(location, parserSettings.isStrict()); boolean isLocal = false; boolean haveHref = false; @@ -480,8 +488,9 @@ * from a thread in the application's thread group. */ protected ApplicationInstance launchApplication(JNLPFile file) throws LaunchException { - if (!file.isApplication()) + if (!file.isApplication()) { throw launchError(new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LNotApplication"), R("LNotApplicationInfo"))); + } try { @@ -527,10 +536,11 @@ } } - if (mainName == null) + if (mainName == null) { throw launchError(new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LCantDetermineMainClass"), R("LCantDetermineMainClassInfo"))); + } Class mainClass = app.getClassLoader().loadClass(mainName); @@ -539,6 +549,7 @@ SwingUtilities.invokeAndWait(new Runnable() { // dummy method to force Event Dispatch Thread creation + @Override public void run() { } }); @@ -711,17 +722,18 @@ // appletInstance is needed by ServiceManager when looking up // services. This could potentially be done in applet constructor // so initialize appletInstance before creating applet. - if (cont == null) - appletInstance = new AppletInstance(file, group, loader, null); - else - appletInstance = new AppletInstance(file, group, loader, null, cont); + if (cont == null) { + appletInstance = new AppletInstance(file, group, loader, null); + } else { + appletInstance = new AppletInstance(file, group, loader, null, cont); + } loader.setApplication(appletInstance); // Initialize applet now that ServiceManager has access to its // appletInstance. String appletName = file.getApplet().getMainClass(); - Class appletClass = loader.loadClass(appletName); + Class appletClass = loader.loadClass(appletName); Applet applet = (Applet) appletClass.newInstance(); // Finish setting up appletInstance. appletInstance.setApplet(applet); @@ -753,7 +765,7 @@ } String appletName = file.getApplet().getMainClass(); - Class appletClass = loader.loadClass(appletName); + Class appletClass = loader.loadClass(appletName); Applet applet = (Applet) appletClass.newInstance(); return applet; @@ -788,7 +800,7 @@ * ThreadGroup has to be created at an earlier point in the applet code. */ protected ThreadGroup createThreadGroup(JNLPFile file) { - ThreadGroup tg = null; + final ThreadGroup tg; if (file instanceof PluginBridge) { tg = Thread.currentThread().getThreadGroup(); @@ -811,8 +823,9 @@ if (applet != null) { SplashUtils.showErrorCaught(ex, applet); } - if (handler != null) + if (handler != null) { handler.launchError(ex); + } return ex; } @@ -825,10 +838,11 @@ * @return an exception to throw if the launch should be aborted, or null otherwise */ private LaunchException launchWarning(LaunchException ex) { - if (handler != null) + if (handler != null) { if (!handler.launchWarning(ex)) // no need to destroy the app b/c it hasn't started - return ex; // chose to abort + return ex; + } // chose to abort return null; // chose to continue, or no handler } @@ -899,12 +913,14 @@ this.isPlugin = isPlugin; } + @Override public void run() { try { // Do not create new AppContext if we're using NetX and icedteaplugin. // The plugin needs an AppContext too, but it has to be created earlier. - if (context && !isPlugin) + if (context && !isPlugin) { SunToolkit.createNewAppContext(); + } doPerApplicationAppContextHacks(); @@ -913,23 +929,28 @@ JNLPRuntime.setDefaultDownloadIndicator(null); application = getApplet(file, ((PluginBridge)file).codeBaseLookup(), cont); } else { - if (file.isApplication()) + if (file.isApplication()) { application = launchApplication(file); - else if (file.isApplet()) - application = launchApplet(file, true, cont); // enable applet code base - else if (file.isInstaller()) + } + else if (file.isApplet()) { + application = launchApplet(file, true, cont); + } // enable applet code base + else if (file.isInstaller()) { application = launchInstaller(file); - else + } + else { throw launchError(new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LNotLaunchable"), R("LNotLaunchableInfo"))); + } } } catch (LaunchException ex) { ex.printStackTrace(); exception = ex; // Exit if we can't launch the application. - if (exitOnFailure) + if (exitOnFailure) { System.exit(1); + } } } diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/Node.java --- a/netx/net/sourceforge/jnlp/Node.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/Node.java Fri Dec 13 13:28:55 2013 +0100 @@ -63,13 +63,16 @@ } Node getFirstChild() { - if (children == null) + if (children == null) { getChildNodes(); + } - if (children.length == 0) + if (children.length == 0) { return null; - else + } + else { return children[0]; + } } Node getNextSibling() { @@ -87,13 +90,15 @@ if (children == null) { List list = new ArrayList(); - for (Enumeration e = xml.enumerateChildren(); e.hasMoreElements();) - list.add(new Node((XMLElement) e.nextElement())); + for (Enumeration e = xml.enumerateChildren(); e.hasMoreElements();) { + list.add(new Node(e.nextElement())); + } children = list.toArray(new Node[list.size()]); - for (int i = 0; i < children.length - 1; i++) + for (int i = 0; i < children.length - 1; i++) { children[i].next = children[i + 1]; + } } return children; @@ -107,8 +112,9 @@ if (attributeNames == null) { attributeNames= new ArrayList(); - for (Enumeration e = xml.enumerateAttributeNames(); e.hasMoreElements();) - attributeNames.add(new String((String) e.nextElement())); + for (Enumeration e = xml.enumerateAttributeNames(); e.hasMoreElements();) { + attributeNames.add(new String(e.nextElement())); + } } return attributeNames; @@ -119,12 +125,15 @@ } String getNodeName() { - if (xml.getName() == null) + if (xml.getName() == null) { return ""; - else + } + else { return xml.getName(); + } } + @Override public String toString() { return getNodeName(); } diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/Parser.java --- a/netx/net/sourceforge/jnlp/Parser.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/Parser.java Fri Dec 13 13:28:55 2013 +0100 @@ -346,7 +346,7 @@ } String initialHeap = getAttribute(node, "initial-heap-size", null); String maxHeap = getAttribute(node, "max-heap-size", null); - List resources = getResources(node, true); + List resources = getResources(node, true); // require version attribute getRequiredAttribute(node, "version", null); diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java --- a/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java Fri Dec 13 13:28:55 2013 +0100 @@ -221,8 +221,11 @@ * * @return List of Strings sorted by ascending order. */ + @SuppressWarnings({"unchecked", "rawtypes"}) + //although Properties are pretending to be they are always + //bug in jdk? public synchronized List> getLRUSortedEntries() { - ArrayList> entries = new ArrayList(cacheOrder.entrySet()); + List> entries = new ArrayList(cacheOrder.entrySet()); // sort by keys in descending order. Collections.sort(entries, new Comparator>() { @Override diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java --- a/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java Fri Dec 13 13:28:55 2013 +0100 @@ -488,7 +488,7 @@ + systemPropertiesFile); } Setting mandatory = systemConfiguration.get("deployment.system.config.mandatory"); - systemPropertiesMandatory = Boolean.valueOf(mandatory == null ? null : (String) mandatory.getValue()); + systemPropertiesMandatory = Boolean.valueOf(mandatory == null ? null : mandatory.getValue()); return true; } else { if (JNLPRuntime.isDebug()) { @@ -562,8 +562,8 @@ for (String key : currentConfiguration.keySet()) { String oldValue = unchangeableConfiguration.get(key) == null ? null - : (String) unchangeableConfiguration.get(key).getValue(); - String newValue = currentConfiguration.get(key) == null ? null : (String) currentConfiguration + : unchangeableConfiguration.get(key).getValue(); + String newValue = currentConfiguration.get(key) == null ? null : currentConfiguration .get(key).getValue(); if (oldValue == null && newValue == null) { continue; diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/controlpanel/CachePane.java --- a/netx/net/sourceforge/jnlp/controlpanel/CachePane.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/controlpanel/CachePane.java Fri Dec 13 13:28:55 2013 +0100 @@ -174,9 +174,12 @@ int row = cacheTable.getSelectedRow(); try { - if (fl == null) return; - if (row == -1 || row > cacheTable.getRowCount() - 1) + if (fl == null) { return; + } + if (row == -1 || row > cacheTable.getRowCount() - 1) { + return; + } int modelRow = cacheTable.convertRowIndexToModel(row); DirectoryNode fileNode = ((DirectoryNode) cacheTable.getModel().getValueAt(modelRow, 0)); if (fileNode.getFile().delete()) { @@ -262,8 +265,9 @@ */ private void populateTable() { ((DefaultTableModel) cacheTable.getModel()).setRowCount(0); //Clears the table - for (Object[] v : generateData(root)) + for (Object[] v : generateData(root)) { ((DefaultTableModel) cacheTable.getModel()).addRow(v); + } } /** diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java --- a/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java Fri Dec 13 13:28:55 2013 +0100 @@ -123,7 +123,7 @@ } private JPanel createTopPanel() { - Font currentFont = null; + Font currentFont; JLabel about = new JLabel(R("CPMainDescriptionShort")); currentFont = about.getFont(); about.setFont(currentFont.deriveFont(currentFont.getSize2D() + 2)); @@ -275,10 +275,12 @@ for (SettingsPanel panel : panels) { JPanel p = panel.getPanel(); Dimension d = p.getMinimumSize(); - if (d.height > height) + if (d.height > height) { height = d.height; - if (d.width > width) + } + if (d.width > width) { width = d.width; + } } Dimension dim = new Dimension(width, height); diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java --- a/netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java Fri Dec 13 13:28:55 2013 +0100 @@ -133,6 +133,7 @@ } @Override + @SuppressWarnings("unchecked") public void itemStateChanged(ItemEvent e) { Object o = e.getSource(); diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/controlpanel/DesktopShortcutPanel.java --- a/netx/net/sourceforge/jnlp/controlpanel/DesktopShortcutPanel.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/controlpanel/DesktopShortcutPanel.java Fri Dec 13 13:28:55 2013 +0100 @@ -72,8 +72,9 @@ shortcutComboOptions.setActionCommand("deployment.javaws.shortcut"); // The configuration property this combobox affects. for (int j = 0; j < items.length; j++) { shortcutComboOptions.addItem(items[j]); - if (config.getProperty("deployment.javaws.shortcut").equals(items[j].getValue())) + if (config.getProperty("deployment.javaws.shortcut").equals(items[j].getValue())) { shortcutComboOptions.setSelectedIndex(j); + } } shortcutComboOptions.addItemListener(this); diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/controlpanel/UnsignedAppletsTrustingListPanel.java --- a/netx/net/sourceforge/jnlp/controlpanel/UnsignedAppletsTrustingListPanel.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/controlpanel/UnsignedAppletsTrustingListPanel.java Fri Dec 13 13:28:55 2013 +0100 @@ -39,7 +39,6 @@ import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.io.BufferedWriter; @@ -116,7 +115,6 @@ private UnsignedAppletActionTableModel currentModel; private String lastDoc; private String lastCode; - private final UnsignedAppletsTrustingListPanel self; /* @@ -150,7 +148,6 @@ } public UnsignedAppletsTrustingListPanel(File globalSettings, File customSettings, DeploymentConfiguration conf) { - self = this; customBackEnd = new UnsignedAppletActionStorageExtendedImpl(customSettings); globalBackEnd = new UnsignedAppletActionStorageExtendedImpl(globalSettings); customModel = new UnsignedAppletActionTableModel(customBackEnd); @@ -763,7 +760,7 @@ private void removeByBehaviour(ExecuteUnsignedApplet unsignedAppletAction) { UnsignedAppletActionEntry[] items = currentModel.back.toArray(); if (askBeforeActionCheckBox.isSelected()) { - List toBeDeleted = new ArrayList(); + List toBeDeleted = new ArrayList(); for (int i = 0; i < items.length; i++) { UnsignedAppletActionEntry unsignedAppletActionEntry = items[i]; if (unsignedAppletActionEntry.getUnsignedAppletAction() == unsignedAppletAction) { @@ -879,7 +876,7 @@ @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_DELETE && !currentModel.back.isReadOnly()) { - removeSelectedFromTable(table, askBeforeActionCheckBox.isSelected(), (UnsignedAppletActionTableModel) table.getModel(), self); + removeSelectedFromTable(table, askBeforeActionCheckBox.isSelected(), (UnsignedAppletActionTableModel) table.getModel(), UnsignedAppletsTrustingListPanel.this); } } diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java --- a/netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java Fri Dec 13 13:28:55 2013 +0100 @@ -88,6 +88,7 @@ // may not need this once security manager can close windows // that do not have app code on the stack WindowListener closer = new WindowAdapter() { + @Override public void windowClosing(WindowEvent event) { appletInstance.destroy(); System.exit(0); @@ -104,8 +105,9 @@ * @throws IllegalStateException */ private void checkDestroyed() { - if (destroyed) + if (destroyed) { throw new IllegalStateException("Illegal applet stub/context access: applet destroyed."); + } } /** @@ -146,18 +148,21 @@ public void startApplet() { checkDestroyed(); - if (appletStarted) + if (appletStarted) { return; + } appletStarted = true; try { AppletDesc appletDesc = file.getApplet(); - if (cont instanceof AppletStub) + if (cont instanceof AppletStub) { applet.setStub((AppletStub) cont); - else + } + else { applet.setStub(this); + } cont.setLayout(new BorderLayout()); cont.add("Center", applet); @@ -175,6 +180,7 @@ try { SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { // do first because some applets need to be displayed before // starting (they use Component.getImage or something) @@ -207,13 +213,15 @@ * Returns the applet if the applet's name is specified, * otherwise return null. */ + @Override public Applet getApplet(String name) { checkDestroyed(); - if (name != null && name.equals(file.getApplet().getName())) + if (name != null && name.equals(file.getApplet().getName())) { return applet; - else + } else { return null; + } } /** @@ -234,6 +242,7 @@ * Returns an enumeration that contains only the applet * from the JNLP file. */ + @Override public Enumeration getApplets() { checkDestroyed(); @@ -243,6 +252,7 @@ /** * Returns an audio clip. */ + @Override public AudioClip getAudioClip(URL location) { checkDestroyed(); @@ -257,6 +267,7 @@ /** * Return an image loaded from the specified location. */ + @Override public Image getImage(URL location) { checkDestroyed(); @@ -269,6 +280,7 @@ /** * Not implemented yet. */ + @Override public void showDocument(java.net.URL uRL) { checkDestroyed(); @@ -277,6 +289,7 @@ /** * Not implemented yet. */ + @Override public void showDocument(java.net.URL uRL, java.lang.String str) { checkDestroyed(); @@ -285,6 +298,7 @@ /** * Not implemented yet. */ + @Override public void showStatus(java.lang.String str) { checkDestroyed(); @@ -293,6 +307,7 @@ /** * Required for JRE1.4, but not implemented yet. */ + @Override public void setStream(String key, InputStream stream) { checkDestroyed(); @@ -301,6 +316,7 @@ /** * Required for JRE1.4, but not implemented yet. */ + @Override public InputStream getStream(String key) { checkDestroyed(); @@ -310,6 +326,7 @@ /** * Required for JRE1.4, but not implemented yet. */ + @Override public Iterator getStreamKeys() { checkDestroyed(); @@ -318,6 +335,7 @@ // stub methods + @Override public void appletResize(int width, int height) { checkDestroyed(); @@ -330,18 +348,21 @@ } } + @Override public AppletContext getAppletContext() { checkDestroyed(); return this; } + @Override public URL getCodeBase() { checkDestroyed(); return file.getCodeBase(); } + @Override public URL getDocumentBase() { checkDestroyed(); @@ -350,16 +371,19 @@ // FIXME: Sun's applet code forces all parameters to lower case. // Does Netx's JNLP code do the same, so we can remove the first lookup? + @Override public String getParameter(String name) { checkDestroyed(); - String s = (String) parameters.get(name); - if (s != null) + String s = parameters.get(name); + if (s != null) { return s; + } - return (String) parameters.get(name.toLowerCase()); + return parameters.get(name.toLowerCase()); } + @Override public boolean isActive() { checkDestroyed(); diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java --- a/netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java Fri Dec 13 13:28:55 2013 +0100 @@ -301,7 +301,7 @@ } // then stop - Thread.currentThread().yield(); + Thread.yield(); nthreads = group.enumerate(threads); for (int i = 0; i < nthreads; i++) { if (JNLPRuntime.isDebug()) diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java --- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Fri Dec 13 13:28:55 2013 +0100 @@ -23,7 +23,6 @@ import java.io.IOException; import java.io.PrintStream; import java.lang.reflect.Constructor; -import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; import java.net.Authenticator; import java.net.ProxySelector; @@ -33,8 +32,6 @@ import java.security.KeyStore; import java.security.Policy; import java.security.Security; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; import java.text.MessageFormat; import java.util.List; import java.util.ResourceBundle; @@ -44,8 +41,6 @@ import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLEngine; -import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; import javax.swing.UIManager; @@ -64,7 +59,6 @@ import net.sourceforge.jnlp.security.JNLPAuthenticator; import net.sourceforge.jnlp.security.KeyStores; import net.sourceforge.jnlp.security.SecurityDialogMessageHandler; -import net.sourceforge.jnlp.security.VariableX509TrustManager; import net.sourceforge.jnlp.services.XServiceManagerStub; import net.sourceforge.jnlp.util.FileUtils; import net.sourceforge.jnlp.util.TeeOutputStream; @@ -486,7 +480,7 @@ * * @throws IllegalStateException if caller is not the exit class */ - public static void setExitClass(Class exitClass) { + public static void setExitClass(Class exitClass) { checkExitClass(); security.setExitClass(exitClass); } diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java --- a/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java Fri Dec 13 13:28:55 2013 +0100 @@ -18,24 +18,18 @@ import static net.sourceforge.jnlp.runtime.Translator.R; -import java.awt.Frame; import java.awt.Window; -import java.lang.ref.WeakReference; import java.net.SocketPermission; -import java.security.AllPermission; import java.security.AccessControlException; import java.security.Permission; -import java.security.SecurityPermission; import javax.swing.JWindow; -import net.sourceforge.jnlp.JNLPFile; import net.sourceforge.jnlp.security.SecurityDialogs.AccessType; import net.sourceforge.jnlp.services.ServiceUtil; import net.sourceforge.jnlp.util.WeakList; import sun.awt.AWTSecurityManager; import sun.awt.AppContext; -import sun.security.util.SecurityConstants; /** * Security manager for JNLP environment. This security manager @@ -117,8 +111,9 @@ // not added to any window list when checkTopLevelWindow is // called for it (and not disposed). - if (!JNLPRuntime.isHeadless()) + if (!JNLPRuntime.isHeadless()) { new JWindow().getOwner(); + } mainAppContext = AppContext.getAppContext(); } @@ -136,12 +131,15 @@ * true if no exit class is set. */ private boolean isExitClass(Class stack[]) { - if (exitClass == null) + if (exitClass == null) { return true; + } - for (int i = 0; i < stack.length; i++) - if (stack[i] == exitClass) + for (int i = 0; i < stack.length; i++) { + if (stack[i] == exitClass) { return true; + } + } return false; } @@ -153,9 +151,10 @@ * @param exitClass the exit class * @throws IllegalStateException if the exit class is already set */ - public void setExitClass(Class exitClass) throws IllegalStateException { - if (this.exitClass != null) + public void setExitClass(Class exitClass) throws IllegalStateException { + if (this.exitClass != null) { throw new IllegalStateException(R("RExitTaken")); + } this.exitClass = exitClass; } @@ -180,8 +179,9 @@ weakApplications.remove(i); } - if (w == window) + if (w == window) { return weakApplications.get(i); + } } return null; @@ -203,8 +203,9 @@ cl = cl.getParent(); } - if (maxDepth <= 0) + if (maxDepth <= 0) { maxDepth = stack.length; + } // this needs to be tightened up for (int i = 0; i < stack.length && i < maxDepth; i++) { @@ -229,8 +230,9 @@ private JNLPClassLoader getJnlpClassLoader(ClassLoader cl) { // Since we want to deal with JNLPClassLoader, extract it if this // is a codebase loader - if (cl instanceof JNLPClassLoader.CodeBaseClassLoader) + if (cl instanceof JNLPClassLoader.CodeBaseClassLoader) { cl = ((JNLPClassLoader.CodeBaseClassLoader) cl).getParentJNLPClassLoader(); + } if (cl instanceof JNLPClassLoader) { JNLPClassLoader loader = (JNLPClassLoader) cl; @@ -244,10 +246,12 @@ * Returns the application's thread group if the application can * be determined; otherwise returns super.getThreadGroup() */ + @Override public ThreadGroup getThreadGroup() { ApplicationInstance app = getApplication(); - if (app == null) + if (app == null) { return super.getThreadGroup(); + } return app.getThreadGroup(); } @@ -257,6 +261,7 @@ * otherwise return normally. This method always denies * permission to change the security manager or policy. */ + @Override public void checkPermission(Permission perm) { String name = perm.getName(); @@ -266,8 +271,9 @@ // System.out.println("Checking permission: " + perm.toString()); if (!JNLPRuntime.isWebstartApplication() && - ("setPolicy".equals(name) || "setSecurityManager".equals(name))) + ("setPolicy".equals(name) || "setSecurityManager".equals(name))) { throw new SecurityException(R("RCantReplaceSM")); + } try { // deny all permissions to stopped applications @@ -334,6 +340,7 @@ * warning banner, and adds the window to the list of windows to * be disposed when the calling application exits. */ + @Override public boolean checkTopLevelWindow(Object window) { ApplicationInstance app = getApplication(); @@ -369,22 +376,26 @@ * Calls not from Runtime.exit or with no exit class set will * behave normally, and the exit class can always exit the JVM. */ + @Override public void checkExit(int status) { // applets are not allowed to exit, but the plugin main class (primordial loader) is Class stack[] = getClassContext(); if (!exitAllowed) { - for (int i = 0; i < stack.length; i++) - if (stack[i].getClassLoader() != null) + for (int i = 0; i < stack.length; i++) { + if (stack[i].getClassLoader() != null) { throw new AccessControlException("Applets may not call System.exit()"); + } + } } super.checkExit(status); boolean realCall = (stack[1] == Runtime.class); - if (isExitClass(stack)) // either exitClass called or no exitClass set - return; // to Runtime.exit or fake call to see if app has permission + if (isExitClass(stack)) { + return; + } // to Runtime.exit or fake call to see if app has permission // not called from Runtime.exit() if (!realCall) { @@ -444,6 +455,7 @@ * @exception SecurityException if the caller does not have * permission to accesss the AWT event queue. */ + @Override public void checkAwtEventQueueAccess() { /* * this is the templace of the code that should allow applets access to diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/security/CertsInfoPane.java --- a/netx/net/sourceforge/jnlp/security/CertsInfoPane.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/security/CertsInfoPane.java Fri Dec 13 13:28:55 2013 +0100 @@ -65,7 +65,6 @@ public class CertsInfoPane extends SecurityDialogPanel { private CertPath certPath; - private JList list; protected JTree tree; private JTable table; private JTextArea output; @@ -175,7 +174,7 @@ /** * Constructs the GUI components of this panel */ - protected void addComponents() { + private void addComponents() { buildTree(); populateTable(); /** @@ -235,17 +234,21 @@ * Copies the currently selected certificate to the system Clipboard. */ private class CopyToClipboardHandler implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); int certIndex = 0; DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); - if (node == null) + if (node == null) { return; - if (node.isRoot()) + } + if (node.isRoot()) { certIndex = 0; - else if (node.isLeaf()) + } + else if (node.isLeaf()) { certIndex = 1; + } String[][] cert = certsData.get(certIndex); int rows = cert.length; @@ -268,12 +271,14 @@ * Updates the JTable when the JTree selection has changed. */ protected class TreeSelectionHandler implements TreeSelectionListener { + @Override public void valueChanged(TreeSelectionEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); - if (node == null) + if (node == null) { return; + } if (node.isRoot()) { table.setModel(new DefaultTableModel(certsData.get(0), columnNames)); @@ -288,6 +293,7 @@ * Updates the JTable when the selection on the list has changed. */ private class ListSelectionHandler implements ListSelectionListener { + @Override public void valueChanged(ListSelectionEvent e) { ListSelectionModel lsm = (ListSelectionModel) e.getSource(); @@ -308,6 +314,7 @@ * has changed. */ private class TableSelectionHandler implements ListSelectionListener { + @Override public void valueChanged(ListSelectionEvent e) { ListSelectionModel lsm = (ListSelectionModel) e.getSource(); @@ -329,8 +336,9 @@ private String makeFingerprint(byte[] hash) { String fingerprint = ""; for (int i = 0; i < hash.length; i++) { - if (!fingerprint.equals("")) + if (!fingerprint.equals("")) { fingerprint += ":"; + } fingerprint += Integer.toHexString( ((hash[i] & 0xFF) | 0x100)).substring(1, 3); } diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/security/appletextendedsecurity/impl/UnsignedAppletActionStorageImpl.java --- a/netx/net/sourceforge/jnlp/security/appletextendedsecurity/impl/UnsignedAppletActionStorageImpl.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/security/appletextendedsecurity/impl/UnsignedAppletActionStorageImpl.java Fri Dec 13 13:28:55 2013 +0100 @@ -151,7 +151,7 @@ } public List getMatchingItems(String documentBase, String codeBase, List archives) { - List result = new ArrayList(); + List result = new ArrayList(); lock(); try { readContents(); diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java --- a/netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java Fri Dec 13 13:28:55 2013 +0100 @@ -155,7 +155,7 @@ } //create the GUI here. - protected void addComponents() { + private void addComponents() { JPanel main = new JPanel(new BorderLayout()); @@ -263,8 +263,9 @@ aliases = keyStore.aliases(); while (aliases.hasMoreElements()) { Certificate c = keyStore.getCertificate(aliases.nextElement()); - if (c instanceof X509Certificate) + if (c instanceof X509Certificate) { certs.add((X509Certificate) c); + } } //get the publisher and root information @@ -309,10 +310,12 @@ new Object[]{label, jpf}, R("CVPasswordTitle"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); - if (result == JOptionPane.OK_OPTION) + if (result == JOptionPane.OK_OPTION) { return jpf.getPassword(); - else + } + else { return null; + } } /** Allows storing KeyStores.Types in a JComponent */ @@ -327,6 +330,7 @@ return type; } + @Override public String toString() { return KeyStores.toDisplayableString(null, type); } @@ -335,6 +339,7 @@ /** Invoked when a user selects a different certificate type */ private class CertificateTypeListener implements ActionListener { @Override + @SuppressWarnings("unchecked")//this is just certificateTypeCombo, nothing else public void actionPerformed(ActionEvent e) { JComboBox source = (JComboBox) e.getSource(); CertificateType type = (CertificateType) source.getSelectedItem(); @@ -371,6 +376,7 @@ } private class ImportButtonListener implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); @@ -411,9 +417,10 @@ } private class ExportButtonListener implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { - JTable table = null; + final JTable table ; if (currentKeyStoreLevel == Level.USER) { table = userTable; } else { @@ -434,8 +441,9 @@ if (alias != null) { if (currentKeyStoreType == KeyStores.Type.CLIENT_CERTS) { char[] password = getPassword(R("CVExportPasswordMessage")); - if (password != null) + if (password != null) { CertificateUtils.dumpPKCS12(alias, chooser.getSelectedFile(), keyStore, password); + } } else { Certificate c = keyStore.getCertificate(alias); PrintStream ps = new PrintStream(chooser.getSelectedFile().getAbsolutePath()); @@ -457,9 +465,10 @@ /** * Removes a certificate from the keyStore and writes changes to disk. */ + @Override public void actionPerformed(ActionEvent e) { - JTable table = null; + final JTable table; if (currentKeyStoreLevel == Level.USER) { table = userTable; } else { @@ -503,9 +512,10 @@ /** * Shows the details of a trusted certificate. */ + @Override public void actionPerformed(ActionEvent e) { - JTable table = null; + final JTable table; if (currentKeyStoreLevel == Level.USER) { table = userTable; } else { diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/services/ServiceUtil.java --- a/netx/net/sourceforge/jnlp/services/ServiceUtil.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/services/ServiceUtil.java Fri Dec 13 13:28:55 2013 +0100 @@ -154,9 +154,9 @@ * must be more than extremely careful in the operations they * perform. */ - static Object createPrivilegedProxy(Class iface, final Object receiver) { + static Object createPrivilegedProxy(Class iface, final Object receiver) { return java.lang.reflect.Proxy.newProxyInstance(XServiceManagerStub.class.getClassLoader(), - new Class[] { iface }, + new Class[] { iface }, new PrivilegedHandler(receiver)); } @@ -170,15 +170,19 @@ this.receiver = receiver; } + @Override public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable { if (JNLPRuntime.isDebug()) { System.err.println("call privileged method: " + method.getName()); - if (args != null) - for (int i = 0; i < args.length; i++) + if (args != null) { + for (int i = 0; i < args.length; i++) { System.err.println(" arg: " + args[i]); + } + } } PrivilegedExceptionAction invoker = new PrivilegedExceptionAction() { + @Override public Object run() throws Exception { return method.invoke(receiver, args); } @@ -242,8 +246,9 @@ if (!shouldPromptUser()) { return false; } - if (app == null) + if (app == null) { app = JNLPRuntime.getApplication(); + } final AccessType tmpType = type; final Object[] tmpExtras = extras; @@ -253,6 +258,7 @@ //applets, otherwise permissions won't be granted to load icons //from resources.jar. Boolean b = AccessController.doPrivileged(new PrivilegedAction() { + @Override public Boolean run() { boolean b = SecurityDialogs.showAccessWarningDialog(tmpType, tmpApp.getJNLPFile(), tmpExtras); @@ -294,14 +300,15 @@ public static boolean isSigned(ApplicationInstance app) { - if (app == null) + if (app == null) { app = JNLPRuntime.getApplication(); + } StackTraceElement[] stack = Thread.currentThread().getStackTrace(); for (int i = 0; i < stack.length; i++) { - Class c = null; + Class c = null; try { c = Class.forName(stack[i].getClassName()); diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/splashscreen/impls/DefaultErrorSplashScreen2012.java --- a/netx/net/sourceforge/jnlp/splashscreen/impls/DefaultErrorSplashScreen2012.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/splashscreen/impls/DefaultErrorSplashScreen2012.java Fri Dec 13 13:28:55 2013 +0100 @@ -46,7 +46,6 @@ public final class DefaultErrorSplashScreen2012 extends BasicComponentErrorSplashScreen { - private final DefaultErrorSplashScreen2012 self; private final ErrorPainter painter; private final DefaultSplashScreens2012Commons commons; @@ -55,22 +54,21 @@ //setSplashHeight(height); //setSplashWidth(width); //to have this in inner classes - self = this; setLoadingException(ex); setSplashReason(splashReason); - painter = new ErrorPainter(self, true); + painter = new ErrorPainter(this, true); addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { - if (((ErrorPainter) painter).getErrorCorner() != null - && e.getX() > ((ErrorPainter) painter).getErrorCorner().x - && e.getY() > ((ErrorPainter) painter).getErrorCorner().y) { + if ((painter).getErrorCorner() != null + && e.getX() > (painter).getErrorCorner().x + && e.getY() > (painter).getErrorCorner().y) { raiseExceptionDialog(); } } }); - commons = new DefaultSplashScreens2012Commons(painter, self); + commons = new DefaultSplashScreens2012Commons(painter, this); } @Override diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/NatCubic.java --- a/netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/NatCubic.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/NatCubic.java Fri Dec 13 13:28:55 2013 +0100 @@ -115,7 +115,7 @@ Cubic[] Y = calcNaturalCubic(pts.npoints - 1, pts.ypoints); /* very crude technique - just break each segment up into steps lines */ Polygon p = new Polygon(); - p.addPoint((int) Math.round(X[0].eval(0)), (int) Math.round(Y[0].eval(0))); + p.addPoint(Math.round(X[0].eval(0)), Math.round(Y[0].eval(0))); for (int i = 0; i < X.length; i++) { for (int j = 1; j <= STEPS; j++) { float u = j / (float) STEPS; diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/SplinesDefs.java --- a/netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/SplinesDefs.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/SplinesDefs.java Fri Dec 13 13:28:55 2013 +0100 @@ -153,24 +153,24 @@ return polygonizeControlPoints(mainLeafArray, scalex, scaley); } - static Polygon polygonizeControlPoints(Point[] pp, Double scalex, double scaley) { + static Polygon polygonizeControlPoints(Point[] pp, double scalex, double scaley) { Polygon r = new Polygon(); for (int i = 0; i < pp.length; i++) { Point p = pp[i]; - r.addPoint((int) ((double) p.x * (double) scalex), (int) ((double) p.y * (double) scaley)); + r.addPoint( (int) ((double) p.x * scalex), (int) ((double) p.y * scaley)); } return r; } - public static Polygon getSecondLeaf(Double scalex, double scaley) { + public static Polygon getSecondLeaf(double scalex, double scaley) { return polygonizeControlPoints(smallLeafArray, scalex, scaley); } - public static Polygon getSecondLeafStalk(Double scalex, double scaley) { + public static Polygon getSecondLeafStalk(double scalex, double scaley) { return polygonizeControlPoints(smallLeafStalkArray, scalex, scaley); } - public static Polygon getMainLeafStalk(Double scalex, double scaley) { + public static Polygon getMainLeafStalk(double scalex, double scaley) { return polygonizeControlPoints(mainLeafStalkArray, scalex, scaley); } diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/util/Reflect.java --- a/netx/net/sourceforge/jnlp/util/Reflect.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/util/Reflect.java Fri Dec 13 13:28:55 2013 +0100 @@ -16,7 +16,8 @@ package net.sourceforge.jnlp.util; -import java.lang.reflect.*; +import java.lang.reflect.Method; + /** * Provides simply, convenient methods to invoke methods by @@ -74,11 +75,12 @@ */ public Object invokeStatic(String className, String method, Object args[]) { try { - Class c = Class.forName(className, true, Reflect.class.getClassLoader()); + Class c = Class.forName(className, true, Reflect.class.getClassLoader()); Method m = getMethod(c, method, args); - if (m.isAccessible() != accessible) + if (m.isAccessible() != accessible) { m.setAccessible(accessible); + } return m.invoke(null, args); } catch (Exception ex) { // eat @@ -102,8 +104,9 @@ public Object invoke(Object object, String method, Object args[]) { try { Method m = getMethod(object.getClass(), method, args); - if (m.isAccessible() != accessible) + if (m.isAccessible() != accessible) { m.setAccessible(accessible); + } return m.invoke(object, args); } catch (Exception ex) { // eat @@ -116,17 +119,18 @@ * Return the Method matching the specified name and number of * arguments. */ - public Method getMethod(Class type, String method, Object args[]) { + public Method getMethod(Class type, String method, Object args[]) { try { - for (Class c = type; c != null; c = c.getSuperclass()) { + for (Class c = type; c != null; c = c.getSuperclass()) { Method methods[] = c.getMethods(); for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(method)) { Class parameters[] = methods[i].getParameterTypes(); - if (parameters.length == args.length) + if (parameters.length == args.length) { return methods[i]; + } } } } diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/jnlp/util/ScreenFinder.java --- a/netx/net/sourceforge/jnlp/util/ScreenFinder.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/jnlp/util/ScreenFinder.java Fri Dec 13 13:28:55 2013 +0100 @@ -39,6 +39,7 @@ 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; @@ -54,8 +55,13 @@ } public static Rectangle getCurrentScreenSizeWithoutBounds() { - Point p = MouseInfo.getPointerInfo().getLocation(); - return getScreenOnCoordsWithutBounds(p); + try { + Point p = MouseInfo.getPointerInfo().getLocation(); + return getScreenOnCoordsWithoutBounds(p); + } catch (HeadlessException ex) { + //should be logged? + return new Rectangle(800, 600); + } } @@ -89,11 +95,16 @@ 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) { + //should be logged? + return new Rectangle(800, 600); + } } diff -r f055f0ed886d -r 94ff58f33514 netx/net/sourceforge/nanoxml/XMLElement.java --- a/netx/net/sourceforge/nanoxml/XMLElement.java Mon Dec 09 13:25:24 2013 +0100 +++ b/netx/net/sourceforge/nanoxml/XMLElement.java Fri Dec 13 13:28:55 2013 +0100 @@ -371,7 +371,7 @@ * * */ - public Enumeration enumerateAttributeNames() { + public Enumeration enumerateAttributeNames() { return this.attributes.keys(); } @@ -383,7 +383,7 @@ * * */ - public Enumeration enumerateChildren() { + public Enumeration enumerateChildren() { return this.children.elements(); } diff -r f055f0ed886d -r 94ff58f33514 plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java --- a/plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java Mon Dec 09 13:25:24 2013 +0100 +++ b/plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java Fri Dec 13 13:28:55 2013 +0100 @@ -403,7 +403,7 @@ } } - return matchingConstructors.toArray(new Constructor[0]); + return matchingConstructors.toArray(new Constructor[0]); } private static Class getPrimitiveType(Class c) { @@ -435,8 +435,9 @@ private static boolean isNumericString(Object o) { // At this point, it _has_ to be a string else automatically // return false - if (!(o instanceof java.lang.String)) + if (!(o instanceof java.lang.String)) { return false; + } try { Long.parseLong((String) o); // whole number test diff -r f055f0ed886d -r 94ff58f33514 plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java --- a/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java Mon Dec 09 13:25:24 2013 +0100 +++ b/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java Fri Dec 13 13:28:55 2013 +0100 @@ -67,7 +67,7 @@ class Signature { private String signature; private int currentIndex; - private List typeList; + private List> typeList; private static final char ARRAY = '['; private static final char OBJECT = 'L'; private static final char SIGNATURE_ENDCLASS = ';'; @@ -135,18 +135,20 @@ public Signature(String signature, ClassLoader cl) { this.signature = signature; currentIndex = 0; - typeList = new ArrayList(10); + typeList = new ArrayList>(10); String elem; while (currentIndex < signature.length()) { elem = nextTypeName(); - if (elem == null) // end of signature + if (elem == null) { continue; + } - Class primitive = primitiveNameToType(elem); - if (primitive != null) + Class primitive = primitiveNameToType(elem); + if (primitive != null) { typeList.add(primitive); + } else { int dimsize = 0; int n = elem.indexOf('['); @@ -163,9 +165,10 @@ if (primitive != null) { typeList.add(Array.newInstance(primitive, dims) .getClass()); - } else + } else { typeList.add(Array.newInstance( getClass(arrayType, cl), dims).getClass()); + } } else { typeList.add(getClass(elem, cl)); } @@ -177,9 +180,9 @@ } } - public static Class getClass(String name, ClassLoader cl) { + public static Class getClass(String name, ClassLoader cl) { - Class c = null; + Class c = null; try { c = Class.forName(name); @@ -196,31 +199,41 @@ return c; } - public static Class primitiveNameToType(String name) { - if (name.equals("void")) + public static Class primitiveNameToType(String name) { + if (name.equals("void")) { return Void.TYPE; - else if (name.equals("boolean")) + } + else if (name.equals("boolean")) { return Boolean.TYPE; - else if (name.equals("byte")) + } + else if (name.equals("byte")) { return Byte.TYPE; - else if (name.equals("char")) + } + else if (name.equals("char")) { return Character.TYPE; - else if (name.equals("short")) + } + else if (name.equals("short")) { return Short.TYPE; - else if (name.equals("int")) + } + else if (name.equals("int")) { return Integer.TYPE; - else if (name.equals("long")) + } + else if (name.equals("long")) { return Long.TYPE; - else if (name.equals("float")) + } + else if (name.equals("float")) { return Float.TYPE; - else if (name.equals("double")) + } + else if (name.equals("double")) { return Double.TYPE; - else + } + else { return null; + } } - public Class[] getClassArray() { - return typeList.subList(0, typeList.size()).toArray(new Class[] {}); + public Class[] getClassArray() { + return typeList.subList(0, typeList.size()).toArray(new Class[] {}); } } @@ -263,7 +276,7 @@ e.printStackTrace(); } - this.classLoaders.put(liveconnectLoader, u); + PluginAppletSecurityContext.classLoaders.put(liveconnectLoader, u); } public PluginAppletSecurityContext(int identifier) { @@ -271,49 +284,61 @@ } private static V parseCall(String s, ClassLoader cl, Class c) { - if (c == Integer.class) + if (c == Integer.class) { return c.cast(new Integer(s)); - else if (c == String.class) - return c.cast(new String(s)); - else if (c == Signature.class) + } + else if (c == String.class) { + return c.cast(s); + } + else if (c == Signature.class) { return c.cast(new Signature(s, cl)); - else + } + else { throw new RuntimeException("Unexpected call value."); + } } - private Object parseArgs(String s, Class c) { - if (c == Boolean.TYPE || c == Boolean.class) - return new Boolean(s); - else if (c == Byte.TYPE || c == Byte.class) + private Object parseArgs(String s, Class c) { + if (c == Boolean.TYPE || c == Boolean.class) { + return Boolean.valueOf(s); + } + else if (c == Byte.TYPE || c == Byte.class) { return new Byte(s); + } else if (c == Character.TYPE || c == Character.class) { String[] bytes = s.split("_"); int low = Integer.parseInt(bytes[0]); int high = Integer.parseInt(bytes[1]); int full = ((high << 8) & 0x0ff00) | (low & 0x0ff); return new Character((char) full); - } else if (c == Short.TYPE || c == Short.class) + } else if (c == Short.TYPE || c == Short.class) { return new Short(s); - else if (c == Integer.TYPE || c == Integer.class) + } + else if (c == Integer.TYPE || c == Integer.class) { return new Integer(s); - else if (c == Long.TYPE || c == Long.class) + } + else if (c == Long.TYPE || c == Long.class) { return new Long(s); - else if (c == Float.TYPE || c == Float.class) + } + else if (c == Float.TYPE || c == Float.class) { return new Float(s); - else if (c == Double.TYPE || c == Double.class) + } + else if (c == Double.TYPE || c == Double.class) { return new Double(s); - else + } + else { return store.getObject(new Integer(s)); + } } public void associateSrc(ClassLoader cl, URL src) { PluginDebug.debug("Associating ", cl, " with ", src); - this.classLoaders.put(cl, src); + PluginAppletSecurityContext.classLoaders.put(cl, src); } public void associateInstance(Integer i, ClassLoader cl) { PluginDebug.debug("Associating ", cl, " with instance ", i); - this.instanceClassLoaders.put(i, cl); + PluginAppletSecurityContext.instanceClassLoaders.put(i, cl); } public static void setStreamhandler(PluginStreamHandler sh) { @@ -338,6 +363,7 @@ private static long privilegedJSObjectUnbox(final JSObject js) { return AccessController.doPrivileged(new PrivilegedAction() { + @Override public Long run() { return JSUtil.getJSObjectInternalReference(js); } @@ -419,8 +445,8 @@ try { if (message.startsWith("FindClass")) { - ClassLoader cl = null; - Class c = null; + ClassLoader cl; + Class c; cl = liveconnectLoader; String[] args = message.split(" "); Integer instance = new Integer(args[1]); @@ -433,7 +459,7 @@ write(reference, "FindClass " + store.getIdentifier(c)); } catch (ClassNotFoundException cnfe) { - cl = this.instanceClassLoaders.get(instance); + cl = PluginAppletSecurityContext.instanceClassLoaders.get(instance); PluginDebug.debug("Not found. Looking in ", cl); if (instance != 0 && cl != null) { @@ -461,14 +487,16 @@ if (message.startsWith("GetStaticMethodID") || methodName.equals("") || - methodName.equals("")) - c = (Class) store.getObject(classID); - else - c = store.getObject(classID).getClass(); + methodName.equals("")) { + c = (Class) store.getObject(classID); + } + else { + c = store.getObject(classID).getClass(); + } - Method m = null; - Constructor cs = null; - Object o = null; + Method m; + Constructor cs; + Object o; if (methodName.equals("") || methodName.equals("")) { o = cs = c.getConstructor(signature.getClassArray()); @@ -490,7 +518,7 @@ PluginDebug.debug("GetStaticFieldID/GetFieldID got class=", c.getName()); - Field f = null; + Field f; f = c.getField(fieldName); store.reference(f); @@ -509,6 +537,7 @@ checkPermission(src, c, acc); Object ret = AccessController.doPrivileged(new PrivilegedAction() { + @Override public Object run() { try { return f.get(c); @@ -518,8 +547,9 @@ } }, acc); - if (ret instanceof Throwable) + if (ret instanceof Throwable) { throw (Throwable) ret; + } String objIDStr = toObjectIDString(ret, f.getType(), false /*do not unbox primitives*/); write(reference, "GetStaticField " + objIDStr); @@ -548,6 +578,7 @@ checkPermission(src, message.startsWith("SetStaticField") ? (Class) o : o.getClass(), acc); Object ret = AccessController.doPrivileged(new PrivilegedAction() { + @Override public Object run() { try { f.set(o, fValue); @@ -559,8 +590,9 @@ } }, acc); - if (ret instanceof Throwable) + if (ret instanceof Throwable) { throw (Throwable) ret; + } write(reference, "SetField"); } else if (message.startsWith("GetObjectArrayElement")) { @@ -611,6 +643,7 @@ checkPermission(src, o.getClass(), acc); Object ret = AccessController.doPrivileged(new PrivilegedAction() { + @Override public Object run() { try { return f.get(o); @@ -620,8 +653,9 @@ } }, acc); - if (ret instanceof Throwable) + if (ret instanceof Throwable) { throw (Throwable) ret; + } String objIDStr = toObjectIDString(ret, f.getType(), false /*do not unbox primitives*/); write(reference, "GetField " + objIDStr); @@ -677,6 +711,7 @@ // http://forums.sun.com/thread.jspa?threadID=332001&start=15&tstart=0 m.setAccessible(true); Object ret = AccessController.doPrivileged(new PrivilegedAction() { + @Override public Object run() { try { return m.invoke(callableObject, fArguments); @@ -686,8 +721,9 @@ } }, acc); - if (ret instanceof Throwable) + if (ret instanceof Throwable) { throw (Throwable) ret; + } String retO; if (ret == null) { @@ -705,8 +741,8 @@ } else if (message.startsWith("GetSuperclass")) { String[] args = message.split(" "); Integer classID = parseCall(args[1], null, Integer.class); - Class c = null; - Class ret = null; + Class c; + Class ret; c = (Class) store.getObject(classID); ret = c.getSuperclass(); @@ -741,7 +777,7 @@ String[] args = message.split(" "); Integer stringID = parseCall(args[1], null, Integer.class); - String o = null; + String o; byte[] b = null; o = (String) store.getObject(stringID); b = o.getBytes("UTF-8"); @@ -751,7 +787,7 @@ String[] args = message.split(" "); Integer stringID = parseCall(args[1], null, Integer.class); - String o = null; + String o; byte[] b = null; o = (String) store.getObject(stringID); b = o.getBytes("UTF-16LE"); @@ -761,22 +797,23 @@ String[] args = message.split(" "); Integer stringID = parseCall(args[1], null, Integer.class); - String o = null; + String o; byte[] b = null; StringBuffer buf = null; o = (String) store.getObject(stringID); b = o.getBytes("UTF-8"); buf = new StringBuffer(b.length * 2); buf.append(b.length); - for (int i = 0; i < b.length; i++) + for (int i = 0; i < b.length; i++) { buf.append(" " + Integer.toString(((int) b[i]) & 0x0ff, 16)); + } write(reference, "GetStringUTFChars " + buf); } else if (message.startsWith("GetStringChars")) { String[] args = message.split(" "); Integer stringID = parseCall(args[1], null, Integer.class); - String o = null; + String o; byte[] b = null; StringBuffer buf = null; o = (String) store.getObject(stringID); @@ -784,8 +821,9 @@ b = o.getBytes("UTF-16LE"); buf = new StringBuffer(b.length * 2); buf.append(b.length); - for (int i = 0; i < b.length; i++) + for (int i = 0; i < b.length; i++) { buf.append(" " + Integer.toString(((int) b[i]) & 0x0ff, 16)); + } PluginDebug.debug("Java: GetStringChars: ", o); PluginDebug.debug(" String BYTES: ", buf); @@ -794,15 +832,16 @@ String[] args = message.split(" "); Integer objectID = parseCall(args[1], null, Integer.class); - String o = null; + String o; byte[] b = null; StringBuffer buf = null; o = store.getObject(objectID).toString(); b = o.getBytes("UTF-8"); buf = new StringBuffer(b.length * 2); buf.append(b.length); - for (int i = 0; i < b.length; i++) + for (int i = 0; i < b.length; i++) { buf.append(" " + Integer.toString(((int) b[i]) & 0x0ff, 16)); + } write(reference, "GetToStringValue " + buf); } else if (message.startsWith("NewArray")) { @@ -810,9 +849,9 @@ String type = parseCall(args[1], null, String.class); Integer length = parseCall(args[2], null, Integer.class); - Object newArray = null; + Object newArray; - Class c; + Class c; if (type.equals("bool")) { c = Boolean.class; } else if (type.equals("double")) { @@ -827,10 +866,12 @@ c = JSObject.class; } - if (args.length > 3) + if (args.length > 3) { newArray = Array.newInstance(c, new int[] { length, parseCall(args[3], null, Integer.class) }); - else + } + else { newArray = Array.newInstance(c, length); + } store.reference(newArray); write(reference, "NewArray " + store.getIdentifier(newArray)); @@ -839,7 +880,7 @@ Integer classNameID = parseCall(args[1], null, Integer.class); Integer methodNameID = parseCall(args[2], null, Integer.class); - Class c = (Class) store.getObject(classNameID); + Class c = (Class) store.getObject(classNameID); String methodName = (String) store.getObject(methodNameID); Method method = null; @@ -870,7 +911,7 @@ Integer classNameID = parseCall(args[1], null, Integer.class); Integer fieldNameID = parseCall(args[2], null, Integer.class); - Class c = (Class) store.getObject(classNameID); + Class c = (Class) store.getObject(classNameID); String fieldName = (String) store.getObject(fieldNameID); Field field = null; @@ -891,13 +932,14 @@ Integer classID = parseCall(args[2], null, Integer.class); Integer objectID = parseCall(args[3], null, Integer.class); - Object newArray = null; + Object newArray; newArray = Array.newInstance((Class) store.getObject(classID), length); Object[] array = (Object[]) newArray; - for (int i = 0; i < array.length; i++) + for (int i = 0; i < array.length; i++) { array[i] = store.getObject(objectID); + } store.reference(newArray); write(reference, "NewObjectArray " + store.getIdentifier(newArray)); @@ -907,7 +949,7 @@ Integer classID = parseCall(args[1], null, Integer.class); Integer methodID = parseCall(args[2], null, Integer.class); - final Constructor m = (Constructor) store.getObject(methodID); + final Constructor m = (Constructor) store.getObject(methodID); Class[] argTypes = m.getParameterTypes(); Object[] arguments = new Object[argTypes.length]; @@ -918,10 +960,11 @@ final Object[] fArguments = arguments; AccessControlContext acc = callContext != null ? callContext : getClosedAccessControlContext(); - Class c = (Class) store.getObject(classID); + Class c = (Class) store.getObject(classID); checkPermission(src, c, acc); Object ret = AccessController.doPrivileged(new PrivilegedAction() { + @Override public Object run() { try { return m.newInstance(fArguments); @@ -931,8 +974,9 @@ } }, acc); - if (ret instanceof Throwable) + if (ret instanceof Throwable) { throw (Throwable) ret; + } store.reference(ret); @@ -970,6 +1014,7 @@ checkPermission(src, c, acc); Object ret = AccessController.doPrivileged(new PrivilegedAction() { + @Override public Object run() { try { return cons.newInstance(castedArgs); @@ -979,8 +1024,9 @@ } }, acc); - if (ret instanceof Throwable) + if (ret instanceof Throwable) { throw (Throwable) ret; + } store.reference(ret); @@ -1011,7 +1057,7 @@ Integer strlength = parseCall(args[1], null, Integer.class); int bytelength = 2 * strlength; byte[] byteArray = new byte[bytelength]; - String ret = null; + String ret; for (int i = 0; i < strlength; i++) { int c = parseCall(args[2 + i], null, Integer.class); PluginDebug.debug("char ", i, " ", c); @@ -1028,13 +1074,15 @@ } else if (message.startsWith("ExceptionOccurred")) { PluginDebug.debug("EXCEPTION: ", throwable); - if (throwable != null) + if (throwable != null) { store.reference(throwable); + } write(reference, "ExceptionOccurred " + store.getIdentifier(throwable)); } else if (message.startsWith("ExceptionClear")) { - if (throwable != null && store.contains(throwable)) + if (throwable != null && store.contains(throwable)) { store.unreference(store.getIdentifier(throwable)); + } throwable = null; write(reference, "ExceptionClear"); } else if (message.startsWith("DeleteGlobalRef")) { @@ -1084,8 +1132,9 @@ // Store the cause as the actual exception. This is needed because // the exception we get here will always be an // "InvocationTargetException" due to the use of reflection above - if (message.startsWith("CallMethod") || message.startsWith("CallStaticMethod")) + if (message.startsWith("CallMethod") || message.startsWith("CallStaticMethod")) { throwable = t.getCause(); + } } } @@ -1098,7 +1147,7 @@ * @param acc AccessControlContext for this execution * @throws AccessControlException If the script has insufficient permissions */ - public void checkPermission(String jsSrc, Class target, AccessControlContext acc) throws AccessControlException { + public void checkPermission(String jsSrc, Class target, AccessControlContext acc) throws AccessControlException { // NPRuntime does not allow cross-site calling. We therefore always // allow this, for the time being return; @@ -1181,7 +1230,7 @@ private int prepopulateClass(String name) { name = name.replace('/', '.'); ClassLoader cl = liveconnectLoader; - Class c = null; + Class c = null; try { c = cl.loadClass(name); @@ -1200,7 +1249,7 @@ Class c = (Class) store.getObject(classID); Method m = null; - Constructor cs = null; + Constructor cs = null; try { if (methodName.equals("") @@ -1286,8 +1335,9 @@ // do nothing } - if (src.equals("[System]")) + if (src.equals("[System]")) { grantedPermissions.add(new JSObjectCreatePermission()); + } } else { JSObjectCreatePermission perm = new JSObjectCreatePermission(); diff -r f055f0ed886d -r 94ff58f33514 plugin/icedteanp/java/sun/applet/PluginAppletViewer.java --- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Mon Dec 09 13:25:24 2013 +0100 +++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Fri Dec 13 13:28:55 2013 +0100 @@ -111,7 +111,6 @@ import net.sourceforge.jnlp.runtime.JNLPClassLoader; import net.sourceforge.jnlp.security.appletextendedsecurity.AppletSecurityLevel; import net.sourceforge.jnlp.security.appletextendedsecurity.AppletStartupSecuritySettings; -import net.sourceforge.jnlp.security.appletextendedsecurity.ExecuteUnsignedApplet; import net.sourceforge.jnlp.splashscreen.SplashController; import net.sourceforge.jnlp.splashscreen.SplashPanel; import net.sourceforge.jnlp.splashscreen.SplashUtils; @@ -249,14 +248,17 @@ windowEventListener = new WindowAdapter() { + @Override public void windowClosing(WindowEvent evt) { destroyApplet(identifier); } + @Override public void windowIconified(WindowEvent evt) { appletStop(); } + @Override public void windowDeiconified(WindowEvent evt) { appletStart(); } @@ -272,6 +274,7 @@ } + @Override public void replaceSplash(final SplashPanel newSplash) { if (splashPanel == null) { return; @@ -283,6 +286,7 @@ try { SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { splashPanel.getSplashComponent().setVisible(false); splashPanel.stopAnimation(); @@ -309,6 +313,7 @@ try { SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { splashPanel.getSplashComponent().setVisible(false); splashPanel.stopAnimation(); @@ -355,6 +360,7 @@ this.appletViewer = appletViewer; } + @Override public void appletStateChanged(AppletEvent evt) { AppletPanel src = (AppletPanel) evt.getSource(); @@ -386,10 +392,12 @@ // Swing also maintains a Frame list for the AppContext, // so we will have to rearrange it as well. // - if (a != null) + if (a != null) { AppletPanel.changeFrameAppContext(frame, SunToolkit.targetToAppContext(a)); - else + } + else { AppletPanel.changeFrameAppContext(frame, AppContext.getAppContext()); + } updateStatus(appletViewer.identifier, PAV_INIT_STATUS.INIT_COMPLETE); @@ -434,8 +442,9 @@ // If there is a key for this status, it means it // was either initialized before, or destroy has been // processed. Stop moving further. - if (updateStatus(identifier, PAV_INIT_STATUS.PRE_INIT) != null) + if (updateStatus(identifier, PAV_INIT_STATUS.PRE_INIT) != null) { return; + } // Extract the information from the message String[] msgParts = new String[4]; @@ -542,8 +551,9 @@ ; // don't bother processing further for inactive applets - if (status.get(identifier).equals(PAV_INIT_STATUS.INACTIVE)) + if (status.get(identifier).equals(PAV_INIT_STATUS.INACTIVE)) { return; + } applets.get(identifier).handleMessage(reference, message); } @@ -639,6 +649,7 @@ PluginDebug.debug("Attempting to destroy panel ", identifier); SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { pav.appletClose(); } @@ -693,6 +704,7 @@ try { SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { setSize(width, height); @@ -764,6 +776,7 @@ /** * Get an audio clip. */ + @Override public AudioClip getAudioClip(URL url) { checkConnect(url); synchronized (audioClips) { @@ -780,6 +793,7 @@ /** * Get an image. */ + @Override public Image getImage(URL url) { return getCachedImage(url); } @@ -808,8 +822,9 @@ JNLPClassLoader loader = (JNLPClassLoader) panel.getAppletClassLoader(); URL localURL = null; - if (loader.resourceAvailableLocally(resourceName)) + if (loader.resourceAvailableLocally(resourceName)) { url = loader.getResource(resourceName); + } url = localURL != null ? localURL : url; } @@ -843,6 +858,7 @@ /** * Get an applet by name. */ + @Override public Applet getApplet(String name) { name = name.toLowerCase(); SocketPermission panelSp = @@ -873,6 +889,7 @@ * Return an enumeration of all the accessible * applets on this page. */ + @Override public Enumeration getApplets() { Vector v = new Vector(); SocketPermission panelSp = @@ -897,6 +914,7 @@ /** * Ignore. */ + @Override public void showDocument(URL url) { PluginDebug.debug("Showing document..."); showDocument(url, "_self"); @@ -905,6 +923,7 @@ /** * Ignore. */ + @Override public void showDocument(URL url, String target) { try { Long reference = getRequestIdentifier(); @@ -919,6 +938,7 @@ /** * Show status. */ + @Override public void showStatus(String status) { try { // FIXME: change to postCallRequest @@ -1113,8 +1133,9 @@ PluginDebug.debug("wait eval request 1"); synchronized (request) { PluginDebug.debug("wait eval request 2"); - while (request.isDone() == false) + while (request.isDone() == false) { request.wait(); + } PluginDebug.debug("wait eval request 3"); } } catch (InterruptedException e) { @@ -1178,8 +1199,9 @@ PluginDebug.debug("wait call request 1"); synchronized (request) { PluginDebug.debug("wait call request 2"); - while (request.isDone() == false) + while (request.isDone() == false) { request.wait(); + } PluginDebug.debug("wait call request 3"); } } catch (InterruptedException e) { @@ -1213,8 +1235,9 @@ PluginDebug.debug("wait cookieinfo request 1"); synchronized (request) { PluginDebug.debug("wait cookieinfo request 2"); - while (request.isDone() == false) + while (request.isDone() == false) { request.wait(); + } PluginDebug.debug("wait cookieinfo request 3"); } } catch (InterruptedException e) { @@ -1259,8 +1282,9 @@ PluginDebug.debug("wait call request 1"); synchronized (request) { PluginDebug.debug("wait call request 2"); - while (request.isDone() == false) + while (request.isDone() == false) { request.wait(); + } PluginDebug.debug("wait call request 3"); } } catch (InterruptedException e) { @@ -1285,8 +1309,9 @@ PluginDebug.debug("wait finalize request 1"); synchronized (request) { PluginDebug.debug("wait finalize request 2"); - while (request.isDone() == false) + while (request.isDone() == false) { request.wait(); + } PluginDebug.debug("wait finalize request 3"); } } catch (InterruptedException e) { @@ -1325,6 +1350,7 @@ PluginDebug.debug("WRITING 2 DONE"); } + @Override public void setStream(String key, InputStream stream) throws IOException { // We do nothing. } @@ -1405,6 +1431,7 @@ } AccessController.doPrivileged(new PrivilegedAction() { + @Override public Void run() { ((AppletViewerPanel)panel).createAppletThread(); return null; @@ -1416,6 +1443,7 @@ panel.sendEvent(AppletPanel.APPLET_START); } + @Override public int print(Graphics graphics, PageFormat pf, int pageIndex) { return Printable.NO_SUCH_PAGE; } @@ -1461,13 +1489,15 @@ new Thread(new Runnable() { @SuppressWarnings("deprecation") + @Override public void run() { ClassLoader cl = p.applet.getClass().getClassLoader(); // Since we want to deal with JNLPClassLoader, extract it if this // is a codebase loader - if (cl instanceof JNLPClassLoader.CodeBaseClassLoader) + if (cl instanceof JNLPClassLoader.CodeBaseClassLoader) { cl = ((JNLPClassLoader.CodeBaseClassLoader) cl).getParentJNLPClassLoader(); + } appletShutdown(p); appletPanels.removeElement(p); @@ -1477,6 +1507,7 @@ try { SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { dispose(); } @@ -1517,10 +1548,12 @@ try { java.security.Permission perm = url.openConnection().getPermission(); - if (perm != null) + if (perm != null) { security.checkPermission(perm); - else + } + else { security.checkConnect(url.getHost(), url.getPort()); + } } catch (java.io.IOException ioe) { security.checkConnect(url.getHost(), url.getPort()); } @@ -1534,6 +1567,7 @@ * the parent class's update() just does a couple of checks (both of * which are accounted for) and then calls paint anyway. */ + @Override public void paint(Graphics g) { // If the image or the graphics don't exist, create new ones @@ -1576,8 +1610,9 @@ long timeout) { // Can't wait on null. Return 0 indicating no wait happened. - if (lock == null) - return 0; + if (lock == null) { + return 0; + } assert lock.isHeldByCurrentThread(); @@ -1601,6 +1636,7 @@ this.fPanel = fPanel; } + @Override public void run() { add("Center", fPanel); fPanel.setVisible(false); diff -r f055f0ed886d -r 94ff58f33514 tests/junit-runner/CommandLine.java --- a/tests/junit-runner/CommandLine.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/junit-runner/CommandLine.java Fri Dec 13 13:28:55 2013 +0100 @@ -45,7 +45,7 @@ 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 -r f055f0ed886d -r 94ff58f33514 tests/junit-runner/JunitLikeXmlOutputListener.java --- a/tests/junit-runner/JunitLikeXmlOutputListener.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/junit-runner/JunitLikeXmlOutputListener.java Fri Dec 13 13:28:55 2013 +0100 @@ -80,7 +80,7 @@ private class ClassStat { - Class c; + Class c; int total; int failed; int passed; @@ -178,8 +178,9 @@ } + @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 @@ } @Override + @SuppressWarnings("unchecked") public void testRunFinished(Result result) throws Exception { writeElement(SOUT_ELEMENT, "@sout@"); @@ -335,7 +337,7 @@ 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 -r f055f0ed886d -r 94ff58f33514 tests/junit-runner/LessVerboseTextListener.java --- a/tests/junit-runner/LessVerboseTextListener.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/junit-runner/LessVerboseTextListener.java Fri Dec 13 13:28:55 2013 +0100 @@ -114,11 +114,12 @@ } } - - public static T getAnnotation(Class q, String methodName, Class a) { + + @SuppressWarnings("unchecked") + public static T getAnnotation(Class q, String methodName, Class 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 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 -r f055f0ed886d -r 94ff58f33514 tests/netx/unit/net/sourceforge/jnlp/ParserCornerCases.java --- a/tests/netx/unit/net/sourceforge/jnlp/ParserCornerCases.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/netx/unit/net/sourceforge/jnlp/ParserCornerCases.java Fri Dec 13 13:28:55 2013 +0100 @@ -83,7 +83,7 @@ ""; XMLElement elem = new XMLElement(); elem.parseFromReader(new StringReader(data)); - XMLElement target = (XMLElement) ((XMLElement) elem.enumerateChildren().nextElement()).enumerateChildren().nextElement(); + XMLElement target = (elem.enumerateChildren().nextElement()).enumerateChildren().nextElement(); Assert.assertEquals("argument", target.getName()); Assert.assertTrue("too small", target.getContent().length() > 20); Assert.assertTrue(target.getContent().contains("xml")); diff -r f055f0ed886d -r 94ff58f33514 tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java --- a/tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java Fri Dec 13 13:28:55 2013 +0100 @@ -32,10 +32,10 @@ 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 -r f055f0ed886d -r 94ff58f33514 tests/netx/unit/net/sourceforge/jnlp/resources/MessagesPropertiesTest.java --- a/tests/netx/unit/net/sourceforge/jnlp/resources/MessagesPropertiesTest.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/netx/unit/net/sourceforge/jnlp/resources/MessagesPropertiesTest.java Fri Dec 13 13:28:55 2013 +0100 @@ -175,7 +175,7 @@ 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 @@ 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 @@ 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 @@ 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 -r f055f0ed886d -r 94ff58f33514 tests/netx/unit/net/sourceforge/jnlp/splashscreen/ErrorSplashUtilsTest.java --- a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/ErrorSplashUtilsTest.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/ErrorSplashUtilsTest.java Fri Dec 13 13:28:55 2013 +0100 @@ -44,11 +44,11 @@ public class ErrorSplashUtilsTest { - private void fakeEnvironment(Map original) throws Exception { + private void fakeEnvironment(Map original) throws Exception { SplashUtilsTest.fakeEnvironment(original); } - private Map getEnvironment() throws Exception { + private Map getEnvironment() throws Exception { return SplashUtilsTest.getEnvironment(); } @@ -64,8 +64,8 @@ @Test public void testgetErrorSplashScreen1() throws Exception { - Map fake1 = new HashMap(); - Map original = getEnvironment(); + Map fake1 = new HashMap(); + Map original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -85,10 +85,10 @@ @Test public void testgetErrorSplashScreen2() throws Exception { - Map fake1 = new HashMap(); + Map fake1 = new HashMap(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.DEFAULT); - Map original = getEnvironment(); + Map original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -107,10 +107,10 @@ @Test public void testgetErrorSplashScreen3() throws Exception { - Map fake1 = new HashMap(); + Map fake1 = new HashMap(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.NONE); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.DEFAULT); - Map original = getEnvironment(); + Map original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -129,10 +129,10 @@ @Test public void testgetErrorSplashScreen4() throws Exception { - Map fake1 = new HashMap(); + Map fake1 = new HashMap(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.NONE); - Map original = getEnvironment(); + Map original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -151,10 +151,10 @@ @Test public void testgetErrorSplashScreen5() throws Exception { - Map fake1 = new HashMap(); + Map fake1 = new HashMap(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.NONE); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.NONE); - Map original = getEnvironment(); + Map original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -170,10 +170,10 @@ @Test public void testgetErrorSplashScreen6() throws Exception { - Map fake1 = new HashMap(); + Map fake1 = new HashMap(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, "fgdthyfjtuk"); - Map original = getEnvironment(); + Map original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -192,9 +192,9 @@ @Test public void testgetErrorSplashScreen7() throws Exception { - Map fake1 = new HashMap(); + Map fake1 = new HashMap(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, "egtrutkyukl"); - Map original = getEnvironment(); + Map original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); diff -r f055f0ed886d -r 94ff58f33514 tests/netx/unit/net/sourceforge/jnlp/splashscreen/SplashUtilsTest.java --- a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/SplashUtilsTest.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/SplashUtilsTest.java Fri Dec 13 13:28:55 2013 +0100 @@ -59,10 +59,11 @@ Assert.assertEquals(SplashUtils.SplashReason.JAVAWS, p2.getSplashReason()); } + @SuppressWarnings("unchecked") public static Map getEnvironment() throws Exception { - Class[] classes = Collections.class.getDeclaredClasses(); + Class[] classes = Collections.class.getDeclaredClasses(); Map 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 @@ return null; } + @SuppressWarnings("unchecked") public static void fakeEnvironment(Map newenv) throws Exception { - Class[] classes = Collections.class.getDeclaredClasses(); + Class[] classes = Collections.class.getDeclaredClasses(); Map 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 @@ @Test public void testGetSplashScreen1() throws Exception { - Map fake1 = new HashMap(); - Map original = getEnvironment(); + Map fake1 = new HashMap(); + Map original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -112,10 +114,10 @@ @Test public void testGetSplashScreen2() throws Exception { - Map fake1 = new HashMap(); + Map fake1 = new HashMap(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.DEFAULT); - Map original = getEnvironment(); + Map original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -134,10 +136,10 @@ @Test public void testGetSplashScreen3() throws Exception { - Map fake1 = new HashMap(); + Map fake1 = new HashMap(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.NONE); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.DEFAULT); - Map original = getEnvironment(); + Map original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -156,10 +158,10 @@ @Test public void testGetSplashScreen4() throws Exception { - Map fake1 = new HashMap(); + Map fake1 = new HashMap(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.NONE); - Map original = getEnvironment(); + Map original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -178,10 +180,10 @@ @Test public void testGetSplashScreen5() throws Exception { - Map fake1 = new HashMap(); + Map fake1 = new HashMap(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.NONE); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.NONE); - Map original = getEnvironment(); + Map original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -197,10 +199,10 @@ @Test public void testGetSplashScreen6() throws Exception { - Map fake1 = new HashMap(); + Map fake1 = new HashMap(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, "fgdthyfjtuk"); - Map original = getEnvironment(); + Map original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -219,9 +221,9 @@ @Test public void testGetSplashScreen7() throws Exception { - Map fake1 = new HashMap(); + Map fake1 = new HashMap(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, "egtrutkyukl"); - Map original = getEnvironment(); + Map original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); diff -r f055f0ed886d -r 94ff58f33514 tests/netx/unit/net/sourceforge/jnlp/splashscreen/parts/DescriptionInfoItemTest.java --- a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/parts/DescriptionInfoItemTest.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/parts/DescriptionInfoItemTest.java Fri Dec 13 13:28:55 2013 +0100 @@ -36,8 +36,8 @@ 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 -r f055f0ed886d -r 94ff58f33514 tests/netx/unit/net/sourceforge/jnlp/util/UrlUtilsTest.java --- a/tests/netx/unit/net/sourceforge/jnlp/util/UrlUtilsTest.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/netx/unit/net/sourceforge/jnlp/util/UrlUtilsTest.java Fri Dec 13 13:28:55 2013 +0100 @@ -42,8 +42,6 @@ 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 @@ 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 -r f055f0ed886d -r 94ff58f33514 tests/netx/unit/net/sourceforge/jnlp/util/XDesktopEntryTest.java --- a/tests/netx/unit/net/sourceforge/jnlp/util/XDesktopEntryTest.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/netx/unit/net/sourceforge/jnlp/util/XDesktopEntryTest.java Fri Dec 13 13:28:55 2013 +0100 @@ -88,7 +88,7 @@ backupedEnv = null; } else { backupedEnv = env; - Map m = new HashMap(env); + Map m = new HashMap(env); m.put(HOME, System.getProperty("user.home")); fakeEnvironment(m); ServerAccess.logOutputReprint("Hacked environment"); @@ -106,7 +106,7 @@ } } - private static void fakeEnvironment(Map m) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException, ClassNotFoundException { + private static void fakeEnvironment(Map m) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException, ClassNotFoundException { Class processEnvironmentClass = Class.forName("java.lang.ProcessEnvironment"); Field env = processEnvironmentClass.getDeclaredField("theUnmodifiableEnvironment"); env.setAccessible(true); diff -r f055f0ed886d -r 94ff58f33514 tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64EncoderTest.java --- a/tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64EncoderTest.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64EncoderTest.java Fri Dec 13 13:28:55 2013 +0100 @@ -108,7 +108,7 @@ private static Object createInsatnce(String ofCalss) throws ClassNotFoundException, InstantiationException, IllegalAccessException { - Class classDefinition = Class.forName(ofCalss); + Class classDefinition = Class.forName(ofCalss); return classDefinition.newInstance(); } diff -r f055f0ed886d -r 94ff58f33514 tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java --- a/tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java Fri Dec 13 13:28:55 2013 +0100 @@ -164,7 +164,7 @@ 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 -r f055f0ed886d -r 94ff58f33514 tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java --- a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java Fri Dec 13 13:28:55 2013 +0100 @@ -804,9 +804,9 @@ } //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 -r f055f0ed886d -r 94ff58f33514 tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java --- a/tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java Fri Dec 13 13:28:55 2013 +0100 @@ -118,9 +118,8 @@ } } catch (Exception ex) { ex.printStackTrace(); - } finally { - return commandLine; } + return commandLine; } public Process getP() { diff -r f055f0ed886d -r 94ff58f33514 tests/test-extensions/net/sourceforge/jnlp/awt/AWTHelper.java --- a/tests/test-extensions/net/sourceforge/jnlp/awt/AWTHelper.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/test-extensions/net/sourceforge/jnlp/awt/AWTHelper.java Fri Dec 13 13:28:55 2013 +0100 @@ -42,7 +42,6 @@ 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 @@ * * @return */ - public Rule getInitStrAsRule(){ + public Rule getInitStrAsRule(){ if( initStr != null ){ return new ContainsRule(this.initStr); }else{ - return new Rule(){ + return new Rule(){ @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 -r f055f0ed886d -r 94ff58f33514 tests/test-extensions/net/sourceforge/jnlp/awt/awtactions/KeyboardActions.java --- a/tests/test-extensions/net/sourceforge/jnlp/awt/awtactions/KeyboardActions.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/test-extensions/net/sourceforge/jnlp/awt/awtactions/KeyboardActions.java Fri Dec 13 13:28:55 2013 +0100 @@ -98,9 +98,9 @@ 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 -r f055f0ed886d -r 94ff58f33514 tests/test-extensions/net/sourceforge/jnlp/closinglisteners/RulesFolowingClosingListener.java --- a/tests/test-extensions/net/sourceforge/jnlp/closinglisteners/RulesFolowingClosingListener.java Mon Dec 09 13:25:24 2013 +0100 +++ b/tests/test-extensions/net/sourceforge/jnlp/closinglisteners/RulesFolowingClosingListener.java Fri Dec 13 13:28:55 2013 +0100 @@ -42,7 +42,7 @@ public class RulesFolowingClosingListener extends CountingClosingListener { - private List rules = new ArrayList(); + private List> rules = new ArrayList>(); public static class ContainsRule extends StringRule { @@ -176,19 +176,19 @@ public RulesFolowingClosingListener() { } - public RulesFolowingClosingListener(List l) { + public RulesFolowingClosingListener(List> l) { addRules(l); } - public RulesFolowingClosingListener(Rule... l) { + public RulesFolowingClosingListener(Rule... l) { addRules(l); } - public List getRules() { + public List> getRules() { return rules; } - public void setRules(List rules) { + public void setRules(List> rules) { if (rules == null) { throw new NullPointerException("rules cant be null"); } @@ -199,14 +199,14 @@ * no more rules will be possible to add by doing this * @param rules */ - public void setRules(Rule[] rules) { + public void setRules(Rule[] rules) { if (rules == null) { throw new NullPointerException("rules cant be null"); } this.rules = Arrays.asList(rules); } - public RulesFolowingClosingListener addRules(List rules) { + final public RulesFolowingClosingListener addRules(List> rules) { if (rules == null) { throw new NullPointerException("rules cant be null"); } @@ -214,7 +214,7 @@ return this; } - public RulesFolowingClosingListener addRules(Rule... rules) { + final public RulesFolowingClosingListener addRules(Rule... rules) { if (rules == null) { throw new NullPointerException("rules cant be null"); } @@ -227,7 +227,7 @@ if (rules == null || rules.size() < 1) { throw new IllegalStateException("No rules specified"); } - for (Rule rule : rules) { + for (Rule rule : rules) { if (!rule.evaluate(content)) { return false; }