Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / January 2006

Tip: Looking for answers? Try searching our database.

java.net.URLEncoder exception nonexistent - confused

Thread view: 
phillip.s.powell@gmail.com - 16 Jan 2006 09:51 GMT
How in the world is this one happening:

[Quote]/~ppowell/includes/chat_submit_message.jsp:44: cannot find
symbol
symbol : class UnsupportedEncodingException
[/Quote]

I am utterly lost:

[CODE]
<%@page import="ppowell.*, java.net.URLEncoder, javax.servlet.http.*"
%>

<%
// STUFF
// SEND MESSAGE TO SERVLET
if (hasSubmittedMessage && send.length() > 0) {
try { // USING NEW VERSION OF URLEncoder.encode() THAT
REQUIRES try{} BLOCK DUE TO NEW 2ND PARAMETER OF ENC-TYPE
 retriever = new HTMLRetriever(ChatGlobals.SERVLET_SELF +
"/ppowell.ChatServlet?message=" +

URLEncoder.encode(message, "UTF-8") + "&nickname=" +
                                             URLEncoder.encode(cookie,
"UTF-8")
                                            );  // SEND MESSAGE
} catch (UnsupportedEncodingException uee) {
 errorMsg = "Error involving message submittal: " + uee.toString();
} catch (Exception e) {
 errorMsg += "Unknown error: " + e.toString();
}
} else if (hasSubmittedMessage && quit.length() > 0) {
try { // USING NEW VERSION OF URLEncoder.encode() THAT REQUIRES try{}
BLOCK DUE TO NEW 2ND PARAMETER OF ENC-TYPE
 retriever = new HTMLRetriever(ChatGlobals.SERVLET_SELF +
"/ppowell.ChatServlet?message=" +
                                             URLEncoder.encode("/q",
"UTF-8") + "&nickname=" +
URLEncoder.encode(cookie, "UTF-8")
                                            ); // SEND "QUIT" COMMAND
} catch (UnsupportedEncodingException uee) {
 errorMsg += "Error involving message submittal: " + uee.toString();
} catch (Exception e) {
 errorMsg += "Unknown error: " + e.toString();
}
}
// STUFF
%>

Please help, I'm completely stuck!

Thanx
Phil
Gordon Beaton - 16 Jan 2006 10:01 GMT
> How in the world is this one happening:
>
> [Quote]/~ppowell/includes/chat_submit_message.jsp:44: cannot find
> symbol
> symbol : class UnsupportedEncodingException
> [/Quote]

import java.io.*;

/gordon

Signature

[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e

phillip.s.powell@gmail.com - 16 Jan 2006 10:06 GMT
Why? URLEncoder is java.net what does java.io have to do with
java.net.URLEncoder? That makes no sense.

Phil

> > How in the world is this one happening:
> >
[quoted text clipped - 10 lines]
> [  do not email me copies of your followups  ]
> g o r d o n + n e w s @  b a l d e r 1 3 . s e
Gordon Beaton - 16 Jan 2006 10:42 GMT
> Why? URLEncoder is java.net what does java.io have to do with
> java.net.URLEncoder? That makes no sense.

Why does it make no sense that a class from one package should be
dependent on a class from another? Doesn't your own code belong to a
different package than the utility classes you are using?

Did you actually read the API documentation for java.net.URLEncoder?
Follow the link for the exception in question and see where it takes
you.

I'll repeat my advice: import java.io.*;

/gordon

Signature

[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e

phillip.s.powell@gmail.com - 16 Jan 2006 10:49 GMT
I went to the link on the API declaration and figured out that
java.net.URLEncoder throws java.io.UnsupportedEncodingException..
interesting, so if you use that class be sure to import java.io.* as
well, else it'll fail to throw the exception you want.

Wow.  My code was in PHP, packages don't exist there. You can't
honestly hold me to what you understand as sense as I don't understand
packages as they're not a PHP concept, förlåt mig såsom också
läsar jag det!

Phil

> > Why? URLEncoder is java.net what does java.io have to do with
> > java.net.URLEncoder? That makes no sense.
[quoted text clipped - 14 lines]
> [  do not email me copies of your followups  ]
> g o r d o n + n e w s @  b a l d e r 1 3 . s e
opalpa@gmail.com opalinski from opalpaweb - 16 Jan 2006 12:31 GMT
> You can't honestly hold me to what you understand as sense as I don't understand
> packages as they're not a PHP concept

The compiler can honestly hold you.

You got some help.  Be grateful instead of flaunting how you jumped
into your new responsibilities with ignorance.

Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
phillip.s.powell@gmail.com - 16 Jan 2006 16:49 GMT
That made 0% sense, but thanx anyway.

> > You can't honestly hold me to what you understand as sense as I don't understand
> > packages as they're not a PHP concept
[quoted text clipped - 7 lines]
> opalpa@gmail.com
> http://www.geocities.com/opalpaweb/
Roedy Green - 16 Jan 2006 21:29 GMT
On 16 Jan 2006 08:49:49 -0800, "phillip.s.powell@gmail.com"
<phillip.s.powell@gmail.com> wrote, quoted or indirectly quoted
someone who said :

>That made 0% sense, but thanx anyway.

I have written a set of "translations" of the error messages into more
understandable English.  For your particular problem see:

http://mindprod.com/jgloss/compileerrormessages.html#CANNOTFINDSYMBOL
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Roedy Green - 16 Jan 2006 21:32 GMT
On Mon, 16 Jan 2006 21:29:01 GMT, Roedy Green
<my_email_is_posted_on_my_website@munged.invalid> wrote, quoted or
indirectly quoted someone who said :

>I have written a set of "translations" of the error messages into more
>understandable English.  For your particular problem see:
>
>http://mindprod.com/jgloss/compileerrormessages.html#CANNOTFINDSYMBOL

In the old days, error message were labeled with a code number.  You
could then look this up in a book and find out what it really meant.
Today this could be even more automated so you would click to see a
full wiki on what others had to say about the message.

Internally Sun may have such things for use in resource bundles.
All they need do is expose the code.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Roedy Green - 16 Jan 2006 11:30 GMT
On 16 Jan 2006 01:51:09 -0800, "phillip.s.powell@gmail.com"
<phillip.s.powell@gmail.com> wrote, quoted or indirectly quoted
someone who said :

>[Quote]/~ppowell/includes/chat_submit_message.jsp:44: cannot find
>symbol
>symbol : class UnsupportedEncodingException

this is a compile time problem, right?  You are missing an import.
See http://mindprod.com/jgloss/urlencoded.html
for sample code.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.