148 e.initCause(sxe); |
148 e.initCause(sxe); |
149 throw e; |
149 throw e; |
150 } catch (ParserConfigurationException pce) { |
150 } catch (ParserConfigurationException pce) { |
151 // Parser with specific options can't be built |
151 // Parser with specific options can't be built |
152 // should not reach here |
152 // should not reach here |
153 InternalError x = new InternalError("Error in creating the new document"); |
153 throw new InternalError("Error in creating the new document", pce); |
154 x.initCause(pce); |
|
155 throw x; |
|
156 } |
154 } |
157 } |
155 } |
158 |
156 |
159 // initialize a new document for the registration data |
157 // initialize a new document for the registration data |
160 private static Document initializeDocument() throws IOException { |
158 private static Document initializeDocument() throws IOException { |
170 |
168 |
171 return doc; |
169 return doc; |
172 } catch (ParserConfigurationException pce) { |
170 } catch (ParserConfigurationException pce) { |
173 // Parser with specified options can't be built |
171 // Parser with specified options can't be built |
174 // should not reach here |
172 // should not reach here |
175 InternalError x = new InternalError("Error in creating the new document"); |
173 throw new InternalError("Error in creating the new document", pce); |
176 x.initCause(pce); |
|
177 throw x; |
|
178 } |
174 } |
179 } |
175 } |
180 |
176 |
181 // Transform the current DOM tree with the given output stream. |
177 // Transform the current DOM tree with the given output stream. |
182 private static void transform(Document document, OutputStream os) { |
178 private static void transform(Document document, OutputStream os) { |
193 transformer.setOutputProperty(OutputKeys.STANDALONE, "yes"); |
189 transformer.setOutputProperty(OutputKeys.STANDALONE, "yes"); |
194 transformer.transform(new DOMSource(document), |
190 transformer.transform(new DOMSource(document), |
195 new StreamResult(new BufferedWriter(new OutputStreamWriter(os, "UTF-8")))); |
191 new StreamResult(new BufferedWriter(new OutputStreamWriter(os, "UTF-8")))); |
196 } catch (UnsupportedEncodingException ue) { |
192 } catch (UnsupportedEncodingException ue) { |
197 // Should not reach here |
193 // Should not reach here |
198 InternalError x = new InternalError("Error generated during transformation"); |
194 throw new InternalError("Error generated during transformation", ue); |
199 x.initCause(ue); |
|
200 throw x; |
|
201 } catch (TransformerConfigurationException tce) { |
195 } catch (TransformerConfigurationException tce) { |
202 // Error generated by the parser |
196 // Error generated by the parser |
203 // Should not reach here |
197 // Should not reach here |
204 InternalError x = new InternalError("Error in creating the new document"); |
198 throw new InternalError("Error in creating the new document", tce); |
205 x.initCause(tce); |
|
206 throw x; |
|
207 } catch (TransformerException te) { |
199 } catch (TransformerException te) { |
208 // Error generated by the transformer |
200 // Error generated by the transformer |
209 InternalError x = new InternalError("Error generated during transformation"); |
201 throw new InternalError("Error generated during transformation", te); |
210 x.initCause(te); |
|
211 throw x; |
|
212 } |
202 } |
213 } |
203 } |
214 |
204 |
215 private static void addServiceTagRegistry(Document document, |
205 private static void addServiceTagRegistry(Document document, |
216 String registryURN, |
206 String registryURN, |