[MNG-6643] - Version comparison CLI does not work anymore

This commit is contained in:
Karl Heinz Marbaise 2019-04-23 20:47:45 +02:00
parent fdde73fcb4
commit 80c6fe3a01
No known key found for this signature in database
GPG Key ID: BF1518E0160788A2
1 changed files with 10 additions and 5 deletions

View File

@ -29,8 +29,6 @@ import java.util.List;
import java.util.Locale;
import java.util.Properties;
import org.apache.commons.lang3.StringUtils;
/**
* <p>
* Generic implementation of version comparison.
@ -609,12 +607,19 @@ public class ComparableVersion
private static String stripLeadingZeroes( String buf )
{
String strippedBuf = StringUtils.stripStart( buf, "0" );
if ( strippedBuf.isEmpty() )
if ( buf == null || buf.isEmpty() )
{
return "0";
}
return strippedBuf;
for ( int i = 0; i < buf.length(); ++i )
{
char c = buf.charAt( i );
if ( c != '0' )
{
return buf.substring( i );
}
}
return buf;
}
@Override