aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2014-01-03 03:28:57 (EST)
committerGerrit Code Review @ Eclipse.org2014-01-03 12:18:44 (EST)
commit72a2dd63bdac100bd99c0df62690bd2dfb915634 (patch)
treee8513da4c48d89f930c4b134351f609d0c5d51b4
parent95423a639128106c0145e30f6322e4d98e2d79a9 (diff)
downloadeclipse.jdt.debug-72a2dd63bdac100bd99c0df62690bd2dfb915634.zip
eclipse.jdt.debug-72a2dd63bdac100bd99c0df62690bd2dfb915634.tar.gz
eclipse.jdt.debug-72a2dd63bdac100bd99c0df62690bd2dfb915634.tar.bz2
Bug Id: 404605 - Evaluation of VM System Properties fails with JDKrefs/changes/32/20232/2
having no support for JAXP Description: https://bugs.eclipse.org/bugs/show_bug.cgi?id=404605 for JDK versions greater than 1.3 , VM Installer was assuming JAXP support (which is not mandatory in JDK). Changes have been done to use LegacySystemProperties always and not generate properties in xml format. Change-Id: I5bed612b19839ac27d87ccad9ca6168798ec864d Signed-off-by: Sarika Sinha <sarika.sinha@in.ibm.com>
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractVMInstall.java31
-rw-r--r--org.eclipse.jdt.launching/lib/launchingsupport.jarbin4812 -> 3117 bytes
-rw-r--r--org.eclipse.jdt.launching/support/org/eclipse/jdt/internal/launching/support/SystemProperties.java94
3 files changed, 8 insertions, 117 deletions
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractVMInstall.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractVMInstall.java
index b7b6ee6..e9afc3d 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractVMInstall.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractVMInstall.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 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
@@ -34,7 +34,6 @@ import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.Launch;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.core.model.IStreamsProxy;
-import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.launching.LaunchingMessages;
import org.eclipse.jdt.internal.launching.LaunchingPlugin;
import org.w3c.dom.Document;
@@ -80,10 +79,12 @@ public abstract class AbstractVMInstall implements IVMInstall, IVMInstall2, IVMI
* parameters are <code>null</code>.
*/
public AbstractVMInstall(IVMInstallType type, String id) {
- if (type == null)
- throw new IllegalArgumentException(LaunchingMessages.vmInstall_assert_typeNotNull);
- if (id == null)
- throw new IllegalArgumentException(LaunchingMessages.vmInstall_assert_idNotNull);
+ if (type == null) {
+ throw new IllegalArgumentException(LaunchingMessages.vmInstall_assert_typeNotNull);
+ }
+ if (id == null) {
+ throw new IllegalArgumentException(LaunchingMessages.vmInstall_assert_idNotNull);
+ }
fType= type;
fId= id;
}
@@ -356,23 +357,7 @@ public abstract class AbstractVMInstall implements IVMInstall, IVMInstall2, IVMI
// launch VM to evaluate properties
File file = LaunchingPlugin.getFileInPlugin(new Path("lib/launchingsupport.jar")); //$NON-NLS-1$
if (file != null && file.exists()) {
- String javaVersion = getJavaVersion();
- boolean hasXMLSupport = false;
- if (javaVersion != null) {
- hasXMLSupport = true;
- if (javaVersion.startsWith(JavaCore.VERSION_1_1) ||
- javaVersion.startsWith(JavaCore.VERSION_1_2) ||
- javaVersion.startsWith(JavaCore.VERSION_1_3)) {
- hasXMLSupport = false;
- }
- }
- String mainType = null;
- if (hasXMLSupport) {
- mainType = "org.eclipse.jdt.internal.launching.support.SystemProperties"; //$NON-NLS-1$
- } else {
- mainType = "org.eclipse.jdt.internal.launching.support.LegacySystemProperties"; //$NON-NLS-1$
- }
- VMRunnerConfiguration config = new VMRunnerConfiguration(mainType, new String[]{file.getAbsolutePath()});
+ VMRunnerConfiguration config = new VMRunnerConfiguration("org.eclipse.jdt.internal.launching.support.LegacySystemProperties", new String[] { file.getAbsolutePath() });//$NON-NLS-1$
IVMRunner runner = getVMRunner(ILaunchManager.RUN_MODE);
if (runner == null) {
abort(LaunchingMessages.AbstractVMInstall_0, null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
diff --git a/org.eclipse.jdt.launching/lib/launchingsupport.jar b/org.eclipse.jdt.launching/lib/launchingsupport.jar
index 8c50a58..e0df1c5 100644
--- a/org.eclipse.jdt.launching/lib/launchingsupport.jar
+++ b/org.eclipse.jdt.launching/lib/launchingsupport.jar
Binary files differ
diff --git a/org.eclipse.jdt.launching/support/org/eclipse/jdt/internal/launching/support/SystemProperties.java b/org.eclipse.jdt.launching/support/org/eclipse/jdt/internal/launching/support/SystemProperties.java
deleted file mode 100644
index 6d7b153..0000000
--- a/org.eclipse.jdt.launching/support/org/eclipse/jdt/internal/launching/support/SystemProperties.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2012 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.internal.launching.support;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * Evaluates system properties passed as program arguments.
- *
- * @since 3.2
- */
-public class SystemProperties {
-
- public static void main(String[] args) {
- try {
- Document doc = newDocument();
- Element properties = doc.createElement("systemProperties"); //$NON-NLS-1$
- doc.appendChild(properties);
- for (int i = 0; i < args.length; i++) {
- String name = args[i];
- String value = System.getProperty(name);
- if (value != null) {
- Element property = doc.createElement("property"); //$NON-NLS-1$
- property.setAttribute("name", name); //$NON-NLS-1$
- property.setAttribute("value", value); //$NON-NLS-1$
- properties.appendChild(property);
- }
- }
- String text = serializeDocument(doc);
- System.out.print(text);
- } catch (ParserConfigurationException e) {
- } catch (IOException e) {
- } catch (TransformerException e) {
- }
- }
-
- /**
- * Returns a a new XML document
- * @return document
- * @throws ParserConfigurationException if an exception occurs creating the document builder
- */
- private static Document newDocument() throws ParserConfigurationException {
- DocumentBuilderFactory dfactory= DocumentBuilderFactory.newInstance();
- DocumentBuilder docBuilder= dfactory.newDocumentBuilder();
- Document doc= docBuilder.newDocument();
- return doc;
- }
-
- /**
- * Serializes a XML document into a string - encoded in UTF8 format,
- * with platform line separators.
- *
- * @param doc document to serialize
- * @return the document as a string
- * @throws IOException if the document cannot be created
- * @throws TransformerException if here is an exception reading the XML
- */
- private static String serializeDocument(Document doc) throws IOException, TransformerException {
- ByteArrayOutputStream s= new ByteArrayOutputStream();
-
- TransformerFactory factory= TransformerFactory.newInstance();
- Transformer transformer= factory.newTransformer();
- transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
-
- DOMSource source= new DOMSource(doc);
- StreamResult outputTarget= new StreamResult(s);
- transformer.transform(source, outputTarget);
-
- return s.toString("UTF8"); //$NON-NLS-1$
- }
-}