IP address working with strings in Java Plug-In
I tried to adapt the code to my application but the flow kept aborting. After many tests and playing with the code I think I have isolated one of my problems. Whenever I try to set a string to the path value, it bombs out.
Code looks like this:
String DestFilePath = "\\10.14.8.21\C$\CustomerInput\SD4\";
For some reason it doesn’t like the string contents. In particular it don’t like the C after the server IP address. I know it must be the \ characters.
The error I get is
> Token Parsing Error: Lexical error at line 46, column 40. Encountered: ""C"" (67), after : ""\""\\\\10.14.8.21\\""]
Can you put this basic string assignment in any Plug-In and see if you get the same. It may be all the backslashes, is there another way to write this assignment?
-
The backslash was the culprit. In a Javascript string any character you want to ignore must be proceeded by a backslash. Since the string I was retrieving from the flow was a IP address path looking like \\10.14.8.16\C$\CustomerInput\SD4 I needed to code it like this \\\\10.14.8.16\\C$\\CustomerInput\\SD4 to make it ignore the backslashes.
Once I knew that little secret the rest was easy.
0
Please sign in to leave a comment.
Comments
1 comment