odd behaviour with quoted input strings

I'm working with a java-based monitoring tool (Solaris/x86) which can be configured to call a shell script when a particular event occurs. The java app sends a set of quoted strings as input to the shell script.

The problem I'm running into is that the shell script, when called by the java app, appears to be treating the quote marks as if they are escaped.

Here's a simplified example of what I'm seeing.

$ cat myscript.sh
#!/bin/sh
p1=$1
p2=$2
p3=$3
p4=$4

echo p1 = .$p1.
echo p2 = .$p2.
echo p3 = .$p3.
echo p4 = .$p4.
# end of myscript.sh
$

If I manually run myscript.sh with a couple quoted input strings I get the desired behaviour, namely p1 and p2 are set to the value of the 2 input strings, while p3 and p4 are undefined/empty:

$ myscript.sh 'a b' 'c d'
p1 = .a b.
p2 = .c d.
p3 = ..
p4 = ..

When the java app calls myscript.sh with the same quoted string arguments I do not get the desired results:

p1 = .'a.
p2 = .b'.
p3 = .'c.
p4 = .d'.

Besides the fact that the p[1-4] variables have the wrong values, there's the oddity that the quotes are showing up as part of the values stored in the p[1-4] variables.

I've modified myscript.sh to run 'env|sort' and 'stty -a' and then compared the 2 sets of output (my manual run vs java app's run). I've reconfigured my environment to use the same settings as the java app, but so far have not been able to duplicate the results obtained when the java app calls myscript.sh.

I've also made sure that the java app and I are running under the same UNIX login ... still a no go.

The java app does not exhibit this behaviour on other UNIX machines so I'm assuming/hoping this is a 'simple' issue of an environment setting for the java app on this machine, but at the moment I'm drawing a blank.

Any suggestions/ideas?

TIA,
Mark