Return-Path: X-Original-To: apmail-hc-commits-archive@www.apache.org Delivered-To: apmail-hc-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CBE6C10668 for ; Wed, 11 Feb 2015 09:54:01 +0000 (UTC) Received: (qmail 20537 invoked by uid 500); 11 Feb 2015 09:53:56 -0000 Delivered-To: apmail-hc-commits-archive@hc.apache.org Received: (qmail 20500 invoked by uid 500); 11 Feb 2015 09:53:55 -0000 Mailing-List: contact commits-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list commits@hc.apache.org Received: (qmail 20489 invoked by uid 99); 11 Feb 2015 09:53:55 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Feb 2015 09:53:55 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id A58BFAC006C for ; Wed, 11 Feb 2015 09:53:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1658910 - /httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/util/VersionInfo.java Date: Wed, 11 Feb 2015 09:53:55 -0000 To: commits@hc.apache.org From: michaelo@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150211095355.A58BFAC006C@hades.apache.org> Author: michaelo Date: Wed Feb 11 09:53:55 2015 New Revision: 1658910 URL: http://svn.apache.org/r1658910 Log: HTTPCORE-395: VersionInfo#getUserAgent reports incorrect Java version Modified: httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/util/VersionInfo.java Modified: httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/util/VersionInfo.java URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/util/VersionInfo.java?rev=1658910&r1=1658909&r2=1658910&view=diff ============================================================================== --- httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/util/VersionInfo.java (original) +++ httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/util/VersionInfo.java Wed Feb 11 09:53:55 2015 @@ -301,10 +301,11 @@ public class VersionInfo { } /** - * Sets the user agent to {@code "/ (Java 1.5 minimum; Java/)"}. + * Sets the user agent to {@code "/ (Java/)"}. If release is + * {@link #UNAVAILABLE}, it will be omitted. *

* For example: - *

"Apache-HttpClient/4.3 (Java 1.5 minimum; Java/1.6.0_35)"
+ *
"Apache-HttpClient/4.3 (Java/1.6.0_35)"
* * @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