From 708dcdb5b70238990c83413de5f00836f5ad6af2 Mon Sep 17 00:00:00 2001 From: Feu Teston Date: Wed, 26 Aug 2009 09:06:44 -0300 Subject: [PATCH] fixing a few null pointer exeptions --- extensions/dna-connector-svn/.classpath | 6 +- .../.settings/org.eclipse.jdt.core.prefs | 5 ++ .../svn/SVNRepositoryRequestProcessor.java | 41 +++++++++++--------- 3 files changed, 31 insertions(+), 21 deletions(-) create mode 100644 extensions/dna-connector-svn/.settings/org.eclipse.jdt.core.prefs diff --git a/extensions/dna-connector-svn/.classpath b/extensions/dna-connector-svn/.classpath index b9205b3..52bceae 100644 --- a/extensions/dna-connector-svn/.classpath +++ b/extensions/dna-connector-svn/.classpath @@ -1,9 +1,9 @@ - - - + + + diff --git a/extensions/dna-connector-svn/.settings/org.eclipse.jdt.core.prefs b/extensions/dna-connector-svn/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..7732742 --- /dev/null +++ b/extensions/dna-connector-svn/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +#Mon Aug 10 09:04:38 BRT 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java b/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java index ab29ab6..d2e1429 100644 --- a/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java +++ b/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java @@ -30,6 +30,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Set; + import org.jboss.dna.common.i18n.I18n; import org.jboss.dna.common.util.Logger; import org.jboss.dna.connector.scm.ScmAction; @@ -184,22 +185,24 @@ public class SVNRepositoryRequestProcessor extends RequestProcessor implements S directoryPath = directoryPath.substring(1); } Collection dirEntries = SVNRepositoryUtil.getDir(workspaceRoot, directoryPath); - for (SVNDirEntry entry : dirEntries) { - // Decide how to represent the children ... - if (entry.getKind() == SVNNodeKind.DIR) { - // Create a Location for each file and directory contained by the parent directory ... - String localName = entry.getName(); - Name childName = nameFactory().create(defaultNamespaceUri, localName); - Path childPath = pathFactory().create(requestedPath, childName); - request.addChild(Location.create(childPath)); - } else if (entry.getKind() == SVNNodeKind.FILE) { - // The parent is a file, and the path may refer to the node that is either the "nt:file" parent - // node, or the child "jcr:content" node... - String localName = entry.getName(); - Path contentPath = pathFactory().create(getPathAsString(requestedPath) + BACK_SLASH + localName); - Location content = Location.create(pathFactory().create(contentPath, JcrLexicon.CONTENT)); - request.addChild(content); - } + if(dirEntries!=null){ + for (SVNDirEntry entry : dirEntries) { + // Decide how to represent the children ... + if (entry.getKind() == SVNNodeKind.DIR) { + // Create a Location for each file and directory contained by the parent directory ... + String localName = entry.getName(); + Name childName = nameFactory().create(defaultNamespaceUri, localName); + Path childPath = pathFactory().create(requestedPath, childName); + request.addChild(Location.create(childPath)); + } else if (entry.getKind() == SVNNodeKind.FILE) { + // The parent is a file, and the path may refer to the node that is either the "nt:file" parent + // node, or the child "jcr:content" node... + String localName = entry.getName(); + Path contentPath = pathFactory().create(getPathAsString(requestedPath) + BACK_SLASH + localName); + Location content = Location.create(pathFactory().create(contentPath, JcrLexicon.CONTENT)); + request.addChild(content); + } + } } } else { if (!requestedPath.getLastSegment().getName().equals(JcrLexicon.CONTENT)) { @@ -263,8 +266,10 @@ public class SVNRepositoryRequestProcessor extends RequestProcessor implements S directoryPath = directoryPath.substring(1); } request.addProperty(factory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FOLDER)); - SVNDirEntry entry = getEntryInfo(workspaceRoot, directoryPath); - request.addProperty(factory.create(JcrLexicon.LAST_MODIFIED, dateFactory.create(entry.getDate()))); + SVNDirEntry entry = getEntryInfo(workspaceRoot, directoryPath); + if(entry!=null){ + request.addProperty(factory.create(JcrLexicon.LAST_MODIFIED, dateFactory.create(entry.getDate()))); + } } else { if (requestedPath.getLastSegment().getName().equals(JcrLexicon.CONTENT)) { String contentPath = getPathAsString(requestedPath.getParent()); -- 1.6.3.1