Commit 5191f392 by Michael Koch Committed by Michael Koch

2003-05-27 Michael Koch <konqueror@gmx.de>

	* java/net/URLConnection.java
	(getHeaderFieldInt): Merged with classpath.

From-SVN: r67184
parent c414a2c3
2003-05-27 Michael Koch <konqueror@gmx.de> 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 * java/io/PrintStream.java
(PrintStream): Reformatted. (PrintStream): Reformatted.
(PrintStream): New method, merged from classpath. (PrintStream): New method, merged from classpath.
......
...@@ -322,25 +322,29 @@ public abstract class URLConnection ...@@ -322,25 +322,29 @@ public abstract class URLConnection
* is not present or cannot be parsed as an integer, the default value * is not present or cannot be parsed as an integer, the default value
* will be returned. * will be returned.
* *
* @param name The name of the header field * @param name The header field key to lookup
* @param val The default value * @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 * @return The value of the header field or the default value if the field
* is missing or malformed * is missing or malformed
*/ */
public int getHeaderFieldInt(String name, int val) public int getHeaderFieldInt(String name, int defaultValue)
{ {
String str = getHeaderField(name); String str = getHeaderField(name);
int result = defaultValue;
try try
{ {
if (str != null) if (str != null)
val = Integer.parseInt(str); result = Integer.parseInt (str);
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
; // Do nothing; val is the default. ; // Do nothing; defaultValue is the default.
} }
return val;
return result;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment