hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From micha...@apache.org
Subject svn commit: r1658967 - /httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java
Date Wed, 11 Feb 2015 14:23:30 GMT
Author: michaelo
Date: Wed Feb 11 14:23:29 2015
New Revision: 1658967

URL: http://svn.apache.org/r1658967
Log:
HTTPCORE-395: VersionInfo#getUserAgent reports incorrect Java version

Modified:
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java
  (contents, props changed)

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java?rev=1658967&r1=1658966&r2=1658967&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java
Wed Feb 11 14:23:29 2015
@@ -301,10 +301,11 @@ public class VersionInfo {
     }
 
     /**
-     * Sets the user agent to {@code "<name>/<release> (Java 1.5 minimum; Java/<java.version>)"}.
+     * Sets the user agent to {@code "<name>/<release> (Java/<java.version>)"}.
If release is
+     * {@link #UNAVAILABLE}, it will be omitted.
      * <p>
      * For example:
-     * <pre>"Apache-HttpClient/4.3 (Java 1.5 minimum; Java/1.6.0_35)"</pre>
+     * <pre>"Apache-HttpClient/4.3 (Java/1.6.0_35)"</pre>
      *
      * @param name the component name, like "Apache-HttpClient".
      * @param pkg
@@ -319,7 +320,12 @@ public class VersionInfo {
         final VersionInfo vi = VersionInfo.loadVersionInfo(pkg, cls.getClassLoader());
         final String release = (vi != null) ? vi.getRelease() : VersionInfo.UNAVAILABLE;
         final String javaVersion = System.getProperty("java.version");
-        return name + "/" + release + " (Java 1.5 minimum; Java/" + javaVersion + ")";
+
+        String nameAndRelease = name;
+        if (!UNAVAILABLE.equals(release))
+            nameAndRelease += "/" + release;
+
+        return String.format("%s (Java/%s)", nameAndRelease, javaVersion);
     }
 
 } // class VersionInfo

Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Wed Feb 11 14:23:29 2015
@@ -0,0 +1,2 @@
+/httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/util/VersionInfo.java:1658910
+/httpcomponents/httpcore/branches/ibm_compat_branch/httpcore/src/main/java/org/apache/http/util/VersionInfo.java:755687-758898



Mime
View raw message