pnever      2003/09/16 03:11:06

  Modified:    src/share/org/apache/slide/structure ObjectNode.java
  Log:
  Fixed java.lang.NegativeArraySizeException problem.
  Thanks to Martin Holz:
  
  "bindings implementation seems to introduce or reveal a
  bug in ObjectNode:
  
  org.apache.slide.common.ServiceAccessException:
  ...
  Caused by: java.lang.NegativeArraySizeException
          at org.apache.slide.structure.ObjectNode$UriPath.parent(ObjectNode.java:762)
          at org.apache.slide.structure.ObjectNode.addChildren(ObjectNode.java:544)
          at org.apache.slide.structure.ObjectNode.<init>(ObjectNode.java:151)
          at org.apache.slide.structure.SubjectNode.<init>(SubjectNode.java:102)
  
  UriPath.parent does not check, if the uri describes the root node '/'.
  For the root node, "this.tokens.length" is 0, so
  "result.tokens = new String[this.tokens.length - 1]" will fail.
  
  UriPath.parent should probably return null.
  
  --
  Martin Holz     <[EMAIL PROTECTED]>"
  
  Revision  Changes    Path
  1.13      +7 -4      
jakarta-slide/src/share/org/apache/slide/structure/ObjectNode.java
  
  Index: ObjectNode.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/structure/ObjectNode.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ObjectNode.java   3 Sep 2003 13:52:10 -0000       1.12
  +++ ObjectNode.java   16 Sep 2003 10:11:06 -0000      1.13
  @@ -755,6 +755,9 @@
           }
           
           public UriPath parent() {
  +            if (this.tokens.length == 0) {
  +                return null;
  +            }
               UriPath result = new UriPath();
               result.tokens = new String[this.tokens.length - 1];
               for (int i = 0; i < result.tokens.length; i++) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to