ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shalg...@apache.org
Subject svn commit: r1498690 - /ctakes/trunk/ctakes-dependency-parser/src/main/java/org/apache/ctakes/dependency/parser/util/DependencyUtility.java
Date Mon, 01 Jul 2013 21:13:44 GMT
Author: shalgrim
Date: Mon Jul  1 21:13:43 2013
New Revision: 1498690

URL: http://svn.apache.org/r1498690
Log:
fixing a null pointer exception

Modified:
    ctakes/trunk/ctakes-dependency-parser/src/main/java/org/apache/ctakes/dependency/parser/util/DependencyUtility.java

Modified: ctakes/trunk/ctakes-dependency-parser/src/main/java/org/apache/ctakes/dependency/parser/util/DependencyUtility.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dependency-parser/src/main/java/org/apache/ctakes/dependency/parser/util/DependencyUtility.java?rev=1498690&r1=1498689&r2=1498690&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dependency-parser/src/main/java/org/apache/ctakes/dependency/parser/util/DependencyUtility.java
(original)
+++ ctakes/trunk/ctakes-dependency-parser/src/main/java/org/apache/ctakes/dependency/parser/util/DependencyUtility.java
Mon Jul  1 21:13:43 2013
@@ -257,8 +257,26 @@ public abstract class DependencyUtility 
 		if (sent1.equals(sent2)) {
 			return getPath( getDependencyNodes(jCas, sent1), node1, node2);
 		} else {
-			logger.debug("Cannot find path between nodes in different sentences. Node1: "
-					+ node1.getCoveredText() + "  Node2: " + node2.getCoveredText());			
+			
+			// 6/28/13 shalgrim
+			// nodes can be null so check before calling getCoveredText
+			String node1txt, node2txt;
+			
+			if (node1 == null) {
+				node1txt = "null";
+			} else {
+				node1txt = node1.getCoveredText();
+			}
+			
+			if (node2 == null)
+			{
+				node2txt = "null";
+			} else {
+				node2txt = node2.getCoveredText();
+			}
+			
+			logger.debug(String.format("Cannot find path between nodes in different sentences. Node1:
%s  Node2: %s",
+					node1txt, node2txt));			
 		}
 		return null;
 	}



Mime
View raw message