You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by ra...@apache.org on 2008/01/07 19:52:28 UTC
svn commit: r609737 - in /xml/security/trunk: ./
src/org/apache/xml/security/algorithms/
src/org/apache/xml/security/encryption/ src/org/apache/xml/security/keys/
src/org/apache/xml/security/keys/content/
src/org/apache/xml/security/signature/ src/org/...
Author: raul
Date: Mon Jan 7 10:52:16 2008
New Revision: 609737
URL: http://svn.apache.org/viewvc?rev=609737&view=rev
Log:
Small refactor for ElementProxy to get rid of the state, it was an old
vestige that where taking space and obfuscating the code.
Fixed bug 40897: String comparisons using '==' causes validation errors
with some parsers. Thanks Vishal Mahajan
Modified:
xml/security/trunk/CHANGELOG.txt
xml/security/trunk/src/org/apache/xml/security/algorithms/Algorithm.java
xml/security/trunk/src/org/apache/xml/security/encryption/XMLCipher.java
xml/security/trunk/src/org/apache/xml/security/keys/KeyInfo.java
xml/security/trunk/src/org/apache/xml/security/keys/content/X509Data.java
xml/security/trunk/src/org/apache/xml/security/signature/Manifest.java
xml/security/trunk/src/org/apache/xml/security/signature/ObjectContainer.java
xml/security/trunk/src/org/apache/xml/security/signature/Reference.java
xml/security/trunk/src/org/apache/xml/security/signature/SignatureProperties.java
xml/security/trunk/src/org/apache/xml/security/signature/SignatureProperty.java
xml/security/trunk/src/org/apache/xml/security/signature/XMLSignature.java
xml/security/trunk/src/org/apache/xml/security/utils/ElementProxy.java
xml/security/trunk/src/org/apache/xml/security/utils/SignatureElementProxy.java
Modified: xml/security/trunk/CHANGELOG.txt
URL: http://svn.apache.org/viewvc/xml/security/trunk/CHANGELOG.txt?rev=609737&r1=609736&r2=609737&view=diff
==============================================================================
--- xml/security/trunk/CHANGELOG.txt (original)
+++ xml/security/trunk/CHANGELOG.txt Mon Jan 7 10:52:16 2008
@@ -1,5 +1,9 @@
Changelog for "Apache xml-security" <http://xml.apache.org/security/>
New in ...
+ Small refactor for ElementProxy to get rid of the state, it was an old
+ vestige that where taking space and obfuscating the code.
+ Fixed bug 40897: String comparisons using '==' causes validation errors
+ with some parsers. Thanks Vishal Mahajan
Fixed bug 43056: Library does not allow specify provider for private key
operations. Thanks to Alon Bar-Lev.
Fixed bug 44102: XMLCipher loadEncryptedKey error. Thanks to Butler.
Modified: xml/security/trunk/src/org/apache/xml/security/algorithms/Algorithm.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src/org/apache/xml/security/algorithms/Algorithm.java?rev=609737&r1=609736&r2=609737&view=diff
==============================================================================
--- xml/security/trunk/src/org/apache/xml/security/algorithms/Algorithm.java (original)
+++ xml/security/trunk/src/org/apache/xml/security/algorithms/Algorithm.java Mon Jan 7 10:52:16 2008
@@ -71,7 +71,7 @@
*/
protected void setAlgorithmURI(String algorithmURI) {
- if ((this._state == MODE_CREATE) && (algorithmURI != null)) {
+ if ( (algorithmURI != null)) {
this._constructionElement.setAttributeNS(null, Constants._ATT_ALGORITHM,
algorithmURI);
}
Modified: xml/security/trunk/src/org/apache/xml/security/encryption/XMLCipher.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src/org/apache/xml/security/encryption/XMLCipher.java?rev=609737&r1=609736&r2=609737&view=diff
==============================================================================
--- xml/security/trunk/src/org/apache/xml/security/encryption/XMLCipher.java (original)
+++ xml/security/trunk/src/org/apache/xml/security/encryption/XMLCipher.java Mon Jan 7 10:52:16 2008
@@ -3722,8 +3722,7 @@
}
this._doc = doc;
- this._state = ElementProxy.MODE_CREATE;
- this._constructionElement = createElementForFamilyLocal(this._doc,
+ this._constructionElement = createElementForFamilyLocal(this._doc,
this.getBaseNamespace(), this.getBaseLocalName());
}
/**
Modified: xml/security/trunk/src/org/apache/xml/security/keys/KeyInfo.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src/org/apache/xml/security/keys/KeyInfo.java?rev=609737&r1=609736&r2=609737&view=diff
==============================================================================
--- xml/security/trunk/src/org/apache/xml/security/keys/KeyInfo.java (original)
+++ xml/security/trunk/src/org/apache/xml/security/keys/KeyInfo.java Mon Jan 7 10:52:16 2008
@@ -131,7 +131,7 @@
*/
public void setId(String Id) {
- if ((this._state == MODE_SIGN) && (Id != null)) {
+ if ((Id != null)) {
this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id);
IdResolver.registerElementById(this._constructionElement, Id);
}
@@ -162,10 +162,8 @@
*/
public void add(KeyName keyname) {
- if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(keyname.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
- }
}
/**
@@ -219,11 +217,8 @@
* @param keyvalue
*/
public void add(KeyValue keyvalue) {
-
- if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(keyvalue.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
- }
}
/**
@@ -241,11 +236,8 @@
* @param mgmtdata
*/
public void add(MgmtData mgmtdata) {
-
- if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(mgmtdata.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
- }
}
/**
@@ -254,11 +246,8 @@
* @param pgpdata
*/
public void add(PGPData pgpdata) {
-
- if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(pgpdata.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
- }
}
/**
@@ -279,11 +268,8 @@
* @param retrievalmethod
*/
public void add(RetrievalMethod retrievalmethod) {
-
- if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(retrievalmethod.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
- }
}
/**
@@ -292,11 +278,8 @@
* @param spkidata
*/
public void add(SPKIData spkidata) {
-
- if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(spkidata.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
- }
}
/**
@@ -305,14 +288,11 @@
* @param x509data
*/
public void add(X509Data x509data) {
-
- if (this._state == MODE_SIGN) {
if (x509Datas==null)
x509Datas=new ArrayList();
x509Datas.add(x509data);
this._constructionElement.appendChild(x509data.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
- }
}
/**
@@ -324,15 +304,11 @@
public void add(EncryptedKey encryptedKey)
throws XMLEncryptionException {
-
- if (this._state == MODE_SIGN) {
if (encryptedKeys==null)
encryptedKeys=new ArrayList();
encryptedKeys.add(encryptedKey);
XMLCipher cipher = XMLCipher.getInstance();
this._constructionElement.appendChild(cipher.martial(encryptedKey));
- }
-
}
/**
@@ -341,11 +317,8 @@
* @param element
*/
public void addUnknownElement(Element element) {
-
- if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(element);
XMLUtils.addReturnToElement(this._constructionElement);
- }
}
/**
Modified: xml/security/trunk/src/org/apache/xml/security/keys/content/X509Data.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src/org/apache/xml/security/keys/content/X509Data.java?rev=609737&r1=609736&r2=609737&view=diff
==============================================================================
--- xml/security/trunk/src/org/apache/xml/security/keys/content/X509Data.java (original)
+++ xml/security/trunk/src/org/apache/xml/security/keys/content/X509Data.java Mon Jan 7 10:52:16 2008
@@ -68,60 +68,17 @@
throws XMLSecurityException {
super(element, BaseURI);
-
- boolean noElements=true;
Node sibling=this._constructionElement.getFirstChild();
while (sibling!=null) {
if (sibling.getNodeType()!=Node.ELEMENT_NODE) {
sibling=sibling.getNextSibling();
continue;
}
- noElements=false;
- Element currentElem = (Element) sibling;
- sibling=sibling.getNextSibling();
- String localname = currentElem.getLocalName();
-
- if (currentElem.getNamespaceURI().equals(Constants.SignatureSpecNS)) {
- if (localname.equals(Constants._TAG_X509ISSUERSERIAL)) {
- XMLX509IssuerSerial is = new XMLX509IssuerSerial(currentElem,
- BaseURI);
-
- this.add(is);
- } else if (localname.equals(Constants._TAG_X509SKI)) {
- XMLX509SKI ski = new XMLX509SKI(currentElem, BaseURI);
-
- this.add(ski);
- } else if (localname.equals(Constants._TAG_X509SUBJECTNAME)) {
- XMLX509SubjectName sn = new XMLX509SubjectName(currentElem,
- BaseURI);
-
- this.add(sn);
- } else if (localname.equals(Constants._TAG_X509CERTIFICATE)) {
- XMLX509Certificate cert = new XMLX509Certificate(currentElem,
- BaseURI);
-
- this.add(cert);
- } else if (localname.equals(Constants._TAG_X509CRL)) {
- XMLX509CRL crl = new XMLX509CRL(currentElem, BaseURI);
-
- this.add(crl);
- } else {
- log.warn("Found a " + currentElem.getTagName() + " element in "
- + Constants._TAG_X509DATA);
- this.addUnknownElement(currentElem);
- }
- } else {
- log.warn("Found a " + currentElem.getTagName() + " element in "
- + Constants._TAG_X509DATA);
- this.addUnknownElement(currentElem);
- }
+ return;
}
- if (noElements) {
- Object exArgs[] = { "Elements", Constants._TAG_X509DATA };
-
- throw new XMLSecurityException("xml.WrongContent", exArgs);
- }
-
+ /* No Elements found */
+ Object exArgs[] = { "Elements", Constants._TAG_X509DATA };
+ throw new XMLSecurityException("xml.WrongContent", exArgs);
}
/**
@@ -165,11 +122,9 @@
*/
public void add(XMLX509IssuerSerial xmlX509IssuerSerial) {
- if (this._state == MODE_SIGN) {
this._constructionElement
.appendChild(xmlX509IssuerSerial.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
- }
}
/**
@@ -198,11 +153,8 @@
* @param xmlX509SKI
*/
public void add(XMLX509SKI xmlX509SKI) {
-
- if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(xmlX509SKI.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
- }
}
/**
@@ -229,11 +181,8 @@
* @param xmlX509SubjectName
*/
public void add(XMLX509SubjectName xmlX509SubjectName) {
-
- if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(xmlX509SubjectName.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
- }
}
/**
@@ -262,11 +211,8 @@
* @param xmlX509Certificate
*/
public void add(XMLX509Certificate xmlX509Certificate) {
-
- if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(xmlX509Certificate.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
- }
}
/**
@@ -284,11 +230,8 @@
* @param xmlX509CRL
*/
public void add(XMLX509CRL xmlX509CRL) {
-
- if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(xmlX509CRL.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
- }
}
/**
@@ -297,11 +240,8 @@
* @param element
*/
public void addUnknownElement(Element element) {
-
- if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(element);
XMLUtils.addReturnToElement(this._constructionElement);
- }
}
/**
Modified: xml/security/trunk/src/org/apache/xml/security/signature/Manifest.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src/org/apache/xml/security/signature/Manifest.java?rev=609737&r1=609736&r2=609737&view=diff
==============================================================================
--- xml/security/trunk/src/org/apache/xml/security/signature/Manifest.java (original)
+++ xml/security/trunk/src/org/apache/xml/security/signature/Manifest.java Mon Jan 7 10:52:16 2008
@@ -137,8 +137,6 @@
String BaseURI, String referenceURI, Transforms transforms, String digestURI, String ReferenceId, String ReferenceType)
throws XMLSignatureException {
- if (this._state == MODE_SIGN) {
-
// the this._doc is handed implicitly by the this.getOwnerDocument()
Reference ref = new Reference(this._doc, BaseURI, referenceURI, this,
transforms, digestURI);
@@ -157,7 +155,6 @@
// add the Element of the Reference object to the Manifest/SignedInfo
this._constructionElement.appendChild(ref.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
- }
}
/**
@@ -171,7 +168,6 @@
public void generateDigestValues()
throws XMLSignatureException, ReferenceNotInitializedException {
- if (this._state == MODE_SIGN) {
for (int i = 0; i < this.getLength(); i++) {
// update the cached Reference object, the Element content is automatically updated
@@ -179,7 +175,6 @@
currentRef.generateDigestValue();
}
- }
}
/**
@@ -201,11 +196,6 @@
*/
public Reference item(int i) throws XMLSecurityException {
- if (this._state == MODE_SIGN) {
-
- // we already have real objects
- return (Reference) this._references.get(i);
- }
if (this._references.get(i) == null) {
// not yet constructed, so _we_ have to
@@ -225,7 +215,7 @@
*/
public void setId(String Id) {
- if ((this._state == MODE_SIGN) && (Id != null)) {
+ if (Id != null) {
this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id);
IdResolver.registerElementById(this._constructionElement, Id);
}
Modified: xml/security/trunk/src/org/apache/xml/security/signature/ObjectContainer.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src/org/apache/xml/security/signature/ObjectContainer.java?rev=609737&r1=609736&r2=609737&view=diff
==============================================================================
--- xml/security/trunk/src/org/apache/xml/security/signature/ObjectContainer.java (original)
+++ xml/security/trunk/src/org/apache/xml/security/signature/ObjectContainer.java Mon Jan 7 10:52:16 2008
@@ -64,7 +64,7 @@
*/
public void setId(String Id) {
- if ((this._state == MODE_SIGN) && (Id != null)) {
+ if ((Id != null)) {
this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id);
IdResolver.registerElementById(this._constructionElement, Id);
}
@@ -86,7 +86,7 @@
*/
public void setMimeType(String MimeType) {
- if ((this._state == MODE_SIGN) && (MimeType != null)) {
+ if ( (MimeType != null)) {
this._constructionElement.setAttributeNS(null, Constants._ATT_MIMETYPE,
MimeType);
}
@@ -108,7 +108,7 @@
*/
public void setEncoding(String Encoding) {
- if ((this._state == MODE_SIGN) && (Encoding != null)) {
+ if ((Encoding != null)) {
this._constructionElement.setAttributeNS(null, Constants._ATT_ENCODING,
Encoding);
}
@@ -133,9 +133,7 @@
Node result = null;
- if (this._state == MODE_SIGN) {
- result = this._constructionElement.appendChild(node);
- }
+ result = this._constructionElement.appendChild(node);
return result;
}
Modified: xml/security/trunk/src/org/apache/xml/security/signature/Reference.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src/org/apache/xml/security/signature/Reference.java?rev=609737&r1=609736&r2=609737&view=diff
==============================================================================
--- xml/security/trunk/src/org/apache/xml/security/signature/Reference.java (original)
+++ xml/security/trunk/src/org/apache/xml/security/signature/Reference.java Mon Jan 7 10:52:16 2008
@@ -233,7 +233,7 @@
*/
public void setURI(String URI) {
- if ((this._state == MODE_SIGN) && (URI != null)) {
+ if ( URI != null) {
this._constructionElement.setAttributeNS(null, Constants._ATT_URI,
URI);
}
@@ -255,7 +255,7 @@
*/
public void setId(String Id) {
- if ((this._state == MODE_SIGN) && (Id != null)) {
+ if ( Id != null ) {
this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id);
IdResolver.registerElementById(this._constructionElement, Id);
}
@@ -277,7 +277,7 @@
*/
public void setType(String Type) {
- if ((this._state == MODE_SIGN) && (Type != null)) {
+ if (Type != null) {
this._constructionElement.setAttributeNS(null, Constants._ATT_TYPE,
Type);
}
@@ -334,9 +334,6 @@
*/
private void setDigestValueElement(byte[] digestValue)
{
-
- if (this._state == MODE_SIGN) {
-
Node n=digestValueElement.getFirstChild();
while (n!=null) {
digestValueElement.removeChild(n);
@@ -347,7 +344,6 @@
Text t = this._doc.createTextNode(base64codedValue);
digestValueElement.appendChild(t);
- }
}
/**
@@ -358,11 +354,7 @@
*/
public void generateDigestValue()
throws XMLSignatureException, ReferenceNotInitializedException {
-
- if (this._state == MODE_SIGN) {
-
- this.setDigestValueElement(this.calculateDigest());
- }
+ this.setDigestValueElement(this.calculateDigest());
}
/**
Modified: xml/security/trunk/src/org/apache/xml/security/signature/SignatureProperties.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src/org/apache/xml/security/signature/SignatureProperties.java?rev=609737&r1=609736&r2=609737&view=diff
==============================================================================
--- xml/security/trunk/src/org/apache/xml/security/signature/SignatureProperties.java (original)
+++ xml/security/trunk/src/org/apache/xml/security/signature/SignatureProperties.java Mon Jan 7 10:52:16 2008
@@ -105,7 +105,7 @@
*/
public void setId(String Id) {
- if ((this._state == MODE_SIGN) && (Id != null)) {
+ if ((Id != null)) {
this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id);
IdResolver.registerElementById(this._constructionElement, Id);
}
Modified: xml/security/trunk/src/org/apache/xml/security/signature/SignatureProperty.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src/org/apache/xml/security/signature/SignatureProperty.java?rev=609737&r1=609736&r2=609737&view=diff
==============================================================================
--- xml/security/trunk/src/org/apache/xml/security/signature/SignatureProperty.java (original)
+++ xml/security/trunk/src/org/apache/xml/security/signature/SignatureProperty.java Mon Jan 7 10:52:16 2008
@@ -76,7 +76,7 @@
*/
public void setId(String Id) {
- if ((this._state == MODE_SIGN) && (Id != null)) {
+ if ((Id != null)) {
this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id);
IdResolver.registerElementById(this._constructionElement, Id);
}
@@ -98,7 +98,7 @@
*/
public void setTarget(String Target) {
- if ((this._state == MODE_SIGN) && (Target != null)) {
+ if ((Target != null)) {
this._constructionElement.setAttributeNS(null, Constants._ATT_TARGET, Target);
}
}
Modified: xml/security/trunk/src/org/apache/xml/security/signature/XMLSignature.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src/org/apache/xml/security/signature/XMLSignature.java?rev=609737&r1=609736&r2=609737&view=diff
==============================================================================
--- xml/security/trunk/src/org/apache/xml/security/signature/XMLSignature.java (original)
+++ xml/security/trunk/src/org/apache/xml/security/signature/XMLSignature.java Mon Jan 7 10:52:16 2008
@@ -323,7 +323,7 @@
*/
public void setId(String Id) {
- if ((this._state == MODE_SIGN) && (Id != null)) {
+ if ( (Id != null)) {
this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id);
IdResolver.registerElementById(this._constructionElement, Id);
}
@@ -374,7 +374,6 @@
private void setSignatureValueElement(byte[] bytes)
{
- if (this._state == MODE_SIGN) {
while (signatureValueElement.hasChildNodes()) {
signatureValueElement.removeChild(signatureValueElement.getFirstChild());
}
@@ -392,7 +391,6 @@
if (base64codedValue.length() > 76) {
XMLUtils.addReturnToElement(signatureValueElement);
}
- }
}
/**
@@ -406,7 +404,7 @@
public KeyInfo getKeyInfo() {
// check to see if we are signing and if we have to create a keyinfo
- if ((this._state == MODE_SIGN) && (this._keyInfo == null)) {
+ if ( (this._keyInfo == null)) {
// create the KeyInfo
this._keyInfo = new KeyInfo(this._doc);
@@ -445,17 +443,17 @@
public void appendObject(ObjectContainer object)
throws XMLSignatureException {
- try {
- if (this._state != MODE_SIGN) {
- throw new XMLSignatureException(
- "signature.operationOnlyBeforeSign");
- }
+ //try {
+ //if (this._state != MODE_SIGN) {
+ // throw new XMLSignatureException(
+ // "signature.operationOnlyBeforeSign");
+ //}
this._constructionElement.appendChild(object.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
- } catch (XMLSecurityException ex) {
- throw new XMLSignatureException("empty", ex);
- }
+ //} catch (XMLSecurityException ex) {
+ // throw new XMLSignatureException("empty", ex);
+ //}
}
/**
@@ -501,7 +499,7 @@
}
try {
- if (this._state == MODE_SIGN) {
+ // if (this._state == MODE_SIGN) {
//Create a SignatureAlgorithm object
SignedInfo si = this.getSignedInfo();
SignatureAlgorithm sa = si.getSignatureAlgorithm();
@@ -523,7 +521,7 @@
// set them on the SignateValue element
this.setSignatureValueElement(jcebytes);
- }
+ //}
} catch (CanonicalizationException ex) {
throw new XMLSignatureException("empty", ex);
} catch (InvalidCanonicalizerException ex) {
Modified: xml/security/trunk/src/org/apache/xml/security/utils/ElementProxy.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src/org/apache/xml/security/utils/ElementProxy.java?rev=609737&r1=609736&r2=609737&view=diff
==============================================================================
--- xml/security/trunk/src/org/apache/xml/security/utils/ElementProxy.java (original)
+++ xml/security/trunk/src/org/apache/xml/security/utils/ElementProxy.java Mon Jan 7 10:52:16 2008
@@ -42,27 +42,7 @@
/** {@link org.apache.commons.logging} logging facility */
static org.apache.commons.logging.Log log =
org.apache.commons.logging.LogFactory.getLog(ElementProxy.class.getName());
- //J-
- /** The element has been created by the code **/
- public static final int MODE_CREATE = 0;
- /** The element has been readed from a DOM tree by the code **/
- public static final int MODE_PROCESS = 1;
- /** The element isn't known if it is readen or created **/
- public static final int MODE_UNKNOWN = 2;
-
- /** The element is going to be signed **/
- public static final int MODE_SIGN = MODE_CREATE;
- /** The element is going to be verified **/
- public static final int MODE_VERIFY = MODE_PROCESS;
-
- /** The element is going to be encrypted **/
- public static final int MODE_ENCRYPT = MODE_CREATE;
- /** The element is going to be decrypted **/
- public static final int MODE_DECRYPT = MODE_PROCESS;
-
- protected int _state = MODE_UNKNOWN;
- //J+
-
+
/**
* Returns the namespace of the Elements of the sub-class.
*
@@ -104,7 +84,6 @@
}
this._doc = doc;
- this._state = ElementProxy.MODE_CREATE;
this._constructionElement = createElementForFamilyLocal(this._doc,
this.getBaseNamespace(), this.getBaseLocalName());
}
@@ -194,7 +173,6 @@
}
this._doc = element.getOwnerDocument();
- this._state = ElementProxy.MODE_PROCESS;
this._constructionElement = element;
this._baseURI = BaseURI;
}
@@ -218,7 +196,6 @@
}
this._doc = element.getOwnerDocument();
- this._state = ElementProxy.MODE_PROCESS;
this._constructionElement = element;
this._baseURI = BaseURI;
@@ -267,26 +244,19 @@
public String getBaseURI() {
return this._baseURI;
}
+
+ static ElementChecker checker = new ElementCheckerImpl.InternedNsChecker();
/**
* Method guaranteeThatElementInCorrectSpace
*
* @throws XMLSecurityException
*/
- public void guaranteeThatElementInCorrectSpace()
+ void guaranteeThatElementInCorrectSpace()
throws XMLSecurityException {
-
- String localnameSHOULDBE = this.getBaseLocalName();
- String namespaceSHOULDBE = this.getBaseNamespace();
+
+ checker.guaranteeThatElementInCorrectSpace(this,this._constructionElement);
- String localnameIS = this._constructionElement.getLocalName();
- String namespaceIS = this._constructionElement.getNamespaceURI();
- if ((namespaceSHOULDBE!=namespaceIS) ||
- !localnameSHOULDBE.equals(localnameIS) ) {
- Object exArgs[] = { namespaceIS +":"+ localnameIS,
- namespaceSHOULDBE +":"+ localnameSHOULDBE};
- throw new XMLSecurityException("xml.WrongElement", exArgs);
- }
}
/**
Modified: xml/security/trunk/src/org/apache/xml/security/utils/SignatureElementProxy.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src/org/apache/xml/security/utils/SignatureElementProxy.java?rev=609737&r1=609736&r2=609737&view=diff
==============================================================================
--- xml/security/trunk/src/org/apache/xml/security/utils/SignatureElementProxy.java (original)
+++ xml/security/trunk/src/org/apache/xml/security/utils/SignatureElementProxy.java Mon Jan 7 10:52:16 2008
@@ -43,12 +43,8 @@
}
this._doc = doc;
- this._state = ElementProxy.MODE_CREATE;
this._constructionElement = XMLUtils.createElementInSignatureSpace(this._doc,
this.getBaseLocalName());
- //super(doc);
- //this._constructionElement.setAttributeNS(Constants.NamespaceSpecNS,"xmlns:ds",
- // Constants.SignatureSpecNS);
}
/**