Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 115370 Details for
Bug 251079
Got error dialog after switching default JRE
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix and regression tests
251079.txt (text/plain), 7.77 KB, created by
Jerome Lanneluc
on 2008-10-17 05:31:33 EDT
(
hide
)
Description:
Proposed fix and regression tests
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2008-10-17 05:31:33 EDT
Size:
7.77 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/ClasspathTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java,v >retrieving revision 1.190 >diff -u -r1.190 ClasspathTests.java >--- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 16 Oct 2008 14:30:32 -0000 1.190 >+++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 17 Oct 2008 09:30:09 -0000 >@@ -3366,6 +3366,32 @@ > } > } > /* >+ * Ensures that the extra libraries in the Class-Path: clause of a jar with a \r\n separator don't cause an exception >+ * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=251079 ) >+ */ >+public void testExtraLibraries15() throws Exception { >+ try { >+ Util.createJar( >+ new String[0], >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\r\n" + >+ "Class-Path: \r\n" + >+ "\r\n", >+ }, >+ getExternalResourcePath("lib1.jar"), >+ JavaCore.VERSION_1_4); >+ ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P", getExternalResourcePath("lib1.jar")})); >+ IJavaProject p = createJavaProject("P", new String[0], new String[] {"org.eclipse.jdt.core.tests.model.TEST_CONTAINER"}, ""); >+ assertClasspathEquals( >+ p.getResolvedClasspath(true), >+ ""+ getExternalPath() + "lib1.jar[CPE_LIBRARY][K_BINARY][isExported:false]" >+ ); >+ } finally { >+ deleteProject("P"); >+ deleteExternalResource("lib1.jar"); >+ } >+}/* > * Ensures that a marker is removed if adding an internal jar that is on the classpath in another project > * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=213723 ) > */ >Index: src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java,v >retrieving revision 1.225 >diff -u -r1.225 AbstractJavaModelTests.java >--- src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java 16 Oct 2008 14:30:32 -0000 1.225 >+++ src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java 17 Oct 2008 09:30:08 -0000 >@@ -995,15 +995,15 @@ > assertStringsEqual(message, expected, strings); > } > protected void assertStringsEqual(String message, String expected, String[] strings) { >- String actual = toString(strings, true/*add extra new lines*/); >+ String actual = org.eclipse.jdt.core.tests.util.Util.toString(strings, true/*add extra new lines*/); > if (!expected.equals(actual)) { > System.out.println(displayString(actual, this.tabs) + this.endChar); > } > assertEquals(message, expected, actual); > } > protected void assertStringsEqual(String message, String[] expectedStrings, String[] actualStrings) { >- String expected = toString(expectedStrings, false/*don't add extra new lines*/); >- String actual = toString(actualStrings, false/*don't add extra new lines*/); >+ String expected = org.eclipse.jdt.core.tests.util.Util.toString(expectedStrings, false/*don't add extra new lines*/); >+ String actual = org.eclipse.jdt.core.tests.util.Util.toString(actualStrings, false/*don't add extra new lines*/); > if (!expected.equals(actual)) { > System.out.println(displayString(actual, this.tabs) + this.endChar); > } >@@ -2774,17 +2774,7 @@ > } > > protected String toString(String[] strings) { >- return toString(strings, false/*don't add extra new line*/); >- } >- protected String toString(String[] strings, boolean addExtraNewLine) { >- if (strings == null) return "null"; >- StringBuffer buffer = new StringBuffer(); >- for (int i = 0, length = strings.length; i < length; i++){ >- buffer.append(strings[i]); >- if (addExtraNewLine || i < length - 1) >- buffer.append("\n"); >- } >- return buffer.toString(); >+ return org.eclipse.jdt.core.tests.util.Util.toString(strings, false/*don't add extra new line*/); > } > protected void tearDown() throws Exception { > super.tearDown(); >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/util/ManifestAnalyzer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/ManifestAnalyzer.java,v >retrieving revision 1.1 >diff -u -r1.1 ManifestAnalyzer.java >--- compiler/org/eclipse/jdt/internal/compiler/util/ManifestAnalyzer.java 9 Oct 2008 08:13:08 -0000 1.1 >+++ compiler/org/eclipse/jdt/internal/compiler/util/ManifestAnalyzer.java 17 Oct 2008 09:30:10 -0000 >@@ -36,6 +36,8 @@ > this.calledFilesNames = null; > for (;;) { > currentChar = reader.read(); >+ if (currentChar == '\r') // skip \r, will consider \n later (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=251079 ) >+ currentChar = reader.read(); > switch (state) { > case START: > if (currentChar == -1) { >@@ -102,7 +104,7 @@ > case READING_JAR: > if (currentChar == -1) { > return false; >- } else if (currentChar == '\n' || currentChar == '\r') { >+ } else if (currentChar == '\n') { > // appends token below > state = CONTINUING; > } else if (currentChar == ' ') { >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v >retrieving revision 1.177 >diff -u -r1.177 BatchCompilerTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 10 Oct 2008 17:24:24 -0000 1.177 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 17 Oct 2008 09:30:13 -0000 >@@ -21,6 +21,7 @@ > import java.text.MessageFormat; > import java.util.ArrayList; > import java.util.Iterator; >+import java.util.List; > > import junit.framework.Test; > >@@ -11026,4 +11027,20 @@ > "", > true); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=251079 >+public void test291_jar_ref_in_jar() throws Exception { >+ assertTrue(ClasspathJar.MANIFEST_ANALYZER.analyzeManifestContents( >+ new StringReader( >+ "Manifest-Version: 1.0\r\n" + >+ "Created-By: Eclipse JDT Test Harness\r\n" + >+ "Class-Path: \r\n" + >+ "\r\n" >+ ))); >+ List calledFileNames = ClasspathJar.MANIFEST_ANALYZER.getCalledFileNames(); >+ String actual = calledFileNames == null ? "<null>" : Util.toString((String[]) calledFileNames.toArray(new String[calledFileNames.size()]), false/*don't add extra new lines*/); >+ assertStringEquals( >+ "<null>", >+ actual, >+ true/*show line serators*/); >+} > } >Index: src/org/eclipse/jdt/core/tests/util/Util.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java,v >retrieving revision 1.72 >diff -u -r1.72 Util.java >--- src/org/eclipse/jdt/core/tests/util/Util.java 9 Oct 2008 11:55:19 -0000 1.72 >+++ src/org/eclipse/jdt/core/tests/util/Util.java 17 Oct 2008 09:30:13 -0000 >@@ -1022,6 +1022,16 @@ > nativePath.substring(0, nativePath.length() - 1) : > nativePath; > } >+public static String toString(String[] strings, boolean addExtraNewLine) { >+ if (strings == null) return "null"; >+ StringBuffer buffer = new StringBuffer(); >+ for (int i = 0, length = strings.length; i < length; i++){ >+ buffer.append(strings[i]); >+ if (addExtraNewLine || i < length - 1) >+ buffer.append("\n"); >+ } >+ return buffer.toString(); >+} > /** > * Unzip the contents of the given zip in the given directory (create it if it doesn't exist) > */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 251079
:
115362
| 115370