Solved

Very Strange Java Concatenation Behaviour!

Posted on 2011-09-30
3
192 Views
Last Modified: 2012-05-12
I'm Trying to construct my URL using the following concatenation

String url = URL_BASE + host  + "/gimp/index.php?cmd=" + cmd + "&user=" + userName + "&password=" + password.toString();

However, I get a reference to an object instead of the password itself.  "The password is passed in using a char array".  I also used the concat method with no luck at all.

https://reports.company.com/gimp/index.php?cmd=gs&user=someuser&password=[C@19c6866d
0
Comment
Question by:snajalm
  • 2
3 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 250 total points
ID: 36890151
Try instead:

String url = URL_BASE + host  + "/gimp/index.php?cmd=" + cmd + "&user=" + userName + "&password=" + new String(password);
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36890158
Char{}.toString() is not producting String, whereas if you use condtrictor new String(char[] ) you'll get String out of char[] array
0
 

Author Closing Comment

by:snajalm
ID: 36890253
That worked just fine so many thanks to you "for_yan" for accurate answer!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now