[armedbear-cvs] r11552 - branches/scripting/j/src/org/armedbear/lisp

Alessio Stalla astalla at common-lisp.net
Fri Jan 9 22:16:05 UTC 2009


Author: astalla
Date: Fri Jan  9 22:16:04 2009
New Revision: 11552

Log:
- fixed a bug in print-object (java-class), thanks to logicmoo
- jproperty-value get/set gives better error messages when it fails


Modified:
   branches/scripting/j/src/org/armedbear/lisp/Java.java
   branches/scripting/j/src/org/armedbear/lisp/print-object.lisp

Modified: branches/scripting/j/src/org/armedbear/lisp/Java.java
==============================================================================
--- branches/scripting/j/src/org/armedbear/lisp/Java.java	(original)
+++ branches/scripting/j/src/org/armedbear/lisp/Java.java	Fri Jan  9 22:16:04 2009
@@ -706,7 +706,7 @@
 				PropertyDescriptor pd = getPropertyDescriptor(obj, propertyName);
 				return new JavaObject(pd.getReadMethod().invoke(obj));
 			} catch (Exception e) {
-				ConditionThrowable t = new ConditionThrowable("Exception in accessing property");
+				ConditionThrowable t = new ConditionThrowable("Exception reading property");
 				t.initCause(e);
 				throw t;
 			}
@@ -718,16 +718,17 @@
 	                  "java-object property-name value") {
     	
     	public LispObject execute(LispObject javaObject, LispObject propertyName, LispObject value) throws ConditionThrowable {
-			try {
-	            Object obj = javaObject.javaInstance();
-				PropertyDescriptor pd = getPropertyDescriptor(obj, propertyName);
-				pd.getWriteMethod().invoke(obj, value.javaInstance());
-				return value;
-			} catch (Exception e) {
-				ConditionThrowable t = new ConditionThrowable("Exception in accessing property");
-				t.initCause(e);
-				throw t;
-			}
+	    Object obj = null;
+	    try {
+		obj = javaObject.javaInstance();
+		PropertyDescriptor pd = getPropertyDescriptor(obj, propertyName);
+		pd.getWriteMethod().invoke(obj, value.javaInstance());
+		return value;
+	    } catch (Exception e) {
+		ConditionThrowable t = new ConditionThrowable("Exception writing property " + propertyName.writeToString() + " in object " + obj + " to " + value.writeToString());
+		t.initCause(e);
+		throw t;
+	    }
         }
     };
     

Modified: branches/scripting/j/src/org/armedbear/lisp/print-object.lisp
==============================================================================
--- branches/scripting/j/src/org/armedbear/lisp/print-object.lisp	(original)
+++ branches/scripting/j/src/org/armedbear/lisp/print-object.lisp	Fri Jan  9 22:16:04 2009
@@ -38,7 +38,7 @@
   object)
 
 (defmethod print-object ((class java:java-class) stream)
-  (write-string (%write-to-string object) stream))
+  (write-string (%write-to-string class) stream))
 
 (defmethod print-object ((class class) stream)
   (print-unreadable-object (class stream :identity t)




More information about the armedbear-cvs mailing list