From c423eba8713696209849c73ec7b04a69ac771cfc Mon Sep 17 00:00:00 2001 From: Markus Koschany Date: Wed, 16 Nov 2022 16:39:16 +0800 Subject: [PATCH] Jython is optional at runtime but required at build time Bug-Debian: https://bugs.debian.org/884536 Forwarded: not-needed Last-Update: 2018-05-25 Disable it because we don't want to support it. Last-Update: 2018-05-25 Gbp-Pq: Name no-Jython-support.patch --- .../script/jpython/JPythonInterpreter.java | 105 ------------------ .../jpython/JPythonInterpreterFactory.java | 4 +- 2 files changed, 2 insertions(+), 107 deletions(-) delete mode 100644 batik-script/src/main/java/org/apache/batik/script/jpython/JPythonInterpreter.java diff --git a/batik-script/src/main/java/org/apache/batik/script/jpython/JPythonInterpreter.java b/batik-script/src/main/java/org/apache/batik/script/jpython/JPythonInterpreter.java deleted file mode 100644 index 7065386..0000000 --- a/batik-script/src/main/java/org/apache/batik/script/jpython/JPythonInterpreter.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - */ -package org.apache.batik.script.jpython; - -import java.io.IOException; -import java.io.Reader; -import java.io.Writer; -import java.util.Locale; - -import org.apache.batik.script.InterpreterException; -import org.python.util.PythonInterpreter; - -/** - * A simple implementation of Interpreter interface to use - * JPython python parser. - * @author Christophe Jolif - * @version $Id: JPythonInterpreter.java 1733416 2016-03-03 07:07:13Z gadams $ - */ -public class JPythonInterpreter implements org.apache.batik.script.Interpreter { - private PythonInterpreter interpreter = null; - - public JPythonInterpreter() { - interpreter = new PythonInterpreter(); - } - - // org.apache.batik.script.Intepreter implementation - - /** - * Returns the content types of the scripting languages this interpreter - * handles. - */ - public String[] getMimeTypes() { - return JPythonInterpreterFactory.JPYTHON_MIMETYPES; - } - - public Object evaluate(Reader scriptreader) - throws IOException { - return evaluate(scriptreader, ""); - } - - public Object evaluate(Reader scriptreader, String description) - throws IOException { - - // oups jpython doesn't accept reader in its eval method :-( - StringBuffer sbuffer = new StringBuffer(); - char[] buffer = new char[1024]; - int val = 0; - while ((val = scriptreader.read(buffer)) != -1) { - sbuffer.append(buffer,0, val); - } - String str = sbuffer.toString(); - return evaluate(str); - } - - public Object evaluate(String script) { - try { - interpreter.exec(script); - } catch (org.python.core.PyException e) { - throw new InterpreterException(e, e.getMessage(), -1, -1); - } catch (RuntimeException re) { - throw new InterpreterException(re, re.getMessage(), -1, -1); - } - return null; - } - - public void dispose() { - } - - public void bindObject(String name, Object object) { - interpreter.set(name, object); - } - - public void setOut(Writer out) { - interpreter.setOut(out); - } - - // org.apache.batik.i18n.Localizable implementation - - public Locale getLocale() { - return null; - } - - public void setLocale(Locale locale) { - } - - public String formatMessage(String key, Object[] args) { - return null; - } -} diff --git a/batik-script/src/main/java/org/apache/batik/script/jpython/JPythonInterpreterFactory.java b/batik-script/src/main/java/org/apache/batik/script/jpython/JPythonInterpreterFactory.java index 3004921..a80c7a8 100644 --- a/batik-script/src/main/java/org/apache/batik/script/jpython/JPythonInterpreterFactory.java +++ b/batik-script/src/main/java/org/apache/batik/script/jpython/JPythonInterpreterFactory.java @@ -56,7 +56,7 @@ public class JPythonInterpreterFactory implements InterpreterFactory { * @param svg12 whether the document is an SVG 1.2 document */ public Interpreter createInterpreter(URL documentURL, boolean svg12) { - return new JPythonInterpreter(); + return null; } /** @@ -69,6 +69,6 @@ public class JPythonInterpreterFactory implements InterpreterFactory { */ public Interpreter createInterpreter(URL documentURL, boolean svg12, ImportInfo imports) { - return new JPythonInterpreter(); + return null; } }