public V get() throws Error { ClassLoader tccl = getContextClassLoader(); V instance = CACHE.get(tccl); if (instance == null) { instance = createNewInstance(); CACHE.put(tccl, instance); } return instance; }
/** * Creates a new identity transformer. * @return */ public static Transformer newTransformer() { try { return transformerFactory.get().newTransformer(); } catch (TransformerConfigurationException tex) { throw new IllegalStateException("Unable to create a JAXP transformer"); } }
private V createNewInstance() { try { return initialValue(); } catch (Exception e) { throw new Error(ContextClassloaderLocalMessages.FAILED_TO_CREATE_NEW_INSTANCE(getClass().getName()), e); } }
public void set(V instance) { CACHE.put(getContextClassLoader(), instance); }
private V createNewInstance() { try { return initialValue(); } catch (Exception e) { throw new Error(ContextClassloaderLocalMessages.FAILED_TO_CREATE_NEW_INSTANCE(getClass().getName()), e); } }
public void set(V instance) { CACHE.put(getContextClassLoader(), instance); }
public V get() throws Error { ClassLoader tccl = getContextClassLoader(); V instance = CACHE.get(tccl); if (instance == null) { instance = createNewInstance(); CACHE.put(tccl, instance); } return instance; }
/** * Creates a new identity transformer. * @return */ public static Transformer newTransformer() { try { return transformerFactory.get().newTransformer(); } catch (TransformerConfigurationException tex) { throw new IllegalStateException("Unable to create a JAXP transformer"); } }
private V createNewInstance() { try { return initialValue(); } catch (Exception e) { throw new Error(ContextClassloaderLocalMessages.FAILED_TO_CREATE_NEW_INSTANCE(getClass().getName()), e); } }
public void set(V instance) { CACHE.put(getContextClassLoader(), instance); }
public V get() throws Error { ClassLoader tccl = getContextClassLoader(); V instance = CACHE.get(tccl); if (instance == null) { instance = createNewInstance(); CACHE.put(tccl, instance); } return instance; }
/** * Creates a new identity transformer. * @return */ public static Transformer newTransformer() { try { return transformerFactory.get().newTransformer(); } catch (TransformerConfigurationException tex) { throw new IllegalStateException("Unable to create a JAXP transformer"); } }
/** * Performs identity transformation. * @param <T> * @param src * @param result * @return * @throws javax.xml.transform.TransformerException * @throws java.io.IOException * @throws org.xml.sax.SAXException * @throws javax.xml.parsers.ParserConfigurationException */ public static <T extends Result> T identityTransform(Source src, T result) throws TransformerException, SAXException, ParserConfigurationException, IOException { if (src instanceof StreamSource) { // work around a bug in JAXP in JDK6u4 and earlier where the namespace processing // is not turned on by default StreamSource ssrc = (StreamSource) src; TransformerHandler th = ((SAXTransformerFactory) transformerFactory.get()).newTransformerHandler(); th.setResult(result); XMLReader reader = saxParserFactory.get().newSAXParser().getXMLReader(); reader.setContentHandler(th); reader.setProperty(LEXICAL_HANDLER_PROPERTY, th); reader.parse(toInputSource(ssrc)); } else { newTransformer().transform(src, result); } return result; }
/** * Performs identity transformation. * @param <T> * @param src * @param result * @return * @throws javax.xml.transform.TransformerException * @throws java.io.IOException * @throws org.xml.sax.SAXException * @throws javax.xml.parsers.ParserConfigurationException */ public static <T extends Result> T identityTransform(Source src, T result) throws TransformerException, SAXException, ParserConfigurationException, IOException { if (src instanceof StreamSource) { // work around a bug in JAXP in JDK6u4 and earlier where the namespace processing // is not turned on by default StreamSource ssrc = (StreamSource) src; TransformerHandler th = ((SAXTransformerFactory) transformerFactory.get()).newTransformerHandler(); th.setResult(result); XMLReader reader = saxParserFactory.get().newSAXParser().getXMLReader(); reader.setContentHandler(th); reader.setProperty(LEXICAL_HANDLER_PROPERTY, th); reader.parse(toInputSource(ssrc)); } else { newTransformer().transform(src, result); } return result; }
/** * Performs identity transformation. * @param <T> * @param src * @param result * @return * @throws javax.xml.transform.TransformerException * @throws java.io.IOException * @throws org.xml.sax.SAXException * @throws javax.xml.parsers.ParserConfigurationException */ public static <T extends Result> T identityTransform(Source src, T result) throws TransformerException, SAXException, ParserConfigurationException, IOException { if (src instanceof StreamSource) { // work around a bug in JAXP in JDK6u4 and earlier where the namespace processing // is not turned on by default StreamSource ssrc = (StreamSource) src; TransformerHandler th = ((SAXTransformerFactory) transformerFactory.get()).newTransformerHandler(); th.setResult(result); XMLReader reader = saxParserFactory.get().newSAXParser().getXMLReader(); reader.setContentHandler(th); reader.setProperty(LEXICAL_HANDLER_PROPERTY, th); reader.parse(toInputSource(ssrc)); } else { newTransformer().transform(src, result); } return result; }