From: <cg...@us...> - 2007-10-03 08:54:09
|
Revision: 3555 http://jython.svn.sourceforge.net/jython/?rev=3555&view=rev Author: cgroves Date: 2007-10-03 01:54:08 -0700 (Wed, 03 Oct 2007) Log Message: ----------- Exit if the encoding given in python.console.encoding isn't supported on this JVM Modified Paths: -------------- trunk/jython/src/org/python/util/InteractiveInterpreter.java trunk/jython/src/org/python/util/jython.java Modified: trunk/jython/src/org/python/util/InteractiveInterpreter.java =================================================================== --- trunk/jython/src/org/python/util/InteractiveInterpreter.java 2007-10-03 06:38:51 UTC (rev 3554) +++ trunk/jython/src/org/python/util/InteractiveInterpreter.java 2007-10-03 08:54:08 UTC (rev 3555) @@ -50,7 +50,7 @@ public boolean runsource(String source, String filename, String symbol) { PyObject code; try { - code = Py.compile_command_flags(source, filename, symbol,cflags,true); + code = Py.compile_command_flags(source, filename, symbol, cflags, true); } catch (PyException exc) { if (Py.matchException(exc, Py.SyntaxError)) { // Case 1 Modified: trunk/jython/src/org/python/util/jython.java =================================================================== --- trunk/jython/src/org/python/util/jython.java 2007-10-03 06:38:51 UTC (rev 3554) +++ trunk/jython/src/org/python/util/jython.java 2007-10-03 08:54:08 UTC (rev 3555) @@ -1,10 +1,22 @@ // Copyright (c) Corporation for National Research Initiatives package org.python.util; -import org.python.core.*; +import java.io.File; +import java.io.InputStream; +import java.nio.charset.Charset; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; -import java.util.zip.*; -import java.io.*; +import org.python.core.Options; +import org.python.core.Py; +import org.python.core.PyCode; +import org.python.core.PyException; +import org.python.core.PyModule; +import org.python.core.PyObject; +import org.python.core.PyString; +import org.python.core.PyStringMap; +import org.python.core.PySystemState; +import org.python.core.imp; public class jython { @@ -222,7 +234,12 @@ opts.encoding = PySystemState.registry.getProperty( "python.console.encoding", null); } - if (opts.encoding != null) { + if(opts.encoding != null) { + if(!Charset.isSupported(opts.encoding)) { + System.err.println(opts.encoding + + " is not a supported encoding on this JVM, so it can't be used in python.console.encoding."); + System.exit(1); + } interp.cflags.encoding = opts.encoding; } try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |