Fix eclipse/checkstyle warnings 16/58216/9
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 4 Jun 2017 06:43:11 +0000 (08:43 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 5 Jun 2017 05:53:43 +0000 (07:53 +0200)
concepts/util should have their checkstyle enforced.

Change-Id: I752ce3c75e69446a1284b511b5221553d7187bb5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
143 files changed:
common/concepts/pom.xml
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/Identifiable.java
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/SemVer.java
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/WritableObjects.java
common/testutils/pom.xml
common/util/pom.xml
common/util/src/main/java/org/opendaylight/yangtools/util/AbstractIdentifier.java
common/util/src/main/java/org/opendaylight/yangtools/util/AbstractStringIdentifier.java
common/util/src/main/java/org/opendaylight/yangtools/util/AbstractUUIDIdentifier.java
common/util/src/main/java/org/opendaylight/yangtools/util/ClassLoaderUtils.java
common/util/src/main/java/org/opendaylight/yangtools/util/ConstantArrayCollection.java
common/util/src/main/java/org/opendaylight/yangtools/util/EmptyDeque.java
common/util/src/main/java/org/opendaylight/yangtools/util/EvenMoreObjects.java
common/util/src/main/java/org/opendaylight/yangtools/util/ExecutorServiceUtil.java
common/util/src/main/java/org/opendaylight/yangtools/util/ImmutableOffsetMap.java
common/util/src/main/java/org/opendaylight/yangtools/util/Immutables.java
common/util/src/main/java/org/opendaylight/yangtools/util/ListenerRegistry.java
common/util/src/main/java/org/opendaylight/yangtools/util/MapAdaptor.java
common/util/src/main/java/org/opendaylight/yangtools/util/MutableOffsetMap.java
common/util/src/main/java/org/opendaylight/yangtools/util/OffsetMapCache.java
common/util/src/main/java/org/opendaylight/yangtools/util/PropertyUtils.java
common/util/src/main/java/org/opendaylight/yangtools/util/ReadWriteTrieMap.java
common/util/src/main/java/org/opendaylight/yangtools/util/SharedSingletonMap.java
common/util/src/main/java/org/opendaylight/yangtools/util/SingletonSet.java
common/util/src/main/java/org/opendaylight/yangtools/util/UnmodifiableCollection.java
common/util/src/main/java/org/opendaylight/yangtools/util/concurrent/AsyncNotifyingListeningExecutorService.java
common/util/src/main/java/org/opendaylight/yangtools/util/concurrent/CachedThreadPoolExecutor.java
common/util/src/main/java/org/opendaylight/yangtools/util/concurrent/CountingRejectedExecutionHandler.java
common/util/src/main/java/org/opendaylight/yangtools/util/concurrent/DeadlockDetectingListeningExecutorService.java
common/util/src/main/java/org/opendaylight/yangtools/util/concurrent/ExceptionMapper.java
common/util/src/main/java/org/opendaylight/yangtools/util/concurrent/FastThreadPoolExecutor.java
common/util/src/main/java/org/opendaylight/yangtools/util/concurrent/ListenerNotificationQueueStats.java
common/util/src/main/java/org/opendaylight/yangtools/util/concurrent/MappingCheckedFuture.java
common/util/src/main/java/org/opendaylight/yangtools/util/concurrent/QueuedNotificationManager.java
common/util/src/main/java/org/opendaylight/yangtools/util/concurrent/ReflectiveExceptionMapper.java
common/util/src/main/java/org/opendaylight/yangtools/util/concurrent/SpecialExecutors.java
common/util/src/main/java/org/opendaylight/yangtools/util/concurrent/TrackingLinkedBlockingQueue.java
common/util/src/main/java/org/opendaylight/yangtools/util/xml/UntrustedXML.java
common/util/src/test/java/org/opendaylight/yangtools/util/ConstantArrayCollectionTest.java
common/util/src/test/java/org/opendaylight/yangtools/util/DurationStatisticsTrackerTest.java
common/util/src/test/java/org/opendaylight/yangtools/util/EvenMoreObjectsTest.java
common/util/src/test/java/org/opendaylight/yangtools/util/HashCodeBuilderTest.java
common/util/src/test/java/org/opendaylight/yangtools/util/ListenerRegistryTest.java
common/util/src/test/java/org/opendaylight/yangtools/util/ReadWriteTrieMapTest.java
common/util/src/test/java/org/opendaylight/yangtools/util/SharedSingletonMapTest.java
common/util/src/test/java/org/opendaylight/yangtools/util/SingletonSetTest.java
common/util/src/test/java/org/opendaylight/yangtools/util/concurrent/AsyncNotifyingListeningExecutorServiceTest.java
common/util/src/test/java/org/opendaylight/yangtools/util/concurrent/CommonTestUtils.java
common/util/src/test/java/org/opendaylight/yangtools/util/concurrent/CountingRejectedExecutionHandlerTest.java
common/util/src/test/java/org/opendaylight/yangtools/util/concurrent/DeadlockDetectingListeningExecutorServiceTest.java
common/util/src/test/java/org/opendaylight/yangtools/util/concurrent/MappingCheckedFutureTest.java
common/util/src/test/java/org/opendaylight/yangtools/util/concurrent/QueuedNotificationManagerTest.java
common/util/src/test/java/org/opendaylight/yangtools/util/concurrent/ReflectiveExceptionMapperTest.java
common/util/src/test/java/org/opendaylight/yangtools/util/concurrent/ThreadPoolExecutorTest.java
common/util/src/test/java/org/opendaylight/yangtools/util/concurrent/TrackingLinkedBlockingQueueTest.java
yang/yang-common/pom.xml
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/OperationFailedException.java
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/QName.java
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/QNameModule.java
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/Revision.java
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/RpcError.java
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/RpcResultBuilder.java
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/SimpleDateFormatUtil.java
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/YangConstants.java
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/YangVersion.java
yang/yang-common/src/test/java/org/opendaylight/yangtools/yang/common/OperationFailedExceptionTest.java
yang/yang-common/src/test/java/org/opendaylight/yangtools/yang/common/QNameTest.java
yang/yang-common/src/test/java/org/opendaylight/yangtools/yang/common/RpcResultBuilderTest.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/AttributesContainer.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/FixedYangInstanceIdentifier.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/ModifyAction.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/PathArgumentList.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/StackedPathArguments.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/StackedReversePathArguments.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/StackedYangInstanceIdentifier.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/YangInstanceIdentifier.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/YangInstanceIdentifierBuilder.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/codec/BinaryCodec.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/codec/BitsCodec.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/codec/InstanceIdentifierCodec.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/codec/Uint32Codec.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/codec/Uint64Codec.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/codec/Uint8Codec.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/AnyXmlNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/AugmentationNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/ChoiceNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/ContainerNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/DataContainerChild.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/DataContainerNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/LeafNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/LeafSetEntryNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/LeafSetNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/MapEntryNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/MapNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/MixinNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/NormalizedNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/NormalizedNodeContainer.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/NormalizedNodes.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/OrderedLeafSetNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/OrderedMapNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/OrderedNodeContainer.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/UnkeyedListEntryNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/UnkeyedListNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/YangModeledAnyXmlNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/package-info.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/stream/ForwardingNormalizedNodeStreamAttributeWriter.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/stream/ForwardingNormalizedNodeStreamWriter.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/stream/NormalizedNodeStreamAttributeWriter.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/stream/NormalizedNodeStreamWriter.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/stream/NormalizedNodeWriter.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/ConflictingModificationAppliedException.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeCandidate.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeCandidateNodes.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeCandidates.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeConfiguration.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeSnapshot.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeTip.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataValidationFailedException.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DefaultDataTreeCandidate.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/IncorrectDataStructureException.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/ModificationType.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/ModifiedNodeDoesNotExistException.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/StoreTreeNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/StoreTreeNodes.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/spi/AbstractMutableContainerNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/spi/LazyContainerNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/spi/TreeNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/spi/TreeNodeFactory.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/xpath/LazyXPathExpression.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/xpath/OptimizableXPathExpression.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/xpath/XPathResult.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/xpath/XPathSchemaContext.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/xpath/XPathSchemaContextFactory.java
yang/yang-data-api/src/test/java/org/opendaylight/yangtools/yang/data/api/ModifyActionTest.java
yang/yang-data-api/src/test/java/org/opendaylight/yangtools/yang/data/api/PathArgumentListTest.java
yang/yang-data-api/src/test/java/org/opendaylight/yangtools/yang/data/api/YangInstanceIdentifierTest.java
yang/yang-data-api/src/test/java/org/opendaylight/yangtools/yang/data/api/schema/NormalizedNodesTest.java
yang/yang-data-api/src/test/java/org/opendaylight/yangtools/yang/data/api/schema/stream/NormalizedNodeWriterTest.java
yang/yang-data-api/src/test/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeCandidateNodesTest.java
yang/yang-data-api/src/test/java/org/opendaylight/yangtools/yang/data/api/schema/tree/NormalizedNodeDataTreeCandidateNodeTest.java
yang/yang-data-api/src/test/java/org/opendaylight/yangtools/yang/data/api/schema/tree/spi/DuplicityTest.java
yang/yang-data-api/src/test/java/org/opendaylight/yangtools/yang/data/api/schema/tree/spi/TreeNodeFactoryTest.java
yang/yang-data-api/src/test/java/org/opendaylight/yangtools/yang/data/api/schema/tree/spi/VersionTest.java

index 15d742191fd09b8033f1bd7cbcf9ec7821d275bf..c6155284fda86737ab5fd1892762d5e1c3b041bb 100644 (file)
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
                 <configuration>
-                    <failsOnError>true</failsOnError>
+                                       <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
                 </configuration>
             </plugin>
         </plugins>
     </build>
 
-  <!--
-      Maven Site Configuration
+    <!--
+        Maven Site Configuration
 
-      The following configuration is necessary for maven-site-plugin to
-      correctly identify the correct deployment path for OpenDaylight Maven
-      sites.
-  -->
-  <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
+        The following configuration is necessary for maven-site-plugin to
+        correctly identify the correct deployment path for OpenDaylight Maven
+        sites.
+    -->
+    <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
 
-  <distributionManagement>
-    <site>
-      <id>opendaylight-site</id>
-      <url>${nexus.site.url}/${project.artifactId}/</url>
-    </site>
-  </distributionManagement>
+    <distributionManagement>
+        <site>
+            <id>opendaylight-site</id>
+            <url>${nexus.site.url}/${project.artifactId}/</url>
+        </site>
+    </distributionManagement>
 </project>
index 99d6b77197fc81b5ef13850e046b761dea776994..2e1d5c1e89d8b738a62dc6bb2ecae41fd5034689 100644 (file)
@@ -11,7 +11,7 @@ import javax.annotation.Nonnull;
 
 public interface Identifiable<T> {
     /**
-     * Return this objects Identifier
+     * Return this objects Identifier.
      *
      * @return Object's identifier, must not be null.
      */
index 234c1469c3343280e1388f72f34dbf96cb3388fc..ea4813a0514eccab6231173144dc8cff61c55a0a 100644 (file)
@@ -55,10 +55,9 @@ public final class SemVer implements Comparable<SemVer>, Serializable {
         if (patchIdx == -1) {
             minorStr = str.substring(minorIdx + 1);
             return create(Integer.parseInt(str.substring(0, minorIdx), 10), Integer.parseInt(minorStr, 10));
-        } else {
-            minorStr = str.substring(minorIdx + 1, patchIdx);
         }
 
+        minorStr = str.substring(minorIdx + 1, patchIdx);
         return create(Integer.parseInt(str.substring(0, minorIdx), 10), Integer.parseInt(minorStr, 10),
             Integer.parseInt(str.substring(patchIdx + 1), 10));
     }
index 57a3714257860bcacf8e6c12753a9689c14f828c..7d22ec2116ab0506a4543c816d9ada13074ec8e5 100644 (file)
@@ -56,7 +56,7 @@ public final class WritableObjects {
      * @throws NullPointerException if output is null
      */
     public static void writeLong(final DataOutput out, final long value, final int flags) throws IOException {
-        Preconditions.checkArgument((flags & 0xFFFFFF0F) == 0, "Invalid flags {}", flags);
+        Preconditions.checkArgument((flags & 0xFFFFFF0F) == 0, "Invalid flags %s", flags);
         final int bytes = valueBytes(value);
         out.writeByte(bytes | flags);
         writeValue(out, value, bytes);
@@ -109,27 +109,27 @@ public final class WritableObjects {
      */
     public static long readLongBody(final @Nonnull DataInput in, final byte header) throws IOException {
         int bytes = header & 0xF;
-        if (bytes < 8) {
-            if (bytes > 0) {
-                long value = 0;
-                if (bytes >= 4) {
-                    bytes -= 4;
-                    value = (in.readInt() & 0xFFFFFFFFL) << (bytes * Byte.SIZE);
-                }
-                if (bytes >= 2) {
-                    bytes -= 2;
-                    value |= in.readUnsignedShort() << (bytes * Byte.SIZE);
-                }
-                if (bytes > 0) {
-                    value |= in.readUnsignedByte();
-                }
-                return value;
-            } else {
-                return 0;
-            }
-        } else {
+        if (bytes >= 8) {
             return in.readLong();
         }
+
+        if (bytes <= 0) {
+            return 0;
+        }
+
+        long value = 0;
+        if (bytes >= 4) {
+            bytes -= 4;
+            value = (in.readInt() & 0xFFFFFFFFL) << bytes * Byte.SIZE;
+        }
+        if (bytes >= 2) {
+            bytes -= 2;
+            value |= in.readUnsignedShort() << bytes * Byte.SIZE;
+        }
+        if (bytes > 0) {
+            value |= in.readUnsignedByte();
+        }
+        return value;
     }
 
     /**
@@ -183,11 +183,11 @@ public final class WritableObjects {
             int left = bytes;
             if (left >= 4) {
                 left -= 4;
-                out.writeInt((int)(value >>> (left * Byte.SIZE)));
+                out.writeInt((int)(value >>> left * Byte.SIZE));
             }
             if (left >= 2) {
                 left -= 2;
-                out.writeShort((int)(value >>> (left * Byte.SIZE)));
+                out.writeShort((int)(value >>> left * Byte.SIZE));
             }
             if (left > 0) {
                 out.writeByte((int)(value & 0xFF));
@@ -203,15 +203,13 @@ public final class WritableObjects {
         if ((value & 0xFFFFFFFF00000000L) != 0) {
             if ((value & 0xFFFF000000000000L) != 0) {
                 return (value & 0xFF00000000000000L) != 0 ? 8 : 7;
-            } else {
-                return (value & 0x0000FF0000000000L) != 0 ? 6 : 5;
             }
+            return (value & 0x0000FF0000000000L) != 0 ? 6 : 5;
         } else if ((value & 0x00000000FFFFFFFFL) != 0) {
             if ((value & 0x00000000FFFF0000L) != 0) {
                 return (value & 0x00000000FF000000L) != 0 ? 4 : 3;
-            } else {
-                return (value & 0x000000000000FF00L) != 0 ? 2 : 1;
             }
+            return (value & 0x000000000000FF00L) != 0 ? 2 : 1;
         } else {
             return 0;
         }
index f51392450a27ec39b7c3f5cc1becb9af70aaa472..2e757f8bffedede5c4c5cf3b906f6e0bb69d787a 100644 (file)
@@ -1,68 +1,80 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
+    <modelVersion>4.0.0</modelVersion>
 
-  <parent>
-      <groupId>org.opendaylight.odlparent</groupId>
-      <artifactId>bundle-parent</artifactId>
-      <version>1.9.0-SNAPSHOT</version>
-      <relativePath/>
-  </parent>
+    <parent>
+        <groupId>org.opendaylight.odlparent</groupId>
+        <artifactId>bundle-parent</artifactId>
+        <version>1.9.0-SNAPSHOT</version>
+        <relativePath/>
+    </parent>
 
-  <groupId>org.opendaylight.yangtools</groupId>
-  <artifactId>testutils</artifactId>
-  <version>1.2.0-SNAPSHOT</version>
-  <!-- Currently not needed, maybe later: <packaging>bundle</packaging> -->
+    <groupId>org.opendaylight.yangtools</groupId>
+    <artifactId>testutils</artifactId>
+    <version>1.2.0-SNAPSHOT</version>
+    <!-- Currently not needed, maybe later: <packaging>bundle</packaging> -->
 
-  <dependencyManagement>
-      <dependencies>
-          <dependency>
-              <groupId>org.opendaylight.yangtools</groupId>
-              <artifactId>yangtools-artifacts</artifactId>
-              <version>${project.version}</version>
-              <scope>import</scope>
-              <type>pom</type>
-          </dependency>
-      </dependencies>
-  </dependencyManagement>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yangtools-artifacts</artifactId>
+                <version>${project.version}</version>
+                <scope>import</scope>
+                <type>pom</type>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
 
-  <dependencies>
-    <!-- NOTE: The use of <scope> here is a little particular, compared to other standard projects...
+    <dependencies>
+        <!-- NOTE: The use of <scope> here is a little particular, compared to other standard projects...
 
-        As this test helper project is intended to itself be used as a <scope>test
-        <dependency> so that the utility code in src/main/java of this project can
-        be used to write src/test/java code in projects using it, all <dependencies>
-        here are <scope>compile here (the default, don't mention it), and NOT <scope>test.
-        (Only a <dependency> which only this project would want to use in its own src/test/java code
-        but not expose to projects depending on it would be <scope>test.  However that kind of against
-        the whole point of this project, and currently there no such dependencies here.
-      -->
-    <dependency>
-        <groupId>org.slf4j</groupId>
-        <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-simple</artifactId>
-    </dependency>
-    <dependency>
-        <groupId>junit</groupId>
-        <artifactId>junit</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-core</artifactId>
-      <scope>compile</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.google.truth</groupId>
-      <artifactId>truth</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-    </dependency>
+             As this test helper project is intended to itself be used as a <scope>test
+             <dependency> so that the utility code in src/main/java of this project can
+             be used to write src/test/java code in projects using it, all <dependencies>
+             here are <scope>compile here (the default, don't mention it), and NOT <scope>test.
+             (Only a <dependency> which only this project would want to use in its own src/test/java code
+             but not expose to projects depending on it would be <scope>test.  However that kind of against
+             the whole point of this project, and currently there no such dependencies here.
+         -->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.google.truth</groupId>
+            <artifactId>truth</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
 
-  </dependencies>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 
 </project>
index 4f505a8ab04d32828f3be9a08c272243431f7a68..3b175013820771899a1f69015a775bfaad09af1e 100644 (file)
         </dependency>
     </dependencies>
 
-  <!--
-      Maven Site Configuration
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-checkstyle-plugin</artifactId>
+                               <configuration>
+                                       <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
 
-      The following configuration is necessary for maven-site-plugin to
-      correctly identify the correct deployment path for OpenDaylight Maven
-      sites.
-  -->
-  <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
+       <!--
+         Maven Site Configuration
 
-  <distributionManagement>
-    <site>
-      <id>opendaylight-site</id>
-      <url>${nexus.site.url}/${project.artifactId}/</url>
-    </site>
-  </distributionManagement>
+         The following configuration is necessary for maven-site-plugin to
+         correctly identify the correct deployment path for OpenDaylight Maven
+         sites.
+      -->
+    <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
+
+       <distributionManagement>
+               <site>
+                       <id>opendaylight-site</id>
+                       <url>${nexus.site.url}/${project.artifactId}/</url>
+               </site>
+       </distributionManagement>
 </project>
index dbe5ca69ef815fffb4c8afbc696a3d78dab4d06c..49a05cf50d7ded473f1c709411c30267b6754db8 100644 (file)
@@ -38,15 +38,15 @@ public abstract class AbstractIdentifier<T> implements Identifier {
     }
 
     @Override
-    public final boolean equals(final Object o) {
-        if (this == o) {
+    public final boolean equals(final Object obj) {
+        if (this == obj) {
             return true;
         }
-        if (o == null) {
+        if (obj == null) {
             return false;
         }
 
-        return getClass().equals(o.getClass()) && value.equals(((AbstractIdentifier<?>)o).value);
+        return getClass().equals(obj.getClass()) && value.equals(((AbstractIdentifier<?>)obj).value);
     }
 
     @Override
index a72c253bcdf34676849d6a0c0e14a6f28b7e9984..3d1cd4d057d73864ff86582f79dcae576a601540 100644 (file)
@@ -27,6 +27,7 @@ public abstract class AbstractStringIdentifier<T extends AbstractStringIdentifie
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public final int compareTo(@Nonnull final T o) {
         return getValue().compareTo(o.getValue());
     }
index 566a12364e340067bbfadfd911030ac8fc0a6e51..6043eee29c95fd0f62aee34b88644ce018e33183 100644 (file)
@@ -27,6 +27,7 @@ public abstract class AbstractUUIDIdentifier<T extends AbstractUUIDIdentifier<T>
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public final int compareTo(@Nonnull final T o) {
         return getValue().compareTo(o.getValue());
     }
index 6e65b03658f58b55b3268dd03d9af9fffb49fbc7..cef9e469f31c0b787b605e835c23e0f71f2de06f 100644 (file)
@@ -33,7 +33,8 @@ public final class ClassLoaderUtils {
     /**
      * Runs {@link Supplier} with provided {@link ClassLoader}.
      *
-     * <p>Invokes supplies function and makes sure that original {@link ClassLoader}
+     * <p>
+     * Invokes supplies function and makes sure that original {@link ClassLoader}
      * is context {@link ClassLoader} after execution.
      *
      * @param cls {@link ClassLoader} to be used.
@@ -57,6 +58,7 @@ public final class ClassLoaderUtils {
     /**
      * Runs {@link Callable} with provided {@link ClassLoader}.
      *
+     * <p>
      * Invokes supplies function and makes sure that original {@link ClassLoader}
      * is context {@link ClassLoader} after execution.
      *
index b8dae240da9abbc109dcec07dfdcba42160c6af6..56ebc36a5709138dc34f9bbcbd2914d6fa32aafe 100644 (file)
@@ -43,6 +43,7 @@ final class ConstantArrayCollection<E> implements Collection<E>, Serializable {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean contains(final Object o) {
         for (Object wlk : array) {
             if (o.equals(wlk)) {
@@ -56,19 +57,19 @@ final class ConstantArrayCollection<E> implements Collection<E>, Serializable {
     @Override
     public Iterator<E> iterator() {
         return new UnmodifiableIterator<E>() {
-            private int i = 0;
+            private int offset = 0;
 
             @Override
             public boolean hasNext() {
-                return i < array.length;
+                return offset < array.length;
             }
 
             @Override
             public E next() {
-                if (i >= array.length) {
+                if (offset >= array.length) {
                     throw new NoSuchElementException();
                 }
-                return array[i++];
+                return array[offset++];
             }
         };
     }
@@ -80,7 +81,7 @@ final class ConstantArrayCollection<E> implements Collection<E>, Serializable {
     }
 
     @Nonnull
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({ "unchecked", "checkstyle:parameterName" })
     @Override
     public <T> T[] toArray(@Nonnull final T[] a) {
         if (a.length < array.length) {
@@ -95,16 +96,19 @@ final class ConstantArrayCollection<E> implements Collection<E>, Serializable {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean add(final E e) {
         throw new UnsupportedOperationException();
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean remove(final Object o) {
         throw new UnsupportedOperationException();
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean containsAll(@Nonnull final Collection<?> c) {
         for (Object o : c) {
             if (!contains(o)) {
@@ -116,16 +120,19 @@ final class ConstantArrayCollection<E> implements Collection<E>, Serializable {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean addAll(@Nonnull final Collection<? extends E> c) {
         throw new UnsupportedOperationException();
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean removeAll(@Nonnull final Collection<?> c) {
         throw new UnsupportedOperationException();
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean retainAll(@Nonnull final Collection<?> c) {
         throw new UnsupportedOperationException();
     }
@@ -163,10 +170,10 @@ final class ConstantArrayCollection<E> implements Collection<E>, Serializable {
         }
 
         final StringBuilder sb = new StringBuilder("[");
-        int i = 0;
-        while (i < array.length - 1) {
-            sb.append(String.valueOf(array[i++])).append(", ");
+        int offset = 0;
+        while (offset < array.length - 1) {
+            sb.append(String.valueOf(array[offset++])).append(", ");
         }
-        return sb.append(String.valueOf(array[i])).append(']').toString();
+        return sb.append(String.valueOf(array[offset])).append(']').toString();
     }
 }
index 566b2c37c1d2c966d54087aed06e5f7dd73c7929..057ac520cdf1bc585aaada440e4e40e18be1bdd9 100644 (file)
@@ -40,16 +40,19 @@ public final class EmptyDeque<E> extends AbstractQueue<E> implements Deque<E>, I
     }
 
     @Override
-    public boolean offer(final E entry) {
+    @SuppressWarnings("checkstyle:parameterName")
+    public boolean offer(final E e) {
         return false;
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean offerFirst(final E e) {
         return false;
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean offerLast(final E e) {
         return false;
     }
@@ -105,16 +108,19 @@ public final class EmptyDeque<E> extends AbstractQueue<E> implements Deque<E>, I
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public <T> T[] toArray(final T[] a) {
         return Preconditions.checkNotNull(a);
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public void addFirst(final E e) {
         add(e);
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public void addLast(final E e) {
         add(e);
     }
@@ -140,16 +146,19 @@ public final class EmptyDeque<E> extends AbstractQueue<E> implements Deque<E>, I
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean removeFirstOccurrence(final Object o) {
         return false;
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean removeLastOccurrence(final Object o) {
         return false;
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public void push(final E e) {
         addFirst(e);
     }
index 137ff43e78aee6bf0951e463f82648454d853803..47b44ae22ce3d07fe7219d793eef980bc3b06976 100644 (file)
@@ -33,7 +33,7 @@ import java.util.function.BiFunction;
 public final class EvenMoreObjects {
 
     @SuppressWarnings("unchecked")
-    public static <T> boolean equalsHelper(T self, Object other, BooleanEqualsFunction<T> equals) {
+    public static <T> boolean equalsHelper(final T self, final Object other, final BooleanEqualsFunction<T> equals) {
         if (other == self) {
             return true;
         }
@@ -43,7 +43,7 @@ public final class EvenMoreObjects {
         if (self.getClass() != other.getClass()) {
             return false;
         }
-        return equals.apply(self, (T) other);
+        return equals.apply(self, (T) other).booleanValue();
     }
 
     @FunctionalInterface
index e3ee6b2d380c7434cdda79a7248fa9e59aeaea02..da1a5255ae27b0f584983c30ce71f515de96d44a 100644 (file)
@@ -24,9 +24,10 @@ import org.slf4j.LoggerFactory;
 public final class ExecutorServiceUtil {
     private static final class WaitInQueueExecutionHandler implements RejectedExecutionHandler {
         @Override
+        @SuppressWarnings("checkstyle:parameterName")
         public void rejectedExecution(final Runnable r, final ThreadPoolExecutor executor) {
-            if (executor.isShutdown() ) {
-                throw new RejectedExecutionException( "Executor has been shutdown." );
+            if (executor.isShutdown()) {
+                throw new RejectedExecutionException("Executor has been shutdown.");
             }
 
             try {
@@ -57,6 +58,7 @@ public final class ExecutorServiceUtil {
     public static <E> BlockingQueue<E> offerFailingBlockingQueue(final BlockingQueue<E> delegate) {
         return new ForwardingBlockingQueue<E>() {
             @Override
+            @SuppressWarnings("checkstyle:parameterName")
             public boolean offer(@Nonnull final E o) {
                 return false;
             }
@@ -83,8 +85,7 @@ public final class ExecutorServiceUtil {
      * timeout period. If the timeout elapses before termination, the executor is forcefully
      * shutdown.
      */
-    public static void tryGracefulShutdown(final ExecutorService executor, long timeout,
-            TimeUnit unit ) {
+    public static void tryGracefulShutdown(final ExecutorService executor, final long timeout, final TimeUnit unit) {
 
         executor.shutdown();
 
index dd5511e10e2c6d105329fde82d5cc4abc3c7c63a..f45bbf6f15add26144973ba772ea06bd69600df8 100644 (file)
@@ -115,36 +115,36 @@ public abstract class ImmutableOffsetMap<K, V> implements UnmodifiableMapPhase<K
      * All other maps are converted to an {@link ImmutableOffsetMap} with the
      * same iteration order as input.
      *
-     * @param m
+     * @param map
      *            Input map, may not be null.
      * @return An isolated, immutable copy of the input map
      */
-    @Nonnull public static <K, V> Map<K, V> orderedCopyOf(@Nonnull final Map<K, V> m) {
+    @Nonnull public static <K, V> Map<K, V> orderedCopyOf(@Nonnull final Map<K, V> map) {
         // Prevent a copy. Note that ImmutableMap is not listed here because of its potentially larger keySet overhead.
-        if (m instanceof ImmutableOffsetMap || m instanceof SharedSingletonMap) {
-            return m;
+        if (map instanceof ImmutableOffsetMap || map instanceof SharedSingletonMap) {
+            return map;
         }
 
         // Familiar and efficient to copy
-        if (m instanceof MutableOffsetMap) {
-            return ((MutableOffsetMap<K, V>) m).toUnmodifiableMap();
+        if (map instanceof MutableOffsetMap) {
+            return ((MutableOffsetMap<K, V>) map).toUnmodifiableMap();
         }
 
-        final int size = m.size();
+        final int size = map.size();
         if (size == 0) {
             // Shares a single object
             return ImmutableMap.of();
         }
         if (size == 1) {
             // Efficient single-entry implementation
-            final Entry<K, V> e = m.entrySet().iterator().next();
+            final Entry<K, V> e = map.entrySet().iterator().next();
             return SharedSingletonMap.orderedOf(e.getKey(), e.getValue());
         }
 
-        final Map<K, Integer> offsets = OffsetMapCache.orderedOffsets(m.keySet());
+        final Map<K, Integer> offsets = OffsetMapCache.orderedOffsets(map.keySet());
         @SuppressWarnings("unchecked")
         final V[] array = (V[]) new Object[offsets.size()];
-        for (Entry<K, V> e : m.entrySet()) {
+        for (Entry<K, V> e : map.entrySet()) {
             array[offsets.get(e.getKey())] = e.getValue();
         }
 
@@ -162,36 +162,36 @@ public abstract class ImmutableOffsetMap<K, V> implements UnmodifiableMapPhase<K
      * All other maps are converted to an {@link ImmutableOffsetMap}. Iterator
      * order is not guaranteed to be retained.
      *
-     * @param m
+     * @param map
      *            Input map, may not be null.
      * @return An isolated, immutable copy of the input map
      */
-    @Nonnull public static <K, V> Map<K, V> unorderedCopyOf(@Nonnull final Map<K, V> m) {
+    @Nonnull public static <K, V> Map<K, V> unorderedCopyOf(@Nonnull final Map<K, V> map) {
         // Prevent a copy. Note that ImmutableMap is not listed here because of its potentially larger keySet overhead.
-        if (m instanceof ImmutableOffsetMap || m instanceof SharedSingletonMap) {
-            return m;
+        if (map instanceof ImmutableOffsetMap || map instanceof SharedSingletonMap) {
+            return map;
         }
 
         // Familiar and efficient to copy
-        if (m instanceof MutableOffsetMap) {
-            return ((MutableOffsetMap<K, V>) m).toUnmodifiableMap();
+        if (map instanceof MutableOffsetMap) {
+            return ((MutableOffsetMap<K, V>) map).toUnmodifiableMap();
         }
 
-        final int size = m.size();
+        final int size = map.size();
         if (size == 0) {
             // Shares a single object
             return ImmutableMap.of();
         }
         if (size == 1) {
             // Efficient single-entry implementation
-            final Entry<K, V> e = m.entrySet().iterator().next();
+            final Entry<K, V> e = map.entrySet().iterator().next();
             return SharedSingletonMap.unorderedOf(e.getKey(), e.getValue());
         }
 
-        final Map<K, Integer> offsets = OffsetMapCache.unorderedOffsets(m.keySet());
+        final Map<K, Integer> offsets = OffsetMapCache.unorderedOffsets(map.keySet());
         @SuppressWarnings("unchecked")
         final V[] array = (V[]) new Object[offsets.size()];
-        for (Entry<K, V> e : m.entrySet()) {
+        for (Entry<K, V> e : map.entrySet()) {
             array[offsets.get(e.getKey())] = e.getValue();
         }
 
@@ -224,27 +224,27 @@ public abstract class ImmutableOffsetMap<K, V> implements UnmodifiableMapPhase<K
     }
 
     @Override
-    public final boolean equals(final Object o) {
-        if (o == this) {
+    public final boolean equals(final Object obj) {
+        if (obj == this) {
             return true;
         }
-        if (!(o instanceof Map)) {
+        if (!(obj instanceof Map)) {
             return false;
         }
 
-        if (o instanceof ImmutableOffsetMap) {
-            final ImmutableOffsetMap<?, ?> om = (ImmutableOffsetMap<?, ?>) o;
+        if (obj instanceof ImmutableOffsetMap) {
+            final ImmutableOffsetMap<?, ?> om = (ImmutableOffsetMap<?, ?>) obj;
 
             // If the offset match, the arrays have to match, too
             if (offsets.equals(om.offsets)) {
                 return Arrays.deepEquals(objects, om.objects);
             }
-        } else if (o instanceof MutableOffsetMap) {
+        } else if (obj instanceof MutableOffsetMap) {
             // Let MutableOffsetMap do the actual work.
-            return o.equals(this);
+            return obj.equals(this);
         }
 
-        final Map<?, ?> other = (Map<?, ?>)o;
+        final Map<?, ?> other = (Map<?, ?>)obj;
 
         // Size and key sets have to match
         if (size() != other.size() || !keySet().equals(other.keySet())) {
@@ -298,6 +298,7 @@ public abstract class ImmutableOffsetMap<K, V> implements UnmodifiableMapPhase<K
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public final void putAll(@Nonnull final Map<? extends K, ? extends V> m) {
         throw new UnsupportedOperationException();
     }
@@ -328,11 +329,11 @@ public abstract class ImmutableOffsetMap<K, V> implements UnmodifiableMapPhase<K
     public final String toString() {
         final StringBuilder sb = new StringBuilder("{");
         final Iterator<K> it = offsets.keySet().iterator();
-        int i = 0;
+        int offset = 0;
         while (it.hasNext()) {
             sb.append(it.next());
             sb.append('=');
-            sb.append(objects[i++]);
+            sb.append(objects[offset++]);
 
             if (it.hasNext()) {
                 sb.append(", ");
index da5521f7425eb9ff9ee4f1f26f0ba967367195c3..43be1d704576829cc672755088c7b691ae46bb38 100644 (file)
@@ -31,19 +31,19 @@ public final class Immutables {
      * <p>Note: This method may return false to immutable objects which
      * immutability is not known, was defined not using concepts term.
      *
-     * @param o
+     * @param obj
      *            Reference to check
      * @return true if object is known to be immutable false otherwise.
      */
-    public static boolean isImmutable(final Object o) {
-        Preconditions.checkArgument(o != null,"Object should not be null");
-        if (o instanceof Mutable) {
+    public static boolean isImmutable(final Object obj) {
+        Preconditions.checkArgument(obj != null,"Object should not be null");
+        if (obj instanceof Mutable) {
             return false;
-        } else if (o instanceof Immutable) {
+        } else if (obj instanceof Immutable) {
             return true;
-        } else if (o instanceof String) {
+        } else if (obj instanceof String) {
             return true;
-        } else if (KNOWN_IMMUTABLES.contains(o.getClass())) {
+        } else if (KNOWN_IMMUTABLES.contains(obj.getClass())) {
             return true;
         }
         return false;
index 32876f6885210f9e0f50d4bf8992d497a9b3d8ee..798f3e575b3fa55a82c8a1642b0e3d84d879fd80 100644 (file)
@@ -63,7 +63,7 @@ public class ListenerRegistry<T extends EventListener> implements Iterable<Liste
     private class ListenerRegistrationImpl<P extends EventListener> extends AbstractObjectRegistration<P> implements
             ListenerRegistration<P> {
 
-        public ListenerRegistrationImpl(final P instance) {
+        ListenerRegistrationImpl(final P instance) {
             super(instance);
         }
 
index e6c23ddc05f84416c1b52afc22d734510b9e505a..3e5fec119dbd2aa77aac70aa4afac2bffa5a948e 100644 (file)
@@ -45,23 +45,12 @@ public final class MapAdaptor {
     }
 
     private static int getProperty(final String name, final int defaultValue) {
-        try {
-            final String p = System.getProperty(name);
-            if (p != null) {
-                try {
-                    int pi = Integer.valueOf(p);
-                    if (pi <= 0) {
-                        LOG.warn("Ignoring illegal value of {}: has to be a positive number", name);
-                    } else {
-                        return pi;
-                    }
-                } catch (NumberFormatException e) {
-                    LOG.warn("Ignoring non-numerical value of {}", name, e);
-                }
-            }
-        } catch (Exception e) {
-            LOG.debug("Failed to get {}", name, e);
+        final int val = Integer.getInteger(name, defaultValue).intValue();
+        if (val > 0) {
+            return val;
         }
+
+        LOG.warn("Ignoring illegal value of {}: has to be a positive number", name);
         return defaultValue;
     }
 
index ef033b116f1720b9138906d0c72f4103cce33c06..9917de9ea21b05f6df853cede9b1bba75177f2c2 100644 (file)
@@ -144,28 +144,28 @@ public abstract class MutableOffsetMap<K, V> extends AbstractMap<K, V> implement
         this.needClone = false;
     }
 
-    public static <K, V> MutableOffsetMap<K, V> orderedCopyOf(final Map<K, V> m) {
-        if (m instanceof Ordered) {
-            return ((Ordered<K, V>) m).clone();
+    public static <K, V> MutableOffsetMap<K, V> orderedCopyOf(final Map<K, V> map) {
+        if (map instanceof Ordered) {
+            return ((Ordered<K, V>) map).clone();
         }
-        if (m instanceof ImmutableOffsetMap) {
-            final ImmutableOffsetMap<K, V> om = (ImmutableOffsetMap<K, V>) m;
+        if (map instanceof ImmutableOffsetMap) {
+            final ImmutableOffsetMap<K, V> om = (ImmutableOffsetMap<K, V>) map;
             return new Ordered<>(om.offsets(), om.objects());
         }
 
-        return new Ordered<>(m);
+        return new Ordered<>(map);
     }
 
-    public static <K, V> MutableOffsetMap<K, V> unorderedCopyOf(final Map<K, V> m) {
-        if (m instanceof Unordered) {
-            return ((Unordered<K, V>) m).clone();
+    public static <K, V> MutableOffsetMap<K, V> unorderedCopyOf(final Map<K, V> map) {
+        if (map instanceof Unordered) {
+            return ((Unordered<K, V>) map).clone();
         }
-        if (m instanceof ImmutableOffsetMap) {
-            final ImmutableOffsetMap<K, V> om = (ImmutableOffsetMap<K, V>) m;
+        if (map instanceof ImmutableOffsetMap) {
+            final ImmutableOffsetMap<K, V> om = (ImmutableOffsetMap<K, V>) map;
             return new Unordered<>(om.offsets(), om.objects());
         }
 
-        return new Unordered<>(m);
+        return new Unordered<>(map);
     }
 
     public static <K, V> MutableOffsetMap<K, V> ordered() {
@@ -365,7 +365,7 @@ public abstract class MutableOffsetMap<K, V> extends AbstractMap<K, V> implement
         // Construct the values
         @SuppressWarnings("unchecked")
         final V[] values = (V[])new Object[keyset.size()];
-        int i = 0;
+        int offset = 0;
         if (removed != 0) {
             if (removed != offsets.size()) {
                 for (Entry<K, Integer> e : offsets.entrySet()) {
@@ -373,16 +373,16 @@ public abstract class MutableOffsetMap<K, V> extends AbstractMap<K, V> implement
                     if (o != null && !REMOVED.equals(o)) {
                         @SuppressWarnings("unchecked")
                         final V v = (V) o;
-                        values[i++] = v;
+                        values[offset++] = v;
                     }
                 }
             }
         } else {
             System.arraycopy(objects, 0, values, 0, offsets.size());
-            i = offsets.size();
+            offset = offsets.size();
         }
         for (V v : newKeys.values()) {
-            values[i++] = v;
+            values[offset++] = v;
         }
 
         return modifiedMap(keyset, values);
@@ -419,22 +419,22 @@ public abstract class MutableOffsetMap<K, V> extends AbstractMap<K, V> implement
     }
 
     @Override
-    public final boolean equals(final Object o) {
-        if (o == this) {
+    public final boolean equals(final Object obj) {
+        if (obj == this) {
             return true;
         }
-        if (!(o instanceof Map)) {
+        if (!(obj instanceof Map)) {
             return false;
         }
 
-        if (o instanceof ImmutableOffsetMap) {
-            final ImmutableOffsetMap<?, ?> om = (ImmutableOffsetMap<?, ?>) o;
+        if (obj instanceof ImmutableOffsetMap) {
+            final ImmutableOffsetMap<?, ?> om = (ImmutableOffsetMap<?, ?>) obj;
 
             if (newKeys.isEmpty() && offsets.equals(om.offsets())) {
                 return Arrays.deepEquals(objects, om.objects());
             }
-        } else if (o instanceof MutableOffsetMap) {
-            final MutableOffsetMap<?, ?> om = (MutableOffsetMap<?, ?>) o;
+        } else if (obj instanceof MutableOffsetMap) {
+            final MutableOffsetMap<?, ?> om = (MutableOffsetMap<?, ?>) obj;
 
             if (offsets.equals(om.offsets)) {
                 return Arrays.deepEquals(objects, om.objects) && newKeys.equals(om.newKeys);
@@ -442,7 +442,7 @@ public abstract class MutableOffsetMap<K, V> extends AbstractMap<K, V> implement
         }
 
         // Fall back to brute map compare
-        final Map<?, ?> other = (Map<?, ?>)o;
+        final Map<?, ?> other = (Map<?, ?>)obj;
 
         // Size and key sets have to match
         if (size() != other.size() || !keySet().equals(other.keySet())) {
@@ -460,8 +460,8 @@ public abstract class MutableOffsetMap<K, V> extends AbstractMap<K, V> implement
 
             // Ensure all objects are present
             for (Entry<K, Integer> e : offsets.entrySet()) {
-                final Object obj = objects[e.getValue()];
-                if (obj != null && !REMOVED.equals(obj) && !obj.equals(other.get(e.getKey()))) {
+                final Object val = objects[e.getValue()];
+                if (val != null && !REMOVED.equals(val) && !val.equals(other.get(e.getKey()))) {
                     return false;
                 }
             }
@@ -513,6 +513,7 @@ public abstract class MutableOffsetMap<K, V> extends AbstractMap<K, V> implement
         }
 
         @Override
+        @SuppressWarnings("checkstyle:parameterName")
         public boolean contains(final Object o) {
             if (!(o instanceof Entry)) {
                 return false;
@@ -528,6 +529,7 @@ public abstract class MutableOffsetMap<K, V> extends AbstractMap<K, V> implement
         }
 
         @Override
+        @SuppressWarnings("checkstyle:parameterName")
         public boolean add(final Entry<K, V> e) {
             Preconditions.checkNotNull(e.getValue());
             final V p = MutableOffsetMap.this.put(e.getKey(), e.getValue());
@@ -535,6 +537,7 @@ public abstract class MutableOffsetMap<K, V> extends AbstractMap<K, V> implement
         }
 
         @Override
+        @SuppressWarnings("checkstyle:parameterName")
         public boolean remove(final Object o) {
             if (!(o instanceof Entry)) {
                 return false;
index 6c78c9ed6dc15869f97e109791a82080434a2402..df6c35e3f649dd7baa5569c2ce2939fba1ea084c 100644 (file)
@@ -74,6 +74,18 @@ final class OffsetMapCache {
         return unorderedOffsets(args instanceof Set ? (Set<T>)args : ImmutableSet.copyOf(args));
     }
 
+    @SuppressWarnings("unchecked")
+    private static <T> Map<T, Integer> unorderedOffsets(final Set<T> args) {
+        final Map<T, Integer> existing = (Map<T, Integer>) UNORDERED_CACHE.getIfPresent(args);
+        if (existing != null) {
+            return existing;
+        }
+
+        final Map<T, Integer> newMap = createMap(args);
+        final Map<?, Integer> raced = UNORDERED_CACHE.asMap().putIfAbsent(newMap.keySet(), newMap);
+        return raced == null ? newMap : (Map<T, Integer>)raced;
+    }
+
     static <K, V> V[] adjustedArray(final Map<K, Integer> offsets, final List<K> keys, final V[] array) {
         Verify.verify(offsets.size() == keys.size(), "Offsets %s do not match keys %s", offsets, keys);
 
@@ -94,35 +106,23 @@ final class OffsetMapCache {
 
     private static <T> Map<T, Integer> createMap(final Collection<T> keys) {
         final Builder<T, Integer> b = ImmutableMap.builder();
-        int i = 0;
+        int counter = 0;
 
         for (T arg : keys) {
-            b.put(arg, i++);
+            b.put(arg, counter++);
         }
 
         return b.build();
     }
 
-    @SuppressWarnings("unchecked")
-    private static <T> Map<T, Integer> unorderedOffsets(final Set<T> args) {
-        final Map<T, Integer> existing = (Map<T, Integer>) UNORDERED_CACHE.getIfPresent(args);
-        if (existing != null) {
-            return existing;
-        }
-
-        final Map<T, Integer> newMap = createMap(args);
-        final Map<?, Integer> raced = UNORDERED_CACHE.asMap().putIfAbsent(newMap.keySet(), newMap);
-        return raced == null ? newMap : (Map<T, Integer>)raced;
-    }
-
     private static <K, V> V[] adjustArray(final Map<K, Integer> offsets, final List<K> keys, final V[] array) {
         @SuppressWarnings("unchecked")
         final V[] ret = (V[]) Array.newInstance(array.getClass().getComponentType(), array.length);
 
-        int i = 0;
+        int offset = 0;
         for (final K k : keys) {
             final Integer o = Verify.verifyNotNull(offsets.get(k), "Key %s not present in offsets %s", k, offsets);
-            ret[o] = array[i++];
+            ret[o] = array[offset++];
         }
 
         return ret;
index 1e4f0983ce7449fcd011af90f606d33883781c74..222d5f0c7f3359963a978b3197297449095c2e41 100644 (file)
@@ -33,10 +33,10 @@ public final class PropertyUtils {
      * @param defaultValue the default value
      * @return the System property as an int or the <code>defaultValue</code> if not found.
      */
-    public static int getIntSystemProperty( String propName, int defaultValue ) {
+    public static int getIntSystemProperty(String propName, int defaultValue) {
         int propValue = defaultValue;
         String strValue = System.getProperty(propName);
-        if (!Strings.isNullOrEmpty(strValue) && !strValue.trim().isEmpty() ) {
+        if (!Strings.isNullOrEmpty(strValue) && !strValue.trim().isEmpty()) {
             try {
                 propValue = Integer.parseInt(strValue);
             } catch (NumberFormatException e) {
index 7eeb2911ec5a21cd3bc879ed36e9f76c1b23f28a..4d91e1812d8ff41c105b9892996baaa9e47d2950 100644 (file)
@@ -93,6 +93,7 @@ final class ReadWriteTrieMap<K, V> implements Map<K, V> {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public void putAll(@Nonnull final Map<? extends K, ? extends V> m) {
         for (Entry<? extends K, ? extends V> e : m.entrySet()) {
             put(e.getKey(), e.getValue());
@@ -121,8 +122,8 @@ final class ReadWriteTrieMap<K, V> implements Map<K, V> {
     }
 
     @Override
-    public boolean equals(final Object o) {
-        return delegate.equals(o);
+    public boolean equals(final Object obj) {
+        return delegate.equals(obj);
     }
 
     @Override
index cb3dbe8df02f68055c2e7d0a534b4b83a6e0037e..f48425a9c193d0eaf0d047c98ecd294d90b660ed 100644 (file)
@@ -80,17 +80,17 @@ public abstract class SharedSingletonMap<K, V> implements Serializable, Unmodifi
         return new Unordered<>(key, value);
     }
 
-    public static <K, V> SharedSingletonMap<K, V> orderedCopyOf(final Map<K, V> m) {
-        Preconditions.checkArgument(m.size() == 1);
+    public static <K, V> SharedSingletonMap<K, V> orderedCopyOf(final Map<K, V> map) {
+        Preconditions.checkArgument(map.size() == 1);
 
-        final Entry<K, V> e = m.entrySet().iterator().next();
+        final Entry<K, V> e = map.entrySet().iterator().next();
         return new Ordered<>(e.getKey(), e.getValue());
     }
 
-    public static <K, V> SharedSingletonMap<K, V> unorderedCopyOf(final Map<K, V> m) {
-        Preconditions.checkArgument(m.size() == 1);
+    public static <K, V> SharedSingletonMap<K, V> unorderedCopyOf(final Map<K, V> map) {
+        Preconditions.checkArgument(map.size() == 1);
 
-        final Entry<K, V> e = m.entrySet().iterator().next();
+        final Entry<K, V> e = map.entrySet().iterator().next();
         return new Unordered<>(e.getKey(), e.getValue());
     }
 
@@ -148,6 +148,7 @@ public abstract class SharedSingletonMap<K, V> implements Serializable, Unmodifi
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public final void putAll(@Nonnull final Map<? extends K, ? extends V> m) {
         throw new UnsupportedOperationException();
     }
index 958c9085e38b5aac35029e3c1b360e53f535543e..feebed56fa10dac3692ad4feb321dc974272bb84 100644 (file)
@@ -29,6 +29,7 @@ public abstract class SingletonSet<E> implements Set<E>, Immutable, Serializable
         private static final long serialVersionUID = 1L;
 
         @Override
+        @SuppressWarnings("checkstyle:parameterName")
         public boolean contains(final Object o) {
             return o == null;
         }
@@ -85,7 +86,7 @@ public abstract class SingletonSet<E> implements Set<E>, Immutable, Serializable
     }
 
     @Nonnull
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({ "unchecked", "checkstyle:parameterName" })
     @Override
     public final <T> T[] toArray(@Nonnull final T[] a) {
         if (a.length > 0) {
@@ -97,16 +98,19 @@ public abstract class SingletonSet<E> implements Set<E>, Immutable, Serializable
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public final boolean add(final E e) {
         throw new UnsupportedOperationException();
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public final boolean remove(final Object o) {
         throw new UnsupportedOperationException();
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public final boolean containsAll(@Nonnull final Collection<?> c) {
         if (c.isEmpty()) {
             return true;
@@ -119,16 +123,19 @@ public abstract class SingletonSet<E> implements Set<E>, Immutable, Serializable
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public final boolean addAll(@Nonnull final Collection<? extends E> c) {
         throw new UnsupportedOperationException();
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public final boolean retainAll(@Nonnull final Collection<?> c) {
         throw new UnsupportedOperationException();
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public final boolean removeAll(@Nonnull final Collection<?> c) {
         throw new UnsupportedOperationException();
     }
@@ -171,6 +178,7 @@ public abstract class SingletonSet<E> implements Set<E>, Immutable, Serializable
         }
 
         @Override
+        @SuppressWarnings("checkstyle:parameterName")
         public boolean contains(final Object o) {
             return element.equals(o);
         }
index 96895025b03766a5f5696a7ec9b04b9ee21b953e..2ae19a7a72d034527fe545c685e22b6c6bc93270 100644 (file)
@@ -85,6 +85,7 @@ public final class UnmodifiableCollection<E> implements Collection<E>, Serializa
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean contains(final Object o) {
         return delegate.contains(o);
     }
@@ -95,36 +96,43 @@ public final class UnmodifiableCollection<E> implements Collection<E>, Serializa
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public <T> T[] toArray(@Nonnull final T[] a) {
         return delegate.toArray(a);
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean containsAll(@Nonnull final Collection<?> c) {
         return delegate.containsAll(c);
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean add(final E e) {
         throw new UnsupportedOperationException();
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean addAll(@Nonnull final Collection<? extends E> c) {
         throw new UnsupportedOperationException();
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean remove(final Object o) {
         throw new UnsupportedOperationException();
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean removeAll(@Nonnull final Collection<?> c) {
         throw new UnsupportedOperationException();
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean retainAll(@Nonnull final Collection<?> c) {
         throw new UnsupportedOperationException();
     }
index b23982e31057bd8e95169b2bb9d4d581161e5d9e..2106e92a782e6aea0eb0b1f1cb9071f1de7b40b0 100644 (file)
@@ -63,9 +63,9 @@ public class AsyncNotifyingListeningExecutorService extends AbstractListeningExe
      * @param listenableFutureExecutor the executor used to run listener callbacks asynchronously.
      *     If null, no executor is used.
      */
-    public AsyncNotifyingListeningExecutorService( final ExecutorService delegate,
-            @Nullable final Executor listenableFutureExecutor ) {
-        this.delegate = Preconditions.checkNotNull( delegate );
+    public AsyncNotifyingListeningExecutorService(final ExecutorService delegate,
+            @Nullable final Executor listenableFutureExecutor) {
+        this.delegate = Preconditions.checkNotNull(delegate);
         this.listenableFutureExecutor = listenableFutureExecutor;
     }
 
@@ -74,8 +74,8 @@ public class AsyncNotifyingListeningExecutorService extends AbstractListeningExe
      *
      * @param task the Callable to execute
      */
-    private <T> AsyncNotifyingListenableFutureTask<T> newFutureTask( final Callable<T> task ) {
-        return AsyncNotifyingListenableFutureTask.create( task, listenableFutureExecutor );
+    private <T> AsyncNotifyingListenableFutureTask<T> newFutureTask(final Callable<T> task) {
+        return AsyncNotifyingListenableFutureTask.create(task, listenableFutureExecutor);
     }
 
     /**
@@ -83,8 +83,8 @@ public class AsyncNotifyingListeningExecutorService extends AbstractListeningExe
      *
      * @param task the Runnable to execute
      */
-    private <T> AsyncNotifyingListenableFutureTask<T> newFutureTask( final Runnable task, final T result ) {
-        return AsyncNotifyingListenableFutureTask.create( task, result, listenableFutureExecutor );
+    private <T> AsyncNotifyingListenableFutureTask<T> newFutureTask(final Runnable task, final T result) {
+        return AsyncNotifyingListenableFutureTask.create(task, result, listenableFutureExecutor);
     }
 
     /**
@@ -95,8 +95,8 @@ public class AsyncNotifyingListeningExecutorService extends AbstractListeningExe
     }
 
     @Override
-    public boolean awaitTermination( final long timeout, @Nonnull final TimeUnit unit ) throws InterruptedException {
-        return delegate.awaitTermination( timeout, unit );
+    public boolean awaitTermination(final long timeout, @Nonnull final TimeUnit unit) throws InterruptedException {
+        return delegate.awaitTermination(timeout, unit);
     }
 
     @Override
@@ -121,41 +121,41 @@ public class AsyncNotifyingListeningExecutorService extends AbstractListeningExe
     }
 
     @Override
-    public void execute( @Nonnull final Runnable command ) {
-        delegate.execute( command );
+    public void execute(@Nonnull final Runnable command) {
+        delegate.execute(command);
     }
 
     @Nonnull
     @Override
-    public <T> ListenableFuture<T> submit( final Callable<T> task ) {
-        AsyncNotifyingListenableFutureTask<T> futureTask = newFutureTask( task );
-        delegate.execute( futureTask );
+    public <T> ListenableFuture<T> submit(final Callable<T> task) {
+        AsyncNotifyingListenableFutureTask<T> futureTask = newFutureTask(task);
+        delegate.execute(futureTask);
         return futureTask;
     }
 
     @Nonnull
     @Override
-    public ListenableFuture<?> submit( final Runnable task ) {
-        AsyncNotifyingListenableFutureTask<Void> futureTask = newFutureTask( task, null );
-        delegate.execute( futureTask );
+    public ListenableFuture<?> submit(final Runnable task) {
+        AsyncNotifyingListenableFutureTask<Void> futureTask = newFutureTask(task, null);
+        delegate.execute(futureTask);
         return futureTask;
     }
 
     @Nonnull
     @Override
-    public <T> ListenableFuture<T> submit( final Runnable task, final T result ) {
-        AsyncNotifyingListenableFutureTask<T> futureTask = newFutureTask( task, result );
-        delegate.execute( futureTask );
+    public <T> ListenableFuture<T> submit(final Runnable task, final T result) {
+        AsyncNotifyingListenableFutureTask<T> futureTask = newFutureTask(task, result);
+        delegate.execute(futureTask);
         return futureTask;
     }
 
-    protected ToStringHelper addToStringAttributes( final ToStringHelper toStringHelper ) {
+    protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
         return toStringHelper;
     }
 
     @Override
     public final String toString() {
-        return addToStringAttributes( MoreObjects.toStringHelper( this )
-                .add( "delegate", delegate ) ).toString();
+        return addToStringAttributes(MoreObjects.toStringHelper(this)
+                .add("delegate", delegate)).toString();
     }
 }
index 2ef1cd83969bbf401162fc239d9a95ba5a724f4a..5ec958eab88852c7d8b779b5e2e39fddd9bba2d5 100644 (file)
@@ -60,26 +60,26 @@ public class CachedThreadPoolExecutor extends ThreadPoolExecutor {
         // been reached, the task will be rejected. We specify a RejectedTaskHandler that tries
         // to offer to the backing queue. If that succeeds, the task will execute as soon as a
         // thread becomes available. If the offer fails to the backing queue, the task is rejected.
-        super( 0, maximumPoolSize, IDLE_TIMEOUT_IN_SEC, TimeUnit.SECONDS,
-               new ExecutorQueue( maximumQueueSize ) );
+        super(0, maximumPoolSize, IDLE_TIMEOUT_IN_SEC, TimeUnit.SECONDS,
+               new ExecutorQueue(maximumQueueSize));
 
-        this.threadPrefix = Preconditions.checkNotNull( threadPrefix );
+        this.threadPrefix = Preconditions.checkNotNull(threadPrefix);
         this.maximumQueueSize = maximumQueueSize;
 
-        setThreadFactory( new ThreadFactoryBuilder().setDaemon( true )
-                                            .setNameFormat( this.threadPrefix + "-%d" ).build() );
+        setThreadFactory(new ThreadFactoryBuilder().setDaemon(true)
+                                            .setNameFormat(this.threadPrefix + "-%d").build());
 
         executorQueue = (ExecutorQueue)super.getQueue();
 
         rejectedTaskHandler = new RejectedTaskHandler(
-                executorQueue.getBackingQueue(), CountingRejectedExecutionHandler.newAbortPolicy() );
-        super.setRejectedExecutionHandler( rejectedTaskHandler );
+                executorQueue.getBackingQueue(), CountingRejectedExecutionHandler.newAbortPolicy());
+        super.setRejectedExecutionHandler(rejectedTaskHandler);
     }
 
     @Override
-    public void setRejectedExecutionHandler( final RejectedExecutionHandler handler ) {
-        Preconditions.checkNotNull( handler );
-        rejectedTaskHandler.setDelegateRejectedExecutionHandler( handler );
+    public void setRejectedExecutionHandler(final RejectedExecutionHandler handler) {
+        Preconditions.checkNotNull(handler);
+        rejectedTaskHandler.setDelegateRejectedExecutionHandler(handler);
     }
 
     @Override
@@ -96,23 +96,23 @@ public class CachedThreadPoolExecutor extends ThreadPoolExecutor {
         return ((TrackingLinkedBlockingQueue<?>)executorQueue.getBackingQueue()).getLargestQueueSize();
     }
 
-    protected ToStringHelper addToStringAttributes( final ToStringHelper toStringHelper ) {
+    protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
         return toStringHelper;
     }
 
     @Override
     public final String toString() {
-        return addToStringAttributes( MoreObjects.toStringHelper( this )
-                .add( "Thread Prefix", threadPrefix )
-                .add( "Current Thread Pool Size", getPoolSize() )
-                .add( "Largest Thread Pool Size", getLargestPoolSize() )
-                .add( "Max Thread Pool Size", getMaximumPoolSize() )
-                .add( "Current Queue Size", executorQueue.getBackingQueue().size() )
-                .add( "Largest Queue Size", getLargestQueueSize() )
-                .add( "Max Queue Size", maximumQueueSize )
-                .add( "Active Thread Count", getActiveCount() )
-                .add( "Completed Task Count", getCompletedTaskCount() )
-                .add( "Total Task Count", getTaskCount() ) ).toString();
+        return addToStringAttributes(MoreObjects.toStringHelper(this)
+                .add("Thread Prefix", threadPrefix)
+                .add("Current Thread Pool Size", getPoolSize())
+                .add("Largest Thread Pool Size", getLargestPoolSize())
+                .add("Max Thread Pool Size", getMaximumPoolSize())
+                .add("Current Queue Size", executorQueue.getBackingQueue().size())
+                .add("Largest Queue Size", getLargestQueueSize())
+                .add("Max Queue Size", maximumQueueSize)
+                .add("Active Thread Count", getActiveCount())
+                .add("Completed Task Count", getCompletedTaskCount())
+                .add("Total Task Count", getTaskCount())).toString();
     }
 
     /**
@@ -130,8 +130,8 @@ public class CachedThreadPoolExecutor extends ThreadPoolExecutor {
 
         private final LinkedBlockingQueue<Runnable> backingQueue;
 
-        ExecutorQueue( final int maxBackingQueueSize ) {
-            backingQueue = new TrackingLinkedBlockingQueue<>( maxBackingQueueSize );
+        ExecutorQueue(final int maxBackingQueueSize) {
+            backingQueue = new TrackingLinkedBlockingQueue<>(maxBackingQueueSize);
         }
 
         LinkedBlockingQueue<Runnable> getBackingQueue() {
@@ -139,9 +139,9 @@ public class CachedThreadPoolExecutor extends ThreadPoolExecutor {
         }
 
         @Override
-        public Runnable poll( final long timeout, final TimeUnit unit ) throws InterruptedException {
-            long totalWaitTime = unit.toMillis( timeout );
-            long waitTime = Math.min( totalWaitTime, POLL_WAIT_TIME_IN_MS );
+        public Runnable poll(final long timeout, final TimeUnit unit) throws InterruptedException {
+            long totalWaitTime = unit.toMillis(timeout);
+            long waitTime = Math.min(totalWaitTime, POLL_WAIT_TIME_IN_MS);
             Runnable task = null;
 
             // We loop here, each time polling the backingQueue first then our queue, instead of
@@ -161,14 +161,14 @@ public class CachedThreadPoolExecutor extends ThreadPoolExecutor {
                 task = backingQueue.poll();
                 if (task == null) {
                     // No task in backing - call the base class to wait for one to be offered.
-                    task = super.poll( waitTime, TimeUnit.MILLISECONDS );
+                    task = super.poll(waitTime, TimeUnit.MILLISECONDS);
 
                     totalWaitTime -= POLL_WAIT_TIME_IN_MS;
-                    if (totalWaitTime <= 0 ) {
+                    if (totalWaitTime <= 0) {
                         break;
                     }
 
-                    waitTime = Math.min( totalWaitTime, POLL_WAIT_TIME_IN_MS );
+                    waitTime = Math.min(totalWaitTime, POLL_WAIT_TIME_IN_MS);
                 }
             }
 
@@ -193,14 +193,14 @@ public class CachedThreadPoolExecutor extends ThreadPoolExecutor {
         private final LinkedBlockingQueue<Runnable> backingQueue;
         private volatile RejectedExecutionHandler delegateRejectedExecutionHandler;
 
-        RejectedTaskHandler( final LinkedBlockingQueue<Runnable> backingQueue,
-                             final RejectedExecutionHandler delegateRejectedExecutionHandler ) {
+        RejectedTaskHandler(final LinkedBlockingQueue<Runnable> backingQueue,
+                             final RejectedExecutionHandler delegateRejectedExecutionHandler) {
             this.backingQueue = backingQueue;
             this.delegateRejectedExecutionHandler = delegateRejectedExecutionHandler;
         }
 
         void setDelegateRejectedExecutionHandler(
-                final RejectedExecutionHandler delegateRejectedExecutionHandler ) {
+                final RejectedExecutionHandler delegateRejectedExecutionHandler) {
             this.delegateRejectedExecutionHandler = delegateRejectedExecutionHandler;
         }
 
@@ -209,13 +209,13 @@ public class CachedThreadPoolExecutor extends ThreadPoolExecutor {
         }
 
         @Override
-        public void rejectedExecution( final Runnable task, final ThreadPoolExecutor executor ) {
+        public void rejectedExecution(final Runnable task, final ThreadPoolExecutor executor) {
             if (executor.isShutdown()) {
-                throw new RejectedExecutionException( "Executor has been shutdown." );
+                throw new RejectedExecutionException("Executor has been shutdown.");
             }
 
             if (!backingQueue.offer(task)) {
-                delegateRejectedExecutionHandler.rejectedExecution( task, executor );
+                delegateRejectedExecutionHandler.rejectedExecution(task, executor);
             }
         }
     }
index 8fd45dc310ac0bafc80fce37a3b1f675f8bba182..a0d59ef451068fd9e0c2da2c124087e1ec86c03c 100644 (file)
@@ -29,12 +29,12 @@ public class CountingRejectedExecutionHandler implements RejectedExecutionHandle
      *
      * @param delegate the backing RejectedExecutionHandler.
      */
-    public CountingRejectedExecutionHandler( final RejectedExecutionHandler delegate ) {
-        this.delegate = Preconditions.checkNotNull( delegate );
+    public CountingRejectedExecutionHandler(final RejectedExecutionHandler delegate) {
+        this.delegate = Preconditions.checkNotNull(delegate);
     }
 
     @Override
-    public void rejectedExecution( final Runnable task, final ThreadPoolExecutor executor ) {
+    public void rejectedExecution(final Runnable task, final ThreadPoolExecutor executor) {
         rejectedTaskCounter.increment();
         delegate.rejectedExecution(task, executor);
     }
index fad71a93525e9d33b4951a71d2e80f63f6d28719..959b8d418ea3d55eec22a6f54ebc44542c947d98 100644 (file)
@@ -80,7 +80,7 @@ public class DeadlockDetectingListeningExecutorService extends AsyncNotifyingLis
      */
     public DeadlockDetectingListeningExecutorService(final ExecutorService delegate,
             @Nonnull final Supplier<Exception> deadlockExceptionSupplier,
-            @Nullable final Executor listenableFutureExecutor ) {
+            @Nullable final Executor listenableFutureExecutor) {
         super(delegate, listenableFutureExecutor);
         this.deadlockExceptionFunction = Preconditions.checkNotNull(deadlockExceptionSupplier);
     }
index b109b190a94b190425b9a2a051d1723b519758ce..f6c37296d80f17054e57f82efdb7c61b7af8bc1b 100644 (file)
@@ -19,7 +19,8 @@ import java.util.concurrent.ExecutionException;
  *
  * <p>
  * This mapper is intended to be used with
- * {@link com.google.common.util.concurrent.Futures#makeChecked(com.google.common.util.concurrent.ListenableFuture, Function)}
+ * {@link com.google.common.util.concurrent.Futures#makeChecked(
+ * com.google.common.util.concurrent.ListenableFuture, Function)}
  * <ul>
  * <li>if exception is the specified type or one of its subclasses, it returns
  * original exception.
@@ -71,34 +72,34 @@ public abstract class ExceptionMapper<X extends Exception> implements Function<E
 
     @SuppressWarnings("unchecked")
     @Override
-    public X apply(final Exception e) {
+    public X apply(final Exception input) {
 
         // If exception is of the specified type,return it.
-        if (exceptionType.isAssignableFrom( e.getClass())) {
-            return (X) e;
+        if (exceptionType.isAssignableFrom(input.getClass())) {
+            return (X) input;
         }
 
         // If exception is ExecutionException whose cause is of the specified
         // type, return the cause.
-        if (e instanceof ExecutionException && e.getCause() != null) {
-            if (exceptionType.isAssignableFrom(e.getCause().getClass())) {
-                return (X) e.getCause();
+        if (input instanceof ExecutionException && input.getCause() != null) {
+            if (exceptionType.isAssignableFrom(input.getCause().getClass())) {
+                return (X) input.getCause();
             }
-            return newWithCause(opName + " execution failed", e.getCause());
+            return newWithCause(opName + " execution failed", input.getCause());
         }
 
         // Otherwise return an instance of the specified type with the original
         // cause.
 
-        if (e instanceof InterruptedException) {
-            return newWithCause(opName + " was interupted.", e);
+        if (input instanceof InterruptedException) {
+            return newWithCause(opName + " was interupted.", input);
         }
 
-        if (e instanceof CancellationException ) {
-            return newWithCause(opName + " was cancelled.", e);
+        if (input instanceof CancellationException) {
+            return newWithCause(opName + " was cancelled.", input);
         }
 
         // We really shouldn't get here but need to cover it anyway for completeness.
-        return newWithCause(opName + " encountered an unexpected failure", e);
+        return newWithCause(opName + " encountered an unexpected failure", input);
     }
 }
index 24fb7b82745035f2ee3d427705a7bb83db43f742..f5e6a1803f67e6093fc87ed441bbfda17a596b89 100644 (file)
@@ -40,9 +40,9 @@ public class FastThreadPoolExecutor extends ThreadPoolExecutor {
      * @param threadPrefix
      *            the name prefix for threads created by this executor.
      */
-    public FastThreadPoolExecutor( final int maximumPoolSize, final int maximumQueueSize, final String threadPrefix ) {
-        this( maximumPoolSize, maximumQueueSize, DEFAULT_IDLE_TIMEOUT_IN_SEC, TimeUnit.SECONDS,
-              threadPrefix );
+    public FastThreadPoolExecutor(final int maximumPoolSize, final int maximumQueueSize, final String threadPrefix) {
+        this(maximumPoolSize, maximumQueueSize, DEFAULT_IDLE_TIMEOUT_IN_SEC, TimeUnit.SECONDS,
+              threadPrefix);
     }
 
     /**
@@ -59,51 +59,51 @@ public class FastThreadPoolExecutor extends ThreadPoolExecutor {
      * @param threadPrefix
      *            the name prefix for threads created by this executor.
      */
-    public FastThreadPoolExecutor( final int maximumPoolSize, final int maximumQueueSize, final long keepAliveTime,
-            final TimeUnit unit, final String threadPrefix ) {
+    public FastThreadPoolExecutor(final int maximumPoolSize, final int maximumQueueSize, final long keepAliveTime,
+            final TimeUnit unit, final String threadPrefix) {
         // We use all core threads (the first 2 parameters below equal) so, when a task is submitted,
         // if the thread limit hasn't been reached, a new thread will be spawned to execute
         // the task even if there is an existing idle thread in the pool. This is faster than
         // handing the task to an existing idle thread via the queue. Once the thread limit is
         // reached, subsequent tasks will be queued. If the queue is full, tasks will be rejected.
 
-        super( maximumPoolSize, maximumPoolSize, keepAliveTime, unit,
-                new TrackingLinkedBlockingQueue<>(maximumQueueSize) );
+        super(maximumPoolSize, maximumPoolSize, keepAliveTime, unit,
+                new TrackingLinkedBlockingQueue<>(maximumQueueSize));
 
         this.threadPrefix = threadPrefix;
         this.maximumQueueSize = maximumQueueSize;
 
-        setThreadFactory( new ThreadFactoryBuilder().setDaemon( true )
-                                                 .setNameFormat( threadPrefix + "-%d" ).build() );
+        setThreadFactory(new ThreadFactoryBuilder().setDaemon(true)
+                                                 .setNameFormat(threadPrefix + "-%d").build());
 
         if (keepAliveTime > 0) {
             // Need to specifically configure core threads to timeout.
-            allowCoreThreadTimeOut( true );
+            allowCoreThreadTimeOut(true);
         }
 
-        setRejectedExecutionHandler( CountingRejectedExecutionHandler.newAbortPolicy() );
+        setRejectedExecutionHandler(CountingRejectedExecutionHandler.newAbortPolicy());
     }
 
     public long getLargestQueueSize() {
         return ((TrackingLinkedBlockingQueue<?>)getQueue()).getLargestQueueSize();
     }
 
-    protected ToStringHelper addToStringAttributes( final ToStringHelper toStringHelper ) {
+    protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
         return toStringHelper;
     }
 
     @Override
     public final String toString() {
-        return addToStringAttributes( MoreObjects.toStringHelper( this )
-                .add( "Thread Prefix", threadPrefix )
-                .add( "Current Thread Pool Size", getPoolSize() )
-                .add( "Largest Thread Pool Size", getLargestPoolSize() )
-                .add( "Max Thread Pool Size", getMaximumPoolSize() )
-                .add( "Current Queue Size", getQueue().size() )
-                .add( "Largest Queue Size", getLargestQueueSize() )
-                .add( "Max Queue Size", maximumQueueSize )
-                .add( "Active Thread Count", getActiveCount() )
-                .add( "Completed Task Count", getCompletedTaskCount() )
-                .add( "Total Task Count", getTaskCount() ) ).toString();
+        return addToStringAttributes(MoreObjects.toStringHelper(this)
+                .add("Thread Prefix", threadPrefix)
+                .add("Current Thread Pool Size", getPoolSize())
+                .add("Largest Thread Pool Size", getLargestPoolSize())
+                .add("Max Thread Pool Size", getMaximumPoolSize())
+                .add("Current Queue Size", getQueue().size())
+                .add("Largest Queue Size", getLargestQueueSize())
+                .add("Max Queue Size", maximumQueueSize)
+                .add("Active Thread Count", getActiveCount())
+                .add("Completed Task Count", getCompletedTaskCount())
+                .add("Total Task Count", getTaskCount())).toString();
     }
 }
index 7da1e4bddc2261282dcdab42fcb1253c2145b0eb..50f2ca45a09e1d5fc7a3aaaf7fb613b6921c2d81 100644 (file)
@@ -23,7 +23,7 @@ public class ListenerNotificationQueueStats {
     private final int currentQueueSize;
 
     @ConstructorProperties({ "listenerClassName","currentQueueSize" })
-    public ListenerNotificationQueueStats( final String listenerClassName, final int currentQueueSize ) {
+    public ListenerNotificationQueueStats(final String listenerClassName, final int currentQueueSize) {
         this.listenerClassName = listenerClassName;
         this.currentQueueSize = currentQueueSize;
     }
index 33000817cf45b7f4a3584feef8972ae6dfc51b72..24001d8cd78392ed3056e4243b0c35c3da9b8601 100644 (file)
@@ -37,9 +37,9 @@ public final class MappingCheckedFuture<V, X extends Exception> extends Abstract
 
     private final Function<Exception, X> mapper;
 
-    private MappingCheckedFuture( final ListenableFuture<V> delegate, final Function<Exception, X> mapper ) {
-        super( delegate );
-        this.mapper = Preconditions.checkNotNull( mapper );
+    private MappingCheckedFuture(final ListenableFuture<V> delegate, final Function<Exception, X> mapper) {
+        super(delegate);
+        this.mapper = Preconditions.checkNotNull(mapper);
     }
 
     /**
@@ -51,17 +51,18 @@ public final class MappingCheckedFuture<V, X extends Exception> extends Abstract
      * @return a new <code>MappingCheckedFuture</code>
      */
     public static <V, X extends Exception> MappingCheckedFuture<V, X> create(
-            final ListenableFuture<V> delegate, final Function<Exception, X> mapper ) {
+            final ListenableFuture<V> delegate, final Function<Exception, X> mapper) {
         return new MappingCheckedFuture<>(delegate, mapper);
     }
 
     @Override
-    protected X mapException( @Nonnull final Exception e ) {
-        return mapper.apply( e );
+    @SuppressWarnings("checkstyle:parameterName")
+    protected X mapException(@Nonnull final Exception e) {
+        return mapper.apply(e);
     }
 
-    private ExecutionException wrapInExecutionException( final String message, final Exception e ) {
-        return new ExecutionException( message, mapException( e ) );
+    private ExecutionException wrapInExecutionException(final String message, final Exception ex) {
+        return new ExecutionException(message, mapException(ex));
     }
 
     @Override
@@ -70,26 +71,26 @@ public final class MappingCheckedFuture<V, X extends Exception> extends Abstract
             return super.get();
         } catch (final InterruptedException e) {
             Thread.currentThread().interrupt();
-            throw wrapInExecutionException( "Operation was interrupted", e );
+            throw wrapInExecutionException("Operation was interrupted", e);
         } catch (final CancellationException e) {
-            throw wrapInExecutionException( "Operation was cancelled", e );
+            throw wrapInExecutionException("Operation was cancelled", e);
         } catch (final ExecutionException e) {
-            throw wrapInExecutionException( e.getMessage(), e );
+            throw wrapInExecutionException(e.getMessage(), e);
         }
     }
 
     @Override
-    public V get( final long timeout, @Nonnull final TimeUnit unit )
+    public V get(final long timeout, @Nonnull final TimeUnit unit)
             throws InterruptedException, ExecutionException, TimeoutException {
         try {
-            return super.get( timeout, unit );
+            return super.get(timeout, unit);
         } catch (final InterruptedException e) {
             Thread.currentThread().interrupt();
-            throw wrapInExecutionException( "Operation was interrupted", e );
+            throw wrapInExecutionException("Operation was interrupted", e);
         } catch (final CancellationException e) {
-            throw wrapInExecutionException( "Operation was cancelled", e );
+            throw wrapInExecutionException("Operation was cancelled", e);
         } catch (final ExecutionException e) {
-            throw wrapInExecutionException( e.getMessage(), e );
+            throw wrapInExecutionException(e.getMessage(), e);
         }
     }
 }
index 5160efe9bf7ccd785a9455335973605906999f61..c47a5884fa2583f5f162418c6e34a4f487d2c765 100644 (file)
@@ -118,13 +118,14 @@ public class QueuedNotificationManager<L, N> implements NotificationManager<L, N
      * @deprecated Use {@link #create(Executor, BatchedInvoker, int, String)} instead.
      */
     @Deprecated
+    @SuppressWarnings("checkstyle:illegalCatch")
     public QueuedNotificationManager(final Executor executor, final Invoker<L, N> listenerInvoker,
             final int maxQueueCapacity, final String name) {
-        this(executor, (BatchedInvoker<L, N>)(l, c) -> c.forEach(n -> {
+        this(executor, (BatchedInvoker<L, N>)(listener, notifications) -> notifications.forEach(n -> {
             try {
-                listenerInvoker.invokeListener(l, n);
+                listenerInvoker.invokeListener(listener, n);
             } catch (Exception e) {
-                LOG.error("{}: Error notifying listener {} with {}", name, l, n, e);
+                LOG.error("{}: Error notifying listener {} with {}", name, listener, n, e);
             }
 
         }), maxQueueCapacity, name);
@@ -280,7 +281,7 @@ public class QueuedNotificationManager<L, N> implements NotificationManager<L, N
             if (obj == this) {
                 return true;
             }
-            return (obj instanceof ListenerKey<?>) && listener == ((ListenerKey<?>) obj).listener;
+            return obj instanceof ListenerKey<?> && listener == ((ListenerKey<?>) obj).listener;
         }
 
         @Override
@@ -426,6 +427,7 @@ public class QueuedNotificationManager<L, N> implements NotificationManager<L, N
             }
         }
 
+        @SuppressWarnings("checkstyle:illegalCatch")
         private void invokeListener(final Collection<N> notifications) {
             LOG.debug("{}: Invoking listener {} with notification: {}", name, listenerKey, notifications);
             try {
index b00ed4f30472227496464bae1ac1aea60da44e9d..36f685fafd13750c80045d644e2a3fac962a5d42 100644 (file)
@@ -29,7 +29,8 @@ public final class ReflectiveExceptionMapper<X extends Exception> extends Except
     protected X newWithCause(final String message, final Throwable cause) {
         try {
             return ctor.newInstance(message, cause);
-        } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+        } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
+                | InvocationTargetException e) {
             throw new IllegalStateException("Failed to instantiate exception " + ctor.getDeclaringClass(), e);
         }
     }
index 929ecc01069b83694048f4a5a3a65ba78108cb1e..981c948c7e893bf641344319b63d9e43c2869ee7 100644 (file)
@@ -48,9 +48,9 @@ public final class SpecialExecutors {
      *            the name prefix for threads created by this executor.
      * @return a new ExecutorService with the specified configuration.
      */
-    public static ExecutorService newBoundedFastThreadPool( int maximumPoolSize,
-            int maximumQueueSize, String threadPrefix ) {
-        return new FastThreadPoolExecutor( maximumPoolSize, maximumQueueSize, threadPrefix );
+    public static ExecutorService newBoundedFastThreadPool(int maximumPoolSize,
+            int maximumQueueSize, String threadPrefix) {
+        return new FastThreadPoolExecutor(maximumPoolSize, maximumQueueSize, threadPrefix);
     }
 
     /**
@@ -68,12 +68,12 @@ public final class SpecialExecutors {
      *            the name prefix for threads created by this executor.
      * @return a new ExecutorService with the specified configuration.
      */
-    public static ExecutorService newBlockingBoundedFastThreadPool( int maximumPoolSize,
-            int maximumQueueSize, String threadPrefix ) {
+    public static ExecutorService newBlockingBoundedFastThreadPool(int maximumPoolSize,
+            int maximumQueueSize, String threadPrefix) {
 
         FastThreadPoolExecutor executor =
-                new FastThreadPoolExecutor( maximumPoolSize, maximumQueueSize, threadPrefix );
-        executor.setRejectedExecutionHandler( CountingRejectedExecutionHandler.newCallerRunsPolicy() );
+                new FastThreadPoolExecutor(maximumPoolSize, maximumQueueSize, threadPrefix);
+        executor.setRejectedExecutionHandler(CountingRejectedExecutionHandler.newCallerRunsPolicy());
         return executor;
     }
 
@@ -104,9 +104,9 @@ public final class SpecialExecutors {
      *            the name prefix for threads created by this executor.
      * @return a new ExecutorService with the specified configuration.
      */
-    public static ExecutorService newBoundedCachedThreadPool( int maximumPoolSize,
-            int maximumQueueSize, String threadPrefix ) {
-        return new CachedThreadPoolExecutor( maximumPoolSize, maximumQueueSize, threadPrefix );
+    public static ExecutorService newBoundedCachedThreadPool(int maximumPoolSize,
+            int maximumQueueSize, String threadPrefix) {
+        return new CachedThreadPoolExecutor(maximumPoolSize, maximumQueueSize, threadPrefix);
     }
 
     /**
@@ -124,12 +124,12 @@ public final class SpecialExecutors {
      *            the name prefix for threads created by this executor.
      * @return a new ExecutorService with the specified configuration.
      */
-    public static ExecutorService newBlockingBoundedCachedThreadPool( int maximumPoolSize,
-            int maximumQueueSize, String threadPrefix ) {
+    public static ExecutorService newBlockingBoundedCachedThreadPool(int maximumPoolSize,
+            int maximumQueueSize, String threadPrefix) {
 
         CachedThreadPoolExecutor executor =
-                new CachedThreadPoolExecutor( maximumPoolSize, maximumQueueSize, threadPrefix );
-        executor.setRejectedExecutionHandler( CountingRejectedExecutionHandler.newCallerRunsPolicy() );
+                new CachedThreadPoolExecutor(maximumPoolSize, maximumQueueSize, threadPrefix);
+        executor.setRejectedExecutionHandler(CountingRejectedExecutionHandler.newCallerRunsPolicy());
         return executor;
     }
 
@@ -145,9 +145,9 @@ public final class SpecialExecutors {
      *            the name prefix for the thread created by this executor.
      * @return a new ExecutorService with the specified configuration.
      */
-    public static ExecutorService newBoundedSingleThreadExecutor( int maximumQueueSize,
-            String threadPrefix ) {
-        return new FastThreadPoolExecutor( 1, maximumQueueSize, Long.MAX_VALUE, TimeUnit.SECONDS,
-                threadPrefix );
+    public static ExecutorService newBoundedSingleThreadExecutor(int maximumQueueSize,
+            String threadPrefix) {
+        return new FastThreadPoolExecutor(1, maximumQueueSize, Long.MAX_VALUE, TimeUnit.SECONDS,
+                threadPrefix);
     }
 }
index dfe31f87478bf7e29508de142f776d7b4bbd48d4..9d02c1b09dfe6bcd136c0cfe2aef8c53a7c6809d 100644 (file)
@@ -36,23 +36,24 @@ public class TrackingLinkedBlockingQueue<E> extends LinkedBlockingQueue<E> {
     private volatile int largestQueueSize = 0;
 
     /**
-     * @see LinkedBlockingQueue#LinkedBlockingQueue
+     * See {@link LinkedBlockingQueue#LinkedBlockingQueue()}.
      */
     public TrackingLinkedBlockingQueue() {
         super();
     }
 
     /**
-     * @see LinkedBlockingQueue#LinkedBlockingQueue(Collection)
+     * See {@link LinkedBlockingQueue#LinkedBlockingQueue(Collection)}.
      */
-    public TrackingLinkedBlockingQueue( final Collection<? extends E> c ) {
+    @SuppressWarnings("checkstyle:parameterName")
+    public TrackingLinkedBlockingQueue(final Collection<? extends E> c) {
         super(c);
     }
 
     /**
-     * @see LinkedBlockingQueue#LinkedBlockingQueue(int)
+     * See {@link LinkedBlockingQueue#LinkedBlockingQueue(int)}.
      */
-    public TrackingLinkedBlockingQueue( final int capacity ) {
+    public TrackingLinkedBlockingQueue(final int capacity) {
         super(capacity);
     }
 
@@ -67,8 +68,9 @@ public class TrackingLinkedBlockingQueue<E> extends LinkedBlockingQueue<E> {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean offer(final E e, final long timeout, final TimeUnit unit) throws InterruptedException {
-        if (super.offer( e, timeout, unit ) ) {
+        if (super.offer(e, timeout, unit)) {
             updateLargestQueueSize();
             return true;
         }
@@ -77,8 +79,9 @@ public class TrackingLinkedBlockingQueue<E> extends LinkedBlockingQueue<E> {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean offer(@Nonnull final E e) {
-        if (super.offer( e ) ) {
+        if (super.offer(e)) {
             updateLargestQueueSize();
             return true;
         }
@@ -87,22 +90,25 @@ public class TrackingLinkedBlockingQueue<E> extends LinkedBlockingQueue<E> {
     }
 
     @Override
-    public void put( final E e ) throws InterruptedException {
-        super.put( e );
+    @SuppressWarnings("checkstyle:parameterName")
+    public void put(final E e) throws InterruptedException {
+        super.put(e);
         updateLargestQueueSize();
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean add(final E e) {
-        boolean result = super.add( e );
+        boolean result = super.add(e);
         updateLargestQueueSize();
         return result;
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean addAll(final Collection<? extends E> c) {
         try {
-            return super.addAll( c );
+            return super.addAll(c);
         } finally {
             updateLargestQueueSize();
         }
index 05ef089bdb7ede0a1a577f77f67e13b04b54551b..8619875c2a67728e9c4d42f48dc5f8295abb391e 100644 (file)
@@ -22,6 +22,8 @@ import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
 
 /**
  * Set of utility methods for instantiating parser that deal with untrusted XML sources.
@@ -31,6 +33,7 @@ import org.xml.sax.SAXException;
 @Beta
 public final class UntrustedXML {
     private static final DocumentBuilderFactory DBF;
+
     static {
         final DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
         f.setCoalescing(true);
@@ -52,6 +55,7 @@ public final class UntrustedXML {
     }
 
     private static final SAXParserFactory SPF;
+
     static {
         final SAXParserFactory f = SAXParserFactory.newInstance();
         f.setNamespaceAware(true);
@@ -62,7 +66,7 @@ public final class UntrustedXML {
             f.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
             f.setFeature("http://xml.org/sax/features/external-general-entities", false);
             f.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
-        } catch (final Exception e) {
+        } catch (final SAXNotRecognizedException | SAXNotSupportedException | ParserConfigurationException e) {
             throw new ExceptionInInitializerError(e);
         }
 
@@ -70,6 +74,7 @@ public final class UntrustedXML {
     }
 
     private static final XMLInputFactory XIF;
+
     static {
         final XMLInputFactory f = XMLInputFactory.newInstance();
 
index 11aac6ccf067b431f142835969d3b43ca23cb5d4..c33c9cb7057e0892ab88b296d27b76d5dbcffe1e 100644 (file)
@@ -54,7 +54,7 @@ public class ConstantArrayCollectionTest {
         assertFalse(c.contains(""));
         assertFalse(c.contains(1));
 
-        assertTrue(c.containsAll(Collections.<String>emptyList()));
+        assertTrue(c.containsAll(Collections.emptyList()));
         assertFalse(c.containsAll(Collections.singleton("")));
         assertFalse(c.containsAll(Collections.singleton(1)));
     }
index 7fef4a303fd6836f12f44673b97c5377a4841e18..0cc3eebf682c79a34b0d40bf3862d6e1a3c0d587 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.yangtools.util;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
 
@@ -69,7 +70,7 @@ public class DurationStatisticsTrackerTest {
     }
 
     private static void verifyDisplayableString(final String name, final String actual, final String expPrefix) {
-        assertEquals(name + " starts with " + expPrefix + ". Actual: " + actual,
-                true, actual.startsWith(expPrefix));
+        assertTrue(name + " starts with " + expPrefix + ". Actual: " + actual,
+                actual.startsWith(expPrefix));
     }
 }
index 59bcd8521763bbe9e8e53e20d42ec8707461debf..3bc5e652747b891cf6074b3c3a03708ea6ecabff 100644 (file)
@@ -28,16 +28,15 @@ public class EvenMoreObjectsTest {
 
     @Test
     public void nullEqualsNull() {
-        assertTrue(EvenMoreObjects.equalsHelper(null, null, (one, another) -> true));
+        assertTrue(EvenMoreObjects.equalsHelper(null, null, (one, another) -> Boolean.TRUE));
     }
 
     private static class Thing {
-
         String name;
         Integer age;
 
         @Override
-        public boolean equals(Object obj) {
+        public boolean equals(final Object obj) {
             return EvenMoreObjects.equalsHelper(this, obj,
                 (one, another) -> Objects.equals(one.name, another.name) && Objects.equals(one.age, another.age));
         }
@@ -52,12 +51,10 @@ public class EvenMoreObjectsTest {
             return MoreObjects.toStringHelper(this).add("name", name).add("age", age).toString();
         }
 
-        Thing(String name, Integer age) {
+        Thing(final String name, final Integer age) {
             super();
             this.name = name;
             this.age = age;
         }
-
     }
-
 }
index 1f7666a2b21f81dd55a8f6ef8f3c194d558e1c28..4863357d13344198f2df47bc33d719a24d56a102 100644 (file)
@@ -15,13 +15,13 @@ public class HashCodeBuilderTest {
 
     @Test
     public void testAllMethodsOfHashCodeBuilder() {
-        final HashCodeBuilder<String> hashCodeBuilder = new HashCodeBuilder<>();
-        assertEquals("Default hash code should be '1'.", 1, hashCodeBuilder.build().intValue());
+        final HashCodeBuilder<String> builder = new HashCodeBuilder<>();
+        assertEquals("Default hash code should be '1'.", 1, builder.build().intValue());
 
         int nextHashCode = HashCodeBuilder.nextHashCode(1, "test");
         assertEquals("Next hash code should be '3556529'.", 3556529, nextHashCode);
 
-        hashCodeBuilder.addArgument("another test");
-        assertEquals("Updated internal hash code should be '700442706'.", -700442706, hashCodeBuilder.build().intValue());
+        builder.addArgument("another test");
+        assertEquals("Updated internal hash code should be '700442706'.", -700442706, builder.build().intValue());
     }
 }
index 211129262bc9d8f29176c98c42268cd38043d826..4c2d2ad83a0cae155348424030f3fa934ce433d9 100644 (file)
@@ -24,7 +24,7 @@ public class ListenerRegistryTest {
 
     private TestEventListener testEventListener;
     private ExtendedTestEventListener extendedTestEventListener;
-    private ListenerRegistry<TestEventListener> listenerRegistry;
+    private ListenerRegistry<TestEventListener> registry;
 
     @Rule
     public ExpectedException expException = ExpectedException.none();
@@ -33,46 +33,48 @@ public class ListenerRegistryTest {
     public void init() {
         testEventListener = new TestEventListener() {};
         extendedTestEventListener = new ExtendedTestEventListener() {};
-        listenerRegistry = new ListenerRegistry<>();
+        registry = new ListenerRegistry<>();
     }
 
     @Test
     public void testCreateNewInstance() {
-        assertNotNull("Intance of listener registry shouldn't be null.", listenerRegistry);
+        assertNotNull("Intance of listener registry shouldn't be null.", registry);
     }
 
     @Test
     public void tetGetListenersMethod() {
-        assertTrue("Listener regisdtry should have any listeners.", Iterables.isEmpty(listenerRegistry.getListeners()));
+        assertTrue("Listener registry should have any listeners.", Iterables.isEmpty(registry.getListeners()));
     }
 
     @Test
     public void testRegisterMethod() {
 
-        final ListenerRegistration<TestEventListener> listenerRegistration = listenerRegistry.register(testEventListener);
+        final ListenerRegistration<TestEventListener> listenerRegistration = registry.register(testEventListener);
         assertEquals("Listeners should be the same.", testEventListener, listenerRegistration.getInstance());
 
         expException.expect(IllegalArgumentException.class);
         expException.expectMessage("Listener should not be null.");
-        listenerRegistry.register(null);
+        registry.register(null);
     }
 
     @Test
     public void testRegisterWithType() {
-        final ListenerRegistration<ExtendedTestEventListener> listenerRegistration = listenerRegistry.registerWithType(extendedTestEventListener);
+        final ListenerRegistration<ExtendedTestEventListener> listenerRegistration = registry.registerWithType(
+            extendedTestEventListener);
         assertEquals("Listeners should be the same.", extendedTestEventListener, listenerRegistration.getInstance());
     }
 
     @Test
     public void testIteratorMethod() {
-        final Iterator<ListenerRegistration<TestEventListener>> listenerIterator = listenerRegistry.iterator();
+        final Iterator<ListenerRegistration<TestEventListener>> listenerIterator = registry.iterator();
         assertNotNull("Listener iterator shouldn't be null.", listenerIterator);
     }
 
     @Test
     public void testCreateMethod() {
-        final ListenerRegistry<EventListener> emptyListenerRegistry = ListenerRegistry.create();
-        assertTrue("List of listeners in listener registry should be empty.", Iterables.isEmpty(emptyListenerRegistry.getListeners()));
+        final ListenerRegistry<EventListener> emptyRegistry = ListenerRegistry.create();
+        assertTrue("List of listeners in listener registry should be empty.",
+            Iterables.isEmpty(emptyRegistry.getListeners()));
     }
 
     interface TestEventListener extends EventListener {
index f0d1ec8de97293b0af52db379a9d96be7a1ef5a3..8af39c471f0a01ff7cf821603169309c6cdd2523 100644 (file)
@@ -51,13 +51,16 @@ public class ReadWriteTrieMapTest {
         final Collection<String> trieMapValues = readWriteTrieMap.values();
         assertEquals("Size of values should be '3'.", 3, trieMapValues.size());
 
-        assertTrue("Entry set of readWriteTrieMap and trieMap should by equals.", convertSetEntryToMap(readWriteTrieMap.entrySet()).equals(trieMap));
+        assertTrue("Entry set of readWriteTrieMap and trieMap should by equals.",
+            convertSetEntryToMap(readWriteTrieMap.entrySet()).equals(trieMap));
 
         trieMap.put("2", "two");
         final ReadWriteTrieMap<String, String> readWriteTrieMap2 = new ReadWriteTrieMap<>(trieMap, 4);
 
-        assertFalse("Objects readWriteTrieMap and readOnlyTrieMap2 should be different.", readWriteTrieMap.equals(readWriteTrieMap2));
-        assertFalse("Hash codes of object readWriteTrieMap and readOnelyTrieMap2 should be different.", readWriteTrieMap.hashCode() == readWriteTrieMap2.hashCode());
+        assertFalse("Objects readWriteTrieMap and readOnlyTrieMap2 should be different.",
+            readWriteTrieMap.equals(readWriteTrieMap2));
+        assertFalse("Hash codes of object readWriteTrieMap and readOnelyTrieMap2 should be different.",
+            readWriteTrieMap.hashCode() == readWriteTrieMap2.hashCode());
 
         final Map<String, String> readOnlyTrieMap = readWriteTrieMap.toReadOnly();
         readWriteTrieMap.clear();
@@ -65,7 +68,7 @@ public class ReadWriteTrieMapTest {
         assertEquals("Size of readOnlyTrieMap should be '6'.", 6, readOnlyTrieMap.size());
     }
 
-    public Map<String, String> convertSetEntryToMap(Set<Entry<String, String>> input) {
+    public Map<String, String> convertSetEntryToMap(final Set<Entry<String, String>> input) {
         Map<String, String> resultMap = new HashMap<>();
         for (Entry<String, String> entry : input) {
             resultMap.put(entry.getKey(), entry.getValue());
index a8bc5b53d6969d913a433b73cfd050edf28e0b2b..f47e859797be295d25be53c43fd4dd5e64c6d3d7 100644 (file)
@@ -84,32 +84,32 @@ public class SharedSingletonMapTest {
         assertTrue(m.equals(t));
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testEmptyOrderedCopyOf() {
         SharedSingletonMap.orderedCopyOf(ImmutableMap.of());
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testEmptyUnorderedCopyOf() {
         SharedSingletonMap.unorderedCopyOf(ImmutableMap.of());
     }
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testClear() {
         create().clear();
     }
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testPut() {
         create().put(null, null);
     }
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testPutAll() {
         create().putAll(Collections.singletonMap("", ""));
     }
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testRemove() {
         create().remove(null);
     }
index 3e2ae6ca04dc140c7f8ed91dc556e27e5f931a9f..8438554104cdda233c5665d0ab590ddf278dd7a0 100644 (file)
@@ -73,37 +73,37 @@ public class SingletonSetTest {
         assertFalse(it.hasNext());
     }
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testRejectedAdd() {
         final SingletonSet<?> s = nullSet();
         s.add(null);
     }
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testRejectedAddAll() {
         final SingletonSet<?> s = nullSet();
         s.addAll(null);
     }
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testRejectedClear() {
         final SingletonSet<?> s = nullSet();
         s.clear();
     }
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testRejectedRemove() {
         final SingletonSet<?> s = nullSet();
         s.remove(null);
     }
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testRejectedRemoveAll() {
         final SingletonSet<?> s = nullSet();
         s.removeAll(null);
     }
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testRejectedRetainAll() {
         final SingletonSet<?> s = nullSet();
         s.retainAll(null);
index bfc9303561f6000880e8e2cc646dd6bf35e4eadd..bbcb87f148e1fe30a6874f9d0038b4dc8752e909 100644 (file)
@@ -8,9 +8,9 @@
 
 package org.opendaylight.yangtools.util.concurrent;
 
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
@@ -19,11 +19,11 @@ import static org.opendaylight.yangtools.util.concurrent.CommonTestUtils.SUBMIT_
 import static org.opendaylight.yangtools.util.concurrent.CommonTestUtils.SUBMIT_RUNNABLE;
 import static org.opendaylight.yangtools.util.concurrent.CommonTestUtils.SUBMIT_RUNNABLE_WITH_RESULT;
 
-import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
@@ -47,11 +47,11 @@ public class AsyncNotifyingListeningExecutorServiceTest {
 
     @After
     public void tearDown() {
-        if (listenerExecutor != null ) {
+        if (listenerExecutor != null) {
             listenerExecutor.shutdownNow();
         }
 
-        if (testExecutor != null ) {
+        if (testExecutor != null) {
             testExecutor.shutdownNow();
         }
     }
@@ -60,17 +60,17 @@ public class AsyncNotifyingListeningExecutorServiceTest {
     public void testListenerCallbackWithExecutor() throws InterruptedException {
 
         String listenerThreadPrefix = "ListenerThread";
-        listenerExecutor = Executors.newFixedThreadPool( 3,
-                new ThreadFactoryBuilder().setNameFormat( listenerThreadPrefix + "-%d" ).build() );
+        listenerExecutor = Executors.newFixedThreadPool(3,
+                new ThreadFactoryBuilder().setNameFormat(listenerThreadPrefix + "-%d").build());
 
         testExecutor = new AsyncNotifyingListeningExecutorService(
                 Executors.newSingleThreadExecutor(
-                        new ThreadFactoryBuilder().setNameFormat( "SingleThread" ).build() ),
-                listenerExecutor );
+                        new ThreadFactoryBuilder().setNameFormat("SingleThread").build()),
+                listenerExecutor);
 
-        testListenerCallback( testExecutor, SUBMIT_CALLABLE, listenerThreadPrefix );
-        testListenerCallback( testExecutor, SUBMIT_RUNNABLE, listenerThreadPrefix );
-        testListenerCallback( testExecutor, SUBMIT_RUNNABLE_WITH_RESULT, listenerThreadPrefix );
+        testListenerCallback(testExecutor, SUBMIT_CALLABLE, listenerThreadPrefix);
+        testListenerCallback(testExecutor, SUBMIT_RUNNABLE, listenerThreadPrefix);
+        testListenerCallback(testExecutor, SUBMIT_RUNNABLE_WITH_RESULT, listenerThreadPrefix);
     }
 
     @Test
@@ -79,20 +79,20 @@ public class AsyncNotifyingListeningExecutorServiceTest {
         String listenerThreadPrefix = "SingleThread";
         testExecutor = new AsyncNotifyingListeningExecutorService(
                 Executors.newSingleThreadExecutor(
-                        new ThreadFactoryBuilder().setNameFormat( listenerThreadPrefix ).build() ),
-                null );
+                        new ThreadFactoryBuilder().setNameFormat(listenerThreadPrefix).build()),
+                null);
 
-        testListenerCallback( testExecutor, SUBMIT_CALLABLE, listenerThreadPrefix );
-        testListenerCallback( testExecutor, SUBMIT_RUNNABLE, listenerThreadPrefix );
-        testListenerCallback( testExecutor, SUBMIT_RUNNABLE_WITH_RESULT, listenerThreadPrefix );
+        testListenerCallback(testExecutor, SUBMIT_CALLABLE, listenerThreadPrefix);
+        testListenerCallback(testExecutor, SUBMIT_RUNNABLE, listenerThreadPrefix);
+        testListenerCallback(testExecutor, SUBMIT_RUNNABLE_WITH_RESULT, listenerThreadPrefix);
     }
 
-    static void testListenerCallback( AsyncNotifyingListeningExecutorService executor,
-            Invoker invoker, final String expListenerThreadPrefix ) throws InterruptedException {
+    static void testListenerCallback(final AsyncNotifyingListeningExecutorService executor,
+            final Invoker invoker, final String expListenerThreadPrefix) throws InterruptedException {
 
         AtomicReference<AssertionError> assertError = new AtomicReference<>();
-        CountDownLatch futureNotifiedLatch = new CountDownLatch( 1 );
-        CountDownLatch blockTaskLatch = new CountDownLatch( 1 );
+        CountDownLatch futureNotifiedLatch = new CountDownLatch(1);
+        CountDownLatch blockTaskLatch = new CountDownLatch(1);
 
         // The blockTaskLatch is used to block the task from completing until we've added
         // our listener to the Future. Otherwise, if the task completes quickly and the Future is
@@ -100,95 +100,92 @@ public class AsyncNotifyingListeningExecutorServiceTest {
         // will immediately notify synchronously on this thread as Futures#addCallback defaults to
         // a same thread executor. This would erroneously fail the test.
 
-        ListenableFuture<?> future = invoker.invokeExecutor( executor, blockTaskLatch );
-        addCallback( future, futureNotifiedLatch, expListenerThreadPrefix, assertError );
+        ListenableFuture<?> future = invoker.invokeExecutor(executor, blockTaskLatch);
+        addCallback(future, futureNotifiedLatch, expListenerThreadPrefix, assertError);
 
         // Now that we've added our listener, signal the latch to let the task complete.
 
         blockTaskLatch.countDown();
 
-        assertTrue( "ListenableFuture callback was not notified of onSuccess",
-                    futureNotifiedLatch.await( 5, TimeUnit.SECONDS ) );
+        assertTrue("ListenableFuture callback was not notified of onSuccess",
+                    futureNotifiedLatch.await(5, TimeUnit.SECONDS));
 
-        if (assertError.get() != null ) {
+        if (assertError.get() != null) {
             throw assertError.get();
         }
 
         // Add another listener - since the Future is already complete, we expect the listener to be
         // notified inline on this thread when it's added.
 
-        futureNotifiedLatch = new CountDownLatch( 1 );
-        addCallback( future, futureNotifiedLatch, Thread.currentThread().getName(), assertError );
+        futureNotifiedLatch = new CountDownLatch(1);
+        addCallback(future, futureNotifiedLatch, Thread.currentThread().getName(), assertError);
 
-        assertTrue( "ListenableFuture callback was not notified of onSuccess",
-                    futureNotifiedLatch.await( 5, TimeUnit.SECONDS ) );
+        assertTrue("ListenableFuture callback was not notified of onSuccess",
+                    futureNotifiedLatch.await(5, TimeUnit.SECONDS));
 
-        if (assertError.get() != null ) {
+        if (assertError.get() != null) {
             throw assertError.get();
         }
     }
 
-    static void addCallback( ListenableFuture<?> future,
-            final CountDownLatch futureNotifiedLatch,
-            final String expListenerThreadPrefix,
-            final AtomicReference<AssertionError> assertError ) {
+    static void addCallback(final ListenableFuture<?> future, final CountDownLatch futureNotifiedLatch,
+            final String expListenerThreadPrefix, final AtomicReference<AssertionError> assertError) {
 
-        Futures.addCallback( future, new FutureCallback<Object>() {
+        Futures.addCallback(future, new FutureCallback<Object>() {
             @Override
-            public void onSuccess( Object result ) {
-
+            public void onSuccess(final Object result) {
                 try {
                     String theadName = Thread.currentThread().getName();
-                    assertTrue( "ListenableFuture callback was not notified on the listener executor."
-                        + " Expected thread name prefix \"" + expListenerThreadPrefix +
-                            "\". Actual thread name \"" + theadName + "\"",
-                            theadName.startsWith( expListenerThreadPrefix ) );
-                } catch( AssertionError e ) {
-                    assertError.set( e );
+                    assertTrue("ListenableFuture callback was not notified on the listener executor."
+                        + " Expected thread name prefix \"" + expListenerThreadPrefix
+                        + "\". Actual thread name \"" + theadName + "\"",
+                            theadName.startsWith(expListenerThreadPrefix));
+                } catch (AssertionError e) {
+                    assertError.set(e);
                 } finally {
                     futureNotifiedLatch.countDown();
                 }
             }
 
             @Override
-            public void onFailure( @Nonnull Throwable t ) {
+            @SuppressWarnings("checkstyle:parameterName")
+            public void onFailure(@Nonnull final Throwable t) {
                 // Shouldn't happen
-                t.printStackTrace();
+                fail("Unexpected failure " + t);
             }
-        } );
+        });
     }
 
     @Test
     public void testDelegatedMethods() throws InterruptedException {
 
-        Runnable task = () -> {
-        };
+        Runnable task = () -> { };
 
-        List<Runnable> taskList = Lists.newArrayList();
+        List<Runnable> taskList = new ArrayList<>();
 
-        ExecutorService mockDelegate = mock( ExecutorService.class );
-        doNothing().when( mockDelegate ).execute( task );
-        doNothing().when( mockDelegate ).shutdown();
-        doReturn( taskList ).when( mockDelegate ).shutdownNow();
-        doReturn( true ).when( mockDelegate ).awaitTermination( 3, TimeUnit.SECONDS );
-        doReturn( true ).when( mockDelegate ).isShutdown();
-        doReturn( true ).when( mockDelegate ).isTerminated();
+        ExecutorService mockDelegate = mock(ExecutorService.class);
+        doNothing().when(mockDelegate).execute(task);
+        doNothing().when(mockDelegate).shutdown();
+        doReturn(taskList).when(mockDelegate).shutdownNow();
+        doReturn(Boolean.TRUE).when(mockDelegate).awaitTermination(3, TimeUnit.SECONDS);
+        doReturn(Boolean.TRUE).when(mockDelegate).isShutdown();
+        doReturn(Boolean.TRUE).when(mockDelegate).isTerminated();
 
         AsyncNotifyingListeningExecutorService executor = new AsyncNotifyingListeningExecutorService(
-                                                                   mockDelegate, null );
+                                                                   mockDelegate, null);
 
-        executor.execute( task );
+        executor.execute(task);
         executor.shutdown();
-        assertEquals( "awaitTermination", true, executor.awaitTermination( 3, TimeUnit.SECONDS ) );
-        assertSame( "shutdownNow", taskList, executor.shutdownNow() );
-        assertEquals( "isShutdown", true, executor.isShutdown() );
-        assertEquals( "isTerminated", true, executor.isTerminated() );
-
-        verify( mockDelegate ).execute( task );
-        verify( mockDelegate ).shutdown();
-        verify( mockDelegate ).awaitTermination( 3, TimeUnit.SECONDS );
-        verify( mockDelegate ).shutdownNow();
-        verify( mockDelegate ).isShutdown();
-        verify( mockDelegate ).isTerminated();
+        assertTrue("awaitTermination", executor.awaitTermination(3, TimeUnit.SECONDS));
+        assertSame("shutdownNow", taskList, executor.shutdownNow());
+        assertTrue("isShutdown", executor.isShutdown());
+        assertTrue("isTerminated", executor.isTerminated());
+
+        verify(mockDelegate).execute(task);
+        verify(mockDelegate).shutdown();
+        verify(mockDelegate).awaitTermination(3, TimeUnit.SECONDS);
+        verify(mockDelegate).shutdownNow();
+        verify(mockDelegate).isShutdown();
+        verify(mockDelegate).isTerminated();
     }
 }
index 7404c8c3843995cbd367e6ec6adc568f1855d650..9ee60f7ad045744b5d566c742b2048b49f9d9e60 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.yangtools.util.concurrent;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.Uninterruptibles;
-import java.util.concurrent.Callable;
 import java.util.concurrent.CountDownLatch;
 
 /**
@@ -20,31 +19,27 @@ import java.util.concurrent.CountDownLatch;
  * @author Thomas Pantelis
  */
 public class CommonTestUtils {
-
+    @FunctionalInterface
     public interface Invoker {
-        ListenableFuture<?> invokeExecutor( ListeningExecutorService executor,
-                CountDownLatch blockingLatch );
+        ListenableFuture<?> invokeExecutor(ListeningExecutorService executor, CountDownLatch blockingLatch);
     }
 
-    public static final Invoker SUBMIT_CALLABLE = (executor, blockingLatch) -> executor.submit(new Callable<Void>() {
-        @Override
-        public Void call() throws Exception {
-            if (blockingLatch != null ) {
-                Uninterruptibles.awaitUninterruptibly( blockingLatch );
-            }
-            return null;
+    public static final Invoker SUBMIT_CALLABLE = (executor, blockingLatch) -> executor.submit(() -> {
+        if (blockingLatch != null) {
+            Uninterruptibles.awaitUninterruptibly(blockingLatch);
         }
-    } );
+        return null;
+    });
 
     public static final Invoker SUBMIT_RUNNABLE = (executor, blockingLatch) -> executor.submit(() -> {
-        if (blockingLatch != null ) {
-            Uninterruptibles.awaitUninterruptibly( blockingLatch );
+        if (blockingLatch != null) {
+            Uninterruptibles.awaitUninterruptibly(blockingLatch);
         }
     });
 
     public static final Invoker SUBMIT_RUNNABLE_WITH_RESULT = (executor, blockingLatch) -> executor.submit(() -> {
-        if (blockingLatch != null ) {
-            Uninterruptibles.awaitUninterruptibly( blockingLatch );
+        if (blockingLatch != null) {
+            Uninterruptibles.awaitUninterruptibly(blockingLatch);
         }
-    }, "foo" );
+    }, "foo");
 }
index 6a86840b963460aaff7da0a60125dd03bb535f5b..e6dd9f3f5e024552228ec90e4f7e31b4b613ed49 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.yangtools.util.concurrent;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.util.concurrent.CountDownLatch;
@@ -40,59 +41,57 @@ public class CountingRejectedExecutionHandlerTest {
     @Test
     public void testCallerRunsPolicyHandler() throws InterruptedException {
 
-        int nTasks = 5;
-        CountDownLatch tasksRunLatch = new CountDownLatch( 1 );
-        CountDownLatch blockLatch = new CountDownLatch( 1 );
+        CountDownLatch tasksRunLatch = new CountDownLatch(1);
+        CountDownLatch blockLatch = new CountDownLatch(1);
 
-        executor = new ThreadPoolExecutor( 1, 1, 0, TimeUnit.SECONDS,
-                ExecutorServiceUtil.offerFailingBlockingQueue(new LinkedBlockingQueue<>() ) );
+        executor = new ThreadPoolExecutor(1, 1, 0, TimeUnit.SECONDS,
+                ExecutorServiceUtil.offerFailingBlockingQueue(new LinkedBlockingQueue<>()));
 
-        CountingRejectedExecutionHandler countingHandler =
-                CountingRejectedExecutionHandler.newCallerRunsPolicy();
-        executor.setRejectedExecutionHandler( countingHandler );
+        CountingRejectedExecutionHandler countingHandler = CountingRejectedExecutionHandler.newCallerRunsPolicy();
+        executor.setRejectedExecutionHandler(countingHandler);
 
-        executor.execute( new Task( tasksRunLatch, blockLatch ) );
+        executor.execute(new Task(tasksRunLatch, blockLatch));
 
-        for (int i = 0; i < nTasks - 1; i++) {
-            executor.execute( new Task( null, null, null, null, 0 ) );
+        int tasks = 5;
+        for (int i = 0; i < tasks - 1; i++) {
+            executor.execute(new Task(null, null, null, null, 0));
         }
 
-        assertEquals( "getRejectedTaskCount", nTasks - 1, countingHandler.getRejectedTaskCount() );
+        assertEquals("getRejectedTaskCount", tasks - 1, countingHandler.getRejectedTaskCount());
 
         blockLatch.countDown();
 
-        assertEquals( "Tasks complete", true, tasksRunLatch.await( 5, TimeUnit.SECONDS ) );
+        assertTrue("Tasks complete", tasksRunLatch.await(5, TimeUnit.SECONDS));
     }
 
     @Test
     public void testAbortPolicyHandler() throws InterruptedException {
 
-        int nTasks = 5;
-        CountDownLatch tasksRunLatch = new CountDownLatch( 1 );
-        CountDownLatch blockLatch = new CountDownLatch( 1 );
+        CountDownLatch tasksRunLatch = new CountDownLatch(1);
+        CountDownLatch blockLatch = new CountDownLatch(1);
 
-        executor = new ThreadPoolExecutor( 1, 1, 0, TimeUnit.SECONDS,
-                ExecutorServiceUtil.offerFailingBlockingQueue(new LinkedBlockingQueue<>() ) );
+        executor = new ThreadPoolExecutor(1, 1, 0, TimeUnit.SECONDS,
+                ExecutorServiceUtil.offerFailingBlockingQueue(new LinkedBlockingQueue<>()));
 
-        CountingRejectedExecutionHandler countingHandler =
-                CountingRejectedExecutionHandler.newAbortPolicy();
-        executor.setRejectedExecutionHandler( countingHandler );
+        CountingRejectedExecutionHandler countingHandler = CountingRejectedExecutionHandler.newAbortPolicy();
+        executor.setRejectedExecutionHandler(countingHandler);
 
-        executor.execute( new Task( tasksRunLatch, blockLatch ) );
+        executor.execute(new Task(tasksRunLatch, blockLatch));
 
-        for (int i = 0; i < nTasks - 1; i++) {
+        int tasks = 5;
+        for (int i = 0; i < tasks - 1; i++) {
             try {
-                executor.execute( new Task( null, null, null, null, 0 ) );
-                fail( "Expected RejectedExecutionException" );
-            } catch( RejectedExecutionException e ) {
+                executor.execute(new Task(null, null, null, null, 0));
+                fail("Expected RejectedExecutionException");
+            } catch (RejectedExecutionException e) {
                 // Expected
             }
         }
 
-        assertEquals( "getRejectedTaskCount", nTasks - 1, countingHandler.getRejectedTaskCount() );
+        assertEquals("getRejectedTaskCount", tasks - 1, countingHandler.getRejectedTaskCount());
 
         blockLatch.countDown();
 
-        assertEquals( "Tasks complete", true, tasksRunLatch.await( 5, TimeUnit.SECONDS ) );
+        assertTrue("Tasks complete", tasksRunLatch.await(5, TimeUnit.SECONDS));
     }
 }
index 83a5134bf7834c9e8cfe0fb80f75336f19312ef2..c1f760375bb47ab6f1c6533f1a8520c1816485e8 100644 (file)
@@ -84,12 +84,11 @@ public class DeadlockDetectingListeningExecutorServiceTest {
 
         ListenableFuture<String> future = executor.submit(() -> "foo");
 
-        assertEquals( "Future result", "foo", future.get( 5, TimeUnit.SECONDS));
+        assertEquals("Future result", "foo", future.get(5, TimeUnit.SECONDS));
 
         // Test submit with Runnable.
 
-        executor.submit(() -> {
-        }).get();
+        executor.submit(() -> { }).get();
 
         // Test submit with Runnable and value.
 
@@ -99,6 +98,7 @@ public class DeadlockDetectingListeningExecutorServiceTest {
     }
 
     @Test
+    @SuppressWarnings("checkstyle:illegalThrows")
     public void testNonBlockingSubmitOnExecutorThread() throws Throwable {
 
         executor = newExecutor();
@@ -110,6 +110,7 @@ public class DeadlockDetectingListeningExecutorServiceTest {
         testNonBlockingSubmitOnExecutorThread(EXECUTE, SUBMIT_CALLABLE);
     }
 
+    @SuppressWarnings("checkstyle:illegalThrows")
     void testNonBlockingSubmitOnExecutorThread(final InitialInvoker initialInvoker, final Invoker invoker)
             throws Throwable {
 
@@ -123,6 +124,7 @@ public class DeadlockDetectingListeningExecutorServiceTest {
             }
 
             @Override
+            @SuppressWarnings("checkstyle:parameterName")
             public void onFailure(@Nonnull final Throwable t) {
                 caughtEx.set(t);
                 futureCompletedLatch.countDown();
@@ -140,7 +142,7 @@ public class DeadlockDetectingListeningExecutorServiceTest {
     }
 
     @Test
-    public void testBlockingSubmitOnExecutorThread() throws Exception {
+    public void testBlockingSubmitOnExecutorThread() throws InterruptedException {
 
         executor = newExecutor();
 
@@ -151,8 +153,9 @@ public class DeadlockDetectingListeningExecutorServiceTest {
         testBlockingSubmitOnExecutorThread(EXECUTE, SUBMIT_CALLABLE);
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
     void testBlockingSubmitOnExecutorThread(final InitialInvoker initialInvoker, final Invoker invoker)
-            throws Exception {
+            throws InterruptedException {
 
         final AtomicReference<Throwable> caughtEx = new AtomicReference<>();
         final CountDownLatch latch = new CountDownLatch(1);
@@ -161,9 +164,9 @@ public class DeadlockDetectingListeningExecutorServiceTest {
 
             try {
                 invoker.invokeExecutor(executor, null).get();
-            } catch(ExecutionException e) {
+            } catch (ExecutionException e) {
                 caughtEx.set(e.getCause());
-            } catch(Throwable e) {
+            } catch (Throwable e) {
                 caughtEx.set(e);
             } finally {
                 latch.countDown();
@@ -172,7 +175,7 @@ public class DeadlockDetectingListeningExecutorServiceTest {
 
         initialInvoker.invokeExecutor(executor, task);
 
-        assertTrue("Task did not complete - executor likely deadlocked", latch.await( 5, TimeUnit.SECONDS));
+        assertTrue("Task did not complete - executor likely deadlocked", latch.await(5, TimeUnit.SECONDS));
         assertNotNull("Expected exception thrown", caughtEx.get());
         assertEquals("Caught exception type", TestDeadlockException.class, caughtEx.get().getClass());
     }
index deeafc1c1b747b3412387a308abb9b4036548cd1..068f82519f15048c0b546493fd3f1a2fc7bb0ee8 100644 (file)
@@ -8,11 +8,11 @@
 
 package org.opendaylight.yangtools.util.concurrent;
 
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import com.google.common.util.concurrent.CheckedFuture;
@@ -32,35 +32,37 @@ import org.junit.Test;
 public class MappingCheckedFutureTest {
 
     interface FutureInvoker {
-        void invokeGet( CheckedFuture<?,?> future ) throws Exception;
-        Throwable extractWrappedTestEx( Exception from );
+        void invokeGet(CheckedFuture<?,?> future) throws Exception;
+
+        Throwable extractWrappedTestEx(Exception from);
     }
 
-    @SuppressWarnings("serial")
     static class TestException extends Exception {
-        TestException( final String message, final Throwable cause ) {
-            super( message, cause );
+        private static final long serialVersionUID = 1L;
+
+        TestException(final String message, final Throwable cause) {
+            super(message, cause);
         }
     }
 
-    static final ExceptionMapper<TestException> MAPPER =  new ExceptionMapper<TestException>(
-                                                                      "Test", TestException.class ) {
+    static final ExceptionMapper<TestException> MAPPER = new ExceptionMapper<TestException>(
+                                                                      "Test", TestException.class) {
 
         @Override
-        protected TestException newWithCause( final String message, final Throwable cause ) {
-            return new TestException( message, cause );
+        protected TestException newWithCause(final String message, final Throwable cause) {
+            return new TestException(message, cause);
         }
     };
 
     static final FutureInvoker GET = new FutureInvoker() {
         @Override
-        public void invokeGet( final CheckedFuture<?,?> future ) throws Exception {
+        public void invokeGet(final CheckedFuture<?, ?> future) throws Exception {
             future.get();
         }
 
         @Override
-        public Throwable extractWrappedTestEx( final Exception from ) {
-            if (from instanceof ExecutionException ) {
+        public Throwable extractWrappedTestEx(final Exception from) {
+            if (from instanceof ExecutionException) {
                 return from.getCause();
             }
 
@@ -70,13 +72,13 @@ public class MappingCheckedFutureTest {
 
     static final FutureInvoker TIMED_GET = new FutureInvoker() {
         @Override
-        public void invokeGet( final CheckedFuture<?,?> future ) throws Exception {
-            future.get( 1, TimeUnit.HOURS );
+        public void invokeGet(final CheckedFuture<?, ?> future) throws Exception {
+            future.get(1, TimeUnit.HOURS);
         }
 
         @Override
-        public Throwable extractWrappedTestEx( final Exception from ) {
-            if (from instanceof ExecutionException ) {
+        public Throwable extractWrappedTestEx(final Exception from) {
+            if (from instanceof ExecutionException) {
                 return from.getCause();
             }
 
@@ -86,139 +88,128 @@ public class MappingCheckedFutureTest {
 
     static final FutureInvoker CHECKED_GET = new FutureInvoker() {
         @Override
-        public void invokeGet( final CheckedFuture<?,?> future ) throws Exception {
+        public void invokeGet(final CheckedFuture<?,?> future) throws Exception {
             future.checkedGet();
         }
 
         @Override
-        public Throwable extractWrappedTestEx( final Exception from ) {
+        public Throwable extractWrappedTestEx(final Exception from) {
             return from;
         }
     };
 
     static final FutureInvoker TIMED_CHECKED_GET = new FutureInvoker() {
         @Override
-        public void invokeGet( final CheckedFuture<?,?> future ) throws Exception {
-            future.checkedGet( 50, TimeUnit.MILLISECONDS );
+        public void invokeGet(final CheckedFuture<?,?> future) throws Exception {
+            future.checkedGet(50, TimeUnit.MILLISECONDS);
         }
 
         @Override
-        public Throwable extractWrappedTestEx( final Exception from ) {
+        public Throwable extractWrappedTestEx(final Exception from) {
             return from;
         }
     };
 
     @Test
     public void testGet() throws Exception {
-
         SettableFuture<String> delegate = SettableFuture.create();
-        MappingCheckedFuture<String,TestException> future = MappingCheckedFuture.create( delegate, MAPPER );
-        delegate.set( "test" );
-        assertEquals( "get", "test", future.get() );
+        MappingCheckedFuture<String,TestException> future = MappingCheckedFuture.create(delegate, MAPPER);
+        delegate.set("test");
+        assertEquals("get", "test", future.get());
     }
 
     @Test
     public void testGetWithExceptions() throws Exception {
-
-        testExecutionException( GET, new RuntimeException() );
-        testExecutionException( GET, new TestException( "mock", null ) );
-        testCancellationException( GET );
-        testInterruptedException( GET );
+        testExecutionException(GET, new RuntimeException());
+        testExecutionException(GET, new TestException("mock", null));
+        testCancellationException(GET);
+        testInterruptedException(GET);
     }
 
     @Test
     public void testTimedGet() throws Exception {
-
         SettableFuture<String> delegate = SettableFuture.create();
-        MappingCheckedFuture<String,TestException> future = MappingCheckedFuture.create( delegate, MAPPER );
-        delegate.set( "test" );
-        assertEquals( "get", "test", future.get( 50, TimeUnit.MILLISECONDS ) );
+        MappingCheckedFuture<String,TestException> future = MappingCheckedFuture.create(delegate, MAPPER);
+        delegate.set("test");
+        assertEquals("get", "test", future.get(50, TimeUnit.MILLISECONDS));
     }
 
     @Test
     public void testTimedGetWithExceptions() throws Exception {
-
-        testExecutionException( TIMED_GET, new RuntimeException() );
-        testCancellationException( TIMED_GET );
-        testInterruptedException( TIMED_GET );
+        testExecutionException(TIMED_GET, new RuntimeException());
+        testCancellationException(TIMED_GET);
+        testInterruptedException(TIMED_GET);
     }
 
     @Test
     public void testCheckedGetWithExceptions() throws Exception {
-
-        testExecutionException( CHECKED_GET, new RuntimeException() );
-        testCancellationException( CHECKED_GET );
-        testInterruptedException( CHECKED_GET );
+        testExecutionException(CHECKED_GET, new RuntimeException());
+        testCancellationException(CHECKED_GET);
+        testInterruptedException(CHECKED_GET);
     }
 
     @Test
     public void testTimedCheckedWithExceptions() throws Exception {
-
-        testExecutionException( TIMED_CHECKED_GET, new RuntimeException() );
-        testCancellationException( TIMED_CHECKED_GET );
-        testInterruptedException( TIMED_CHECKED_GET );
+        testExecutionException(TIMED_CHECKED_GET, new RuntimeException());
+        testCancellationException(TIMED_CHECKED_GET);
+        testInterruptedException(TIMED_CHECKED_GET);
     }
 
-    private static void testExecutionException( final FutureInvoker invoker, final Throwable cause ) {
-
+    @SuppressWarnings("checkstyle:illegalCatch")
+    private static void testExecutionException(final FutureInvoker invoker, final Throwable cause) {
         SettableFuture<String> delegate = SettableFuture.create();
-        MappingCheckedFuture<String,TestException> mappingFuture =
-                                                        MappingCheckedFuture.create( delegate, MAPPER );
+        MappingCheckedFuture<String, TestException> mappingFuture = MappingCheckedFuture.create(delegate, MAPPER);
 
-        delegate.setException( cause );
+        delegate.setException(cause);
 
         try {
-            invoker.invokeGet( mappingFuture );
-            fail( "Expected exception thrown" );
-        } catch( Exception e ) {
-            Throwable expectedTestEx = invoker.extractWrappedTestEx( e );
-            assertNotNull( "Expected returned exception is null", expectedTestEx );
-            assertEquals( "Exception type", TestException.class, expectedTestEx.getClass() );
-
-            if (cause instanceof TestException ) {
-                assertNull( "Expected null cause", expectedTestEx.getCause() );
+            invoker.invokeGet(mappingFuture);
+            fail("Expected exception thrown");
+        } catch (Exception e) {
+            Throwable expectedTestEx = invoker.extractWrappedTestEx(e);
+            assertNotNull("Expected returned exception is null", expectedTestEx);
+            assertEquals("Exception type", TestException.class, expectedTestEx.getClass());
+
+            if (cause instanceof TestException) {
+                assertNull("Expected null cause", expectedTestEx.getCause());
             } else {
-                assertSame( "TestException cause", cause, expectedTestEx.getCause() );
+                assertSame("TestException cause", cause, expectedTestEx.getCause());
             }
         }
     }
 
-    private static void testCancellationException( final FutureInvoker invoker ) {
-
+    @SuppressWarnings("checkstyle:illegalCatch")
+    private static void testCancellationException(final FutureInvoker invoker) {
         SettableFuture<String> delegate = SettableFuture.create();
-        MappingCheckedFuture<String,TestException> mappingFuture =
-                                                        MappingCheckedFuture.create( delegate, MAPPER );
+        MappingCheckedFuture<String, TestException> mappingFuture = MappingCheckedFuture.create(delegate, MAPPER);
 
-        mappingFuture.cancel( false );
+        mappingFuture.cancel(false);
 
         try {
-            invoker.invokeGet( mappingFuture );
-            fail( "Expected exception thrown" );
-        } catch( Exception e ) {
-            Throwable expectedTestEx = invoker.extractWrappedTestEx( e );
-            assertNotNull( "Expected returned exception is null", expectedTestEx );
-            assertEquals( "Exception type", TestException.class, expectedTestEx.getClass() );
-            assertEquals( "TestException cause type", CancellationException.class,
-                          expectedTestEx.getCause().getClass() );
+            invoker.invokeGet(mappingFuture);
+            fail("Expected exception thrown");
+        } catch (Exception e) {
+            Throwable expectedTestEx = invoker.extractWrappedTestEx(e);
+            assertNotNull("Expected returned exception is null", expectedTestEx);
+            assertEquals("Exception type", TestException.class, expectedTestEx.getClass());
+            assertEquals("TestException cause type", CancellationException.class, expectedTestEx.getCause().getClass());
         }
     }
 
-    private static void testInterruptedException( final FutureInvoker invoker ) throws Exception {
-
+    @SuppressWarnings("checkstyle:illegalCatch")
+    private static void testInterruptedException(final FutureInvoker invoker) throws Exception {
         SettableFuture<String> delegate = SettableFuture.create();
-        final MappingCheckedFuture<String,TestException> mappingFuture =
-                                                        MappingCheckedFuture.create( delegate, MAPPER );
+        final MappingCheckedFuture<String, TestException> mappingFuture = MappingCheckedFuture.create(delegate, MAPPER);
 
         final AtomicReference<AssertionError> assertError = new AtomicReference<>();
-        final CountDownLatch doneLatch = new CountDownLatch( 1 );
+        final CountDownLatch doneLatch = new CountDownLatch(1);
         Thread thread = new Thread() {
-
             @Override
             public void run() {
                 try {
                     doInvoke();
-                } catch( AssertionError e ) {
-                    assertError.set( e );
+                } catch (AssertionError e) {
+                    assertError.set(e);
                 } finally {
                     doneLatch.countDown();
                 }
@@ -226,23 +217,23 @@ public class MappingCheckedFutureTest {
 
             void doInvoke() {
                 try {
-                    invoker.invokeGet( mappingFuture );
-                    fail( "Expected exception thrown" );
-                } catch( Exception e ) {
-                    Throwable expectedTestEx = invoker.extractWrappedTestEx( e );
-                    assertNotNull( "Expected returned exception is null", expectedTestEx );
-                    assertEquals( "Exception type", TestException.class, expectedTestEx.getClass() );
-                    assertEquals( "TestException cause type", InterruptedException.class,
-                                  expectedTestEx.getCause().getClass() );
+                    invoker.invokeGet(mappingFuture);
+                    fail("Expected exception thrown");
+                } catch (Exception e) {
+                    Throwable expectedTestEx = invoker.extractWrappedTestEx(e);
+                    assertNotNull("Expected returned exception is null", expectedTestEx);
+                    assertEquals("Exception type", TestException.class, expectedTestEx.getClass());
+                    assertEquals("TestException cause type", InterruptedException.class,
+                                  expectedTestEx.getCause().getClass());
                 }
             }
         };
         thread.start();
 
         thread.interrupt();
-        assertEquals( "get call completed", true, doneLatch.await( 5, TimeUnit.SECONDS ) );
+        assertTrue("get call completed", doneLatch.await(5, TimeUnit.SECONDS));
 
-        if (assertError.get() != null ) {
+        if (assertError.get() != null) {
             throw assertError.get();
         }
     }
index 69fa995125bb64b9f323a6548499dbe768be076e..8d6c9d473fad50d862011be480cfaec7f768bd41 100644 (file)
@@ -9,16 +9,15 @@
 package org.opendaylight.yangtools.util.concurrent;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.mock;
 
 import com.google.common.base.Stopwatch;
 import com.google.common.util.concurrent.Uninterruptibles;
-import java.io.PrintStream;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
@@ -29,6 +28,7 @@ import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import org.junit.After;
 import org.junit.Test;
+import org.opendaylight.yangtools.util.concurrent.QueuedNotificationManager.BatchedInvoker;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -62,15 +62,15 @@ public class QueuedNotificationManagerTest {
             actual.clear();
         }
 
-        void onNotification(final N data) {
+        void onNotification(final Collection<? extends N> data) {
 
             try {
                 if (sleepTime > 0) {
-                    Uninterruptibles.sleepUninterruptibly( sleepTime, TimeUnit.MILLISECONDS);
+                    Uninterruptibles.sleepUninterruptibly(sleepTime, TimeUnit.MILLISECONDS);
                 }
 
                 if (cacheNotifications) {
-                    actual.add(data);
+                    actual.addAll(data);
                 }
 
                 RuntimeException localRuntimeEx = runtimeEx;
@@ -86,12 +86,12 @@ public class QueuedNotificationManagerTest {
                 }
 
             } finally {
-                latch.countDown();
+                data.forEach(action -> latch.countDown());
             }
         }
 
         void verifyNotifications() {
-            boolean done = Uninterruptibles.awaitUninterruptibly(latch, 10, TimeUnit.SECONDS);
+            boolean done = Uninterruptibles.awaitUninterruptibly(latch, 5, TimeUnit.SECONDS);
             if (!done) {
                 long actualCount = latch.getCount();
                 fail(name + ": Received " + (expCount - actualCount) + " notifications. Expected " + expCount);
@@ -129,10 +129,10 @@ public class QueuedNotificationManagerTest {
         }
     }
 
-    static class TestNotifier<N> implements QueuedNotificationManager.Invoker<TestListener<N>, N> {
+    static class TestNotifier<N> implements BatchedInvoker<TestListener<N>, N> {
         @Override
-        public void invokeListener(final TestListener<N> listener, final N notification) {
-            listener.onNotification(notification);
+        public void invokeListener(final TestListener<N> listener, final Collection<? extends N> notifications) {
+            listener.onNotification(notifications);
         }
     }
 
@@ -146,17 +146,16 @@ public class QueuedNotificationManagerTest {
         }
     }
 
-    @Test(timeout=10000)
+    @Test(timeout = 10000)
     public void testNotificationsWithSingleListener() {
 
-        queueExecutor = Executors.newFixedThreadPool( 2 );
-        NotificationManager<TestListener<Integer>, Integer> manager = new QueuedNotificationManager<>(queueExecutor,
-                new TestNotifier<>(), 10, "TestMgr" );
+        queueExecutor = Executors.newFixedThreadPool(2);
+        NotificationManager<TestListener<Integer>, Integer> manager = QueuedNotificationManager.create(queueExecutor,
+                new TestNotifier<>(), 10, "TestMgr");
 
-        int initialCount = 6;
-        int nNotifications = 100;
+        int count = 100;
 
-        TestListener<Integer> listener = new TestListener<>(nNotifications, 1);
+        TestListener<Integer> listener = new TestListener<>(count, 1);
         listener.sleepTime = 20;
 
         manager.submitNotifications(listener, Arrays.asList(1, 2));
@@ -172,29 +171,30 @@ public class QueuedNotificationManagerTest {
 
         listener.sleepTime = 0;
 
-        List<Integer> expNotifications = new ArrayList<>(nNotifications);
+        List<Integer> expNotifications = new ArrayList<>(count);
         expNotifications.addAll(Arrays.asList(1, 2, 3, 4, 5, 6));
-        for (int i = 1; i <= nNotifications - initialCount; i++) {
-            Integer v = Integer.valueOf(initialCount + i);
-            expNotifications.add(v);
-            manager.submitNotification(listener, v);
+        int initialCount = 6;
+        for (int i = 1; i <= count - initialCount; i++) {
+            Integer val = Integer.valueOf(initialCount + i);
+            expNotifications.add(val);
+            manager.submitNotification(listener, val);
         }
 
-        listener.verifyNotifications( expNotifications );
+        listener.verifyNotifications(expNotifications);
     }
 
     @Test
     public void testNotificationsWithMultipleListeners() throws InterruptedException {
 
-        int nListeners = 10;
-        queueExecutor = Executors.newFixedThreadPool(nListeners);
-        final ExecutorService stagingExecutor = Executors.newFixedThreadPool(nListeners);
-        final NotificationManager<TestListener<Integer>, Integer> manager = new QueuedNotificationManager<>(
-                queueExecutor, new TestNotifier<>(), 5000, "TestMgr" );
+        int count = 10;
+        queueExecutor = Executors.newFixedThreadPool(count);
+        final ExecutorService stagingExecutor = Executors.newFixedThreadPool(count);
+        final NotificationManager<TestListener<Integer>, Integer> manager = QueuedNotificationManager.create(
+                queueExecutor, new TestNotifier<>(), 5000, "TestMgr");
 
         final int nNotifications = 100000;
 
-        LOG.info("Testing {} listeners with {} notifications each...",  nListeners, nNotifications);
+        LOG.info("Testing {} listeners with {} notifications each...", count, nNotifications);
 
         final Integer[] notifications = new Integer[nNotifications];
         for (int i = 1; i <= nNotifications; i++) {
@@ -205,7 +205,7 @@ public class QueuedNotificationManagerTest {
 
         List<TestListener<Integer>> listeners = new ArrayList<>();
         List<Thread> threads = new ArrayList<>();
-        for (int i = 1; i <= nListeners; i++) {
+        for (int i = 1; i <= count; i++) {
             final TestListener<Integer> listener =
                     i == 2 ? new TestListener2<>(nNotifications, i) :
                     i == 3 ? new TestListener3<>(nNotifications, i) :
@@ -243,44 +243,44 @@ public class QueuedNotificationManagerTest {
         }
     }
 
-    @Test(timeout=10000)
+    @Test(timeout = 10000)
     public void testNotificationsWithListenerRuntimeEx() {
 
         queueExecutor = Executors.newFixedThreadPool(1);
-        NotificationManager<TestListener<Integer>, Integer> manager =
-                new QueuedNotificationManager<>( queueExecutor, new TestNotifier<>(),
-                10, "TestMgr" );
-
+        NotificationManager<TestListener<Integer>, Integer> manager = QueuedNotificationManager.create(queueExecutor,
+            new TestNotifier<>(), 10, "TestMgr");
 
         TestListener<Integer> listener = new TestListener<>(2, 1);
-        final RuntimeException mockedRuntimeException = mock(RuntimeException.class);
-        doNothing().when(mockedRuntimeException).printStackTrace(any(PrintStream.class));
+        final RuntimeException mockedRuntimeException = new RuntimeException("mock");
         listener.runtimeEx = mockedRuntimeException;
 
         manager.submitNotification(listener, 1);
         manager.submitNotification(listener, 2);
 
         listener.verifyNotifications();
+        List<Runnable> tasks = queueExecutor.shutdownNow();
+        assertTrue(tasks.isEmpty());
     }
 
-    @Test(timeout=10000)
+    @Test(timeout = 10000)
     public void testNotificationsWithListenerJVMError() {
 
         final CountDownLatch errorCaughtLatch = new CountDownLatch(1);
         queueExecutor = new ThreadPoolExecutor(1, 1, 0, TimeUnit.SECONDS, new LinkedBlockingQueue<>()) {
-             @Override
-             public void execute(final Runnable command) {
-                 super.execute(() -> {
-                     try {
-                         command.run();
-                     } catch (Error e) {
-                         errorCaughtLatch.countDown();
-                     }
-                 });
-             }
+            @Override
+            @SuppressWarnings("checkstyle:illegalCatch")
+            public void execute(final Runnable command) {
+                super.execute(() -> {
+                    try {
+                        command.run();
+                    } catch (Error e) {
+                        errorCaughtLatch.countDown();
+                    }
+                });
+            }
         };
 
-        NotificationManager<TestListener<Integer>, Integer> manager = new QueuedNotificationManager<>(queueExecutor,
+        NotificationManager<TestListener<Integer>, Integer> manager = QueuedNotificationManager.create(queueExecutor,
                 new TestNotifier<>(), 10, "TestMgr");
 
         TestListener<Integer> listener = new TestListener<>(2, 1);
@@ -288,11 +288,12 @@ public class QueuedNotificationManagerTest {
 
         manager.submitNotification(listener, 1);
 
-        assertEquals("JVM Error caught", true, Uninterruptibles.awaitUninterruptibly(
-                                                       errorCaughtLatch, 5, TimeUnit.SECONDS));
+        assertTrue("JVM Error caught", Uninterruptibles.awaitUninterruptibly(errorCaughtLatch, 5, TimeUnit.SECONDS));
 
         manager.submitNotification(listener, 2);
 
         listener.verifyNotifications();
+        List<Runnable> tasks = queueExecutor.shutdownNow();
+        assertTrue(tasks.isEmpty());
     }
 }
index c10215d1b7ed9a05782c0b14eb3754ba55d55f9c..7d5a9f06f7f16563dee45e9b59adf451fafa8127 100644 (file)
@@ -12,11 +12,11 @@ import static org.junit.Assert.assertEquals;
 import java.util.concurrent.ExecutionException;
 import org.junit.Test;
 
-public final class ReflectiveExceptionMapperTest {
+public class ReflectiveExceptionMapperTest {
     static final class NoArgumentCtorException extends Exception {
         private static final long serialVersionUID = 1L;
 
-        public NoArgumentCtorException() {
+        NoArgumentCtorException() {
             super();
         }
     }
@@ -32,12 +32,12 @@ public final class ReflectiveExceptionMapperTest {
     static final class FailingCtorException extends Exception {
         private static final long serialVersionUID = 1L;
 
-        public FailingCtorException(final String message, final Throwable cause) {
+        FailingCtorException(final String message, final Throwable cause) {
             throw new IllegalArgumentException("just for test");
         }
     }
 
-    static final class GoodException extends Exception {
+    public static final class GoodException extends Exception {
         private static final long serialVersionUID = 1L;
 
         public GoodException(final String message, final Throwable cause) {
@@ -46,24 +46,25 @@ public final class ReflectiveExceptionMapperTest {
     }
 
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testNoArgumentsContructor() {
         ReflectiveExceptionMapper.create("no arguments", NoArgumentCtorException.class);
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testPrivateContructor() {
         ReflectiveExceptionMapper.create("private constructor", PrivateCtorException.class);
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testFailingContructor() {
         ReflectiveExceptionMapper.create("failing constructor", FailingCtorException.class);
     }
 
     @Test
     public void testInstantiation() {
-        ReflectiveExceptionMapper<GoodException> mapper = ReflectiveExceptionMapper.create("instantiation", GoodException.class);
+        ReflectiveExceptionMapper<GoodException> mapper = ReflectiveExceptionMapper.create("instantiation",
+            GoodException.class);
 
         final Throwable cause = new Throwable("some test message");
 
index 44f90f9884d927df4a20fb939a4ecb4e000334c1..05c4abd0f0c0862ed4c27f04e398f2cf9edc8dc6 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.yangtools.util.concurrent;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import com.google.common.base.Stopwatch;
@@ -22,6 +22,8 @@ import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReference;
 import org.junit.After;
 import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Tests various ThreadPoolExecutor implementations.
@@ -29,6 +31,7 @@ import org.junit.Test;
  * @author Thomas Pantelis
  */
 public class ThreadPoolExecutorTest {
+    private static final Logger LOG = LoggerFactory.getLogger(ThreadPoolExecutorTest.class);
 
     private ExecutorService executor;
 
@@ -40,68 +43,54 @@ public class ThreadPoolExecutorTest {
     }
 
     @Test
-    public void testFastThreadPoolExecution() throws Exception {
-
-        testThreadPoolExecution(
-                SpecialExecutors.newBoundedFastThreadPool( 50, 100000, "TestPool" ),
-                100000, "TestPool", 0 );
+    public void testFastThreadPoolExecution() throws InterruptedException {
+        testThreadPoolExecution(SpecialExecutors.newBoundedFastThreadPool(50, 100000, "TestPool"), 100000, "TestPool",
+            0);
     }
 
     @Test(expected = RejectedExecutionException.class)
-    public void testFastThreadPoolRejectingTask() throws Exception {
-
-        executor = SpecialExecutors.newBoundedFastThreadPool( 1, 1, "TestPool" );
+    public void testFastThreadPoolRejectingTask() throws InterruptedException {
+        executor = SpecialExecutors.newBoundedFastThreadPool(1, 1, "TestPool");
 
         for (int i = 0; i < 5; i++) {
-            executor.execute( new Task( null, null, null, null,
-                    TimeUnit.MICROSECONDS.convert( 5, TimeUnit.SECONDS ) ) );
+            executor.execute(new Task(null, null, null, null, TimeUnit.MICROSECONDS.convert(5, TimeUnit.SECONDS)));
         }
     }
 
     @Test
-    public void testBlockingFastThreadPoolExecution() throws Exception {
-
+    public void testBlockingFastThreadPoolExecution() throws InterruptedException {
         // With a queue capacity of 1, it should block at some point.
-        testThreadPoolExecution(
-                SpecialExecutors.newBlockingBoundedFastThreadPool( 2, 1, "TestPool" ),
-                1000, null, 10 );
+        testThreadPoolExecution(SpecialExecutors.newBlockingBoundedFastThreadPool(2, 1, "TestPool"), 1000, null, 10);
     }
 
     @Test
-    public void testCachedThreadPoolExecution() throws Exception {
-
-        testThreadPoolExecution(
-                SpecialExecutors.newBoundedCachedThreadPool( 10, 100000, "TestPool" ),
-                100000, "TestPool", 0 );
+    public void testCachedThreadPoolExecution() throws InterruptedException {
+        testThreadPoolExecution(SpecialExecutors.newBoundedCachedThreadPool(10, 100000, "TestPool"),
+                100000, "TestPool", 0);
     }
 
     @Test(expected = RejectedExecutionException.class)
-    public void testCachedThreadRejectingTask() throws Exception {
-
-        ExecutorService executor = SpecialExecutors.newBoundedCachedThreadPool( 1, 1, "TestPool" );
+    public void testCachedThreadRejectingTask() throws InterruptedException {
+        ExecutorService executor = SpecialExecutors.newBoundedCachedThreadPool(1, 1, "TestPool");
 
         for (int i = 0; i < 5; i++) {
-            executor.execute( new Task( null, null, null, null,
-                    TimeUnit.MICROSECONDS.convert( 5, TimeUnit.SECONDS ) ) );
+            executor.execute(new Task(null, null, null, null, TimeUnit.MICROSECONDS.convert(5, TimeUnit.SECONDS)));
         }
     }
 
     @Test
-    public void testBlockingCachedThreadPoolExecution() throws Exception {
-
-        testThreadPoolExecution(
-                SpecialExecutors.newBlockingBoundedCachedThreadPool( 2, 1, "TestPool" ),
-                1000, null, 10 );
+    public void testBlockingCachedThreadPoolExecution() throws InterruptedException {
+        testThreadPoolExecution(SpecialExecutors.newBlockingBoundedCachedThreadPool(2, 1, "TestPool"), 1000, null, 10);
     }
 
-    void testThreadPoolExecution( final ExecutorService executor,
-            final int numTasksToRun, final String expThreadPrefix, final long taskDelay ) throws Exception {
+    void testThreadPoolExecution(final ExecutorService executor, final int numTasksToRun, final String expThreadPrefix,
+            final long taskDelay) throws InterruptedException {
 
         this.executor = executor;
 
-        System.out.println("\nTesting " + executor.getClass().getSimpleName() + " with " + numTasksToRun + " tasks.");
+        LOG.debug("Testing {} with {} tasks.", executor.getClass().getSimpleName(), numTasksToRun);
 
-        final CountDownLatch tasksRunLatch = new CountDownLatch( numTasksToRun );
+        final CountDownLatch tasksRunLatch = new CountDownLatch(numTasksToRun);
         final ConcurrentMap<Thread, AtomicLong> taskCountPerThread = new ConcurrentHashMap<>();
         final AtomicReference<AssertionError> threadError = new AtomicReference<>();
 
@@ -112,35 +101,34 @@ public class ThreadPoolExecutorTest {
             public void run() {
                 for (int i = 0; i < numTasksToRun; i++) {
 //                    if (i%100 == 0) {
-//                        Uninterruptibles.sleepUninterruptibly( 20, TimeUnit.MICROSECONDS );
+//                        Uninterruptibles.sleepUninterruptibly(20, TimeUnit.MICROSECONDS);
 //                    }
 
-                    executor.execute( new Task( tasksRunLatch, taskCountPerThread,
-                                                threadError, expThreadPrefix, taskDelay ) );
+                    executor.execute(new Task(tasksRunLatch, taskCountPerThread, threadError, expThreadPrefix,
+                        taskDelay));
                 }
             }
         }.start();
 
-        boolean done = tasksRunLatch.await( 15, TimeUnit.SECONDS );
+        boolean done = tasksRunLatch.await(15, TimeUnit.SECONDS);
 
         stopWatch.stop();
 
         if (!done) {
-            fail((numTasksToRun - tasksRunLatch.getCount()) + " tasks out of " + numTasksToRun + " executed");
+            fail(numTasksToRun - tasksRunLatch.getCount() + " tasks out of " + numTasksToRun + " executed");
         }
 
         if (threadError.get() != null) {
             throw threadError.get();
         }
 
-        System.out.println( taskCountPerThread.size() + " threads used:" );
+        LOG.debug("{} threads used:", taskCountPerThread.size());
         for (Map.Entry<Thread, AtomicLong> e : taskCountPerThread.entrySet()) {
-            System.out.println( "  " + e.getKey().getName() + " - " + e.getValue() + " tasks" );
+            LOG.debug("  {} - {} tasks", e.getKey().getName(), e.getValue());
         }
 
-        System.out.println( "\n" + executor );
-        System.out.println( "\nElapsed time: " + stopWatch );
-        System.out.println();
+        LOG.debug("{}", executor);
+        LOG.debug("Elapsed time: {}", stopWatch);
     }
 
     static class Task implements Runnable {
@@ -151,8 +139,8 @@ public class ThreadPoolExecutorTest {
         final String expThreadPrefix;
         final long delay;
 
-        Task( CountDownLatch tasksRunLatch, ConcurrentMap<Thread, AtomicLong> taskCountPerThread,
-                AtomicReference<AssertionError> threadError, String expThreadPrefix, long delay ) {
+        Task(final CountDownLatch tasksRunLatch, final ConcurrentMap<Thread, AtomicLong> taskCountPerThread,
+                final AtomicReference<AssertionError> threadError, final String expThreadPrefix, final long delay) {
             this.tasksRunLatch = tasksRunLatch;
             this.taskCountPerThread = taskCountPerThread;
             this.threadError = threadError;
@@ -161,7 +149,7 @@ public class ThreadPoolExecutorTest {
             blockLatch = null;
         }
 
-        Task( CountDownLatch tasksRunLatch, CountDownLatch blockLatch ) {
+        Task(final CountDownLatch tasksRunLatch, final CountDownLatch blockLatch) {
             this.tasksRunLatch = tasksRunLatch;
             this.blockLatch = blockLatch;
             this.taskCountPerThread = null;
@@ -175,23 +163,24 @@ public class ThreadPoolExecutorTest {
             try {
                 try {
                     if (delay > 0) {
-                        TimeUnit.MICROSECONDS.sleep( delay );
+                        TimeUnit.MICROSECONDS.sleep(delay);
                     } else if (blockLatch != null) {
                         blockLatch.await();
                     }
                 } catch (InterruptedException e) {
+                    // Ignored
                 }
 
                 if (expThreadPrefix != null) {
-                    assertEquals( "Thread name starts with " + expThreadPrefix, true,
-                            Thread.currentThread().getName().startsWith( expThreadPrefix ) );
+                    assertTrue("Thread name starts with " + expThreadPrefix,
+                            Thread.currentThread().getName().startsWith(expThreadPrefix));
                 }
 
                 if (taskCountPerThread != null) {
-                    AtomicLong count = taskCountPerThread.get( Thread.currentThread() );
+                    AtomicLong count = taskCountPerThread.get(Thread.currentThread());
                     if (count == null) {
-                        count = new AtomicLong( 0 );
-                        AtomicLong prev = taskCountPerThread.putIfAbsent( Thread.currentThread(), count );
+                        count = new AtomicLong(0);
+                        AtomicLong prev = taskCountPerThread.putIfAbsent(Thread.currentThread(), count);
                         if (prev != null) {
                             count = prev;
                         }
@@ -202,7 +191,7 @@ public class ThreadPoolExecutorTest {
 
             } catch (AssertionError e) {
                 if (threadError != null) {
-                    threadError.set( e );
+                    threadError.set(e);
                 }
             } finally {
                 if (tasksRunLatch != null) {
index 6b685bc8421442d078409a35ad032d8f99ec7300..17c66d7a247bf99d2a1685959998f835996ac2b1 100644 (file)
@@ -9,6 +9,8 @@
 package org.opendaylight.yangtools.util.concurrent;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.util.Arrays;
@@ -24,79 +26,75 @@ public class TrackingLinkedBlockingQueueTest {
 
     @Test
     public void testOffer() throws InterruptedException {
+        TrackingLinkedBlockingQueue<String> queue = new TrackingLinkedBlockingQueue<>(2);
 
-        TrackingLinkedBlockingQueue<String> queue = new TrackingLinkedBlockingQueue<>( 2 );
+        assertTrue("offer", queue.offer("1"));
+        assertEquals("getLargestQueueSize", 1, queue.getLargestQueueSize());
+        assertEquals("size", 1, queue.size());
 
-        assertEquals( "offer", true, queue.offer( "1" ) );
-        assertEquals( "getLargestQueueSize", 1, queue.getLargestQueueSize() );
-        assertEquals( "size", 1, queue.size() );
+        assertTrue("offer", queue.offer("2", 1, TimeUnit.MILLISECONDS));
+        assertEquals("getLargestQueueSize", 2, queue.getLargestQueueSize());
+        assertEquals("size", 2, queue.size());
 
-        assertEquals( "offer", true, queue.offer( "2", 1, TimeUnit.MILLISECONDS ) );
-        assertEquals( "getLargestQueueSize", 2, queue.getLargestQueueSize() );
-        assertEquals( "size", 2, queue.size() );
+        assertFalse("offer", queue.offer("3"));
+        assertEquals("getLargestQueueSize", 2, queue.getLargestQueueSize());
+        assertEquals("size", 2, queue.size());
 
-        assertEquals( "offer", false, queue.offer( "3" ) );
-        assertEquals( "getLargestQueueSize", 2, queue.getLargestQueueSize() );
-        assertEquals( "size", 2, queue.size() );
-
-        assertEquals( "offer", false, queue.offer( "4", 1, TimeUnit.MILLISECONDS ) );
-        assertEquals( "getLargestQueueSize", 2, queue.getLargestQueueSize() );
-        assertEquals( "size", 2, queue.size() );
+        assertFalse("offer", queue.offer("4", 1, TimeUnit.MILLISECONDS));
+        assertEquals("getLargestQueueSize", 2, queue.getLargestQueueSize());
+        assertEquals("size", 2, queue.size());
     }
 
     @Test
     public void testPut() throws InterruptedException {
-
         TrackingLinkedBlockingQueue<String> queue = new TrackingLinkedBlockingQueue<>();
 
-        queue.put( "1" );
-        assertEquals( "getLargestQueueSize", 1, queue.getLargestQueueSize() );
-        assertEquals( "size", 1, queue.size() );
+        queue.put("1");
+        assertEquals("getLargestQueueSize", 1, queue.getLargestQueueSize());
+        assertEquals("size", 1, queue.size());
 
-        queue.put( "2" );
-        assertEquals( "getLargestQueueSize", 2, queue.getLargestQueueSize() );
-        assertEquals( "size", 2, queue.size() );
+        queue.put("2");
+        assertEquals("getLargestQueueSize", 2, queue.getLargestQueueSize());
+        assertEquals("size", 2, queue.size());
     }
 
     @Test
     public void testAdd() {
+        TrackingLinkedBlockingQueue<String> queue = new TrackingLinkedBlockingQueue<>(2);
 
-        TrackingLinkedBlockingQueue<String> queue = new TrackingLinkedBlockingQueue<>( 2 );
+        assertTrue("add", queue.add("1"));
+        assertEquals("getLargestQueueSize", 1, queue.getLargestQueueSize());
+        assertEquals("size", 1, queue.size());
 
-        assertEquals( "add", true, queue.add( "1" ) );
-        assertEquals( "getLargestQueueSize", 1, queue.getLargestQueueSize() );
-        assertEquals( "size", 1, queue.size() );
-
-        assertEquals( "add", true, queue.add( "2" ) );
-        assertEquals( "getLargestQueueSize", 2, queue.getLargestQueueSize() );
-        assertEquals( "size", 2, queue.size() );
+        assertTrue("add", queue.add("2"));
+        assertEquals("getLargestQueueSize", 2, queue.getLargestQueueSize());
+        assertEquals("size", 2, queue.size());
 
         try {
-            queue.add( "3" );
-            fail( "Expected IllegalStateException" );
-        } catch( IllegalStateException e ) {
+            queue.add("3");
+            fail("Expected IllegalStateException");
+        } catch (IllegalStateException e) {
             // Expected
-            assertEquals( "getLargestQueueSize", 2, queue.getLargestQueueSize() );
-            assertEquals( "size", 2, queue.size() );
+            assertEquals("getLargestQueueSize", 2, queue.getLargestQueueSize());
+            assertEquals("size", 2, queue.size());
         }
     }
 
     @Test
     public void testAddAll() {
+        TrackingLinkedBlockingQueue<String> queue = new TrackingLinkedBlockingQueue<>(3);
 
-        TrackingLinkedBlockingQueue<String> queue = new TrackingLinkedBlockingQueue<>( 3 );
-
-        queue.addAll( Arrays.asList( "1", "2" ) );
-        assertEquals( "getLargestQueueSize", 2, queue.getLargestQueueSize() );
-        assertEquals( "size", 2, queue.size() );
+        queue.addAll(Arrays.asList("1", "2"));
+        assertEquals("getLargestQueueSize", 2, queue.getLargestQueueSize());
+        assertEquals("size", 2, queue.size());
 
         try {
-            queue.addAll( Arrays.asList( "3", "4" ) );
-            fail( "Expected IllegalStateException" );
-        } catch( IllegalStateException e ) {
+            queue.addAll(Arrays.asList("3", "4"));
+            fail("Expected IllegalStateException");
+        } catch (IllegalStateException e) {
             // Expected
-            assertEquals( "getLargestQueueSize", 3, queue.getLargestQueueSize() );
-            assertEquals( "size", 3, queue.size() );
+            assertEquals("getLargestQueueSize", 3, queue.getLargestQueueSize());
+            assertEquals("size", 3, queue.size());
         }
     }
 }
index bfbb2c6d9fa72fcaa3090ddc0169e256cb3546dc..80d7e469e57a5c5a9fa27801bf872414ed5d8275 100644 (file)
         </dependency>
     </dependencies>
 
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-checkstyle-plugin</artifactId>
+                               <configuration>
+                                       <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+
   <!--
       Maven Site Configuration
 
index e47f31529771bbbc4bdb9e271af80c21d37a8eef..cbfee5bc8bc21ede423a0f7303924f4ac1b3e35a 100644 (file)
@@ -50,7 +50,7 @@ public class OperationFailedException extends Exception {
         super(Preconditions.checkNotNull(message), cause);
 
         if (errors != null && errors.length > 0) {
-            errorList = ImmutableList.copyOf( Arrays.asList( errors ) );
+            errorList = ImmutableList.copyOf(Arrays.asList(errors));
         } else {
             // Add a default RpcError.
             errorList = ImmutableList.of(RpcResultBuilder.newError(ErrorType.APPLICATION, null,
@@ -69,7 +69,7 @@ public class OperationFailedException extends Exception {
 
     @Override
     public String toString() {
-        return MoreObjects.toStringHelper( this ).add( "message", getMessage() )
-                .add( "errorList", errorList ).toString();
+        return MoreObjects.toStringHelper(this).add("message", getMessage())
+                .add("errorList", errorList).toString();
     }
 }
index 771c008f47502bdf9a233ea2c65c83014632ee5f..29abd7880c4c85977e43e18e4f083d711bf7174a 100644 (file)
@@ -29,6 +29,7 @@ import org.opendaylight.yangtools.concepts.Immutable;
  * The QName from XML consists of local name of element and XML namespace, but
  * for our use, we added module revision to it.
  *
+ * <p>
  * In YANG context QName is full name of defined node, type, procedure or
  * notification. QName consists of XML namespace, YANG model revision and local
  * name of defined type. It is used to prevent name clashes between nodes with
@@ -43,11 +44,10 @@ import org.opendaylight.yangtools.concepts.Immutable;
  * node in the YANG module</li>
  * </ul>
  *
+ * <p>
  * QName may also have <code>prefix</code> assigned, but prefix does not
  * affect equality and identity of two QNames and carry only information
  * which may be useful for serializers / deserializers.
- *
- *
  */
 public final class QName implements Immutable, Serializable, Comparable<QName> {
     private static final Interner<QName> INTERNER = Interners.newWeakInterner();
@@ -97,7 +97,8 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
 
     private static String checkLocalName(final String localName) {
         Preconditions.checkArgument(localName != null, "Parameter 'localName' may not be null.");
-               Preconditions.checkArgument(!Strings.isNullOrEmpty(localName), "Parameter 'localName' must be a non-empty string.");
+        Preconditions.checkArgument(!Strings.isNullOrEmpty(localName),
+                "Parameter 'localName' must be a non-empty string.");
 
         for (final char c : ILLEGAL_CHARACTERS) {
             if (localName.indexOf(c) != -1) {
@@ -130,6 +131,95 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
         throw new IllegalArgumentException("Invalid input:" + input);
     }
 
+    public static QName create(final QName base, final String localName) {
+        return create(base.getModule(), localName);
+    }
+
+    /**
+     * Creates new QName.
+     *
+     * @param qnameModule
+     *            Namespace and revision enclosed as a QNameModule
+     * @param localName
+     *            Local name part of QName. MUST NOT BE null.
+     * @return Instance of QName
+     */
+    public static QName create(final QNameModule qnameModule, final String localName) {
+        return new QName(Preconditions.checkNotNull(qnameModule,"module may not be null"), localName);
+    }
+
+    /**
+     * Creates new QName.
+     *
+     * @param namespace
+     *            Namespace of QName or null if namespace is undefined.
+     * @param revision
+     *            Revision of namespace or null if revision is unspecified.
+     * @param localName
+     *            Local name part of QName. MUST NOT BE null.
+     * @return Instance of QName
+     */
+    public static QName create(final URI namespace, final Date revision, final String localName) {
+        return create(QNameModule.create(namespace, revision), localName);
+    }
+
+    /**
+     * Creates new QName.
+     *
+     * @param namespace
+     *            Namespace of QName or null if namespace is undefined.
+     * @param revision
+     *            Revision of namespace or null if revision is unspecified.
+     * @param localName
+     *            Local name part of QName. MUST NOT BE null.
+     * @return Instance of QName
+     */
+    public static QName create(final String namespace, final String localName, final Date revision) {
+        final URI namespaceUri = parseNamespace(namespace);
+        return create(QNameModule.create(namespaceUri, revision), localName);
+    }
+
+    /**
+     * Creates new QName.
+     *
+     * @param namespace
+     *            Namespace of QName, MUST NOT BE Null.
+     * @param revision
+     *            Revision of namespace / YANG module. MUST NOT BE null, MUST BE
+     *            in format <code>YYYY-mm-dd</code>.
+     * @param localName
+     *            Local name part of QName. MUST NOT BE null.
+     * @return A new QName
+     * @throws NullPointerException
+     *             If any of parameters is null.
+     * @throws IllegalArgumentException
+     *             If <code>namespace</code> is not valid URI or
+     *             <code>revision</code> is not according to format
+     *             <code>YYYY-mm-dd</code>.
+     */
+    public static QName create(final String namespace, final String revision, final String localName) {
+        final URI namespaceUri = parseNamespace(namespace);
+        final Date revisionDate = parseRevision(revision);
+        return create(namespaceUri, revisionDate, localName);
+    }
+
+    /**
+     * Creates new QName.
+     *
+     * @param namespace
+     *            Namespace of QName, MUST NOT BE Null.
+     * @param localName
+     *            Local name part of QName. MUST NOT BE null.
+     * @return A new QName
+     * @throws NullPointerException
+     *             If any of parameters is null.
+     * @throws IllegalArgumentException
+     *             If <code>namespace</code> is not valid URI.
+     */
+    public static QName create(final String namespace, final String localName) {
+        return create(parseNamespace(namespace), null, localName);
+    }
+
     /**
      * Get the module component of the QName.
      *
@@ -150,7 +240,7 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
 
     /**
      * Returns YANG schema identifier which were defined for this node in the
-     * YANG module
+     * YANG module.
      *
      * @return YANG schema identifier which were defined for this node in the
      *         YANG module
@@ -161,7 +251,7 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
 
     /**
      * Returns revision of the YANG module if the module has defined revision,
-     * otherwise returns <code>null</code>
+     * otherwise returns <code>null</code>.
      *
      * @return revision of the YANG module if the module has defined revision,
      *         otherwise returns <code>null</code>
@@ -196,7 +286,6 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
     }
 
     /**
-     *
      * Compares the specified object with this list for equality.  Returns
      * <tt>true</tt> if and only if the specified object is also instance of
      * {@link QName} and its {@link #getLocalName()}, {@link #getNamespace()} and
@@ -218,78 +307,6 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
         return Objects.equals(localName, other.localName) && module.equals(other.module);
     }
 
-    public static QName create(final QName base, final String localName) {
-        return create(base.getModule(), localName);
-    }
-
-    /**
-     * Creates new QName.
-     *
-     * @param qnameModule
-     *            Namespace and revision enclosed as a QNameModule
-     * @param localName
-     *            Local name part of QName. MUST NOT BE null.
-     * @return Instance of QName
-     */
-    public static QName create(final QNameModule qnameModule, final String localName) {
-        return new QName(Preconditions.checkNotNull(qnameModule,"module may not be null"), localName);
-    }
-
-    /**
-     * Creates new QName.
-     *
-     * @param namespace
-     *            Namespace of QName or null if namespace is undefined.
-     * @param revision
-     *            Revision of namespace or null if revision is unspecified.
-     * @param localName
-     *            Local name part of QName. MUST NOT BE null.
-     * @return Instance of QName
-     */
-    public static QName create(final URI namespace, final Date revision, final String localName) {
-        return create(QNameModule.create(namespace, revision), localName);
-    }
-
-    /**
-     * Creates new QName.
-     *
-     * @param namespace
-     *            Namespace of QName or null if namespace is undefined.
-     * @param revision
-     *            Revision of namespace or null if revision is unspecified.
-     * @param localName
-     *            Local name part of QName. MUST NOT BE null.
-     * @return Instance of QName
-     */
-    public static QName create(final String namespace, final String localName, final Date revision) {
-        final URI namespaceUri = parseNamespace(namespace);
-        return create(QNameModule.create(namespaceUri, revision), localName);
-    }
-
-    /**
-     * Creates new QName.
-     *
-     * @param namespace
-     *            Namespace of QName, MUST NOT BE Null.
-     * @param revision
-     *            Revision of namespace / YANG module. MUST NOT BE null, MUST BE
-     *            in format <code>YYYY-mm-dd</code>.
-     * @param localName
-     *            Local name part of QName. MUST NOT BE null.
-     * @return A new QName
-     * @throws NullPointerException
-     *             If any of parameters is null.
-     * @throws IllegalArgumentException
-     *             If <code>namespace</code> is not valid URI or
-     *             <code>revision</code> is not according to format
-     *             <code>YYYY-mm-dd</code>.
-     */
-    public static QName create(final String namespace, final String revision, final String localName) {
-        final URI namespaceUri = parseNamespace(namespace);
-        final Date revisionDate = parseRevision(revision);
-        return create(namespaceUri, revisionDate, localName);
-    }
-
     private static URI parseNamespace(final String namespace) {
         try {
             return new URI(namespace);
@@ -298,23 +315,6 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
         }
     }
 
-    /**
-     * Creates new QName.
-     *
-     * @param namespace
-     *            Namespace of QName, MUST NOT BE Null.
-     * @param localName
-     *            Local name part of QName. MUST NOT BE null.
-     * @return A new QName
-     * @throws NullPointerException
-     *             If any of parameters is null.
-     * @throws IllegalArgumentException
-     *             If <code>namespace</code> is not valid URI.
-     */
-    public static QName create(final String namespace, final String localName) {
-        return create(parseNamespace(namespace), null, localName);
-    }
-
     @Override
     public String toString() {
         final StringBuilder sb = new StringBuilder();
@@ -331,9 +331,9 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
     }
 
     /**
-     * Return string representation of revision in format
-     * <code>YYYY-mm-dd</code>
+     * Return string representation of revision in format <code>YYYY-mm-dd</code>
      *
+     * <p>
      * YANG Specification defines format for <code>revision</code> as
      * YYYY-mm-dd. This format for revision is reused accross multiple places
      * such as capabilities URI, YANG modules, etc.
@@ -354,6 +354,7 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
         return create(getNamespace(), null, localName);
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
     public static Date parseRevision(final String formatedDate) {
         try {
             return getRevisionFormat().parse(formatedDate);
@@ -367,6 +368,7 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
      * Formats {@link Date} representing revision to format
      * <code>YYYY-mm-dd</code>
      *
+     * <p>
      * YANG Specification defines format for <code>revision</code> as
      * YYYY-mm-dd. This format for revision is reused accross multiple places
      * such as capabilities URI, YANG modules, etc.
@@ -383,9 +385,9 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
     }
 
     /**
-     *
      * Compares this QName to other, without comparing revision.
      *
+     * <p>
      * Compares instance of this to other instance of QName and returns true if
      * both instances have equal <code>localName</code> ({@link #getLocalName()}
      * ) and <code>namespace</code> ({@link #getNamespace()}).
index ebf5a1fadb6b593cae6faf10e6bb430a518b57f6..acc12bbe4e08e88b44becbe2b551fb8bbce0cd01 100644 (file)
@@ -149,6 +149,7 @@ public final class QNameModule implements Immutable, Serializable {
 
     @Override
     public String toString() {
-        return MoreObjects.toStringHelper(QNameModule.class).omitNullValues().add("ns", getNamespace()).add("rev", getFormattedRevision()).toString();
+        return MoreObjects.toStringHelper(QNameModule.class).omitNullValues().add("ns", getNamespace())
+            .add("rev", getFormattedRevision()).toString();
     }
 }
index 8915b08a3eb72e1825efedb8653d8b9e55053607..bc8940a55cb1da88b24d6a39c542ae8d424604ec 100644 (file)
@@ -73,6 +73,7 @@ public abstract class Revision implements Comparable<Revision>, Serializable {
 
         private String str;
 
+        @SuppressWarnings("checkstyle:redundantModifier")
         public Proxy() {
             // For Externalizable
         }
@@ -130,6 +131,7 @@ public abstract class Revision implements Comparable<Revision>, Serializable {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public final int compareTo(final Revision o) {
         return toDate().compareTo(o.toDate());
     }
index 63f59d5beaaf6919f992ad27d02fdf3c91be148d..b1a79f402d8bf429718176b4cc5e428d0b84a23c 100644 (file)
@@ -49,6 +49,7 @@ public interface RpcError {
 
     /**
      * Returns a short string that identifies the general type of error condition.
+     *
      * <p>
      * The following outlines suggested values as defined by netconf (<a href="https://tools.ietf.org/html/rfc6241#page-89">RFC 6241</a>):
      * <pre>
@@ -93,7 +94,6 @@ public interface RpcError {
     String getMessage();
 
     /**
-     *
      * Returns a string containing additional information to provide extended
      * and/or implementation-specific debugging information.
      *
@@ -102,7 +102,6 @@ public interface RpcError {
     String getInfo();
 
     /**
-     *
      * Returns an exception cause.
      *
      * @return a Throwable if the error was triggered by exception, null otherwise.
index 7b5ef531c9033d191146902dd14b8cc1a292d1de..be6801fc86580bea267a2130adc47ae93928c516 100644 (file)
@@ -34,8 +34,8 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
         private final T result;
         private final boolean successful;
 
-        RpcResultImpl( final boolean successful, final T result,
-                       final Collection<RpcError> errors ) {
+        RpcResultImpl(final boolean successful, final T result,
+                       final Collection<RpcError> errors) {
             this.successful = successful;
             this.result = result;
             this.errors = errors;
@@ -74,9 +74,9 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
         private final ErrorType errorType;
         private final Throwable cause;
 
-        RpcErrorImpl( final ErrorSeverity severity, final ErrorType errorType,
+        RpcErrorImpl(final ErrorSeverity severity, final ErrorType errorType,
                 final String tag, final String message, final String applicationTag, final String info,
-                final Throwable cause ) {
+                final Throwable cause) {
             this.severity = severity;
             this.errorType = errorType;
             this.tag = tag;
@@ -134,7 +134,7 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
     private T result;
     private final boolean successful;
 
-    private RpcResultBuilder( final boolean successful, final T result ) {
+    private RpcResultBuilder(final boolean successful, final T result) {
         this.successful = successful;
         this.result = result;
     }
@@ -151,7 +151,7 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      *
      * @param result the result value
      */
-    public static <T> RpcResultBuilder<T> success( final T result ) {
+    public static <T> RpcResultBuilder<T> success(final T result) {
         return new RpcResultBuilder<>(true, result);
     }
 
@@ -160,7 +160,7 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      *
      * @param builder builder for the result value
      */
-    public static <T> RpcResultBuilder<T> success( final Builder<T> builder ) {
+    public static <T> RpcResultBuilder<T> success(final Builder<T> builder) {
         return success(builder.build());
     }
 
@@ -176,7 +176,7 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      *
      * @param success true if successful, false otherwise.
      */
-    public static <T> RpcResultBuilder<T> status( final boolean success ) {
+    public static <T> RpcResultBuilder<T> status(final boolean success) {
         return new RpcResultBuilder<>(success, null);
     }
 
@@ -185,9 +185,9 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      *
      * @param other the other RpcResult.
      */
-    public static <T> RpcResultBuilder<T> from( final RpcResult<T> other ) {
+    public static <T> RpcResultBuilder<T> from(final RpcResult<T> other) {
         return new RpcResultBuilder<>(other.isSuccessful(), other.getResult())
-                                                      .withRpcErrors( other.getErrors() );
+                                                      .withRpcErrors(other.getErrors());
     }
 
     /**
@@ -200,9 +200,9 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      *
      * @return an RpcError
      */
-    public static RpcError newError( final ErrorType errorType, final String tag, final String message ) {
-        return new RpcErrorImpl( ErrorSeverity.ERROR, errorType,
-                tag != null ? tag : "operation-failed", message, null, null, null );
+    public static RpcError newError(final ErrorType errorType, final String tag, final String message) {
+        return new RpcErrorImpl(ErrorSeverity.ERROR, errorType,
+                tag != null ? tag : "operation-failed", message, null, null, null);
     }
 
     /**
@@ -212,17 +212,17 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      * @param tag a short string that identifies the general type of error condition. See
      *        {@link RpcError#getTag} for a list of suggested values.
      * @param message a string suitable for human display that describes the error condition.
-     * @param applicationTag a short string that identifies the specific type of error condition.
+     * @param applicationTag a short string that identifies the specific type of error condition.
      * @param info a string containing additional information to provide extended
      *        and/or implementation-specific debugging information.
      * @param cause the exception that triggered the error.
      *
      * @return an RpcError
      */
-    public static RpcError newError(  final ErrorType errorType, final String tag, final String message,
-            final String applicationTag, final String info, final Throwable cause ) {
-        return new RpcErrorImpl( ErrorSeverity.ERROR, errorType,
-                tag != null ? tag : "operation-failed", message, applicationTag, info, cause );
+    public static RpcError newError(final ErrorType errorType, final String tag, final String message,
+            final String applicationTag, final String info, final Throwable cause) {
+        return new RpcErrorImpl(ErrorSeverity.ERROR, errorType,
+                tag != null ? tag : "operation-failed", message, applicationTag, info, cause);
     }
 
     /**
@@ -235,8 +235,8 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      *
      * @return an RpcError
      */
-    public static RpcError newWarning( final ErrorType errorType, final String tag, final String message ) {
-        return new RpcErrorImpl( ErrorSeverity.WARNING, errorType, tag, message, null, null, null );
+    public static RpcError newWarning(final ErrorType errorType, final String tag, final String message) {
+        return new RpcErrorImpl(ErrorSeverity.WARNING, errorType, tag, message, null, null, null);
     }
 
     /**
@@ -246,17 +246,17 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      * @param tag a short string that identifies the general type of warning condition. See
      *        {@link RpcError#getTag} for a list of suggested values.
      * @param message a string suitable for human display that describes the warning condition.
-     * @param applicationTag a short string that identifies the specific type of warning condition.
+     * @param applicationTag a short string that identifies the specific type of warning condition.
      * @param info a string containing additional information to provide extended
      *        and/or implementation-specific debugging information.
      * @param cause the exception that triggered the warning.
      *
      * @return an RpcError
      */
-    public static RpcError newWarning(  final ErrorType errorType, final String tag, final String message,
-            final String applicationTag, final String info, final Throwable cause ) {
-        return new RpcErrorImpl( ErrorSeverity.WARNING, errorType, tag, message,
-                                 applicationTag, info, cause );
+    public static RpcError newWarning(final ErrorType errorType, final String tag, final String message,
+            final String applicationTag, final String info, final Throwable cause) {
+        return new RpcErrorImpl(ErrorSeverity.WARNING, errorType, tag, message,
+                                 applicationTag, info, cause);
     }
 
     /**
@@ -264,7 +264,7 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      *
      * @param result the result value
      */
-    public RpcResultBuilder<T> withResult( final T result ) {
+    public RpcResultBuilder<T> withResult(final T result) {
         this.result = result;
         return this;
     }
@@ -274,26 +274,26 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      *
      * @param builder builder for the result value
      */
-    public RpcResultBuilder<T> withResult( final Builder<T> builder ) {
+    public RpcResultBuilder<T> withResult(final Builder<T> builder) {
         return withResult(builder.build());
     }
 
-    private void addError( final ErrorSeverity severity, final ErrorType errorType,
+    private void addError(final ErrorSeverity severity, final ErrorType errorType,
             final String tag, final String message, final String applicationTag, final String info,
-            final Throwable cause ) {
+            final Throwable cause) {
 
-        addError( new RpcErrorImpl( severity, errorType,
+        addError(new RpcErrorImpl(severity, errorType,
                                     tag != null ? tag : "operation-failed", message,
-                                    applicationTag, info, cause ) );
+                                    applicationTag, info, cause));
     }
 
-    private void addError( final RpcError error ) {
+    private void addError(final RpcError error) {
 
         if (errors == null) {
             errors = new ImmutableList.Builder<>();
         }
 
-        errors.add( error );
+        errors.add(error);
     }
 
     /**
@@ -304,8 +304,8 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      *        {@link RpcError#getTag} for a list of suggested values.
      * @param message a string suitable for human display that describes the warning condition.
      */
-    public RpcResultBuilder<T> withWarning( final ErrorType errorType, final String tag, final String message ) {
-        addError( ErrorSeverity.WARNING, errorType, tag, message, null, null, null );
+    public RpcResultBuilder<T> withWarning(final ErrorType errorType, final String tag, final String message) {
+        addError(ErrorSeverity.WARNING, errorType, tag, message, null, null, null);
         return this;
     }
 
@@ -321,9 +321,9 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      *        and/or implementation-specific debugging information.
      * @param cause the exception that triggered the warning.
      */
-    public RpcResultBuilder<T> withWarning( final ErrorType errorType, final String tag, final String message,
-            final String applicationTag, final String info, final Throwable cause ) {
-        addError( ErrorSeverity.WARNING, errorType, tag, message, applicationTag, info, cause );
+    public RpcResultBuilder<T> withWarning(final ErrorType errorType, final String tag, final String message,
+            final String applicationTag, final String info, final Throwable cause) {
+        addError(ErrorSeverity.WARNING, errorType, tag, message, applicationTag, info, cause);
         return this;
     }
 
@@ -333,8 +333,8 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      * @param errorType the conceptual layer at which the error occurred.
      * @param message a string suitable for human display that describes the error condition.
      */
-    public RpcResultBuilder<T> withError( final ErrorType errorType, final String message ) {
-        addError( ErrorSeverity.ERROR, errorType, null, message, null, null, null );
+    public RpcResultBuilder<T> withError(final ErrorType errorType, final String message) {
+        addError(ErrorSeverity.ERROR, errorType, null, message, null, null, null);
         return this;
     }
 
@@ -346,8 +346,8 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      *        {@link RpcError#getTag} for a list of suggested values.
      * @param message a string suitable for human display that describes the error condition.
      */
-    public RpcResultBuilder<T> withError( final ErrorType errorType, final String tag, final String message ) {
-        addError( ErrorSeverity.ERROR, errorType, tag, message, null, null, null );
+    public RpcResultBuilder<T> withError(final ErrorType errorType, final String tag, final String message) {
+        addError(ErrorSeverity.ERROR, errorType, tag, message, null, null, null);
         return this;
     }
 
@@ -358,9 +358,9 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      * @param message a string suitable for human display that describes the error condition.
      * @param cause the exception that triggered the error.
      */
-    public RpcResultBuilder<T> withError( final ErrorType errorType, final String message,
-                                          final Throwable cause ) {
-        addError( ErrorSeverity.ERROR, errorType, null, message, null, null, cause );
+    public RpcResultBuilder<T> withError(final ErrorType errorType, final String message,
+                                          final Throwable cause) {
+        addError(ErrorSeverity.ERROR, errorType, null, message, null, null, cause);
         return this;
     }
 
@@ -376,9 +376,9 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      *        and/or implementation-specific debugging information.
      * @param cause the exception that triggered the error.
      */
-    public RpcResultBuilder<T> withError( final ErrorType errorType, final String tag, final String message,
-            final String applicationTag, final String info, final Throwable cause ) {
-        addError( ErrorSeverity.ERROR, errorType, tag, message, applicationTag, info, cause );
+    public RpcResultBuilder<T> withError(final ErrorType errorType, final String tag, final String message,
+            final String applicationTag, final String info, final Throwable cause) {
+        addError(ErrorSeverity.ERROR, errorType, tag, message, applicationTag, info, cause);
         return this;
     }
 
@@ -387,8 +387,8 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      *
      * @param error the RpcError
      */
-    public RpcResultBuilder<T> withRpcError( final RpcError error ) {
-        addError( error );
+    public RpcResultBuilder<T> withRpcError(final RpcError error) {
+        addError(error);
         return this;
     }
 
@@ -397,10 +397,10 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
      *
      * @param errors the list of RpcErrors
      */
-    public RpcResultBuilder<T> withRpcErrors( final Collection<RpcError> errors ) {
+    public RpcResultBuilder<T> withRpcErrors(final Collection<RpcError> errors) {
         if (errors != null) {
             for (RpcError error : errors) {
-                addError( error );
+                addError(error);
             }
         }
         return this;
@@ -416,14 +416,13 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
     /**
      * Builds RpcResult and wraps it in a Future
      *
+     * <p>
      * This is a convenience method to assist those writing rpcs
      * that produce immediate results.  It allows you to replace
      *
-     * Futures.immediateFuture(rpcResult.build())
-     *
+     * {@code Futures.immediateFuture(rpcResult.build())}
      * with
-     *
-     * rpcResult.buildFuture();
+     * {@code rpcResult.buildFuture();}
      *
      * @return Future for RpcResult built by RpcResultBuilder
      *
index 0ffc0bec1d4e30cdf1df7166f5fdb73138bfded0..b6a2b2a26fc66c0d4c2eeca17f9f5eed8c023ece 100644 (file)
@@ -15,27 +15,27 @@ import java.util.Date;
 public final class SimpleDateFormatUtil {
 
     /**
-     * revision format according to Yang spec
+     * revision format according to Yang spec.
      */
     private static final String REVISION_SIMPLE_DATE = "yyyy-MM-dd";
 
     /**
-     * default Yang date that is used when date is not present
+     * default Yang date that is used when date is not present.
      */
     private static final String DEFAULT_DATE = "1970-01-01";
 
     /**
-     * {@link SimpleDateFormatUtil#DEFAULT_DATE} for revision statement
+     * {@link SimpleDateFormatUtil#DEFAULT_DATE} for revision statement.
      */
     public static final Date DEFAULT_DATE_REV;
 
     /**
-     * {@link SimpleDateFormatUtil#DEFAULT_DATE} for import statement
+     * {@link SimpleDateFormatUtil#DEFAULT_DATE} for import statement.
      */
     public static final Date DEFAULT_DATE_IMP;
 
     /**
-     * {@link SimpleDateFormatUtil#DEFAULT_DATE} for belongs-to statement
+     * {@link SimpleDateFormatUtil#DEFAULT_DATE} for belongs-to statement.
      */
     public static final Date DEFAULT_BELONGS_TO_DATE;
 
index 3b362cf8b8a79a92f81a4163761be79cd73bfa3e..3f93818b72e9c7bd2cc9896dd612fd3794add069 100644 (file)
@@ -71,7 +71,7 @@ public final class YangConstants {
         URI.create("urn:ietf:params:netconf:capability:yang-library:1.0");
 
     /**
-     * Prefix for YANG-specific XPath functions
+     * Prefix for YANG-specific XPath functions.
      */
     public static final String YANG_XPATH_FUNCTIONS_PREFIX = "yang";
 
index 59cb26a957555c81f1a0589f0f38a361292bd0da..2009465e9a5698b0754c0719d5fa6f2e111e475d 100644 (file)
@@ -37,7 +37,7 @@ public enum YangVersion {
     private final String str;
     private String reference;
 
-    private YangVersion(final String str, final String reference) {
+    YangVersion(final String str, final String reference) {
         this.str = Preconditions.checkNotNull(str);
         this.reference = Preconditions.checkNotNull(reference);
     }
index def8552e251c66bccc9cdc18b4018d085ebb6b69..27e6c22fa40a78adaedec15aa5e882b4fa589bff 100644 (file)
@@ -16,11 +16,12 @@ public class OperationFailedExceptionTest {
 
     @Test
     public void testOperationFailedException() {
-        final Throwable cause = new Throwable( "mock cause" );
+        final Throwable cause = new Throwable("mock cause");
         final RpcError rpcErrorShort = RpcResultBuilder.newError(RpcError.ErrorType.RPC, "tag", "msg");
         final OperationFailedException operationFailedException1 = new OperationFailedException("error msg", cause,
                 rpcErrorShort);
-        final OperationFailedException operationFailedException2 = new OperationFailedException("error msg", rpcErrorShort);
+        final OperationFailedException operationFailedException2 = new OperationFailedException("error msg",
+                rpcErrorShort);
         assertEquals(operationFailedException1.getErrorList(), operationFailedException2.getErrorList());
         assertTrue(operationFailedException1.toString().contains("error msg"));
     }
index e6a279b32925dd536b07d09173330d74b7127379..56bc0bc629541807022210859796243b8c22b202 100644 (file)
@@ -11,41 +11,40 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+
 import java.net.URI;
 import java.util.Date;
 import org.junit.Test;
 
 public class QNameTest {
-    private final String namespace = "urn:foo", revision = "2013-12-24", localName = "bar";
-    private final URI ns;
-
-    public QNameTest() throws Exception {
-        this.ns = new URI(namespace);
-    }
+    private final String namespace = "urn:foo";
+    private final String revision = "2013-12-24";
+    private final String localName = "bar";
+    private final URI ns = URI.create(namespace);
 
     @Test
     public void testStringSerialization() throws Exception {
         {
-            QName qName = QName.create(namespace, revision, localName);
+            QName qname = QName.create(namespace, revision, localName);
             assertEquals(QName.QNAME_LEFT_PARENTHESIS + namespace + QName.QNAME_REVISION_DELIMITER
-                    + revision + QName.QNAME_RIGHT_PARENTHESIS + localName, qName.toString());
-            QName copied = QName.create(qName.toString());
-            assertEquals(qName, copied);
+                    + revision + QName.QNAME_RIGHT_PARENTHESIS + localName, qname.toString());
+            QName copied = QName.create(qname.toString());
+            assertEquals(qname, copied);
         }
         // no revision
         {
-            QName qName = new QName(ns, localName);
+            QName qname = new QName(ns, localName);
             assertEquals(QName.QNAME_LEFT_PARENTHESIS + namespace + QName.QNAME_RIGHT_PARENTHESIS
-                    + localName, qName.toString());
-            QName copied = QName.create(qName.toString());
-            assertEquals(qName, copied);
+                    + localName, qname.toString());
+            QName copied = QName.create(qname.toString());
+            assertEquals(qname, copied);
         }
         // no namespace nor revision
         {
-            QName qName = new QName(null, localName);
-            assertEquals(localName, qName.toString());
-            QName copied = QName.create(qName.toString());
-            assertEquals(qName, copied);
+            QName qname = new QName(null, localName);
+            assertEquals(localName, qname.toString());
+            QName copied = QName.create(qname.toString());
+            assertEquals(qname, copied);
         }
     }
 
@@ -61,73 +60,73 @@ public class QNameTest {
 
     @Test
     public void testCompareTo() throws Exception {
-        String A = "a";
-        String B = "b";
+        final String A = "a";
+        final String B = "b";
 
-        QName a = QName.create(A);
-        QName b = QName.create(A);
-        assertTrue(a.compareTo(b) == 0);
-        assertTrue(b.compareTo(a) == 0);
+        QName qa = QName.create(A);
+        QName qb = QName.create(A);
+        assertTrue(qa.compareTo(qb) == 0);
+        assertTrue(qb.compareTo(qa) == 0);
 
         // compare with localName
-        a = QName.create(A);
-        b = QName.create(B);
-        assertTrue(a.compareTo(b) < 0);
-        assertTrue(b.compareTo(a) > 0);
+        qa = QName.create(A);
+        qb = QName.create(B);
+        assertTrue(qa.compareTo(qb) < 0);
+        assertTrue(qb.compareTo(qa) > 0);
 
         // compare with namespace
-        a = QName.create(A, revision, A);
-        b = QName.create(B, revision, A);
-        assertTrue(a.compareTo(b) < 0);
-        assertTrue(b.compareTo(a) > 0);
+        qa = QName.create(A, revision, A);
+        qb = QName.create(B, revision, A);
+        assertTrue(qa.compareTo(qb) < 0);
+        assertTrue(qb.compareTo(qa) > 0);
 
         // compare with 1 null namespace
-        a = QName.create(null, QName.parseRevision(revision), A);
-        b = QName.create(URI.create(A), QName.parseRevision(revision), A);
-        assertTrue(a.compareTo(b) < 0);
-        assertTrue(b.compareTo(a) > 0);
+        qa = QName.create(null, QName.parseRevision(revision), A);
+        qb = QName.create(URI.create(A), QName.parseRevision(revision), A);
+        assertTrue(qa.compareTo(qb) < 0);
+        assertTrue(qb.compareTo(qa) > 0);
 
         // compare with both null namespace
-        b = QName.create(null, QName.parseRevision(revision), A);
-        assertTrue(a.compareTo(b) == 0);
-        assertTrue(b.compareTo(a) == 0);
+        qb = QName.create(null, QName.parseRevision(revision), A);
+        assertTrue(qa.compareTo(qb) == 0);
+        assertTrue(qb.compareTo(qa) == 0);
 
         // compare with revision
-        a = QName.create(A, "2013-12-24", A);
-        b = QName.create(A, "2013-12-25", A);
-        assertTrue(a.compareTo(b) < 0);
-        assertTrue(b.compareTo(a) > 0);
+        qa = QName.create(A, "2013-12-24", A);
+        qb = QName.create(A, "2013-12-25", A);
+        assertTrue(qa.compareTo(qb) < 0);
+        assertTrue(qb.compareTo(qa) > 0);
 
         // compare with 1 null revision
-        a = QName.create(URI.create(A), null, A);
-        b = QName.create(URI.create(A), QName.parseRevision(revision), A);
-        assertTrue(a.compareTo(b) < 0);
-        assertTrue(b.compareTo(a) > 0);
+        qa = QName.create(URI.create(A), null, A);
+        qb = QName.create(URI.create(A), QName.parseRevision(revision), A);
+        assertTrue(qa.compareTo(qb) < 0);
+        assertTrue(qb.compareTo(qa) > 0);
 
         // compare with both null revision
-        b = QName.create(URI.create(A), null, A);
-        assertTrue(a.compareTo(b) == 0);
-        assertTrue(b.compareTo(a) == 0);
+        qb = QName.create(URI.create(A), null, A);
+        assertTrue(qa.compareTo(qb) == 0);
+        assertTrue(qb.compareTo(qa) == 0);
     }
 
     @Test
     public void testQName() {
-        final QName qName = QName.create(namespace, revision, localName);
-        final QName qName1 = QName.create(namespace, localName);
-        final QName qName2 = QName.create(qName1, localName);
-        assertEquals(qName1, qName.withoutRevision());
-        assertEquals(qName1, qName2);
-        assertTrue(qName.isEqualWithoutRevision(qName1));
+        final QName qname = QName.create(namespace, revision, localName);
+        final QName qname1 = QName.create(namespace, localName);
+        final QName qname2 = QName.create(qname1, localName);
+        assertEquals(qname1, qname.withoutRevision());
+        assertEquals(qname1, qname2);
+        assertTrue(qname.isEqualWithoutRevision(qname1));
         assertNotNull(QName.formattedRevision(new Date()));
-        assertNotNull(qName.hashCode());
-        assertEquals(qName, qName.intern());
+        assertNotNull(qname.hashCode());
+        assertEquals(qname, qname.intern());
     }
 
     @Test
     public void testQNameModule() {
-        final QNameModule qNameModule = QNameModule.create(ns, new Date());
-        assertNotNull(qNameModule.toString());
-        assertNotNull(qNameModule.getRevisionNamespace());
+        final QNameModule qnameModule = QNameModule.create(ns, new Date());
+        assertNotNull(qnameModule.toString());
+        assertNotNull(qnameModule.getRevisionNamespace());
     }
 
     private static void assertLocalNameFails(final String localName) {
@@ -135,6 +134,7 @@ public class QNameTest {
             new QName(null, localName);
             fail("Local name should fail:" + localName);
         } catch (IllegalArgumentException e) {
+            // Expected
         }
     }
-}
\ No newline at end of file
+}
index 45991b2e285a871aefc0e06c46eb314f6543dadb..74166dfede8792046f199e77a5a8b8711409c5e2 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.yangtools.yang.common;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
@@ -30,85 +31,85 @@ public class RpcResultBuilderTest {
 
     @Test
     public void testSuccess() {
-        RpcResult<String> result = RpcResultBuilder.<String>success().withResult( "foo" ).build();
-        verifyRpcResult( result, true, "foo" );
-        assertNotNull( "getErrors returned null", result.getErrors() );
-        assertEquals( "getErrors size", 0, result.getErrors().size() );
+        RpcResult<String> result = RpcResultBuilder.<String>success().withResult("foo").build();
+        verifyRpcResult(result, true, "foo");
+        assertNotNull("getErrors returned null", result.getErrors());
+        assertEquals("getErrors size", 0, result.getErrors().size());
 
-        result = RpcResultBuilder.success( "bar" ).build();
-        verifyRpcResult( result, true, "bar" );
+        result = RpcResultBuilder.success("bar").build();
+        verifyRpcResult(result, true, "bar");
     }
 
     @Test
     public void testFailed() {
-        Throwable cause = new Throwable( "mock cause" );
-        Throwable cause2 = new Throwable( "mock cause2" );
+        Throwable cause = new Throwable("mock cause");
+        Throwable cause2 = new Throwable("mock cause2");
         RpcResult<String> result = RpcResultBuilder.<String>failed()
-                  .withError( ErrorType.PROTOCOL, "error message 1" )
-                  .withError( ErrorType.APPLICATION, "lock_denied", "error message 2" )
-                  .withError( ErrorType.RPC, "in-use", "error message 3", "my-app-tag", "my-info", cause )
-                  .withError( ErrorType.TRANSPORT, "error message 4", cause2 )
+                  .withError(ErrorType.PROTOCOL, "error message 1")
+                  .withError(ErrorType.APPLICATION, "lock_denied", "error message 2")
+                  .withError(ErrorType.RPC, "in-use", "error message 3", "my-app-tag", "my-info", cause)
+                  .withError(ErrorType.TRANSPORT, "error message 4", cause2)
                   .build();
-        verifyRpcResult( result, false, null );
-        verifyRpcError( result, 0, ErrorSeverity.ERROR, ErrorType.PROTOCOL, "operation-failed",
-                        "error message 1", null, null, null );
-        verifyRpcError( result, 1, ErrorSeverity.ERROR, ErrorType.APPLICATION, "lock_denied",
-                        "error message 2", null, null, null );
-        verifyRpcError( result, 2, ErrorSeverity.ERROR, ErrorType.RPC, "in-use",
-                        "error message 3", "my-app-tag", "my-info", cause );
-        verifyRpcError( result, 3, ErrorSeverity.ERROR, ErrorType.TRANSPORT, "operation-failed",
-                        "error message 4", null, null, cause2 );
-        assertEquals( "getErrors size", 4, result.getErrors().size() );
+        verifyRpcResult(result, false, null);
+        verifyRpcError(result, 0, ErrorSeverity.ERROR, ErrorType.PROTOCOL, "operation-failed",
+                        "error message 1", null, null, null);
+        verifyRpcError(result, 1, ErrorSeverity.ERROR, ErrorType.APPLICATION, "lock_denied",
+                        "error message 2", null, null, null);
+        verifyRpcError(result, 2, ErrorSeverity.ERROR, ErrorType.RPC, "in-use",
+                        "error message 3", "my-app-tag", "my-info", cause);
+        verifyRpcError(result, 3, ErrorSeverity.ERROR, ErrorType.TRANSPORT, "operation-failed",
+                        "error message 4", null, null, cause2);
+        assertEquals("getErrors size", 4, result.getErrors().size());
     }
 
     @Test
     public void testWithWarnings() {
-        Throwable cause = new Throwable( "mock cause" );
+        Throwable cause = new Throwable("mock cause");
         RpcResult<String> result = RpcResultBuilder.<String>success()
-                  .withWarning( ErrorType.APPLICATION, "lock_denied", "message 1" )
-                  .withWarning( ErrorType.RPC, "in-use", "message 2", "my-app-tag", "my-info", cause )
+                  .withWarning(ErrorType.APPLICATION, "lock_denied", "message 1")
+                  .withWarning(ErrorType.RPC, "in-use", "message 2", "my-app-tag", "my-info", cause)
                   .build();
-        verifyRpcResult( result, true, null );
-        verifyRpcError( result, 0, ErrorSeverity.WARNING, ErrorType.APPLICATION, "lock_denied",
-                        "message 1", null, null, null );
-        verifyRpcError( result, 1, ErrorSeverity.WARNING, ErrorType.RPC, "in-use",
-                        "message 2", "my-app-tag", "my-info", cause );
-        assertEquals( "getErrors size", 2, result.getErrors().size() );
+        verifyRpcResult(result, true, null);
+        verifyRpcError(result, 0, ErrorSeverity.WARNING, ErrorType.APPLICATION, "lock_denied",
+                        "message 1", null, null, null);
+        verifyRpcError(result, 1, ErrorSeverity.WARNING, ErrorType.RPC, "in-use",
+                        "message 2", "my-app-tag", "my-info", cause);
+        assertEquals("getErrors size", 2, result.getErrors().size());
     }
 
     @Test
     public void testFrom() {
-        Throwable cause = new Throwable( "mock cause" );
+        Throwable cause = new Throwable("mock cause");
         RpcResult<String> result = RpcResultBuilder.<String>success()
-                .withResult( "foo" )
-                .withWarning( ErrorType.RPC, "in-use", "message", "my-app-tag", "my-info", cause )
+                .withResult("foo")
+                .withWarning(ErrorType.RPC, "in-use", "message", "my-app-tag", "my-info", cause)
                 .build();
 
-        RpcResult<String> copy = RpcResultBuilder.from( result )
-                .withError( ErrorType.PROTOCOL, "error message" )
+        RpcResult<String> copy = RpcResultBuilder.from(result)
+                .withError(ErrorType.PROTOCOL, "error message")
                 .build();
-        verifyRpcResult( copy, true, "foo" );
-        verifyRpcError( copy, 0, ErrorSeverity.WARNING, ErrorType.RPC, "in-use",
-                        "message", "my-app-tag", "my-info", cause );
-        verifyRpcError( copy, 1, ErrorSeverity.ERROR, ErrorType.PROTOCOL, "operation-failed",
-                        "error message", null, null, null );
+        verifyRpcResult(copy, true, "foo");
+        verifyRpcError(copy, 0, ErrorSeverity.WARNING, ErrorType.RPC, "in-use",
+                        "message", "my-app-tag", "my-info", cause);
+        verifyRpcError(copy, 1, ErrorSeverity.ERROR, ErrorType.PROTOCOL, "operation-failed",
+                        "error message", null, null, null);
     }
 
     @Test
     public void testWithRpcErrors() {
-        Throwable cause = new Throwable( "mock cause" );
+        Throwable cause = new Throwable("mock cause");
         RpcResult<String> result = RpcResultBuilder.<String>failed()
-                .withWarning( ErrorType.RPC, "in-use", "message", "my-app-tag", "my-info", cause )
-                .withError( ErrorType.PROTOCOL, "error message" )
+                .withWarning(ErrorType.RPC, "in-use", "message", "my-app-tag", "my-info", cause)
+                .withError(ErrorType.PROTOCOL, "error message")
                 .build();
 
         RpcResult<String> result2 = RpcResultBuilder.<String>failed()
-                .withRpcErrors( result.getErrors() )
+                .withRpcErrors(result.getErrors())
                 .build();
-        verifyRpcError( result2, 0, ErrorSeverity.WARNING, ErrorType.RPC, "in-use",
-                        "message", "my-app-tag", "my-info", cause );
-        verifyRpcError( result2, 1, ErrorSeverity.ERROR, ErrorType.PROTOCOL, "operation-failed",
-                        "error message", null, null, null );
+        verifyRpcError(result2, 0, ErrorSeverity.WARNING, ErrorType.RPC, "in-use",
+                        "message", "my-app-tag", "my-info", cause);
+        verifyRpcError(result2, 1, ErrorSeverity.ERROR, ErrorType.PROTOCOL, "operation-failed",
+                        "error message", null, null, null);
     }
 
     @Test
@@ -123,23 +124,23 @@ public class RpcResultBuilderTest {
                 "info", null);
         rpcResultBuilder.withRpcError(rpcErrorShort);
         final RpcResult<Object> rpcResult = rpcResultBuilder.build();
-        final RpcResultBuilder<RpcResult<Object>> rpcResultRpcResultBuilder1 = RpcResultBuilder.success
-                (rpcResultBuilder);
-        final RpcResultBuilder<RpcResult<Object>> rpcResultRpcResultBuilder2 = rpcResultRpcResultBuilder1.withResult
-                (rpcResultBuilder);
+        final RpcResultBuilder<RpcResult<Object>> rpcResultRpcResultBuilder1 = RpcResultBuilder.success(
+                rpcResultBuilder);
+        final RpcResultBuilder<RpcResult<Object>> rpcResultRpcResultBuilder2 = rpcResultRpcResultBuilder1.withResult(
+                rpcResultBuilder);
 
         assertEquals(rpcErrorShort.getErrorType(), rpcErrorShortWarn.getErrorType());
         assertEquals(rpcErrorLong.getErrorType(), rpcErrorLongWarn.getErrorType());
         assertEquals(rpcResultRpcResultBuilder1, rpcResultRpcResultBuilder2);
         assertNotNull(rpcResultBuilder.buildFuture());
-        assertEquals("RpcResult [successful=true, result=null, errors=[RpcError [message=msg, severity=ERROR, " +
-                "errorType=RPC, tag=tag, applicationTag=null, info=null, cause=null]]]", rpcResult.toString());
+        assertEquals("RpcResult [successful=true, result=null, errors=[RpcError [message=msg, severity=ERROR, "
+                "errorType=RPC, tag=tag, applicationTag=null, info=null, cause=null]]]", rpcResult.toString());
     }
 
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialization() throws Exception {
-        RpcResult<String> result = RpcResultBuilder.<String>success().withResult( "foo" ).build();
+        RpcResult<String> result = RpcResultBuilder.<String>success().withResult("foo").build();
 
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream(bos);
@@ -150,9 +151,9 @@ public class RpcResultBuilderTest {
 
         verifyRpcResult(clone, true, "foo");
 
-        Throwable cause = new Throwable( "mock cause" );
+        Throwable cause = new Throwable("mock cause");
         result = RpcResultBuilder.<String>failed()
-                .withError( ErrorType.RPC, "in-use", "error message", "my-app-tag", "my-info", cause )
+                .withError(ErrorType.RPC, "in-use", "error message", "my-app-tag", "my-info", cause)
                 .build();
 
         bos = new ByteArrayOutputStream();
@@ -163,29 +164,29 @@ public class RpcResultBuilderTest {
         clone = (RpcResult<String>) in.readObject();
 
         verifyRpcResult(clone, false, null);
-        verifyRpcError( result, 0, ErrorSeverity.ERROR, ErrorType.RPC, "in-use",
-                "error message", "my-app-tag", "my-info", cause );
+        verifyRpcError(result, 0, ErrorSeverity.ERROR, ErrorType.RPC, "in-use",
+                "error message", "my-app-tag", "my-info", cause);
     }
 
-    void verifyRpcError( final RpcResult<?> result, final int errorIndex, final ErrorSeverity expSeverity,
+    void verifyRpcError(final RpcResult<?> result, final int errorIndex, final ErrorSeverity expSeverity,
             final ErrorType expErrorType, final String expTag, final String expMessage, final String expAppTag,
-            final String expInfo, final Throwable expCause ) {
-
-        List<RpcError> errors = new ArrayList<>( result.getErrors() );
-        assertTrue( "Expected error at index " + errorIndex + " not found",
-                    errorIndex < errors.size() );
-        RpcError error = errors.get( errorIndex );
-        assertEquals( "getSeverity", expSeverity, error.getSeverity() );
-        assertEquals( "getErrorType", expErrorType, error.getErrorType() );
-        assertEquals( "getTag", expTag, error.getTag() );
-        assertEquals( "getMessage", expMessage, error.getMessage() );
-        assertEquals( "getApplicationTag", expAppTag, error.getApplicationTag() );
-        assertEquals( "getInfo", expInfo, error.getInfo() );
-        assertEquals( "getCause", expCause, error.getCause() );
+            final String expInfo, final Throwable expCause) {
+
+        List<RpcError> errors = new ArrayList<>(result.getErrors());
+        assertTrue("Expected error at index " + errorIndex + " not found",
+                    errorIndex < errors.size());
+        RpcError error = errors.get(errorIndex);
+        assertEquals("getSeverity", expSeverity, error.getSeverity());
+        assertEquals("getErrorType", expErrorType, error.getErrorType());
+        assertEquals("getTag", expTag, error.getTag());
+        assertEquals("getMessage", expMessage, error.getMessage());
+        assertEquals("getApplicationTag", expAppTag, error.getApplicationTag());
+        assertEquals("getInfo", expInfo, error.getInfo());
+        assertEquals("getCause", expCause, error.getCause());
     }
 
-    void verifyRpcResult( final RpcResult<?> result, final boolean expSuccess, final Object expValue ) {
-        assertEquals( "isSuccessful", expSuccess, result.isSuccessful() );
-        assertEquals( "getResult", expValue, result.getResult() );
+    void verifyRpcResult(final RpcResult<?> result, final boolean expSuccess, final Object expValue) {
+        assertEquals("isSuccessful", expSuccess, result.isSuccessful());
+        assertEquals("getResult", expValue, result.getResult());
     }
-}
\ No newline at end of file
+}
index 7bbfb8828528a18e032c88e056273d4e46ee54d0..021f2b03786d3ed27cb8fe943696559213f33e73 100644 (file)
@@ -11,12 +11,9 @@ import java.util.Map;
 import org.opendaylight.yangtools.yang.common.QName;
 
 /**
- *
  * Container of attributes, which may be attached to nodes.
- *
  */
 public interface AttributesContainer {
-
     /**
      * Returns immutable map of QName and value of the attribute.
      *
@@ -25,12 +22,10 @@ public interface AttributesContainer {
     Map<QName, String> getAttributes();
 
     /**
-     * Returns attribute value by supplied QName
-     *
+     * Returns attribute value by supplied QName.
      *
      * @param name Attribute name
      * @return Value of attribute if present, null otherwise.
      */
     Object getAttributeValue(QName name);
-
 }
index ddce29e7642d9f03179c5981513f073e52970ecd..18a34fea1d9691cf1b32ccd5056f779a22839811 100644 (file)
@@ -15,8 +15,10 @@ import javax.annotation.Nonnull;
 import org.opendaylight.yangtools.util.HashCodeBuilder;
 
 final class FixedYangInstanceIdentifier extends YangInstanceIdentifier implements Cloneable {
-    static final FixedYangInstanceIdentifier EMPTY_INSTANCE = new FixedYangInstanceIdentifier(ImmutableList.of(), new HashCodeBuilder<>().build());
+    static final FixedYangInstanceIdentifier EMPTY_INSTANCE = new FixedYangInstanceIdentifier(ImmutableList.of(),
+            new HashCodeBuilder<>().build());
     private static final long serialVersionUID = 1L;
+
     private final ImmutableList<PathArgument> path;
     private transient volatile YangInstanceIdentifier parent;
 
@@ -98,7 +100,7 @@ final class FixedYangInstanceIdentifier extends YangInstanceIdentifier implement
 
     @Override
     public PathArgument getLastPathArgument() {
-        return path.isEmpty()? null : path.get(path.size() - 1);
+        return path.isEmpty() ? null : path.get(path.size() - 1);
     }
 
     @Nonnull
index 13317397f40ab6ae9b5cb5eeb19106ae7133436a..bcd73561a724dd47afaad1f4db49f52d280d69a0 100644 (file)
@@ -12,40 +12,40 @@ import java.util.Arrays;
 // TODO rename to ModifyOperation
 
 /**
- * https://tools.ietf.org/html/rfc6241#section-7.2
+ * See https://tools.ietf.org/html/rfc6241#section-7.2.
  */
 public enum ModifyAction {
     MERGE(true), REPLACE(true), CREATE(false), DELETE(false), REMOVE(false), NONE(true, false);
 
     public static ModifyAction fromXmlValue(final String xmlNameOfAction) {
         switch (xmlNameOfAction) {
-        case "merge":
-            return MERGE;
-        case "replace":
-            return REPLACE;
-        case "remove":
-            return REMOVE;
-        case "delete":
-            return DELETE;
-        case "create":
-            return CREATE;
-        case "none":
-            return NONE;
-        default:
-            throw new IllegalArgumentException("Unknown operation " + xmlNameOfAction + " available operations "
-                    + Arrays.toString(ModifyAction.values()));
+            case "merge":
+                return MERGE;
+            case "replace":
+                return REPLACE;
+            case "remove":
+                return REMOVE;
+            case "delete":
+                return DELETE;
+            case "create":
+                return CREATE;
+            case "none":
+                return NONE;
+            default:
+                throw new IllegalArgumentException("Unknown operation " + xmlNameOfAction + " available operations "
+                        + Arrays.toString(ModifyAction.values()));
         }
     }
 
     private final boolean asDefaultPermitted;
     private final boolean onElementPermitted;
 
-    private ModifyAction(final boolean asDefaultPermitted, final boolean onElementPermitted) {
+    ModifyAction(final boolean asDefaultPermitted, final boolean onElementPermitted) {
         this.asDefaultPermitted = asDefaultPermitted;
         this.onElementPermitted = onElementPermitted;
     }
 
-    private ModifyAction(final boolean asDefaultPermitted) {
+    ModifyAction(final boolean asDefaultPermitted) {
         this(asDefaultPermitted, true);
     }
 
index 8b5f8cb6e3752f2b5d2fc30f6b1abbd4439101d3..512b3fd5a6248da0d7e1a6a7da4207fd046f8762 100644 (file)
@@ -24,32 +24,37 @@ abstract class PathArgumentList extends AbstractList<PathArgument> {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public final boolean remove(final Object o) {
         throw new UnsupportedOperationException();
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public final boolean addAll(@Nonnull final Collection<? extends PathArgument> c) {
         throw new UnsupportedOperationException();
     }
 
     @Override
-    public final boolean removeAll(@Nonnull final Collection<?> c) {
+    @SuppressWarnings("checkstyle:parameterName")
+    public final boolean addAll(final int index, final Collection<? extends PathArgument> c) {
         throw new UnsupportedOperationException();
     }
 
     @Override
-    public final boolean retainAll(@Nonnull final Collection<?> c) {
+    @SuppressWarnings("checkstyle:parameterName")
+    public final boolean removeAll(@Nonnull final Collection<?> c) {
         throw new UnsupportedOperationException();
     }
 
     @Override
-    public final void clear() {
+    @SuppressWarnings("checkstyle:parameterName")
+    public final boolean retainAll(@Nonnull final Collection<?> c) {
         throw new UnsupportedOperationException();
     }
 
     @Override
-    public final boolean addAll(final int index, final Collection<? extends PathArgument> c) {
+    public final void clear() {
         throw new UnsupportedOperationException();
     }
 }
index 690e2a438b3c3f9a32fe3e24fea30255a91caeab..f35c186879db36bb822f8965598d2d79ebc1510c 100644 (file)
@@ -19,7 +19,7 @@ final class StackedPathArguments extends PathArgumentList {
     private final List<PathArgument> base;
     private final List<PathArgument> stack;
 
-    public StackedPathArguments(@Nonnull final YangInstanceIdentifier base, @Nonnull final List<PathArgument> stack) {
+    StackedPathArguments(@Nonnull final YangInstanceIdentifier base, @Nonnull final List<PathArgument> stack) {
         Verify.verify(!stack.isEmpty());
         this.base = base.getPathArguments();
         this.stack = stack;
@@ -31,6 +31,7 @@ final class StackedPathArguments extends PathArgumentList {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean contains(final Object o) {
         final PathArgument srch = (PathArgument) Preconditions.checkNotNull(o);
         return stack.contains(srch) || base.contains(srch);
@@ -45,6 +46,7 @@ final class StackedPathArguments extends PathArgumentList {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public int indexOf(final Object o) {
         final PathArgument srch = (PathArgument) Preconditions.checkNotNull(o);
 
@@ -59,6 +61,7 @@ final class StackedPathArguments extends PathArgumentList {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public int lastIndexOf(final Object o) {
         final PathArgument srch = (PathArgument) Preconditions.checkNotNull(o);
 
index 382e1aaa1dd61c117c7a02f2e933bac39d07f5bc..fbe02fc3926cfe67c62b8c65b83d11bb92590dca 100644 (file)
@@ -50,8 +50,8 @@ final class StackedReversePathArguments extends PathArgumentList {
         return ret;
     }
 
-
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public boolean contains(final Object o) {
         final PathArgument srch = (PathArgument) Preconditions.checkNotNull(o);
         return Iterators.contains(iterator(), srch);
@@ -63,12 +63,14 @@ final class StackedReversePathArguments extends PathArgumentList {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public int indexOf(final Object o) {
         final PathArgument srch = (PathArgument) Preconditions.checkNotNull(o);
         return super.indexOf(srch);
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public int lastIndexOf(final Object o) {
         final PathArgument srch = (PathArgument) Preconditions.checkNotNull(o);
 
index e98cd30a1822c8e903a055741f2e95dea7961e74..51218a315a895b400f5e6a2d6b41d569cec2870d 100644 (file)
@@ -41,7 +41,8 @@ final class StackedYangInstanceIdentifier extends YangInstanceIdentifier impleme
     private transient volatile StackedPathArguments pathArguments;
     private transient volatile StackedReversePathArguments reversePathArguments;
 
-    StackedYangInstanceIdentifier(final YangInstanceIdentifier parent, final PathArgument pathArgument, final int hash) {
+    StackedYangInstanceIdentifier(final YangInstanceIdentifier parent, final PathArgument pathArgument,
+            final int hash) {
         super(hash);
         this.parent = Preconditions.checkNotNull(parent);
         this.pathArgument = Preconditions.checkNotNull(pathArgument);
index a8a02c84189d730ed8a0b55661c286d9a91bcd12..7ee6cf8a9b396f92fcf10b99450db7c91f0c949e 100644 (file)
@@ -46,18 +46,18 @@ import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
  * which conceptually is XPath expression minimized to uniquely identify element
  * in data tree which conforms to constraints maintained by YANG Model,
  * effectively this makes Instance Identifier a path to element in data tree.
- * </p>
+ *
  * <p>
  * Constraints put in YANG specification on instance-identifier allowed it to be
  * effectively represented in Java and it's evaluation does not require
  * full-blown XPath processor.
- * </p>
- * <h3>Path Arguments</h3>
+ *
  * <p>
+ * <h3>Path Arguments</h3>
  * Path to the node represented in instance identifier consists of
  * {@link PathArgument} which carries necessary information to uniquely identify
  * node on particular level in the subtree.
- * </p>
+ *
  * <ul>
  * <li>{@link NodeIdentifier} - Identifier of node, which has cardinality
  * <code>0..1</code> in particular subtree in data tree.</li>
@@ -69,7 +69,6 @@ import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
  * <code>augmentation</code> node.</li>
  * </ul>
  *
- *
  * @see <a href="http://tools.ietf.org/html/rfc6020#section-9.13">RFC6020</a>
  */
 public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentifier>, Immutable, Serializable {
@@ -92,7 +91,9 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
     }
 
     @Nonnull abstract YangInstanceIdentifier createRelativeIdentifier(int skipFromRoot);
+
     @Nonnull abstract Collection<PathArgument> tryPathArguments();
+
     @Nonnull abstract Collection<PathArgument> tryReversePathArguments();
 
     /**
@@ -127,7 +128,7 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
      * @return Ancestor {@link YangInstanceIdentifier}
      * @throws IllegalArgumentException if the specified depth is negative or is greater than the depth of this object.
      */
-   @Nonnull public abstract YangInstanceIdentifier getAncestor(int depth);
+    @Nonnull public abstract YangInstanceIdentifier getAncestor(int depth);
 
     /**
      * Returns an ordered iteration of path arguments.
@@ -170,18 +171,6 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
         return create(Arrays.asList(path));
     }
 
-    @Override
-    public final int hashCode() {
-        /*
-         * The caching is safe, since the object contract requires
-         * immutability of the object and all objects referenced from this
-         * object.
-         * Used lists, maps are immutable. Path Arguments (elements) are also
-         * immutable, since the PathArgument contract requires immutability.
-         */
-        return hash;
-    }
-
     boolean pathArgumentsEqual(final YangInstanceIdentifier other) {
         return Iterables.elementsEqual(getPathArguments(), other.getPathArguments());
     }
@@ -203,7 +192,7 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
     }
 
     /**
-     * Constructs a new Instance Identifier with new {@link NodeIdentifier} added to the end of path arguments
+     * Constructs a new Instance Identifier with new {@link NodeIdentifier} added to the end of path arguments.
      *
      * @param name QName of {@link NodeIdentifier}
      * @return Instance Identifier with additional path argument added to the end.
@@ -213,8 +202,7 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
     }
 
     /**
-     *
-     * Constructs a new Instance Identifier with new {@link PathArgument} added to the end of path arguments
+     * Constructs a new Instance Identifier with new {@link PathArgument} added to the end of path arguments.
      *
      * @param arg Path argument which should be added to the end
      * @return Instance Identifier with additional path argument added to the end.
@@ -315,6 +303,18 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
         return ret;
     }
 
+    @Override
+    public final int hashCode() {
+        /*
+         * The caching is safe, since the object contract requires
+         * immutability of the object and all objects referenced from this
+         * object.
+         * Used lists, maps are immutable. Path Arguments (elements) are also
+         * immutable, since the PathArgument contract requires immutability.
+         */
+        return hash;
+    }
+
     private static int hashCode(final Object value) {
         if (value == null) {
             return 0;
@@ -340,7 +340,8 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
     // Static factories & helpers
 
     /**
-     * Returns a new InstanceIdentifier with only one path argument of type {@link NodeIdentifier} with supplied QName
+     * Returns a new InstanceIdentifier with only one path argument of type {@link NodeIdentifier} with supplied
+     * QName.
      *
      * @param name QName of first node identifier
      * @return Instance Identifier with only one path argument of type {@link NodeIdentifier}
@@ -359,7 +360,6 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
     }
 
     /**
-     *
      * Returns new builder for InstanceIdentifier with path arguments copied from original instance identifier.
      *
      * @param origin InstanceIdentifier from which path arguments are copied.
@@ -370,17 +370,19 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
     }
 
     /**
-     * Path argument / component of InstanceIdentifier
-     *
+     * Path argument / component of InstanceIdentifier.
      * Path argument uniquely identifies node in data tree on particular
      * level.
+     *
      * <p>
      * This interface itself is used as common parent for actual
      * path arguments types and should not be implemented by user code.
+     *
      * <p>
      * Path arguments SHOULD contain only minimum of information
      * required to uniquely identify node on particular subtree level.
      *
+     * <p>
      * For actual path arguments types see:
      * <ul>
      * <li>{@link NodeIdentifier} - Identifier of container or leaf
@@ -394,6 +396,7 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
          * If applicable returns unique QName of data node as defined in YANG
          * Schema.
          *
+         * <p>
          * This method may return null, if the corresponding schema node, does
          * not have QName associated, such as in cases of augmentations.
          *
@@ -413,7 +416,7 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
         String toRelativeString(PathArgument previous);
     }
 
-    private static abstract class AbstractPathArgument implements PathArgument {
+    private abstract static class AbstractPathArgument implements PathArgument {
         private static final long serialVersionUID = -4546547994250849340L;
         private final QName nodeType;
         private transient int hashValue;
@@ -429,6 +432,7 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
         }
 
         @Override
+        @SuppressWarnings("checkstyle:parameterName")
         public int compareTo(@Nonnull final PathArgument o) {
             return nodeType.compareTo(o.getNodeType());
         }
@@ -628,9 +632,10 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
     }
 
     /**
-     * Composite path argument identifying a {@link org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode} node in
-     * particular subtree.
+     * Composite path argument identifying a {@link org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode}
+     * node in particular subtree.
      *
+     * <p>
      * Augmentation is uniquely identified by set of all possible child nodes.
      * This is possible
      * to identify instance of augmentation,
@@ -638,7 +643,6 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
      * statement must not add multiple nodes from same namespace
      * / module to the target node.
      *
-     *
      * @see <a href="http://tools.ietf.org/html/rfc6020#section-7.15">RFC6020</a>
      */
     public static final class AugmentationIdentifier implements PathArgument {
@@ -652,9 +656,8 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
         }
 
         /**
-         *
          * Construct new augmentation identifier using supplied set of possible
-         * child nodes
+         * child nodes.
          *
          * @param childNames
          *            Set of possible child nodes.
@@ -664,7 +667,7 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
         }
 
         /**
-         * Returns set of all possible child nodes
+         * Returns set of all possible child nodes.
          *
          * @return set of all possible child nodes.
          */
@@ -683,15 +686,15 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
         }
 
         @Override
-        public boolean equals(final Object o) {
-            if (this == o) {
+        public boolean equals(final Object obj) {
+            if (this == obj) {
                 return true;
             }
-            if (!(o instanceof AugmentationIdentifier)) {
+            if (!(obj instanceof AugmentationIdentifier)) {
                 return false;
             }
 
-            AugmentationIdentifier that = (AugmentationIdentifier) o;
+            AugmentationIdentifier that = (AugmentationIdentifier) obj;
             return childNames.equals(that.childNames);
         }
 
@@ -701,6 +704,7 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
         }
 
         @Override
+        @SuppressWarnings("checkstyle:parameterName")
         public int compareTo(@Nonnull final PathArgument o) {
             if (!(o instanceof AugmentationIdentifier)) {
                 return -1;
@@ -712,9 +716,9 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
             if (thisSize == otherSize) {
                 Iterator<QName> otherIterator = otherChildNames.iterator();
                 for (QName name : childNames) {
-                    int c = name.compareTo(otherIterator.next());
-                    if (c != 0) {
-                        return c;
+                    int child = name.compareTo(otherIterator.next());
+                    if (child != 0) {
+                        return child;
                     }
                 }
                 return 0;
@@ -727,7 +731,7 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
     }
 
     /**
-     * Fluent Builder of Instance Identifier instances
+     * Fluent Builder of Instance Identifier instances.
      */
     public interface InstanceIdentifierBuilder extends Builder<YangInstanceIdentifier> {
         /**
@@ -747,7 +751,8 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
         InstanceIdentifierBuilder node(QName nodeType);
 
         /**
-         * Adds {@link NodeIdentifierWithPredicates} with supplied QName and key values to path arguments of resulting instance identifier.
+         * Adds {@link NodeIdentifierWithPredicates} with supplied QName and key values to path arguments of resulting
+         * instance identifier.
          *
          * @param nodeType QName of {@link NodeIdentifierWithPredicates} which will be added
          * @param keyValues Map of key components and their respective values for {@link NodeIdentifierWithPredicates}
@@ -766,8 +771,7 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
         InstanceIdentifierBuilder nodeWithKey(QName nodeType, QName key, Object value);
 
         /**
-         *
-         * Builds an {@link YangInstanceIdentifier} with path arguments from this builder
+         * Builds an {@link YangInstanceIdentifier} with path arguments from this builder.
          *
          * @return {@link YangInstanceIdentifier}
          */
index 1aa8d73176ea221a6a95c9411e02f44748fb9f5f..fdba65fe994d2ace2d0005100925f395b613a493 100644 (file)
@@ -23,12 +23,12 @@ final class YangInstanceIdentifierBuilder implements InstanceIdentifierBuilder {
     private final HashCodeBuilder<PathArgument> hash;
     private final List<PathArgument> path;
 
-    public YangInstanceIdentifierBuilder() {
+    YangInstanceIdentifierBuilder() {
         this.hash = new HashCodeBuilder<>();
         this.path = new ArrayList<>();
     }
 
-    public YangInstanceIdentifierBuilder(final Iterable<PathArgument> prefix, final int hash) {
+    YangInstanceIdentifierBuilder(final Iterable<PathArgument> prefix, final int hash) {
         this.path = Lists.newArrayList(prefix);
         this.hash = new HashCodeBuilder<>(hash);
     }
index f26558af7d03b420c726fb9e4cf63506ba0f84fc..0c5d865d6575a48bb1dbfa96ad4a91ae87615a58 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.yangtools.yang.data.api.codec;
 
 import org.opendaylight.yangtools.concepts.Codec;
 
-public interface BinaryCodec<T> extends Codec<T, byte[]>{
+public interface BinaryCodec<T> extends Codec<T, byte[]> {
     @Override
     T serialize(byte[] data);
 
index a22cb85facfd8fd55babce67622b1daabcd16995..4aeeae2866205e5f0d4fb1e329a324259b051046 100644 (file)
@@ -8,10 +8,9 @@
 package org.opendaylight.yangtools.yang.data.api.codec;
 
 import java.util.Set;
-
 import org.opendaylight.yangtools.concepts.Codec;
 
-public interface BitsCodec<T> extends Codec<T, Set<String>>{
+public interface BitsCodec<T> extends Codec<T, Set<String>> {
     @Override
     T serialize(Set<String> data);
 
index 097908f6454f2f8130885c9f3aec00d1b492c19c..0fd2007d0d3ade1b380f957fb30ee2af758fa01f 100644 (file)
@@ -9,13 +9,14 @@ package org.opendaylight.yangtools.yang.data.api.codec;
 
 import org.opendaylight.yangtools.concepts.Codec;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
 /**
- *
- * Codec which serializes / deserializes InstanceIdentifier
+ * Codec which serializes / deserializes InstanceIdentifier.
  *
  * @param <T> Target type
  */
 public interface InstanceIdentifierCodec<T>  extends Codec<T,YangInstanceIdentifier> {
+
     @Override
     T serialize(YangInstanceIdentifier data);
 
index ad347a9cb6e4afd2aec1424f32d1a76203fadff3..6451a8c2d933c60b359288421d1f9b52513dba71 100644 (file)
@@ -11,15 +11,14 @@ import com.google.common.primitives.UnsignedLong;
 import org.opendaylight.yangtools.concepts.Codec;
 
 /**
- *
- * FIXME: Should be changed to {@link UnsignedLong}
+ * FIXME: Should be changed to {@link UnsignedLong}.
  *
  * @author ttkacik
  *
  * @param <T>
  *          Output type of serialization.
  */
-public interface Uint32Codec<T>  extends Codec<T,Long> {
+public interface Uint32Codec<T> extends Codec<T, Long> {
     @Override
     T serialize(Long data);
 
index 7294d5bf5d02aee48d10e35f10652f776d2608cd..833bbf6948030929ee339e74775d8de64fd027e1 100644 (file)
@@ -12,14 +12,14 @@ import java.math.BigInteger;
 import org.opendaylight.yangtools.concepts.Codec;
 
 /**
- * FIXME: Should be changed to {@link UnsignedLong}
+ * FIXME: Should be changed to {@link UnsignedLong}.
  *
  * @author ttkacik
  *
  * @param <T>
  *          Output type of serialization.
  */
-public interface Uint64Codec<T> extends Codec<T,BigInteger> {
+public interface Uint64Codec<T> extends Codec<T, BigInteger> {
     @Override
     T serialize(BigInteger data);
 
index d35c218f691d6420575b20de09375529e92fed99..299bf3d4cf71eacfab1a0b6baa94fd0abbdfda40 100644 (file)
@@ -10,15 +10,14 @@ package org.opendaylight.yangtools.yang.data.api.codec;
 import org.opendaylight.yangtools.concepts.Codec;
 
 /**
- *
- * FIXME: Should be changed to UnsignedByte
+ * FIXME: Should be changed to UnsignedByte.
  *
  * @author ttkacik
  *
  * @param <T>
  *          Output type of serialization.
  */
-public interface Uint8Codec<T> extends Codec<T,Short> {
+public interface Uint8Codec<T> extends Codec<T, Short> {
     @Override
     T serialize(Short data);
 
index cff313dc95097ec40475bfa831ac435ad69f6dbb..a7e4bdcd29ec5e9668f971c76757910de87422db 100644 (file)
@@ -20,8 +20,10 @@ public interface AnyXmlNode extends AttributesContainer, DataContainerChild<Node
     NodeIdentifier getIdentifier();
 
     /**
+     * Return value represented as a DOMSource. Returned source contains top level element
+     * that duplicates the anyxml node.
+     *
      * @return anyxml node value represented as DOMSource.
-     * Returned source contains top level element that duplicates the anyxml node.
      */
     @Override
     DOMSource getValue();
index 0c24bd8bb0886056a22670046176df757e1ef463..5a6d338e132757a87e682fb7c60c9c297dda7b04 100644 (file)
@@ -15,30 +15,26 @@ import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
 /**
  * Data instance of <code>augment</code> associated with parent node.
  *
+ * <p>
  * Augmentation is addition of subtree defined by other external YANG Model and
  * is schema for subtree is described by instance of  {@link AugmentationSchema}
  * associated with parent node of this node.
  *
+ * <p>
  * Augmentation node MUST NOT be direct child of other augmentation node.
- *
  */
 public interface AugmentationNode extends MixinNode, DataContainerNode<AugmentationIdentifier>,
     DataContainerChild<AugmentationIdentifier, Collection<DataContainerChild<? extends PathArgument, ?>>> {
 
     /**
-     * Gets identifier of augmentation node
-     *
-     * Returned identifier of augmentation node contains all possible
+     * Gets identifier of augmentation node. Returned identifier of augmentation node contains all possible
      * direct child QNames.
      *
-     * This is sufficient to identify instance of augmentation,
-     * since RFC6020 states that <code>augment</code> that augment
-     * statement must not add multiple nodes from same namespace
-     * / module
-     * to the target node.
+     * <p>
+     * This is sufficient to identify instance of augmentation, since RFC6020 states that <code>augment</code>
+     * that augment statement must not add multiple nodes from same namespace / module to the target node.
      *
      * @return Identifier which uniquelly identifies augmentation in particular subtree.
-     *
      */
     @Override
     AugmentationIdentifier getIdentifier();
index a073d1b6d110c25cbb9990ce2618365245164479..54761d96ff79c6af65e9efcd6d585ac63dc0663c 100644 (file)
@@ -14,19 +14,20 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgum
 /**
  * Node representing data instance of <code>choice</code>.
  *
+ * <p>
  * Choice node is instance of one of possible alternatives, from which only one is allowed to exist at one time in
  * particular context of parent node.
  *
+ * <p>
  * YANG Model and schema for choice is described by instance of
  * {@link org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode}.
  *
+ * <p>
  * Valid alternatives of subtree are described by instances of
  * {@link org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode}, which are retrieved via
  * {@link org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode#getCases()}.
  */
-public interface ChoiceNode extends //
-        MixinNode, //
-        DataContainerNode<NodeIdentifier>,
+public interface ChoiceNode extends MixinNode, DataContainerNode<NodeIdentifier>,
         DataContainerChild<NodeIdentifier, Collection<DataContainerChild<? extends PathArgument, ?>>> {
 
 }
index ee42baadb4d4b2148a456d77a9c82809b00a2f71..082c31295bce6d9e5a11d7bd5ca2a456e4d7d0d9 100644 (file)
@@ -13,16 +13,16 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 
 /**
- * Data subtree with cardinality 0..1 in the context of parent node
+ * Data subtree with cardinality 0..1 in the context of parent node.
  *
+ * <p>
  * Node which does not have value but contains valid {@link DataContainerChild} nodes.
  *
- * Schema of this node is described by instance of {@link org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode}.
- *
+ * <p>
+ * Schema of this node is described by instance of
+ * {@link org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode}.
  */
-public interface ContainerNode extends //
-        AttributesContainer,
-        DataContainerNode<NodeIdentifier>,
+public interface ContainerNode extends AttributesContainer, DataContainerNode<NodeIdentifier>,
         DataContainerChild<NodeIdentifier, Collection<DataContainerChild<? extends PathArgument, ?>>> {
 
 }
index 2b5366d71e9557deface981dd0353e95725b10f5..993949296a5892b39ab3de2f764c82f69a337bac 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.yangtools.yang.data.api.schema;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 
 /**
- *
  * Marker interface for direct children of {@link DataContainerNode}.
  *
  * <h3>Implementation notes</h3>
@@ -23,13 +22,12 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgum
  * <li>{@link ChoiceNode}
  * <li>{@link MapNode}
  * <li>{@link AugmentationNode}
- *</ul>
+ * </ul>
  *
  * @param <K> Path Argument Type which is used to identify node
  * @param <V> Value type
  */
 public interface DataContainerChild<K extends PathArgument,V> extends NormalizedNode<K, V> {
-
     @Override
     K getIdentifier();
 }
index 270f46331e7a6ae0f6fa3a64979363c9ccb91d8f..341c41a5da38828657a6e68cc7afd23baed67462 100644 (file)
@@ -11,11 +11,10 @@ import java.util.Collection;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 
 /**
- *
  * Abstract node which does not have value but contains valid {@link DataContainerChild} nodes.
- *
  * Schema of this node is described by instance of {@link org.opendaylight.yangtools.yang.model.api.DataNodeContainer}.
  *
+ * <p>
  * <h2>Implementation notes</h2>
  * This interface should not be implemented directly, but rather implementing one of it's subclasses
  * <ul>
@@ -30,14 +29,12 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgum
  */
 public interface DataContainerNode<K extends PathArgument> extends //
         NormalizedNodeContainer<K, PathArgument, DataContainerChild<? extends PathArgument, ?>> {
-
     /**
-     * Returns iteration of all child nodes
-     *
+     * Returns iteration of all child nodes.
      * Order of returned child nodes may be defined by subinterfaces.
      *
-     * <b>Implementation Notes:</b>
      * <p>
+     * <b>Implementation Notes:</b>
      * All nodes returned in this iterable, MUST also be accessible via
      * {@link #getChild(PathArgument)} using their associated identifier.
      *
index 8dcdfde984d3a093c7e7bdd3bf29938a4615c4cf..5ec80151ee0c6a9661924c08daf567cf88009822 100644 (file)
@@ -11,8 +11,9 @@ import org.opendaylight.yangtools.yang.data.api.AttributesContainer;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 
 /**
- * Leaf node with multiplicity 0..1
+ * Leaf node with multiplicity 0..1.
  *
+ * <p>
  * Leaf node has a value, but no child nodes in the data tree, schema
  * for leaf node and its value is described by {@link org.opendaylight.yangtools.yang.model.api.LeafSchemaNode}.
  *
@@ -20,9 +21,8 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
  */
 public interface LeafNode<T> extends AttributesContainer, DataContainerChild<NodeIdentifier, T>,
         ValueNode<NodeIdentifier, T> {
-
     /**
-     * Returns value of this leaf node
+     * Returns value of this leaf node.
      *
      * @return Returned value of this leaf node. Value SHOULD meet criteria defined by schema.
      */
index ede054e45ab6149828afebc135ab755346a8880b..5c5d8603cface33d3208e3bf1734aa400cda9c2f 100644 (file)
@@ -11,9 +11,9 @@ import org.opendaylight.yangtools.yang.data.api.AttributesContainer;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
 
 /**
+ * Leaf node with multiplicity 0...n.
  *
- * Leaf node with multiplicity 0...n
- *
+ * <p>
  * Leaf node has a value, but no child nodes in the data tree, schema
  * for leaf node and its value is described by
  * {@link org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode}.
@@ -23,12 +23,11 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithV
  */
 public interface LeafSetEntryNode<T> extends AttributesContainer, NormalizedNode<NodeWithValue, T>,
         ValueNode<NodeWithValue, T> {
-
     /**
      * Returns {@link NodeWithValue} which identifies this leaf set entry.
-     *
      * Returned {@link NodeWithValue} contains same value as this node.
      *
+     * <p>
      * <h3>Implementation notes</h3> Invocation of
      * {@link NodeWithValue#getValue()} on returned instance of
      * {@link NodeWithValue} must returns
@@ -36,7 +35,6 @@ public interface LeafSetEntryNode<T> extends AttributesContainer, NormalizedNode
      * following condition is allways met:
      * <code>true == this.getIdentifier().getValue().equals(this.getValue())</code>
      *
-     *
      * @return {@link NodeWithValue} which identifies this leaf set entry.
      */
     @Override
index 35f4fb43ff192b29ec7656e690dd5eaab15535dd..3b42c44686deca71dffe0c445f1089a2f10389b7 100644 (file)
@@ -12,11 +12,11 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
 
 /**
- * Node representing set of simple leaf nodes.
+ * Node representing set of simple leaf nodes. Node containing instances of {@link LeafSetEntryNode}.
  *
- * Node containing instances of {@link LeafSetEntryNode}
- *
- * Schema and semantics of this node are described by instance of {@link org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode}.
+ * <p>
+ * Schema and semantics of this node are described by instance of
+ * {@link org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode}.
  *
  * @param <T> Type of leaf node values.
  */
index e2252063a7d51eca42f72191b6364a637a4a8631..5e848e89df9a56fb6b269ee69bcb8ca4679b0ddc 100644 (file)
@@ -11,16 +11,13 @@ import org.opendaylight.yangtools.yang.data.api.AttributesContainer;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 
 /**
- *
  * Instance of Map entry, this node does not contains value, but child nodes.
- *
  */
 public interface MapEntryNode extends AttributesContainer, DataContainerNode<NodeIdentifierWithPredicates> {
-
     /**
-     *
      * Returns identifier of this node in parent map node
      *
+     * <p>
      * Contents of identifier is defined by <code>key</code> (
      * {@link org.opendaylight.yangtools.yang.model.api.ListSchemaNode#getKeyDefinition()}
      * ) statement in YANG schema for associated list item and child {@link LeafNode}s
@@ -31,5 +28,4 @@ public interface MapEntryNode extends AttributesContainer, DataContainerNode<Nod
      */
     @Override
     NodeIdentifierWithPredicates getIdentifier();
-
 }
index e5631d4e7f387d65e1310c1de88069d074258d86..fc602d56331ea0dee438aa93a39cf73ee8d03de7 100644 (file)
@@ -15,14 +15,12 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
  * Containment node, which contains {@link MapEntryNode} of the same type, which may
  * be quickly retrieved using key.
  *
+ * <p>
  * This node maps to the list node in YANG schema, schema and semantics of this node,
  * its children and key construction is  defined by YANG <code>list</code>
  * statement and its <code>key</code> and <code>ordered-by</code> substatements.
- *
  */
-public interface MapNode extends //
-        MixinNode,
-        DataContainerChild<NodeIdentifier, Collection<MapEntryNode>>,
+public interface MapNode extends MixinNode, DataContainerChild<NodeIdentifier, Collection<MapEntryNode>>,
         NormalizedNodeContainer<NodeIdentifier, NodeIdentifierWithPredicates, MapEntryNode> {
 
 }
index f0d8e401c698ee8d238f8dbdedc67b1ff739f716..d39bdf9ddf65766a561294874d0ab07d73618a8d 100644 (file)
@@ -8,11 +8,9 @@
 package org.opendaylight.yangtools.yang.data.api.schema;
 
 /**
- *
  * Marker interface for nodes, which are mixins - their content
  * belongs to parent node and in serialized form this node
  * does not exists, but it's children are present.
- *
  */
 public interface MixinNode {
 
index deb69732bcc39dc8493021048f3895381e510077..700f0f5bc203a49aa32b61a9e8abac30298691fd 100644 (file)
@@ -12,12 +12,11 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 
 /**
- *
  * Node which is normalized according to the YANG schema
  * is identifiable by a {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier}.
  *
- * See subinterfaces of this interface for concretization
- * of node.
+ * <p>
+ * See subinterfaces of this interface for concretization of node.
  *
  * @param <K> Local identifier of node
  * @param <V> Value of node
index e10f31d03ebaeefd459d7431eeb203387f36a657..b4cd9efc9b5470f7c68872c119b893fa87b2be49 100644 (file)
@@ -14,11 +14,12 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgum
 /**
  * Node which is not leaf, but has child {@link NormalizedNode}s as its valzue.
  *
- *
+ * <p>
  * NormalizedNodeContainer does not have a value, but it has a child
  * nodes. Definition of possible and valid child nodes is introduced
  * in subclasses of this interface.
  *
+ * <p>
  * This interface should not be used directly, but rather use of of derived subinterfaces
  * such as {@link DataContainerNode}, {@link MapNode}, {@link LeafSetNode}.
  *
@@ -29,8 +30,8 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgum
  * @param <V>
  *            Child Node type
  */
-public interface NormalizedNodeContainer<I extends PathArgument, K extends PathArgument, V extends NormalizedNode<? extends K, ?>>
-        extends NormalizedNode<I, Collection<V>> {
+public interface NormalizedNodeContainer<I extends PathArgument, K extends PathArgument,
+       V extends NormalizedNode<? extends K, ?>> extends NormalizedNode<I, Collection<V>> {
 
     @Override
     I getIdentifier();
index 34d23c5a3e84cf41f333f056b63b651b19ad3cfc..154a163a66f6394edeb2b225de845b8094a74acf 100644 (file)
@@ -34,12 +34,14 @@ public final class NormalizedNodes {
         throw new UnsupportedOperationException("Utility class should not be instantiated");
     }
 
-    public static Optional<NormalizedNode<?, ?>> findNode(final YangInstanceIdentifier rootPath, final NormalizedNode<?, ?> rootNode, final YangInstanceIdentifier childPath) {
+    public static Optional<NormalizedNode<?, ?>> findNode(final YangInstanceIdentifier rootPath,
+            final NormalizedNode<?, ?> rootNode, final YangInstanceIdentifier childPath) {
         final Optional<YangInstanceIdentifier> relativePath = childPath.relativeTo(rootPath);
         return relativePath.isPresent() ? findNode(rootNode, relativePath.get()) : Optional.absent();
     }
 
-    public static Optional<NormalizedNode<?, ?>> findNode(final Optional<NormalizedNode<?, ?>> parent, final Iterable<PathArgument> relativePath) {
+    public static Optional<NormalizedNode<?, ?>> findNode(final Optional<NormalizedNode<?, ?>> parent,
+            final Iterable<PathArgument> relativePath) {
         checkNotNull(parent, "Parent must not be null");
         checkNotNull(relativePath, "Relative path must not be null");
 
@@ -51,19 +53,23 @@ public final class NormalizedNodes {
         return currentNode;
     }
 
-    public static Optional<NormalizedNode<?, ?>> findNode(final Optional<NormalizedNode<?, ?>> parent, final PathArgument... relativePath) {
+    public static Optional<NormalizedNode<?, ?>> findNode(final Optional<NormalizedNode<?, ?>> parent,
+            final PathArgument... relativePath) {
         return findNode(parent, Arrays.asList(relativePath));
     }
 
-    public static Optional<NormalizedNode<?, ?>> findNode(final NormalizedNode<?, ?> parent, final Iterable<PathArgument> relativePath) {
+    public static Optional<NormalizedNode<?, ?>> findNode(final NormalizedNode<?, ?> parent,
+            final Iterable<PathArgument> relativePath) {
         return findNode(Optional.fromNullable(parent), relativePath);
     }
 
-    public static Optional<NormalizedNode<?, ?>> findNode(final NormalizedNode<?, ?> parent, final PathArgument... relativePath) {
+    public static Optional<NormalizedNode<?, ?>> findNode(final NormalizedNode<?, ?> parent,
+            final PathArgument... relativePath) {
         return findNode(parent, Arrays.asList(relativePath));
     }
 
-    public static Optional<NormalizedNode<?, ?>> findNode(final NormalizedNode<?, ?> tree, final YangInstanceIdentifier path) {
+    public static Optional<NormalizedNode<?, ?>> findNode(final NormalizedNode<?, ?> tree,
+            final YangInstanceIdentifier path) {
         checkNotNull(tree, "Tree must not be null");
         checkNotNull(path, "Path must not be null");
 
@@ -71,7 +77,8 @@ public final class NormalizedNodes {
     }
 
     @SuppressWarnings({ "unchecked", "rawtypes" })
-    public static Optional<NormalizedNode<?, ?>> getDirectChild(final NormalizedNode<?, ?> node, final PathArgument pathArg) {
+    public static Optional<NormalizedNode<?, ?>> getDirectChild(final NormalizedNode<?, ?> node,
+            final PathArgument pathArg) {
         if (node instanceof LeafNode<?> || node instanceof LeafSetEntryNode<?>) {
             return Optional.absent();
         } else if (node instanceof DataContainerNode<?>) {
@@ -117,8 +124,8 @@ public final class NormalizedNodes {
 
     private static String toStringTree(final PathArgument identifier) {
         if (identifier instanceof NodeIdentifierWithPredicates) {
-            return identifier.getNodeType().getLocalName() +
-                    ((NodeIdentifierWithPredicates) identifier).getKeyValues().values();
+            return identifier.getNodeType().getLocalName()
+                + ((NodeIdentifierWithPredicates) identifier).getKeyValues().values();
         } else if (identifier instanceof AugmentationIdentifier) {
             return "augmentation";
         } else {
index 11bc39a28e8bf025c507e49cd62cf7909bf5c5e0..062ea08aaf01b7a1e048bccf421d1a999dfd7cc5 100644 (file)
@@ -7,14 +7,14 @@
  */
 package org.opendaylight.yangtools.yang.data.api.schema;
 
-
 /**
- *
  * Leaf set node which preserves user-supplied ordering.
  *
+ * <p>
  * This node represents a data instance of <code>leaf-list</code> with
  * <code>ordered-by user;</code> substatement.
  *
+ * <p>
  * Except preserving user-ordering all other semantics and behaviour is same
  * as in {@link LeafSetNode}.
  *
index 7c3363d7c8bfb22707479e4ed70d43f2860f2370..bfe6dae702f57940a1ece6c85d6e38be6c2bbf33 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.yangtools.yang.data.api.schema;
 
 /**
- *
  * Map node which preserves user-supplied ordering.
  *
  * <p>
@@ -18,7 +17,6 @@ package org.opendaylight.yangtools.yang.data.api.schema;
  * <p>
  * Except preserving user-ordering all other semantics and behaviour is same as
  * in {@link MapNode}.
- *
  */
 public interface OrderedMapNode extends MapNode, OrderedNodeContainer<MapEntryNode> {
 
index 628383ceed8734849db8513845b4a57af3eee739..4516d77c7234d421179e2aea4d10175705f4cd71 100644 (file)
@@ -11,16 +11,15 @@ import java.util.Collection;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 
 /**
- *
  * Normalized Node container which preserves user supplied ordering
  * and allows addressing of child elements by position.
  *
  * @param <V> child type
  */
-public interface OrderedNodeContainer<V extends NormalizedNode<?, ?>> extends MixinNode, NormalizedNode<NodeIdentifier, Collection<V>> {
-
+public interface OrderedNodeContainer<V extends NormalizedNode<?, ?>> extends MixinNode,
+       NormalizedNode<NodeIdentifier, Collection<V>> {
     /**
-     * Returns child node by position
+     * Returns child node by position.
      *
      * @param position Position of child node
      * @return Child Node
@@ -29,7 +28,7 @@ public interface OrderedNodeContainer<V extends NormalizedNode<?, ?>> extends Mi
     V getChild(int position);
 
     /**
-     * Returns count of child nodes
+     * Returns count of child nodes.
      *
      * @return count of child nodes.
      */
index 03294a3fd351579c7d3e13a535dc0e61942cf4d8..4f7ef2ebf4bca0ee3cf14097a8450d2fd820b23e 100644 (file)
@@ -11,14 +11,12 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 
 /**
  * List entry node, which does not have value, but child nodes.
- *
  * Represents an instance of data, which schema is instance of
  * {@link org.opendaylight.yangtools.yang.model.api.ListSchemaNode} with key undefined.
  *
+ * <p>
  * This nodes itself does not contain any ordering information, user supplied
  * ordering is preserved by parent node, which is instance of {@link UnkeyedListNode}.
- *
- *
  */
 public interface UnkeyedListEntryNode extends DataContainerNode<NodeIdentifier> {
 
index dfa06938e7de873f8b8b3ae6a32800bbd8f69702..63ab2cd167bcdbe1f7e1a36256cb127e5cb6970e 100644 (file)
@@ -10,9 +10,7 @@ package org.opendaylight.yangtools.yang.data.api.schema;
 import java.util.Collection;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 
-
 /**
- *
  * Containment node, which contains {@link UnkeyedListEntryNode} of the same type, which may
  * be quickly retrieved using key.
  *
@@ -24,10 +22,8 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
  * Ordering of the elements is user-defined during construction of instance of this
  * interface. Ordered view of elements (iteration)
  * is provided by {@link #getValue()} call.
- *
  */
-public interface UnkeyedListNode extends
-    DataContainerChild<NodeIdentifier, Collection<UnkeyedListEntryNode>>,
+public interface UnkeyedListNode extends DataContainerChild<NodeIdentifier, Collection<UnkeyedListEntryNode>>,
     OrderedNodeContainer<UnkeyedListEntryNode> {
 
 }
index 4bb7f049b086393678bb236c44bc507740e9e02a..3b31e3f3da53aaa67170c1fe91c8c0f3e59dc3e1 100644 (file)
@@ -24,7 +24,9 @@ public interface YangModeledAnyXmlNode extends AttributesContainer, DataContaine
         DataContainerChild<NodeIdentifier, Collection<DataContainerChild<? extends PathArgument, ?>>> {
 
     /**
-     * @return DataSchemaNode - schema of contained XML data
+     * Returns the schema corresponding to the node's datea.
+     *
+     * @return schema of contained XML data
      */
     @Nonnull
     ContainerSchemaNode getSchemaOfAnyXmlData();
index 7976bc68afd0301cba9d263312d3f8995cb1bfe4..9ea4d9cc66cdda6166f5235a74289263ffe653e6 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 /**
- *
  * Definition of normalized YANG DOM Model
  *
  * Normalized DOM Model brings more direct mapping between YANG Model, DOM
  * <h3>Tree / subtree structure</h3> <h4>Grammar representation</h4>
  *
  * <pre>
- *  {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier} = {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument}*
- *  {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument} = {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier}| {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates}| {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue} | {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier}
+ *  {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier} =
+ *    {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument}*
+ *  {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument} =
+ *    {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier}
+ *    | {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates}
+ *    | {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue}
+ *    | {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier}
  *
  *  TreeRoot = {@link org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode}
- *  {@link org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode} = ( {@link org.opendaylight.yangtools.yang.data.api.schema.LeafNode} | {@link org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode} | {@link org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode} | {@link org.opendaylight.yangtools.yang.data.api.schema.MapNode} | {@link org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode})*
- *  ContainerDataNode = {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier} {@link org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode}
+ *  {@link org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode} =
+ *    ( {@link org.opendaylight.yangtools.yang.data.api.schema.LeafNode}
+ *     | {@link org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode}
+ *     | {@link org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode}
+ *     | {@link org.opendaylight.yangtools.yang.data.api.schema.MapNode}
+ *     | {@link org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode})*
+ *  ContainerDataNode =
+ *    {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier}
+ *    {@link org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode}
  *
- *  {@link org.opendaylight.yangtools.yang.data.api.schema.LeafNode} = {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier} SimpleValue
- *  {@link org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode} = {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier} {@link org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode}
- *  {@link org.opendaylight.yangtools.yang.data.api.schema.MapNode} = {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier} {@link org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode}
- *  {@link org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode} = {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates} {@link org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode}
+ *  {@link org.opendaylight.yangtools.yang.data.api.schema.LeafNode} =
+ *    {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier} SimpleValue
+ *  {@link org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode} =
+ *    {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier}
+ *    {@link org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode}
+ *  {@link org.opendaylight.yangtools.yang.data.api.schema.MapNode} =
+ *    {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier}
+ *    {@link org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode}
+ *  {@link org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode} =
+ *    {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates}
+ *    {@link org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode}
  *
  *  // Special nodes
- *  {@link org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode} = {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier} {@link org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode}*
- *  {@link org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode} = {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier} {@link org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode}
- *  {@link org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode} = {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue} SimpleValue
+ *  {@link org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode} =
+ *    {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier}
+ *    {@link org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode}*
+ *  {@link org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode} =
+ *    {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier}
+ *    {@link org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode}
+ *  {@link org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode} =
+ *    {@link org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue} SimpleValue
  * </pre>
  *
  * The resulting tree organization is following:
  * code using these interfaces.
  *
  */
-package org.opendaylight.yangtools.yang.data.api.schema;
\ No newline at end of file
+package org.opendaylight.yangtools.yang.data.api.schema;
index 08104f8c064050f236e0c3bfba3405b0ce6ef235..56876652a47890da96a7fdd48bb45a1693f1ae1d 100644 (file)
@@ -13,7 +13,8 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 
-public abstract class ForwardingNormalizedNodeStreamAttributeWriter extends ForwardingNormalizedNodeStreamWriter implements NormalizedNodeStreamAttributeWriter {
+public abstract class ForwardingNormalizedNodeStreamAttributeWriter extends ForwardingNormalizedNodeStreamWriter
+        implements NormalizedNodeStreamAttributeWriter {
     @Override
     protected abstract NormalizedNodeStreamAttributeWriter delegate();
 
@@ -24,7 +25,8 @@ public abstract class ForwardingNormalizedNodeStreamAttributeWriter extends Forw
     }
 
     @Override
-    public void leafSetEntryNode(final QName name, final Object value, final Map<QName, String> attributes) throws IOException {
+    public void leafSetEntryNode(final QName name, final Object value, final Map<QName, String> attributes)
+            throws IOException {
         delegate().leafSetEntryNode(name, value, attributes);
     }
 
index 7377b34eb65e36314d67f82a42fb15a723cd6d31..9f6da2fc1e692e55e798122f2eead8d9921dba66 100644 (file)
@@ -14,7 +14,8 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.Augmentat
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 
-public abstract class ForwardingNormalizedNodeStreamWriter extends ForwardingObject implements NormalizedNodeStreamWriter {
+public abstract class ForwardingNormalizedNodeStreamWriter extends ForwardingObject
+        implements NormalizedNodeStreamWriter {
     @Override
     protected abstract NormalizedNodeStreamWriter delegate();
 
index f28d75c82fe440a32bcf956f4ba9d56cfa256726..bcd89e6a7bcf7dffade0bcaf22755eed44b9bd9a 100644 (file)
@@ -13,19 +13,24 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
- * Extension to the NormalizedNodeStreamWriter with attribute support
+ * Extension to the NormalizedNodeStreamWriter with attribute support.
  */
 public interface NormalizedNodeStreamAttributeWriter extends NormalizedNodeStreamWriter {
 
-    void leafNode(YangInstanceIdentifier.NodeIdentifier name, Object value, Map<QName, String> attributes) throws IOException;
+    void leafNode(YangInstanceIdentifier.NodeIdentifier name, Object value, Map<QName, String> attributes)
+            throws IOException;
 
     void leafSetEntryNode(QName name, Object value, Map<QName, String> attributes) throws IOException;
 
-    void startContainerNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint, Map<QName, String> attributes) throws IOException;
+    void startContainerNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint,
+            Map<QName, String> attributes) throws IOException;
 
-    void startYangModeledAnyXmlNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint, Map<QName, String> attributes) throws IOException;
+    void startYangModeledAnyXmlNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint,
+            Map<QName, String> attributes) throws IOException;
 
-    void startUnkeyedListItem(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint, Map<QName, String> attributes) throws IOException;
+    void startUnkeyedListItem(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint,
+            Map<QName, String> attributes) throws IOException;
 
-    void startMapEntryNode(YangInstanceIdentifier.NodeIdentifierWithPredicates identifier, int childSizeHint, Map<QName, String> attributes) throws IOException;
+    void startMapEntryNode(YangInstanceIdentifier.NodeIdentifierWithPredicates identifier, int childSizeHint,
+            Map<QName, String> attributes) throws IOException;
 }
index 059ed1b0e4dbcf48aaa00edc0778fcc2b5a79298..f07aa0dabfa6d932fb8e3d7adc00e59444d553d6 100644 (file)
@@ -90,6 +90,7 @@ public interface NormalizedNodeStreamWriter extends Closeable, Flushable {
      * completely, but if they do use them, they are expected to be resilient in
      * face of missing and mismatched hints, which is to say the user can
      * specify startLeafSet(..., 1) and then call leafNode() 15 times.
+     *
      * <p>
      * The acceptable hint values are non-negative integers and this constant,
      * all other values will result, based on implementation preference, in the
@@ -98,7 +99,6 @@ public interface NormalizedNodeStreamWriter extends Closeable, Flushable {
     int UNKNOWN_SIZE = -1;
 
     /**
-     *
      * Emits a leaf node event with supplied value.
      *
      * @param name
@@ -117,8 +117,8 @@ public interface NormalizedNodeStreamWriter extends Closeable, Flushable {
     void leafNode(NodeIdentifier name, Object value) throws IOException;
 
     /**
-     *
      * Emits a start of leaf set (leaf-list).
+     *
      * <p>
      * Emits start of leaf set, during writing leaf set event, only
      * {@link #leafSetEntryNode(QName, Object)} calls are valid. Leaf set event is
@@ -143,8 +143,8 @@ public interface NormalizedNodeStreamWriter extends Closeable, Flushable {
     void startLeafSet(NodeIdentifier name, int childSizeHint) throws IOException;
 
     /**
-     *
      * Emits a start of leaf set (leaf-list).
+     *
      * <p>
      * Emits start of leaf set, during writing leaf set event, only
      * {@link #leafSetEntryNode(QName, Object)} calls are valid. Leaf set event is
@@ -169,7 +169,7 @@ public interface NormalizedNodeStreamWriter extends Closeable, Flushable {
     void startOrderedLeafSet(NodeIdentifier name, int childSizeHint) throws IOException, IllegalArgumentException;
 
     /**
-     * Emits a leaf set entry node
+     * Emits a leaf set entry node.
      *
      * @param name
      *            name of the node as defined in the schema.
@@ -184,7 +184,6 @@ public interface NormalizedNodeStreamWriter extends Closeable, Flushable {
     void leafSetEntryNode(QName name, Object value) throws IOException;
 
     /**
-     *
      * Emits start of new container.
      *
      * <p>
@@ -221,7 +220,6 @@ public interface NormalizedNodeStreamWriter extends Closeable, Flushable {
     void startContainerNode(NodeIdentifier name, int childSizeHint) throws IOException;
 
     /**
-     *
      * Emits start of unkeyed list node event.
      *
      * <p>
@@ -276,7 +274,6 @@ public interface NormalizedNodeStreamWriter extends Closeable, Flushable {
     void startUnkeyedListItem(NodeIdentifier name, int childSizeHint) throws IOException;
 
     /**
-     *
      * Emits start of map node event.
      *
      * <p>
@@ -304,7 +301,6 @@ public interface NormalizedNodeStreamWriter extends Closeable, Flushable {
     void startMapNode(NodeIdentifier name, int childSizeHint) throws IOException;
 
     /**
-     *
      * Emits start of map entry.
      *
      * <p>
@@ -339,7 +335,6 @@ public interface NormalizedNodeStreamWriter extends Closeable, Flushable {
     void startMapEntryNode(NodeIdentifierWithPredicates identifier, int childSizeHint) throws IOException;
 
     /**
-     *
      * Emits start of map node event.
      *
      * <p>
@@ -367,8 +362,7 @@ public interface NormalizedNodeStreamWriter extends Closeable, Flushable {
     void startOrderedMapNode(NodeIdentifier name, int childSizeHint) throws IOException;
 
     /**
-     *
-     *
+     * Emits start of a choice node event.
      *
      * @param name
      *            name of node as defined in schema, namespace and revision are
@@ -433,38 +427,37 @@ public interface NormalizedNodeStreamWriter extends Closeable, Flushable {
     void anyxmlNode(NodeIdentifier name, Object value) throws IOException;
 
     /**
-    *
-    * Emits start of new yang modeled anyXml node.
-    *
-    * <p>
-    * End of yang modeled anyXml node event is emitted by invoking {@link #endNode()}.
-    *
-    * <p>
-    * Valid sub-events are:
-    * <ul>
-    * <li>{@link #leafNode}</li>
-    * <li>{@link #startContainerNode}</li>
-    * <li>{@link #startLeafSet}</li>
-    * <li>{@link #startMapNode}</li>
-    * <li>{@link #startUnkeyedList}</li>
-    * </ul>
-    *
-    * @param name
-    *            name of node as defined in schema, namespace and revision are
-    *            derived from parent node.
-    * @param childSizeHint
-    *            Non-negative count of expected direct child nodes or
-    *            {@link #UNKNOWN_SIZE} if count is unknown. This is only hint
-    *            and should not fail writing of child events, if there are more
-    *            events than count.
-    * @throws IllegalArgumentException
-    *             If emitted node is invalid in current context or was emitted
-    *             multiple times.
-    * @throws IllegalStateException
-    *             If node was emitted inside <code>map</code>,
-    *             <code>choice</code> <code>unkeyed list</code> node.
-    * @throws IOException if an underlying IO error occurs
-    */
+     * Emits start of new yang modeled anyXml node.
+     *
+     * <p>
+     * End of yang modeled anyXml node event is emitted by invoking {@link #endNode()}.
+     *
+     * <p>
+     * Valid sub-events are:
+     * <ul>
+     * <li>{@link #leafNode}</li>
+     * <li>{@link #startContainerNode}</li>
+     * <li>{@link #startLeafSet}</li>
+     * <li>{@link #startMapNode}</li>
+     * <li>{@link #startUnkeyedList}</li>
+     * </ul>
+     *
+     * @param name
+     *            name of node as defined in schema, namespace and revision are
+     *            derived from parent node.
+     * @param childSizeHint
+     *            Non-negative count of expected direct child nodes or
+     *            {@link #UNKNOWN_SIZE} if count is unknown. This is only hint
+     *            and should not fail writing of child events, if there are more
+     *            events than count.
+     * @throws IllegalArgumentException
+     *             If emitted node is invalid in current context or was emitted
+     *             multiple times.
+     * @throws IllegalStateException
+     *             If node was emitted inside <code>map</code>,
+     *             <code>choice</code> <code>unkeyed list</code> node.
+     * @throws IOException if an underlying IO error occurs
+     */
     void startYangModeledAnyXmlNode(NodeIdentifier name, int childSizeHint) throws IOException;
 
     /**
index 29702b22f1223041adb9cc557cf7527f95ce10e5..62e221c307f9c5562fd9bd5417bb2064c3389b9a 100644 (file)
@@ -68,20 +68,20 @@ public class NormalizedNodeWriter implements Closeable, Flushable {
     }
 
     /**
-     * Create a new writer backed by a {@link NormalizedNodeStreamWriter}. Unlike the simple {@link #forStreamWriter(NormalizedNodeStreamWriter)}
-     * method, this allows the caller to switch off RFC6020 XML compliance, providing better
-     * throughput. The reason is that the XML mapping rules in RFC6020 require the encoding
-     * to emit leaf nodes which participate in a list's key first and in the order in which
-     * they are defined in the key. For JSON, this requirement is completely relaxed and leaves
-     * can be ordered in any way we see fit. The former requires a bit of work: first a lookup
-     * for each key and then for each emitted node we need to check whether it was already
-     * emitted.
+     * Create a new writer backed by a {@link NormalizedNodeStreamWriter}. Unlike the simple
+     * {@link #forStreamWriter(NormalizedNodeStreamWriter)} method, this allows the caller to switch off RFC6020 XML
+     * compliance, providing better throughput. The reason is that the XML mapping rules in RFC6020 require
+     * the encoding to emit leaf nodes which participate in a list's key first and in the order in which they are
+     * defined in the key. For JSON, this requirement is completely relaxed and leaves can be ordered in any way we
+     * see fit. The former requires a bit of work: first a lookup for each key and then for each emitted node we need
+     * to check whether it was already emitted.
      *
      * @param writer Back-end writer
      * @param orderKeyLeaves whether the returned instance should be RFC6020 XML compliant.
      * @return A new instance.
      */
-    public static NormalizedNodeWriter forStreamWriter(final NormalizedNodeStreamWriter writer, final boolean orderKeyLeaves) {
+    public static NormalizedNodeWriter forStreamWriter(final NormalizedNodeStreamWriter writer,
+            final boolean orderKeyLeaves) {
         return orderKeyLeaves ? new OrderedNormalizedNodeWriter(writer) : new NormalizedNodeWriter(writer);
     }
 
@@ -142,7 +142,8 @@ public class NormalizedNodeWriter implements Closeable, Flushable {
         } else if (node instanceof LeafNode) {
             final LeafNode<?> nodeAsLeaf = (LeafNode<?>)node;
             if (writer instanceof NormalizedNodeStreamAttributeWriter) {
-                ((NormalizedNodeStreamAttributeWriter) writer).leafNode(nodeAsLeaf.getIdentifier(), nodeAsLeaf.getValue(), nodeAsLeaf.getAttributes());
+                ((NormalizedNodeStreamAttributeWriter) writer).leafNode(nodeAsLeaf.getIdentifier(),
+                    nodeAsLeaf.getValue(), nodeAsLeaf.getAttributes());
             } else {
                 writer.leafNode(nodeAsLeaf.getIdentifier(), nodeAsLeaf.getValue());
             }
@@ -186,7 +187,8 @@ public class NormalizedNodeWriter implements Closeable, Flushable {
         if (node instanceof ContainerNode) {
             final ContainerNode n = (ContainerNode) node;
             if (writer instanceof NormalizedNodeStreamAttributeWriter) {
-                ((NormalizedNodeStreamAttributeWriter) writer).startContainerNode(n.getIdentifier(), childSizeHint(n.getValue()), n.getAttributes());
+                ((NormalizedNodeStreamAttributeWriter) writer).startContainerNode(n.getIdentifier(),
+                    childSizeHint(n.getValue()), n.getAttributes());
             } else {
                 writer.startContainerNode(n.getIdentifier(), childSizeHint(n.getValue()));
             }
@@ -195,7 +197,8 @@ public class NormalizedNodeWriter implements Closeable, Flushable {
         if (node instanceof YangModeledAnyXmlNode) {
             final YangModeledAnyXmlNode n = (YangModeledAnyXmlNode) node;
             if (writer instanceof NormalizedNodeStreamAttributeWriter) {
-                ((NormalizedNodeStreamAttributeWriter) writer).startYangModeledAnyXmlNode(n.getIdentifier(), childSizeHint(n.getValue()), n.getAttributes());
+                ((NormalizedNodeStreamAttributeWriter) writer).startYangModeledAnyXmlNode(n.getIdentifier(),
+                    childSizeHint(n.getValue()), n.getAttributes());
             } else {
                 writer.startYangModeledAnyXmlNode(n.getIdentifier(), childSizeHint(n.getValue()));
             }
@@ -259,7 +262,8 @@ public class NormalizedNodeWriter implements Closeable, Flushable {
         protected boolean writeMapEntryNode(final MapEntryNode node) throws IOException {
             final NormalizedNodeStreamWriter nnWriter = getWriter();
             if (nnWriter instanceof NormalizedNodeStreamAttributeWriter) {
-                ((NormalizedNodeStreamAttributeWriter) nnWriter).startMapEntryNode(node.getIdentifier(), childSizeHint(node.getValue()), node.getAttributes());
+                ((NormalizedNodeStreamAttributeWriter) nnWriter).startMapEntryNode(node.getIdentifier(),
+                    childSizeHint(node.getValue()), node.getAttributes());
             } else {
                 nnWriter.startMapEntryNode(node.getIdentifier(), childSizeHint(node.getValue()));
             }
index 59610c28a3d557687a3fe9960f3d16918b593482..c14ff17eb5631a24622d0e4daca782879725e021 100644 (file)
@@ -12,22 +12,17 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 /**
  * Exception thrown when a proposed change fails validation before being
  * applied into the Data Tree because the Data Tree has been modified
- * in way that a conflicting
- * node is present.
+ * in way that a conflicting node is present.
  */
 public class ConflictingModificationAppliedException extends DataValidationFailedException {
-
-    /**
-     *
-     */
     private static final long serialVersionUID = 1L;
 
-    public ConflictingModificationAppliedException(final YangInstanceIdentifier path, final String message, final Throwable cause) {
+    public ConflictingModificationAppliedException(final YangInstanceIdentifier path, final String message,
+            final Throwable cause) {
         super(path, message, cause);
     }
 
     public ConflictingModificationAppliedException(final YangInstanceIdentifier path, final String message) {
         super(path, message);
     }
-
 }
index 0956c0b9771367bc6aa3c6d3dff784a090c96b36..063302c3c6ad1770aba2ad249b3b2f0a54bbdffe 100644 (file)
@@ -48,5 +48,5 @@ public interface DataTreeCandidate {
      * equals implementation must result in identity comparison.
      */
     @Override
-    boolean equals(Object o);
+    boolean equals(Object obj);
 }
index d36a4816a598580348fcfad18e9029ed83b5761d..8625b4e07856006e01f51f96ff861235af1e27fe 100644 (file)
@@ -28,42 +28,45 @@ public final class DataTreeCandidateNodes {
 
     /**
      * Applies the {@code node} to the {@code cursor}, note that if the top node of (@code node} is RootNode
-     * you need to use {@link #applyRootedNodeToCursor(DataTreeModificationCursor, YangInstanceIdentifier, DataTreeCandidateNode) applyRootedNodeToCursor}
-     * method that works with rooted node candidates
+     * you need to use {@link #applyRootedNodeToCursor(DataTreeModificationCursor, YangInstanceIdentifier,
+     * DataTreeCandidateNode) applyRootedNodeToCursor} method that works with rooted node candidates.
+     *
      * @param cursor cursor from the modification we want to apply the {@code node} to
      * @param node candidate tree to apply
      */
     public static void applyToCursor(final DataTreeModificationCursor cursor, final DataTreeCandidateNode node) {
         switch (node.getModificationType()) {
-        case DELETE:
-            cursor.delete(node.getIdentifier());
-            break;
-        case SUBTREE_MODIFIED:
+            case DELETE:
+                cursor.delete(node.getIdentifier());
+                break;
+            case SUBTREE_MODIFIED:
                 cursor.enter(node.getIdentifier());
                 AbstractNodeIterator iterator = new ExitingNodeIterator(null, node.getChildNodes().iterator());
-            do {
-                iterator = iterator.next(cursor);
-            } while (iterator != null);
-            break;
-        case UNMODIFIED:
-            // No-op
-            break;
-        case WRITE:
-            cursor.write(node.getIdentifier(), node.getDataAfter().get());
-            break;
-        default:
-            throw new IllegalArgumentException("Unsupported modification " + node.getModificationType());
+                do {
+                    iterator = iterator.next(cursor);
+                } while (iterator != null);
+                break;
+            case UNMODIFIED:
+                // No-op
+                break;
+            case WRITE:
+                cursor.write(node.getIdentifier(), node.getDataAfter().get());
+                break;
+            default:
+                throw new IllegalArgumentException("Unsupported modification " + node.getModificationType());
         }
     }
 
     /**
      * Applies the {@code node} that is rooted(doesn't have an identifier) in tree A to tree B's {@code cursor}
-     * at location specified by {@code rootPath}
+     * at location specified by {@code rootPath}.
+     *
      * @param cursor cursor from the modification we want to apply the {@code node} to
      * @param rootPath path in the {@code cursor}'s tree we want to apply to candidate to
      * @param node candidate tree to apply
      */
-    public static void applyRootedNodeToCursor(final DataTreeModificationCursor cursor, final YangInstanceIdentifier rootPath, final DataTreeCandidateNode node) {
+    public static void applyRootedNodeToCursor(final DataTreeModificationCursor cursor,
+            final YangInstanceIdentifier rootPath, final DataTreeCandidateNode node) {
         switch (node.getModificationType()) {
             case DELETE:
                 cursor.delete(rootPath.getLastPathArgument());
@@ -116,26 +119,26 @@ public final class DataTreeCandidateNodes {
             while (iterator.hasNext()) {
                 final DataTreeCandidateNode node = iterator.next();
                 switch (node.getModificationType()) {
-                case DELETE:
-                    cursor.delete(node.getIdentifier());
-                    break;
-                case APPEARED:
-                case DISAPPEARED:
-                case SUBTREE_MODIFIED:
-                    final Collection<DataTreeCandidateNode> children = node.getChildNodes();
-                    if (!children.isEmpty()) {
-                        cursor.enter(node.getIdentifier());
+                    case DELETE:
+                        cursor.delete(node.getIdentifier());
+                        break;
+                    case APPEARED:
+                    case DISAPPEARED:
+                    case SUBTREE_MODIFIED:
+                        final Collection<DataTreeCandidateNode> children = node.getChildNodes();
+                        if (!children.isEmpty()) {
+                            cursor.enter(node.getIdentifier());
                             return new ExitingNodeIterator(this, children.iterator());
-                    }
-                    break;
-                case UNMODIFIED:
-                    // No-op
-                    break;
-                case WRITE:
-                    cursor.write(node.getIdentifier(), node.getDataAfter().get());
-                    break;
-                default:
-                    throw new IllegalArgumentException("Unsupported modification " + node.getModificationType());
+                        }
+                        break;
+                    case UNMODIFIED:
+                        // No-op
+                        break;
+                    case WRITE:
+                        cursor.write(node.getIdentifier(), node.getDataAfter().get());
+                        break;
+                    default:
+                        throw new IllegalArgumentException("Unsupported modification " + node.getModificationType());
                 }
             }
             exitNode(cursor);
@@ -168,7 +171,7 @@ public final class DataTreeCandidateNodes {
 
         private final AbstractNodeIterator parent;
 
-        public ExitingNodeIterator(@Nullable final AbstractNodeIterator parent,
+        ExitingNodeIterator(@Nullable final AbstractNodeIterator parent,
                 @Nonnull final Iterator<DataTreeCandidateNode> iterator) {
             super(iterator);
             this.parent = parent;
index 5c97be386bb962ed5c0a2139b7a38beafe07c173..629c782b2bdf5d1b850f3a5085b04f760808675f 100644 (file)
@@ -23,15 +23,18 @@ import org.slf4j.LoggerFactory;
 @Beta
 public final class DataTreeCandidates {
     private static final Logger LOG = LoggerFactory.getLogger(DataTreeCandidates.class);
+
     private DataTreeCandidates() {
         throw new UnsupportedOperationException();
     }
 
-    public static DataTreeCandidate newDataTreeCandidate(final YangInstanceIdentifier rootPath, final DataTreeCandidateNode rootNode) {
+    public static DataTreeCandidate newDataTreeCandidate(final YangInstanceIdentifier rootPath,
+            final DataTreeCandidateNode rootNode) {
         return new DefaultDataTreeCandidate(rootPath, rootNode);
     }
 
-    public static DataTreeCandidate fromNormalizedNode(final YangInstanceIdentifier rootPath, final NormalizedNode<?, ?> node) {
+    public static DataTreeCandidate fromNormalizedNode(final YangInstanceIdentifier rootPath,
+            final NormalizedNode<?, ?> node) {
         return new DefaultDataTreeCandidate(rootPath, new NormalizedNodeDataTreeCandidateNode(node));
     }
 
@@ -39,7 +42,8 @@ public final class DataTreeCandidates {
         DataTreeCandidateNodes.applyToCursor(cursor, candidate.getRootNode());
     }
 
-    public static void applyToModification(final DataTreeModification modification, final DataTreeCandidate candidate) {
+    public static void applyToModification(final DataTreeModification modification,
+            final DataTreeCandidate candidate) {
         if (modification instanceof CursorAwareDataTreeModification) {
             applyToCursorAwareModification((CursorAwareDataTreeModification) modification, candidate);
             return;
@@ -48,28 +52,28 @@ public final class DataTreeCandidates {
         final DataTreeCandidateNode node = candidate.getRootNode();
         final YangInstanceIdentifier path = candidate.getRootPath();
         switch (node.getModificationType()) {
-        case DELETE:
-            modification.delete(path);
-            LOG.debug("Modification {} deleted path {}", modification, path);
-            break;
-        case SUBTREE_MODIFIED:
-            LOG.debug("Modification {} modified path {}", modification, path);
+            case DELETE:
+                modification.delete(path);
+                LOG.debug("Modification {} deleted path {}", modification, path);
+                break;
+            case SUBTREE_MODIFIED:
+                LOG.debug("Modification {} modified path {}", modification, path);
 
-            NodeIterator iterator = new NodeIterator(null, path, node.getChildNodes().iterator());
-            do {
-                iterator = iterator.next(modification);
-            } while (iterator != null);
-            break;
-        case UNMODIFIED:
-            LOG.debug("Modification {} unmodified path {}", modification, path);
-            // No-op
-            break;
-        case WRITE:
-            modification.write(path, node.getDataAfter().get());
-            LOG.debug("Modification {} written path {}", modification, path);
-            break;
-        default:
-            throw new IllegalArgumentException("Unsupported modification " + node.getModificationType());
+                NodeIterator iterator = new NodeIterator(null, path, node.getChildNodes().iterator());
+                do {
+                    iterator = iterator.next(modification);
+                } while (iterator != null);
+                break;
+            case UNMODIFIED:
+                LOG.debug("Modification {} unmodified path {}", modification, path);
+                // No-op
+                break;
+            case WRITE:
+                modification.write(path, node.getDataAfter().get());
+                LOG.debug("Modification {} written path {}", modification, path);
+                break;
+            default:
+                throw new IllegalArgumentException("Unsupported modification " + node.getModificationType());
         }
     }
 
@@ -92,7 +96,7 @@ public final class DataTreeCandidates {
         private final YangInstanceIdentifier path;
         private final NodeIterator parent;
 
-        public NodeIterator(@Nullable final NodeIterator parent, @Nonnull final YangInstanceIdentifier path,
+        NodeIterator(@Nullable final NodeIterator parent, @Nonnull final YangInstanceIdentifier path,
                 @Nonnull final Iterator<DataTreeCandidateNode> iterator) {
             this.iterator = Preconditions.checkNotNull(iterator);
             this.path = Preconditions.checkNotNull(path);
@@ -105,25 +109,25 @@ public final class DataTreeCandidates {
                 final YangInstanceIdentifier child = path.node(node.getIdentifier());
 
                 switch (node.getModificationType()) {
-                case DELETE:
-                    modification.delete(child);
-                    LOG.debug("Modification {} deleted path {}", modification, child);
-                    break;
-                case APPEARED:
-                case DISAPPEARED:
-                case SUBTREE_MODIFIED:
-                    LOG.debug("Modification {} modified path {}", modification, child);
-                    return new NodeIterator(this, child, node.getChildNodes().iterator());
-                case UNMODIFIED:
-                    LOG.debug("Modification {} unmodified path {}", modification, child);
-                    // No-op
-                    break;
-                case WRITE:
-                    modification.write(child, node.getDataAfter().get());
-                    LOG.debug("Modification {} written path {}", modification, child);
-                    break;
-                default:
-                    throw new IllegalArgumentException("Unsupported modification " + node.getModificationType());
+                    case DELETE:
+                        modification.delete(child);
+                        LOG.debug("Modification {} deleted path {}", modification, child);
+                        break;
+                    case APPEARED:
+                    case DISAPPEARED:
+                    case SUBTREE_MODIFIED:
+                        LOG.debug("Modification {} modified path {}", modification, child);
+                        return new NodeIterator(this, child, node.getChildNodes().iterator());
+                    case UNMODIFIED:
+                        LOG.debug("Modification {} unmodified path {}", modification, child);
+                        // No-op
+                        break;
+                    case WRITE:
+                        modification.write(child, node.getDataAfter().get());
+                        LOG.debug("Modification {} written path {}", modification, child);
+                        break;
+                    default:
+                        throw new IllegalArgumentException("Unsupported modification " + node.getModificationType());
                 }
             }
 
index b789854725b8168e29a080e6ef9ec59193e8c964..b8eae24c3fdde405ea189f4918f5cc5d12f76dcc 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 /**
  * DataTree configuration class.
  *
+ * <p>
  * TreeConfig supports currently the following options:
  * <ul>
  * <li>treeType</li>
@@ -24,6 +25,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
  * <li>enable/disable mandatory nodes validation</li>
  * </ul>
  *
+ * <p>
  * TreeConfig can be easily extended in order to support further data tree
  * configuration options, like following:
  * <ul>
@@ -32,9 +34,9 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
  * <li>other schema aware validation options</li>
  * </ul>
  *
+ * <p>
  * This can be useful when strict validation is not required or useful for some
  * reasons.
- *
  */
 @Beta
 public class DataTreeConfiguration implements Immutable {
@@ -81,12 +83,12 @@ public class DataTreeConfiguration implements Immutable {
     public static DataTreeConfiguration getDefault(final TreeType treeType) {
         Preconditions.checkNotNull(treeType);
         switch (treeType) {
-        case CONFIGURATION:
-            return DEFAULT_CONFIGURATION;
-        case OPERATIONAL:
-            return DEFAULT_OPERATIONAL;
-        default:
-            return new DataTreeConfiguration(treeType, YangInstanceIdentifier.EMPTY, false, true);
+            case CONFIGURATION:
+                return DEFAULT_CONFIGURATION;
+            case OPERATIONAL:
+                return DEFAULT_OPERATIONAL;
+            default:
+                return new DataTreeConfiguration(treeType, YangInstanceIdentifier.EMPTY, false, true);
         }
     }
 
@@ -121,4 +123,4 @@ public class DataTreeConfiguration implements Immutable {
             return new DataTreeConfiguration(treeType, rootPath, uniqueIndexes, mandatoryNodesValidation);
         }
     }
-}
\ No newline at end of file
+}
index d0e9c1e3ecdd688c1d05c9024985757f071de278..b207a91fc23404dbafc7d18135276ab63064d8ef 100644 (file)
@@ -7,11 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.data.api.schema.tree;
 
+import com.google.common.base.Optional;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
-import com.google.common.base.Optional;
-
 /**
  * Read-only snapshot of a {@link DataTree}. The snapshot is stable and isolated,
  * e.g. data tree changes occurring after the snapshot has been taken are not
index cfa70f9c5c62d8e1a5fe393bf4a7837ae74fc1db..dae1e244eb92253b3a3ef016d9480c1911a0391d 100644 (file)
@@ -48,5 +48,5 @@ public interface DataTreeTip {
      * equals implementation must result in identity comparison.
      */
     @Override
-    boolean equals(Object o);
+    boolean equals(Object obj);
 }
index 6f1286900996dbe5c1ae74a19f00efdd9dae1547..3ccc0d509113952f71da7e2c90eb76c9506c23a2 100644 (file)
@@ -7,18 +7,17 @@
  */
 package org.opendaylight.yangtools.yang.data.api.schema.tree;
 
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-
 import com.google.common.base.Preconditions;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
- * Exception thrown when a proposed change fails validation before being
- * applied into the datastore. This can have multiple reasons, for example
- * the datastore has been concurrently modified such that a conflicting
- * node is present, or the modification is structurally incorrect.
+ * Exception thrown when a proposed change fails validation before being applied into the datastore. This can have
+ * multiple reasons, for example the datastore has been concurrently modified such that a conflicting node is present,
+ * or the modification is structurally incorrect.
  */
 public class DataValidationFailedException extends Exception {
     private static final long serialVersionUID = 1L;
+
     private final YangInstanceIdentifier path;
 
     /**
@@ -30,14 +29,16 @@ public class DataValidationFailedException extends Exception {
     public DataValidationFailedException(final YangInstanceIdentifier path, final String message) {
         this(path, message, null);
     }
+
     /**
-     * Create a new instance, initializing
+     * Create a new instance, initializing the cause.
      *
      * @param path Object path which caused this exception
      * @param message Specific message describing the failure
      * @param cause Exception which triggered this failure, may be null
      */
-    public DataValidationFailedException(final YangInstanceIdentifier path, final String message, final Throwable cause) {
+    public DataValidationFailedException(final YangInstanceIdentifier path, final String message,
+            final Throwable cause) {
         super(message, cause);
         this.path = Preconditions.checkNotNull(path);
     }
index 8d68ce7d23062f1f96f611c52cc1d5eed38507d9..26eace9bc0c21b9e2412e56d4c331b35a3eaf44b 100644 (file)
@@ -35,6 +35,7 @@ final class DefaultDataTreeCandidate implements DataTreeCandidate {
 
     @Override
     public String toString() {
-        return MoreObjects.toStringHelper(this).add("rootPath", getRootPath()).add("rootNode", getRootNode()).toString();
+        return MoreObjects.toStringHelper(this).add("rootPath", getRootPath()).add("rootNode", getRootNode())
+            .toString();
     }
 }
index 07f435adccf02218abc03020ad074bd4bda08a1d..479f63250f111d2182d16043496208003f635355 100644 (file)
@@ -10,24 +10,18 @@ package org.opendaylight.yangtools.yang.data.api.schema.tree;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
- * Exception thrown when a proposed change fails validation before being
- * applied into the datastore because of incorrect structure of user supplied
- * data.
- *
+ * Exception thrown when a proposed change fails validation before being applied into the datastore
+ * because of incorrect structure of user supplied data.
  */
 public class IncorrectDataStructureException extends DataValidationFailedException {
-
-    /**
-     *
-     */
     private static final long serialVersionUID = 1L;
 
-    public IncorrectDataStructureException(final YangInstanceIdentifier path, final String message, final Throwable cause) {
+    public IncorrectDataStructureException(final YangInstanceIdentifier path, final String message,
+            final Throwable cause) {
         super(path, message, cause);
     }
 
     public IncorrectDataStructureException(final YangInstanceIdentifier path, final String message) {
         super(path, message);
     }
-
 }
index 668d2b0233e613a64c3775e28078c7650368b64f..de4be252fe79e82d896570462bae0b464dd5acec 100644 (file)
@@ -8,9 +8,8 @@
 package org.opendaylight.yangtools.yang.data.api.schema.tree;
 
 /**
- * Enumeration of all possible node modification states. These are used in
- * data tree modification context to quickly assess what sort of modification
- * the node is undergoing.
+ * Enumeration of all possible node modification states. These are used in data tree modification context to quickly
+ * assess what sort of modification the node is undergoing.
  */
 public enum ModificationType {
     /**
@@ -39,8 +38,10 @@ public enum ModificationType {
      * This node has appeared because it is implied by one of its children. This type is usually produced when a
      * structural container is created to host some leaf entries. It does not have an associated before-image.
      *
+     * <p>
      * Its semantics is a combination of SUBTREE_MODIFIED and WRITE, depending on which context it is being interpreted.
      *
+     * <p>
      * Users who track the value of the node can treat it as a WRITE. Users transforming a {@link DataTreeCandidate} to
      * operations on a {@link DataTreeModification} should interpret it as a SUBTREE_MODIFIED and examine its children.
      * This is needed to correctly deal with concurrent operations on the nodes children, as issuing a write on the
@@ -53,11 +54,13 @@ public enum ModificationType {
      * This node has disappeared because it is no longer implied by any children. This type is usually produced when a
      * structural container is removed because it has become empty. It does not have an associated after-image.
      *
-     * Its semantics is a combination of SUBTREE_MODIFIED and DELETE, depending on which context it is being interpreted.
-     * Users who track the value of the node can treat it as a DELETE, as the container has disappeared. Users
-     * transforming a {@link DataTreeCandidate} to operations on a {@link DataTreeModification} should interpret it as
-     * a SUBTREE_MODIFIED and examine its children.
+     * <p>
+     * Its semantics is a combination of SUBTREE_MODIFIED and DELETE, depending on which context it is being
+     * interpreted. Users who track the value of the node can treat it as a DELETE, as the container has disappeared.
+     * Users transforming a {@link DataTreeCandidate} to operations on a {@link DataTreeModification} should interpret
+     * it as a SUBTREE_MODIFIED and examine its children.
      *
+     * <p>
      * This is needed to correctly deal with concurrent operations on the nodes children, as issuing a delete on the
      * DataTreeModification would end up removing any leaves which have not been present at the DataTree which emitted
      * this event.
index d769b9906cb4e4d1a925215cf244c4dda7d95946..951463e490af8a20069c31574e47681b8f9f10ba 100644 (file)
@@ -15,24 +15,19 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
  * modified or written did not exist when transaction started
  * and still does not exists when transaction is processed.
  *
+ * <p>
  * Note if node existed in first place and was removed by other transaction,
  * thrown exception should be {@link ConflictingModificationAppliedException}.
- *
- *
  */
 public class ModifiedNodeDoesNotExistException extends DataValidationFailedException {
-
-    /**
-     *
-     */
     private static final long serialVersionUID = 1L;
 
-    public ModifiedNodeDoesNotExistException(final YangInstanceIdentifier path, final String message, final Throwable cause) {
+    public ModifiedNodeDoesNotExistException(final YangInstanceIdentifier path, final String message,
+            final Throwable cause) {
         super(path, message, cause);
     }
 
     public ModifiedNodeDoesNotExistException(final YangInstanceIdentifier path, final String message) {
         super(path, message);
     }
-
 }
index e54683e95f17ede2dd21fe63a9ca6a34a67d9ace..33c635087945b2f21e2e9d751ee52a6293323894 100644 (file)
@@ -7,9 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.data.api.schema.tree;
 
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
-
 import com.google.common.base.Optional;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 
 /**
  * A tree node which has references to its child leaves. This are typically
@@ -20,7 +19,7 @@ import com.google.common.base.Optional;
 public interface StoreTreeNode<C extends StoreTreeNode<C>> {
 
     /**
-     * Returns a direct child of the node
+     * Returns a direct child of the node.
      *
      * @param child Identifier of child
      * @return Optional with node if the child is existing, {@link Optional#absent()} otherwise.
index 33584640c54f5d2214d927816e5d2a4df877a4ca..8d786f107a0b3fd7679157f597f15273a25d8789 100644 (file)
@@ -28,7 +28,8 @@ public final class StoreTreeNodes {
     }
 
     /**
-     * Finds a node in tree
+     * Finds a node in tree.
+     *
      * @param <T>
      *          Store tree node type.
      * @param tree Data Tree
@@ -47,27 +48,27 @@ public final class StoreTreeNodes {
     public static <T extends StoreTreeNode<T>> T findNodeChecked(final T tree, final YangInstanceIdentifier path) {
         T current = tree;
 
-        int i = 1;
+        int depth = 1;
         for (PathArgument pathArg : path.getPathArguments()) {
             Optional<T> potential = current.getChild(pathArg);
             if (!potential.isPresent()) {
                 throw new IllegalArgumentException(String.format("Child %s is not present in tree.",
-                        path.getAncestor(i)));
+                        path.getAncestor(depth)));
             }
             current = potential.get();
-            ++i;
+            ++depth;
         }
         return current;
     }
 
     /**
-     * Finds a node or closest parent in  the tree
+     * Finds a node or closest parent in the tree.
+     *
      * @param <T>
      *          Store tree node type.
      * @param tree Data Tree
      * @param path Path to the node
      * @return Map.Entry Entry with key which is path to closest parent and value is parent node.
-     *
      */
     public static <T extends StoreTreeNode<T>> Entry<YangInstanceIdentifier, T> findClosest(final T tree,
             final YangInstanceIdentifier path) {
@@ -101,7 +102,8 @@ public final class StoreTreeNodes {
         return new SimpleImmutableEntry<>(path.getAncestor(nesting - 1), parent.get());
     }
 
-    public static <T extends StoreTreeNode<T>> Optional<T> getChild(final Optional<T> parent, final PathArgument child) {
+    public static <T extends StoreTreeNode<T>> Optional<T> getChild(final Optional<T> parent,
+            final PathArgument child) {
         if (parent.isPresent()) {
             return parent.get().getChild(child);
         }
index e012926d4efe2fcf5aa52a8c5dfd8b0b23a89d42..056a189a0d91982f4d12039b9df8ab1135f2ff46 100644 (file)
@@ -25,7 +25,8 @@ abstract class AbstractMutableContainerNode implements MutableTreeNode {
     private NormalizedNode<?, ?> data;
     private Version subtreeVersion;
 
-    protected AbstractMutableContainerNode(final AbstractContainerNode parent, final Map<PathArgument, TreeNode> children) {
+    protected AbstractMutableContainerNode(final AbstractContainerNode parent,
+            final Map<PathArgument, TreeNode> children) {
         this.data = parent.getData();
         this.version = parent.getVersion();
         this.subtreeVersion = parent.getSubtreeVersion();
@@ -95,4 +96,4 @@ abstract class AbstractMutableContainerNode implements MutableTreeNode {
         children = null;
         return ret;
     }
-}
\ No newline at end of file
+}
index 47c68e22ec41a035e9a41fbce756909effff24a8..1ca6ea02754da431274066fe18647f26bd7b2ddd 100644 (file)
@@ -24,8 +24,8 @@ final class LazyContainerNode extends AbstractModifiedContainerNode {
         this(data, version, MapAdaptor.getDefaultInstance().initialSnapshot(1), subtreeVersion);
     }
 
-    LazyContainerNode(final NormalizedNode<?, ?> data, final Version version, final Map<PathArgument, TreeNode> children,
-            final Version subtreeVersion) {
+    LazyContainerNode(final NormalizedNode<?, ?> data, final Version version,
+            final Map<PathArgument, TreeNode> children, final Version subtreeVersion) {
         super(data, version, children, subtreeVersion);
     }
 
index 0ac7d27a4f812ffb896ff938b761d30a6642342d..d8adb3b676a163724f6fc8b37983e07350ecc4e9 100644 (file)
@@ -16,12 +16,15 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.StoreTreeNode;
  * A very basic data tree node. It has a version (when it was last modified), a subtree version (when any of its
  * children were modified) and some read-only data.
  *
+ * <p>
  * Semantic difference between these two is important when dealing with modifications involving parent/child
  * relationships and what operations can be execute concurrently without creating a data dependency conflict.
  *
+ * <p>
  * A replace/delete operation cannot be applied to this node if the subtree version does not match. This mismatch
  * still allows modifications to its descendants.
  *
+ * <p>
  * A mismatch in node version indicates a replacement, preventing a modification of descendants or itself.
  */
 // FIXME: BUG-2399: clarify that versioning rules are not enforced for non-presence containers, as they are not
index 05af016687b2dca742d7285224702f43402b86a1..29b1b37c82e92bb9fd5f07e8a93578f272370555 100644 (file)
@@ -30,8 +30,8 @@ public final class TreeNodeFactory {
      * {@link TreeNodeFactory#createTreeNodeRecursively}. Each call to <code>createTreeNodeRecursively</code>
      * calls either {@link #createNormalizedNodeRecursively} or {@link #createOrderedNodeRecursively}
      * which depends on type of child node.
-     * <br> The root node that is returned holds reference to data node and whole subtree of children also containing references
-     * to data nodes.
+     * <br> The root node that is returned holds reference to data node and whole subtree of children also containing
+     * references to data nodes.
      *
      * @param version version of indexed data
      * @param data reference to data node
@@ -52,11 +52,13 @@ public final class TreeNodeFactory {
 
     /**
      * Method creates and returns Normalized Node Container as root and recursively creates whole subtree
-     * from all of the container child iterables stored in {@link org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer#getValue()}
+     * from all of the container child iterables stored in
+     * {@link org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer#getValue()}
      * <br>
-     * The reason why is this method called recursively is that in background method calls {@link TreeNodeFactory#createTreeNodeRecursively}
-     * for each child stored in NormalizedNode and after each child is created the method calls again {@link #createNormalizedNodeRecursively} method
-     * until all of the children are resolved.
+     * The reason why is this method called recursively is that in background method calls
+     * {@link TreeNodeFactory#createTreeNodeRecursively} for each child stored in NormalizedNode and after each child
+     * is created the method calls again {@link #createNormalizedNodeRecursively} method until all of the children are
+     * resolved.
      *
      * @param version version of indexed data
      * @param container Normalized Node Container
@@ -71,11 +73,13 @@ public final class TreeNodeFactory {
 
     /**
      * Method creates and returns Ordered Node Container as root and recursively creates whole subtree
-     * from all of the container child iterables stored in {@link org.opendaylight.yangtools.yang.data.api.schema.OrderedNodeContainer#getValue()}
+     * from all of the container child iterables stored in
+     * {@link org.opendaylight.yangtools.yang.data.api.schema.OrderedNodeContainer#getValue()}
      * <br>
-     * The reason why is this method called recursively is that in background method calls {@link TreeNodeFactory#createTreeNodeRecursively}
-     * for each child stored in NormalizedNode and after each child is created the method calls again {@link #createNormalizedNodeRecursively} method
-     * until all of the children are resolved.
+     * The reason why is this method called recursively is that in background method calls
+     * {@link TreeNodeFactory#createTreeNodeRecursively} for each child stored in NormalizedNode and after each child
+     * is created the method calls again {@link #createNormalizedNodeRecursively} method until all of the children are
+     * resolved.
      *
      * @param version version of indexed data
      * @param container Ordered Node Container
@@ -101,7 +105,8 @@ public final class TreeNodeFactory {
     public static TreeNode createTreeNodeRecursively(final NormalizedNode<?, ?> data, final Version version) {
         if (data instanceof NormalizedNodeContainer<?, ?, ?>) {
             @SuppressWarnings("unchecked")
-            NormalizedNodeContainer<?, ?, NormalizedNode<?, ?>> container = (NormalizedNodeContainer<?, ?, NormalizedNode<?, ?>>) data;
+            NormalizedNodeContainer<?, ?, NormalizedNode<?, ?>> container =
+                (NormalizedNodeContainer<?, ?, NormalizedNode<?, ?>>) data;
             return createNormalizedNodeRecursively(version, container);
 
         }
index e174bb4154eb7aefd1c82e6d9ba997df7364d7d3..ffbe9195bf12b3a1e9626a17517fa663303e7640 100644 (file)
@@ -19,6 +19,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
  * Asynchronous interface to evaluation. It is functionally the same as an XPathExpression, but allows for asynchronous
  * execution of evaluation of the expression.
  *
+ * <p>
  * FIXME: Whether or not the resulting XPathResult can perform blocking calls is up for grabs, but implementations are
  *        definitely allowed to perform things like on-demand data transformation from foreign object and data models.
  *
@@ -34,16 +35,14 @@ public interface LazyXPathExpression {
      * {@link XPathResult} at some point it the future. If it fails to match anything, it {@link Future#get()} will
      * return {@link Optional#absent()}.
      *
+     * <p>
      * FIXME: The amount of overhead an implementation can incur on the user as data from the resulting
      *        {@link XPathResult} is being accessed is left UNDEFINED.
-     *
      *        Specifically, the user is expected to store each result returned directly or indirectly in a local
      *        variable instead of repeated calls to the result's methods, as these may incur CPU processing overhead.
-     *
      *        Furthermore all method invocations can throw {@link LazyXPathExpressionException}, which the users are
      *        expected to handle gracefully. RESILIENT USERS ARE EXPECTED TO CATCH {@link LazyXPathExpressionException}
      *        AND RECOVER IN THE SAME MANNER THEY WOULD IF AN {@link XPathExpressionException} WOULD HAVE BEEN THROWN.
-     *
      *        [ FIXME: would it be appropriate to allow implementations to SneakyThrow {@link XPathExpressionException}
      *                 and not introduce a RuntimeExpcetion ? ]
      *
index 506d977b6b9470c9e407e94892d44a7da1735eb8..72d6e346e147921c65f98aa1a3ff6246c3c08174 100644 (file)
@@ -15,6 +15,7 @@ import javax.annotation.Nonnull;
  * expense of additional processing being performed on them. The decision to optimize a particular expression is left
  * to the user's discretion.
  *
+ * <p>
  * Implementations supporting profile-driven and similar optimizations which depend on data being gathered during
  * evaluation should not implement this interface, but rather perform these optimizations transparently behind the
  * scenes. That implies the users can expect those optimizations not interfering with the user's ability to evaluate
index 48c5c5e8740ce94faeb20a0eebdd7e1232adc351..366f22153b9e7dfa4d2cf939e036e53bb35f095c 100644 (file)
@@ -14,13 +14,12 @@ import javax.annotation.Nonnull;
  * Base interface for various things an XPath evaluation can return.
  *
  * @param <T> type of returned value
- *
- * FIXME: do we want to support all the modes of
- *        <a href="http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResultType">DOM XPath</a> ?
- *        The default DataTree (yang-data-impl) implementation can support ORDERED_NODE_SNAPSHOT_TYPE. The clustered
- *        datastore may want to implement ORDERED_NODE_ITERATOR_TYPE (via iterators).
  */
 @Beta
+// FIXME: do we want to support all the modes of
+//        <a href="http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResultType">DOM XPath</a> ?
+//        The default DataTree (yang-data-impl) implementation can support ORDERED_NODE_SNAPSHOT_TYPE. The clustered
+//        datastore may want to implement ORDERED_NODE_ITERATOR_TYPE (via iterators).
 public interface XPathResult<T> {
     /**
      * Get the value contained in this result.
index 5499d49c9453ea7dae15fb8a9b7aed11131d8029..a5c5ea0a3c97e5255fd9e23d9e3307d4d7603ef8 100644 (file)
@@ -24,6 +24,7 @@ public interface XPathSchemaContext {
     /**
      * Compile an XPath expression for execution on {@link XPathDocument}s produced by this context.
      *
+     * <p>
      * The user must provide a prefix-to-mapping {@link Converter}, which will be used to convert any prefixes found
      * in the XPath expression being compiled in the resulting context.
      *
index 739c777350ab4cdc1a2b09b8bee87dfd24e781d4..fb0e1e97a138daf58664ba5272719d1c9755aa31 100644 (file)
@@ -15,6 +15,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
  * implementation. Users are expected to resolve these via their service resolution framework, be it
  * {@link java.util.ServiceLoader}, OSGi or similar.
  *
+ * <p>
  * Implementations are required to support {@link java.util.ServiceLoader}.
  */
 public interface XPathSchemaContextFactory {
index a0877f7c4e9f1935c013fb88fe69a6af9c30f4bd..d1de45f9d8ac5941c2f4ed3af7617c21da6e2d53 100644 (file)
@@ -32,6 +32,7 @@ public class ModifyActionTest {
             ModifyAction.fromXmlValue("exception call");
             fail();
         } catch (IllegalArgumentException e) {
+            // Expected
         }
     }
 }
index fcfe60bddbe150b256ed98c1a1376e643c1be2f3..49beab7a334aa7aa9c7fc00de5b36edb15e0e5e9 100644 (file)
@@ -18,7 +18,6 @@ import java.net.URISyntaxException;
 import java.text.ParseException;
 import java.util.HashMap;
 import java.util.Map;
-import javax.annotation.Nonnull;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
@@ -56,36 +55,42 @@ public class PathArgumentListTest {
             l.remove(null);
             fail();
         } catch (UnsupportedOperationException e) {
+            // Expected
         }
 
         try {
             l.addAll(null);
             fail();
         } catch (UnsupportedOperationException e) {
+            // Expected
         }
 
         try {
             l.removeAll(null);
             fail();
         } catch (UnsupportedOperationException e) {
+            // Expected
         }
 
         try {
             l.retainAll(null);
             fail();
         } catch (UnsupportedOperationException e) {
+            // Expected
         }
 
         try {
             l.clear();
             fail();
         } catch (UnsupportedOperationException e) {
+            // Expected
         }
 
         try {
             l.addAll(0, null);
             fail();
         } catch (UnsupportedOperationException e) {
+            // Expected
         }
     }
 
@@ -98,13 +103,14 @@ public class PathArgumentListTest {
         final QName qNameLeaf = QName.create(qNameModule, "leaf-a");
         final Map<QName, Object> entryLeaf = new HashMap<>();
         entryLeaf.put(qNameList, "leaf");
-        final YangInstanceIdentifier.NodeIdentifierWithPredicates nodeIdentifierWithPredicates = new YangInstanceIdentifier
-                .NodeIdentifierWithPredicates(qNameList , entryLeaf);
+        final YangInstanceIdentifier.NodeIdentifierWithPredicates nodeIdentifierWithPredicates =
+            new YangInstanceIdentifier.NodeIdentifierWithPredicates(qNameList , entryLeaf);
         final YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.of(qNameRoot).node(qNameList)
                 .node(nodeIdentifierWithPredicates).node(qNameLeaf);
         final PathArgument pathArgumentToRoot = yangInstanceIdentifier.getAncestor(1).getPathArguments().iterator()
                 .next();
-        final StackedPathArguments stackedPathArguments = (StackedPathArguments)yangInstanceIdentifier.getPathArguments();
+        final StackedPathArguments stackedPathArguments = (StackedPathArguments)yangInstanceIdentifier
+            .getPathArguments();
         assertTrue(yangInstanceIdentifier.pathArgumentsEqual(yangInstanceIdentifier));
         assertEquals(pathArgumentToRoot, stackedPathArguments.get(0));
         assertEquals(4, stackedPathArguments.size());
@@ -112,8 +118,8 @@ public class PathArgumentListTest {
         assertEquals(0, stackedPathArguments.indexOf(pathArgumentToRoot));
         assertEquals(0, stackedPathArguments.lastIndexOf(pathArgumentToRoot));
 
-        final StackedReversePathArguments stackedReversePathArguments = (StackedReversePathArguments)yangInstanceIdentifier
-                .getReversePathArguments();
+        final StackedReversePathArguments stackedReversePathArguments =
+            (StackedReversePathArguments)yangInstanceIdentifier.getReversePathArguments();
         final QName rootQname = pathArgumentToRoot.getNodeType();
         final QName leafQname = stackedReversePathArguments.get(0).getNodeType();
         assertEquals(qNameRoot, rootQname);
@@ -134,6 +140,7 @@ public class PathArgumentListTest {
             stackedYangInstanceIdentifier.getAncestor(12);
             fail();
         } catch (IllegalArgumentException e) {
+            // Expected
         }
     }
-}
\ No newline at end of file
+}
index 00877d96a7c806bb6860177eeddd9c0ceabd3bcf..e2e6f87dd84368b64ee5f3a8c0efa760514f3623 100644 (file)
@@ -15,6 +15,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
+
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Lists;
@@ -53,309 +54,319 @@ public class YangInstanceIdentifierTest {
 
     @Test
     public void testGetLastPathArgument() {
-        YangInstanceIdentifier id1 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1), new NodeIdentifier(NODENAME2));
-        assertEquals( "getLastPathArgument", new NodeIdentifier(NODENAME2), id1.getLastPathArgument());
+        YangInstanceIdentifier id1 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1),
+                new NodeIdentifier(NODENAME2));
+        assertEquals("getLastPathArgument", new NodeIdentifier(NODENAME2), id1.getLastPathArgument());
         YangInstanceIdentifier id2 = YangInstanceIdentifier.create();
-        assertNull( id2.getLastPathArgument() );
+        assertNull(id2.getLastPathArgument());
     }
 
     @Test
     public void testHashCodeEquals() {
-        YangInstanceIdentifier id1 = YangInstanceIdentifier.create(NodeIdentifier.create(NODENAME1), new NodeIdentifier(NODENAME2));
-        YangInstanceIdentifier id2 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1), NodeIdentifier.create(NODENAME2));
+        YangInstanceIdentifier id1 = YangInstanceIdentifier.create(NodeIdentifier.create(NODENAME1),
+                new NodeIdentifier(NODENAME2));
+        YangInstanceIdentifier id2 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1),
+                NodeIdentifier.create(NODENAME2));
 
-        assertEquals( "hashCode", id1.hashCode(), id2.hashCode() );
+        assertEquals("hashCode", id1.hashCode(), id2.hashCode());
     }
 
     @Test
     public void testEquals() {
-        YangInstanceIdentifier id1 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1), new NodeIdentifier(NODENAME2));
-        YangInstanceIdentifier id2 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1), new NodeIdentifier(NODENAME2));
-        YangInstanceIdentifier id3 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME2), new NodeIdentifier(NODENAME1));
-        YangInstanceIdentifier id4 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1));
-
-        assertEquals( "equals", false, id1.equals( null ) );
-        assertEquals( "equals", true, id1.equals( id1 ) );
-        assertEquals( "equals", true, id1.equals( id2 ) );
-        assertEquals( "equals", false, id1.equals( id3 ) );
-        assertEquals( "equals", false, id1.equals( id4 ) );
-        assertEquals( "equals", false, id1.equals( new Object() ) );
+        final YangInstanceIdentifier id1 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1),
+                new NodeIdentifier(NODENAME2));
+        final YangInstanceIdentifier id2 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1),
+                new NodeIdentifier(NODENAME2));
+        final YangInstanceIdentifier id3 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME2),
+                new NodeIdentifier(NODENAME1));
+        final YangInstanceIdentifier id4 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1));
+
+        assertEquals("equals", false, id1.equals(null));
+        assertEquals("equals", true, id1.equals(id1));
+        assertEquals("equals", true, id1.equals(id2));
+        assertEquals("equals", false, id1.equals(id3));
+        assertEquals("equals", false, id1.equals(id4));
+        assertEquals("equals", false, id1.equals(new Object()));
     }
 
     @Test
     public void testToString() {
-        YangInstanceIdentifier id = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1), new NodeIdentifier(NODENAME2));
+        YangInstanceIdentifier id = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1),
+                new NodeIdentifier(NODENAME2));
 
-        assertNotNull( id.toString() );
+        assertNotNull(id.toString());
     }
 
     @Test
     public void testNode() {
-        YangInstanceIdentifier id = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1), new NodeIdentifier(NODENAME2));
+        final YangInstanceIdentifier id = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1),
+                new NodeIdentifier(NODENAME2));
 
-        YangInstanceIdentifier newID = id.node( NODENAME3 );
+        YangInstanceIdentifier newID = id.node(NODENAME3);
 
-        assertNotNull( "InstanceIdentifier is null", newID );
-        assertEquals( "Path size", 3, newID.getPathArguments().size() );
+        assertNotNull("InstanceIdentifier is null", newID);
+        assertEquals("Path size", 3, newID.getPathArguments().size());
 
         Iterator<PathArgument> it = newID.getPathArguments().iterator();
-        assertEquals( "PathArg 1 node type", NODENAME1, it.next().getNodeType() );
-        assertEquals( "PathArg 2 node type", NODENAME2, it.next().getNodeType() );
-        assertEquals( "PathArg 3 node type", NODENAME3, it.next().getNodeType() );
+        assertEquals("PathArg 1 node type", NODENAME1, it.next().getNodeType());
+        assertEquals("PathArg 2 node type", NODENAME2, it.next().getNodeType());
+        assertEquals("PathArg 3 node type", NODENAME3, it.next().getNodeType());
 
-        newID = id.node( new NodeIdentifier( NODENAME3 ) );
+        newID = id.node(new NodeIdentifier(NODENAME3));
 
-        assertNotNull( "InstanceIdentifier is null", newID );
-        assertEquals( "Path size", 3, newID.getPathArguments().size() );
+        assertNotNull("InstanceIdentifier is null", newID);
+        assertEquals("Path size", 3, newID.getPathArguments().size());
 
         it = newID.getPathArguments().iterator();
-        assertEquals( "PathArg 1 node type", NODENAME1, it.next().getNodeType() );
-        assertEquals( "PathArg 2 node type", NODENAME2, it.next().getNodeType() );
-        assertEquals( "PathArg 3 node type", NODENAME3, it.next().getNodeType() );
+        assertEquals("PathArg 1 node type", NODENAME1, it.next().getNodeType());
+        assertEquals("PathArg 2 node type", NODENAME2, it.next().getNodeType());
+        assertEquals("PathArg 3 node type", NODENAME3, it.next().getNodeType());
     }
 
     @Test
     public void testRelativeTo() {
-
-        YangInstanceIdentifier id1 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1), new NodeIdentifier(NODENAME2),
-                new NodeIdentifier(NODENAME3), new NodeIdentifier(NODENAME4));
-        YangInstanceIdentifier id2 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1), new NodeIdentifier(NODENAME2));
-        YangInstanceIdentifier id3 = YangInstanceIdentifier.create(
-                Lists.newArrayList(new NodeIdentifier(NODENAME1), new NodeIdentifier(NODENAME2)));
-
-        Optional<YangInstanceIdentifier> relative = id1.relativeTo( id2 );
-        assertEquals( "isPresent", true, relative.isPresent() );
-
-        List<PathArgument> p = relative.get().getPathArguments();
-        assertEquals( "Path size", 2, p.size() );
-        assertEquals( "PathArg 1 node type", NODENAME3, p.get(0).getNodeType() );
-        assertEquals( "PathArg 2 node type", NODENAME4, p.get(1).getNodeType() );
-
-        relative = id2.relativeTo( id3 );
-        assertEquals( "isPresent", true, relative.isPresent() );
-        assertEquals( "Path size", 0, relative.get().getPathArguments().size() );
-
-        relative = id2.relativeTo( id1 );
-        assertEquals( "isPresent", false, relative.isPresent() );
+        final YangInstanceIdentifier id1 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1),
+                new NodeIdentifier(NODENAME2), new NodeIdentifier(NODENAME3), new NodeIdentifier(NODENAME4));
+        final YangInstanceIdentifier id2 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1),
+                new NodeIdentifier(NODENAME2));
+        final YangInstanceIdentifier id3 = YangInstanceIdentifier.create(Lists.newArrayList(
+                    new NodeIdentifier(NODENAME1), new NodeIdentifier(NODENAME2)));
+
+        Optional<YangInstanceIdentifier> relative = id1.relativeTo(id2);
+        assertEquals("isPresent", true, relative.isPresent());
+
+        List<PathArgument> path = relative.get().getPathArguments();
+        assertEquals("Path size", 2, path.size());
+        assertEquals("PathArg 1 node type", NODENAME3, path.get(0).getNodeType());
+        assertEquals("PathArg 2 node type", NODENAME4, path.get(1).getNodeType());
+
+        relative = id2.relativeTo(id3);
+        assertEquals("isPresent", true, relative.isPresent());
+        assertEquals("Path size", 0, relative.get().getPathArguments().size());
+
+        relative = id2.relativeTo(id1);
+        assertEquals("isPresent", false, relative.isPresent());
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testContainsNull() {
         final YangInstanceIdentifier id = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1));
 
-        id.contains( null );
+        id.contains(null);
     }
 
     @Test
     public void testContains() {
-
-        YangInstanceIdentifier id1 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1), new NodeIdentifier(NODENAME2),
-                new NodeIdentifier(NODENAME3), new NodeIdentifier(NODENAME4));
-        YangInstanceIdentifier id2 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1), new NodeIdentifier(NODENAME2));
-        YangInstanceIdentifier id3 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1), new NodeIdentifier(NODENAME2));
-        YangInstanceIdentifier id4 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1), new NodeIdentifier(NODENAME3));
-
-        assertEquals( "contains", true, id2.contains( id1 ) );
-        assertEquals( "contains", true, id2.contains( id3 ) );
-        assertEquals( "contains", false, id1.contains( id2 ) );
-        assertEquals( "contains", false, id2.contains( id4 ) );
+        final YangInstanceIdentifier id1 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1),
+                new NodeIdentifier(NODENAME2), new NodeIdentifier(NODENAME3), new NodeIdentifier(NODENAME4));
+        final YangInstanceIdentifier id2 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1),
+                new NodeIdentifier(NODENAME2));
+        final YangInstanceIdentifier id3 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1),
+                new NodeIdentifier(NODENAME2));
+        final YangInstanceIdentifier id4 = YangInstanceIdentifier.create(new NodeIdentifier(NODENAME1),
+                new NodeIdentifier(NODENAME3));
+
+        assertEquals("contains", true, id2.contains(id1));
+        assertEquals("contains", true, id2.contains(id3));
+        assertEquals("contains", false, id1.contains(id2));
+        assertEquals("contains", false, id2.contains(id4));
     }
 
     @Test
     public void testOf() {
+        YangInstanceIdentifier newID = YangInstanceIdentifier.of(NODENAME1);
 
-        YangInstanceIdentifier newID = YangInstanceIdentifier.of( NODENAME1 );
+        assertNotNull("InstanceIdentifier is null", newID);
+        assertEquals("Path size", 1, newID.getPathArguments().size());
+        assertEquals("PathArg 1 node type", NODENAME1, newID.getPathArguments().get(0).getNodeType());
 
-        assertNotNull( "InstanceIdentifier is null", newID );
-        assertEquals( "Path size", 1, newID.getPathArguments().size() );
-        assertEquals( "PathArg 1 node type", NODENAME1, newID.getPathArguments().get(0).getNodeType() );
-
-        assertNotNull( newID.toString() ); // for code coverage
+        assertNotNull(newID.toString()); // for code coverage
     }
 
     @Test
     public void testBuilder() {
-
         YangInstanceIdentifier newID = YangInstanceIdentifier.builder()
-                .node( NODENAME1 )
-                .nodeWithKey( NODENAME2, Collections.singletonMap( KEY1, "foo" ) )
-                .nodeWithKey( NODENAME3, KEY2, "bar" ).build();
+                .node(NODENAME1)
+                .nodeWithKey(NODENAME2, Collections.singletonMap(KEY1, "foo"))
+                .nodeWithKey(NODENAME3, KEY2, "bar").build();
 
-        assertNotNull( "InstanceIdentifier is null", newID );
-        assertEquals( "Path size", 3, newID.getPathArguments().size() );
+        assertNotNull("InstanceIdentifier is null", newID);
+        assertEquals("Path size", 3, newID.getPathArguments().size());
 
         Iterator<PathArgument> it = newID.getPathArguments().iterator();
-        assertEquals( "PathArg 1 node type", NODENAME1, it.next().getNodeType() );
-        verifyNodeIdentifierWithPredicates( "PathArg 2", it.next(), NODENAME2, KEY1, "foo" );
-        verifyNodeIdentifierWithPredicates( "PathArg 3", it.next(), NODENAME3, KEY2, "bar" );
+        assertEquals("PathArg 1 node type", NODENAME1, it.next().getNodeType());
+        verifyNodeIdentifierWithPredicates("PathArg 2", it.next(), NODENAME2, KEY1, "foo");
+        verifyNodeIdentifierWithPredicates("PathArg 3", it.next(), NODENAME3, KEY2, "bar");
 
-        newID = YangInstanceIdentifier.builder( newID ).node( NODENAME4 ).build();
+        newID = YangInstanceIdentifier.builder(newID).node(NODENAME4).build();
 
-        assertNotNull( "InstanceIdentifier is null", newID );
-        assertEquals( "Path size", 4, newID.getPathArguments().size() );
+        assertNotNull("InstanceIdentifier is null", newID);
+        assertEquals("Path size", 4, newID.getPathArguments().size());
 
         it = newID.getPathArguments().iterator();
-        assertEquals( "PathArg 1 node type", NODENAME1, it.next().getNodeType() );
-        assertEquals( "PathArg 2 node type", NODENAME2, it.next().getNodeType() );
-        assertEquals( "PathArg 3 node type", NODENAME3, it.next().getNodeType() );
-        assertEquals( "PathArg 4 node type", NODENAME4, it.next().getNodeType() );
+        assertEquals("PathArg 1 node type", NODENAME1, it.next().getNodeType());
+        assertEquals("PathArg 2 node type", NODENAME2, it.next().getNodeType());
+        assertEquals("PathArg 3 node type", NODENAME3, it.next().getNodeType());
+        assertEquals("PathArg 4 node type", NODENAME4, it.next().getNodeType());
 
-        newID = YangInstanceIdentifier.builder().node( NODENAME1 ).build();
+        newID = YangInstanceIdentifier.builder().node(NODENAME1).build();
 
-        assertNotNull( "InstanceIdentifier is null", newID );
-        assertEquals( "Path size", 1, newID.getPathArguments().size() );
-        assertEquals( "PathArg 1 node type", NODENAME1, newID.getPathArguments().get(0).getNodeType() );
+        assertNotNull("InstanceIdentifier is null", newID);
+        assertEquals("Path size", 1, newID.getPathArguments().size());
+        assertEquals("PathArg 1 node type", NODENAME1, newID.getPathArguments().get(0).getNodeType());
     }
 
     private static void verifyNodeIdentifierWithPredicates(final String prefix,
-            final PathArgument arg, final QName nodeName, final QName key, final Object value ) {
+            final PathArgument arg, final QName nodeName, final QName key, final Object value) {
 
-        assertNotNull( prefix + " is null", arg );
-        assertEquals( prefix + " class", NodeIdentifierWithPredicates.class, arg.getClass() );
+        assertNotNull(prefix + " is null", arg);
+        assertEquals(prefix + " class", NodeIdentifierWithPredicates.class, arg.getClass());
         NodeIdentifierWithPredicates node = (NodeIdentifierWithPredicates)arg;
-        assertEquals( prefix + " node type", nodeName, node.getNodeType() );
-        assertEquals( prefix + " key values map size", 1, node.getKeyValues().size() );
+        assertEquals(prefix + " node type", nodeName, node.getNodeType());
+        assertEquals(prefix + " key values map size", 1, node.getKeyValues().size());
         Entry<QName, Object> entry = node.getKeyValues().entrySet().iterator().next();
-        assertEquals( prefix + " key values map entry key", key, entry.getKey() );
-        assertEquals( prefix + " key values map entry value", value, entry.getValue() );
+        assertEquals(prefix + " key values map entry key", key, entry.getKey());
+        assertEquals(prefix + " key values map entry value", value, entry.getValue());
     }
 
     @Test
     public void testNodeIdentifierWithPredicates() {
 
-        NodeIdentifierWithPredicates node1 = new NodeIdentifierWithPredicates( NODENAME1, KEY1, "foo" );
-        verifyNodeIdentifierWithPredicates( "NodeIdentifierWithPredicates", node1, NODENAME1, KEY1, "foo" );
+        NodeIdentifierWithPredicates node1 = new NodeIdentifierWithPredicates(NODENAME1, KEY1, "foo");
+        verifyNodeIdentifierWithPredicates("NodeIdentifierWithPredicates", node1, NODENAME1, KEY1, "foo");
 
-        NodeIdentifierWithPredicates node2 = new NodeIdentifierWithPredicates( NODENAME1, KEY1, "foo" );
+        NodeIdentifierWithPredicates node2 = new NodeIdentifierWithPredicates(NODENAME1, KEY1, "foo");
 
-        assertEquals( "hashCode", node1.hashCode(), node2.hashCode() );
-        assertEquals( "equals", true, node1.equals( node2 ) );
+        assertEquals("hashCode", node1.hashCode(), node2.hashCode());
+        assertEquals("equals", true, node1.equals(node2));
 
-        assertEquals( "equals", false,
-                node1.equals( new NodeIdentifierWithPredicates( NODENAME2, KEY1, "foo" ) ) );
-        assertEquals( "equals", false,
-                node1.equals( new NodeIdentifierWithPredicates( NODENAME1, KEY2, "foo" ) ) );
-        assertEquals( "equals", false,
-                node1.equals( new NodeIdentifierWithPredicates( NODENAME1, KEY1, "bar" ) ) );
-        assertEquals( "equals", false, node1.equals( new Object() ) );
+        assertEquals("equals", false,
+                node1.equals(new NodeIdentifierWithPredicates(NODENAME2, KEY1, "foo")));
+        assertEquals("equals", false,
+                node1.equals(new NodeIdentifierWithPredicates(NODENAME1, KEY2, "foo")));
+        assertEquals("equals", false,
+                node1.equals(new NodeIdentifierWithPredicates(NODENAME1, KEY1, "bar")));
+        assertEquals("equals", false, node1.equals(new Object()));
 
-        assertNotNull( node1.toString() ); // for code coverage
-        assertNotNull( node1.toRelativeString(node2) );
+        assertNotNull(node1.toString()); // for code coverage
+        assertNotNull(node1.toRelativeString(node2));
 
-        NodeIdentifierWithPredicates node3 = new NodeIdentifierWithPredicates( NODENAME1,
-                ImmutableMap.<QName, Object>builder().put( KEY1, 10 ).put( KEY2, 20 ).build() );
+        NodeIdentifierWithPredicates node3 = new NodeIdentifierWithPredicates(NODENAME1,
+                ImmutableMap.<QName, Object>builder().put(KEY1, 10).put(KEY2, 20).build());
 
-        NodeIdentifierWithPredicates node4 = new NodeIdentifierWithPredicates( NODENAME1,
-                ImmutableMap.<QName, Object>builder().put( KEY1, 10 ).put( KEY2, 20 ).build() );
+        NodeIdentifierWithPredicates node4 = new NodeIdentifierWithPredicates(NODENAME1,
+                ImmutableMap.<QName, Object>builder().put(KEY1, 10).put(KEY2, 20).build());
 
-        assertEquals( "hashCode", node3.hashCode(), node4.hashCode() );
-        assertEquals( "equals", true, node3.equals( node4 ) );
+        assertEquals("hashCode", node3.hashCode(), node4.hashCode());
+        assertEquals("equals", true, node3.equals(node4));
 
-        assertEquals( "equals", false, node3.equals( node1 ) );
-        assertEquals( "equals", false,
-                node1.equals( new NodeIdentifierWithPredicates( NODENAME1,
-                        ImmutableMap.<QName, Object>builder().put( KEY1, 10 ).put( KEY3, 20 ).build() ) ) );
+        assertEquals("equals", false, node3.equals(node1));
+        assertEquals("equals", false,
+                node1.equals(new NodeIdentifierWithPredicates(NODENAME1,
+                        ImmutableMap.<QName, Object>builder().put(KEY1, 10).put(KEY3, 20).build())));
 
-        node1 = new NodeIdentifierWithPredicates( NODENAME1, KEY1, new byte[]{1,2} );
-        node2 = new NodeIdentifierWithPredicates( NODENAME1, KEY1, new byte[]{1,2} );
+        node1 = new NodeIdentifierWithPredicates(NODENAME1, KEY1, new byte[]{1,2});
+        node2 = new NodeIdentifierWithPredicates(NODENAME1, KEY1, new byte[]{1,2});
 
-        assertEquals( "hashCode", node1.hashCode(), node2.hashCode() );
-        assertEquals( "equals", true, node1.equals( node2 ) );
+        assertEquals("hashCode", node1.hashCode(), node2.hashCode());
+        assertEquals("equals", true, node1.equals(node2));
 
-        assertEquals( "equals", false,
-                node1.equals( new NodeIdentifierWithPredicates( NODENAME1, KEY1, new byte[]{1,3} ) ) );
-        assertEquals( "equals", false,
-                node1.equals( new NodeIdentifierWithPredicates( NODENAME1, KEY1, new byte[]{1} ) ) );
-        assertEquals( "equals", false,
-                node1.equals( new NodeIdentifierWithPredicates( NODENAME1, KEY1, new byte[]{1,2,3} ) ) );
+        assertEquals("equals", false,
+                node1.equals(new NodeIdentifierWithPredicates(NODENAME1, KEY1, new byte[]{1,3})));
+        assertEquals("equals", false,
+                node1.equals(new NodeIdentifierWithPredicates(NODENAME1, KEY1, new byte[]{1})));
+        assertEquals("equals", false,
+                node1.equals(new NodeIdentifierWithPredicates(NODENAME1, KEY1, new byte[]{1,2,3})));
     }
 
     @Test
     public void testNodeWithValue() {
 
-        NodeWithValue<?> node1 = new NodeWithValue<>( NODENAME1, "foo" );
-        assertEquals( "getNodeType", NODENAME1, node1.getNodeType() );
-        assertEquals( "getValue", "foo", node1.getValue() );
+        NodeWithValue<?> node1 = new NodeWithValue<>(NODENAME1, "foo");
+        assertEquals("getNodeType", NODENAME1, node1.getNodeType());
+        assertEquals("getValue", "foo", node1.getValue());
 
-        NodeWithValue<?> node2 = new NodeWithValue<>( NODENAME1, "foo" );
+        NodeWithValue<?> node2 = new NodeWithValue<>(NODENAME1, "foo");
 
-        assertEquals( "hashCode", node1.hashCode(), node2.hashCode() );
-        assertEquals( "equals", true, node1.equals( node2 ) );
+        assertEquals("hashCode", node1.hashCode(), node2.hashCode());
+        assertEquals("equals", true, node1.equals(node2));
 
-        assertEquals( "equals", false, node1.equals( new NodeWithValue<>( NODENAME1, "bar" ) ) );
-        assertEquals( "equals", false, node1.equals( new NodeWithValue<>( NODENAME2, "foo" ) ) );
-        assertEquals( "equals", false, node1.equals( new Object() ) );
+        assertEquals("equals", false, node1.equals(new NodeWithValue<>(NODENAME1, "bar")));
+        assertEquals("equals", false, node1.equals(new NodeWithValue<>(NODENAME2, "foo")));
+        assertEquals("equals", false, node1.equals(new Object()));
 
-        assertNotNull( node1.toString() ); // for code coverage
-        assertNotNull( node1.toRelativeString(node2) );
+        assertNotNull(node1.toString()); // for code coverage
+        assertNotNull(node1.toRelativeString(node2));
 
-        NodeWithValue<?> node3 = new NodeWithValue<>( NODENAME1, new byte[]{1,2} );
-        NodeWithValue<?> node4 = new NodeWithValue<>( NODENAME1, new byte[]{1,2} );
+        NodeWithValue<?> node3 = new NodeWithValue<>(NODENAME1, new byte[]{1,2});
+        NodeWithValue<?> node4 = new NodeWithValue<>(NODENAME1, new byte[]{1,2});
 
-        assertEquals( "hashCode", node3.hashCode(), node4.hashCode() );
-        assertEquals( "equals", true, node3.equals( node4 ) );
+        assertEquals("hashCode", node3.hashCode(), node4.hashCode());
+        assertEquals("equals", true, node3.equals(node4));
 
-        assertEquals( "equals", false, node3.equals( new NodeWithValue<>( NODENAME1, new byte[]{1,3} ) ) );
-        assertEquals( "equals", false, node3.equals( node1 ) );
+        assertEquals("equals", false, node3.equals(new NodeWithValue<>(NODENAME1, new byte[]{1,3})));
+        assertEquals("equals", false, node3.equals(node1));
     }
 
     @Test
     public void testNodeIdentifier() {
 
-        NodeIdentifier node1 = new NodeIdentifier( NODENAME1 );
-        assertEquals( "getNodeType", NODENAME1, node1.getNodeType() );
-        NodeIdentifier node2 = new NodeIdentifier( NODENAME1 );
-        AugmentationIdentifier node3 = new AugmentationIdentifier( Sets.newHashSet( NODENAME1, NODENAME2 ) );
+        final NodeIdentifier node1 = new NodeIdentifier(NODENAME1);
+        assertEquals("getNodeType", NODENAME1, node1.getNodeType());
+        final NodeIdentifier node2 = new NodeIdentifier(NODENAME1);
+        final AugmentationIdentifier node3 = new AugmentationIdentifier(Sets.newHashSet(NODENAME1, NODENAME2));
 
-        assertEquals( "hashCode", node1.hashCode(), node2.hashCode() );
-        assertEquals( "compareTo", 0, node1.compareTo( node2 ) );
-        assertEquals( "compareTo", true, node1.compareTo( new NodeIdentifier( NODENAME3 ) ) != 0 );
+        assertEquals("hashCode", node1.hashCode(), node2.hashCode());
+        assertEquals("compareTo", 0, node1.compareTo(node2));
+        assertEquals("compareTo", true, node1.compareTo(new NodeIdentifier(NODENAME3)) != 0);
 
-        assertEquals( "equals", false, node1.equals( null ) );
-        assertEquals( "equals", false, node1.equals( node3 ) );
-        assertEquals( "equals", true, node1.equals( node1 ) );
-        assertEquals( "equals", true, node1.equals( node2 ) );
-        assertEquals( "equals", false, node1.equals( new NodeIdentifier( NODENAME3 ) ) );
-        assertEquals( "equals", false, node1.equals( new Object() ) );
+        assertEquals("equals", false, node1.equals(null));
+        assertEquals("equals", false, node1.equals(node3));
+        assertEquals("equals", true, node1.equals(node1));
+        assertEquals("equals", true, node1.equals(node2));
+        assertEquals("equals", false, node1.equals(new NodeIdentifier(NODENAME3)));
+        assertEquals("equals", false, node1.equals(new Object()));
 
-        assertNotNull( node1.toString() ); // for code coverage
+        assertNotNull(node1.toString()); // for code coverage
     }
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testAugmentationIdentifierNodeType() {
-        AugmentationIdentifier node1 = new AugmentationIdentifier( Sets.newHashSet( NODENAME1, NODENAME2 ) );
+        AugmentationIdentifier node1 = new AugmentationIdentifier(Sets.newHashSet(NODENAME1, NODENAME2));
         node1.getNodeType();
     }
 
     @Test
     public void testAugmentationIdentifier() {
 
-        AugmentationIdentifier node1 = new AugmentationIdentifier( Sets.newHashSet( NODENAME1, NODENAME2 ) );
-        assertEquals( "getPossibleChildNames", Sets.newHashSet( NODENAME1, NODENAME2 ), node1.getPossibleChildNames() );
-        AugmentationIdentifier node2 = new AugmentationIdentifier( Sets.newHashSet( NODENAME2, NODENAME1 ) );
-        AugmentationIdentifier node3 = new AugmentationIdentifier( Sets.newHashSet( NODENAME1, NODENAME3 ) );
-        AugmentationIdentifier node4 = new AugmentationIdentifier( Sets.newHashSet( NODENAME1, NODENAME2, NODENAME3 ) );
-        NodeIdentifier node5 = new NodeIdentifier( NODENAME3 );
-
-        assertEquals( "hashCode", node1.hashCode(), node2.hashCode() );
-
-        assertEquals( "equals", true, node1.equals( node1 ) );
-        assertEquals( "equals", true, node1.equals( node2 ) );
-        assertEquals( "equals", false, node1.equals( node3 ) );
-        assertEquals( "equals", false, node1.equals( new AugmentationIdentifier( Sets.newHashSet( NODENAME1 ) ) ) );
-        assertEquals( "equals", false, node1.equals( new Object() ) );
-
-        assertEquals( "compareTo", -1, node1.compareTo( node5 ) );
-        assertNotEquals( "compareTo", -1, node1.compareTo( node2 ) );
-        assertEquals( "compareTo", 0, node1.compareTo( node2 ) );
-        assertEquals( "compareTo", 1, node1.compareTo( node4 ) );
-        assertEquals( "compareTo", -1, node4.compareTo( node1 ) );
-
-        assertNotNull( node1.toString() ); // for code coverage
-        assertNotNull( node1.toRelativeString(node5));
+        final AugmentationIdentifier node1 = new AugmentationIdentifier(Sets.newHashSet(NODENAME1, NODENAME2));
+        assertEquals("getPossibleChildNames", Sets.newHashSet(NODENAME1, NODENAME2), node1.getPossibleChildNames());
+        final AugmentationIdentifier node2 = new AugmentationIdentifier(Sets.newHashSet(NODENAME2, NODENAME1));
+        final AugmentationIdentifier node3 = new AugmentationIdentifier(Sets.newHashSet(NODENAME1, NODENAME3));
+        final AugmentationIdentifier node4 = new AugmentationIdentifier(Sets.newHashSet(NODENAME1, NODENAME2,
+                    NODENAME3));
+        final NodeIdentifier node5 = new NodeIdentifier(NODENAME3);
+
+        assertEquals("hashCode", node1.hashCode(), node2.hashCode());
+
+        assertEquals("equals", true, node1.equals(node1));
+        assertEquals("equals", true, node1.equals(node2));
+        assertEquals("equals", false, node1.equals(node3));
+        assertEquals("equals", false, node1.equals(new AugmentationIdentifier(Sets.newHashSet(NODENAME1))));
+        assertEquals("equals", false, node1.equals(new Object()));
+
+        assertEquals("compareTo", -1, node1.compareTo(node5));
+        assertNotEquals("compareTo", -1, node1.compareTo(node2));
+        assertEquals("compareTo", 0, node1.compareTo(node2));
+        assertEquals("compareTo", 1, node1.compareTo(node4));
+        assertEquals("compareTo", -1, node4.compareTo(node1));
+
+        assertNotNull(node1.toString()); // for code coverage
+        assertNotNull(node1.toRelativeString(node5));
     }
 
-    private static YangInstanceIdentifier serdes(final YangInstanceIdentifier id) throws IOException, ClassNotFoundException {
+    private static YangInstanceIdentifier serdes(final YangInstanceIdentifier id) throws IOException,
+            ClassNotFoundException {
         final ByteArrayOutputStream bos = new ByteArrayOutputStream();
         try (final ObjectOutputStream oos = new ObjectOutputStream(bos)) {
             oos.writeObject(id);
index 1ed24c9e6ac53a2fab351920cd7037b7dafb7d22..a8ee218f802f07a4c52a4a48d453de3766bd755d 100644 (file)
@@ -41,7 +41,8 @@ public class NormalizedNodesTest {
         final DataContainerNode<?> mockedDataContainerNode = mock(DataContainerNode.class);
         final ContainerNode mockedContainerNode = mock(ContainerNode.class);
         doReturn(Optional.of(mockedContainerNode)).when(mockedDataContainerNode).getChild(any(PathArgument.class));
-        assertEquals(mockedContainerNode, NormalizedNodes.getDirectChild(mockedDataContainerNode, mockedPathArgument).get());
+        assertEquals(mockedContainerNode, NormalizedNodes.getDirectChild(mockedDataContainerNode, mockedPathArgument)
+                .get());
 
         final MapNode mockedMapNode = mock(MapNode.class);
         final QName listQName = QName.create("test-ns", "test-list");
@@ -50,7 +51,8 @@ public class NormalizedNodesTest {
                 new NodeIdentifierWithPredicates(listQName, listKeyQName, "str-value");
         final MapEntryNode mockedMapEntryNode = mock(MapEntryNode.class);
         doReturn(Optional.of(mockedMapEntryNode)).when(mockedMapNode).getChild(any(NodeIdentifierWithPredicates.class));
-        assertEquals(mockedMapEntryNode, NormalizedNodes.getDirectChild(mockedMapNode, nodeIdentifierWithPredicates).get());
+        assertEquals(mockedMapEntryNode, NormalizedNodes.getDirectChild(mockedMapNode, nodeIdentifierWithPredicates)
+                .get());
         assertEquals(Optional.absent(), NormalizedNodes.getDirectChild(mockedMapNode, mockedPathArgument));
 
         final LeafSetNode<?> mockedLeafSetNode = mock(LeafSetNode.class);
@@ -122,7 +124,7 @@ public class NormalizedNodesTest {
 
         stringTree = NormalizedNodes.toStringTree(mockedAugmentationNode);
         assertNotNull(stringTree);
-        assertEquals("augmentation {\n    list-node {\n        list-node[key-leaf-value] {\n            leaf-node " +
-                "str-value-1\n        }\n    }\n}\n", stringTree);
+        assertEquals("augmentation {\n    list-node {\n        list-node[key-leaf-value] {\n            leaf-node "
+                "str-value-1\n        }\n    }\n}\n", stringTree);
     }
 }
index 4ee8bb51fb7ad9bc88803a7e705b15a986bc5272..0adef450023980eb72f5831c67dbff4e9d18a099 100644 (file)
@@ -69,8 +69,8 @@ public class NormalizedNodeWriterTest {
     @Test
     public void testNormalizedNodeWriter() throws IOException {
         final NormalizedNodeStreamWriter loggingNormalizedNodeStreamWriter = new LoggingNormalizedNodeStreamWriter();
-        final NormalizedNodeWriter orderedNormalizedNodeWriter = NormalizedNodeWriter.forStreamWriter
-                (loggingNormalizedNodeStreamWriter);
+        final NormalizedNodeWriter orderedNormalizedNodeWriter = NormalizedNodeWriter.forStreamWriter(
+                loggingNormalizedNodeStreamWriter);
 
         assertEquals(loggingNormalizedNodeStreamWriter, orderedNormalizedNodeWriter.getWriter());
 
@@ -136,8 +136,8 @@ public class NormalizedNodeWriterTest {
         orderedNormalizedNodeWriter.flush();
         orderedNormalizedNodeWriter.close();
 
-        final NormalizedNodeWriter normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter
-                (loggingNormalizedNodeStreamWriter, false);
+        final NormalizedNodeWriter normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter(
+                loggingNormalizedNodeStreamWriter, false);
 
         assertNotNull(normalizedNodeWriter.write(mockedMapEntryNode));
 
index 09cdaed62ec10ded984009727f12b4e68d2ab536..62a2cac1f4c906c4f66bed47da4faecca4d3a2b3 100644 (file)
@@ -30,7 +30,8 @@ public class DataTreeCandidateNodesTest {
     @Test
     public void testFromNormalizedNode() {
         final NormalizedNode<?, ?> mockedNormalizedNode = mock(NormalizedNode.class);
-        final DataTreeCandidateNode dataTreeCandidateNode = DataTreeCandidateNodes.fromNormalizedNode(mockedNormalizedNode);
+        final DataTreeCandidateNode dataTreeCandidateNode = DataTreeCandidateNodes.fromNormalizedNode(
+                mockedNormalizedNode);
         assertNotNull(dataTreeCandidateNode);
     }
 
index 5f61ac8b5fa96f09ee7dbf6e6763ed60643b5e20..f769a3a7a96ca22179bfbb985e3791e61fa37fa0 100644 (file)
@@ -61,7 +61,8 @@ public class NormalizedNodeDataTreeCandidateNodeTest {
         doReturn(Optional.absent()).when(mockedNormalizedNodeContainer).getChild(any(PathArgument.class));
         assertNull(normalizedNodeDataTreeCandidateNode2.getModifiedChild(mockedPathArgument));
 
-        doReturn(Optional.of(mockedChildNormNode1)).when(mockedNormalizedNodeContainer).getChild(any(PathArgument.class));
+        doReturn(Optional.of(mockedChildNormNode1)).when(mockedNormalizedNodeContainer).getChild(
+                any(PathArgument.class));
         assertNotNull(normalizedNodeDataTreeCandidateNode2.getModifiedChild(mockedPathArgument));
     }
 }
index 1477d5ce68b251a78a69e1f13aa1215c990c3047..c9fe7cd4998837749c424fbfd9653cdd8857bbb0 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.yangtools.yang.data.api.schema.tree.spi;
 
 import static org.junit.Assert.assertEquals;
 import static org.mockito.Mockito.mock;
+
 import java.util.Map;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
index bbf6e1dec6eac5f94108a1e887d4b5eec84194fb..a26e3812140602d1fed05d9dac60fd1b80109586 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.yangtools.yang.data.api.schema.tree.spi;
 
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
+
 import org.junit.Test;
 import org.mockito.Mockito;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
index 09b26cda123e4d6416be77c40d39357beb62fc63..f4053455ff0577f28997c86b439ffc5e5f528a4f 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.yangtools.yang.data.api.schema.tree.spi;
 
 import static org.junit.Assert.assertFalse;
+
 import org.junit.Test;
 
 public class VersionTest {
@@ -19,7 +20,7 @@ public class VersionTest {
 
         assertFalse(v1.equals(v2));
         assertFalse(v2.equals(v1));
-     }
+    }
 
     @Test
     public void testNext() {