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 73122 Details for
Bug 195509
Need to improve classpath resolution for Apache Harmony in org/eclipse/jdt/core/tests/util/Util.java
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Better fix
patch_195509.txt (text/plain), 5.15 KB, created by
Olivier Thomann
on 2007-07-05 10:44:10 EDT
(
hide
)
Description:
Better fix
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2007-07-05 10:44:10 EDT
Size:
5.15 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >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.56 >diff -u -r1.56 Util.java >--- src/org/eclipse/jdt/core/tests/util/Util.java 24 May 2007 14:31:35 -0000 1.56 >+++ src/org/eclipse/jdt/core/tests/util/Util.java 5 Jul 2007 14:43:36 -0000 >@@ -639,47 +639,75 @@ > * Example of use: [org.eclipse.jdt.core.tests.util.Util.getJavaClassLib()] > */ > public static String[] getJavaClassLibs() { >- String jreDir = getJREDirectory(); >- final String osName = System.getProperty("os.name"); >- if (jreDir == null) { >- return new String[] {}; >- } >- if (osName.startsWith("Mac")) { >- return new String[] { >- toNativePath(jreDir + "/../Classes/classes.jar") >- }; >- } >- final String vmName = System.getProperty("java.vm.name"); >- if ("J9".equals(vmName)) { >- return new String[] { >- toNativePath(jreDir + "/lib/jclMax/classes.zip") >- }; >- } >- if ("DRLVM".equals(vmName)) { >- FilenameFilter jarFilter = new FilenameFilter() { >- public boolean accept(File dir, String name) { >- return name.endsWith(".jar") & !name.endsWith("-src.jar"); >+ // check bootclasspath properties for Sun, JRockit and Harmony VMs >+ String bootclasspathProperty = System.getProperty("sun.boot.class.path"); //$NON-NLS-1$ >+ if ((bootclasspathProperty == null) || (bootclasspathProperty.length() == 0)) { >+ // IBM J9 VMs >+ bootclasspathProperty = System.getProperty("vm.boot.class.path"); //$NON-NLS-1$ >+ if ((bootclasspathProperty == null) || (bootclasspathProperty.length() == 0)) { >+ // Harmony using IBM VME >+ bootclasspathProperty = System.getProperty("org.apache.harmony.boot.class.path"); //$NON-NLS-1$ >+ } >+ } >+ String[] jars = null; >+ if ((bootclasspathProperty != null) && (bootclasspathProperty.length() != 0)) { >+ StringTokenizer tokenizer = new StringTokenizer(bootclasspathProperty, File.pathSeparator); >+ final int size = tokenizer.countTokens(); >+ jars = new String[size]; >+ int i = 0; >+ while (tokenizer.hasMoreTokens()) { >+ final String fileName = toNativePath(tokenizer.nextToken()); >+ if (new File(fileName).exists()) { >+ jars[i] = fileName; >+ i++; > } >- }; >- String[] jars = new File(jreDir + "/lib/boot/").list(jarFilter); >- for (int i = 0; i < jars.length; i++) { >- jars[i] = toNativePath(jreDir + "/lib/boot/" + jars[i]); > } >- return jars; >+ if (size != i) { >+ // resize >+ System.arraycopy(jars, 0, (jars = new String[i]), 0, i); >+ } >+ } else { >+ String jreDir = getJREDirectory(); >+ final String osName = System.getProperty("os.name"); >+ if (jreDir == null) { >+ return new String[] {}; >+ } >+ if (osName.startsWith("Mac")) { >+ return new String[] { >+ toNativePath(jreDir + "/../Classes/classes.jar") >+ }; >+ } >+ final String vmName = System.getProperty("java.vm.name"); >+ if ("J9".equals(vmName)) { >+ return new String[] { >+ toNativePath(jreDir + "/lib/jclMax/classes.zip") >+ }; >+ } >+ String[] jarsNames = null; >+ ArrayList paths = new ArrayList(); >+ if ("DRLVM".equals(vmName)) { >+ FilenameFilter jarFilter = new FilenameFilter() { >+ public boolean accept(File dir, String name) { >+ return name.endsWith(".jar") & !name.endsWith("-src.jar"); >+ } >+ }; >+ jarsNames = new File(jreDir + "/lib/boot/").list(jarFilter); >+ addJarEntries(jreDir + "/lib/boot/", jarsNames, paths); >+ } else { >+ jarsNames = new String[] { >+ "/lib/vm.jar", >+ "/lib/rt.jar", >+ "/lib/core.jar", >+ "/lib/security.jar", >+ "/lib/xml.jar", >+ "/lib/graphics.jar" >+ }; >+ addJarEntries(jreDir, jarsNames, paths); >+ } >+ jars = new String[paths.size()]; >+ paths.toArray(jars); > } >- ArrayList paths = new ArrayList(); >- String[] jarsNames = new String[] { >- "/lib/vm.jar", >- "/lib/rt.jar", >- "/lib/core.jar", >- "/lib/security.jar", >- "/lib/xml.jar", >- "/lib/graphics.jar" >- }; >- addJarEntries(jreDir, jarsNames, paths); >- String[] result = new String[paths.size()]; >- paths.toArray(result); >- return result; >+ return jars; > } > private static void addJarEntries(String jreDir, String[] jarNames, ArrayList paths) { > for (int i = 0, max = jarNames.length; i < max; i++) { >@@ -691,15 +719,14 @@ > } > } > public static String getJavaClassLibsAsString() { >- String[] classLibs = getJavaClassLibs(); >- StringBuffer buffer = new StringBuffer(); >- for (int i = 0, max = classLibs.length; i < max; i++) { >- buffer >- .append(classLibs[i]) >- .append(File.pathSeparatorChar); >- >- } >- return buffer.toString(); >+ String[] classLibs = getJavaClassLibs(); >+ StringBuffer buffer = new StringBuffer(); >+ for (int i = 0, max = classLibs.length; i < max; i++) { >+ buffer >+ .append(classLibs[i]) >+ .append(File.pathSeparatorChar); >+ } >+ return buffer.toString(); > } > /** > * Returns the JRE directory this tests are running on.
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 195509
:
73099
|
73117
|
73122
|
73141