private int [ ] parse ( String version ) { final Matcher m = Pattern . compile ( "(\\d+)\\.(\\d+)\\.(\\d+)-?(SNAPSHOT)?\\.?(\\d*)?" ) . matcher ( version ) ; if ( ! m . matches ( ) ) { throw new IllegalArgumentException ( "Malformed version string: " + version ) ; } return new int [ ] { Integer . parseInt ( m . group ( 1 ) ) , // major Integer . parseInt ( m . group ( 2 ) ) , // minor Integer . parseInt ( m . group ( 3 ) ) , // revision m . group ( 4 ) == null ? 0 // no SNAPSHOT suffix : m . group ( 5 ) . isEmpty ( ) ? 0 // "SNAPSHOT" : Integer . parseInt ( m . group ( 5 ) ) , // "SNAPSHOT.123" } ; }
Parses the version .