diff options
| author | Vikas Chandra | 2018-03-26 10:18:30 +0000 |
|---|---|---|
| committer | Vikas Chandra | 2018-03-26 10:18:30 +0000 |
| commit | 0e085d0187261f0f5d8358effcba91beb59075d5 (patch) | |
| tree | f44ec2e93050ee2f74103b4ff12bc1e330a07d49 | |
| parent | e55ef40f99adc3c4b99edc339d1abd3196b8ac60 (diff) | |
| download | eclipse.pde.ui-0e085d0187261f0f5d8358effcba91beb59075d5.tar.gz eclipse.pde.ui-0e085d0187261f0f5d8358effcba91beb59075d5.tar.xz eclipse.pde.ui-0e085d0187261f0f5d8358effcba91beb59075d5.zip | |
Bug 532773 - NPE during API analysis while using Java 10
Change-Id: I597dbc4bbaa680389bb15912bb69c222fbf93a14
Signed-off-by: Vikas Chandra <Vikas.Chandra@in.ibm.com>
| -rw-r--r-- | apitools/org.eclipse.pde.api.tools/JavaSE-10.profile | 270 | ||||
| -rw-r--r-- | apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/ApiBaseline.java | 41 |
2 files changed, 309 insertions, 2 deletions
diff --git a/apitools/org.eclipse.pde.api.tools/JavaSE-10.profile b/apitools/org.eclipse.pde.api.tools/JavaSE-10.profile new file mode 100644 index 0000000000..34a05a954a --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools/JavaSE-10.profile @@ -0,0 +1,270 @@ +############################################################################### +# Copyright (c) 2018 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 +############################################################################### +# NOTE: The JavaSE-10 profile only has VM packages + org.osgi.framework.system.packages = \ + com.oracle.awt,\ + com.oracle.net,\ + com.oracle.nio,\ + com.oracle.tools.packager,\ + com.sun.jarsigner,\ + com.sun.java.accessibility.util,\ + com.sun.javadoc,\ + com.sun.javafx.tools.packager,\ + com.sun.javafx.tools.packager.bundlers,\ + com.sun.javafx.tools.resource,\ + com.sun.jdi,\ + com.sun.jdi.connect,\ + com.sun.jdi.connect.spi,\ + com.sun.jdi.event,\ + com.sun.jdi.request,\ + com.sun.management,\ + com.sun.net.httpserver,\ + com.sun.net.httpserver.spi,\ + com.sun.nio.file,\ + com.sun.nio.sctp,\ + com.sun.security.auth,\ + com.sun.security.auth.callback,\ + com.sun.security.auth.login,\ + com.sun.security.auth.module,\ + com.sun.security.jgss,\ + com.sun.source.doctree,\ + com.sun.source.tree,\ + com.sun.source.util,\ + com.sun.tools.attach,\ + com.sun.tools.attach.spi,\ + com.sun.tools.javac,\ + com.sun.tools.javadoc,\ + com.sun.tools.jconsole,\ + javafx.animation,\ + javafx.application,\ + javafx.beans,\ + javafx.beans.binding,\ + javafx.beans.property,\ + javafx.beans.property.adapter,\ + javafx.beans.value,\ + javafx.collections,\ + javafx.collections.transformation,\ + javafx.concurrent,\ + javafx.css,\ + javafx.css.converter,\ + javafx.embed.swing,\ + javafx.event,\ + javafx.fxml,\ + javafx.geometry,\ + javafx.print,\ + javafx.scene,\ + javafx.scene.canvas,\ + javafx.scene.chart,\ + javafx.scene.control,\ + javafx.scene.control.cell,\ + javafx.scene.control.skin,\ + javafx.scene.effect,\ + javafx.scene.image,\ + javafx.scene.input,\ + javafx.scene.layout,\ + javafx.scene.media,\ + javafx.scene.paint,\ + javafx.scene.shape,\ + javafx.scene.text,\ + javafx.scene.transform,\ + javafx.scene.web,\ + javafx.stage,\ + javafx.util,\ + javafx.util.converter,\ + javax.accessibility,\ + javax.activation,\ + javax.activity,\ + javax.annotation,\ + javax.annotation.processing,\ + javax.crypto,\ + javax.crypto.interfaces,\ + javax.crypto.spec,\ + javax.imageio,\ + javax.imageio.event,\ + javax.imageio.metadata,\ + javax.imageio.plugins.bmp,\ + javax.imageio.plugins.jpeg,\ + javax.imageio.plugins.tiff,\ + javax.imageio.spi,\ + javax.imageio.stream,\ + javax.jnlp,\ + javax.jws,\ + javax.jws.soap,\ + javax.lang.model,\ + javax.lang.model.element,\ + javax.lang.model.type,\ + javax.lang.model.util,\ + javax.management,\ + javax.management.loading,\ + javax.management.modelmbean,\ + javax.management.monitor,\ + javax.management.openmbean,\ + javax.management.relation,\ + javax.management.remote,\ + javax.management.remote.rmi,\ + javax.management.timer,\ + javax.naming,\ + javax.naming.directory,\ + javax.naming.event,\ + javax.naming.ldap,\ + javax.naming.spi,\ + javax.net,\ + javax.net.ssl,\ + javax.print,\ + javax.print.attribute,\ + javax.print.attribute.standard,\ + javax.print.event,\ + javax.rmi,\ + javax.rmi.CORBA,\ + javax.rmi.ssl,\ + javax.script,\ + javax.security.auth,\ + javax.security.auth.callback,\ + javax.security.auth.kerberos,\ + javax.security.auth.login,\ + javax.security.auth.spi,\ + javax.security.auth.x500,\ + javax.security.cert,\ + javax.security.sasl,\ + javax.smartcardio,\ + javax.sound.midi,\ + javax.sound.midi.spi,\ + javax.sound.sampled,\ + javax.sound.sampled.spi,\ + javax.sql,\ + javax.sql.rowset,\ + javax.sql.rowset.serial,\ + javax.sql.rowset.spi,\ + javax.swing,\ + javax.swing.border,\ + javax.swing.colorchooser,\ + javax.swing.event,\ + javax.swing.filechooser,\ + javax.swing.plaf,\ + javax.swing.plaf.basic,\ + javax.swing.plaf.metal,\ + javax.swing.plaf.multi,\ + javax.swing.plaf.nimbus,\ + javax.swing.plaf.synth,\ + javax.swing.table,\ + javax.swing.text,\ + javax.swing.text.html,\ + javax.swing.text.html.parser,\ + javax.swing.text.rtf,\ + javax.swing.tree,\ + javax.swing.undo,\ + javax.tools,\ + javax.transaction,\ + javax.transaction.xa,\ + javax.xml,\ + javax.xml.bind,\ + javax.xml.bind.annotation,\ + javax.xml.bind.annotation.adapters,\ + javax.xml.bind.attachment,\ + javax.xml.bind.helpers,\ + javax.xml.bind.util,\ + javax.xml.catalog,\ + javax.xml.crypto,\ + javax.xml.crypto.dom,\ + javax.xml.crypto.dsig,\ + javax.xml.crypto.dsig.dom,\ + javax.xml.crypto.dsig.keyinfo,\ + javax.xml.crypto.dsig.spec,\ + javax.xml.datatype,\ + javax.xml.namespace,\ + javax.xml.parsers,\ + javax.xml.soap,\ + javax.xml.stream,\ + javax.xml.stream.events,\ + javax.xml.stream.util,\ + javax.xml.transform,\ + javax.xml.transform.dom,\ + javax.xml.transform.sax,\ + javax.xml.transform.stax,\ + javax.xml.transform.stream,\ + javax.xml.validation,\ + javax.xml.ws,\ + javax.xml.ws.handler,\ + javax.xml.ws.handler.soap,\ + javax.xml.ws.http,\ + javax.xml.ws.soap,\ + javax.xml.ws.spi,\ + javax.xml.ws.spi.http,\ + javax.xml.ws.wsaddressing,\ + javax.xml.xpath,\ + jdk.dynalink,\ + jdk.dynalink.beans,\ + jdk.dynalink.linker,\ + jdk.dynalink.linker.support,\ + jdk.dynalink.support,\ + jdk.incubator.http,\ + jdk.javadoc.doclet,\ + jdk.jfr,\ + jdk.jfr.consumer,\ + jdk.jshell,\ + jdk.jshell.execution,\ + jdk.jshell.spi,\ + jdk.jshell.tool,\ + jdk.management.cmm,\ + jdk.management.jfr,\ + jdk.management.resource,\ + jdk.nashorn.api.scripting,\ + jdk.nashorn.api.tree,\ + jdk.net,\ + jdk.packager.services,\ + jdk.packager.services.singleton,\ + jdk.security.jarsigner,\ + netscape.javascript,\ + org.ietf.jgss,\ + org.omg.CORBA,\ + org.omg.CORBA.DynAnyPackage,\ + org.omg.CORBA.ORBPackage,\ + org.omg.CORBA.TypeCodePackage,\ + org.omg.CORBA.portable,\ + org.omg.CORBA_2_3,\ + org.omg.CORBA_2_3.portable,\ + org.omg.CosNaming,\ + org.omg.CosNaming.NamingContextExtPackage,\ + org.omg.CosNaming.NamingContextPackage,\ + org.omg.Dynamic,\ + org.omg.DynamicAny,\ + org.omg.DynamicAny.DynAnyFactoryPackage,\ + org.omg.DynamicAny.DynAnyPackage,\ + org.omg.IOP,\ + org.omg.IOP.CodecFactoryPackage,\ + org.omg.IOP.CodecPackage,\ + org.omg.Messaging,\ + org.omg.PortableInterceptor,\ + org.omg.PortableInterceptor.ORBInitInfoPackage,\ + org.omg.PortableServer,\ + org.omg.PortableServer.CurrentPackage,\ + org.omg.PortableServer.POAManagerPackage,\ + org.omg.PortableServer.POAPackage,\ + org.omg.PortableServer.ServantLocatorPackage,\ + org.omg.PortableServer.portable,\ + org.omg.SendingContext,\ + org.omg.stub.java.rmi,\ + org.w3c.dom,\ + org.w3c.dom.bootstrap,\ + org.w3c.dom.css,\ + org.w3c.dom.events,\ + org.w3c.dom.html,\ + org.w3c.dom.ls,\ + org.w3c.dom.ranges,\ + org.w3c.dom.stylesheets,\ + org.w3c.dom.traversal,\ + org.w3c.dom.views,\ + org.w3c.dom.xpath,\ + org.xml.sax,\ + org.xml.sax.ext,\ + org.xml.sax.helpers,\ + sun.misc,\ + sun.reflect
\ No newline at end of file diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/ApiBaseline.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/ApiBaseline.java index 66793e82ed..23ad1f0610 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/ApiBaseline.java +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/ApiBaseline.java @@ -317,6 +317,39 @@ public class ApiBaseline extends ApiElement implements IApiBaseline, IVMInstallC return null; } + private static Properties getJavaProfilePropertiesForVMPackage(String ee) { + Bundle osgiBundle = Platform.getBundle("org.eclipse.pde.api.tools"); //$NON-NLS-1$ + if (osgiBundle == null) { + return null; + } + URL profileURL = osgiBundle.getEntry(ee.replace('/', '_') + ".profile"); //$NON-NLS-1$ + if (profileURL != null) { + InputStream is = null; + try { + profileURL = FileLocator.resolve(profileURL); + URLConnection openConnection = profileURL.openConnection(); + openConnection.setUseCaches(false); + is = openConnection.getInputStream(); + if (is != null) { + Properties profile = new Properties(); + profile.load(is); + return profile; + } + } catch (IOException e) { + ApiPlugin.log(e); + } finally { + try { + if (is != null) { + is.close(); + } + } catch (IOException e) { + ApiPlugin.log(e); + } + } + } + return null; + } + /** * Initializes this baseline from the given properties. * @@ -327,8 +360,11 @@ public class ApiBaseline extends ApiElement implements IApiBaseline, IVMInstallC private void initialize(Properties profile, ExecutionEnvironmentDescription description) throws CoreException { String value = profile.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES); if (value == null) { - // Java 10 onwards calculate this on runtime. - value = getVMPackages(); + if (value == null) { + // Java 10 onwards calculate this via profile in this plugin + Properties javaProfilePropertiesForVMPackage = getJavaProfilePropertiesForVMPackage(description.getProperty(ExecutionEnvironmentDescription.CLASS_LIB_LEVEL)); + value = javaProfilePropertiesForVMPackage.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES); + } } String[] systemPackages = null; if (value != null) { @@ -375,6 +411,7 @@ public class ApiBaseline extends ApiElement implements IApiBaseline, IVMInstallC fSystemLibraryComponentList.add(fSystemLibraryComponent); } + @SuppressWarnings("unused") private String getVMPackages() { if (fVMPackages == null) { fVMPackages = calculateVMPackages(); |
