You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-auto@ws.apache.org by jo...@apache.org on 2009/04/28 21:48:03 UTC

svn commit: r769514 - in /webservices/xmlrpc/trunk: ./ client/src/main/filtered-resources/ client/src/main/filtered-resources/org/ client/src/main/filtered-resources/org/apache/ client/src/main/filtered-resources/org/apache/xmlrpc/ client/src/main/filt...

Author: jochen
Date: Tue Apr 28 19:48:01 2009
New Revision: 769514

URL: http://svn.apache.org/viewvc?rev=769514&view=rev
Log:
The version number in the clients user agent string is now updated automatically.

Added:
    webservices/xmlrpc/trunk/client/src/main/filtered-resources/
    webservices/xmlrpc/trunk/client/src/main/filtered-resources/org/
    webservices/xmlrpc/trunk/client/src/main/filtered-resources/org/apache/
    webservices/xmlrpc/trunk/client/src/main/filtered-resources/org/apache/xmlrpc/
    webservices/xmlrpc/trunk/client/src/main/filtered-resources/org/apache/xmlrpc/client/
    webservices/xmlrpc/trunk/client/src/main/filtered-resources/org/apache/xmlrpc/client/XmlRpcClient.properties
Modified:
    webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcHttpTransport.java
    webservices/xmlrpc/trunk/pom.xml
    webservices/xmlrpc/trunk/src/changes/changes.xml

Added: webservices/xmlrpc/trunk/client/src/main/filtered-resources/org/apache/xmlrpc/client/XmlRpcClient.properties
URL: http://svn.apache.org/viewvc/webservices/xmlrpc/trunk/client/src/main/filtered-resources/org/apache/xmlrpc/client/XmlRpcClient.properties?rev=769514&view=auto
==============================================================================
--- webservices/xmlrpc/trunk/client/src/main/filtered-resources/org/apache/xmlrpc/client/XmlRpcClient.properties (added)
+++ webservices/xmlrpc/trunk/client/src/main/filtered-resources/org/apache/xmlrpc/client/XmlRpcClient.properties Tue Apr 28 19:48:01 2009
@@ -0,0 +1 @@
+user.agent=Apache XML RPC ${project.version}

Modified: webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcHttpTransport.java
URL: http://svn.apache.org/viewvc/webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcHttpTransport.java?rev=769514&r1=769513&r2=769514&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcHttpTransport.java (original)
+++ webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcHttpTransport.java Tue Apr 28 19:48:01 2009
@@ -20,8 +20,12 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.net.URL;
+import java.util.Properties;
 
 import org.apache.xmlrpc.XmlRpcException;
 import org.apache.xmlrpc.XmlRpcRequest;
@@ -56,11 +60,35 @@
         }
     }
 
-	private String userAgent;
+    /** The user agent string.
+     */
+    public static final String USER_AGENT;
+    static {
+        final String p = "XmlRpcClient.properties";
+        final URL url = XmlRpcHttpTransport.class.getResource(p);
+        if (url == null) {
+            throw new IllegalStateException("Failed to locate resource: " + p);
+        }
+        InputStream stream = null;
+        try {
+            stream = url.openStream();
+            final Properties props = new Properties();
+            props.load(stream);
+            USER_AGENT = props.getProperty("user.agent");
+            if (USER_AGENT == null  ||  USER_AGENT.trim().length() == 0) {
+                throw new IllegalStateException("The property user.agent is not set.");
+            }
+            stream.close();
+            stream = null;
+        } catch (IOException e) {
+            throw new UndeclaredThrowableException(e, "Failed to load resource " + url + ": " + e.getMessage());
+        } finally {
+            if (stream != null) { try { stream.close(); } catch (Throwable t) { /* Ignore me */ } }
+        }
+    }
+
+    private String userAgent;
 
-	/** The user agent string.
-	 */
-	public static final String USER_AGENT = "Apache XML RPC 3.0";
 
 	protected XmlRpcHttpTransport(XmlRpcClient pClient, String pUserAgent) {
 		super(pClient);

Modified: webservices/xmlrpc/trunk/pom.xml
URL: http://svn.apache.org/viewvc/webservices/xmlrpc/trunk/pom.xml?rev=769514&r1=769513&r2=769514&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/pom.xml (original)
+++ webservices/xmlrpc/trunk/pom.xml Tue Apr 28 19:48:01 2009
@@ -287,6 +287,12 @@
   </scm>
 
   <build>
+  	<resources>
+  		<resource>
+  			<filtering>true</filtering>
+  			<directory>src/main/filtered-resources</directory>
+  		</resource>
+  	</resources>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>

Modified: webservices/xmlrpc/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/webservices/xmlrpc/trunk/src/changes/changes.xml?rev=769514&r1=769513&r2=769514&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/src/changes/changes.xml (original)
+++ webservices/xmlrpc/trunk/src/changes/changes.xml Tue Apr 28 19:48:01 2009
@@ -24,6 +24,13 @@
   </properties>
   <body>
     <release version="3.1.2" date="2009-Apr-19">
+      <action dev="jochen" type="fix">
+        The version number in the clients user agent string is now
+        updated automatically.
+      </action>
+    </release>
+
+    <release version="3.1.2" date="2009-Apr-19">
       <action dev="jochen" type="fix" due-to="Mark Gertsvolf" due-to-email="markg@nortel.com"
           issue="XMLRPC-162">
         Eliminated a possible race condition in the ThreadPool.