jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r162075 - in /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core: ./ lock/ nodetype/ xml/
Date Wed, 20 Apr 2005 21:31:59 GMT
Author: jukka
Date: Wed Apr 20 14:31:57 2005
New Revision: 162075

URL: http://svn.apache.org/viewcvs?rev=162075&view=rev
Log:
JCR-97: Improved Checkstyle conformance by removing inline conditionals.

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Path.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASessionImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/PathMap.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ValueConstraint.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/ImportHandler.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java?rev=162075&r1=162074&r2=162075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
Wed Apr 20 14:31:57 2005
@@ -223,9 +223,12 @@
             Path.PathElement elem = elems[i];
             QName name = elem.getName();
             int index = elem.getIndex();
-            if (parentState.hasChildNodeEntry(name, index == 0 ? 1 : index)) {
+            if (index == 0) {
+                index = 1;
+            }
+            if (parentState.hasChildNodeEntry(name, index)) {
                 // child node
-                NodeState.ChildNodeEntry nodeEntry = parentState.getChildNodeEntry(name,
index == 0 ? 1 : index);
+                NodeState.ChildNodeEntry nodeEntry = parentState.getChildNodeEntry(name,
index);
                 if (i == elems.length - 1) {
                     // last element in the path
                     return new NodeId(nodeEntry.getUUID());

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java?rev=162075&r1=162074&r2=162075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java Wed Apr
20 14:31:57 2005
@@ -149,8 +149,16 @@
         while (iter.hasNext()) {
             ItemId id = (ItemId) iter.next();
             ItemImpl item = (ItemImpl) itemCache.get(id);
-            ps.print(item.isNode() ? "Node: " : "Prop: ");
-            ps.print(item.isTransient() ? "transient " : "          ");
+            if (item.isNode()) {
+                ps.print("Node: ");
+            } else {
+                ps.print("Property: ");
+            }
+            if (item.isTransient()) {
+                ps.print("transient ");
+            } else {
+                ps.print("          ");
+            }
             ps.println(id + "\t" + item.getPath() + " (" + item + ")");
         }
     }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java?rev=162075&r1=162074&r2=162075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java Wed Apr 20
14:31:57 2005
@@ -207,9 +207,12 @@
                 if (pe.denotesName()) {
                     // check if node entry exists
                     NodeState thisState = (NodeState) state;
+                    int index = pe.getIndex();
+                    if (index == 0) {
+                        index = 1;
+                    }
                     NodeState.ChildNodeEntry cne =
-                            thisState.getChildNodeEntry(pe.getName(),
-                                    pe.getIndex() == 0 ? 1 : pe.getIndex());
+                            thisState.getChildNodeEntry(pe.getName(), index);
                     if (cne != null) {
                         return new NodeId(cne.getUUID());
                     } else {
@@ -565,7 +568,9 @@
     protected void removeChildNode(QName nodeName, int index) throws RepositoryException
{
         // modify the state of 'this', i.e. the parent node
         NodeState thisState = (NodeState) getOrCreateTransientItemState();
-        index = (index == 0) ? 1 : index;
+        if (index == 0) {
+            index = 1;
+        }
         NodeState.ChildNodeEntry entry = thisState.getChildNodeEntry(nodeName, index);
         if (entry == null) {
             String msg = "failed to remove child " + nodeName + " of " + safeGetJCRPath();
@@ -714,7 +719,11 @@
 
         NodeDefinitionImpl def;
         try {
-            def = getApplicableChildNodeDefinition(nodeName, nodeType == null ? null : nodeType.getQName());
+            QName nodeTypeName = null;
+            if (nodeType != null) {
+                nodeTypeName = nodeType.getQName();
+            }
+            def = getApplicableChildNodeDefinition(nodeName, nodeTypeName);
         } catch (RepositoryException re) {
             String msg = "no definition found in parent node's node type for new node";
             log.debug(msg);
@@ -1453,8 +1462,10 @@
         // check lock status
         checkLock();
 
-        NodeTypeImpl nt = (nodeTypeName == null) ?
-                null : session.getNodeTypeManager().getNodeType(nodeTypeName);
+        NodeTypeImpl nt = null;
+        if (nodeTypeName != null) {
+            nt = session.getNodeTypeManager().getNodeType(nodeTypeName);
+        }
         return internalAddChildNode(nodeName, nt, uuid);
     }
 
@@ -1561,7 +1572,10 @@
         // check lock status
         checkLock();
 
-        int type = (value == null) ? PropertyType.UNDEFINED : value.getType();
+        int type = PropertyType.UNDEFINED;
+        if (value != null) {
+            type = value.getType();
+        }
 
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(name, type, false, status);
@@ -1997,7 +2011,10 @@
     public Property setProperty(String name, Value value)
             throws ValueFormatException, VersionException, LockException,
             ConstraintViolationException, RepositoryException {
-        int type = (value == null) ? PropertyType.UNDEFINED : value.getType();
+        int type = PropertyType.UNDEFINED;
+        if (value != null) {
+            type = value.getType();
+        }
         return setProperty(name, value, type);
     }
 
@@ -2303,7 +2320,11 @@
         sanityCheck();
 
         NodeId id = resolveRelativeNodePath(relPath);
-        return (id != null) ? itemMgr.itemExists(id) : false;
+        if (id != null) {
+            return itemMgr.itemExists(id);
+        } else {
+            return false;
+        }
     }
 
     /**
@@ -2489,7 +2510,11 @@
         sanityCheck();
 
         PropertyId id = resolveRelativePropertyPath(relPath);
-        return (id != null) ? itemMgr.itemExists(id) : false;
+        if (id != null) {
+            return itemMgr.itemExists(id);
+        } else {
+            return false;
+        }
     }
 
     /**
@@ -2639,7 +2664,11 @@
 
         // @todo optimize, no need to build entire path just to find this node's index
         int index = getPrimaryPath().getNameElement().getIndex();
-        return (index == 0) ? 1 : index;
+        if (index == 0) {
+            return 1;
+        } else {
+            return index;
+        }
     }
 
     //------------------------------< versioning support: public Node methods >

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Path.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Path.java?rev=162075&r1=162074&r2=162075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Path.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Path.java Wed Apr 20 14:31:57
2005
@@ -166,9 +166,12 @@
     public static Path create(String jcrPath, NamespaceResolver resolver,
                               boolean normalize)
             throws MalformedPathException {
-        return normalize
-                ? parse(jcrPath, null, resolver).getNormalizedPath()
-                : parse(jcrPath, null, resolver);
+        Path path = parse(jcrPath, null, resolver);
+        if (normalize) {
+            return path.getNormalizedPath();
+        } else {
+            return path;
+        }
     }
 
     /**
@@ -186,9 +189,12 @@
     public static Path create(Path parent, String relJCRPath,
                               NamespaceResolver resolver, boolean canonicalize)
             throws MalformedPathException {
-        return canonicalize
-                ? parse(relJCRPath, parent, resolver).getCanonicalPath()
-                : parse(relJCRPath, parent, resolver);
+        Path path = parse(relJCRPath, parent, resolver);
+        if (canonicalize) {
+            return path.getCanonicalPath();
+        } else {
+            return path;
+        }
     }
 
     /**
@@ -212,9 +218,12 @@
         PathBuilder pb = new PathBuilder(parent.getElements());
         pb.addAll(relPath.getElements());
 
-        return normalize
-                ? pb.getPath().getNormalizedPath()
-                : pb.getPath();
+        Path path = pb.getPath();
+        if (normalize) {
+            return path.getNormalizedPath();
+        } else {
+            return path;
+        }
     }
 
     /**
@@ -234,9 +243,12 @@
         PathBuilder pb = new PathBuilder(parent.getElements());
         pb.addLast(name);
 
-        return normalize
-                ? pb.getPath().getNormalizedPath()
-                : pb.getPath();
+        Path path = pb.getPath();
+        if (normalize) {
+            return path.getNormalizedPath();
+        } else {
+            return path;
+        }
     }
 
     /**
@@ -257,9 +269,12 @@
         PathBuilder pb = new PathBuilder(parent.getElements());
         pb.addLast(name, index);
 
-        return normalize
-                ? pb.getPath().getNormalizedPath()
-                : pb.getPath();
+        Path path = pb.getPath();
+        if (normalize) {
+            return path.getNormalizedPath();
+        } else {
+            return path;
+        }
     }
 
     /**
@@ -407,9 +422,13 @@
                 throw new MalformedPathException("'" + jcrPath + "' is not a valid path:
'" + elem + "' is not a legal path element");
             }
         }
-        return resolver == null
-                ? null
-                : new Path((PathElement[]) list.toArray(new PathElement[list.size()]), isNormalized);
+        if (resolver != null) {
+            return new Path(
+                    (PathElement[]) list.toArray(new PathElement[list.size()]),
+                    isNormalized);
+        } else {
+            return null;
+        }
     }
 
     //------------------------------------------------------< utility methods >
@@ -502,7 +521,11 @@
                     throw new MalformedPathException("Path can not be canonicalized: unresolvable
'..' element");
                 }
                 queue.removeLast();
-                last = queue.isEmpty() ? null : (PathElement) queue.getLast();
+                if (queue.isEmpty()) {
+                    last = null;
+                } else {
+                    last = (PathElement) queue.getLast();
+                }
             } else {
                 queue.add(last = elem);
             }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java?rev=162075&r1=162074&r2=162075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java Wed Apr
20 14:31:57 2005
@@ -1016,7 +1016,11 @@
         // check type according to definition of this property
         int reqType = definition.getRequiredType();
         if (reqType == PropertyType.UNDEFINED) {
-            reqType = value != null ? value.getType() : PropertyType.STRING;
+            if (value != null) {
+                reqType = value.getType();
+            } else {
+                reqType = PropertyType.STRING;
+            }
         }
 
         if (value == null) {

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java?rev=162075&r1=162074&r2=162075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java Wed Apr
20 14:31:57 2005
@@ -390,7 +390,13 @@
      * @throws RepositoryException
      */
     public void dump(PrintStream ps) throws RepositoryException {
-        ps.println("Session: " + (userId == null ? "unknown" : userId) + " (" + this + ")");
+        ps.print("Session: ");
+        if (userId == null) {
+            ps.print("unknown");
+        } else {
+            ps.print(userId);
+        }
+        ps.println(" (" + this + ")");
         ps.println();
         itemMgr.dump(ps);
         ps.println();
@@ -904,8 +910,11 @@
         // add target to new parent
         destParentNode.createChildNodeLink(destName.getName(), targetUUID);
         // remove target from old parent
-        srcParentNode.removeChildNode(srcName.getName(),
-                srcName.getIndex() == 0 ? 1 : srcName.getIndex());
+        int index = srcName.getIndex();
+        if (index == 0) {
+            index = 1;
+        }
+        srcParentNode.removeChildNode(srcName.getName(), index);
         // change definition of target if necessary
         NodeDefinitionImpl oldTargetDef = (NodeDefinitionImpl) targetNode.getDefinition();
         NodeDefId oldTargetDefId = oldTargetDef.unwrap().getId();

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java?rev=162075&r1=162074&r2=162075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java Wed
Apr 20 14:31:57 2005
@@ -1107,7 +1107,11 @@
         if (values != null) {
             InternalValue[] newValues = new InternalValue[values.length];
             for (int i = 0; i < values.length; i++) {
-                newValues[i] = values[i] != null ? values[i].createCopy() : null;
+                if (values[i] != null) {
+                    newValues[i] = values[i].createCopy();
+                } else {
+                    newValues[i] = null;
+                }
             }
             newState.setValues(values);
             // FIXME delegate to 'node type instance handler'
@@ -1366,8 +1370,11 @@
             WorkspaceImpl srcWsp = (WorkspaceImpl) srcSession.getWorkspace();
 
             // do cross-workspace copy
-            internalCopy(srcAbsPath, srcWsp, destAbsPath,
-                    removeExisting ? CLONE_REMOVE_EXISTING : CLONE);
+            int mode = CLONE;
+            if (removeExisting) {
+                mode = CLONE_REMOVE_EXISTING;
+            }
+            internalCopy(srcAbsPath, srcWsp, destAbsPath, mode);
         } finally {
             if (srcSession != null) {
                 // we don't need the other session anymore, logout
@@ -1528,7 +1535,10 @@
                 targetState.removeParentUUID(srcParentState.getUUID());
             }
 
-            int srcNameIndex = srcName.getIndex() == 0 ? 1 : srcName.getIndex();
+            int srcNameIndex = srcName.getIndex();
+            if (srcNameIndex == 0) {
+                srcNameIndex = 1;
+            }
             srcParentState.removeChildNodeEntry(srcName.getName(), srcNameIndex);
 
             // store states

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASessionImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASessionImpl.java?rev=162075&r1=162074&r2=162075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASessionImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASessionImpl.java Wed
Apr 20 14:31:57 2005
@@ -364,7 +364,11 @@
      * is also considered to be equal.
      */
     private static boolean stringsEqual(String s1, String s2) {
-        return s1 == null ? s2 == null : s1.equals(s2);
+        if (s1 == null) {
+            return s2 == null;
+        } else {
+            return s1.equals(s2);
+        }
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/PathMap.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/PathMap.java?rev=162075&r1=162074&r2=162075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/PathMap.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/PathMap.java Wed Apr
20 14:31:57 2005
@@ -317,7 +317,11 @@
          */
         private static int getOneBasedIndex(Path.PathElement element) {
             int index = element.getIndex();
-            return index == 0 ? 1 : index;
+            if (index == 0) {
+                return 1;
+            } else {
+                return index;
+            }
         }
 
         /**

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java?rev=162075&r1=162074&r2=162075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
Wed Apr 20 14:31:57 2005
@@ -84,7 +84,7 @@
      * @return
      */
     public boolean remove(QName name) {
-        return ntDefs.remove(name) != null ? true : false;
+        return (ntDefs.remove(name) != null);
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java?rev=162075&r1=162074&r2=162075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
Wed Apr 20 14:31:57 2005
@@ -308,7 +308,11 @@
     public String getPrimaryItemName() {
         try {
             QName piName = ntd.getPrimaryItemName();
-            return piName == null ? null : piName.toJCRName(nsResolver);
+            if (piName != null) {
+                return piName.toJCRName(nsResolver);
+            } else {
+                return null;
+            }
         } catch (NoPrefixDeclaredException npde) {
             // should never get here
             log.error("encountered unregistered namespace in name of primary item", npde);

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java?rev=162075&r1=162074&r2=162075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java
Wed Apr 20 14:31:57 2005
@@ -74,8 +74,11 @@
         if (id != null) {
             throw new IllegalStateException("Unable to set attribute. Property definition
already compiled.");
         }
-        this.valueConstraints =
-                (valueConstraints == null) ? ValueConstraint.EMPTY_ARRAY : valueConstraints;
+        if (valueConstraints != null) {
+            this.valueConstraints = valueConstraints;
+        } else {
+            this.valueConstraints = ValueConstraint.EMPTY_ARRAY;
+        }
     }
 
     /**
@@ -87,8 +90,11 @@
         if (id != null) {
             throw new IllegalStateException("Unable to set attribute. Property definition
already compiled.");
         }
-        this.defaultValues =
-                (defaultValues == null) ? InternalValue.EMPTY_ARRAY : defaultValues;
+        if (defaultValues != null) {
+            this.defaultValues = defaultValues;
+        } else {
+            this.defaultValues = InternalValue.EMPTY_ARRAY;
+        }
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ValueConstraint.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ValueConstraint.java?rev=162075&r1=162074&r2=162075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ValueConstraint.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ValueConstraint.java
Wed Apr 20 14:31:57 2005
@@ -539,10 +539,12 @@
     public String getDefinition(NamespaceResolver nsResolver) {
         try {
             String p = path.toJCRPath(nsResolver);
-            if (deep) {
-                return (path.denotesRoot() ? p + "*" : p + "/*");
-            } else {
+            if (!deep) {
                 return p;
+            } else if (path.denotesRoot()) {
+                return p + "*";
+            } else {
+                return p + "/*";
             }
         } catch (NoPrefixDeclaredException npde) {
             // should never get here, return raw definition as fallback

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/ImportHandler.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/ImportHandler.java?rev=162075&r1=162074&r2=162075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/ImportHandler.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/ImportHandler.java
Wed Apr 20 14:31:57 2005
@@ -306,7 +306,9 @@
          * {@inheritDoc}
          */
         boolean declarePrefix(String prefix, String uri) {
-            uri = DEFAULT_URI.equals(uri) ? DUMMY_DEFAULT_URI : uri;
+            if (DEFAULT_URI.equals(uri)) {
+                uri = DUMMY_DEFAULT_URI;
+            }
             return nsContext.declarePrefix(prefix, uri);
         }
 
@@ -318,15 +320,20 @@
             String uri = nsContext.getURI(prefix);
             if (uri == null) {
                 throw new NamespaceException("unknown prefix");
+            } else if (DUMMY_DEFAULT_URI.equals(uri)) {
+                return DEFAULT_URI;
+            } else {
+                return uri;
             }
-            return DUMMY_DEFAULT_URI.equals(uri) ? DEFAULT_URI : uri;
         }
 
         /**
          * {@inheritDoc}
          */
         public String getPrefix(String uri) throws NamespaceException {
-            uri = DEFAULT_URI.equals(uri) ? DUMMY_DEFAULT_URI : uri;
+            if (DEFAULT_URI.equals(uri)) {
+                uri = DUMMY_DEFAULT_URI;
+            }
             String prefix = nsContext.getPrefix(uri);
             if (prefix == null) {
                 /**



Mime
View raw message