incubator-kato-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From monte...@apache.org
Subject svn commit: r888882 - /incubator/kato/trunk/org.apache.kato/kato.jdi/src/main/java/org/apache/kato/tools/jdi/KatoReader.java
Date Wed, 09 Dec 2009 17:25:42 GMT
Author: monteith
Date: Wed Dec  9 17:25:42 2009
New Revision: 888882

URL: http://svn.apache.org/viewvc?rev=888882&view=rev
Log:
Fix variable problem with null object references.

Modified:
    incubator/kato/trunk/org.apache.kato/kato.jdi/src/main/java/org/apache/kato/tools/jdi/KatoReader.java

Modified: incubator/kato/trunk/org.apache.kato/kato.jdi/src/main/java/org/apache/kato/tools/jdi/KatoReader.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.jdi/src/main/java/org/apache/kato/tools/jdi/KatoReader.java?rev=888882&r1=888881&r2=888882&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.jdi/src/main/java/org/apache/kato/tools/jdi/KatoReader.java
(original)
+++ incubator/kato/trunk/org.apache.kato/kato.jdi/src/main/java/org/apache/kato/tools/jdi/KatoReader.java
Wed Dec  9 17:25:42 2009
@@ -277,8 +277,9 @@
 			case 'c':
 			{
 				try{
-					if(jField.get(jObject) instanceof JavaObject){
-						JavaObject jOut = (JavaObject)jField.get(jObject);
+					Object field = jField.get(jObject);
+					if(field instanceof JavaObject){
+						JavaObject jOut = (JavaObject)field;
 						addLongToVector(vctr, jOut.getID().getAddress());
 						if (!objectMap.containsKey(jOut.getID().getAddress())){
 							objectMap.put(jOut.getID().getAddress(), jOut);
@@ -286,7 +287,7 @@
 						logr.log(JDILogger.LEVEL_VERYVERBOSE, "  " + jOut.getID().getAddress()); //$NON-NLS-1$
 					}else{
 						addLongToVector(vctr, 0);
-						logr.log(JDILogger.LEVEL_VERYVERBOSE, "  Not JavaObject " + jField.get(jObject).getClass().getName());
//$NON-NLS-1$
+						logr.log(JDILogger.LEVEL_VERYVERBOSE, "  Not JavaObject " + ((field == null) ? "null"
: field.getClass().getName())); //$NON-NLS-1$
 					}
 
 
@@ -1777,21 +1778,22 @@
 
 			JavaClass javaClass = getClass(refType);
 			if (javaClass != null){
-				try{
-					JavaClass jSuperClass = javaClass.getSuperclass();
+				JavaClass jSuperClass = javaClass.getSuperclass();
+				if( jSuperClass != null) {
 					addLongToVector(vctr, jSuperClass.getID().getAddress());
 					logr.log(JDILogger.LEVEL_VERYVERBOSE, "  " + jSuperClass.getID().getAddress()); //$NON-NLS-1$
 					ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
 					rpckt.setData(vectorToByte(vctr));
 					return rpckt;
-				}catch(NullPointerException exxy){
+				} else {
 					addLongToVector(vctr, 0);
 					logr.log(JDILogger.LEVEL_VERYVERBOSE, "  Class "+javaClass.getName()+"{"+javaClass.getID().getAddress()+"}
has no superclass"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 					ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
 					rpckt.setData(vectorToByte(vctr));
-					return rpckt;
-				}
+					return rpckt;	
+				}				
 			}
+			
 			logr.log(JDILogger.LEVEL_VERYVERBOSE, "Invalid class ID"); //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
 
 		} else if (cpckt.getCommand() == 3){



Mime
View raw message