@ char conflict while passing value to SmbFileInputStream() function

M

Mohit Mehral

String user="//administrator:";
String pass="ce11@!@#";
SmbFileInputStream fstream = new SmbFileInputStream("smb:"+user
+pass"@"+file_ip);
////////////////////////////////////////////////////////////////////////////////////
smb://administrtorce11@!@@172.21.8.9
///////////////////////////////////////////////////////////////////////////////////
user://unamePASSWD@hostIP
RUNTIME Exception encounter ::::::----> hostname invalid incase my
password having '@' sign.

Is there anyway to handle the @ char. in my password.for that it'll
not conflict with host IP.
 
R

RedGrittyBrick

Mohit said:
String user="//administrator:";
String pass="ce11@!@#";
SmbFileInputStream fstream = new SmbFileInputStream("smb:"+user
+pass"@"+file_ip);

That's clearly not your code, you should cut and paste real code.
////////////////////////////////////////////////////////////////////////////////////
smb://administrtorce11@!@@172.21.8.9
///////////////////////////////////////////////////////////////////////////////////
user://unamePASSWD@hostIP
RUNTIME Exception encounter ::::::----> hostname invalid incase my
password having '@' sign.

Is there anyway to handle the @ char. in my password.for that it'll
not conflict with host IP.

I recommend you read the documentation for the classes you are using!
The documentation says:

"the '@' [in the example password] is URL encoded with
the '%40' hexcode escape."

so

SmbFileInputStream fstream = new SmbFileInputStream(
"smb://" + user + ":" + pass.replaceAll("@","%40") + "@" + file_ip
);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top