예제 #1
0
 protected void circumventBugIfNeeded(XMLSignatureInput input)
     throws CanonicalizationException, ParserConfigurationException, IOException, SAXException {
   if (!input.isNeedsToBeExpanded()) {
     return;
   }
   Document doc = null;
   if (input.getSubNode() != null) {
     doc = XMLUtils.getOwnerDocument(input.getSubNode());
   } else {
     doc = XMLUtils.getOwnerDocument(input.getNodeSet());
   }
   XMLUtils.circumventBug2650(doc);
 }
 /**
  * Method engineCanonicalizeXPathNodeSet
  *
  * @inheritDoc
  * @param xpathNodeSet
  * @throws CanonicalizationException
  */
 public byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet) throws CanonicalizationException {
   if (xpathNodeSet.size() == 0) {
     return new byte[0];
   }
   this._xpathNodeSet = xpathNodeSet;
   try {
     Node rootNodeOfC14n = XMLUtils.getOwnerDocument(this._xpathNodeSet);
     this.canonicalizeXPathNodeSet(rootNodeOfC14n, new NameSpaceSymbTable());
     this._writer.close();
     if (this._writer instanceof ByteArrayOutputStream) {
       return ((ByteArrayOutputStream) this._writer).toByteArray();
     }
     return null;
   } catch (UnsupportedEncodingException ex) {
     throw new CanonicalizationException("empty", ex);
   } catch (IOException ex) {
     throw new CanonicalizationException("empty", ex);
   }
 }