Check for exact lengths of both strings instead of > 0. We have one additional length check but the string conversions happen only when the string length matches.
This change should be save, anyhow comments are welcome.
And as we know that the length of head will get ~16 bytes one could initialize it with at least 16 bytes to avoid that the JVM extends the buffer during runtime. Currently 5 bytes are used: "protected StringBuilder head = new StringBuilder(5);"
https://github.com/igniterealtime/Openfire/blob/master/src/java/org/jivesoftware/openfire/nio/XMLLightweightParser.java#384
Check for exact lengths of both strings instead of > 0. We have one additional length check but the string conversions happen only when the string length matches.
This change should be save, anyhow comments are welcome.
And as we know that the length of head will get ~16 bytes one could initialize it with at least 16 bytes to avoid that the JVM extends the buffer during runtime. Currently 5 bytes are used: "protected StringBuilder head = new StringBuilder(5);"