Author: angela
Date: Tue Mar 15 13:45:30 2016
New Revision: 1735074
URL: http://svn.apache.org/viewvc?rev=1735074&view=rev
Log:
minor improvement: refactor code duplication
Modified:
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/SysViewImportHandler.java
Modified:
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/SysViewImportHandler.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/SysViewImportHandler.java?rev=1735074&r1=1735073&r2=1735074&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/SysViewImportHandler.java
(original)
+++
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/SysViewImportHandler.java
Tue Mar 15 13:45:30 2016
@@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
+import javax.annotation.Nonnull;
import javax.jcr.InvalidSerializedDataException;
import javax.jcr.NamespaceRegistry;
import javax.jcr.PropertyType;
@@ -230,9 +231,7 @@ class SysViewImportHandler extends Targe
// check if all system properties (jcr:primaryType, jcr:uuid etc.)
// have been collected and create node as necessary primaryType
- if (currentPropName != null
- &&
currentPropName.getNamespaceUri().equals(NamespaceRegistry.NAMESPACE_JCR)
- && currentPropName.getLocalName().equals("primaryType")) {
+ if (isSystemProperty("primaryType")) {
BufferedStringValue val = currentPropValues.get(0);
String s = null;
try {
@@ -243,9 +242,7 @@ class SysViewImportHandler extends Targe
} catch (RepositoryException e) {
throw new SAXException(new
InvalidSerializedDataException("illegal node type name: " + s, e));
}
- } else if (currentPropName != null
- &&
currentPropName.getNamespaceUri().equals(NamespaceRegistry.NAMESPACE_JCR)
- && currentPropName.getLocalName().equals("mixinTypes")) {
+ } else if (isSystemProperty("mixinTypes")) {
if (state.mixinNames == null) {
state.mixinNames = new
ArrayList<String>(currentPropValues.size());
}
@@ -260,9 +257,7 @@ class SysViewImportHandler extends Targe
throw new SAXException(new
InvalidSerializedDataException("illegal mixin type name: " + s, e));
}
}
- } else if (currentPropName != null
- &&
currentPropName.getNamespaceUri().equals(NamespaceRegistry.NAMESPACE_JCR)
- && currentPropName.getLocalName().equals("uuid")) {
+ } else if (isSystemProperty("uuid")) {
BufferedStringValue val = currentPropValues.get(0);
try {
state.uuid = val.retrieve();
@@ -293,6 +288,12 @@ class SysViewImportHandler extends Targe
}
}
+ private boolean isSystemProperty(@Nonnull String localName) {
+ return currentPropName != null
+ &&
currentPropName.getNamespaceUri().equals(NamespaceRegistry.NAMESPACE_JCR)
+ && currentPropName.getLocalName().equals(localName);
+ }
+
//--------------------------------------------------------< inner classes >
/**