You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by js...@apache.org on 2026/07/23 11:57:16 UTC

(jackrabbit-oak) 01/01: OAK-12327: PropertyValueImpl with type restriction lost when "is not null"

This is an automated email from the ASF dual-hosted git repository.

jsedding pushed a commit to branch jsedding/OAK-12327-typed-property-existence-test-case
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit 85757b5c1eb8d09f8670b5af051e6a4b7bc89e62
Author: Julian Sedding <js...@apache.org>
AuthorDate: Thu Jul 23 13:56:57 2026 +0200

    OAK-12327: PropertyValueImpl with type restriction lost when "is not null"
    
    - failing unit test
---
 .../apache/jackrabbit/oak/jcr/query/QueryTest.java   | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java
index 214bd94d0a..ed902d80f5 100644
--- a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java
+++ b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java
@@ -33,6 +33,7 @@ import java.io.ByteArrayInputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.util.Arrays;
+import java.util.Calendar;
 import java.util.HashSet;
 import java.util.NoSuchElementException;
 import java.util.Set;
@@ -343,6 +344,25 @@ public class QueryTest extends AbstractRepositoryTest {
                 "order by path() desc", Query.JCR_SQL2));
     }
 
+    @Test
+    public void propertyExistenceWithType() throws Exception {
+        Session session = getAdminSession();
+        Node root = session.getRootNode();
+
+        Node test = root.addNode("test");
+        test.addNode("a", "oak:Unstructured").setProperty("test", new String[]{"2025-10-14T20:32:01.481Z", "foo"});
+        test.addNode("b", "oak:Unstructured").setProperty("test", Calendar.getInstance());
+        test.addNode("c", "oak:Unstructured").setProperty("test", "/a/b/c");
+        session.save();
+
+        String nodeList = getNodeList(session,
+                "select [jcr:path] " +
+                        "from [nt:base] " +
+                        "where property([test], 'String') is not null " +
+                        "order by first([test])", Query.JCR_SQL2);
+        assertEquals("/test/c, /test/a", nodeList);
+    }
+
     @Test
     public void twoSelectors() throws Exception {
         Session session = getAdminSession();