jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/TransletOutput.java
changeset 40828 3748a4f12d7b
parent 25868 686eef1e7a79
equal deleted inserted replaced
40777:e384420383a5 40828:3748a4f12d7b
     1 /*
     1 /*
     2  * reserved comment block
     2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT REMOVE OR ALTER!
       
     4  */
     3  */
       
     4 
     5 /*
     5 /*
     6  * Copyright 2001-2004 The Apache Software Foundation.
     6  * Licensed to the Apache Software Foundation (ASF) under one or more
     7  *
     7  * contributor license agreements.  See the NOTICE file distributed with
     8  * Licensed under the Apache License, Version 2.0 (the "License");
     8  * this work for additional information regarding copyright ownership.
     9  * you may not use this file except in compliance with the License.
     9  * The ASF licenses this file to You under the Apache License, Version 2.0
    10  * You may obtain a copy of the License at
    10  * (the "License"); you may not use this file except in compliance with
       
    11  * the License.  You may obtain a copy of the License at
    11  *
    12  *
    12  *     http://www.apache.org/licenses/LICENSE-2.0
    13  *     http://www.apache.org/licenses/LICENSE-2.0
    13  *
    14  *
    14  * Unless required by applicable law or agreed to in writing, software
    15  * Unless required by applicable law or agreed to in writing, software
    15  * distributed under the License is distributed on an "AS IS" BASIS,
    16  * distributed under the License is distributed on an "AS IS" BASIS,
    16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    17  * See the License for the specific language governing permissions and
    18  * See the License for the specific language governing permissions and
    18  * limitations under the License.
    19  * limitations under the License.
    19  */
       
    20 /*
       
    21  * $Id: TransletOutput.java,v 1.2.4.1 2005/09/05 09:19:44 pvedula Exp $
       
    22  */
    20  */
    23 
    21 
    24 package com.sun.org.apache.xalan.internal.xsltc.compiler;
    22 package com.sun.org.apache.xalan.internal.xsltc.compiler;
    25 
    23 
    26 import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
    24 import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
    33 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
    31 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
    34 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.StringType;
    32 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.StringType;
    35 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
    33 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
    36 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
    34 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
    37 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
    35 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
       
    36 import jdk.xml.internal.JdkXmlFeatures;
    38 
    37 
    39 /**
    38 /**
    40  * @author Morten Jorgensen
    39  * @author Morten Jorgensen
    41  */
    40  */
    42 final class TransletOutput extends Instruction {
    41 final class TransletOutput extends Instruction {
   101     public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
   100     public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
   102         final ConstantPoolGen cpg = classGen.getConstantPool();
   101         final ConstantPoolGen cpg = classGen.getConstantPool();
   103         final InstructionList il = methodGen.getInstructionList();
   102         final InstructionList il = methodGen.getInstructionList();
   104         final boolean isSecureProcessing = classGen.getParser().getXSLTC()
   103         final boolean isSecureProcessing = classGen.getParser().getXSLTC()
   105                                            .isSecureProcessing();
   104                                            .isSecureProcessing();
       
   105         final boolean isExtensionFunctionEnabled = classGen.getParser().getXSLTC()
       
   106                 .getFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION);
   106 
   107 
   107         if (isSecureProcessing) {
   108         if (isSecureProcessing && !isExtensionFunctionEnabled) {
   108             int index = cpg.addMethodref(BASIS_LIBRARY_CLASS,
   109             int index = cpg.addMethodref(BASIS_LIBRARY_CLASS,
   109                                          "unallowed_extension_elementF",
   110                                          "unallowed_extension_elementF",
   110                                          "(Ljava/lang/String;)V");
   111                                          "(Ljava/lang/String;)V");
   111             il.append(new PUSH(cpg, "redirect"));
   112             il.append(new PUSH(cpg, "redirect"));
   112             il.append(new INVOKESTATIC(index));
   113             il.append(new INVOKESTATIC(index));