### Eclipse Workspace Patch 1.0 #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.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 4 Mar 2009 15:52:24 -0000 @@ -26,13 +26,13 @@ SKIP_LINE = 6; private static final char[] CLASSPATH_HEADER_TOKEN = "Class-Path:".toCharArray(); //$NON-NLS-1$ - private int ClasspathSectionsCount; + private int classpathSectionsCount; private ArrayList calledFilesNames; public boolean analyzeManifestContents(Reader reader) throws IOException { int state = START, substate = 0; StringBuffer currentJarToken = new StringBuffer(); int currentChar; - this.ClasspathSectionsCount = 0; + this.classpathSectionsCount = 0; this.calledFilesNames = null; for (;;) { currentChar = reader.read(); @@ -63,39 +63,57 @@ case PAST_CLASSPATH_HEADER: if (currentChar == ' ') { state = SKIPPING_WHITESPACE; - this.ClasspathSectionsCount++; + this.classpathSectionsCount++; } else { return false; } 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') { + addCurrentTokenJarWhenNecessary(currentJarToken); state = START; } else if (currentChar == ' ') { state = SKIPPING_WHITESPACE; } else if (currentChar == CLASSPATH_HEADER_TOKEN[0]) { + addCurrentTokenJarWhenNecessary(currentJarToken); state = IN_CLASSPATH_HEADER; substate = 1; } else if (this.calledFilesNames == null) { - return false; + // >>>>>>>>>>>>>>>>>> Add the latest jar read + addCurrentTokenJarWhenNecessary(currentJarToken); + state = START; } else { + // >>>>>>>>>>>>>>>>>> Add the latest jar read + addCurrentTokenJarWhenNecessary(currentJarToken); state = SKIP_LINE; } break; case SKIP_LINE: if (currentChar == -1) { + if (this.classpathSectionsCount != 0) { + if (this.calledFilesNames == null) { + return false; + } + } return true; } else if (currentChar == '\n') { state = START; @@ -103,10 +121,13 @@ break; case READING_JAR: if (currentChar == -1) { + // >>>>>>>>>>>>>>>>>> Add the latest jar read return false; } 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,17 +135,29 @@ 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; + return this.classpathSectionsCount; } public List getCalledFileNames() { return this.calledFilesNames; #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 4 Mar 2009 15:52:25 -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