Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Jun 2018 05:07:20 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 229325] develop/statsvn dose work on FreeBSD-11-stable
Message-ID:  <bug-229325-7788-QTF1wM1mNt@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-229325-7788@https.bugs.freebsd.org/bugzilla/>
References:  <bug-229325-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D229325

--- Comment #1 from kensaku.masuda@gmail.com ---
One more problem found.

Here is patches.

--- src/net/sf/statsvn/util/SvnStartupUtils.java.orig   2018-06-25
10:35:11.895337000 +0900
+++ src/net/sf/statsvn/util/SvnStartupUtils.java        2018-06-25
13:32:56.122954000 +0900
@@ -26,6 +26,13 @@
        private static final String SVN_VERSION_LINE_PATTERN =3D ".*
[0-9]+\\.[0-9]+\\.[0-9]+.*";

        private static final String SVN_VERSION_PATTERN =3D
"[0-9]+\\.[0-9]+\\.[0-9]+";
+       private static final int SVN_MINIMUM_MAJOR_VERSION =3D 1;
+       private static final int SVN_MINIMUM_MINOR_VERSION =3D 3;
+       private static final int SVN_MINIMUM_REVISION_VERSION =3D 0;
+
+       private static final int SVN_MINIMUM_MAJOR_VERSION_DIFF_PER_REV =3D=
 1;
+       private static final int SVN_MINIMUM_MINOR_VERSION_DIFF_PER_REV =3D=
 4;
+       private static final int SVN_MINIMUM_REVISION_VERSION_DIFF_PER_REV =
=3D 0;


     protected ISvnProcessor processor;
@@ -62,7 +69,10 @@
                                                final String versionString =
=3D
line.substring(m.start(), m.end());

                                                // we perform a simple stri=
ng
comparison against the version numbers
-                                               if
(versionString.compareTo(SVN_MINIMUM_VERSION) >=3D 0) {
+                                               final int[] version =3D
parseVersionNumber(versionString);
+                                               if (version[0] >=3D
SVN_MINIMUM_MAJOR_VERSION &&
+                                                   version[1] >=3D
SVN_MINIMUM_MINOR_VERSION &&
+                                                   version[2] >=3D
SVN_MINIMUM_REVISION_VERSION) {
                                                        return versionStrin=
g;
// success
                                                } else {
                                                        throw new
SvnVersionMismatchException(versionString, SVN_MINIMUM_VERSION);
@@ -94,8 +104,38 @@
        /* (non-Javadoc)
      * @see
net.sf.statsvn.util.IVersionProcessor#checkDiffPerRevPossible(java.lang.Str=
ing)
      */
-       public synchronized boolean checkDiffPerRevPossible(final String
version) {
+       public synchronized boolean checkDiffPerRevPossible(final String
versionString) {
                // we perform a simple string comparison against the version
numbers
-               return version.compareTo(SVN_MINIMUM_VERSION_DIFF_PER_REV) =
>=3D
0;
+               try {
+                       final int[] version =3D
parseVersionNumber(versionString);
+
+                       return  version[0] >=3D
SVN_MINIMUM_MAJOR_VERSION_DIFF_PER_REV &&
+                               version[1] >=3D
SVN_MINIMUM_MINOR_VERSION_DIFF_PER_REV &&
+                               version[2] >=3D
SVN_MINIMUM_REVISION_VERSION_DIFF_PER_REV;
+               } catch(SvnVersionMismatchException e) {
+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
SvnConfigurationOptions.getTaskLogger().info(e.getMessage());
+                       return false;
+               }
+       }
+
+       /**
+        * Get integer version array from version string.
+        * @param versionString
+        * @return
+        *      triple of version number=20
+        * @exception SvnVersionMismatchException
+        **/
+       static int[] parseVersionNumber(final String versionString) throws
SvnVersionMismatchException {
+               final String[] versionNumberStrings =3D
versionString.split("\\.");
+
+               if(versionNumberStrings.length =3D=3D 3) {
+                       int[] version =3D new int[3];
+                       for(int i =3D 0 ; i < 3 ; i++) {
+                               version[i] =3D
Integer.parseInt(versionNumberStrings[i], 10);
+                       }
+                       return version;
+               } else {
+                       throw new SvnVersionMismatchException(versionString,
SVN_MINIMUM_VERSION);
+               }
        }
 }

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-229325-7788-QTF1wM1mNt>