Skip to content

Commit

Permalink
[MNG-6631] documented the performance intent
Browse files Browse the repository at this point in the history
  • Loading branch information
hboutemy committed Apr 27, 2019
1 parent 44ad1aa commit d34e8fb
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,14 @@ private static Integer getNextIntegerToken( StringTokenizer tok )

private static Integer tryParseInt( String s )
{
// for performance, check digits instead of relying later on catching NumberFormatException
if ( !isDigits( s ) )
{
return null;
}

try
{
if ( !isDigits( s ) )
{
return null;
}
long longValue = Long.parseLong( s );
if ( longValue > Integer.MAX_VALUE )
{
Expand All @@ -236,6 +238,7 @@ private static Integer tryParseInt( String s )
}
catch ( NumberFormatException e )
{
// should never happen since checked isDigits(s) before
return null;
}
}
Expand Down

0 comments on commit d34e8fb

Please sign in to comment.