[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/24084] HttpUrlConnection getHeaderFieldKey throws NoSuchE
From: |
phil at mkdoc dot com |
Subject: |
[Bug classpath/24084] HttpUrlConnection getHeaderFieldKey throws NoSuchElementException |
Date: |
27 Sep 2005 16:47:18 -0000 |
------- Additional Comments From phil at mkdoc dot com 2005-09-27 16:47 -------
(From update of attachment 9819)
>package com.mkdoc.bug;
>
>import java.io.IOException;
>
>import java.net.URL;
>import java.net.URLConnection;
>
>import java.util.NoSuchElementException;
>
>public class HttpHeaderFieldKeyTest {
>
> /**
> * A test URL from which to get headers.
> */
> private static final String TEST_URL = "http://test.mksearch.mkdoc.org/";
>
> /**
> * Index out of range.
> */
> private static final int INDEX = 94860;
>
> /**
> * Run the test, no arguments.
> */
> public static final void main(String[] args) {
>
> URL url = null;
>
> URLConnection connection = null;
>
> try {
>
> url = new URL(TEST_URL);
>
> connection = url.openConnection();
>
> connection.connect();
>
> try {
>
> String header = connection.getHeaderFieldKey(INDEX);
>
> if (header == null) {
>
> System.out.println("Test passes, method returned null.");
> }
> else {
>
> System.err.println("Test fails, header at index " +
> INDEX +
> " has value '" +
> header +
> "'.");
> }
> }
> catch (NoSuchElementException nsee) {
>
> System.err.println("Test fails, NoSuchElementException
> thrown.");
> }
> }
> catch (IOException ioe) {
>
> System.err.println("Connection error for URL " +
> TEST_URL);
> }
> finally {
>
> if (connection != null) {
>
> connection.disconnect();
> }
> }
>
> }
>
>}
Sorry, an earlier draft got uploaded, this does not compile, see follow-up.
package com.mkdoc.bug;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.util.NoSuchElementException;
public class HttpHeaderFieldKeyTest {
/**
* A test URL from which to get headers.
*/
private static final String TEST_URL = "http://test.mksearch.mkdoc.org/";
/**
* Index out of range.
*/
private static final int INDEX = 94860;
/**
* Run the test, no arguments.
*/
public static final void main(String[] args) {
URL url = null;
URLConnection connection = null;
try {
url = new URL(TEST_URL);
connection = url.openConnection();
connection.connect();
try {
String header = connection.getHeaderFieldKey(INDEX);
if (header == null) {
System.out.println("Test passes, method returned null.");
}
else {
System.err.println("Test fails, header at index " +
INDEX +
" has value '" +
header +
"'.");
}
}
catch (NoSuchElementException nsee) {
System.err.println("Test fails, NoSuchElementException
thrown.");
}
}
catch (IOException ioe) {
System.err.println("Test did not run, connection error for URL " +
TEST_URL);
}
}
}
--
What |Removed |Added
----------------------------------------------------------------------------
Attachment #9819|A simple test case for the |Sorry, an earlier draft got
description|bug. |uploaded, this does not
| |compile, see follow-up
| |attachment.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24084
- [Bug classpath/24084] New: HttpUrlConnection getHeaderFieldKey throws NoSuchElementException, phil at mkdoc dot com, 2005/09/27
- [Bug classpath/24084] HttpUrlConnection getHeaderFieldKey throws NoSuchElementException, phil at mkdoc dot com, 2005/09/27
- [Bug classpath/24084] HttpUrlConnection getHeaderFieldKey throws NoSuchElementException, phil at mkdoc dot com, 2005/09/27
- [Bug classpath/24084] HttpUrlConnection getHeaderFieldKey throws NoSuchElementException, phil at mkdoc dot com, 2005/09/27
- [Bug classpath/24084] HttpUrlConnection getHeaderFieldKey throws NoSuchElementException, phil at mkdoc dot com, 2005/09/27
- [Bug classpath/24084] HttpUrlConnection getHeaderFieldKey throws NoSuchElementException,
phil at mkdoc dot com <=
- [Bug classpath/24084] HttpUrlConnection getHeaderFieldKey throws NoSuchElementException, daney at gcc dot gnu dot org, 2005/09/27