• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

Very Strange Java Concatenation Behaviour!

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
snajalm
Asked:
snajalm
  • 2
1 Solution
 
for_yanCommented:
Try instead:

String url = URL_BASE + host  + "/gimp/index.php?cmd=" + cmd + "&user=" + userName + "&password=" + new String(password);
0
 
for_yanCommented:
Char{}.toString() is not producting String, whereas if you use condtrictor new String(char[] ) you'll get String out of char[] array
0
 
snajalmAuthor Commented:
That worked just fine so many thanks to you "for_yan" for accurate answer!
0

Featured Post

Industry Leaders: 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!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now