File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
main/java/org/apache/maven/plugins/gpg
test/java/org/apache/maven/plugins/gpg Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -47,13 +47,13 @@ public static GpgVersion parse( String rawVersion )
4747 @ Override
4848 public int compareTo ( GpgVersion other )
4949 {
50- Pattern p = Pattern .compile ( "([. \\ d]+)$ " );
50+ Pattern p = Pattern .compile ( "(\\ d+ \\ .)+( \\ d+) " );
5151
5252 String [] thisSegments ;
5353 Matcher m = p .matcher ( rawVersion );
5454 if ( m .find () )
5555 {
56- thisSegments = m .group ( 1 ).split ( "\\ ." );
56+ thisSegments = m .group ( 0 ).split ( "\\ ." );
5757 }
5858 else
5959 {
@@ -64,7 +64,7 @@ public int compareTo( GpgVersion other )
6464 m = p .matcher ( other .rawVersion );
6565 if ( m .find () )
6666 {
67- otherSegments = m .group ( 1 ).split ( "\\ ." );
67+ otherSegments = m .group ( 0 ).split ( "\\ ." );
6868 }
6969 else
7070 {
Original file line number Diff line number Diff line change 1919 * under the License.
2020 */
2121
22- import static org .junit .Assert .assertTrue ;
23-
24- import org .apache .maven .plugins .gpg .GpgVersion ;
2522import org .junit .Test ;
2623
24+ import static org .junit .Assert .assertTrue ;
25+
26+ /**
27+ * Tests for {@link GpgVersion}.
28+ */
2729public class GpgVersionTest
2830{
2931 @ Test
@@ -32,6 +34,8 @@ public void test()
3234 assertTrue ( GpgVersion .parse ( "gpg (GnuPG) 2.2.1" ).isAtLeast ( GpgVersion .parse ( "gpg (GnuPG) 2.2.1" ) ) );
3335 assertTrue ( GpgVersion .parse ( "gpg (GnuPG) 2.2.1" ).isAtLeast ( GpgVersion .parse ( "2.1" ) ) );
3436 assertTrue ( GpgVersion .parse ( "gpg (GnuPG/MacGPG2) 2.2.10" ).isAtLeast ( GpgVersion .parse ( "2.2.10" ) ) );
37+ assertTrue ( GpgVersion .parse ( "gpg (GnuPG) 2.0.26 (Gpg4win 2.2.3)" )
38+ .isAtLeast ( GpgVersion .parse ( "2.0.26" ) ) );
3539 }
3640
3741}
You can’t perform that action at this time.
0 commit comments