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.
> +
> + 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]