The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Java Help
|
Need Help - I am not even a beginner in Java :(
Discuss Need Help - I am not even a beginner in Java :( in the Java Help forum on Dev Shed. Need Help - I am not even a beginner in Java :( Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

December 13th, 2012, 01:34 AM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 1
Time spent in forums: 4 m 16 sec
Reputation Power: 0
|
|
|
Need Help - I am not even a beginner in Java :(
Hi ,
Firstly I am at stage 0 in java. Well I have never been into any programming, but it seems like I need a little help to solve a task. I have been given a code and asked to incorporate it to fix an error.
here's the code -
4a5
> import java.net.*;
225c226,227
< String file = fileElem.getAttribute("URI");
---
> String file = URLDecoder.decode(fileElem.getAttribute("URI"), "UTF-8");
> log.info(file);
486c488
< String file = fileElem.getAttribute("URI");
---
> String file = URLDecoder.decode(fileElem.getAttribute("URI"), "UTF-8");
It is a simple URL encoding issue which could be fixed by incorporating this code. But I am too dumb that I don't even know how to do it!
Well there is a program used to decode files, But it has got simple URL encoding issue, which could be fixed by code given above.
Please have a look at the below links so you will get a clear very clear Idea.
https://tag3u lp55xczs3 pn.oni on.to/
https://ta g3ulp55x czs3pn.oni on.to/req uiem-3.3.5-w in.zip
https://tag 3ulp55 xczs 3pn.on ion.to/requ iem-3.3.5-s rc.zip - source code
https://tag 3ulp55xcz s3pn.oni on.t o/cg...a448&offset=40
{Please remove spaces from the links given above}
The above links are to a program used to decode files. its a freeware, and the source code is too available. the particular version that works for me is 3.3.5 but unfortunately it has a URL encoding issue. The developer of that program gave me the fix to the issue and has asked me to incorporate it and fix it for myself. But I as I said I have never been into any programming, and I really don't understand anything here. But I would really appreciate it if some one will teach me how to do it step-by-step and how to fix it!
Thanks in advance.
|

December 13th, 2012, 04:03 AM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
What the author gave you is a simple diff patch. You can either pass that through a program called patch, which will change the appropriate lines, or you can do it yourself. Here's what to do:
Code:
4a5
> import java.net.*;
The line 4a5 means go to line 4 and then add the following code:
Next we have:
Code:
225c226,227
< String file = fileElem.getAttribute("URI");
---
> String file = URLDecoder.decode(fileElem.getAttribute("URI"), "UTF-8");
> log.info(file)
From the 225c226,227, we can tell that the change is around line 225 of the file and the letter c means to change that line to something else. (As you may have guessed, the < indicates what should be removed and the > indicates what it should be replaced with) What you're looking for is a line that looks like this:
Code:
String file = fileElem.getAttribute("URI");
Replace that line with the following two lines:
Code:
String file = URLDecoder.decode(fileElem.getAttribute("URI"), "UTF-8");
log.info(file)
Next, we have the following diff:
Code:
486c488
< String file = fileElem.getAttribute("URI");
---
> String file = URLDecoder.decode(fileElem.getAttribute("URI"), "UTF-8");
As you can guess, this means go to line 486 and look in that area for
Code:
String file = fileElem.getAttribute("URI");
and replace it with:
Code:
String file = URLDecoder.decode(fileElem.getAttribute("URI"), "UTF-8");
Then save and recompile the source code and there you have it.
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
Last edited by Scorpions4ever : December 13th, 2012 at 04:06 AM.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|