1 /* |
1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
105 if (m_realTransformer == null) { |
105 if (m_realTransformer == null) { |
106 m_realTransformer = transformerFactory.newTransformer(); |
106 m_realTransformer = transformerFactory.newTransformer(); |
107 } |
107 } |
108 } |
108 } |
109 |
109 |
|
110 @Override |
110 public void clearParameters() { |
111 public void clearParameters() { |
111 if (m_realTransformer != null) |
112 if (m_realTransformer != null) |
112 m_realTransformer.clearParameters(); |
113 m_realTransformer.clearParameters(); |
113 } |
114 } |
114 |
115 |
|
116 @Override |
115 public javax.xml.transform.ErrorListener getErrorListener() { |
117 public javax.xml.transform.ErrorListener getErrorListener() { |
116 try { |
118 try { |
117 materialize(); |
119 materialize(); |
118 return m_realTransformer.getErrorListener(); |
120 return m_realTransformer.getErrorListener(); |
119 } catch (TransformerException e) { |
121 } catch (TransformerException e) { |
120 // will be caught later |
122 // will be caught later |
121 } |
123 } |
122 return null; |
124 return null; |
123 } |
125 } |
124 |
126 |
|
127 @Override |
125 public java.util.Properties getOutputProperties() { |
128 public java.util.Properties getOutputProperties() { |
126 try { |
129 try { |
127 materialize(); |
130 materialize(); |
128 return m_realTransformer.getOutputProperties(); |
131 return m_realTransformer.getOutputProperties(); |
129 } catch (TransformerException e) { |
132 } catch (TransformerException e) { |
130 // will be caught later |
133 // will be caught later |
131 } |
134 } |
132 return null; |
135 return null; |
133 } |
136 } |
134 |
137 |
|
138 @Override |
135 public String getOutputProperty(String str) |
139 public String getOutputProperty(String str) |
136 throws java.lang.IllegalArgumentException { |
140 throws java.lang.IllegalArgumentException { |
137 try { |
141 try { |
138 materialize(); |
142 materialize(); |
139 return m_realTransformer.getOutputProperty(str); |
143 return m_realTransformer.getOutputProperty(str); |
141 // will be caught later |
145 // will be caught later |
142 } |
146 } |
143 return null; |
147 return null; |
144 } |
148 } |
145 |
149 |
|
150 @Override |
146 public Object getParameter(String str) { |
151 public Object getParameter(String str) { |
147 try { |
152 try { |
148 materialize(); |
153 materialize(); |
149 return m_realTransformer.getParameter(str); |
154 return m_realTransformer.getParameter(str); |
150 } catch (TransformerException e) { |
155 } catch (TransformerException e) { |
151 // will be caught later |
156 // will be caught later |
152 } |
157 } |
153 return null; |
158 return null; |
154 } |
159 } |
155 |
160 |
|
161 @Override |
156 public javax.xml.transform.URIResolver getURIResolver() { |
162 public javax.xml.transform.URIResolver getURIResolver() { |
157 try { |
163 try { |
158 materialize(); |
164 materialize(); |
159 return m_realTransformer.getURIResolver(); |
165 return m_realTransformer.getURIResolver(); |
160 } catch (TransformerException e) { |
166 } catch (TransformerException e) { |
161 // will be caught later |
167 // will be caught later |
162 } |
168 } |
163 return null; |
169 return null; |
164 } |
170 } |
165 |
171 |
|
172 @Override |
166 public void setErrorListener( |
173 public void setErrorListener( |
167 javax.xml.transform.ErrorListener errorListener) |
174 javax.xml.transform.ErrorListener errorListener) |
168 throws java.lang.IllegalArgumentException { |
175 throws java.lang.IllegalArgumentException { |
169 try { |
176 try { |
170 materialize(); |
177 materialize(); |
172 } catch (TransformerException e) { |
179 } catch (TransformerException e) { |
173 // will be caught later |
180 // will be caught later |
174 } |
181 } |
175 } |
182 } |
176 |
183 |
|
184 @Override |
177 public void setOutputProperties(java.util.Properties properties) |
185 public void setOutputProperties(java.util.Properties properties) |
178 throws java.lang.IllegalArgumentException { |
186 throws java.lang.IllegalArgumentException { |
179 try { |
187 try { |
180 materialize(); |
188 materialize(); |
181 m_realTransformer.setOutputProperties(properties); |
189 m_realTransformer.setOutputProperties(properties); |
182 } catch (TransformerException e) { |
190 } catch (TransformerException e) { |
183 // will be caught later |
191 // will be caught later |
184 } |
192 } |
185 } |
193 } |
186 |
194 |
|
195 @Override |
187 public void setOutputProperty(String str, String str1) |
196 public void setOutputProperty(String str, String str1) |
188 throws java.lang.IllegalArgumentException { |
197 throws java.lang.IllegalArgumentException { |
189 try { |
198 try { |
190 materialize(); |
199 materialize(); |
191 m_realTransformer.setOutputProperty(str, str1); |
200 m_realTransformer.setOutputProperty(str, str1); |
192 } catch (TransformerException e) { |
201 } catch (TransformerException e) { |
193 // will be caught later |
202 // will be caught later |
194 } |
203 } |
195 } |
204 } |
196 |
205 |
|
206 @Override |
197 public void setParameter(String str, Object obj) { |
207 public void setParameter(String str, Object obj) { |
198 try { |
208 try { |
199 materialize(); |
209 materialize(); |
200 m_realTransformer.setParameter(str, obj); |
210 m_realTransformer.setParameter(str, obj); |
201 } catch (TransformerException e) { |
211 } catch (TransformerException e) { |
202 // will be caught later |
212 // will be caught later |
203 } |
213 } |
204 } |
214 } |
205 |
215 |
|
216 @Override |
206 public void setURIResolver(javax.xml.transform.URIResolver uRIResolver) { |
217 public void setURIResolver(javax.xml.transform.URIResolver uRIResolver) { |
207 try { |
218 try { |
208 materialize(); |
219 materialize(); |
209 m_realTransformer.setURIResolver(uRIResolver); |
220 m_realTransformer.setURIResolver(uRIResolver); |
210 } catch (TransformerException e) { |
221 } catch (TransformerException e) { |
270 throw new TransformerException("Unexpected StreamSource object"); |
281 throw new TransformerException("Unexpected StreamSource object"); |
271 } |
282 } |
272 |
283 |
273 //------------------------------------------------------------------------ |
284 //------------------------------------------------------------------------ |
274 |
285 |
|
286 @Override |
275 public void transform( |
287 public void transform( |
276 javax.xml.transform.Source source, |
288 javax.xml.transform.Source source, |
277 javax.xml.transform.Result result) |
289 javax.xml.transform.Result result) |
278 throws javax.xml.transform.TransformerException |
290 throws javax.xml.transform.TransformerException |
279 { |
291 { |
407 |
419 |
408 /** |
420 /** |
409 * Return Transformer instance for this thread, allocating a new one if |
421 * Return Transformer instance for this thread, allocating a new one if |
410 * necessary. Note that this method does not clear global parameters, |
422 * necessary. Note that this method does not clear global parameters, |
411 * properties or any other data set on a previously used transformer. |
423 * properties or any other data set on a previously used transformer. |
|
424 * |
|
425 * @return Transformer instance |
412 */ |
426 */ |
413 public static Transformer newTransformer() { |
427 public static Transformer newTransformer() { |
414 //CR : 6813167 |
428 //CR : 6813167 |
415 /*Transformer tt = (Transformer) effTransformer.get(); |
429 /*Transformer tt = (Transformer) effTransformer.get(); |
416 if (tt == null) { |
430 if (tt == null) { |