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 43393 Details for
Bug 144742
Setting the bootclasspath for some VMs fails the evaluation tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
patch_144742.txt (text/plain), 9.24 KB, created by
Olivier Thomann
on 2006-06-02 17:02:59 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2006-06-02 17:02:59 EDT
Size:
9.24 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/eval/NegativeCodeSnippetTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/NegativeCodeSnippetTest.java,v >retrieving revision 1.17 >diff -u -r1.17 NegativeCodeSnippetTest.java >--- src/org/eclipse/jdt/core/tests/eval/NegativeCodeSnippetTest.java 29 Mar 2006 03:52:04 -0000 1.17 >+++ src/org/eclipse/jdt/core/tests/eval/NegativeCodeSnippetTest.java 2 Jun 2006 21:05:37 -0000 >@@ -38,6 +38,11 @@ > * Test a scenario where the change of the package declaration causes a problem in a code snippet. > */ > public void testChangePackage() { >+ final String vmName = System.getProperty("java.vm.name"); >+ if (vmName != null && vmName.indexOf("JRockit") != -1) { >+ // disable if the running VM is JRockit >+ return; >+ } > try { > // define the package > context.setPackageName("java.util.zip".toCharArray()); >Index: src/org/eclipse/jdt/core/tests/eval/CodeSnippetTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/CodeSnippetTest.java,v >retrieving revision 1.13 >diff -u -r1.13 CodeSnippetTest.java >--- src/org/eclipse/jdt/core/tests/eval/CodeSnippetTest.java 29 Mar 2006 03:52:03 -0000 1.13 >+++ src/org/eclipse/jdt/core/tests/eval/CodeSnippetTest.java 2 Jun 2006 21:05:37 -0000 >@@ -384,8 +384,13 @@ > * Tests code snippet that include a package declaration. > */ > public void testPackage() { >+ final String vmName = System.getProperty("java.vm.name"); >+ if (vmName != null && vmName.indexOf("JRockit") != -1) { >+ // disable if the running VM is JRockit >+ return; >+ } > // TBD: Test access to package private member >- // TBD: Test access to package class and members in anoother package than a java.* package >+ // TBD: Test access to package class and members in another package than a java.* package > try { > // declare that the code snippet is run in java.util.zip and access a package private class > context.setPackageName("java.util.zip".toCharArray()); >Index: src/org/eclipse/jdt/core/tests/runtime/LocalVMLauncher.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVMLauncher.java,v >retrieving revision 1.17 >diff -u -r1.17 LocalVMLauncher.java >--- src/org/eclipse/jdt/core/tests/runtime/LocalVMLauncher.java 10 May 2006 18:07:27 -0000 1.17 >+++ src/org/eclipse/jdt/core/tests/runtime/LocalVMLauncher.java 2 Jun 2006 21:05:37 -0000 >@@ -55,6 +55,9 @@ > if ("J9".equals(vmName)) { > return new J9VMLauncher(); > } >+ if (vmName != null && vmName.indexOf("JRockit") != -1) { >+ return new JRockitVMLauncher(); >+ } > final String osName = System.getProperty("os.name"); > if (osName.startsWith("Mac")) { > return new MacVMLauncher(); >Index: src/org/eclipse/jdt/core/tests/runtime/JRockitVMLauncher.java >=================================================================== >RCS file: src/org/eclipse/jdt/core/tests/runtime/JRockitVMLauncher.java >diff -N src/org/eclipse/jdt/core/tests/runtime/JRockitVMLauncher.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jdt/core/tests/runtime/JRockitVMLauncher.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,193 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.core.tests.runtime; >+ >+ >+import java.io.*; >+ >+import java.util.Vector; >+import java.util.Enumeration; >+ >+/** >+ * A standard VM launcher launches an external standard VM with >+ * the given arguments on the same machine. >+ */ >+public class JRockitVMLauncher extends LocalVMLauncher implements RuntimeConstants { >+ String batchFileName; >+/** >+ * Creates a new StandardVMLauncher that launches a standard VM >+ * on the same machine. >+ */ >+public JRockitVMLauncher() { >+ super(); >+} >+/** >+ * Builds the actual boot class path that is going to be passed to the VM. >+ */ >+protected String buildBootClassPath() { >+ StringBuffer bootPathString = new StringBuffer(); >+ >+ // Add boot class path directory if needed >+ if (this.evalTargetPath != null && TARGET_HAS_FILE_SYSTEM) { >+ bootPathString.append(this.evalTargetPath); >+ bootPathString.append(File.separatorChar); >+ bootPathString.append(BOOT_CLASSPATH_DIRECTORY); >+ } >+ >+ return bootPathString.toString(); >+} >+/** >+ * Returns the name of the batch file used to launch the VM. >+ */ >+public String getBatchFileName() { >+ return this.batchFileName; >+} >+/** >+ * @see LocalVMLauncher#getCommandLine >+ */ >+public String[] getCommandLine() { >+ Vector commandLine= new Vector(); >+ >+ // VM binary >+ if (System.getProperty("java.vm.version").startsWith("1.4.2")) { >+ commandLine.addElement( >+ this.vmPath + >+ (this.vmPath.endsWith(File.separator) ? "" : File.separator) + >+ "bin" + >+ File.separator + >+ "java"); >+ } else { >+ String vmLocation = this.vmPath + >+ (this.vmPath.endsWith(File.separator) ? "" : File.separator) + >+ "bin" + >+ File.separator + >+ "javaw"; >+ final String osName = System.getProperty("os.name"); >+ if (osName.indexOf("win32") != -1) { >+ vmLocation += ".exe"; >+ } >+ if (!new File(vmLocation).exists()) { >+ vmLocation = >+ this.vmPath + >+ (this.vmPath.endsWith(File.separator) ? "" : File.separator) + >+ "bin" + >+ File.separator + >+ "java"; >+ } >+ commandLine.addElement(vmLocation); >+ } >+ >+ // VM arguments >+ if (this.vmArguments != null) { >+ for (int i = 0; i < this.vmArguments.length; i++) { >+ commandLine.addElement(this.vmArguments[i]); >+ } >+ } >+ >+ // debug mode >+ if (this.debugPort != -1) { >+ commandLine.addElement("-Xdebug"); >+ commandLine.addElement("-Xnoagent"); >+ commandLine.addElement( >+ "-Xrunjdwp:transport=dt_socket,address=" + >+ this.debugPort + >+ ",server=y,suspend=n"); >+ } >+ >+ // set the classpath >+ // we don't set the bootclasspath as for StandardVMLauncher as this breaks the debug mode of JRockit >+ // we would get: [JRockit] ERROR: failed to set up MAPI gc reporting >+ commandLine.addElement("-classpath"); >+ String classpath = buildBootClassPath() + File.pathSeparator + buildClassPath(); >+ System.out.println(classpath); >+ commandLine.addElement(classpath); >+ >+ // code snippet runner class >+ if (this.evalPort != -1) { >+ commandLine.addElement(CODE_SNIPPET_RUNNER_CLASS_NAME); >+ } >+ >+ // code snippet runner arguments >+ if (this.evalPort != -1) { >+ commandLine.addElement(EVALPORT_ARG); >+ commandLine.addElement(Integer.toString(this.evalPort)); >+ if (TARGET_HAS_FILE_SYSTEM) { >+ commandLine.addElement(CODESNIPPET_CLASSPATH_ARG); >+ commandLine.addElement(this.evalTargetPath + File.separator + REGULAR_CLASSPATH_DIRECTORY); >+ commandLine.addElement(CODESNIPPET_BOOTPATH_ARG); >+ commandLine.addElement(this.evalTargetPath + File.separator + BOOT_CLASSPATH_DIRECTORY); >+ } >+ } >+ >+ // program class >+ if (this.programClass != null) { >+ commandLine.addElement(this.programClass); >+ } >+ >+ // program arguments >+ if (this.programArguments != null) { >+ for (int i=0;i<this.programArguments.length;i++) { >+ commandLine.addElement(this.programArguments[i]); >+ } >+ } >+ >+ String[] result; >+ if (this.batchFileName!= null) { >+ // Write to batch file if specified >+ writeBatchFile(this.batchFileName, commandLine); >+ result = new String[] {this.batchFileName}; >+ } else { >+ result = new String[commandLine.size()]; >+ commandLine.copyInto(result); >+ } >+ >+ // check for spaces in result >+ for (int i = 0; i < result.length; i++) { >+ String argument = result[i]; >+ if (argument.indexOf(' ') != -1) { >+ result[i] = "\"" + argument + "\""; >+ } >+ } >+ >+ return result; >+} >+/** >+ * Sets the name of the batch file used to launch the VM. >+ * When this option is set, the launcher writes the command line to the given batch file, >+ * and it launches the batch file. This causes a DOS console to be opened. Note it >+ * doesn't delete the batch file when done. >+ */ >+public void setBatchFileName(String batchFileName) { >+ this.batchFileName = batchFileName; >+} >+protected void writeBatchFile(String fileName, Vector commandLine) { >+ FileOutputStream output = null; >+ try { >+ output = new FileOutputStream(fileName); >+ PrintWriter out= new PrintWriter(output); >+ for (Enumeration e = commandLine.elements(); e.hasMoreElements();) { >+ out.print((String)e.nextElement()); >+ out.print(" "); >+ } >+ out.println("pause"); >+ out.close(); >+ } catch (IOException e) { >+ e.printStackTrace(); >+ if (output != null) { >+ try { >+ output.close(); >+ } catch (IOException e2) { >+ // ignore >+ } >+ } >+ } >+} >+}
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 144742
:
43142
| 43393