Click to See Complete Forum and Search --> : UNknown exception error, PLEASE HELP !!!!


Valzara
06-21-2005, 02:06 PM
Hi all,

I am developing a web browser with filter function in it, where the browser will bann some specified website, like porn site.

I took this example :
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=4837&lngWId=2
as my base web browser.

After I compile it, it cannot detect the website. So I edit the 'back' button of this browser, where the 'back' button will lead to http://www.google.com, but after I done it, it simply shows that it cannot retrieve the website. Below is what it shows:

java.net.UnknownHostException: www.google.com
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:320)
at sun.net.www.http.HttpClient.New(HttpClient.java:315)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:510)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:487)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:615)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:272).... .... and lots more

What's wrong with it!? Please help me!!! This is my project, if I fail it means I gotta flunk my subject also, please help me !!!

Ximvu
06-21-2005, 07:02 PM
it cannot detect the website.
What exactly do you mean here? did it generate an error?

Also, is there anyway you could post the lines of code you edited that generate the error, and possibly the entire stack trace (list of error messages).

Valzara
06-22-2005, 09:20 AM
HI, thanks for tey to help me. *respect*


Anyway this program doesn't shows any error. It's error free! But just cannot get the web page to be displayed, I wonder what's wrong with it. I upload my program here, please help me... .... THANKS !!!

Ximvu
06-22-2005, 01:26 PM
The back button loaded google when I tried it. Are you sure you're using a computer connected to the internet? Are you behind a proxy?

Valzara
06-23-2005, 01:26 AM
Ugh !?
Please tell me if the browser lead other page when u type the URL into the address bar??

I scare it's the network server in my college's problem...

Ximvu
06-23-2005, 12:19 PM
No, it only goes anywhere when I hit the back button, or when I hit links on a page already loaded. When I type an address in it does nothing.

Valzara
06-23-2005, 11:41 PM
hm... ...perhaps I should add a button which will rad from the address bar itself, let me try first....

Valzara
06-28-2005, 12:27 PM
I had implement that address bar with the 'go' button, I suppose when click on that button the browser will lead to that website, but no matter how I try on that code it seems do nothing... ..., can someone please help me on this problem, tell me what's wrong with the code of my 'go' button??

Please help me, THANKS !!!

'The updated code are below)

Ximvu
06-28-2005, 03:25 PM
Your code needs somewhere where it actually tells the browser to change pages, in the existing version this was done in the back() and forward() methods contained in dcPane. I tried adding this go() method to dcPane:
public URL go(URL _url)
{
history.add(_url);
historyIndex++;
displayPage(_url);
return _url;
}

and then calling it in dcToolBar in your go button's actionlistener, like so:
goBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
try {
URL url = new URL(urlText.getText());
chautaripane.go(url);

}

This worked fine for me and displayed the page.

Valzara
06-29-2005, 12:23 AM
*hail* OMG u just solve it with just few lines of codes. I wonder I can't come out with this idea while doing it... ... the more I feel I am noob...

However, I had find out why I can't load the page normally, it's due to my college's hostel server. WHen I tried it outside, it works fine too.

Really thank you, Ximvu, thank you.