You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by mu...@apache.org on 2006/01/13 23:02:12 UTC
svn commit: r368871 [4/6] - in /xml/security/branches/jsr105_0_16/src/org:
apache/xml/security/ apache/xml/security/algorithms/
apache/xml/security/algorithms/implementations/ apache/xml/security/c14n/
apache/xml/security/c14n/helper/ apache/xml/securi...
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/implementations/TransformXPath2Filter.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/implementations/TransformXPath2Filter.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/implementations/TransformXPath2Filter.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/implementations/TransformXPath2Filter.java Fri Jan 13 14:00:23 2006
@@ -20,10 +20,7 @@
import java.io.IOException;
import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
-import java.util.Set;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
@@ -31,6 +28,7 @@
import org.apache.xml.security.c14n.CanonicalizationException;
import org.apache.xml.security.c14n.InvalidCanonicalizerException;
import org.apache.xml.security.exceptions.XMLSecurityException;
+import org.apache.xml.security.signature.NodeFilter;
import org.apache.xml.security.signature.XMLSignatureInput;
import org.apache.xml.security.transforms.TransformSpi;
import org.apache.xml.security.transforms.TransformationException;
@@ -38,17 +36,14 @@
import org.apache.xml.security.transforms.params.XPath2FilterContainer;
import org.apache.xml.security.utils.CachedXPathAPIHolder;
import org.apache.xml.security.utils.CachedXPathFuncHereAPI;
-import org.apache.xml.security.utils.HelperNodeList;
import org.apache.xml.security.utils.XMLUtils;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
-
/**
* Implements the <I>XML Signature XPath Filter v2.0</I>
*
@@ -67,30 +62,10 @@
public static final String implementedTransformURI =
Transforms.TRANSFORM_XPATH2FILTER;
//J-
- // contains the type of the filter
- List _filterTypes = new ArrayList();
+ // contains the type of the filter
// contains the node set
- List _filterNodes = new ArrayList();
-
- Set _F = null;
- List _ancestors = null;
-
- private static final String FUnion = "union";
- private static final String FSubtract = "subtract";
- private static final String FIntersect = "intersect";
-
- /** @inheritDoc */
- public boolean wantsOctetStream () { return false; }
- /** @inheritDoc */
- public boolean wantsNodeSet () { return true; }
- /** @inheritDoc */
- public boolean returnsOctetStream () { return false; }
- /** @inheritDoc */
- public boolean returnsNodeSet () { return true; }
-
- //J+
-
+
/**
* Method engineGetURI
*
@@ -100,7 +75,7 @@
return implementedTransformURI;
}
- Set _inputSet = null;
+
/**
* Method enginePerformTransform
@@ -111,20 +86,15 @@
*/
protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input)
throws TransformationException {
-
+ CachedXPathAPIHolder.setDoc(this._transformObject.getElement().getOwnerDocument());
try {
-
- this._inputSet = input.getNodeSet(true);
-
- if (this._inputSet.size() == 0) {
-
- // input node set contains no nodes
- return input;
- }
+ List unionNodes=new ArrayList();
+ List substractNodes=new ArrayList();
+ List intersectNodes=new ArrayList();
CachedXPathFuncHereAPI xPathFuncHereAPI =
new CachedXPathFuncHereAPI(CachedXPathAPIHolder.getCachedXPathAPI());
- Document inputDoc = XMLUtils.getOwnerDocument(_inputSet);
+
Element []xpathElements =XMLUtils.selectNodes(
this._transformObject.getElement().getFirstChild(),
@@ -139,15 +109,12 @@
throw new TransformationException("xml.WrongContent", exArgs);
}
- if (true) {
- _filterTypes.add(FUnion);
-
- // Set root = new HashSet(); root.add(inputDoc);
- HelperNodeList root = new HelperNodeList();
-
- root.appendChild(inputDoc);
- _filterNodes.add(root);
- }
+ Document inputDoc = null;
+ if (input.getSubNode() != null) {
+ inputDoc = XMLUtils.getOwnerDocument(input.getSubNode());
+ } else {
+ inputDoc = XMLUtils.getOwnerDocument(input.getNodeSet());
+ }
for (int i = 0; i < noOfSteps; i++) {
Element xpathElement =XMLUtils.selectNode(
@@ -157,185 +124,97 @@
XPath2FilterContainer xpathContainer =
XPath2FilterContainer.newInstance(xpathElement,
input.getSourceURI());
-
- if (xpathContainer.isIntersect()) {
- _filterTypes.add(FIntersect);
- } else if (xpathContainer.isSubtract()) {
- _filterTypes.add(FSubtract);
- } else if (xpathContainer.isUnion()) {
- _filterTypes.add(FUnion);
- } else {
- _filterTypes.add(null);
- }
+
NodeList subtreeRoots = xPathFuncHereAPI.selectNodeList(inputDoc,
xpathContainer.getXPathFilterTextNode(),
CachedXPathFuncHereAPI.getStrFromNode(xpathContainer.getXPathFilterTextNode()),
xpathContainer.getElement());
-
- // _filterNodes.add(XMLUtils.convertNodelistToSet(subtreeRoots));
- _filterNodes.add(subtreeRoots);
- }
-
- this._F = new HashSet();
- this._ancestors = new ArrayList();
-
- this.traversal(inputDoc);
-
- Set resultSet = new HashSet();
- Iterator it = this._inputSet.iterator();
- while (it.hasNext()) {
- Object n = it.next();
- if (this._F.contains(n)) {
- resultSet.add(n);
- }
+ if (xpathContainer.isIntersect()) {
+ intersectNodes.add(subtreeRoots);
+ } else if (xpathContainer.isSubtract()) {
+ substractNodes.add(subtreeRoots);
+ } else if (xpathContainer.isUnion()) {
+ unionNodes.add(subtreeRoots);
+ }
}
- XMLSignatureInput result = new XMLSignatureInput(resultSet);
-
-
- result.setSourceURI(input.getSourceURI());
-
- return result;
+ input.setNeedsToBeExpanded(true);
+
+ input.addNodeFilter(new XPath2NodeFilter(unionNodes,substractNodes,intersectNodes));
+ input.setNodeSet(true);
+ return input;
} catch (TransformerException ex) {
throw new TransformationException("empty", ex);
} catch (DOMException ex) {
throw new TransformationException("empty", ex);
- } catch (IOException ex) {
- throw new TransformationException("empty", ex);
} catch (CanonicalizationException ex) {
throw new TransformationException("empty", ex);
} catch (InvalidCanonicalizerException ex) {
throw new TransformationException("empty", ex);
- } catch (ParserConfigurationException ex) {
- throw new TransformationException("empty", ex);
} catch (XMLSecurityException ex) {
throw new TransformationException("empty", ex);
} catch (SAXException ex) {
throw new TransformationException("empty", ex);
- }
+ } catch (IOException ex) {
+ throw new TransformationException("empty", ex);
+ } catch (ParserConfigurationException ex) {
+ throw new TransformationException("empty", ex);
+ }
}
+}
- /**
- * Method traversal
- *
- * @param currentNode
- */
- private void traversal(Node currentNode) {
-
- this._ancestors.add(currentNode);
-
- if (this._inputSet.contains(currentNode)) {
-
- int iMax = this._filterTypes.size();
- int i = 0;
-
- searchFirstUnionWhichContainsNode: for (i = iMax - 1; i >= 0; i--) {
- NodeList rootNodes = (NodeList) this._filterNodes.get(i);
- String type = (String) this._filterTypes.get(i);
-
- if ((type == FUnion)
- && rooted(/*currentNode,*/ this._ancestors, rootNodes)) {
-
- /*
- if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
- log.debug(i + " " + ((Element) currentNode).getTagName()
- + " is " + type + " of " + rootNode.getNodeName());
- }
- */
- break searchFirstUnionWhichContainsNode;
- }
- }
-
- int IStart = i;
-
- if (IStart == -1) {
- IStart = 0;
- }
+class XPath2NodeFilter implements NodeFilter {
+ XPath2NodeFilter(List unionNodes, List substractNodes,
+ List intersectNodes) {
+ this.unionNodes=unionNodes;
+ this.substractNodes=substractNodes;
+ this.intersectNodes=intersectNodes;
+ }
+ List unionNodes=new ArrayList();
+ List substractNodes=new ArrayList();
+ List intersectNodes=new ArrayList();
- boolean include = true;
- // search in the subsequent steps for
- for (int I = IStart; I < iMax; I++) {
- NodeList rootNodes = (NodeList) this._filterNodes.get(I);
- String type = (String) this._filterTypes.get(I);
- boolean rooted = rooted(/*currentNode,*/ this._ancestors, rootNodes);
-
- if ((type == FIntersect) &&!rooted) {
-
- /*
- if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
- log.debug("The intersect operation from step " + I
- + " does not include " + currentNode.getNodeName());
- }
- */
- include = false;
-
- break;
- } else if ((type == FSubtract) && rooted) {
-
- /*
- if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
- log.debug("The subtract operation from step " + I
- + " does subtract " + currentNode.getNodeName());
- }
- */
- include = false;
-
- break;
- } else {
- //do nothing
- }
- }
-
- if (include) {
- this._F.add(currentNode);
- }
- }
-
- {
-
- // here we do the traversal
- if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
- NamedNodeMap attributes = ((Element) currentNode).getAttributes();
- int attributesLength = attributes.getLength();
-
- for (int x = 0; x < attributesLength; x++) {
- Node attr = attributes.item(x);
-
- traversal(attr);
- }
- }
+ /**
+ * @see org.apache.xml.security.signature.NodeFilter#isNodeInclude(org.w3c.dom.Node)
+ */
+ public boolean isNodeInclude(Node currentNode) {
+ boolean notIncluded=false;
+ if (rooted(currentNode,substractNodes)) {
+ notIncluded=true;
+ } else if (!rooted(currentNode,intersectNodes)) {
+ notIncluded=true;
+ }
+ if (notIncluded && rooted(currentNode,unionNodes)) {
+ notIncluded=false;
+ }
- for (Node currentChild = currentNode.getFirstChild();
- currentChild != null;
- currentChild = currentChild.getNextSibling()) {
- traversal(currentChild);
- }
- }
+ return !notIncluded;
- this._ancestors.remove(currentNode);
}
/**
* Method rooted
+ * @param currentNode
+ * @param nodeList
*
- * @param ancestors
- * @param rootNodes
- * @return
+ * @return if rooted bye the rootnodes
*/
- boolean rooted(/*Node currentNode,*/ List ancestors, NodeList rootNodes) {
-
+ boolean rooted(Node currentNode, List nodeList ) {
+ for (int j=0;j<nodeList.size();j++) {
+ NodeList rootNodes=(NodeList) nodeList.get(j);
int length = rootNodes.getLength();
for (int i = 0; i < length; i++) {
Node rootNode = rootNodes.item(i);
- if (ancestors.contains(rootNode)) {
+ if (XMLUtils.isDescendantOrSelf(rootNode,currentNode)) {
return true;
}
}
-
- return false;
+
+ }
+ return false;
}
}
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/implementations/TransformXPointer.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/implementations/TransformXPointer.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/implementations/TransformXPointer.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/implementations/TransformXPointer.java Fri Jan 13 14:00:23 2006
@@ -38,16 +38,6 @@
public static final String implementedTransformURI =
Transforms.TRANSFORM_XPOINTER;
- //J-
- /** @inheritDoc */
- public boolean wantsOctetStream () { return false; }
- /** @inheritDoc */
- public boolean wantsNodeSet () { return true; }
- /** @inheritDoc */
- public boolean returnsOctetStream () { return false; }
- /** @inheritDoc */
- public boolean returnsNodeSet () { return true; }
- //J+
/** @inheritDoc */
protected String engineGetURI() {
@@ -58,7 +48,7 @@
* Method enginePerformTransform
*
* @param input
- * @return
+ * @return {@link XMLSignatureInput} as the result of transformation
* @throws TransformationException
*
*/
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/implementations/TransformXSLT.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/implementations/TransformXSLT.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/implementations/TransformXSLT.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/implementations/TransformXSLT.java Fri Jan 13 14:00:23 2006
@@ -59,16 +59,7 @@
static final String XSLTSpecNS = "http://www.w3.org/1999/XSL/Transform";
static final String defaultXSLTSpecNSprefix = "xslt";
static final String XSLTSTYLESHEET = "stylesheet";
-
- /** @inheritDoc */
- public boolean wantsOctetStream () { return false; }
- /** @inheritDoc */
- public boolean wantsNodeSet () { return true; }
- /** @inheritDoc */
- public boolean returnsOctetStream () { return true; }
- /** @inheritDoc */
- public boolean returnsNodeSet () { return true; }
- //J+
+
/**
* Method engineGetURI
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/params/XPath2FilterContainer.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/params/XPath2FilterContainer.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/params/XPath2FilterContainer.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/params/XPath2FilterContainer.java Fri Jan 13 14:00:23 2006
@@ -133,7 +133,7 @@
*
* @param doc
* @param xpath2filter
- * @return
+ * @return the filter.
*/
public static XPath2FilterContainer newInstanceIntersect(Document doc,
String xpath2filter) {
@@ -148,7 +148,7 @@
*
* @param doc
* @param xpath2filter
- * @return
+ * @return the filter.
*/
public static XPath2FilterContainer newInstanceSubtract(Document doc,
String xpath2filter) {
@@ -163,7 +163,7 @@
*
* @param doc
* @param xpath2filter
- * @return
+ * @return the filter
*/
public static XPath2FilterContainer newInstanceUnion(Document doc,
String xpath2filter) {
@@ -178,7 +178,7 @@
*
* @param doc
* @param params
- * @return
+ * @return the nodelist with the data
*/
public static NodeList newInstances(Document doc, String[][] params) {
@@ -214,7 +214,7 @@
*
* @param element
* @param BaseURI
- * @return
+ * @return the filter
*
* @throws XMLSecurityException
*/
@@ -293,7 +293,7 @@
/**
* Method getBaseLocalName
*
- * @return
+ * @return the XPATH2 tag
*/
public final String getBaseLocalName() {
return XPath2FilterContainer._TAG_XPATH2;
@@ -302,7 +302,7 @@
/**
* Method getBaseNamespace
*
- * @return
+ * @return XPATH2 tag namespace
*/
public final String getBaseNamespace() {
return XPath2FilterContainer.XPathFilter2NS;
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/params/XPath2FilterContainer04.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/params/XPath2FilterContainer04.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/params/XPath2FilterContainer04.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/params/XPath2FilterContainer04.java Fri Jan 13 14:00:23 2006
@@ -129,7 +129,7 @@
*
* @param doc
* @param xpath2filter
- * @return
+ * @return the instance
*/
public static XPath2FilterContainer04 newInstanceIntersect(Document doc,
String xpath2filter) {
@@ -144,7 +144,7 @@
*
* @param doc
* @param xpath2filter
- * @return
+ * @return the instance
*/
public static XPath2FilterContainer04 newInstanceSubtract(Document doc,
String xpath2filter) {
@@ -159,7 +159,7 @@
*
* @param doc
* @param xpath2filter
- * @return
+ * @return the instance
*/
public static XPath2FilterContainer04 newInstanceUnion(Document doc,
String xpath2filter) {
@@ -174,7 +174,7 @@
*
* @param element
* @param BaseURI
- * @return
+ * @return the instance
*
* @throws XMLSecurityException
*/
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/params/XPathFilterCHGPContainer.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/params/XPathFilterCHGPContainer.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/params/XPathFilterCHGPContainer.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/transforms/params/XPathFilterCHGPContainer.java Fri Jan 13 14:00:23 2006
@@ -136,7 +136,7 @@
* Method indentXPathText
*
* @param xp
- * @return
+ * @return the string with enters
*/
static String indentXPathText(String xp) {
@@ -213,7 +213,7 @@
/**
* Method getIncludeButSearch
*
- * @return
+ * @return the string
*/
public String getIncludeButSearch() {
return this.getXStr(XPathFilterCHGPContainer._TAG_INCLUDE_BUT_SEARCH);
@@ -222,7 +222,7 @@
/**
* Method getExcludeButSearch
*
- * @return
+ * @return the string
*/
public String getExcludeButSearch() {
return this.getXStr(XPathFilterCHGPContainer._TAG_EXCLUDE_BUT_SEARCH);
@@ -231,7 +231,7 @@
/**
* Method getExclude
*
- * @return
+ * @return the string
*/
public String getExclude() {
return this.getXStr(XPathFilterCHGPContainer._TAG_EXCLUDE);
@@ -240,7 +240,7 @@
/**
* Method getIncludeSlashPolicy
*
- * @return
+ * @return the string
*/
public boolean getIncludeSlashPolicy() {
@@ -271,7 +271,7 @@
/**
* Method getHereContextNodeIncludeButSearch
*
- * @return
+ * @return the string
*/
public Node getHereContextNodeIncludeButSearch() {
return this
@@ -281,7 +281,7 @@
/**
* Method getHereContextNodeExcludeButSearch
*
- * @return
+ * @return the string
*/
public Node getHereContextNodeExcludeButSearch() {
return this
@@ -291,7 +291,7 @@
/**
* Method getHereContextNodeExclude
*
- * @return
+ * @return the string
*/
public Node getHereContextNodeExclude() {
return this.getHereContextNode(XPathFilterCHGPContainer._TAG_EXCLUDE);
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/Base64.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/Base64.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/Base64.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/Base64.java Fri Jan 13 14:00:23 2006
@@ -19,7 +19,6 @@
import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -302,7 +301,7 @@
public static byte[] decode(BufferedReader reader)
throws IOException, Base64DecodingException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ UnsyncByteArrayOutputStream baos = new UnsyncByteArrayOutputStream();
String line;
while (null != (line = reader.readLine())) {
@@ -343,8 +342,7 @@
static private final int SIXTEENBIT = 16;
static private final int FOURBYTE = 4;
static private final int SIGN = -128;
- static private final char PAD = '=';
- static private final boolean fDebug = false;
+ static private final char PAD = '=';
static final private byte [] base64Alphabet = new byte[BASELENGTH];
static final private char [] lookUpBase64Alphabet = new char[LOOKUPLENGTH];
@@ -388,9 +386,6 @@
return (octect == PAD);
}
- protected static final boolean isData(byte octect) {
- return (base64Alphabet[octect] != -1);
- }
/**
* Encodes hex octects into Base64
@@ -434,9 +429,7 @@
int encodedIndex = 0;
int dataIndex = 0;
int i = 0;
- if (fDebug) {
- System.out.println("number of triplets = " + numberTriplets );
- }
+
for (int line = 0; line < numberLines; line++) {
for (int quartet = 0; quartet < 19; quartet++) {
@@ -444,9 +437,6 @@
b2 = binaryData[dataIndex++];
b3 = binaryData[dataIndex++];
- if (fDebug) {
- System.out.println( "b1= " + b1 +", b2= " + b2 + ", b3= " + b3 );
- }
l = (byte)(b2 & 0x0f);
k = (byte)(b1 & 0x03);
@@ -456,11 +446,6 @@
byte val2 = ((b2 & SIGN)==0)?(byte)(b2>>4):(byte)((b2)>>4^0xf0);
byte val3 = ((b3 & SIGN)==0)?(byte)(b3>>6):(byte)((b3)>>6^0xfc);
- if (fDebug) {
- System.out.println( "val2 = " + val2 );
- System.out.println( "k4 = " + (k<<4));
- System.out.println( "vak = " + (val2 | (k<<4)));
- }
encodedData[encodedIndex++] = lookUpBase64Alphabet[ val1 ];
encodedData[encodedIndex++] = lookUpBase64Alphabet[ val2 | ( k<<4 )];
@@ -477,9 +462,6 @@
b2 = binaryData[dataIndex++];
b3 = binaryData[dataIndex++];
- if (fDebug) {
- System.out.println( "b1= " + b1 +", b2= " + b2 + ", b3= " + b3 );
- }
l = (byte)(b2 & 0x0f);
k = (byte)(b1 & 0x03);
@@ -489,11 +471,6 @@
byte val2 = ((b2 & SIGN)==0)?(byte)(b2>>4):(byte)((b2)>>4^0xf0);
byte val3 = ((b3 & SIGN)==0)?(byte)(b3>>6):(byte)((b3)>>6^0xfc);
- if (fDebug) {
- System.out.println( "val2 = " + val2 );
- System.out.println( "k4 = " + (k<<4));
- System.out.println( "vak = " + (val2 | (k<<4)));
- }
encodedData[encodedIndex++] = lookUpBase64Alphabet[ val1 ];
encodedData[encodedIndex++] = lookUpBase64Alphabet[ val2 | ( k<<4 )];
@@ -505,11 +482,7 @@
if (fewerThan24bits == EIGHTBIT) {
b1 = binaryData[dataIndex];
k = (byte) ( b1 &0x03 );
- if (fDebug) {
- System.out.println("b1=" + b1);
- System.out.println("b1<<2 = " + (b1>>2) );
- }
- byte val1 = ((b1 & SIGN)==0)?(byte)(b1>>2):(byte)((b1)>>2^0xc0);
+ byte val1 = ((b1 & SIGN)==0)?(byte)(b1>>2):(byte)((b1)>>2^0xc0);
encodedData[encodedIndex++] = lookUpBase64Alphabet[ val1 ];
encodedData[encodedIndex++] = lookUpBase64Alphabet[ k<<4 ];
encodedData[encodedIndex++] = PAD;
@@ -553,7 +526,7 @@
int len = removeWhiteSpace(base64Data);
if (len%FOURBYTE != 0) {
- throw new Base64DecodingException("It should be dived by four");
+ throw new Base64DecodingException("decoding.divisible.four");
//should be divisible by four
}
@@ -564,7 +537,7 @@
byte decodedData[] = null;
byte b1=0,b2=0,b3=0, b4=0;
- byte d1=0,d2=0,d3=0,d4=0;
+
int i = 0;
int encodedIndex = 0;
@@ -574,25 +547,24 @@
dataIndex=(numberQuadruple-1)*4;
encodedIndex=(numberQuadruple-1)*3;
//first last bits.
- if (!isData( (d1 = base64Data[dataIndex++]) ) ||
- !isData( (d2 = base64Data[dataIndex++]) )) {
+ b1 = base64Alphabet[base64Data[dataIndex++]];
+ b2 = base64Alphabet[base64Data[dataIndex++]];
+ if ((b1==-1) || (b2==-1)) {
throw new Base64DecodingException("decoding.general");//if found "no data" just return null
}
- b1 = base64Alphabet[d1];
- b2 = base64Alphabet[d2];
-
- d3 = base64Data[dataIndex++];
- d4 = base64Data[dataIndex++];
- if (!isData( (d3 ) ) ||
- !isData( (d4 ) )) {//Check if they are PAD characters
+
+ byte d3,d4;
+ b3 = base64Alphabet[d3=base64Data[dataIndex++]];
+ b4 = base64Alphabet[d4=base64Data[dataIndex++]];
+ if ((b3==-1 ) || (b4==-1) ) {
+ //Check if they are PAD characters
if (isPad( d3 ) && isPad( d4)) { //Two PAD e.g. 3c[Pad][Pad]
if ((b2 & 0xf) != 0)//last 4 bits should be zero
throw new Base64DecodingException("decoding.general");
decodedData = new byte[ encodedIndex + 1 ];
decodedData[encodedIndex] = (byte)( b1 <<2 | b2>>4 ) ;
- } else if (!isPad( d3) && isPad(d4)) { //One PAD e.g. 3cQ[Pad]
- b3 = base64Alphabet[ d3 ];
+ } else if (!isPad( d3) && isPad(d4)) { //One PAD e.g. 3cQ[Pad]
if ((b3 & 0x3 ) != 0)//last 2 bits should be zero
throw new Base64DecodingException("decoding.general");
decodedData = new byte[ encodedIndex + 2 ];
@@ -604,8 +576,6 @@
} else {
//No PAD e.g 3cQl
decodedData = new byte[encodedIndex+3];
- b3 = base64Alphabet[ d3 ];
- b4 = base64Alphabet[ d4 ];
decodedData[encodedIndex++] = (byte)( b1 <<2 | b2>>4 ) ;
decodedData[encodedIndex++] = (byte)(((b2 & 0xf)<<4 ) |( (b3>>2) & 0xf) );
decodedData[encodedIndex++] = (byte)( b3<<6 | b4 );
@@ -613,19 +583,19 @@
encodedIndex=0;
dataIndex=0;
//the begin
- for (; i<numberQuadruple-1; i++) {
-
- if (!isData( (d1 = base64Data[dataIndex++]) )||
- !isData( (d2 = base64Data[dataIndex++]) )||
- !isData( (d3 = base64Data[dataIndex++]) )||
- !isData( (d4 = base64Data[dataIndex++]) ))
- throw new Base64DecodingException("decoding.general");//if found "no data" just return null
-
- b1 = base64Alphabet[d1];
- b2 = base64Alphabet[d2];
- b3 = base64Alphabet[d3];
- b4 = base64Alphabet[d4];
-
+ for (i=numberQuadruple-1; i>0; i--) {
+ b1 = base64Alphabet[base64Data[dataIndex++]];
+ b2 = base64Alphabet[base64Data[dataIndex++]];
+ b3 = base64Alphabet[base64Data[dataIndex++]];
+ b4 = base64Alphabet[base64Data[dataIndex++]];
+
+ if ( (b1==-1) ||
+ (b2==-1) ||
+ (b3==-1) ||
+ (b4==-1) ) {
+ throw new Base64DecodingException("decoding.general");//if found "no data" just return null
+ }
+
decodedData[encodedIndex++] = (byte)( b1 <<2 | b2>>4 ) ;
decodedData[encodedIndex++] = (byte)(((b2 & 0xf)<<4 ) |( (b3>>2) & 0xf) );
decodedData[encodedIndex++] = (byte)( b3<<6 | b4 );
@@ -642,12 +612,12 @@
* @throws Base64DecodingException
*/
public final static void decode(byte[] base64Data,
- OutputStream os) throws Base64DecodingException, IOException {
+ OutputStream os) throws Base64DecodingException, IOException {
// remove white spaces
int len = removeWhiteSpace(base64Data);
if (len%FOURBYTE != 0) {
- throw new Base64DecodingException("It should be dived by four");
+ throw new Base64DecodingException("decoding.divisible.four");
//should be divisible by four
}
@@ -658,49 +628,48 @@
//byte decodedData[] = null;
byte b1=0,b2=0,b3=0, b4=0;
- byte d1=0,d2=0,d3=0,d4=0;
int i = 0;
int dataIndex = 0;
//the begin
- for (; i<numberQuadruple-1; i++) {
-
- if (!isData( (d1 = base64Data[dataIndex++]) )||
- !isData( (d2 = base64Data[dataIndex++]) )||
- !isData( (d3 = base64Data[dataIndex++]) )||
- !isData( (d4 = base64Data[dataIndex++]) ))
+ for (i=numberQuadruple-1; i>0; i--) {
+ b1 = base64Alphabet[base64Data[dataIndex++]];
+ b2 = base64Alphabet[base64Data[dataIndex++]];
+ b3 = base64Alphabet[base64Data[dataIndex++]];
+ b4 = base64Alphabet[base64Data[dataIndex++]];
+ if ( (b1==-1) ||
+ (b2==-1) ||
+ (b3==-1) ||
+ (b4==-1) )
throw new Base64DecodingException("decoding.general");//if found "no data" just return null
- b1 = base64Alphabet[d1];
- b2 = base64Alphabet[d2];
- b3 = base64Alphabet[d3];
- b4 = base64Alphabet[d4];
+
os.write((byte)( b1 <<2 | b2>>4 ) );
os.write((byte)(((b2 & 0xf)<<4 ) |( (b3>>2) & 0xf) ));
os.write( (byte)( b3<<6 | b4 ));
- }
-// first last bits.
- if (!isData( (d1 = base64Data[dataIndex++]) ) ||
- !isData( (d2 = base64Data[dataIndex++]) )) {
+ }
+ b1 = base64Alphabet[base64Data[dataIndex++]];
+ b2 = base64Alphabet[base64Data[dataIndex++]];
+
+ // first last bits.
+ if ((b1==-1) ||
+ (b2==-1) ){
throw new Base64DecodingException("decoding.general");//if found "no data" just return null
}
- b1 = base64Alphabet[d1];
- b2 = base64Alphabet[d2];
-
- d3 = base64Data[dataIndex++];
- d4 = base64Data[dataIndex++];
- if (!isData( (d3 ) ) ||
- !isData( (d4 ) )) {//Check if they are PAD characters
+ byte d3,d4;
+ b3= base64Alphabet[d3 = base64Data[dataIndex++]];
+ b4= base64Alphabet[d4 = base64Data[dataIndex++]];
+ if ((b3==-1 ) ||
+ (b4==-1) ) {//Check if they are PAD characters
if (isPad( d3 ) && isPad( d4)) { //Two PAD e.g. 3c[Pad][Pad]
if ((b2 & 0xf) != 0)//last 4 bits should be zero
throw new Base64DecodingException("decoding.general");
os.write( (byte)( b1 <<2 | b2>>4 ) );
- } else if (!isPad( d3) && isPad(d4)) { //One PAD e.g. 3cQ[Pad]
- b3 = base64Alphabet[ d3 ];
+ } else if (!isPad( d3) && isPad(d4)) { //One PAD e.g. 3cQ[Pad]
if ((b3 & 0x3 ) != 0)//last 2 bits should be zero
throw new Base64DecodingException("decoding.general");
os.write( (byte)( b1 <<2 | b2>>4 ));
@@ -710,8 +679,6 @@
}
} else {
//No PAD e.g 3cQl
- b3 = base64Alphabet[ d3 ];
- b4 = base64Alphabet[ d4 ];
os.write((byte)( b1 <<2 | b2>>4 ) );
os.write( (byte)(((b2 & 0xf)<<4 ) |( (b3>>2) & 0xf) ));
os.write((byte)( b3<<6 | b4 ));
@@ -729,11 +696,7 @@
*/
public final static void decode(InputStream is,
OutputStream os) throws Base64DecodingException, IOException {
- // remove white spaces
-
-
-
- //byte decodedData[] = null;
+ //byte decodedData[] = null;
byte b1=0,b2=0,b3=0, b4=0;
int index=0;
@@ -751,11 +714,11 @@
data[index++]=(byte)is.read();
break;
}
- if (!isData(readed)) {
- throw new Base64DecodingException("decoding.general");//if found "no data" just return null
- }
- data[index++]=readed;
+
+ if ((data[index++]=readed)==-1) {
+ throw new Base64DecodingException("decoding.general");//if found "no data" just return null
+ }
if (index!=4) {
continue;
@@ -775,8 +738,10 @@
byte d1=data[0],d2=data[1],d3=data[2], d4=data[3];
b1 = base64Alphabet[d1];
b2 = base64Alphabet[d2];
- if (!isData( (d3 ) ) ||
- !isData( (d4 ) )) {//Check if they are PAD characters
+ b3 = base64Alphabet[ d3 ];
+ b4 = base64Alphabet[ d4 ];
+ if ((b3==-1 ) ||
+ (b4==-1) ) {//Check if they are PAD characters
if (isPad( d3 ) && isPad( d4)) { //Two PAD e.g. 3c[Pad][Pad]
if ((b2 & 0xf) != 0)//last 4 bits should be zero
throw new Base64DecodingException("decoding.general");
@@ -792,8 +757,7 @@
}
} else {
//No PAD e.g 3cQl
- b3 = base64Alphabet[ d3 ];
- b4 = base64Alphabet[ d4 ];
+
os.write((byte)( b1 <<2 | b2>>4 ) );
os.write( (byte)(((b2 & 0xf)<<4 ) |( (b3>>2) & 0xf) ));
os.write((byte)( b3<<6 | b4 ));
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/CachedXPathAPIHolder.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/CachedXPathAPIHolder.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/CachedXPathAPIHolder.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/CachedXPathAPIHolder.java Fri Jan 13 14:00:23 2006
@@ -24,9 +24,16 @@
* @author Raul Benito
*/
public class CachedXPathAPIHolder {
+ static org.apache.commons.logging.Log log =
+ org.apache.commons.logging.LogFactory.getLog(CachedXPathAPIHolder.class.getName());
+
static ThreadLocal local=new ThreadLocal();
static ThreadLocal localDoc=new ThreadLocal();
+ /**
+ * Sets the doc for the xpath transformation. Resets the cache if needed
+ * @param doc
+ */
public static void setDoc(Document doc) {
if (localDoc.get()!=doc) {
CachedXPathAPI cx=(CachedXPathAPI)local.get();
@@ -42,7 +49,7 @@
}
}
/**
- * @return
+ * @return the cachexpathapi for this thread
*/
public static CachedXPathAPI getCachedXPathAPI() {
CachedXPathAPI cx=(CachedXPathAPI)local.get();
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/CachedXPathFuncHereAPI.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/CachedXPathFuncHereAPI.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/CachedXPathFuncHereAPI.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/CachedXPathFuncHereAPI.java Fri Jan 13 14:00:23 2006
@@ -18,30 +18,35 @@
-import javax.xml.transform.TransformerException;
-
import org.apache.xml.dtm.DTMManager;
+import org.apache.xml.security.transforms.implementations.FuncHere;
import org.apache.xml.security.transforms.implementations.FuncHereContext;
import org.apache.xml.utils.PrefixResolver;
import org.apache.xml.utils.PrefixResolverDefault;
import org.apache.xpath.CachedXPathAPI;
+import org.apache.xpath.Expression;
import org.apache.xpath.XPath;
import org.apache.xpath.XPathContext;
+import org.apache.xpath.compiler.FunctionTable;
import org.apache.xpath.objects.XObject;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.ProcessingInstruction;
-import org.w3c.dom.Text;
+import org.w3c.dom.*;
import org.w3c.dom.traversal.NodeIterator;
+import javax.xml.transform.ErrorListener;
+import javax.xml.transform.SourceLocator;
+import javax.xml.transform.TransformerException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
/**
*
* @author $Author$
*/
public class CachedXPathFuncHereAPI {
+ static org.apache.commons.logging.Log log =
+ org.apache.commons.logging.LogFactory.getLog(CachedXPathFuncHereAPI.class.getName());
/**
* XPathContext, and thus DTMManager and DTMs, persists through multiple
* calls to this object.
@@ -50,16 +55,22 @@
/** Field _dtmManager */
DTMManager _dtmManager = null;
-
+
XPathContext _context = null;
-
+
String xpathStr=null;
-
+
XPath xpath=null;
+ static FunctionTable _funcTable = null;
+
+ static {
+ fixupFunctionTable();
+ }
+
/**
* Method getFuncHereContext
- * @return
+ * @return the context for this object
*
*/
public FuncHereContext getFuncHereContext() {
@@ -87,7 +98,7 @@
*
* @param previouslyUsed
*/
- public CachedXPathFuncHereAPI(CachedXPathAPI previouslyUsed) {
+ public CachedXPathFuncHereAPI(CachedXPathAPI previouslyUsed) {
this._dtmManager = previouslyUsed.getXPathContext().getDTMManager();
this._context=previouslyUsed.getXPathContext();
}
@@ -254,7 +265,7 @@
throws TransformerException {
// Create the XPath object.
//String str = CachedXPathFuncHereAPI.getStrFromNode(xpathnode);
-
+
// Since we don't have a XML Parser involved here, install some default support
// for things like namespaces, etc.
// (Changed from: XPathContext xpathSupport = new XPathContext();
@@ -281,7 +292,7 @@
_context.reset();
_dtmManager=_context.getDTMManager();
}
- xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
+ xpath = createXPath(str, prefixResolver);
xpathStr=str;
}
@@ -326,18 +337,18 @@
// Create the XPath object.
//String str = CachedXPathFuncHereAPI.getStrFromNode(xpathnode);
if (str!=xpathStr) {
- if (str.indexOf("here()")>0) {
- _context.reset();
- _dtmManager=_context.getDTMManager();
- }
+ if (str.indexOf("here()")>0) {
+ _context.reset();
+ _dtmManager=_context.getDTMManager();
+ }
try {
- xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
+ xpath = createXPath(str, prefixResolver);
} catch (TransformerException ex) {
//Try to see if it is a problem with the classloader.
- Throwable th= ex.getCause();
+ Throwable th= ex.getCause();
if (th instanceof ClassNotFoundException) {
if (th.getMessage().indexOf("FuncHere")>0) {
- throw new RuntimeException(I18n.translate("endorsed.jdk1.4.0")/*,*/+ex);
+ throw new RuntimeException(I18n.translate("endorsed.jdk1.4.0")/*,*/+ex);
}
}
throw ex;
@@ -356,35 +367,91 @@
return xpath.execute(this._funcHereContext, ctxtNode, prefixResolver);
}
- /**
- * Method getStrFromNode
- *
- * @param xpathnode
- * @return
- */
- public static String getStrFromNode(Node xpathnode) {
+ private XPath createXPath(String str, PrefixResolver prefixResolver) throws TransformerException {
+ XPath xpath = null;
+ Class[] classes = new Class[]{String.class, SourceLocator.class, PrefixResolver.class, int.class,
+ ErrorListener.class, FunctionTable.class};
+ Object[] objects = new Object[]{str, null, prefixResolver, new Integer(XPath.SELECT), null, _funcTable};
+ try {
+ Constructor constructor = XPath.class.getConstructor(classes);
+ xpath = (XPath) constructor.newInstance(objects);
+ } catch (Throwable t) {
+ }
+ if (xpath == null) {
+ xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
+ }
+ return xpath;
+ }
- if (xpathnode.getNodeType() == Node.TEXT_NODE) {
+ /**
+ * Method getStrFromNode
+ *
+ * @param xpathnode
+ * @return the string for the node.
+ */
+ public static String getStrFromNode(Node xpathnode) {
+
+ if (xpathnode.getNodeType() == Node.TEXT_NODE) {
+
+ // we iterate over all siblings of the context node because eventually,
+ // the text is "polluted" with pi's or comments
+ StringBuffer sb = new StringBuffer();
+
+ for (Node currentSibling = xpathnode.getParentNode().getFirstChild();
+ currentSibling != null;
+ currentSibling = currentSibling.getNextSibling()) {
+ if (currentSibling.getNodeType() == Node.TEXT_NODE) {
+ sb.append(((Text) currentSibling).getData());
+ }
+ }
+
+ return sb.toString();
+ } else if (xpathnode.getNodeType() == Node.ATTRIBUTE_NODE) {
+ return ((Attr) xpathnode).getNodeValue();
+ } else if (xpathnode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
+ return ((ProcessingInstruction) xpathnode).getNodeValue();
+ }
- // we iterate over all siblings of the context node because eventually,
- // the text is "polluted" with pi's or comments
- StringBuffer sb = new StringBuffer();
+ return null;
+ }
- for (Node currentSibling = xpathnode.getParentNode().getFirstChild();
- currentSibling != null;
- currentSibling = currentSibling.getNextSibling()) {
- if (currentSibling.getNodeType() == Node.TEXT_NODE) {
- sb.append(((Text) currentSibling).getData());
+ private static void fixupFunctionTable() {
+ boolean installed = false;
+ log.info("Registering Here function");
+ /**
+ * Try to register our here() implementation as internal function.
+ */
+ try {
+ Class []args = {String.class, Expression.class};
+ Method installFunction = FunctionTable.class.getMethod("installFunction", args);
+ if ((installFunction.getModifiers() & Modifier.STATIC) != 0) {
+ Object []params = {"here", new FuncHere()};
+ installFunction.invoke(null, params);
+ installed = true;
}
- }
-
- return sb.toString();
- } else if (xpathnode.getNodeType() == Node.ATTRIBUTE_NODE) {
- return ((Attr) xpathnode).getNodeValue();
- } else if (xpathnode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
- return ((ProcessingInstruction) xpathnode).getNodeValue();
- }
-
- return null;
- }
+ } catch (Throwable t) {
+ log.debug("Error installing function using the static installFunction method", t);
+ }
+ if(!installed) {
+ try {
+ _funcTable = new FunctionTable();
+ Class []args = {String.class, Class.class};
+ Method installFunction = FunctionTable.class.getMethod("installFunction", args);
+ Object []params = {"here", FuncHere.class};
+ installFunction.invoke(_funcTable, params);
+ installed = true;
+ } catch (Throwable t) {
+ log.debug("Error installing function using the static installFunction method", t);
+ }
+ }
+ if (log.isDebugEnabled()) {
+ if (installed) {
+ log.debug("Registered class " + FuncHere.class.getName()
+ + " for XPath function 'here()' function in internal table");
+ } else {
+ log.debug("Unable to register class " + FuncHere.class.getName()
+ + " for XPath function 'here()' function in internal table");
+ }
+ }
+ }
}
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/DigesterOutputStream.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/DigesterOutputStream.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/DigesterOutputStream.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/DigesterOutputStream.java Fri Jan 13 14:00:23 2006
@@ -36,13 +36,11 @@
/** @inheritDoc */
public byte[] toByteArray() {
- // TODO Auto-generated method stub
return none;
}
/** @inheritDoc */
public void write(byte[] arg0) {
- // TODO Auto-generated method stub
mda.update(arg0);
}
@@ -53,7 +51,6 @@
/** @inheritDoc */
public void write(byte[] arg0, int arg1, int arg2) {
- // TODO Auto-generated method stub
mda.update(arg0, arg1, arg2);
}
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/ElementProxy.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/ElementProxy.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/ElementProxy.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/ElementProxy.java Fri Jan 13 14:00:23 2006
@@ -113,9 +113,36 @@
this._doc = doc;
this._state = ElementProxy.MODE_CREATE;
- this._constructionElement = ElementProxy.createElementForFamily(this._doc,
+ this._constructionElement = createElementForFamilyLocal(this._doc,
this.getBaseNamespace(), this.getBaseLocalName());
}
+ String tagName=null;
+ String prefix=ElementProxy.getDefaultPrefix(this.getBaseNamespace());
+ String defaultPrefixNaming=ElementProxy.getDefaultPrefixBindings(this.getBaseNamespace());
+ private Element createElementForFamilyLocal(Document doc, String namespace,
+ String localName) {
+ Element result = null;
+ if (namespace == null) {
+ result = doc.createElementNS(null, localName);
+ } else {
+ if ((prefix == null) || (prefix.length() == 0)) {
+ result = doc.createElementNS(namespace, localName);
+
+ result.setAttributeNS(Constants.NamespaceSpecNS, "xmlns",
+ namespace);
+ } else {
+ if (tagName==null) {
+ tagName=prefix + ":" + localName;
+ }
+ result = doc.createElementNS(namespace, tagName );
+
+ result.setAttributeNS(Constants.NamespaceSpecNS, defaultPrefixNaming,
+ namespace);
+ }
+ }
+ return result;
+}
+
/**
* This method creates an Element in a given namespace with a given localname.
@@ -146,7 +173,7 @@
} else {
result = doc.createElementNS(namespace, prefix + ":" + localName);
- result.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:" + prefix,
+ result.setAttributeNS(Constants.NamespaceSpecNS, ElementProxy.getDefaultPrefixBindings(namespace),
namespace);
}
}
@@ -167,8 +194,6 @@
if (element == null) {
throw new XMLSecurityException("ElementProxy.nullElement");
}
- if (log.isDebugEnabled()) {
- }
if (log.isDebugEnabled()) {
log.debug("setElement(" + element.getTagName() + ", \"" + BaseURI + "\"");
@@ -265,8 +290,8 @@
String localnameIS = this._constructionElement.getLocalName();
String namespaceIS = this._constructionElement.getNamespaceURI();
- if ( !localnameSHOULDBE.equals(localnameIS) ||
- !namespaceSHOULDBE.equals(namespaceSHOULDBE)) {
+ if ((namespaceSHOULDBE!=namespaceIS) ||
+ !localnameSHOULDBE.equals(localnameIS) ) {
Object exArgs[] = { namespaceIS +":"+ localnameIS,
namespaceSHOULDBE +":"+ localnameSHOULDBE};
throw new XMLSecurityException("xml.WrongElement", exArgs);
@@ -371,7 +396,7 @@
/**
* Method getBytesFromChildElement
- *
+ * @deprecated
* @param localname
* @param namespace
* @return the bytes
@@ -447,7 +472,7 @@
while (sibling!=null) {
if (localname.equals(sibling.getLocalName())
&&
- namespace.equals(sibling.getNamespaceURI())) {
+ namespace!=sibling.getNamespaceURI() ) {
number++;
}
sibling=sibling.getNextSibling();
@@ -505,6 +530,7 @@
/** Field _prefixMappings */
static HashMap _prefixMappings = new HashMap();
+ static HashMap _prefixMappingsBindings = new HashMap();
/**
* Method setDefaultPrefix
@@ -525,7 +551,8 @@
throw new XMLSecurityException("prefix.AlreadyAssigned", exArgs);
}
}
- ElementProxy._prefixMappings.put(namespace, prefix);
+ ElementProxy._prefixMappings.put(namespace, prefix.intern());
+ ElementProxy._prefixMappingsBindings.put(namespace, ("xmlns:"+prefix).intern());
}
/**
@@ -540,4 +567,10 @@
return prefix;
}
+ public static String getDefaultPrefixBindings(String namespace) {
+
+ String prefix = (String) ElementProxy._prefixMappingsBindings.get(namespace);
+
+ return prefix;
+ }
}
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/EncryptionConstants.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/EncryptionConstants.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/EncryptionConstants.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/EncryptionConstants.java Fri Jan 13 14:00:23 2006
@@ -167,7 +167,7 @@
/**
* Method getEncryptionSpecNSprefix
*
- * @return
+ * @return the prefix for this node.
*/
public static String getEncryptionSpecNSprefix() {
return ElementProxy
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/HelperNodeList.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/HelperNodeList.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/HelperNodeList.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/HelperNodeList.java Fri Jan 13 14:00:23 2006
@@ -62,7 +62,7 @@
* Method item
*
* @param index
- * @return
+ * @return node with inde i
*/
public Node item(int index) {
@@ -74,7 +74,7 @@
/**
* Method getLength
*
- * @return
+ * @return length of the list
*/
public int getLength() {
return nodes.size();
@@ -96,7 +96,7 @@
}
/**
- * @return
+ * @return the document that contains this nodelist
*/
public Document getOwnerDocument() {
if (this.getLength() == 0) {
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/I18n.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/I18n.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/I18n.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/I18n.java Fri Jan 13 14:00:23 2006
@@ -75,7 +75,7 @@
*
* @param message
* @param args is an <CODE>Object[]</CODE> array of strings which are inserted into the String which is retrieved from the <CODE>ResouceBundle</CODE>
- * @return
+ * @return message translated
*/
public static String translate(String message, Object[] args) {
return getExceptionMessage(message, args);
@@ -88,7 +88,7 @@
* <CODE>XMLSecurityException.getExceptionMEssage()</CODE>
*
* @param message
- * @return
+ * @return message translated
*/
public static String translate(String message) {
return getExceptionMessage(message);
@@ -98,7 +98,7 @@
* Method getExceptionMessage
*
* @param msgID
- * @return
+ * @return message translated
*
*/
public static String getExceptionMessage(String msgID) {
@@ -122,7 +122,7 @@
*
* @param msgID
* @param originalException
- * @return
+ * @return message translated
*/
public static String getExceptionMessage(String msgID,
Exception originalException) {
@@ -151,7 +151,7 @@
*
* @param msgID
* @param exArgs
- * @return
+ * @return message translated
*/
public static String getExceptionMessage(String msgID, Object exArgs[]) {
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/IdResolver.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/IdResolver.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/IdResolver.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/IdResolver.java Fri Jan 13 14:00:23 2006
@@ -18,13 +18,13 @@
-import javax.xml.transform.TransformerException;
-import org.apache.xpath.CachedXPathAPI;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import java.util.Arrays;
import java.util.WeakHashMap;
import java.lang.ref.WeakReference;
@@ -119,73 +119,17 @@
}
// this must be done so that Xalan can catch ALL namespaces
//XMLUtils.circumventBug2650(doc);
- CachedXPathAPIHolder.setDoc(doc);
- CachedXPathAPI cx=CachedXPathAPIHolder.getCachedXPathAPI();//cxHolder.getCachedXPathAPI();
- result = IdResolver.getElementByIdInDSNamespace(doc, id,cx);
+ result = IdResolver.getElementBySearching(doc, id);
if (result != null) {
- log.debug(
- "Found an Element using an insecure Id/ID/id search method: "
- + result.getTagName());
-
- // register the ID to speed up further queries on that ID
- IdResolver.registerElementById(result, id);
+ IdResolver.registerElementById(result, id);
return result;
}
- result = IdResolver.getElementByIdInXENCNamespace(doc, id,cx);
-
- if (result != null) {
- log.debug(
- "I could find an Element using the advanced xenc:Namespace searcher method: "
- + result.getTagName());
-
- // register the ID to speed up further queries on that ID
- IdResolver.registerElementById(result, id);
-
- return result;
- }
-
- result = IdResolver.getElementByIdInSOAPSignatureNamespace(doc, id,cx);
-
- if (result != null) {
- log.debug(
- "I could find an Element using the advanced SOAP-SEC:id searcher method: "
- + result.getTagName());
-
- // register the ID to speed up further queries on that ID
- IdResolver.registerElementById(result, id);
-
- return result;
- }
-
- result = IdResolver.getElementByIdInXKMSNamespace(doc, id,cx);
-
- if (result != null) {
- log.debug("I could find an Element using the XKMS searcher method: "
- + result.getTagName());
-
- // register the ID to speed up further queries on that ID
- IdResolver.registerElementById(result, id);
-
- return result;
- }
-
- result = IdResolver.getElementByIdUnsafeMatchByIdName(doc, id,cx);
-
- if (result != null) {
- log.warn(
- "Found an Element using an insecure Id/ID/id search method: "
- + result.getTagName());
-
- // Don't register the ID, we're not sure
- return result;
- }
-
return null;
}
-
+
/**
* Method getElementByIdUsingDOM
@@ -221,195 +165,69 @@
return null;
}
- /**
- * Method getElementByIdInDSNamespace
- *
- * @param doc
- * @param id
- * @param cx
- * @return the element obtained by the Id, or null if it is not found.
- */
- private static Element getElementByIdInDSNamespace(Document doc, String id
- ,CachedXPathAPI cx) {
- if (log.isDebugEnabled())
- log.debug("getElementByIdInDSNamespace() Search for ID " + id);
-
- try {
- Element nscontext = XMLUtils.createDSctx(doc, "ds",
- Constants.SignatureSpecNS);
- Element element = (Element) cx.selectSingleNode(doc,
- "//ds:*[@Id='" + id + "']", nscontext);
-
- return element;
-
- /*
- NodeList dsElements = XPathAPI.selectNodeList(doc, "//ds:*",
- nscontext);
-
- log.debug("Found ds:Elements: " + dsElements.getLength());
-
- for (int i = 0; i < dsElements.getLength(); i++) {
- Element currentElem = (Element) dsElements.item(i);
- Attr IdAttr = currentElem.getAttributeNode(Constants._ATT_ID);
-
- if (IdAttr != null) {
- if (IdAttr.getNodeValue().equals(id)) {
- return currentElem;
- }
- }
- }
- */
- } catch (TransformerException ex) {
- log.fatal("empty", ex);
- }
-
- return null;
- }
-
- /**
- * Method getElementByIdInXENCNamespace
- *
- * @param doc
- * @param id
- * @param cx
- * @return the element obtained by the Id, or null if it is not found.
- */
- private static Element getElementByIdInXENCNamespace(Document doc,
- String id, CachedXPathAPI cx) {
- if (log.isDebugEnabled())
- log.debug("getElementByIdInXENCNamespace() Search for ID " + id);
-
- try {
- Element nscontext =
- XMLUtils.createDSctx(doc, "xenc",
- org.apache.xml.security.utils
- .EncryptionConstants.EncryptionSpecNS);
- Element element = (Element) cx.selectSingleNode(doc,
- "//xenc:*[@Id='" + id + "']", nscontext);
-
- return element;
- } catch (TransformerException ex) {
- log.fatal("empty", ex);
- }
-
- return null;
+
+ static java.util.List names;
+ static {
+ String namespaces[]={ Constants.SignatureSpecNS,
+ EncryptionConstants.EncryptionSpecNS,
+ "http://schemas.xmlsoap.org/soap/security/2000-12",
+ "http://www.w3.org/2002/03/xkms#"
+ };
+ names=Arrays.asList(namespaces);
+ }
+
+
+ private static Element getElementBySearching(Node root,String id) {
+ Element []els=new Element[5];
+ getElementBySearching(root,id,els);
+ for (int i=0;i<els.length;i++) {
+ if (els[i]!=null) {
+ return els[i];
+ }
+ }
+ return null;
+
+ }
+ private static int getElementBySearching(Node root,String id,Element []els) {
+ switch (root.getNodeType()) {
+ case Node.ELEMENT_NODE:
+ Element el=(Element)root;
+ if (el.hasAttributes()) {
+ int index=names.indexOf(el.getNamespaceURI());
+ if (index<0) {
+ index=4;
+ }
+ if (el.getAttribute("Id").equals(id)) {
+ els[index]=el;
+ if (index==0) {
+ return 1;
+ }
+ } else if ( el.getAttribute("id").equals(id) ) {
+ if (index!=2) {
+ index=4;
+ }
+ els[index]=el;
+ } else if ( el.getAttribute("ID").equals(id) ) {
+ if (index!=3) {
+ index=4;
+ }
+ els[index]=el;
+ } else if ((index==3)&&(
+ el.getAttribute("OriginalRequestID").equals(id) ||
+ el.getAttribute("RequestID").equals(id) ||
+ el.getAttribute("ResponseID" ).equals(id))) {
+ els[3]=el;
+ }
+ }
+ case Node.DOCUMENT_NODE:
+ Node sibling=root.getFirstChild();
+ while (sibling!=null) {
+ if (getElementBySearching(sibling,id,els)==1)
+ return 1;
+ sibling=sibling.getNextSibling();
+ }
+ }
+ return 0;
}
- /**
- * Method getElementByIdInSOAPSignatureNamespace
- *
- * @param doc
- * @param id
- * @param cx
- * @return the element obtained by the Id, or null if it is not found.
- */
- private static Element getElementByIdInSOAPSignatureNamespace(Document doc,
- String id, CachedXPathAPI cx) {
- if (log.isDebugEnabled())
- log.debug("getElementByIdInSOAPSignatureNamespace() Search for ID " + id);
-
- try {
- Element nscontext = XMLUtils.createDSctx(
- doc, "SOAP-SEC",
- "http://schemas.xmlsoap.org/soap/security/2000-12");
- Element element = (Element) cx.selectSingleNode(doc,
- "//*[@SOAP-SEC:id='" + id + "']", nscontext);
-
- return element;
- } catch (TransformerException ex) {
- log.fatal("empty", ex);
- }
-
- return null;
- }
-
- /**
- * Method getElementByIdInXKMSNamespace
- *
- * @param doc
- * @param id
- * @param cx
- * @return the element obtained by the Id, or null if it is not found.
- * @see <a href="http://www.w3c.org/2001/XKMS/Drafts/XKMS-20020410">XKMS</a>
- */
- private static Element getElementByIdInXKMSNamespace(Document doc,
- String id, CachedXPathAPI cx) {
-
- /*
- xmlns:xkms="http://www.w3.org/2002/03/xkms#"
-
- <attribute name="ID" type="ID" use="optional"/>
- <attribute name="OriginalRequestID" type="ID" use="optional"/>
- <attribute name="RequestID" type="ID" use="optional"/>
- <attribute name="ResponseID" type="ID" use="required"/>
- */
- if (log.isDebugEnabled())
- log.debug("getElementByIdInXKMSNamespace() Search for ID " + id);
-
- try {
- Element nscontext =
- XMLUtils.createDSctx(doc, "xkms",
- "http://www.w3.org/2002/03/xkms#");
- String[] attrs = { "ID", "OriginalRequestID", "RequestID",
- "ResponseID" };
-
- for (int i = 0; i < attrs.length; i++) {
- String attr = attrs[i];
- Element element = (Element) cx.selectSingleNode(doc,
- "//xkms:*[@" + attr + "='" + id + "']",
- nscontext);
-
- if (element != null) {
- return element;
- }
- }
-
- return null;
- } catch (TransformerException ex) {
- log.fatal("empty", ex);
- }
-
- return null;
- }
-
- /**
- * Method getElementByIdUnsafeMatchByIdName
- *
- * @param doc
- * @param id
- * @param cx
- * @return the element obtained by the Id, or null if it is not found.
- */
- private static Element getElementByIdUnsafeMatchByIdName(Document doc,
- String id, CachedXPathAPI cx) {
- if (log.isDebugEnabled())
- log.debug("getElementByIdUnsafeMatchByIdName() Search for ID " + id);
-
- try {
- Element element_Id = (Element) cx.selectSingleNode(doc,
- "//*[@Id='" + id + "']");
-
- if (element_Id != null) {
- return element_Id;
- }
-
- Element element_ID = (Element) cx.selectSingleNode(doc,
- "//*[@ID='" + id + "']");
-
- if (element_ID != null) {
- return element_ID;
- }
-
- Element element_id = (Element) cx.selectSingleNode(doc,
- "//*[@id='" + id + "']");
-
- if (element_id != null) {
- return element_id;
- }
- } catch (TransformerException ex) {
- log.fatal("empty", ex);
- }
-
- return null;
- }
}
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/JavaUtils.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/JavaUtils.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/JavaUtils.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/JavaUtils.java Fri Jan 13 14:00:23 2006
@@ -18,14 +18,12 @@
-import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Vector;
/**
@@ -42,148 +40,11 @@
private JavaUtils() {
// we don't allow instantiation
}
-
- /**
- * Checks whether an object implements a specific interface.
- *
- * <pre>
- * org.w3c.dom.Document doc = ...; // some init
- *
- * boolean this_is_true =
- * JavaUtils.implementsInterface(doc.getDocumentElement(),
- * "org.w3c.dom.Element");
- *
- * boolean this_is_true_too =
- * JavaUtils.implementsInterface(doc.getDocumentElement(),
- * "org.w3c.dom.Node");
- *
- * </pre>
- *
- * @param object which is to be checked
- * @param interfaceName is the String of the Interface
- * @return <code>true</code> if the object implements the specified interface
- */
- public static boolean implementsInterface(Object object,
- String interfaceName) {
-
- Vector allClasses = new Vector();
- Vector allInterfaces = new Vector();
- Class c = object.getClass();
-
- while (!c.getName().equals("java.lang.Object")) {
- Class interfaces[] = c.getInterfaces();
- String className = c.getName();
-
- allClasses.add(className);
-
- for (int i = 0; i < interfaces.length; i++) {
- String ifName = interfaces[i].getName();
-
- allInterfaces.add(ifName);
- }
-
- c = c.getSuperclass();
- }
-
- for (int i = 0; i < allInterfaces.size(); i++) {
- if (((String) allInterfaces.get(i)).equals(interfaceName)) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- *
- * @param object
- * @param className
- * @return
- */
- public static boolean instanceOf(Object object, String className) {
-
- if (object.getClass().getName().equals(className)) {
- return true;
- }
-
- return implementsInterface(object, className);
- }
-
- /**
- * Returns true if both byte arrays are bytewise equal, false if the differ.
- *
- * @param refBytes
- * @param c14nBytes
- * @return true if both byte arrays are bytewise equal, false if the differ.
- * @see java.security.MessageDigest#isEqual
- */
- public static boolean binaryCompare(byte refBytes[], byte c14nBytes[]) {
-
- /*
- {
- if (refBytes.length != c14nBytes.length) {
- return false;
- }
-
- for (int i = 0; i < refBytes.length; i++) {
- if (refBytes[i] != c14nBytes[i]) {
- return false;
- }
- }
- }
- return true;
- */
- return java.security.MessageDigest.isEqual(refBytes, c14nBytes);
- }
-
- /*
- * Checks whether an object extends a specific class.
- *
- * @param object which is to be checked
- * @param className is the String of the Class
- * @return <code>true</code> if the object extends the specified class
- * public static boolean extendsClass(Object object,
- * String className) {
- *
- * String cn = object.getClass().getName();
- * while (!cn.equals("java.lang.object")) {
- * Object o = null;
- * try {
- * o = Class.forName(cn);
- * Class superC = o.getClass().getSuperclass();
- * cn = superC.getName();
- * } catch (Exception e) {}
- * }
- *
- * Class ancestors[] = object.getClass().getDeclaredClasses();
- *
- * for (int i=0; i<ancestors.length; i++) {
- * System.out.println(i + " " + ancestors[i].getName());
- * }
- *
- * for (int i = 0; i < ancestors.length; i++) {
- * if (ancestors[i].getName().equals(className)) {
- * return true;
- * }
- * }
- *
- * return false;
- * }
- */
-
- /*
- public static boolean extendsClassOrImplementsInterface(Object object,
- String name) {
- return (extendsClass(object, name) ||
- implementsInterface(object, name));
- }
- */
-
/**
* Method getBytesFromFile
*
* @param fileName
- * @return
+ * @return the bytes readed from the file
*
* @throws FileNotFoundException
* @throws IOException
@@ -195,7 +56,7 @@
{
FileInputStream fisRef = new FileInputStream(fileName);
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ UnsyncByteArrayOutputStream baos = new UnsyncByteArrayOutputStream();
byte buf[] = new byte[1024];
int len;
@@ -236,7 +97,7 @@
* them as a byte array.
*
* @param inputStream
- * @return
+ * @return the bytes readed from the stream
*
* @throws FileNotFoundException
* @throws IOException
@@ -246,7 +107,7 @@
byte refBytes[] = null;
{
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ UnsyncByteArrayOutputStream baos = new UnsyncByteArrayOutputStream();
byte buf[] = new byte[1024];
int len;
@@ -258,42 +119,5 @@
}
return refBytes;
- }
-
- /**
- * Method runGC
- *
- */
- public static void runGC() {
-
- log.debug("<METHOD name=runGC()>");
-
- Runtime runtime = Runtime.getRuntime();
- long lFreeMemBefore = runtime.freeMemory();
- long lTotalMemBefore = runtime.totalMemory();
- long lStart = System.currentTimeMillis();
-
- runtime.gc();
- runtime.runFinalization();
-
- long lEnd = System.currentTimeMillis();
- double time = (lEnd - lStart) / 1000.0;
- long lFreeMemAfter = runtime.freeMemory();
- long lTotalMemAfter = runtime.totalMemory();
-
- if (log.isDebugEnabled()) {
- log.debug("* Garbage collection took " + time + " seconds.");
- log.debug("* Memory before gc()... free:" + lFreeMemBefore + "= "
- + lFreeMemBefore / 1024 + "KB,...total:" + lTotalMemBefore
- + "= " + lTotalMemBefore / 1024 + "KB,... used:"
- + (lTotalMemBefore - lFreeMemBefore) + "= "
- + (lTotalMemBefore - lFreeMemBefore) / 1024 + "KB");
- log.debug("* Memory after: gc()... free:" + lFreeMemAfter + "= "
- + lFreeMemAfter / 1024 + "KB,...total:" + lTotalMemAfter + "= "
- + lTotalMemAfter / 1024 + "KB,... used:"
- + (lTotalMemAfter - lFreeMemAfter) + "= "
- + (lTotalMemAfter - lFreeMemAfter) / 1024 + "KB");
- log.debug("</METHOD>");
- }
}
}
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/RFC2253Parser.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/RFC2253Parser.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/RFC2253Parser.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/RFC2253Parser.java Fri Jan 13 14:00:23 2006
@@ -40,7 +40,7 @@
* Method rfc2253toXMLdsig
*
* @param dn
- * @return
+ * @return normalized string
*
*/
public static String rfc2253toXMLdsig(String dn) {
@@ -57,7 +57,7 @@
* Method xmldsigtoRFC2253
*
* @param dn
- * @return
+ * @return normalized string
*/
public static String xmldsigtoRFC2253(String dn) {
@@ -73,7 +73,7 @@
* Method normalize
*
* @param dn
- * @return
+ * @return normalized string
*/
public static String normalize(String dn) {
@@ -113,7 +113,7 @@
* Method parseRDN
*
* @param str
- * @return
+ * @return normalized string
* @throws IOException
*/
static String parseRDN(String str) throws IOException {
@@ -143,7 +143,7 @@
* Method parseATAV
*
* @param str
- * @return
+ * @return normalized string
* @throws IOException
*/
static String parseATAV(String str) throws IOException {
@@ -164,7 +164,7 @@
* Method normalizeAT
*
* @param str
- * @return
+ * @return normalized string
*/
static String normalizeAT(String str) {
@@ -181,7 +181,7 @@
* Method normalizeV
*
* @param str
- * @return
+ * @return normalized string
* @throws IOException
*/
static String normalizeV(String str) throws IOException {
@@ -227,7 +227,7 @@
* Method rfctoXML
*
* @param string
- * @return
+ * @return normalized string
*/
static String rfctoXML(String string) {
@@ -244,7 +244,7 @@
* Method xmltoRFC
*
* @param string
- * @return
+ * @return normalized string
*/
static String xmltoRFC(String string) {
@@ -261,7 +261,7 @@
* Method changeLess32toRFC
*
* @param string
- * @return
+ * @return normalized string
* @throws IOException
*/
static String changeLess32toRFC(String string) throws IOException {
@@ -304,7 +304,7 @@
* Method changeLess32toXML
*
* @param string
- * @return
+ * @return normalized string
* @throws IOException
*/
static String changeLess32toXML(String string) throws IOException {
@@ -329,7 +329,7 @@
* Method changeWStoXML
*
* @param string
- * @return
+ * @return normalized string
* @throws IOException
*/
static String changeWStoXML(String string) throws IOException {
@@ -367,7 +367,7 @@
* Method changeWStoRFC
*
* @param string
- * @return
+ * @return normalized string
*/
static String changeWStoRFC(String string) {
@@ -390,7 +390,7 @@
* Method semicolonToComma
*
* @param str
- * @return
+ * @return normalized string
*/
static String semicolonToComma(String str) {
return removeWSandReplace(str, ";", ",");
@@ -401,7 +401,7 @@
*
* @param str
* @param symbol
- * @return
+ * @return normalized string
*/
static String removeWhiteSpace(String str, String symbol) {
return removeWSandReplace(str, symbol, symbol);
@@ -413,7 +413,7 @@
* @param str
* @param symbol
* @param replace
- * @return
+ * @return normalized string
*/
static String removeWSandReplace(String str, String symbol, String replace) {
@@ -444,7 +444,7 @@
* @param s
* @param i
* @param j
- * @return
+ * @return number of quotes
*/
private static int countQuotes(String s, int i, int j) {
@@ -465,7 +465,7 @@
* Method trim
*
* @param str
- * @return
+ * @return the string
*/
static String trim(String str) {
Modified: xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/SignerOutputStream.java
URL: http://svn.apache.org/viewcvs/xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/SignerOutputStream.java?rev=368871&r1=368870&r2=368871&view=diff
==============================================================================
--- xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/SignerOutputStream.java (original)
+++ xml/security/branches/jsr105_0_16/src/org/apache/xml/security/utils/SignerOutputStream.java Fri Jan 13 14:00:23 2006
@@ -37,7 +37,6 @@
/** @inheritDoc */
public byte[] toByteArray() {
- // TODO Auto-generated method stub
return none;
}
@@ -61,7 +60,6 @@
/** @inheritDoc */
public void write(byte[] arg0, int arg1, int arg2) {
- // TODO Auto-generated method stub
try {
sa.update(arg0,arg1,arg2);
} catch (XMLSignatureException e) {