Message3723

Author amylin
Recipients amylin
Date 2008-10-29.21:02:42
SpamBayes Score 2.52071e-12
Marked as misclassified No
Message-id <1225314163.94.0.805586188479.issue1163@psf.upfronthosting.co.za>
In-reply-to
Content
When we issue a jython command in WebSphere wsadmin scripting tool 
which invokes a WebSphere MBean operation and the MBean method returns 
a string containing some NLS translated characters such as French 
characters "ceci aété fait déjà", Jython will automatically converts 
the string to python unicode string and return to the wsadmin.

Here is an example:

The Java method "mbeanTest" returns some French characters:

public String mbeanTest()
{
return "ceci a été fait déjà"; 
}

Invoke the method in wsadmin interactive mode using jython and the 
command returns some unicode string to wsadmin. It appears a bug in 
Jython to mangle and convert the French string to python unicode 
string.

C:\WebSphere\AppServer\profiles\Dmgr01\bin>wsadmin -lang jython
*sys-package-mgr*: processing modified jar,
'C:\WebSphere\AppServer\plugins\com.ibm.ws.admin.services.jar'
WASX7209I: Connected to process "dmgr" on node AMYLIN4CellManager06 
using SOAP connector; The type of process is: DeploymentManager
WASX7031I: For help, enter: "print Help.help()"

wsadmin>cs = AdminControl.queryNames("type=ConfigService,*")
wsadmin>AdminControl.invoke(cs, 'mbeanTest')
'ceci a \xE9t\xE9 fait d\xE9j\xE0'


The wsadmin does not convert the French string to unicode string. The
wsadmin has invoked BSFManager.iexec(lang, command, 0, 0, command) and
BSFManger has taken the input command and finally invoked Jython
PyInterpreter.runcode() code and it somehow converts the French string 
to the unicode string in Jython code and returns the unicode string to 
wsadmin.

If we issue Jython "print" output command, it will returns the correct
string. We have added System.out.println() statements to prove wsadmin 
has not converted the string and Jython has converted the string to 
unicode string and return to wsadmin.

wsadmin>cs = AdminControl.queryNames("WebSphere:type=ConfigService,*")
********* invoke BSFManager.iexec(lang, command, 0, 0, command)
********* done
wsadmin>AdminControl.invoke(cs, 'mbeanTest')
********* invoke BSFManager.iexec(lang, command, 0, 0, command)
********** return from AdminControl.invoke() ceci a été fait déjà
'ceci a \xE9t\xE9 fait d\xE9j\xE0'


When issue the "print" command, it returns the correct French string.

wsadmin>s = AdminControl.invoke(cs, 'mbeanTest')
wsadmin>print s
ceci a été fait déjà
History
Date User Action Args
2008-10-29 21:02:44amylinsetrecipients: + amylin
2008-10-29 21:02:43amylinsetmessageid: <1225314163.94.0.805586188479.issue1163@psf.upfronthosting.co.za>
2008-10-29 21:02:43amylinlinkissue1163 messages
2008-10-29 21:02:42amylincreate