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 127196 Details for
Bug 265103
Manifest Class-Path is not read correctly with ECJ
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix for HEAD
patch_265103_HEAD.txt (text/plain), 11.76 KB, created by
Olivier Thomann
on 2009-03-02 13:05:59 EST
(
hide
)
Description:
Proposed fix for HEAD
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2009-03-02 13:05:59 EST
Size:
11.76 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java,v >retrieving revision 1.48 >diff -u -r1.48 ClasspathJar.java >--- batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java 10 Nov 2008 16:38:21 -0000 1.48 >+++ batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java 2 Mar 2009 18:04:12 -0000 >@@ -51,7 +51,7 @@ > try { > initialize(); > ArrayList result = new ArrayList(); >- ZipEntry manifest = this.zipFile.getEntry("META-INF/MANIFEST.MF"); //$NON-NLS-1$ >+ ZipEntry manifest = this.zipFile.getEntry("META-INF/MANIFEST.MF"); //$NON-NLS-1$ > if (manifest != null) { // non-null implies regular file > reader = new BufferedReader(new InputStreamReader(this.zipFile.getInputStream(manifest))); > ManifestAnalyzer analyzer = new ManifestAnalyzer(); >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.2 >diff -u -r1.2 ManifestAnalyzer.java >--- compiler/org/eclipse/jdt/internal/compiler/util/ManifestAnalyzer.java 17 Oct 2008 11:01:09 -0000 1.2 >+++ compiler/org/eclipse/jdt/internal/compiler/util/ManifestAnalyzer.java 2 Mar 2009 18:04:12 -0000 >@@ -70,16 +70,23 @@ > break; > case SKIPPING_WHITESPACE: > if (currentChar == -1) { >+ // >>>>>>>>>>>>>>>>>> Add the latest jar read >+ addCurrentTokenJarWhenNecessary(currentJarToken); > return true; > } else if (currentChar == '\n') { > state = CONTINUING; > } else if (currentChar != ' ') { > currentJarToken.append((char) currentChar); > state = READING_JAR; >+ } else { >+ // >>>>>>>>>>>>>>>>>> Add the latest jar read >+ addCurrentTokenJarWhenNecessary(currentJarToken); > } > break; > case CONTINUING: > if (currentChar == -1) { >+ // >>>>>>>>>>>>>>>>>> Add the latest jar read >+ addCurrentTokenJarWhenNecessary(currentJarToken); > return true; > } else if (currentChar == '\n') { > state = START; >@@ -89,8 +96,11 @@ > state = IN_CLASSPATH_HEADER; > substate = 1; > } else if (this.calledFilesNames == null) { >- return false; >+ // >>>>>>>>>>>>>>>>>> Add the latest jar read >+ return addCurrentTokenJarWhenNecessary(currentJarToken); > } else { >+ // >>>>>>>>>>>>>>>>>> Add the latest jar read >+ addCurrentTokenJarWhenNecessary(currentJarToken); > state = SKIP_LINE; > } > break; >@@ -101,12 +111,15 @@ > state = START; > } > break; >- case READING_JAR: >+ case READING_JAR: > if (currentChar == -1) { >- return false; >+ // >>>>>>>>>>>>>>>>>> Add the latest jar read >+ return addCurrentTokenJarWhenNecessary(currentJarToken); > } else if (currentChar == '\n') { > // appends token below > state = CONTINUING; >+ // >>>>>>>>>>> Add a break to not add the jar yet as it can continue on the next line >+ break; > } else if (currentChar == ' ') { > // appends token below > state = SKIPPING_WHITESPACE; >@@ -114,15 +127,27 @@ > currentJarToken.append((char) currentChar); > break; > } >- if (this.calledFilesNames == null) { >- this.calledFilesNames = new ArrayList(); >- } >- this.calledFilesNames.add(currentJarToken.toString()); >- currentJarToken.setLength(0); >+ addCurrentTokenJarWhenNecessary(currentJarToken); > break; > } > } >+ } >+ >+ // >>>>>>>>>>>>>>>> Method Extracted from analyzeManifestContents in the READING_JAR Block >+ private boolean addCurrentTokenJarWhenNecessary(StringBuffer currentJarToken) { >+ if (currentJarToken != null && currentJarToken.length() > 0) { >+ if (this.calledFilesNames == null) { >+ this.calledFilesNames = new ArrayList(); >+ } >+ this.calledFilesNames.add(currentJarToken.toString()); >+ currentJarToken.setLength(0); >+ return true; >+ } >+ return false; > } >+ // <<<<<<<<<<<<<<<<<<<<<< >+ >+ > public int getClasspathSectionsCount() { > return this.ClasspathSectionsCount; > } >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java,v >retrieving revision 1.76 >diff -u -r1.76 TestAll.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java 1 Dec 2008 12:32:11 -0000 1.76 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java 2 Mar 2009 18:04:12 -0000 >@@ -70,6 +70,7 @@ > standardTests.add(SerialVersionUIDTests.class); > standardTests.add(LineNumberAttributeTest.class); > standardTests.add(ProgrammingProblemsTest.class); >+ standardTests.add(ManifestAnalyzerTest.class); > > // add all javadoc tests > for (int i=0, l=JavadocTest.ALL_CLASSES.size(); i<l; i++) { >Index: src/org/eclipse/jdt/core/tests/compiler/regression/ManifestAnalyzerTest.java >=================================================================== >RCS file: src/org/eclipse/jdt/core/tests/compiler/regression/ManifestAnalyzerTest.java >diff -N src/org/eclipse/jdt/core/tests/compiler/regression/ManifestAnalyzerTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/ManifestAnalyzerTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,107 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Fabrice Matrat - initial contribution >+ * IBM Corporation - code review and integration >+ *******************************************************************************/ >+package org.eclipse.jdt.core.tests.compiler.regression; >+import java.io.IOException; >+import java.io.StringReader; >+import java.util.List; >+ >+import org.eclipse.jdt.internal.compiler.util.ManifestAnalyzer; >+ >+public class ManifestAnalyzerTest extends AbstractRegressionTest { >+ >+ private static final String FIRST_JAR = "firstJar.jar"; >+ private static final String SECOND_JAR = "secondJar.jar"; >+ private static final String WHITESPACE = " "; >+ >+ ManifestAnalyzer manifestAnalyzer = new ManifestAnalyzer(); >+ >+ public ManifestAnalyzerTest(String name) { >+ super(name); >+ } >+ public void testWithOneJar() throws IOException { >+ String testWithOneJar = "Manifest-Version: 1.0\nAnt-Version: Apache Ant 1.6.5\nCreated-By: 1.5.0_14-b03 (Sun Microsystems Inc.)\nClass-Path: " + FIRST_JAR + "\nBuild-Reference: Version toto"; >+ StringReader reader = new StringReader(testWithOneJar); >+ this.manifestAnalyzer.analyzeManifestContents(reader); >+ List jars = this.manifestAnalyzer.getCalledFileNames(); >+ assertEquals("Wrong size", 1, jars.size()); >+ assertEquals(FIRST_JAR, jars.get(0)); >+ } >+ >+ public void testWithOneJarWithWiteSpace() throws IOException { >+ String testWithOneJarWithWiteSpace = "Manifest-Version: 1.0\nAnt-Version: Apache Ant 1.6.5\nCreated-By: 1.5.0_14-b03 (Sun Microsystems Inc.)\nClass-Path: " + FIRST_JAR + WHITESPACE + "\nBuild-Reference: Version toto"; >+ StringReader reader = new StringReader(testWithOneJarWithWiteSpace); >+ this.manifestAnalyzer.analyzeManifestContents(reader); >+ List jars = this.manifestAnalyzer.getCalledFileNames(); >+ assertEquals("Wrong size", 1, jars.size()); >+ assertEquals(FIRST_JAR, jars.get(0)); >+ } >+ >+ public void testWithSecondJarOnNextLine() throws IOException { >+ String testWithSecondJarOnNextLine = "Manifest-Version: 1.0\nAnt-Version: Apache Ant 1.6.5\nCreated-By: 1.5.0_14-b03 (Sun Microsystems Inc.)\nClass-Path: " + FIRST_JAR + "\n"+ WHITESPACE + WHITESPACE +"secondJar.jar\nBuild-Reference: Version toto"; >+ StringReader reader = new StringReader(testWithSecondJarOnNextLine); >+ this.manifestAnalyzer.analyzeManifestContents(reader); >+ List jars = this.manifestAnalyzer.getCalledFileNames(); >+ assertEquals("Wrong size", 2, jars.size()); >+ assertEquals(FIRST_JAR, jars.get(0)); >+ assertEquals(SECOND_JAR, jars.get(1)); >+ } >+ >+ public void testWithSecondJarOnTwoLine() throws IOException { >+ String testWithSecondJarOnTwoLine = "Manifest-Version: 1.0\nAnt-Version: Apache Ant 1.6.5\nCreated-By: 1.5.0_14-b03 (Sun Microsystems Inc.)\nClass-Path: " + FIRST_JAR + " second\n" + WHITESPACE + "Jar.jar\nBuild-Reference: Version toto"; >+ StringReader reader = new StringReader(testWithSecondJarOnTwoLine); >+ this.manifestAnalyzer.analyzeManifestContents(reader); >+ List jars = this.manifestAnalyzer.getCalledFileNames(); >+ assertEquals("Wrong size", 2, jars.size()); >+ assertEquals(FIRST_JAR, jars.get(0)); >+ assertEquals(SECOND_JAR, jars.get(1)); >+ } >+ >+ public void testWithSecondJarOnTwoLineEndedWithEOF() throws IOException { >+ String testWithSecondJarOnTwoLineEndedWithEOF = "Manifest-Version: 1.0\nAnt-Version: Apache Ant 1.6.5\nCreated-By: 1.5.0_14-b03 (Sun Microsystems Inc.)\nClass-Path: " + FIRST_JAR + " second\n Jar.jar"; >+ StringReader reader = new StringReader(testWithSecondJarOnTwoLineEndedWithEOF); >+ this.manifestAnalyzer.analyzeManifestContents(reader); >+ List jars = this.manifestAnalyzer.getCalledFileNames(); >+ assertEquals("Wrong size", 2, jars.size()); >+ assertEquals(FIRST_JAR, jars.get(0)); >+ assertEquals(SECOND_JAR, jars.get(1)); >+ } >+ >+ public void testWithSecondJarOnTwoLineEndedWithWhiteSpaceEOF() throws IOException { >+ String testWithSecondJarOnTwoLineEndedWithWhiteSpaceEOF = "Manifest-Version: 1.0\nAnt-Version: Apache Ant 1.6.5\nCreated-By: 1.5.0_14-b03 (Sun Microsystems Inc.)\nClass-Path: " + FIRST_JAR + " second\n Jar.jar "; >+ StringReader reader = new StringReader(testWithSecondJarOnTwoLineEndedWithWhiteSpaceEOF); >+ this.manifestAnalyzer.analyzeManifestContents(reader); >+ List jars = this.manifestAnalyzer.getCalledFileNames(); >+ assertEquals("Wrong size", 2, jars.size()); >+ assertEquals(FIRST_JAR, jars.get(0)); >+ assertEquals(SECOND_JAR, jars.get(1)); >+ } >+ >+ public void testWithSecondJarOnTwoLineEndedWithWhiteSpaceNewLineEOF() throws IOException { >+ String testWithSecondJarOnTwoLineEndedWithWhiteSpaceNewLineEOF = "Manifest-Version: 1.0\nAnt-Version: Apache Ant 1.6.5\nCreated-By: 1.5.0_14-b03 (Sun Microsystems Inc.)\nClass-Path: " + FIRST_JAR + " second\n Jar.jar \n"; >+ StringReader reader = new StringReader(testWithSecondJarOnTwoLineEndedWithWhiteSpaceNewLineEOF); >+ this.manifestAnalyzer.analyzeManifestContents(reader); >+ List jars = this.manifestAnalyzer.getCalledFileNames(); >+ assertEquals("Wrong size", 2, jars.size()); >+ assertEquals(FIRST_JAR, jars.get(0)); >+ assertEquals(SECOND_JAR, jars.get(1)); >+ } >+ >+ public void testWithSecondJarOnTwoLineEndedWithNewLineEOF() throws IOException { >+ String testWithSecondJarOnTwoLineEndedWithNewLineEOF = "Manifest-Version: 1.0\nAnt-Version: Apache Ant 1.6.5\nCreated-By: 1.5.0_14-b03 (Sun Microsystems Inc.)\nClass-Path: " + FIRST_JAR + " second\n Jar.jar\n"; >+ StringReader reader = new StringReader(testWithSecondJarOnTwoLineEndedWithNewLineEOF); >+ this.manifestAnalyzer.analyzeManifestContents(reader); >+ List jars = this.manifestAnalyzer.getCalledFileNames(); >+ assertEquals("Wrong size", 2, jars.size()); >+ assertEquals(FIRST_JAR, jars.get(0)); >+ assertEquals(SECOND_JAR, jars.get(1)); >+ } >+}
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 265103
:
125864
|
127195
|
127196
|
127487
|
127491