You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by st...@apache.org on 2004/08/27 11:56:51 UTC

cvs commit: jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core PropertyImpl.java Test.java

stefan      2004/08/27 02:56:51

  Modified:    proposals/jcrri/src/org/apache/slide/jcr/core
                        PropertyImpl.java Test.java
  Log:
  jcrri: NullPointerException when setting property to null
  
  Revision  Changes    Path
  1.25      +1 -1      jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/PropertyImpl.java
  
  Index: PropertyImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/PropertyImpl.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- PropertyImpl.java	27 Aug 2004 09:28:47 -0000	1.24
  +++ PropertyImpl.java	27 Aug 2004 09:56:51 -0000	1.25
  @@ -132,7 +132,7 @@
   	checkItemState();
   
   	// check for null values
  -	ArrayList list = new ArrayList(values.length);
  +	ArrayList list = new ArrayList();
   	// compact array (purge null entries)
   	if (values != null) {
   	    for (int i = 0; i < values.length; i++) {
  
  
  
  1.17      +15 -0     jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/Test.java
  
  Index: Test.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/Test.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Test.java	27 Aug 2004 09:28:47 -0000	1.16
  +++ Test.java	27 Aug 2004 09:56:51 -0000	1.17
  @@ -25,6 +25,7 @@
   import javax.jcr.nodetype.NodeTypeManager;
   import javax.jcr.util.TraversingItemVisitor;
   import java.io.*;
  +import java.util.ArrayList;
   import java.util.Calendar;
   import java.util.Properties;
   
  @@ -122,6 +123,20 @@
   	dumpTree(root, System.out);
   
   	root.save();
  +
  +	if (root.hasProperty("bla")) {
  +	    root.setProperty("bla", (String) null);
  +	}
  +	if (!root.hasProperty("bla")) {
  +	    String[] strings = new String[]{"huey", "louie", null, "dewey"};
  +	    root.setProperty("bla", strings);
  +	    Value[] vals = root.getProperty("bla").getValues();
  +	    ArrayList list = new ArrayList();
  +	    for (int i = 0; i < vals.length; i++) {
  +		list.add(vals[i].getString());
  +	    }
  +	    System.out.println(list);
  +	}
   
   	System.out.println("after save()...");
   	System.out.println();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org