public JavaVersion(String javaVersion) throws VersionException {
  this.javaVersion=javaVersion;
  int versionDelimiters=0;
  int lastIndex=0;
  while ((lastIndex=javaVersion.indexOf(VERSION_DELIMITER,lastIndex + 1)) != -1) {
    versionDelimiters++;
  }
  int indexUpdate;
  if (versionDelimiters == 3) {
    indexUpdate=javaVersion.lastIndexOf(VERSION_DELIMITER);
  }
 else {
    indexUpdate=javaVersion.indexOf(START_UPDATE);
  }
  int indexIdentifier=javaVersion.indexOf(START_IDENTIFIER);
  String versionRead=null;
  String updateRead="0";
  String identifierRead=null;
  if (indexUpdate == -1 && indexIdentifier == -1) {
    versionRead=javaVersion;
  }
 else   if (indexUpdate != -1 && indexIdentifier == -1) {
    versionRead=javaVersion.substring(0,indexUpdate);
    updateRead=javaVersion.substring(indexUpdate + 1);
  }
 else   if (indexUpdate == -1) {
    versionRead=javaVersion.substring(0,indexIdentifier);
    identifierRead=javaVersion.substring(indexIdentifier + 1);
  }
 else {
    versionRead=javaVersion.substring(0,indexUpdate);
    updateRead=javaVersion.substring(indexUpdate + 1,indexIdentifier);
    identifierRead=javaVersion.substring(indexIdentifier + 1);
  }
  StringTokenizer strTok=new StringTokenizer(versionRead,"" + VERSION_DELIMITER);
  if (strTok.countTokens() != 3) {
    throw new VersionException(MessageFormat.format(res.getString("NoParseJavaVersion.exception.message"),javaVersion));
  }
  String majorRead=strTok.nextToken();
  try {
    major=Integer.parseInt(majorRead);
  }
 catch (  NumberFormatException ex) {
    throw new VersionException(MessageFormat.format(res.getString("NoParseJavaVersion.exception.message"),javaVersion));
  }
  if (major < 0) {
    throw new VersionException(MessageFormat.format(res.getString("NoParseJavaVersion.exception.message"),javaVersion));
  }
  String middleRead=strTok.nextToken();
  try {
    middle=Integer.parseInt(middleRead);
  }
 catch (  NumberFormatException ex) {
    throw new VersionException(MessageFormat.format(res.getString("NoParseJavaVersion.exception.message"),javaVersion));
  }
  if (middle < 0) {
    throw new VersionException(MessageFormat.format(res.getString("NoParseJavaVersion.exception.message"),javaVersion));
  }
  String minorRead=strTok.nextToken();
  try {
    minor=Integer.parseInt(minorRead);
  }
 catch (  NumberFormatException ex) {
    throw new VersionException(MessageFormat.format(res.getString("NoParseJavaVersion.exception.message"),javaVersion));
  }
  if (minor < 0) {
    throw new VersionException(MessageFormat.format(res.getString("NoParseJavaVersion.exception.message"),javaVersion));
  }
  try {
    update=Integer.parseInt(updateRead);
  }
 catch (  NumberFormatException ex) {
    throw new VersionException(MessageFormat.format(res.getString("NoParseJavaVersion.exception.message"),javaVersion));
  }
  if (update < 0) {
    throw new VersionException(MessageFormat.format(res.getString("NoParseJavaVersion.exception.message"),javaVersion));
  }
  this.identifier=identifierRead;
}

public JavaVersion ( String javaVersion ) throws VersionException { this . javaVersion = javaVersion ; int versionDelimiters = 0 ; int lastIndex = 0 ; while ( ( lastIndex = javaVersion . indexOf ( VERSION_DELIMITER , lastIndex + 1 ) ) != - 1 ) { versionDelimiters ++ ; } int indexUpdate ; if ( versionDelimiters == 3 ) { indexUpdate = javaVersion . lastIndexOf ( VERSION_DELIMITER ) ; } else { indexUpdate = javaVersion . indexOf ( START_UPDATE ) ; } int indexIdentifier = javaVersion . indexOf ( START_IDENTIFIER ) ; String versionRead = null ; String updateRead = "0" ; String identifierRead = null ; if ( indexUpdate == - 1 && indexIdentifier == - 1 ) { versionRead = javaVersion ; } else if ( indexUpdate != - 1 && indexIdentifier == - 1 ) { versionRead = javaVersion . substring ( 0 , indexUpdate ) ; updateRead = javaVersion . substring ( indexUpdate + 1 ) ; } else if ( indexUpdate == - 1 ) { versionRead = javaVersion . substring ( 0 , indexIdentifier ) ; identifierRead = javaVersion . substring ( indexIdentifier + 1 ) ; } else { versionRead = javaVersion . substring ( 0 , indexUpdate ) ; updateRead = javaVersion . substring ( indexUpdate + 1 , indexIdentifier ) ; identifierRead = javaVersion . substring ( indexIdentifier + 1 ) ; } StringTokenizer strTok = new StringTokenizer ( versionRead , "" + VERSION_DELIMITER ) ; if ( strTok . countTokens ( ) != 3 ) { throw new VersionException ( MessageFormat . format ( res . getString ( "NoParseJavaVersion.exception.message" ) , javaVersion ) ) ; } String majorRead = strTok . nextToken ( ) ; try { major = Integer . parseInt ( majorRead ) ; } catch ( NumberFormatException ex ) { throw new VersionException ( MessageFormat . format ( res . getString ( "NoParseJavaVersion.exception.message" ) , javaVersion ) ) ; } if ( major < 0 ) { throw new VersionException ( MessageFormat . format ( res . getString ( "NoParseJavaVersion.exception.message" ) , javaVersion ) ) ; } String middleRead = strTok . nextToken ( ) ; try { middle = Integer . parseInt ( middleRead ) ; } catch ( NumberFormatException ex ) { throw new VersionException ( MessageFormat . format ( res . getString ( "NoParseJavaVersion.exception.message" ) , javaVersion ) ) ; } if ( middle < 0 ) { throw new VersionException ( MessageFormat . format ( res . getString ( "NoParseJavaVersion.exception.message" ) , javaVersion ) ) ; } String minorRead = strTok . nextToken ( ) ; try { minor = Integer . parseInt ( minorRead ) ; } catch ( NumberFormatException ex ) { throw new VersionException ( MessageFormat . format ( res . getString ( "NoParseJavaVersion.exception.message" ) , javaVersion ) ) ; } if ( minor < 0 ) { throw new VersionException ( MessageFormat . format ( res . getString ( "NoParseJavaVersion.exception.message" ) , javaVersion ) ) ; } try { update = Integer . parseInt ( updateRead ) ; } catch ( NumberFormatException ex ) { throw new VersionException ( MessageFormat . format ( res . getString ( "NoParseJavaVersion.exception.message" ) , javaVersion ) ) ; } if ( update < 0 ) { throw new VersionException ( MessageFormat . format ( res . getString ( "NoParseJavaVersion.exception.message" ) , javaVersion ) ) ; } this . identifier = identifierRead ; }
construct a javaversion object from the supplied string .
