File tree Expand file tree Collapse file tree
remotesync-api/src/main/java/org/piwigo/remotesync/legacy Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010 ******************************************************************************/
1111package org .piwigo .remotesync .legacy ;
1212
13+ import java .util .regex .Matcher ;
1314import java .util .regex .Pattern ;
1415
16+ import org .apache .commons .lang .StringUtils ;
17+
1518public class VersionParser
1619{
1720
@@ -25,7 +28,16 @@ public void parseVersion(String version)
2528
2629 major = Integer .parseInt (parts [0 ]);
2730 minor = Integer .parseInt (parts [1 ]);
28- build = Integer .parseInt (parts [2 ]);
31+ build = StringUtils .isNumeric (parts [2 ]) ? Integer .parseInt (parts [2 ]) : parseBetaVersion (parts [2 ]);
32+ }
33+
34+ public int parseBetaVersion (String version )
35+ {
36+ Matcher matcher = Pattern .compile ("\\ d+" ).matcher (version );
37+
38+ if (!matcher .find ())
39+ throw new NumberFormatException ("For input string [" + version + "]" );
40+ return Integer .parseInt (matcher .group ());
2941 }
3042
3143 public int getMajorVersion ()
You can’t perform that action at this time.
0 commit comments