Hi Gurus,
I know its a basic question. but i dont how it is handled in java.
I have a program that handles 5 String[] args. The input args are going to be
ipaddress time username encryptedpassword role.
10.0.0.0 1306149242287 Admin Tf]Mbp9}`n,$H'Ld0\"Vh|% AdminUser
note that the encrypted password contains " (Double Quotes). Becuase of this the Java main method takes `Tf]Mbp9}`n,$H'Ld0\"Vh|% AdminUser` as a single argument. So if i try to handle args[4] then i get ArrayOutofBoundException
Here is the sample code
When i run this program
C:>java com.xyz.dm.TestArgs 10.0.0.0 1306149242287 Admin Tf]Mbp9}`n,$H'Ld0\"Vh|% Admin
Lenth5
Arument is ==10.0.0.0
Arument is ==1306149242287
Arument is ==Admin
Arument is ==Tf]Mbp9}`n,$H'Ld0"Vh|%
Arument is ==Admin
But if i run the same class through ProcessBuilder and passing these exact argument, im getting the java.lang.ArrayIndexOutOfBoundsException: 4
Here is the code:
Here is the output
In ======== Lenth4
Argument is ==10.78.0.0
Argument is ==1306149242287
Argument is ==Admin
Argument is ==Tf]Mbp9}`n,$H'Ld0Vh|% Admin
Is it a valid behavior ? To have a workaround im passing the encrypted password as the final argument. But if i have the encrypted password in the middle i will have this exception.
Could someone clarify this behaviour
Thanks,
Venkat