Message6446
The two test cases below exit with a
java.lang.NullPointerException
at org.python.core.Py.javas2pys(Py.java:1559)
at org.python.jsr223.PyScriptEngine$1.invoke(PyScriptEngine.java:154)
at $Proxy10.toString(Unknown Source)
.........
public void testGetInterfaceCharSequence1() throws ScriptException, IOException {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("python");
Invocable invocableEngine = (Invocable) engine;
assertNull(engine.eval(
"from java.lang import CharSequence\n" +
"class MyString(CharSequence):\n" +
" def length(self): return 3\n" +
" def charAt(self, index): return 'a'\n" +
" def subSequence(self, start, end): return \"\"\n" +
" def toString(self): return \"aaa\"\n" +
"c = MyString()"));
CharSequence seq = invocableEngine.getInterface(engine.get("c"), CharSequence.class);
assertEquals("aaa", seq.toString());
}
public void testGetInterfaceCharSequence2() throws ScriptException, IOException {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine pythonEngine = manager.getEngineByName("python");
Invocable invocableEngine = (Invocable) pythonEngine;
assertNull(pythonEngine.eval(
"from java.lang import StringBuilder\r\n" +
"c = StringBuilder(\"abc\")\r\n"));
CharSequence seq = invocableEngine.getInterface(pythonEngine.get("c"), CharSequence.class);
assertEquals("abc", seq.toString());
} |
|
Date |
User |
Action |
Args |
2011-03-21 17:09:52 | kaneiderdaniel | set | recipients:
+ kaneiderdaniel |
2011-03-21 17:09:52 | kaneiderdaniel | set | messageid: <1300727392.79.0.443216304136.issue1721@psf.upfronthosting.co.za> |
2011-03-21 17:09:52 | kaneiderdaniel | link | issue1721 messages |
2011-03-21 17:09:52 | kaneiderdaniel | create | |
|