mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 02:05:53 +00:00
Avoid expensive calls to getClass().getSimpleName() in Message
This commit is contained in:
parent
9c124ac257
commit
a011948139
@ -115,10 +115,10 @@ public abstract class Message implements Serializable {
|
|||||||
parsed = true;
|
parsed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkState(this.length != UNKNOWN_LENGTH,
|
if (this.length == UNKNOWN_LENGTH)
|
||||||
"Length field has not been set in constructor for %s after %s parse. " +
|
checkState(false, "Length field has not been set in constructor for %s after %s parse. " +
|
||||||
"Refer to Message.parseLite() for detail of required Length field contract.",
|
"Refer to Message.parseLite() for detail of required Length field contract.",
|
||||||
getClass().getSimpleName(), parseLazy ? "lite" : "full");
|
getClass().getSimpleName(), parseLazy ? "lite" : "full");
|
||||||
|
|
||||||
if (SELF_CHECK) {
|
if (SELF_CHECK) {
|
||||||
selfCheck(msg, offset);
|
selfCheck(msg, offset);
|
||||||
@ -397,8 +397,8 @@ public abstract class Message implements Serializable {
|
|||||||
if (length != UNKNOWN_LENGTH)
|
if (length != UNKNOWN_LENGTH)
|
||||||
return length;
|
return length;
|
||||||
maybeParse();
|
maybeParse();
|
||||||
checkState(length != UNKNOWN_LENGTH,
|
if (length == UNKNOWN_LENGTH)
|
||||||
"Length field has not been set in %s after full parse.", getClass().getSimpleName());
|
checkState(false, "Length field has not been set in %s after full parse.", getClass().getSimpleName());
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user