Skip to content

Commit 71ebcd2

Browse files
committed
No need to end exception messages with an exclamation!
1 parent 85a5edd commit 71ebcd2

8 files changed

Lines changed: 23 additions & 23 deletions

File tree

src/main/java/org/apache/bcel/classfile/Utility.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ public static String codeToString(final ByteSequence bytes, final ConstantPool c
561561
buf.append(bytes.readInt());
562562
break;
563563
default: // Never reached
564-
throw new IllegalStateException("Unreachable default case reached!");
564+
throw new IllegalStateException("Unreachable default case reached.");
565565
}
566566
}
567567
}

src/main/java/org/apache/bcel/generic/FieldGen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ private void checkType(final Type atype) {
164164
throw new ClassGenException("You haven't defined the type of the field yet");
165165
}
166166
if (!isFinal()) {
167-
throw new ClassGenException("Only final fields may have an initial value!");
167+
throw new ClassGenException("Only final fields may have an initial value.");
168168
}
169169
if (!superType.equals(atype)) {
170170
throw new ClassGenException("Types are not compatible: " + superType + " vs. " + atype);

src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -581,13 +581,13 @@ public void visitField(final Field obj) {
581581
}
582582
} else { // isInterface!
583583
if (!obj.isPublic()) {
584-
throw new ClassConstraintException("Interface field '" + tostring(obj) + "' must have the ACC_PUBLIC modifier set but hasn't!");
584+
throw new ClassConstraintException("Interface field '" + tostring(obj) + "' must have the ACC_PUBLIC modifier set but hasn't.");
585585
}
586586
if (!obj.isStatic()) {
587-
throw new ClassConstraintException("Interface field '" + tostring(obj) + "' must have the ACC_STATIC modifier set but hasn't!");
587+
throw new ClassConstraintException("Interface field '" + tostring(obj) + "' must have the ACC_STATIC modifier set but hasn't.");
588588
}
589589
if (!obj.isFinal()) {
590-
throw new ClassConstraintException("Interface field '" + tostring(obj) + "' must have the ACC_FINAL modifier set but hasn't!");
590+
throw new ClassConstraintException("Interface field '" + tostring(obj) + "' must have the ACC_FINAL modifier set but hasn't.");
591591
}
592592
}
593593

@@ -617,7 +617,7 @@ public void visitField(final Field obj) {
617617

618618
final String nameanddesc = name + sig;
619619
if (fieldNamesAndDesc.contains(nameanddesc)) {
620-
throw new ClassConstraintException("No two fields (like '" + tostring(obj) + "') are allowed have same names and descriptors!");
620+
throw new ClassConstraintException("No two fields (like '" + tostring(obj) + "') are allowed have same names and descriptors.");
621621
}
622622
if (fieldNames.contains(name)) {
623623
addMessage("More than one field of name '" + name + "' detected (but with different type descriptors). This is very unusual.");
@@ -897,10 +897,10 @@ public void visitMethod(final Method obj) {
897897

898898
} else {
899899
if (!obj.isPublic()) {
900-
throw new ClassConstraintException("Interface method '" + tostring(obj) + "' must have the ACC_PUBLIC modifier set but hasn't!");
900+
throw new ClassConstraintException("Interface method '" + tostring(obj) + "' must have the ACC_PUBLIC modifier set but hasn't.");
901901
}
902902
if (!obj.isAbstract()) {
903-
throw new ClassConstraintException("Interface method '" + tostring(obj) + "' must have the ACC_ABSTRACT modifier set but hasn't!");
903+
throw new ClassConstraintException("Interface method '" + tostring(obj) + "' must have the ACC_ABSTRACT modifier set but hasn't.");
904904
}
905905
if (obj.isPrivate() || obj.isProtected() || obj.isStatic() || obj.isFinal() || obj.isSynchronized() || obj.isNative() || obj.isStrictfp()) {
906906
throw new ClassConstraintException("Interface method '" + tostring(obj) + "' must not have"
@@ -918,7 +918,7 @@ public void visitMethod(final Method obj) {
918918

919919
final String nameanddesc = name + sig;
920920
if (methodNamesAndDesc.contains(nameanddesc)) {
921-
throw new ClassConstraintException("No two methods (like '" + tostring(obj) + "') are allowed have same names and desciptors!");
921+
throw new ClassConstraintException("No two methods (like '" + tostring(obj) + "') are allowed have same names and desciptors.");
922922
}
923923
methodNamesAndDesc.add(nameanddesc);
924924

@@ -1015,7 +1015,7 @@ private FAMRAV_Visitor(final JavaClass jc) {
10151015
@Override
10161016
public void visitConstantFieldref(final ConstantFieldref obj) {
10171017
if (obj.getTag() != Const.CONSTANT_Fieldref) {
1018-
throw new ClassConstraintException("ConstantFieldref '" + tostring(obj) + "' has wrong tag!");
1018+
throw new ClassConstraintException("ConstantFieldref '" + tostring(obj) + "' has wrong tag.");
10191019
}
10201020
final int nameAndTypeIndex = obj.getNameAndTypeIndex();
10211021
final ConstantNameAndType cnat = (ConstantNameAndType) cp.getConstant(nameAndTypeIndex);
@@ -1043,7 +1043,7 @@ public void visitConstantFieldref(final ConstantFieldref obj) {
10431043
@Override
10441044
public void visitConstantInterfaceMethodref(final ConstantInterfaceMethodref obj) {
10451045
if (obj.getTag() != Const.CONSTANT_InterfaceMethodref) {
1046-
throw new ClassConstraintException("ConstantInterfaceMethodref '" + tostring(obj) + "' has wrong tag!");
1046+
throw new ClassConstraintException("ConstantInterfaceMethodref '" + tostring(obj) + "' has wrong tag.");
10471047
}
10481048
final int nameAndTypeIndex = obj.getNameAndTypeIndex();
10491049
final ConstantNameAndType cnat = (ConstantNameAndType) cp.getConstant(nameAndTypeIndex);
@@ -1076,7 +1076,7 @@ public void visitConstantInterfaceMethodref(final ConstantInterfaceMethodref obj
10761076
@Override
10771077
public void visitConstantMethodref(final ConstantMethodref obj) {
10781078
if (obj.getTag() != Const.CONSTANT_Methodref) {
1079-
throw new ClassConstraintException("ConstantMethodref '" + tostring(obj) + "' has wrong tag!");
1079+
throw new ClassConstraintException("ConstantMethodref '" + tostring(obj) + "' has wrong tag.");
10801080
}
10811081
final int nameAndTypeIndex = obj.getNameAndTypeIndex();
10821082
final ConstantNameAndType cnat = (ConstantNameAndType) cp.getConstant(nameAndTypeIndex);

src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ public VerificationResult do_verify() {
10211021
final JavaClass jc = Repository.lookupClass(verifier.getClassName());
10221022
final Method[] methods = jc.getMethods();
10231023
if (methodNo >= methods.length) {
1024-
throw new InvalidMethodException("METHOD DOES NOT EXIST!");
1024+
throw new InvalidMethodException("METHOD DOES NOT EXIST.");
10251025
}
10261026
final Method method = methods[methodNo];
10271027
code = method.getCode();
@@ -1120,13 +1120,13 @@ private void pass3StaticInstructionChecks() {
11201120
while (ih != null) {
11211121
final Instruction i = ih.getInstruction();
11221122
if (i instanceof IMPDEP1) {
1123-
throw new StaticCodeInstructionConstraintException("IMPDEP1 must not be in the code, it is an illegal instruction for _internal_ JVM use!");
1123+
throw new StaticCodeInstructionConstraintException("IMPDEP1 must not be in the code, it is an illegal instruction for _internal_ JVM use.");
11241124
}
11251125
if (i instanceof IMPDEP2) {
1126-
throw new StaticCodeInstructionConstraintException("IMPDEP2 must not be in the code, it is an illegal instruction for _internal_ JVM use!");
1126+
throw new StaticCodeInstructionConstraintException("IMPDEP2 must not be in the code, it is an illegal instruction for _internal_ JVM use.");
11271127
}
11281128
if (i instanceof BREAKPOINT) {
1129-
throw new StaticCodeInstructionConstraintException("BREAKPOINT must not be in the code, it is an illegal instruction for _internal_ JVM use!");
1129+
throw new StaticCodeInstructionConstraintException("BREAKPOINT must not be in the code, it is an illegal instruction for _internal_ JVM use.");
11301130
}
11311131
ih = ih.getNext();
11321132
}

src/main/java/org/apache/bcel/verifier/structurals/ControlFlowGraph.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private InstructionHandle[] _getSuccessors() {
104104
final Subroutine s = subroutines.subroutineOf(getInstruction());
105105
if (s == null) { // return empty;
106106
// RET in dead code. "empty" would be the correct answer, but we know something about the surrounding project...
107-
throw new AssertionViolatedException("Asking for successors of a RET in dead code?!");
107+
throw new AssertionViolatedException("Asking for successors of a RET in dead code?.");
108108
}
109109

110110
//TODO: remove. Only JustIce must not use it, but foreign users of the ControlFlowGraph
@@ -398,7 +398,7 @@ public ControlFlowGraph(final MethodGen methodGen, final boolean enableJustIceCh
398398
public InstructionContext contextOf(final InstructionHandle inst) {
399399
final InstructionContext ic = instructionContexts.get(inst);
400400
if (ic == null) {
401-
throw new AssertionViolatedException("InstructionContext requested for an InstructionHandle that's not known!");
401+
throw new AssertionViolatedException("InstructionContext requested for an InstructionHandle that's not known.");
402402
}
403403
return ic;
404404
}

src/main/java/org/apache/bcel/verifier/structurals/InstConstraintVisitor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ public void visitCHECKCAST(final CHECKCAST o) {
459459
public void visitCPInstruction(final CPInstruction o) {
460460
final int idx = o.getIndex();
461461
if (idx < 0 || idx >= cpg.getSize()) {
462-
throw new AssertionViolatedException("Huh?! Constant pool index of instruction '" + o + "' illegal? Pass 3a should have checked this!");
462+
throw new AssertionViolatedException("Huh?! Constant pool index of instruction '" + o + "' illegal? Pass 3a should have checked this.");
463463
}
464464
}
465465

@@ -2360,7 +2360,7 @@ public void visitNEW(final NEW o) {
23602360

23612361
final Type t = o.getType(cpg);
23622362
if (!(t instanceof ReferenceType)) {
2363-
throw new AssertionViolatedException("NEW.getType() returning a non-reference type?!");
2363+
throw new AssertionViolatedException("NEW.getType() returning a non-reference type?.");
23642364
}
23652365
if (!(t instanceof ObjectType)) {
23662366
constraintViolated(o, "Expecting a class type (ObjectType) to work on. Found: '" + t + "'.");
@@ -2484,7 +2484,7 @@ public void visitRET(final RET o) {
24842484
constraintViolated(o, "Expecting a ReturnaddressType in local variable " + o.getIndex() + ".");
24852485
}
24862486
if (locals().get(o.getIndex()) == ReturnaddressType.NO_TARGET) {
2487-
throw new AssertionViolatedException("RET expecting a target!");
2487+
throw new AssertionViolatedException("RET expecting a target.");
24882488
}
24892489
// Other constraints such as non-allowed overlapping subroutines are enforced
24902490
// while building the Subroutines data structure.

src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ private void circulationPump(final MethodGen m, final ControlFlowGraph cfg, fina
206206
int skipJsr = 0;
207207
for (int ss = oldchain.size() - 1; ss >= 0; ss--) {
208208
if (skipJsr < 0) {
209-
throw new AssertionViolatedException("More RET than JSR in execution chain?!");
209+
throw new AssertionViolatedException("More RET than JSR in execution chain?.");
210210
}
211211
//System.err.println("+"+oldchain.get(ss));
212212
if (oldchain.get(ss).getInstruction().getInstruction() instanceof JsrInstruction) {

src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public void addEnteringJsrInstruction(final InstructionHandle jsrInst) {
110110
throw new AssertionViolatedException("Expecting JsrInstruction InstructionHandle.");
111111
}
112112
if (localVariable == UNSET) {
113-
throw new AssertionViolatedException("Set the localVariable first!");
113+
throw new AssertionViolatedException("Set the localVariable first.");
114114
}
115115
// Something is wrong when an ASTORE is targeted that does not operate on the same local variable than the rest of the
116116
// JsrInstruction-targets and the RET.

0 commit comments

Comments
 (0)