jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1456138 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml: BufferedStringValue.java DocViewImportHandler.java SessionImporter.java StringValue.java SysViewImportHandler.java TargetImportHandler.java
Date Wed, 13 Mar 2013 21:33:21 GMT
Author: mduerig
Date: Wed Mar 13 21:33:20 2013
New Revision: 1456138

URL: http://svn.apache.org/r1456138
Log:
clean up

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/BufferedStringValue.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/DocViewImportHandler.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/SessionImporter.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/StringValue.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/SysViewImportHandler.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/TargetImportHandler.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/BufferedStringValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/BufferedStringValue.java?rev=1456138&r1=1456137&r2=1456138&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/BufferedStringValue.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/BufferedStringValue.java
Wed Mar 13 21:33:20 2013
@@ -44,17 +44,17 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * <code>BufferedStringValue</code> represents an appendable
+ * {@code BufferedStringValue} represents an appendable
  * serialized value that is either buffered in-memory or backed
  * by a temporary file if its size exceeds a certain limit.
  * <p/>
  * <b>Important:</b> Note that in order to free resources
- * <code>{@link #dispose()}</code> should be called as soon as
- * <code>BufferedStringValue</code> instance is not used anymore.
+ * {@code {@link #dispose()}} should be called as soon as
+ * {@code BufferedStringValue} instance is not used anymore.
  */
 class BufferedStringValue implements TextValue {
 
-    private static Logger log = LoggerFactory.getLogger(BufferedStringValue.class);
+    private static final Logger log = LoggerFactory.getLogger(BufferedStringValue.class);
 
     /**
      * The maximum size for buffering data in memory.
@@ -92,7 +92,7 @@ class BufferedStringValue implements Tex
     private boolean base64;
 
     /**
-     * Constructs a new empty <code>BufferedStringValue</code>.
+     * Constructs a new empty {@code BufferedStringValue}.
      */
     protected BufferedStringValue(ValueFactory valueFactory, NamePathMapper namePathMapper)
{
         buffer = new StringWriter();
@@ -171,9 +171,9 @@ class BufferedStringValue implements Tex
     }
 
     /**
-     * Returns a <code>Reader</code> for reading the serialized value.
+     * Returns a {@code Reader} for reading the serialized value.
      *
-     * @return a <code>Reader</code> for reading the serialized value.
+     * @return a {@code Reader} for reading the serialized value.
      * @throws IOException if an I/O error occurs
      */
     public Reader reader() throws IOException {
@@ -239,6 +239,7 @@ class BufferedStringValue implements Tex
 
     //--------------------------------------------------------< TextValue >
 
+    @Override
     public Value getValue(int targetType) throws RepositoryException {
         try {
             if (targetType == PropertyType.NAME) {
@@ -271,9 +272,7 @@ class BufferedStringValue implements Tex
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public void dispose() {
         if (buffer != null) {
             buffer = null;
@@ -323,6 +322,7 @@ class BufferedStringValue implements Tex
             out.reset();
         }
 
+        @Override
         public int read() throws IOException {
             if (remaining == 0) {
                 fillBuffer();

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/DocViewImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/DocViewImportHandler.java?rev=1456138&r1=1456137&r2=1456138&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/DocViewImportHandler.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/DocViewImportHandler.java
Wed Mar 13 21:33:20 2013
@@ -42,12 +42,12 @@ import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 
 /**
- * <code>DocViewImportHandler</code> processes Document View XML SAX events
- * and 'translates' them into <code>{@link Importer}</code> method calls.
+ * {@code DocViewImportHandler} processes Document View XML SAX events
+ * and 'translates' them into {@code {@link Importer}} method calls.
  */
 class DocViewImportHandler extends TargetImportHandler {
 
-    private static Logger log = LoggerFactory.getLogger(DocViewImportHandler.class);
+    private static final Logger log = LoggerFactory.getLogger(DocViewImportHandler.class);
 
     /**
      * stack of NodeInfo instances; an instance is pushed onto the stack
@@ -56,10 +56,10 @@ class DocViewImportHandler extends Targe
      */
     private final Stack<NodeInfo> stack = new Stack<NodeInfo>();
     // buffer used to merge adjacent character data
-    private BufferedStringValue textHandler = null;
+    private BufferedStringValue textHandler;
 
     /**
-     * Constructs a new <code>DocViewImportHandler</code>.
+     * Constructs a new {@code DocViewImportHandler}.
      *
      * @param importer     the importer
      * @param valueFactory a value factory
@@ -118,10 +118,10 @@ class DocViewImportHandler extends Targe
 
     /**
      * Translates character data reported by the
-     * <code>{@link #characters(char[], int, int)}</code> &
-     * <code>{@link #ignorableWhitespace(char[], int, int)}</code> SAX events
-     * into a  <code>jcr:xmltext</code> child node with one
-     * <code>jcr:xmlcharacters</code> property.
+     * {@code {@link #characters(char[], int, int)}} &
+     * {@code {@link #ignorableWhitespace(char[], int, int)}} SAX events
+     * into a  {@code jcr:xmltext} child node with one
+     * {@code jcr:xmlcharacters} property.
      *
      * @throws SAXException if an error occurs
      * @see #appendCharacters(char[], int, int)
@@ -179,7 +179,7 @@ class DocViewImportHandler extends Targe
     }
 
     /**
-     * Processes the given <code>name</code>, i.e. decodes it and checks
+     * Processes the given {@code name}, i.e. decodes it and checks
      * the format of the decoded name.
      *
      * @param nameInfo name to process
@@ -195,7 +195,7 @@ class DocViewImportHandler extends Targe
             } catch (ConstraintViolationException e) {
                 // decoded name would be illegal according to jsr 170,
                 // use encoded name as a fallback
-                log.warn("encountered illegal decoded name '" + decodedLocalName + "'", e);
+                log.warn("encountered illegal decoded name '" + decodedLocalName + '\'',
e);
                 return nameInfo;
             }
         }
@@ -252,7 +252,7 @@ class DocViewImportHandler extends Targe
                 if (NamespaceRegistry.NAMESPACE_JCR.equals(propNameInfo.getNamespaceUri())
                         && "primaryType".equals(propNameInfo.getLocalName())) {
                     // jcr:primaryType
-                    if (attrValue.length() > 0) {
+                    if (!attrValue.isEmpty()) {
                         //TODO
                         nodeTypeName = attrValue;
                     }
@@ -263,7 +263,7 @@ class DocViewImportHandler extends Targe
                 } else if (NamespaceRegistry.NAMESPACE_JCR.equals(propNameInfo.getNamespaceUri())
                         && "uuid".equals(propNameInfo.getLocalName())) {
                     // jcr:uuid
-                    if (attrValue.length() > 0) {
+                    if (!attrValue.isEmpty()) {
                         id = attrValue;
                     }
                 } else {
@@ -282,9 +282,6 @@ class DocViewImportHandler extends Targe
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
     public void characters(char[] ch, int start, int length)
             throws SAXException {
@@ -295,9 +292,6 @@ class DocViewImportHandler extends Targe
         appendCharacters(ch, start, length);
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
     public void ignorableWhitespace(char[] ch, int start, int length)
             throws SAXException {
@@ -308,9 +302,6 @@ class DocViewImportHandler extends Targe
         appendCharacters(ch, start, length);
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
     public void endElement(String namespaceURI, String localName, String qName)
             throws SAXException {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/SessionImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/SessionImporter.java?rev=1456138&r1=1456137&r2=1456138&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/SessionImporter.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/SessionImporter.java
Wed Mar 13 21:33:20 2013
@@ -472,8 +472,8 @@ public class SessionImporter implements 
     @Override
     public void end() throws RepositoryException {
         /**
-         * adjust references that refer to uuid's which have been mapped to
-         * newly generated uuid's on import
+         * adjust references that refer to uuids which have been mapped to
+         * newly generated uuids on import
          */
         // 1. let protected property/node importers handle protected ref-properties
         //    and (protected) properties underneath a protected parent node.

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/StringValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/StringValue.java?rev=1456138&r1=1456137&r2=1456138&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/StringValue.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/StringValue.java
Wed Mar 13 21:33:20 2013
@@ -27,7 +27,7 @@ import org.apache.jackrabbit.oak.spi.xml
 import org.apache.jackrabbit.value.ValueHelper;
 
 /**
- * <code>StringValue</code> represents an immutable serialized value.
+ * {@code StringValue} represents an immutable serialized value.
  */
 class StringValue implements TextValue {
 
@@ -36,7 +36,7 @@ class StringValue implements TextValue {
     private final NamePathMapper namePathMapper;
 
     /**
-     * Constructs a new <code>StringValue</code> representing the given
+     * Constructs a new {@code StringValue} representing the given
      * value.
      *
      * @param value serialized value from document
@@ -57,6 +57,7 @@ class StringValue implements TextValue {
         return this.value;
     }
 
+    @Override
     public Value getValue(int type) throws RepositoryException {
         String inputValue = type == PropertyType.NAME ?
                 namePathMapper.getOakName(value) :
@@ -66,6 +67,7 @@ class StringValue implements TextValue {
         return ValueHelper.deserialize(inputValue, type, false, valueFactory);
     }
 
+    @Override
     public void dispose() {
         // do nothing
     }

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=1456138&r1=1456137&r2=1456138&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
Wed Mar 13 21:33:20 2013
@@ -36,7 +36,7 @@ import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 
 /**
- * <code>SysViewImportHandler</code>  ...
+ * {@code SysViewImportHandler}  ...
  */
 class SysViewImportHandler extends TargetImportHandler {
 
@@ -47,6 +47,7 @@ class SysViewImportHandler extends Targe
      * when the corresponding sv:node element is encountered.
      */
     private final Stack<ImportState> stack = new Stack<ImportState>();
+    private final ArrayList<BufferedStringValue> currentPropValues = new ArrayList<BufferedStringValue>();
 
     /**
      * fields used temporarily while processing sv:property and sv:value elements
@@ -55,12 +56,10 @@ class SysViewImportHandler extends Targe
     private int currentPropType = PropertyType.UNDEFINED;
     private PropInfo.MultipleStatus currentPropMultipleStatus = PropInfo.MultipleStatus.UNKNOWN;
     // list of appendable value objects
-    private ArrayList<BufferedStringValue> currentPropValues =
-            new ArrayList<BufferedStringValue>();
     private BufferedStringValue currentPropValue;
 
     /**
-     * Constructs a new <code>SysViewImportHandler</code>.
+     * Constructs a new {@code SysViewImportHandler}.
      *
      * @param importer     the underlying importer
      * @param valueFactory the value factory
@@ -102,9 +101,6 @@ class SysViewImportHandler extends Targe
 
     //-------------------------------------------------------< ContentHandler >
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
     public void startElement(String namespaceURI, String localName,
                              String qName, Attributes atts)
@@ -181,13 +177,10 @@ class SysViewImportHandler extends Targe
             currentPropValue.setBase64("xs:base64Binary".equals(xsiType));
         } else {
             throw new SAXException(new InvalidSerializedDataException(
-                    "Unexpected element in system view xml document: {" + namespaceURI +
"}" + localName));
+                    "Unexpected element in system view xml document: {" + namespaceURI +
'}' + localName));
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
     public void characters(char[] ch, int start, int length)
             throws SAXException {
@@ -202,9 +195,6 @@ class SysViewImportHandler extends Targe
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
     public void ignorableWhitespace(char[] ch, int start, int length)
             throws SAXException {
@@ -222,9 +212,6 @@ class SysViewImportHandler extends Targe
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
     public void endElement(String namespaceURI, String localName, String qName)
             throws SAXException {
@@ -336,7 +323,7 @@ class SysViewImportHandler extends Targe
         /**
          * list of PropInfo instances representing properties of current node
          */
-        List<PropInfo> props = new ArrayList<PropInfo>();
+        final List<PropInfo> props = new ArrayList<PropInfo>();
 
         /**
          * flag indicating whether startNode() has been called for current node
@@ -353,7 +340,7 @@ class SysViewImportHandler extends Targe
      * @param namespaceUri attribute namespace
      * @param localName attribute local name
      * @return attribute value,
-     *         or <code>null</code> if the named attribute is not found
+     *         or {@code null} if the named attribute is not found
      */
     private static String getAttribute(Attributes attributes, String namespaceUri, String
localName) {
         return attributes.getValue(namespaceUri, localName);

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/TargetImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/TargetImportHandler.java?rev=1456138&r1=1456137&r2=1456138&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/TargetImportHandler.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/TargetImportHandler.java
Wed Mar 13 21:33:20 2013
@@ -35,9 +35,9 @@ import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
 /**
- * <code>TargetImportHandler</code> serves as the base class for the concrete
- * classes <code>{@link DocViewImportHandler}</code> and
- * <code>{@link SysViewImportHandler}</code>.
+ * {@code TargetImportHandler} serves as the base class for the concrete
+ * classes {@code {@link DocViewImportHandler}} and
+ * {@code {@link SysViewImportHandler}}.
  */
 public abstract class TargetImportHandler extends DefaultHandler {
 
@@ -140,7 +140,7 @@ public abstract class TargetImportHandle
         private String repoPrefix;
 
         NameInfo(String docQualifiedName) throws RepositoryException {
-            int idx = docQualifiedName.indexOf(":");
+            int idx = docQualifiedName.indexOf(':');
             if (idx == -1) {
                 docPrefix = null;
                 localName = docQualifiedName;
@@ -191,23 +191,23 @@ public abstract class TargetImportHandle
         }
 
         String getDocQualifiedName() {
-            if (docPrefix == null || docPrefix.length() == 0) {
+            if (docPrefix == null || docPrefix.isEmpty()) {
                 return localName;
             } else {
-                return docPrefix + ":" + localName;
+                return docPrefix + ':' + localName;
             }
         }
 
         String getRepoQualifiedName() {
-            if (repoPrefix == null || repoPrefix.length() == 0) {
+            if (repoPrefix == null || repoPrefix.isEmpty()) {
                 return localName;
             } else {
-                return repoPrefix + ":" + localName;
+                return repoPrefix + ':' + localName;
             }
         }
 
         String getExpandedName() {
-            return "{" + namespaceUri + "}" + localName;
+            return '{' + namespaceUri + '}' + localName;
         }
     }
 }



Mime
View raw message