Mercurial > hg > release > icedtea-web-1.6
changeset 1179:ed0b9abe24d7
Added support for Entry-Point manifest
* netx/net/sourceforge/jnlp/JNLPFile.java: defined ENTRY_POINT. Added methodsto get raw manifest, or list of possible entry points.
* netx/net/sourceforge/jnlp/runtime/ManifestAttributesChecker.java: Added logic to check real main class against manifest attribute.
* tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java: Existing tests made aware about Entry-Point. Added tests for splitEntryPoints. All occurences of claslaoder repalced by classloader.
author | Jiri Vanek <jvanek@redhat.com> |
---|---|
date | Wed, 18 Mar 2015 16:50:54 +0100 |
parents | d0f564b96c10 |
children | b8689b23ce0b |
files | ChangeLog NEWS netx/net/sourceforge/jnlp/JNLPFile.java netx/net/sourceforge/jnlp/runtime/ManifestAttributesChecker.java plugin/icedteanp/java/sun/applet/PluginAppletViewer.java tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPFileTest.java tests/test-extensions/net/sourceforge/jnlp/util/logging/NoStdOutErrTest.java |
diffstat | 8 files changed, 152 insertions(+), 57 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Mar 17 12:01:51 2015 -0400 +++ b/ChangeLog Wed Mar 18 16:50:54 2015 +0100 @@ -1,3 +1,14 @@ +2015-03-18 Jiri Vanek <jvanek@redhat.com> + + Added support for Entry-Point manifest + * netx/net/sourceforge/jnlp/JNLPFile.java: defined ENTRY_POINT. Added methods + to get raw manifest, or list of possible entry points. + * netx/net/sourceforge/jnlp/runtime/ManifestAttributesChecker.java: Added logic + to check real main class against manifest attribute. + * tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java: Existing tests made + aware about Entry-Point. Added tests for splitEntryPoints. All occurences of + claslaoder repalced by classloader. + 2015-03-17 Jie Kang <jkang@redhat.com> Escape apostrophes in Messages.properties
--- a/NEWS Tue Mar 17 12:01:51 2015 -0400 +++ b/NEWS Wed Mar 18 16:50:54 2015 +0100 @@ -13,7 +13,8 @@ * Improved to be able to run with any JDK * JDK 6 and older no longer supported * JDK 8 support added (URLPermission granted if applicable) -* Added DE localisation +* JDK 9 supported +* Added support for Entry-Point manifest attribute * Added KEY_ENABLE_MANIFEST_ATTRIBUTES_CHECK deployment property to control scan of Manifest file * starting arguments now accept also -- abbreviations * Control Panel
--- a/netx/net/sourceforge/jnlp/JNLPFile.java Tue Mar 17 12:01:51 2015 -0400 +++ b/netx/net/sourceforge/jnlp/JNLPFile.java Wed Mar 18 16:50:54 2015 +0100 @@ -900,6 +900,8 @@ public static final String CODEBASE = "Codebase"; public static final String TRUSTED_ONLY = "Trusted-Only"; public static final String TRUSTED_LIBRARY = "Trusted-Library"; + public static final String ENTRY_POINT="Entry-Point"; + private JNLPClassLoader loader; @@ -925,6 +927,18 @@ return loader.getMainClass(); } + /** + * + * http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/security/manifest.html#entry_pt + */ + public String[] getEntryPoints() { + return splitEntryPoints(getEntryPointString()); + } + + public String getEntryPointString() { + return getAttribute(ENTRY_POINT); + } + /** * http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/manifest.html#app_name */ @@ -1047,8 +1061,8 @@ } } } - } - + } + public String createJnlpVendorValue() { final String location; if (getSourceLocation() != null) { @@ -1088,7 +1102,18 @@ return createJnlpTitleValue(); } return getTitle() + " from " + createJnlpTitleValue(); - + } + + //not private for testing purposes + static String[] splitEntryPoints(String entryPointString) { + if (entryPointString == null || entryPointString.trim().isEmpty()) { + return null; + } + String[] result = entryPointString.trim().split("\\s+"); + if (result.length == 0) { + return null; + } + return result; } }
--- a/netx/net/sourceforge/jnlp/runtime/ManifestAttributesChecker.java Tue Mar 17 12:01:51 2015 -0400 +++ b/netx/net/sourceforge/jnlp/runtime/ManifestAttributesChecker.java Wed Mar 18 16:50:54 2015 +0100 @@ -82,6 +82,7 @@ checkCodebaseAttribute(); checkPermissionsAttribute(); checkApplicationLibraryAllowableCodebaseAttribute(); + checkEntryPoint(); } else { OutputController.getLogger().log(OutputController.Level.WARNING_ALL, MANIFEST_CHECK_DISABLED_MESSAGE); } @@ -91,6 +92,36 @@ final String deploymentProperty = JNLPRuntime.getConfiguration().getProperty(DeploymentConfiguration.KEY_ENABLE_MANIFEST_ATTRIBUTES_CHECK); return Boolean.parseBoolean(deploymentProperty); } + + /* + * http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/security/manifest.html#entry_pt + */ + private void checkEntryPoint() throws LaunchException { + if (signing == SigningState.NONE) { + return; /*when app is not signed at all, then skip this check*/ + } + if (file.getLaunchInfo() == null) { + OutputController.getLogger().log(OutputController.Level.MESSAGE_DEBUG, "Entry-Point can not be checked now, because of not existing launch info."); + return; + } + if (file.getLaunchInfo().getMainClass() == null) { + OutputController.getLogger().log(OutputController.Level.MESSAGE_DEBUG, "Entry-Point can not be checked now, because of unknown main class."); + return; + } + final String[] eps = file.getManifestsAttributes().getEntryPoints(); + String mainClass = file.getLaunchInfo().getMainClass(); + if (eps == null) { + OutputController.getLogger().log(OutputController.Level.MESSAGE_DEBUG, "Entry-Point manifest attribute for yours '" + mainClass + "'not found. Continuing."); + return; + } + for (String ep : eps) { + if (ep.equals(mainClass)) { + OutputController.getLogger().log(OutputController.Level.MESSAGE_DEBUG, "Entry-Point of " + ep + " mathches " + mainClass + " continuing."); + return; + } + } + throw new LaunchException("None of the entry points specified: '" + file.getManifestsAttributes().getEntryPointString() + "' matched the main class " + mainClass + " and apelt is signed. This is a security error and the app will not be launched."); + } /** * http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/security/manifest.html#trusted_only
--- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Tue Mar 17 12:01:51 2015 -0400 +++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Wed Mar 18 16:50:54 2015 +0100 @@ -1414,7 +1414,7 @@ panel.sendEvent(AppletPanel.APPLET_DISPOSE); /** - * Fixed #4501142: Classlaoder sharing policy doesn't + * Fixed #4501142: Classloader sharing policy doesn't * take "archive" into account. This will be overridden * by Java Plug-in. [stanleyh] */
--- a/tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java Tue Mar 17 12:01:51 2015 -0400 +++ b/tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java Wed Mar 18 16:50:54 2015 +0100 @@ -360,4 +360,25 @@ JNLPFile jnlpFile = new JNLPFile(is, codeBase, new ParserSettings(false, false, false)); Assert.assertEquals(SecurityDesc.RequestedPermissionLevel.NONE, jnlpFile.getRequestedPermissionLevel()); } + + @Test + public void splitEmptyEntryPointsReturnsTests() throws Exception { + Assert.assertArrayEquals(null, JNLPFile.splitEntryPoints(" ")); + Assert.assertArrayEquals(null, JNLPFile.splitEntryPoints(null)); + } + + @Test + public void ensureSingleEntryPointIsParsed() throws Exception { + Assert.assertArrayEquals(new String[]{"a.b.c"}, JNLPFile.splitEntryPoints(" a.b.c ")); + Assert.assertArrayEquals(new String[]{"a.b.c"}, JNLPFile.splitEntryPoints("a.b.c")); + Assert.assertArrayEquals(new String[]{"a.b.c"}, JNLPFile.splitEntryPoints(" a.b.c")); + Assert.assertArrayEquals(new String[]{"a.b.c"}, JNLPFile.splitEntryPoints("a.b.c ")); + } + + @Test + public void ensureMultipleEntryPointsAreParsed() throws Exception { + Assert.assertArrayEquals(new String[]{"a.b.c", "cde"}, JNLPFile.splitEntryPoints(" a.b.c cde")); + Assert.assertArrayEquals(new String[]{"a.b.c", "cde"}, JNLPFile.splitEntryPoints(" a.b.c cde ")); + Assert.assertArrayEquals(new String[]{"a.b.c", "cde"}, JNLPFile.splitEntryPoints("a.b.c cde ")); + } }
--- a/tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPFileTest.java Tue Mar 17 12:01:51 2015 -0400 +++ b/tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPFileTest.java Wed Mar 18 16:50:54 2015 +0100 @@ -91,25 +91,26 @@ FileTestUtils.createJarWithContents(jarLocation77, manifest77); final DummyJNLPFileWithJar jnlpFile = new DummyJNLPFileWithJar(0, jarLocation66, jarLocation77); //jar 6 should be main - final JNLPClassLoader classLoader = new JNLPClassLoader(jnlpFile, UpdatePolicy.ALWAYS);//jnlp file got its instance in classlaoders constructor + final JNLPClassLoader classLoader = new JNLPClassLoader(jnlpFile, UpdatePolicy.ALWAYS);//jnlp file got its instance in classloaders constructor //jnlpFile.getManifestsAttributes().setLoader(classLoader); //classloader set, but no att specified - Assert.assertNull("classlaoder attached, but should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_NAME))); - Assert.assertNull("classlaoder attached, but should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_LIBRARY_ALLOWABLE))); - Assert.assertNull("classlaoder attached, but should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.CALLER_ALLOWABLE))); - Assert.assertNull("classlaoder attached, but should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.CODEBASE))); - Assert.assertNull("classlaoder attached, but should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.PERMISSIONS))); - Assert.assertNull("classlaoder attached, but should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.TRUSTED_LIBRARY))); - Assert.assertNull("classlaoder attached, but should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.TRUSTED_ONLY))); + Assert.assertNull("classloader attached, but should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_NAME))); + Assert.assertNull("classloader attached, but should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_LIBRARY_ALLOWABLE))); + Assert.assertNull("classloader attached, but should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.CALLER_ALLOWABLE))); + Assert.assertNull("classloader attached, but should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.CODEBASE))); + Assert.assertNull("classloader attached, but should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.PERMISSIONS))); + Assert.assertNull("classloader attached, but should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.TRUSTED_LIBRARY))); + Assert.assertNull("classloader attached, but should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.TRUSTED_ONLY))); + Assert.assertNull("classloader attached, but should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.ENTRY_POINT))); - Assert.assertNull("classlaoder attached, but should be null", jnlpFile.getManifestsAttributes().getMainClass()); - Assert.assertNull("classlaoder attached, but should be null", jnlpFile.getManifestsAttributes().getApplicationName()); - Assert.assertNull("classlaoder attached, but should be null", jnlpFile.getManifestsAttributes().getApplicationLibraryAllowableCodebase()); - Assert.assertNull("classlaoder attached, but should be null", jnlpFile.getManifestsAttributes().getCallerAllowableCodebase()); - Assert.assertNull("classlaoder attached, but should be null", jnlpFile.getManifestsAttributes().getCodebase()); - Assert.assertEquals("no classlaoder attached, should be null", JNLPFile.ManifestBoolean.UNDEFINED, jnlpFile.getManifestsAttributes().isSandboxForced()); - Assert.assertEquals("no classlaoder attached, should be null", JNLPFile.ManifestBoolean.UNDEFINED, jnlpFile.getManifestsAttributes().isTrustedLibrary()); - Assert.assertEquals("no classlaoder attached, should be null", JNLPFile.ManifestBoolean.UNDEFINED, jnlpFile.getManifestsAttributes().isTrustedOnly()); + Assert.assertNull("classloader attached, but should be null", jnlpFile.getManifestsAttributes().getMainClass()); + Assert.assertNull("classloader attached, but should be null", jnlpFile.getManifestsAttributes().getApplicationName()); + Assert.assertNull("classloader attached, but should be null", jnlpFile.getManifestsAttributes().getApplicationLibraryAllowableCodebase()); + Assert.assertNull("classloader attached, but should be null", jnlpFile.getManifestsAttributes().getCallerAllowableCodebase()); + Assert.assertNull("classloader attached, but should be null", jnlpFile.getManifestsAttributes().getCodebase()); + Assert.assertEquals("no classloader attached, should be null", JNLPFile.ManifestBoolean.UNDEFINED, jnlpFile.getManifestsAttributes().isSandboxForced()); + Assert.assertEquals("no classloader attached, should be null", JNLPFile.ManifestBoolean.UNDEFINED, jnlpFile.getManifestsAttributes().isTrustedLibrary()); + Assert.assertEquals("no classloader attached, should be null", JNLPFile.ManifestBoolean.UNDEFINED, jnlpFile.getManifestsAttributes().isTrustedOnly()); } @Test @@ -123,6 +124,7 @@ Manifest manifest6 = new Manifest(); manifest6.getMainAttributes().put(Attributes.Name.MAIN_CLASS, "DummyClass1"); //see DummyJNLPFileWithJar constructor with int manifest6.getMainAttributes().put(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_NAME), "DummyClass1 title"); + manifest6.getMainAttributes().put(new Attributes.Name(JNLPFile.ManifestsAttributes.ENTRY_POINT), "main1 main2"); manifest6.getMainAttributes().put(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_LIBRARY_ALLOWABLE), "*.com https://*.cz"); manifest6.getMainAttributes().put(new Attributes.Name(JNLPFile.ManifestsAttributes.CALLER_ALLOWABLE), "*.net ftp://*uu.co.uk"); manifest6.getMainAttributes().put(new Attributes.Name(JNLPFile.ManifestsAttributes.CODEBASE), "*.com *.net *.cz *.co.uk"); @@ -154,28 +156,29 @@ final DummyJNLPFileWithJar jnlpFile = new DummyJNLPFileWithJar(1, jarLocation7, jarLocation6); //jar 6 should be main. Jar 7 have wrong items, but they are never laoded as in main jar are the correct one final DummyJNLPFileWithJar errorJnlpFile = new DummyJNLPFileWithJar(0, jarLocation7); //jar 7 should be main - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_NAME))); - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_LIBRARY_ALLOWABLE))); - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.CALLER_ALLOWABLE))); - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.CODEBASE))); - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.PERMISSIONS))); - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.TRUSTED_LIBRARY))); - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.TRUSTED_ONLY))); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_NAME))); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.ENTRY_POINT))); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_LIBRARY_ALLOWABLE))); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.CALLER_ALLOWABLE))); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.CODEBASE))); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.PERMISSIONS))); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.TRUSTED_LIBRARY))); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.TRUSTED_ONLY))); - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getApplicationName()); - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getApplicationLibraryAllowableCodebase()); - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getCallerAllowableCodebase()); - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getCodebase()); - Assert.assertEquals("no classlaoder attached, should be null", JNLPFile.ManifestBoolean.UNDEFINED, jnlpFile.getManifestsAttributes().isSandboxForced()); - Assert.assertEquals("no classlaoder attached, should be null", JNLPFile.ManifestBoolean.UNDEFINED, jnlpFile.getManifestsAttributes().isTrustedLibrary()); - Assert.assertEquals("no classlaoder attached, should be null", JNLPFile.ManifestBoolean.UNDEFINED, jnlpFile.getManifestsAttributes().isTrustedOnly()); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getApplicationName()); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getApplicationLibraryAllowableCodebase()); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getCallerAllowableCodebase()); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getCodebase()); + Assert.assertEquals("no classloader attached, should be null", JNLPFile.ManifestBoolean.UNDEFINED, jnlpFile.getManifestsAttributes().isSandboxForced()); + Assert.assertEquals("no classloader attached, should be null", JNLPFile.ManifestBoolean.UNDEFINED, jnlpFile.getManifestsAttributes().isTrustedLibrary()); + Assert.assertEquals("no classloader attached, should be null", JNLPFile.ManifestBoolean.UNDEFINED, jnlpFile.getManifestsAttributes().isTrustedOnly()); - final JNLPClassLoader classLoader = new JNLPClassLoader(jnlpFile, UpdatePolicy.ALWAYS); //jnlp file got its instance in classlaoders constructor + final JNLPClassLoader classLoader = new JNLPClassLoader(jnlpFile, UpdatePolicy.ALWAYS); //jnlp file got its instance in classloaders constructor //jnlpFile.getManifestsAttributes().setLoader(classLoader); Exception ex = null; try { - final JNLPClassLoader errorClassLoader = new JNLPClassLoader(errorJnlpFile, UpdatePolicy.ALWAYS);//jnlp file got its instance in classlaoders constructor + final JNLPClassLoader errorClassLoader = new JNLPClassLoader(errorJnlpFile, UpdatePolicy.ALWAYS);//jnlp file got its instance in classloaders constructor //errorJnlpFile.getManifestsAttributes().setLoader(errorClassLoader); } catch (Exception e){ //correct exception @@ -184,6 +187,7 @@ Assert.assertNotNull(ex); Assert.assertEquals("DummyClass1 title", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_NAME))); + Assert.assertEquals("main1 main2", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.ENTRY_POINT))); Assert.assertEquals("*.com https://*.cz", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_LIBRARY_ALLOWABLE))); Assert.assertEquals("*.net ftp://*uu.co.uk", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.CALLER_ALLOWABLE))); Assert.assertEquals("*.com *.net *.cz *.co.uk", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.CODEBASE))); @@ -194,6 +198,7 @@ Assert.assertNull(errorJnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_NAME))); + Assert.assertNull(errorJnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.ENTRY_POINT))); Assert.assertNull(errorJnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_LIBRARY_ALLOWABLE))); Assert.assertNull(errorJnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.CALLER_ALLOWABLE))); Assert.assertNull(errorJnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.CODEBASE))); @@ -243,6 +248,7 @@ } + @Test public void removeTitle() throws Exception { File tempDirectory = FileTestUtils.createTempDirectory(); @@ -281,13 +287,13 @@ FileTestUtils.createJarWithContents(jarLocation5, manifest5); final DummyJNLPFileWithJar jnlpFile = new DummyJNLPFileWithJar(3, jarLocation5, jarLocation3, jarLocation4, jarLocation1, jarLocation2); //jar 1 should be main - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getMainClass()); - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_VENDOR)); - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_TITLE)); - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.MAIN_CLASS)); - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_VENDOR_ID)); - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_URL)); - Assert.assertNull("no classlaoder attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_NAME))); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getMainClass()); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_VENDOR)); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_TITLE)); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.MAIN_CLASS)); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_VENDOR_ID)); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_URL)); + Assert.assertNull("no classloader attached, should be null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_NAME))); Assert.assertNull(jnlpFile.getTitleFromJnlp()); Assert.assertNull(jnlpFile.getTitleFromManifest()); @@ -305,20 +311,20 @@ Assert.assertNull(jnlpFile.getTitleFromManifest()); Assert.assertNull(jnlpFile.getTitle()); - final JNLPClassLoader classLoader = new JNLPClassLoader(jnlpFile, UpdatePolicy.ALWAYS);//jnlp file got its instance in classlaoders constructor + final JNLPClassLoader classLoader = new JNLPClassLoader(jnlpFile, UpdatePolicy.ALWAYS);//jnlp file got its instance in classloaders constructor //jnlpFile.getManifestsAttributes().setLoader(classLoader); - Assert.assertNotNull("classlaoder attached, should be not null", jnlpFile.getManifestsAttributes().getMainClass()); + Assert.assertNotNull("classloader attached, should be not null", jnlpFile.getManifestsAttributes().getMainClass()); Assert.assertNull("defined twice, shoud be null", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_VENDOR)); - Assert.assertNotNull("classlaoder attached, should be not null", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_TITLE)); - Assert.assertNotNull("classlaoder attached, should be not null", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.MAIN_CLASS)); + Assert.assertNotNull("classloader attached, should be not null", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_TITLE)); + Assert.assertNotNull("classloader attached, should be not null", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.MAIN_CLASS)); Assert.assertNull("not deffined, should benull", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_VENDOR_ID)); - Assert.assertNotNull("classlaoder attached, should be not null", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_URL)); - Assert.assertNotNull("classlaoder attached, should be not null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_NAME))); + Assert.assertNotNull("classloader attached, should be not null", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_URL)); + Assert.assertNotNull("classloader attached, should be not null", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_NAME))); //correct values are also tested in JnlpClassloaderTest - Assert.assertEquals("classlaoder attached, should be not null", "it", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_TITLE)); - Assert.assertEquals("classlaoder attached, should be not null", "DummyClass1", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.MAIN_CLASS)); - Assert.assertEquals("classlaoder attached, should be not null", "some url1", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_URL)); - Assert.assertEquals("classlaoder attached, should be not null", "Manifested Name", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_NAME))); + Assert.assertEquals("classloader attached, should be not null", "it", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_TITLE)); + Assert.assertEquals("classloader attached, should be not null", "DummyClass1", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.MAIN_CLASS)); + Assert.assertEquals("classloader attached, should be not null", "some url1", jnlpFile.getManifestsAttributes().getAttribute(Attributes.Name.IMPLEMENTATION_URL)); + Assert.assertEquals("classloader attached, should be not null", "Manifested Name", jnlpFile.getManifestsAttributes().getAttribute(new Attributes.Name(JNLPFile.ManifestsAttributes.APP_NAME))); Assert.assertNull(jnlpFile.getTitleFromJnlp()); Assert.assertEquals("Manifested Name", jnlpFile.getTitleFromManifest());
--- a/tests/test-extensions/net/sourceforge/jnlp/util/logging/NoStdOutErrTest.java Tue Mar 17 12:01:51 2015 -0400 +++ b/tests/test-extensions/net/sourceforge/jnlp/util/logging/NoStdOutErrTest.java Wed Mar 18 16:50:54 2015 +0100 @@ -49,9 +49,9 @@ * static instance. On opposite, if junit creates the instance, then itw see this one. * * Explanation is that junit classloader (fresh for each test-class) is creating - * special classlaoder for itw (or better itw is creating its own one). The itw - * classlaoder is then branch...or leaf of junit classlaoder. So any class loaded - * by junit classlaoder is visible from itw, but not vice verse. + * special classloader for itw (or better itw is creating its own one). The itw + * classloader is then branch...or leaf of junit classloader. So any class loaded + * by junit classloader is visible from itw, but not vice verse. */ public class NoStdOutErrTest {