[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Very Strange Java Concatenation Behaviour!

Posted on 2011-09-30
3
Medium Priority
?
202 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 1000 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

649 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