Login | Register
My pages Projects Community openCollabNet

Discussions > commits > subclipse svn commit: r5996 - trunk/subclipse/org.tigris.subversion.subclipse.core/src/org/tigris/subversion/subclipse/core/resources/SVNWorkspaceRoot.java

subclipse
Discussion topic

Back to topic list

subclipse svn commit: r5996 - trunk/subclipse/org.tigris.subversion.subclipse.core/src/org/tigris/subversion/subclipse/core/resources/SVNWorkspaceRoot.java

Author selsemore
Full name Stephen Elsemore
Date 2016-06-22 10:16:14 PDT
Message Author: selsemore
Date: 2016-06-22 10:16:13-0700
New Revision: 5996

Modified:
   trunk/subclipse/org.​tigris.subversion.su​bclipse.core/src/org​/tigris/subversion/s​ubclipse/core/resour​ces/SVNWorkspaceRoot​.java

Log:
Fix NPE after attempting to switch to bad URL
Issue #: 1654


Modified: trunk/subclipse/org.​tigris.subversion.su​bclipse.core/src/org​/tigris/subversion/s​ubclipse/core/resour​ces/SVNWorkspaceRoot​.java
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/trunk/su​bclipse/org.tigris.s​ubversion.subclipse.​core/src/org/tigris/​subversion/subclipse​/core/resources/SVNW​orkspaceRoot.java?vi​ew=diff&pathrev=​5996&r1=5995​&r2=5996
====================​====================​====================​==================
--- trunk/subclipse/org.​tigris.subversion.su​bclipse.core/src/org​/tigris/subversion/s​ubclipse/core/resour​ces/SVNWorkspaceRoot​.java (original)
+++ trunk/subclipse/org.​tigris.subversion.su​bclipse.core/src/org​/tigris/subversion/s​ubclipse/core/resour​ces/SVNWorkspaceRoot​.java 2016-06-22 10:16:13-0700
@@ -478,18 +478,21 @@
         return (IResource[]) resources.toArray(new IResource[resources.size()]);
     }
     
- public static IResource[] getResourcesFor(IResource resource) {
- Set<IResource> resources = new LinkedHashSet<IRe​source>();
- resources.add(resource);
- IWorkspaceRoot root = ResourcesPlugin.getW​orkspace().getRoot()​;
- IProject[] projects = root.getProjects();
- for (IProject project : projects) {
- if (!project.getLocatio​n().equals(resource.​getLocation()) && resource.getLocation​().isPrefixOf(projec​t.getLocation())) {
- resources.add(project);
+ public static IResource[] getResourcesFor(IResource resource) {
+ Set<IResource> resources = new LinkedHashSet<IRe​source>();
+ if (resource.getLocation() != null) {
+ resources.add(resource);
+ IWorkspaceRoot root = ResourcesPlugin.getW​orkspace().getRoot()​;
+ IProject[] projects = root.getProjects();
+ for (IProject project : projects) {
+ if (!resource.getLocati​on().equals(project.​getLocation())
+ && resource.getLocation​().isPrefixOf(projec​t.getLocation())) {
+ resources.add(project);
+ }
+ }
             }
+ return (IResource[]) resources.toArray(new IResource[resources.size()]);
         }
- return (IResource[]) resources.toArray(new IResource[resources.size()]);
- }
 
     /**
      * Gets the repository which the local filesystem <code>location​</code> belongs to.

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

subclipse svn commit: r5996 - trunk/subclipse/org.tigris.subversion.subclipse.core/src/org/tigris/subversion/subclipse/core/resources/SVNWorkspaceRoot.java selsemore Stephen Elsemore 2016-06-22 10:16:14 PDT
Messages per page: