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 177463 Details for
Bug 288759
[reconciler] eclipse will always report null point error when a non-existing path is used for links
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
288759.patch.txt (text/plain), 6.89 KB, created by
DJ Houghton
on 2010-08-25 15:15:51 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
DJ Houghton
Created:
2010-08-25 15:15:51 EDT
Size:
6.89 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.reconciler.dropins >Index: src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java,v >retrieving revision 1.66 >diff -u -r1.66 Activator.java >--- src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java 22 Jun 2010 14:59:47 -0000 1.66 >+++ src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java 25 Aug 2010 19:13:23 -0000 >@@ -18,6 +18,7 @@ > import org.eclipse.equinox.internal.p2.core.helpers.*; > import org.eclipse.equinox.internal.p2.extensionlocation.*; > import org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager; >+import org.eclipse.equinox.internal.p2.reconciler.dropins.DropinsRepositoryListener.LinkedRepository; > import org.eclipse.equinox.internal.p2.update.Configuration; > import org.eclipse.equinox.internal.p2.update.PathUtil; > import org.eclipse.equinox.internal.provisional.p2.directorywatcher.DirectoryWatcher; >@@ -357,9 +358,10 @@ > File child = children[inner]; > if (child.isFile() && child.getName().toLowerCase().endsWith(EXT_LINK)) { > // if we have a link file then add the link file and its target >- File target = DropinsRepositoryListener.getLinkedFile(child); >- if (target == null || !target.exists()) >+ LinkedRepository repo = DropinsRepositoryListener.getLinkedRepository(child); >+ if (repo == null || !repo.exists()) > continue; >+ File target = repo.getLocation(); > result.add(child); > result.add(target); > File eclipse = new File(target, DIR_ECLIPSE); >Index: src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java,v >retrieving revision 1.24 >diff -u -r1.24 DropinsRepositoryListener.java >--- src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java 25 Feb 2010 17:30:53 -0000 1.24 >+++ src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java 25 Aug 2010 19:13:23 -0000 >@@ -11,8 +11,6 @@ > *******************************************************************************/ > package org.eclipse.equinox.internal.p2.reconciler.dropins; > >-import org.eclipse.equinox.p2.query.QueryUtil; >- > import java.io.*; > import java.net.URI; > import java.net.URISyntaxException; >@@ -28,6 +26,7 @@ > import org.eclipse.equinox.p2.core.ProvisionException; > import org.eclipse.equinox.p2.metadata.IInstallableUnit; > import org.eclipse.equinox.p2.query.IQueryResult; >+import org.eclipse.equinox.p2.query.QueryUtil; > import org.eclipse.equinox.p2.repository.IRepository; > import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; > import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; >@@ -43,6 +42,7 @@ > private static final String LINK = ".link"; //$NON-NLS-1$ > private static final String ZIP = ".zip"; //$NON-NLS-1$ > private static final String LINKS_PATH = "path"; //$NON-NLS-1$ >+ private static final String LINK_IS_OPTIONAL = "optional"; //$NON-NLS-1$ > private static final String DROPIN_ARTIFACT_REPOSITORIES = "dropin.artifactRepositories"; //$NON-NLS-1$ > private static final String DROPIN_METADATA_REPOSITORIES = "dropin.metadataRepositories"; //$NON-NLS-1$ > private static final String PIPE = "|"; //$NON-NLS-1$ >@@ -50,6 +50,34 @@ > private List<IMetadataRepository> metadataRepositories = new ArrayList<IMetadataRepository>(); > private List<IArtifactRepository> artifactRepositories = new ArrayList<IArtifactRepository>(); > >+ static class LinkedRepository { >+ LinkedRepository(File location) { >+ super(); >+ if (location == null) >+ throw new IllegalArgumentException("Repository location cannot be null."); //$NON-NLS-1$ >+ this.location = location; >+ } >+ >+ boolean exists() { >+ return location.exists(); >+ } >+ >+ File getLocation() { >+ return location; >+ } >+ >+ boolean isOptional() { >+ return optional; >+ } >+ >+ void setOptional(boolean optional) { >+ this.optional = optional; >+ } >+ >+ private File location; >+ private boolean optional = false; >+ } >+ > public DropinsRepositoryListener(IProvisioningAgent agent, String repositoryName) { > super(repositoryName, true); > this.agent = agent; >@@ -81,6 +109,8 @@ > > private void addRepository(File file) { > URI repoLocation = createRepositoryLocation(file); >+ if (repoLocation == null) >+ return; > Map<String, String> properties = new HashMap<String, String>(); > // if the file pointed to a link file, keep track of the attribute > // so we can add it to the repo later >@@ -89,17 +119,15 @@ > if (linkLocation != null) > properties.put(Site.PROP_LINK_FILE, file.getAbsolutePath()); > } >- if (repoLocation != null) { >- getMetadataRepository(repoLocation, properties); >- getArtifactRepository(repoLocation, properties); >- } >+ getMetadataRepository(repoLocation, properties); >+ getArtifactRepository(repoLocation, properties); > } > > /* > * Return the file pointed to by the given link file. Return null if there is a problem > * reading the file or resolving the location. > */ >- static File getLinkedFile(File file) { >+ static LinkedRepository getLinkedRepository(File file) { > Properties links = new Properties(); > try { > InputStream input = new BufferedInputStream(new FileInputStream(file)); >@@ -133,7 +161,13 @@ > linkedFile = new File(root, path); > } > try { >- return linkedFile.getCanonicalFile(); >+ LinkedRepository result = new LinkedRepository(linkedFile.getCanonicalFile()); >+ // Check if the link target is marked as optional. >+ // If link is optional, then the link target may not exist. >+ // So IF link is marked as optional AND does not exist, simply ignore it. >+ String optional = links.getProperty(LINK_IS_OPTIONAL); >+ result.setOptional(Boolean.valueOf(optional).booleanValue()); >+ return result; > } catch (IOException e) { > LogHelper.log(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.error_resolving_link, linkedFile.getAbsolutePath(), file.getAbsolutePath()), e)); > return null; >@@ -179,13 +213,13 @@ > } > > private URI getLinkRepository(File file, boolean logMissingLink) { >- File repo = getLinkedFile(file); >+ LinkedRepository repo = getLinkedRepository(file); > if (repo == null) { > if (logMissingLink) > LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Unable to determine link location from file: " + file.getAbsolutePath())); //$NON-NLS-1$ > return null; > } >- return repo.toURI(); >+ return repo.isOptional() && !repo.exists() ? null : repo.getLocation().toURI(); > } > > public void getMetadataRepository(URI repoURL, Map<String, String> properties) {
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 288759
:
146638
| 177463