Author: reto
Date: Sat May 21 09:04:32 2011
New Revision: 1125652

URL: http://svn.apache.org/viewvc?rev=1125652&view=rev
Log:
CLEREZZA-540: gracefully handling invalid username in uri path section.

Modified:
    
incubator/clerezza/trunk/parent/platform.graphnodeprovider/src/main/scala/GraphNodeProvider.scala

Modified: 
incubator/clerezza/trunk/parent/platform.graphnodeprovider/src/main/scala/GraphNodeProvider.scala
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.graphnodeprovider/src/main/scala/GraphNodeProvider.scala?rev=1125652&r1=1125651&r2=1125652&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/parent/platform.graphnodeprovider/src/main/scala/GraphNodeProvider.scala
 (original)
+++ 
incubator/clerezza/trunk/parent/platform.graphnodeprovider/src/main/scala/GraphNodeProvider.scala
 Sat May 21 09:04:32 2011
@@ -102,15 +102,19 @@ class GraphNodeProvider extends Logging 
                addToUnion(cgGraph)
 
                if (isLocal && uriPath.startsWith("/user/")) {
-                       val nextSlash = uriPath.indexOf('/',6)
+                       val nextSlash = uriPath.indexOf('/',6)          
                        if (nextSlash != -1) {
                                val userName = uriPath.substring(6, nextSlash)
                                val webIdOption = 
AccessController.doPrivileged(new PrivilegedAction[Option[UriRef]]() {
                                                def run(): Option[UriRef] = {
                                                        val userNode: GraphNode 
= userManager.getUserInSystemGraph(userName)
-                                                       userNode.getNode match {
-                                                               case u: UriRef 
=> Some(u)
-                                                               case _ => None
+                                                       if (userNode != null) {
+                                                               
userNode.getNode match {
+                                                                       case u: 
UriRef => Some(u)
+                                                                       case _ 
=> None
+                                                               }
+                                                       } else {
+                                                               None
                                                        }
                                                }
                                        }


Reply via email to