Fix code smells in AlwaysFailOperation
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / tree / AlwaysFailOperation.java
index 8463c836e8ac2b079604de2744d0448a774861c9..9c662e5779a082518ba6c3ea04e89261e4bb3f16 100644 (file)
@@ -28,39 +28,43 @@ final class AlwaysFailOperation extends ModificationApplyOperation {
     }
 
     @Override
-    Optional<TreeNode> apply(final ModifiedNode modification,
-            final Optional<TreeNode> storeMeta, final Version version) {
-        throw new IllegalStateException("Schema Context is not available.");
+    Optional<TreeNode> apply(final ModifiedNode modification, final Optional<TreeNode> storeMeta,
+            final Version version) {
+        throw ise();
     }
 
     @Override
     void checkApplicable(final YangInstanceIdentifier path, final NodeModification modification,
             final Optional<TreeNode> storeMetadata, final Version version) {
-        throw new IllegalStateException("Schema Context is not available.");
+        throw ise();
     }
 
     @Override
     public Optional<ModificationApplyOperation> getChild(final PathArgument child) {
-        throw new IllegalStateException("Schema Context is not available.");
+        throw ise();
     }
 
     @Override
     void verifyStructure(final NormalizedNode<?, ?> modification, final boolean verifyChildren) {
-        throw new IllegalStateException("Schema Context is not available.");
+        throw ise();
     }
 
     @Override
     ChildTrackingPolicy getChildPolicy() {
-        throw new IllegalStateException("Schema Context is not available.");
+        throw ise();
     }
 
     @Override
     void mergeIntoModifiedNode(final ModifiedNode node, final NormalizedNode<?, ?> value, final Version version) {
-        throw new IllegalStateException("Schema Context is not available.");
+        throw ise();
     }
 
     @Override
     void recursivelyVerifyStructure(final NormalizedNode<?, ?> value) {
-        throw new IllegalStateException("Schema Context is not available.");
+        throw ise();
     }
-}
\ No newline at end of file
+
+    private static IllegalStateException ise() {
+        return new IllegalStateException("Schema Context is not available.");
+    }
+}