# java.net.SocketException: Unexpected end of file from server



## Empire Phoenix (9. Feb 2009)

Im algemeinen funktioniert dieser code, jedoch wirft er bei einigen Sites diesen Fehler: (hier ein Testbeispiel das laut Validator absolut korrekt ist Validated ) 

http://empirephoenix.de/new horizons/news 

Die Frage ist, wie kann ich dafür sorgen, das entweder die Website anerkannt wird (ich kann von den benötigten Sites den code ändern) oder dass der Code etwas fehlertoleranter wird?




```
java.net.SocketException: Unexpected end of file from server
	at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
	at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
	at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
	at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at java.net.HttpURLConnection.getResponseCode(Unknown Source)
	at javax.swing.JEditorPane.getStream(Unknown Source)
	at javax.swing.JEditorPane.setPage(Unknown Source)
	at src.HtmlPage.setWebpage(HtmlPage.java:28)
	at src.AutoDownloader.<init>(AutoDownloader.java:90)
	at src.AutoDownloader$1.run(AutoDownloader.java:42)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
```


```
import java.net.URL;

import javax.swing.JScrollPane;
import javax.swing.JTextPane;

public class HtmlPage extends JScrollPane{
	private static final long serialVersionUID = 1L;
	private JTextPane tp;
	private JScrollPane js;

	HtmlPage(){
		super(); 
		 tp = new JTextPane();
		 tp.setEditable(false);
		 this.getViewport().add(tp);
		 this.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_ALWAYS);
		 this.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_ALWAYS);
		 this.setVisible(true); 
	}
	
	public void setWebpage(String address) throws Exception{
		URL url;
		url = new URL(address);
		tp.setPage(url);
	}
}
```


----------



## Wildcard (9. Feb 2009)

Ein Leerzeichen in der URL?  :autsch: 
Hast du das maskiert?


----------



## Empire Phoenix (9. Feb 2009)

Ah dammit, die einfachsten fehler sind immer die nervigste ...


----------

