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 11909 Details for
Bug 63911
ExtensionsParser should use serviceTracker
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch for runtime
org.eclipse.core.runtime-63911.diff (text/plain), 7.94 KB, created by
Rafael Chaves
on 2004-06-10 16:39:07 EDT
(
hide
)
Description:
patch for runtime
Filename:
MIME Type:
Creator:
Rafael Chaves
Created:
2004-06-10 16:39:07 EDT
Size:
7.94 KB
patch
obsolete
>Index: src/org/eclipse/core/internal/registry/EclipseBundleListener.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/EclipseBundleListener.java,v >retrieving revision 1.19 >diff -u -r1.19 EclipseBundleListener.java >--- src/org/eclipse/core/internal/registry/EclipseBundleListener.java 19 May 2004 20:37:55 -0000 1.19 >+++ src/org/eclipse/core/internal/registry/EclipseBundleListener.java 10 Jun 2004 20:35:08 -0000 >@@ -15,6 +15,7 @@ > import java.net.URL; > import java.util.MissingResourceException; > import java.util.ResourceBundle; >+import javax.xml.parsers.ParserConfigurationException; > import org.eclipse.core.internal.runtime.*; > import org.eclipse.core.runtime.*; > import org.osgi.framework.*; >@@ -35,9 +36,11 @@ > private static final String FRAGMENT_MANIFEST = "fragment.xml"; //$NON-NLS-1$ > > private ExtensionRegistry registry; >+ private ExtensionsParser parser; > > public EclipseBundleListener(ExtensionRegistry registry) { > this.registry = registry; >+ this.parser = new ExtensionsParser(); > } > > public void bundleChanged(BundleEvent event) { >@@ -134,7 +137,7 @@ > } catch (MissingResourceException e) { > //Ignore the exception > } >- Namespace bundleModel = new ExtensionsParser(problems).parseManifest(new InputSource(is), manifestType, manifestName, b); >+ Namespace bundleModel = parser.parseManifest(problems, new InputSource(is), manifestType, manifestName, b); > bundleModel.setUniqueIdentifier(bundle.getSymbolicName()); > bundleModel.setBundle(bundle); > if (isFragment) { >@@ -145,13 +148,14 @@ > if (problems.getSeverity() != IStatus.OK) > InternalPlatform.getDefault().log(problems); > return bundleModel; >+ } catch (ParserConfigurationException e) { >+ logParsingError(bundle, e); >+ return null; > } catch (SAXException e) { >- // TODO: need to log this >- e.printStackTrace(); >+ logParsingError(bundle, e); > return null; > } catch (IOException e) { >- // TODO: need to log this >- e.printStackTrace(); >+ logParsingError(bundle, e); > return null; > } finally { > try { >@@ -160,6 +164,11 @@ > // nothing to do > } > } >+ } >+ >+ private void logParsingError(Bundle bundle, Exception e) { >+ String message = Policy.bind("parse.failedParsingManifest", bundle.getLocation()); //$NON-NLS-1$ >+ InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, 0, message, e)); > } > > } >Index: src/org/eclipse/core/internal/registry/ExtensionsParser.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.core.runtime/src/org/eclipse/core/internal/registry/ExtensionsParser.java,v >retrieving revision 1.17 >diff -u -r1.17 ExtensionsParser.java >--- src/org/eclipse/core/internal/registry/ExtensionsParser.java 24 May 2004 17:57:26 -0000 1.17 >+++ src/org/eclipse/core/internal/registry/ExtensionsParser.java 10 Jun 2004 20:35:08 -0000 >@@ -17,7 +17,7 @@ > import javax.xml.parsers.SAXParserFactory; > import org.eclipse.core.internal.runtime.*; > import org.eclipse.core.runtime.*; >-import org.osgi.framework.ServiceReference; >+import org.osgi.util.tracker.ServiceTracker; > import org.xml.sax.*; > import org.xml.sax.helpers.DefaultHandler; > >@@ -25,6 +25,7 @@ > // Introduced for backward compatibility > private final static String NO_EXTENSION_MUNGING = "eclipse.noExtensionMunging"; //$NON-NLS-1$ //System property > private static Map extensionPointMap; >+ private static ServiceTracker parserFactoryTracker; > static { > initializeExtensionPointMap(); > } >@@ -67,7 +68,6 @@ > // populating in this plugin descriptor > private Stack objectStack = new Stack(); > >- private ServiceReference parserReference; > private String schemaVersion = null; > > // A status for holding results. >@@ -126,9 +126,9 @@ > > private Locator locator = null; > >- public ExtensionsParser(MultiStatus status) { >- super(); >- this.status = status; >+ public ExtensionsParser() { >+ parserFactoryTracker = new ServiceTracker(InternalPlatform.getDefault().getBundleContext(), SAXParserFactory.class.getName(), null); >+ parserFactoryTracker.open(); > } > > /** >@@ -346,27 +346,17 @@ > error(new Status(IStatus.WARNING, Platform.PI_RUNTIME, PARSE_PROBLEM, msg, ex)); > } > >- private SAXParserFactory acquireXMLParsing() { >- parserReference = InternalPlatform.getDefault().getBundleContext().getServiceReference("javax.xml.parsers.SAXParserFactory"); //$NON-NLS-1$ >- if (parserReference == null) >- return null; >- return (SAXParserFactory) InternalPlatform.getDefault().getBundleContext().getService(parserReference); >- } >- >- private void releaseXMLParsing() { >- if (parserReference != null) >- InternalPlatform.getDefault().getBundleContext().ungetService(parserReference); >- } >- >- public Namespace parseManifest(InputSource in, String manifestType, String manifestName, ResourceBundle bundle) throws SAXException, IOException { >+ public Namespace parseManifest(MultiStatus status, InputSource in, String manifestType, String manifestName, ResourceBundle bundle) throws ParserConfigurationException, SAXException, IOException { >+ this.status = status; > long start = 0; > this.resources = bundle; > if (InternalPlatform.DEBUG) > start = System.currentTimeMillis(); > >- SAXParserFactory factory = acquireXMLParsing(); >+ SAXParserFactory factory = (SAXParserFactory) parserFactoryTracker.getService(); >+ > if (factory == null) >- return null; //TODO We should log a warning >+ throw new SAXException(Policy.bind("parse.xmlParserNotAvailable")); //$NON-NLS-1$ > > try { > if (manifestType == null) >@@ -377,24 +367,16 @@ > locationName = in.getSystemId(); > if (locationName == null) > locationName = manifestName; >+ factory.setNamespaceAware(true); > try { >- factory.setNamespaceAware(true); >- try { >- factory.setFeature("http://xml.org/sax/features/string-interning", true); //$NON-NLS-1$ >- } catch (SAXException se) { >- // ignore; we can still operate without string-interning >- } >- factory.setValidating(false); >- factory.newSAXParser().parse(in, this); >- } catch (ParserConfigurationException e) { >- // TODO Auto-generated catch block >- // If this happens seems like we should throw an exception. >- e.printStackTrace(); >+ factory.setFeature("http://xml.org/sax/features/string-interning", true); //$NON-NLS-1$ >+ } catch (SAXException se) { >+ // ignore; we can still operate without string-interning > } >- >+ factory.setValidating(false); >+ factory.newSAXParser().parse(in, this); > return (Namespace) objectStack.pop(); > } finally { >- releaseXMLParsing(); > if (InternalPlatform.DEBUG) { > cumulativeTime = cumulativeTime + (System.currentTimeMillis() - start); > InternalPlatform.getDefault().setOption("org.eclipse.core.runtime/registry/parsing/timing/value", Long.toString(cumulativeTime)); //$NON-NLS-1$ >Index: src/org/eclipse/core/internal/runtime/messages.properties >=================================================================== >RCS file: /home/eclipse/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/messages.properties,v >retrieving revision 1.75 >diff -u -r1.75 messages.properties >--- src/org/eclipse/core/internal/runtime/messages.properties 26 May 2004 15:34:56 -0000 1.75 >+++ src/org/eclipse/core/internal/runtime/messages.properties 10 Jun 2004 20:35:09 -0000 >@@ -93,6 +93,8 @@ > parse.unknownAttributeLine= Unknown attribute \"{1}\" for element \"{0}\" ignored (line: {2}). > parse.unknownElement = Unknown element \"{1}\", found within a \"{0}\", ignored. > parse.unknownElementLine = Unknown element \"{1}\", found within a \"{0}\", ignored (line: {2}). >+parse.xmlParserNotAvailable=Could not acquire XML parsing service. >+parse.failedParsingManifest=Could not parse plug-in manifest for \"{0}\". Any contributed extensions and extension points will be ignored. > > > ### metadata
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 63911
:
11883
|
11909
|
11910
|
11911