Introduce formatting methods for SourceException
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / effective / type / BitsSpecificationEffectiveStatementImpl.java
index 05374ce27c7d4ff9137b37556e733063d18ff06c..b688f18f46d00c8fb0d6933940b1eba63d358ecf 100644 (file)
@@ -41,17 +41,16 @@ public final class BitsSpecificationEffectiveStatementImpl extends
                     } else if (highestPosition != 4294967295L) {
                         newPos = highestPosition + 1;
                     } else {
-                        throw new SourceException("Bit " + b + " must have a position statement",
-                            ctx.getStatementSourceReference());
+                        throw new SourceException(ctx.getStatementSourceReference(),
+                            "Bit %s must have a position statement", b);
                     }
 
                     b = new BitImpl(newPos, b.getQName(), b.getPath(), b.getDescription(), b.getReference(),
                         b.getStatus(), b.getUnknownSchemaNodes());
                 }
 
-                if (b.getPosition() < 0L || b.getPosition() > 4294967295L) {
-                    throw new SourceException("Bit " + b + " has illegal position", ctx.getStatementSourceReference());
-                }
+                SourceException.throwIf(b.getPosition() < 0L && b.getPosition() > 4294967295L,
+                        ctx.getStatementSourceReference(), "Bit %s has illegal position", b);
 
                 if (highestPosition == null || highestPosition < b.getPosition()) {
                     highestPosition = b.getPosition();