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 39746 Details for
Bug 138812
directory.list(filter) is spec'd to return null
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch illustrating NPE spots
nullListFilter.patch (text/plain), 5.93 KB, created by
David Williams
on 2006-04-28 01:37:56 EDT
(
hide
)
Description:
patch illustrating NPE spots
Filename:
MIME Type:
Creator:
David Williams
Created:
2006-04-28 01:37:56 EDT
Size:
5.93 KB
patch
obsolete
>Index: src/org/eclipse/update/internal/core/SiteFileFactory.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFileFactory.java,v >retrieving revision 1.68 >diff -u -r1.68 SiteFileFactory.java >--- src/org/eclipse/update/internal/core/SiteFileFactory.java 11 Apr 2006 16:37:57 -0000 1.68 >+++ src/org/eclipse/update/internal/core/SiteFileFactory.java 28 Apr 2006 05:24:13 -0000 >@@ -158,7 +158,18 @@ > try { > // handle the installed featuresConfigured under featuresConfigured subdirectory > dir = featureDir.list(); >- for (int index = 0; index < dir.length; index++) { >+ if (dir == null) { >+ try { >+ printWarning(featureDir); >+ } >+ catch (IOException e) { >+ System.out.println(" * * * * * " + "Unexpected exception while handline exception: "); >+ System.out.println(e.getMessage()); >+ } >+ } >+ else { >+ >+ for (int index = 0; index < dir.length; index++) { > > // the URL must ends with '/' for the bundle to be resolved > newFilePath = dir[index] + (dir[index].endsWith("/") ? "/" : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >@@ -178,6 +189,7 @@ > ((Site) site).addFeatureReferenceModel(featureRef); > } > } >+ } > } catch (MalformedURLException e) { > throw Utilities.newCoreException(NLS.bind(Messages.SiteFileFactory_UnableToCreateURLForFile, (new String[] { newFilePath })), e); > } >@@ -202,7 +214,17 @@ > try { > // only list JAR files > dir = featureDir.list(FeaturePackagedContentProvider.filter); >- for (int index = 0; index < dir.length; index++) { >+ if (dir == null) { >+ try { >+ printWarning(featureDir); >+ } >+ catch (IOException e) { >+ System.out.println(" * * * * * " + "Unexpected exception while handling unexpected exception: "); >+ System.out.println(e.getMessage()); >+ } >+ } >+ else { >+ for (int index = 0; index < dir.length; index++) { > > // check if the JAR file contains a feature.xml > currentFeatureFile = new File(featureDir, dir[index]); >@@ -226,12 +248,23 @@ > site.addFeatureReferenceModel(featureRef); > } > } >+ } > } catch (MalformedURLException e) { > throw Utilities.newCoreException(NLS.bind(Messages.SiteFileFactory_UnableToCreateURLForFile, (new String[] { newFilePath })), e); > } > } > } > >+ private void printWarning(File directory) throws IOException { >+ System.out.println(); >+ System.out.println(" - - - - - " + "Unexpectedly found filtered directory was null instead of empty array: "); >+ System.out.println(" - - - - - " + directory.getCanonicalPath()); >+ System.out.println(" - - - - - " + " canRead: " + directory.canRead()); >+ System.out.println(" - - - - - " + " isDirectory: " + directory.isDirectory()); >+ System.out.println(" - - - - - " + " isHidden: " + directory.isHidden()); >+ System.out.println(); >+ } >+ > /** > * Method parsePlugins. > * >@@ -249,15 +282,28 @@ > return f.isDirectory(); > } > }); >- DefaultPluginParser parser = new DefaultPluginParser(); >- for (int i = 0; i < dirs.length; i++) { >- File pluginFile = new File(dirs[i], "META-INF/MANIFEST.MF"); //$NON-NLS-1$ >- InputStream in = null; >+ >+ if (dirs == null) { > try { >- BundleManifest bundleManifest = new BundleManifest(pluginFile); >- if (bundleManifest.exists()) { >- PluginEntry entry = bundleManifest.getPluginEntry(); >- addParsedPlugin(entry, dirs[i]); >+ printWarning(pluginsDir); >+ } >+ catch (IOException e) { >+ System.out.println(" * * * * * " + "Unexpected exception while handline exception: "); >+ System.out.println(e.getMessage()); >+ } >+ } >+ else { >+ >+ DefaultPluginParser parser = new DefaultPluginParser(); >+ >+ for (int i = 0; i < dirs.length; i++) { >+ File pluginFile = new File(dirs[i], "META-INF/MANIFEST.MF"); //$NON-NLS-1$ >+ InputStream in = null; >+ try { >+ BundleManifest bundleManifest = new BundleManifest(pluginFile); >+ if (bundleManifest.exists()) { >+ PluginEntry entry = bundleManifest.getPluginEntry(); >+ addParsedPlugin(entry, dirs[i]); > } else { > if (!(pluginFile = new File(dirs[i], "plugin.xml")) //$NON-NLS-1$ > .exists()) { >@@ -286,11 +332,13 @@ > try{ > in.close(); > } catch(IOException e){ >+ } >+ } > } > } > } > } >- } >+ > > /** > * tranform each Plugin and Fragment into an ArchiveReferenceModel >@@ -336,12 +384,22 @@ > return; > } > String[] dir = pluginDir.list(FeaturePackagedContentProvider.filter); >- for (int i = 0; i < dir.length; i++) { >- ContentReference ref = null; >- String refString = null; >- InputStream in = null; >+ if (dir == null) { > try { >- File file = new File(pluginDir, dir[i]); >+ printWarning(pluginDir); >+ } >+ catch (IOException e) { >+ System.out.println(" * * * * * " + "Unexpected exception while handline exception: "); >+ System.out.println(e.getMessage()); >+ } >+ } >+ else { >+ for (int i = 0; i < dir.length; i++) { >+ ContentReference ref = null; >+ String refString = null; >+ InputStream in = null; >+ try { >+ File file = new File(pluginDir, dir[i]); > JarContentReference jarReference = new JarContentReference( > null, file); > ref = jarReference.peek("META-INF/MANIFEST.MF", null, null); //$NON-NLS-1$ >@@ -351,8 +409,9 @@ > if (manifest.exists()) { > addParsedPlugin(manifest.getPluginEntry(), file); > continue; >+ } > } >- } >+ > ref = jarReference.peek("plugin.xml", null, null); //$NON-NLS-1$ > if (ref == null) { > ref = jarReference.peek("fragment.xml", null, null); //$NON-NLS-1$ >@@ -381,11 +440,13 @@ > try{ > in.close(); > }catch(IOException ce){ >+ } >+ } > } > } > } > } >- } >+ > > /* > * @see SiteModelFactory#createSiteMapModel()
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 138812
: 39746