Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 13th, 2012, 01:34 AM
rrypo123 rrypo123 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 1 rrypo123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #2  
Old December 13th, 2012, 04:03 AM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,406 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 10 h 17 m 19 sec
Reputation Power: 4080
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:
Code:
 
import java.net.*; 


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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Need Help - I am not even a beginner in Java :(

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap