jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r704160 - in /jackrabbit/branches/1.5: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/AbstractSession.java
Date Mon, 13 Oct 2008 16:43:37 GMT
Author: jukka
Date: Mon Oct 13 09:43:37 2008
New Revision: 704160

URL: http://svn.apache.org/viewvc?rev=704160&view=rev
Log:
1.5: Merged revisions 704002, 704005, and 704158 (JCR-1793 and JCR-1803)

Modified:
    jackrabbit/branches/1.5/   (props changed)
    jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
    jackrabbit/branches/1.5/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/AbstractSession.java

Propchange: jackrabbit/branches/1.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Oct 13 09:43:37 2008
@@ -1,2 +1,2 @@
 /jackrabbit/branches/1.3:631261
-/jackrabbit/trunk:703928
+/jackrabbit/trunk:703899-704158

Modified: jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java?rev=704160&r1=704159&r2=704160&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
Mon Oct 13 09:43:37 2008
@@ -110,7 +110,17 @@
             PropertyState prop = props[i];
             if (prop.getName().equals(NameConstants.JCR_FROZENUUID)) {
                 // special property
-                frozenUUID = UUID.fromString(node.getPropertyValue(NameConstants.JCR_FROZENUUID).getString());
+                InternalValue value =
+                    node.getPropertyValue(NameConstants.JCR_FROZENUUID);
+                // JCR-1803: The value should be a STRING, but older Jackrabbit
+                // versions (< 1.1, see JCR-487) used REFERENCE values. Since
+                // we do not automatically upgrade old content, we need to be
+                // ready to handle both types of values here.
+                if (value.getType() == PropertyType.STRING) {
+                    frozenUUID = UUID.fromString(value.getString());
+                } else {
+                    frozenUUID = value.getUUID();
+                }
             } else if (prop.getName().equals(NameConstants.JCR_FROZENPRIMARYTYPE)) {
                 // special property
                 frozenPrimaryType = node.getPropertyValue(NameConstants.JCR_FROZENPRIMARYTYPE).getQName();

Modified: jackrabbit/branches/1.5/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/AbstractSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/AbstractSession.java?rev=704160&r1=704159&r2=704160&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/AbstractSession.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/AbstractSession.java
Mon Oct 13 09:43:37 2008
@@ -57,6 +57,9 @@
 
     /**
      * Local namespace mappings. Prefixes as keys and namespace URIs as values.
+     * <p>
+     * This map is only accessed from synchronized methods (see
+     * <a href="https://issues.apache.org/jira/browse/JCR-1793">JCR-1793</a>).
      */
     private final Map namespaces = new HashMap();
 
@@ -66,7 +69,7 @@
      * <code>super.logout()</code> when overriding this method to avoid
      * namespace mappings to be carried over to a new session.
      */
-    public void logout() {
+    public synchronized void logout() {
         namespaces.clear();
     }
 
@@ -85,7 +88,7 @@
      * @throws NamespaceException if the namespace is not found
      * @throws RepositoryException if a repository error occurs
      */
-    public String getNamespacePrefix(String uri)
+    public synchronized String getNamespacePrefix(String uri)
             throws NamespaceException, RepositoryException {
         Iterator iterator = namespaces.entrySet().iterator();
         while (iterator.hasNext()) {
@@ -121,7 +124,7 @@
      * @throws NamespaceException if the namespace is not found
      * @throws RepositoryException if a repository error occurs
      */
-    public String getNamespaceURI(String prefix)
+    public synchronized String getNamespaceURI(String prefix)
             throws NamespaceException, RepositoryException {
         String uri = (String) namespaces.get(prefix);
 
@@ -152,7 +155,8 @@
      * @return namespace prefixes
      * @throws RepositoryException if a repository error occurs
      */
-    public String[] getNamespacePrefixes() throws RepositoryException {
+    public synchronized String[] getNamespacePrefixes()
+            throws RepositoryException {
         NamespaceRegistry registry = getWorkspace().getNamespaceRegistry();
         String[] uris = registry.getURIs();
         for (int i = 0; i < uris.length; i++) {
@@ -175,7 +179,7 @@
      * @throws NamespaceException if the mapping is illegal
      * @throws RepositoryException if a repository error occurs
      */
-    public void setNamespacePrefix(String prefix, String uri)
+    public synchronized void setNamespacePrefix(String prefix, String uri)
             throws NamespaceException, RepositoryException {
         if (prefix == null) {
             throw new IllegalArgumentException("Prefix must not be null");
@@ -450,7 +454,7 @@
      * @throws SAXException if the SAX event handler failed
      * @throws RepositoryException if another error occurs
      */
-    private void export(String path, Exporter exporter)
+    private synchronized void export(String path, Exporter exporter)
             throws PathNotFoundException, SAXException, RepositoryException {
         Item item = getItem(path);
         if (item.isNode()) {



Mime
View raw message