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>
* 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.
......
......@@ -322,25 +322,29 @@ public abstract class URLConnection
* 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.
catch (NumberFormatException e)
{
; // 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