This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: Patch: java.net.URLConnection
- From: Michael Koch <konqueror at gmx dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Tue, 27 May 2003 08:20:03 +0200
- Subject: FYI: Patch: java.net.URLConnection
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi list,
I commited the attached patch to trunk to merge java.net.URLConnection
more with classpath's version.
Michael
- --
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+0wOTWSOgCCdjSDsRAioOAJ481xJJ2SLxsDGDp3qJI3vMRHiZ7wCgnC34
0wEOwCJ/u8pQzVwczj4uhYE=
=HAxZ
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1909
diff -u -b -B -r1.1909 ChangeLog
--- ChangeLog 27 May 2003 06:04:27 -0000 1.1909
+++ ChangeLog 27 May 2003 06:15:36 -0000
@@ -1,5 +1,10 @@
2003-05-27 Michael Koch <konqueror@gmx.de>
+ * java/net/URLConnection.java
+ (getHeaderFieldInt): Merged with classpath.
+
+2003-05-27 Michael Koch <konqueror@gmx.de>
+
* java/io/PrintStream.java
(PrintStream): Reformatted.
(PrintStream): New method, merged from classpath.
Index: java/net/URLConnection.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URLConnection.java,v
retrieving revision 1.19
diff -u -b -B -r1.19 URLConnection.java
--- java/net/URLConnection.java 9 May 2003 07:11:11 -0000 1.19
+++ java/net/URLConnection.java 27 May 2003 06:15:37 -0000
@@ -322,25 +322,29 @@
* is not present or cannot be parsed as an integer, the default value
* will be returned.
*
- * @param name The name of the header field
- * @param val The default value
+ * @param name The header field key to lookup
+ * @param defaultValue The defaule value if the header field is not found
+ * or can't be parsed.
*
* @return The value of the header field or the default value if the field
* is missing or malformed
*/
- public int getHeaderFieldInt(String name, int val)
+ public int getHeaderFieldInt(String name, int defaultValue)
{
String str = getHeaderField(name);
+ int result = defaultValue;
+
try
{
if (str != null)
- val = Integer.parseInt(str);
+ result = Integer.parseInt (str);
}
catch (NumberFormatException e)
{
- ; // Do nothing; val is the default.
+ ; // Do nothing; defaultValue is the default.
}
- return val;
+
+ return result;
}
/**