jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r786513 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
Date Fri, 19 Jun 2009 14:06:01 GMT
Author: stefan
Date: Fri Jun 19 14:06:01 2009
New Revision: 786513

URL: http://svn.apache.org/viewvc?rev=786513&view=rev
Log:
JCR-2165: Node.getReferences(String) and Node.getWeakReferences(String) issues

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=786513&r1=786512&r2=786513&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
Fri Jun 19 14:06:01 2009
@@ -4637,7 +4637,7 @@
                         throw new RepositoryException("invalid property name: " + name, e);
                     }
                     ArrayList<PropertyId> filteredList = new ArrayList<PropertyId>(idList.size());
-                    for (PropertyId propId : filteredList) {
+                    for (PropertyId propId : idList) {
                         if (propId.getName().equals(qName)) {
                             filteredList.add(propId);
                         }
@@ -4682,13 +4682,27 @@
                 Node n = nit.nextNode();
                 for (PropertyIterator pit = n.getProperties(); pit.hasNext();) {
                     Property p = pit.nextProperty();
-                    if (p.getType() == PropertyType.WEAKREFERENCE
-                            && p.getString().equals(getIdentifier())) {
-                        if (name != null) {
-                            if (name.equals(p.getName())) {
-                                l.add(p);
+                    if (name != null && !name.equals(p.getName())) {
+                        continue;
+                    }
+                    if (p.getType() == PropertyType.WEAKREFERENCE) {
+                        boolean containsId = false;
+                        if (p.isMultiple()) {
+                            // multi-valued
+                            Value[] v = p.getValues();
+                            for (int i = 0; i < v.length; i++) {
+                                if (getIdentifier().equals(v[i].getString())) {
+                                    containsId = true;
+                                    break;
+                                }
                             }
                         } else {
+                            // single-valued
+                            if (getIdentifier().equals(p.getString())) {
+                                containsId = true;
+                            }
+                        }
+                        if (containsId) {
                             l.add(p);
                         }
                     }



Mime
View raw message