Path: blob/master/test/jdk/javax/script/JDK_8196959/BadFactory.java
41149 views
/*1* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223import javax.script.*;24import java.util.*;2526// do many bad things to prevent ScriptEngineManager to run correctly27public class BadFactory implements ScriptEngineFactory {28public String getEngineName() {29return null;30}3132public String getEngineVersion() {33return null;34}3536public List<String> getExtensions() {37return null;38}3940public String getLanguageName() {41return null;42}4344public String getLanguageVersion() {45return null;46}4748public String getMethodCallSyntax(String obj, String m, String[] args) {49return null;50}5152public List<String> getMimeTypes() {53List<String> list = new ArrayList<String>();54list.add("application/bad");55list.add(null);56list.add("");57return list;58}5960public List<String> getNames() {61throw new IllegalArgumentException();62}6364public String getOutputStatement(String str) {65return "bad-factory-output";66}6768public String getParameter(String key) {69return null;70}7172public String getProgram(String[] statements) {73return null;74}7576public ScriptEngine getScriptEngine() {77return null;78}79}808182