View | Details | Raw Unified | Return to bug 60950
Collapse All | Expand All

(-)a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java (-1 / +1 lines)
Lines 121-127 public abstract class TransformSupport extends BodyTagSupport { Link Here
121
        }
121
        }
122
122
123
        try {
123
        try {
124
            t = XmlUtil.newTransformer(source);
124
            t = XmlUtil.newTransformer(source, uriResolver);
125
            t.setURIResolver(uriResolver);
125
            t.setURIResolver(uriResolver);
126
        } catch (TransformerConfigurationException e) {
126
        } catch (TransformerConfigurationException e) {
127
            throw new JspTagException(e);
127
            throw new JspTagException(e);
(-)a/impl/src/main/java/org/apache/taglibs/standard/util/XmlUtil.java (-9 / +16 lines)
Lines 25-31 import java.security.PrivilegedAction; Link Here
25
import java.security.PrivilegedActionException;
25
import java.security.PrivilegedActionException;
26
import java.security.PrivilegedExceptionAction;
26
import java.security.PrivilegedExceptionAction;
27
import java.util.concurrent.Callable;
27
import java.util.concurrent.Callable;
28
29
import javax.servlet.http.HttpServletRequest;
28
import javax.servlet.http.HttpServletRequest;
30
import javax.servlet.jsp.PageContext;
29
import javax.servlet.jsp.PageContext;
31
import javax.xml.XMLConstants;
30
import javax.xml.XMLConstants;
Lines 183-196 public class XmlUtil { Link Here
183
     * @return a new Transformer
182
     * @return a new Transformer
184
     * @throws TransformerConfigurationException if there was a problem creating the Transformer from the XSLT
183
     * @throws TransformerConfigurationException if there was a problem creating the Transformer from the XSLT
185
     */
184
     */
186
    public static Transformer newTransformer(Source source) throws TransformerConfigurationException {
185
    public static Transformer newTransformer(Source source, JstlUriResolver uriResolver) throws TransformerConfigurationException {
187
        Transformer transformer = TRANSFORMER_FACTORY.newTransformer(source);
186
        synchronized (TRANSFORMER_FACTORY) {
188
        // Although newTansformer() is not allowed to return null, Xalan does.
187
            final URIResolver original = TRANSFORMER_FACTORY.getURIResolver();
189
        // Trap that here by throwing the expected TransformerConfigurationException.
188
            try {
190
        if (transformer == null) {
189
                TRANSFORMER_FACTORY.setURIResolver(uriResolver);
191
            throw new TransformerConfigurationException("newTransformer returned null. XSLT may be invalid.");
190
                Transformer transformer = TRANSFORMER_FACTORY.newTransformer(source);
191
                // Although newTransformer() is not allowed to return null, Xalan does.
192
                // Trap that here by throwing the expected TransformerConfigurationException.
193
                if (transformer == null) {
194
                    throw new TransformerConfigurationException("newTransformer returned null. XSLT may be invalid.");
195
                }
196
                return transformer;
197
            } finally {
198
                //restore URI resolver on factory to what was before
199
                TRANSFORMER_FACTORY.setURIResolver(original);
200
            }
192
        }
201
        }
193
        return transformer;
194
    }
202
    }
195
203
196
    /**
204
    /**
197
- 

Return to bug 60950