[542571] Errors when debugging xslt with Java 9 or newer
Also re-enable XSL launch tests
diff --git a/xsl/bundles/org.eclipse.wst.xsl.jaxp.launching/META-INF/MANIFEST.MF b/xsl/bundles/org.eclipse.wst.xsl.jaxp.launching/META-INF/MANIFEST.MF
index 862eff3..85eaaf1 100644
--- a/xsl/bundles/org.eclipse.wst.xsl.jaxp.launching/META-INF/MANIFEST.MF
+++ b/xsl/bundles/org.eclipse.wst.xsl.jaxp.launching/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.eclipse.wst.xsl.jaxp.launching;singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.1.100.qualifier
Bundle-Activator: org.eclipse.wst.xsl.jaxp.launching.internal.JAXPLaunchingPlugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.14.0,4.0.0)",
org.eclipse.core.variables;bundle-version="[3.4.100,4.0.0)",
diff --git a/xsl/bundles/org.eclipse.wst.xsl.jaxp.launching/pom.xml b/xsl/bundles/org.eclipse.wst.xsl.jaxp.launching/pom.xml
index 836b6da..678d09a 100644
--- a/xsl/bundles/org.eclipse.wst.xsl.jaxp.launching/pom.xml
+++ b/xsl/bundles/org.eclipse.wst.xsl.jaxp.launching/pom.xml
@@ -22,7 +22,7 @@
<groupId>org.eclipse.webtools.sourceediting</groupId>
<artifactId>org.eclipse.wst.xsl.jaxp.launching</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>XSLT JAXP Launching UI Plugin</name>
diff --git a/xsl/bundles/org.eclipse.wst.xsl.jaxp.launching/src/org/eclipse/wst/xsl/jaxp/launching/internal/JAXPJavaLaunchConfigurationDelegate.java b/xsl/bundles/org.eclipse.wst.xsl.jaxp.launching/src/org/eclipse/wst/xsl/jaxp/launching/internal/JAXPJavaLaunchConfigurationDelegate.java
index 690d631..05575d9 100644
--- a/xsl/bundles/org.eclipse.wst.xsl.jaxp.launching/src/org/eclipse/wst/xsl/jaxp/launching/internal/JAXPJavaLaunchConfigurationDelegate.java
+++ b/xsl/bundles/org.eclipse.wst.xsl.jaxp.launching/src/org/eclipse/wst/xsl/jaxp/launching/internal/JAXPJavaLaunchConfigurationDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Chase Technology Ltd - http://www.chasetechnology.co.uk
+ * Copyright (c) 2007, 2019 Chase Technology Ltd - http://www.chasetechnology.co.uk
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -20,6 +20,7 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
+import java.util.StringTokenizer;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -37,6 +38,8 @@
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.ISourceLocator;
import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMInstall2;
import org.eclipse.jdt.launching.IVMRunner;
import org.eclipse.jdt.launching.JavaLaunchDelegate;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -346,17 +349,49 @@
String[] invokerClasspath = invokerCP.toArray(new String[0]);
+ String[] processorJars = new String[0];
+ if (!vmSupportsEndorsedDirs(configuration)) {
+ File endorsedDir = getEndorsedDir();
+ IPath endorsedPath = getEndorsedPath();
+ processorJars = endorsedDir.list();
+ for (int i = 0; i < processorJars.length; i++) {
+ processorJars[i] = endorsedPath.addTrailingSeparator().append(processorJars[i]).toString();
+ }
+ }
+
// add them together
String[] classpath = new String[userClasspath.length
- + invokerClasspath.length];
- System.arraycopy(invokerClasspath, 0, classpath, 0,
+ + invokerClasspath.length + processorJars.length];
+ System.arraycopy(processorJars, 0, classpath, 0,
+ processorJars.length);
+ System.arraycopy(invokerClasspath, 0, classpath, processorJars.length,
invokerClasspath.length);
- System.arraycopy(userClasspath, 0, classpath, invokerClasspath.length,
+ System.arraycopy(userClasspath, 0, classpath, processorJars.length + invokerClasspath.length,
userClasspath.length);
return classpath;
}
+ // https://bugs.eclipse.org/532490
+ public String[][] getClasspathAndModulepath(ILaunchConfiguration config) throws CoreException {
+ String[][] classpathAndModulepath = super.getClasspathAndModulepath(config);
+ boolean needToRemoveJrtFs = false;
+ for (int i = 0; !needToRemoveJrtFs && i < classpathAndModulepath[1].length; i++) {
+ needToRemoveJrtFs = needToRemoveJrtFs || classpathAndModulepath[1][i].indexOf("jrt-fs.jar") > 1; //$NON-NLS-1$
+ }
+ if (needToRemoveJrtFs) {
+ String[] modulesWithoutJrtFs = new String[classpathAndModulepath[1].length - 1];
+ int i = 0;
+ for (String module : classpathAndModulepath[1]) {
+ if (module.indexOf("jrt-fs.jar") < 0) { //$NON-NLS-1$
+ modulesWithoutJrtFs[i++] = module;
+ }
+ }
+ classpathAndModulepath[1] = modulesWithoutJrtFs;
+ }
+ return classpathAndModulepath;
+ }
+
@Override
public String getVMArguments(ILaunchConfiguration configuration)
throws CoreException {
@@ -385,10 +420,13 @@
Messages.XSLTLaunchConfigurationDelegate_23
+ jars[i], null));
File file = new File(tempDir, "END_" + i + ".jar"); //$NON-NLS-1$ //$NON-NLS-2$
- moveFile(entry, file);
+ copyFile(entry, file);
}
- // add the endorsed dir
- vmargs += " -Djava.endorsed.dirs=\"" + tempDir.getAbsolutePath() + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+ // add the endorsed dir on older versions
+ boolean useEndorsed = vmSupportsEndorsedDirs(configuration);
+ if (useEndorsed) {
+ vmargs += " -Djava.endorsed.dirs=\"" + tempDir.getAbsolutePath() + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+ }
String tfactory = getTransformerFactory(install);
if (tfactory != null)
@@ -414,6 +452,21 @@
return vmargs;
}
+ private boolean vmSupportsEndorsedDirs(ILaunchConfiguration configuration) throws CoreException {
+ boolean useEndorsed = true;
+ IVMInstall vmInstall = getVMInstall(configuration);
+ if (vmInstall instanceof IVMInstall2) {
+ String version = ((IVMInstall2) vmInstall).getJavaVersion();
+ if (version != null) {
+ double vmVersion = Double.parseDouble(new StringTokenizer(version, ".").nextToken()); //$NON-NLS-1$
+ if (vmVersion >= 9d) {
+ useEndorsed = false;
+ }
+ }
+ }
+ return useEndorsed;
+ }
+
private String getTransformerFactory(IProcessorInstall install) {
String tfactory = null;
if (ILaunchManager.DEBUG_MODE.equals(mode))
@@ -427,13 +480,17 @@
}
private File getEndorsedDir() {
- IPath tempLocation = Platform.getStateLocation(
- JAXPLaunchingPlugin.getDefault().getBundle())
- .append("endorsed"); //$NON-NLS-1$
- return tempLocation.toFile();
+ return getEndorsedPath().toFile();
}
- private static void moveFile(URL src, File target) throws CoreException {
+ private IPath getEndorsedPath() {
+ IPath location = Platform.getStateLocation(
+ JAXPLaunchingPlugin.getDefault().getBundle())
+ .append("endorsed"); //$NON-NLS-1$
+ return location;
+ }
+
+ private static void copyFile(URL src, File target) throws CoreException {
BufferedOutputStream bos = null;
BufferedInputStream bis = null;
try {
diff --git a/xsl/features/org.eclipse.wst.xsl.feature/feature.xml b/xsl/features/org.eclipse.wst.xsl.feature/feature.xml
index 3c19177..3cd3338 100644
--- a/xsl/features/org.eclipse.wst.xsl.feature/feature.xml
+++ b/xsl/features/org.eclipse.wst.xsl.feature/feature.xml
@@ -15,7 +15,7 @@
<feature
id="org.eclipse.wst.xsl.feature"
label="%featureName"
- version="1.3.800.qualifier"
+ version="1.3.900.qualifier"
provider-name="%providerName"
plugin="org.eclipse.wst.xsl"
license-feature="org.eclipse.license"
diff --git a/xsl/features/org.eclipse.wst.xsl.feature/pom.xml b/xsl/features/org.eclipse.wst.xsl.feature/pom.xml
index ced8c12..e616cc8 100644
--- a/xsl/features/org.eclipse.wst.xsl.feature/pom.xml
+++ b/xsl/features/org.eclipse.wst.xsl.feature/pom.xml
@@ -22,7 +22,7 @@
<groupId>org.eclipse.webtools.sourceediting</groupId>
<artifactId>org.eclipse.wst.xsl.feature</artifactId>
- <version>1.3.800-SNAPSHOT</version>
+ <version>1.3.900-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<name>XSLT FeaturePlugin</name>
diff --git a/xsl/features/org.eclipse.wst.xsl_sdk.feature/feature.xml b/xsl/features/org.eclipse.wst.xsl_sdk.feature/feature.xml
index 346d54f..7921c4a 100644
--- a/xsl/features/org.eclipse.wst.xsl_sdk.feature/feature.xml
+++ b/xsl/features/org.eclipse.wst.xsl_sdk.feature/feature.xml
@@ -15,7 +15,7 @@
<feature
id="org.eclipse.wst.xsl_sdk.feature"
label="%featureName"
- version="1.1.800.qualifier"
+ version="1.1.900.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="2.0.0.qualifier">
diff --git a/xsl/features/org.eclipse.wst.xsl_sdk.feature/pom.xml b/xsl/features/org.eclipse.wst.xsl_sdk.feature/pom.xml
index 37712b4..104c656 100644
--- a/xsl/features/org.eclipse.wst.xsl_sdk.feature/pom.xml
+++ b/xsl/features/org.eclipse.wst.xsl_sdk.feature/pom.xml
@@ -21,6 +21,6 @@
<groupId>org.eclipse.webtools.sourceediting</groupId>
<artifactId>org.eclipse.wst.xsl_sdk.feature</artifactId>
- <version>1.1.800-SNAPSHOT</version>
+ <version>1.1.900-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/xsl/features/org.eclipse.wst.xsl_tests.feature/feature.xml b/xsl/features/org.eclipse.wst.xsl_tests.feature/feature.xml
index 33b884c..8da0fbe 100644
--- a/xsl/features/org.eclipse.wst.xsl_tests.feature/feature.xml
+++ b/xsl/features/org.eclipse.wst.xsl_tests.feature/feature.xml
@@ -15,7 +15,7 @@
<feature
id="org.eclipse.wst.xsl_tests.feature"
label="%featureName"
- version="1.1.800.qualifier"
+ version="1.1.900.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="2.0.0.qualifier">
diff --git a/xsl/features/org.eclipse.wst.xsl_tests.feature/pom.xml b/xsl/features/org.eclipse.wst.xsl_tests.feature/pom.xml
index 4bbc7ac..7857575 100644
--- a/xsl/features/org.eclipse.wst.xsl_tests.feature/pom.xml
+++ b/xsl/features/org.eclipse.wst.xsl_tests.feature/pom.xml
@@ -21,6 +21,6 @@
<groupId>org.eclipse.webtools.sourceediting</groupId>
<artifactId>org.eclipse.wst.xsl_tests.feature</artifactId>
- <version>1.1.800-SNAPSHOT</version>
+ <version>1.1.900-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/xsl/tests/org.eclipse.wst.xsl.launching.tests/META-INF/MANIFEST.MF b/xsl/tests/org.eclipse.wst.xsl.launching.tests/META-INF/MANIFEST.MF
index 262309b..cb695e9 100644
--- a/xsl/tests/org.eclipse.wst.xsl.launching.tests/META-INF/MANIFEST.MF
+++ b/xsl/tests/org.eclipse.wst.xsl.launching.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.eclipse.wst.xsl.launching.tests;singleton:=true
-Bundle-Version: 1.2.0.qualifier
+Bundle-Version: 1.2.100.qualifier
Require-Bundle: org.eclipse.ui;bundle-version="[3.4.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
diff --git a/xsl/tests/org.eclipse.wst.xsl.launching.tests/pom.xml b/xsl/tests/org.eclipse.wst.xsl.launching.tests/pom.xml
index a68a447..751cd90 100644
--- a/xsl/tests/org.eclipse.wst.xsl.launching.tests/pom.xml
+++ b/xsl/tests/org.eclipse.wst.xsl.launching.tests/pom.xml
@@ -22,7 +22,7 @@
<groupId>org.eclipse.webtools.sourceediting</groupId>
<artifactId>org.eclipse.wst.xsl.launching.tests</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>XSL Launching Tests</name>
diff --git a/xsl/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/XSLLaunchingTest.java b/xsl/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/XSLLaunchingTest.java
index 24c92df..0b8e4e9 100644
--- a/xsl/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/XSLLaunchingTest.java
+++ b/xsl/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/XSLLaunchingTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2017 Jesper Steen M�ller
+ * Copyright (c) 2008, 2019 Jesper Steen M�ller
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -14,20 +14,23 @@
package org.eclipse.wst.xsl.launching.tests.testcase;
-import java.io.*;
-import static org.junit.Assert.*;
-import javax.xml.parsers.*;
+import static org.junit.Assert.assertEquals;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.w3c.dom.*;
-import org.xml.sax.*;
+import java.io.IOException;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.wst.xsl.launching.tests.AbstractLaunchingTest;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
public class XSLLaunchingTest extends AbstractLaunchingTest {
@@ -56,7 +59,7 @@
super.tearDown();
}
- @Ignore @Test
+ @Test
public void testSimpleTransformation() throws Exception {
IPath folder = testProject.getFullPath();
env.addFileFromResource(folder, "1-input.xml", "1-input.xml");
@@ -79,7 +82,7 @@
* @throws SAXException
* @throws IOException
*/
- @Ignore @Test
+ @Test
public void testTransformComments() throws Exception {
IPath folder = testProject.getFullPath();
env.addFileFromResource(folder, "testCommentInput.xml",