jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r161492 - incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java
Date Fri, 15 Apr 2005 16:01:30 GMT
Author: mreutegg
Date: Fri Apr 15 09:01:29 2005
New Revision: 161492

URL: http://svn.apache.org/viewcvs?view=rev&rev=161492
Log:
Update to spec 0.16.4:
- Value in Row of a query result must be of type StringValue if property is of type undefined.

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java?view=diff&r1=161491&r2=161492
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java
Fri Apr 15 09:01:29 2005
@@ -31,6 +31,9 @@
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.PathValue;
 import javax.jcr.LongValue;
+import javax.jcr.PropertyType;
+import javax.jcr.StringValue;
+import javax.jcr.Property;
 import java.util.Arrays;
 import java.util.Set;
 import java.util.HashSet;
@@ -184,7 +187,11 @@
                     if (node.hasProperty(properties[i])) {
                         PropertyImpl prop = node.getProperty(properties[i]);
                         if (!prop.getDefinition().isMultiple()) {
-                            tmp[i] = prop.getValue();
+                            if (prop.getDefinition().getRequiredType() == PropertyType.UNDEFINED)
{
+                                tmp[i] = new StringValue(prop.getString());
+                            } else {
+                                tmp[i] = prop.getValue();
+                            }
                         } else {
                             // mvp values cannot be returned
                             tmp[i] = null;
@@ -202,7 +209,10 @@
                 }
                 values = tmp;
             }
-            return values;
+            // return a copy of the array
+            Value[] ret = new Value[values.length];
+            System.arraycopy(values, 0, ret, 0, values.length);
+            return ret;
         }
 
         /**
@@ -230,9 +240,14 @@
                     throw new ItemNotFoundException(propertyName);
                 }
                 if (node.hasProperty(prop)) {
-                    return node.getProperty(prop).getValue();
+                    Property p = node.getProperty(prop);
+                    if (p.getDefinition().getRequiredType() == PropertyType.UNDEFINED) {
+                        return new StringValue(p.getString());
+                    } else {
+                        return p.getValue();
+                    }
                 } else {
-                    // either jcr:score / jcr:path or not set
+                    // either jcr:score, jcr:path or not set
                     if (QueryConstants.JCR_PATH.equals(prop)) {
                         return PathValue.valueOf(node.getPath());
                     } else if (QueryConstants.JCR_SCORE.equals(prop)) {



Mime
View raw message