Am 2015-02-11 um 21:24 schrieb sebb:
On 11 February 2015 at 14:23,  <[email protected]> wrote:
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;

Conditional statements should alwaya uae blocks please.

Already committed. Thanks for that one. Though, wondering why the checkstyle goal did not fail during my build run.

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to