MCPcopy Create free account
hub / github.com/apache/tomcat / parseLong

Method parseLong

java/org/apache/tomcat/util/buf/Ascii.java:91–108  ·  view source on GitHub ↗

Parses an unsigned long from the specified sub array of bytes. @param b the bytes to parse @param off the start offset of the bytes @param len the length of the bytes @return the long value @exception NumberFormatException if the long format was invalid

(byte[] b, int off, int len)

Source from the content-addressed store, hash-verified

89 * @exception NumberFormatException if the long format was invalid
90 */
91 public static long parseLong(byte[] b, int off, int len) throws NumberFormatException {
92 int c;
93
94 if (b == null || len <= 0 || !isDigit(c = b[off++])) {
95 throw new NumberFormatException();
96 }
97
98 long n = c - '0';
99 while (--len > 0) {
100 if (isDigit(c = b[off++]) && (n < OVERFLOW_LIMIT || (n == OVERFLOW_LIMIT && (c - '0') < 8))) {
101 n = n * 10 + c - '0';
102 } else {
103 throw new NumberFormatException();
104 }
105 }
106
107 return n;
108 }
109}

Callers 15

testParseLong1Method · 0.95
testParseLong2Method · 0.95
testParseLong3Method · 0.95
testParseLong4Method · 0.95
testParseLong5Method · 0.95
getLongMethod · 0.95
getValueAsLongMethod · 0.45
parsePoolPropertiesMethod · 0.45
setPropertiesMethod · 0.45
runMethod · 0.45
mainMethod · 0.45
createChannelMethod · 0.45

Calls 1

isDigitMethod · 0.95

Tested by 12

testParseLong1Method · 0.76
testParseLong2Method · 0.76
testParseLong3Method · 0.76
testParseLong4Method · 0.76
testParseLong5Method · 0.76
mainMethod · 0.36
createChannelMethod · 0.36
runMethod · 0.36
mainMethod · 0.36
testBug57601Method · 0.36
testBug57602Method · 0.36