Solved

Very Strange Java Concatenation Behaviour!

Posted on 2011-09-30
3
198 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How  Can  I  resolve   this  Error "java.sql.SQLException: Invalid column index" 4 56
use lov values 2 72
collection output issue 9 66
Java Eclipse Loop 3 31
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This video teaches viewers about errors in exception handling.

726 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