You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2012/06/28 14:04:14 UTC
svn commit: r1354962 - in /santuario/xml-security-java/trunk: ./
src/main/java/org/apache/jcp/xml/dsig/internal/dom/
src/main/java/org/apache/xml/security/c14n/implementations/
src/main/java/org/apache/xml/security/exceptions/
src/main/java/org/apache/...
Author: coheigea
Date: Thu Jun 28 12:04:12 2012
New Revision: 1354962
URL: http://svn.apache.org/viewvc?rev=1354962&view=rev
Log:
Enabled pmd by default
Modified:
santuario/xml-security-java/trunk/pom.xml
santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java
santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMXMLObject.java
santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/UtfHelpper.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/exceptions/XMLSecurityException.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/exceptions/XMLSecurityRuntimeException.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/PrivateKeyResolver.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/crypto/Merlin.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityException.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/InputProcessorChainImpl.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/OutputProcessorChainImpl.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/XMLSecurityStreamReader.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/XMLSecurityStreamWriter.java
Modified: santuario/xml-security-java/trunk/pom.xml
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/pom.xml?rev=1354962&r1=1354961&r2=1354962&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/pom.xml (original)
+++ santuario/xml-security-java/trunk/pom.xml Thu Jun 28 12:04:12 2012
@@ -104,19 +104,19 @@
</testResources>
<plugins>
- <!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.5</version>
<configuration>
<linkXRef>false</linkXRef>
+ <sourceEncoding>utf-8</sourceEncoding>
<failOnViolation>true</failOnViolation>
<verbose>true</verbose>
- <targetJdk>1.5</targetJdk>
+ <targetJdk>1.6</targetJdk>
<excludes>
<exclude>
- **/XMLX509SKI.java,**/KeyInfoFactory.java,**/XMLDSigSecurity.java
+ **/XMLX509SKI.java,**/CryptoBase.java, **/XPathFactory.java,**/MultiInputStream.java,**/AbstractDecryptInputProcessor.java
</exclude>
</excludes>
</configuration>
@@ -129,8 +129,7 @@
</goals>
</execution>
</executions>
- </plugin>
- -->
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -358,6 +357,12 @@
<maven.test.skip>true</maven.test.skip>
</properties>
</profile>
+ <profile>
+ <id>nochecks</id>
+ <properties>
+ <pmd.skip>true</pmd.skip>
+ </properties>
+ </profile>
</profiles>
<properties>
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java?rev=1354962&r1=1354961&r2=1354962&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java Thu Jun 28 12:04:12 2012
@@ -86,7 +86,7 @@ public final class DOMSignaturePropertie
* @param propsElem a SignatureProperties element
* @throws MarshalException if a marshalling error occurs
*/
- public DOMSignatureProperties(Element propsElem, XMLCryptoContext context)
+ public DOMSignatureProperties(Element propsElem)
throws MarshalException
{
// unmarshal attributes
@@ -105,8 +105,7 @@ public final class DOMSignaturePropertie
for (int i = 0; i < length; i++) {
Node child = nodes.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
- properties.add(new DOMSignatureProperty((Element)child,
- context));
+ properties.add(new DOMSignatureProperty((Element)child));
}
}
if (properties.isEmpty()) {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java?rev=1354962&r1=1354961&r2=1354962&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java Thu Jun 28 12:04:12 2012
@@ -90,7 +90,7 @@ public final class DOMSignatureProperty
*
* @param propElem a SignatureProperty element
*/
- public DOMSignatureProperty(Element propElem, XMLCryptoContext context)
+ public DOMSignatureProperty(Element propElem)
throws MarshalException
{
// unmarshal attributes
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMXMLObject.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMXMLObject.java?rev=1354962&r1=1354961&r2=1354962&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMXMLObject.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMXMLObject.java Thu Jun 28 12:04:12 2012
@@ -117,7 +117,7 @@ public final class DOMXMLObject extends
content.add(new DOMManifest(childElem, context, provider));
continue;
} else if (tag.equals("SignatureProperties")) {
- content.add(new DOMSignatureProperties(childElem, context));
+ content.add(new DOMSignatureProperties(childElem));
continue;
} else if (tag.equals("X509Data")) {
content.add(new DOMX509Data(childElem));
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMXMLSignature.java?rev=1354962&r1=1354961&r2=1354962&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMXMLSignature.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMXMLSignature.java Thu Jun 28 12:04:12 2012
@@ -142,7 +142,7 @@ public final class DOMXMLSignature exten
// unmarshal SignatureValue
Element sigValElem = DOMUtils.getNextSiblingElement(siElem);
- sv = new DOMSignatureValue(sigValElem, context);
+ sv = new DOMSignatureValue(sigValElem);
// unmarshal KeyInfo, if specified
Element nextSibling = DOMUtils.getNextSiblingElement(sigValElem);
@@ -489,7 +489,7 @@ public final class DOMXMLSignature exten
this.id = id;
}
- DOMSignatureValue(Element sigValueElem, XMLCryptoContext context)
+ DOMSignatureValue(Element sigValueElem)
throws MarshalException
{
try {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/UtfHelpper.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/UtfHelpper.java?rev=1354962&r1=1354961&r2=1354962&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/UtfHelpper.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/UtfHelpper.java Thu Jun 28 12:04:12 2012
@@ -28,7 +28,7 @@ public final class UtfHelpper {
// complete
}
- public static final void writeByte(
+ public static void writeByte(
final String str,
final OutputStream out,
Map<String, byte[]> cache
@@ -42,7 +42,7 @@ public final class UtfHelpper {
out.write(result);
}
- public static final void writeCharToUtf8(final char c, final OutputStream out) throws IOException {
+ public static void writeCharToUtf8(final char c, final OutputStream out) throws IOException {
if (c < 0x80) {
out.write(c);
return;
@@ -77,7 +77,7 @@ public final class UtfHelpper {
}
- public static final void writeStringToUtf8(
+ public static void writeStringToUtf8(
final String str,
final OutputStream out
) throws IOException{
@@ -122,7 +122,7 @@ public final class UtfHelpper {
}
- public static final byte[] getStringInUtf8(final String str) {
+ public static byte[] getStringInUtf8(final String str) {
final int length = str.length();
boolean expanded = false;
byte []result = new byte[length];
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/exceptions/XMLSecurityException.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/exceptions/XMLSecurityException.java?rev=1354962&r1=1354961&r2=1354962&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/exceptions/XMLSecurityException.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/exceptions/XMLSecurityException.java Thu Jun 28 12:04:12 2012
@@ -18,8 +18,6 @@
*/
package org.apache.xml.security.exceptions;
-import java.io.PrintStream;
-import java.io.PrintWriter;
import java.text.MessageFormat;
import org.apache.xml.security.utils.Constants;
@@ -181,24 +179,6 @@ public class XMLSecurityException extend
}
/**
- * Method printStackTrace
- *
- * @param printwriter
- */
- public void printStackTrace(PrintWriter printwriter) {
- super.printStackTrace(printwriter);
- }
-
- /**
- * Method printStackTrace
- *
- * @param printstream
- */
- public void printStackTrace(PrintStream printstream) {
- super.printStackTrace(printstream);
- }
-
- /**
* Method getOriginalException
*
* @return the original exception
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/exceptions/XMLSecurityRuntimeException.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/exceptions/XMLSecurityRuntimeException.java?rev=1354962&r1=1354961&r2=1354962&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/exceptions/XMLSecurityRuntimeException.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/exceptions/XMLSecurityRuntimeException.java Thu Jun 28 12:04:12 2012
@@ -18,8 +18,6 @@
*/
package org.apache.xml.security.exceptions;
-import java.io.PrintStream;
-import java.io.PrintWriter;
import java.text.MessageFormat;
import org.apache.xml.security.utils.Constants;
@@ -130,7 +128,7 @@ public class XMLSecurityRuntimeException
* @param originalException
*/
public XMLSecurityRuntimeException(String msgID, Object exArgs[], Exception originalException) {
- super(MessageFormat.format(I18n.getExceptionMessage(msgID), exArgs));
+ super(MessageFormat.format(I18n.getExceptionMessage(msgID), exArgs), originalException);
this.msgID = msgID;
}
@@ -166,34 +164,6 @@ public class XMLSecurityRuntimeException
}
/**
- * Method printStackTrace
- *
- */
- public void printStackTrace() {
- synchronized (System.err) {
- super.printStackTrace(System.err);
- }
- }
-
- /**
- * Method printStackTrace
- *
- * @param printwriter
- */
- public void printStackTrace(PrintWriter printwriter) {
- super.printStackTrace(printwriter);
- }
-
- /**
- * Method printStackTrace
- *
- * @param printstream
- */
- public void printStackTrace(PrintStream printstream) {
- super.printStackTrace(printstream);
- }
-
- /**
* Method getOriginalException
*
* @return the original exception
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/PrivateKeyResolver.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/PrivateKeyResolver.java?rev=1354962&r1=1354961&r2=1354962&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/PrivateKeyResolver.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/PrivateKeyResolver.java Thu Jun 28 12:04:12 2012
@@ -324,6 +324,7 @@ public class PrivateKeyResolver extends
try {
certBytes = cert.getEncoded();
} catch (CertificateEncodingException e1) {
+ log.debug("Cannot recover the key", e1);
}
if (certBytes != null && Arrays.equals(certBytes, x509CertBytes)) {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/crypto/Merlin.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/crypto/Merlin.java?rev=1354962&r1=1354961&r2=1354962&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/crypto/Merlin.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/crypto/Merlin.java Thu Jun 28 12:04:12 2012
@@ -57,6 +57,7 @@ public class Merlin extends MerlinBase {
try {
cacertsIs.close();
} catch (IOException e) {
+ log.debug(e.getMessage(), e);
//ignore
}
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityException.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityException.java?rev=1354962&r1=1354961&r2=1354962&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityException.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityException.java Thu Jun 28 12:04:12 2012
@@ -51,7 +51,6 @@ public class XMLSecurityException extend
}
private static final ResourceBundle resources;
- private ErrorCode errorCode;
static {
try {
@@ -72,7 +71,6 @@ public class XMLSecurityException extend
*/
public XMLSecurityException(ErrorCode errorCode, String msgId, Throwable exception, Object... arguments) {
super(getMessage(errorCode, msgId, arguments), exception);
- this.errorCode = errorCode;
}
/**
@@ -85,12 +83,10 @@ public class XMLSecurityException extend
*/
public XMLSecurityException(ErrorCode errorCode, String msgId, Throwable exception) {
super(getMessage(errorCode, msgId), exception);
- this.errorCode = errorCode;
}
public XMLSecurityException(ErrorCode errorCode, Throwable exception) {
super(getMessage(errorCode, null), exception);
- this.errorCode = errorCode;
}
/**
@@ -103,7 +99,6 @@ public class XMLSecurityException extend
*/
public XMLSecurityException(ErrorCode errorCode, String msgId, Object... arguments) {
super(getMessage(errorCode, msgId, arguments));
- this.errorCode = errorCode;
}
/**
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/InputProcessorChainImpl.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/InputProcessorChainImpl.java?rev=1354962&r1=1354961&r2=1354962&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/InputProcessorChainImpl.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/InputProcessorChainImpl.java Thu Jun 28 12:04:12 2012
@@ -22,7 +22,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.xml.security.stax.ext.*;
import org.apache.xml.security.stax.ext.stax.XMLSecEvent;
-import org.apache.xml.security.stax.ext.stax.XMLSecStartElement;
import javax.xml.stream.XMLStreamException;
import java.util.ArrayList;
@@ -43,7 +42,6 @@ public class InputProcessorChainImpl imp
private List<InputProcessor> inputProcessors = Collections.synchronizedList(new ArrayList<InputProcessor>(20));//the default of ten entries is not enough
private int startPos = 0;
private int curPos = 0;
- private XMLSecStartElement parentXmlSecStartElement;
private final SecurityContext securityContext;
private final DocumentContextImpl documentContext;
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/OutputProcessorChainImpl.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/OutputProcessorChainImpl.java?rev=1354962&r1=1354961&r2=1354962&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/OutputProcessorChainImpl.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/OutputProcessorChainImpl.java Thu Jun 28 12:04:12 2012
@@ -209,10 +209,8 @@ public class OutputProcessorChainImpl im
}
}
outputProcessors.get(this.curPos++).processNextEvent(xmlSecEvent, this);
- if (reparent) {
- if (parentXmlSecStartElement != null) {
- parentXmlSecStartElement = parentXmlSecStartElement.getParentXMLSecStartElement();
- }
+ if (reparent && parentXmlSecStartElement != null) {
+ parentXmlSecStartElement = parentXmlSecStartElement.getParentXMLSecStartElement();
}
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/XMLSecurityStreamReader.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/XMLSecurityStreamReader.java?rev=1354962&r1=1354961&r2=1354962&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/XMLSecurityStreamReader.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/XMLSecurityStreamReader.java Thu Jun 28 12:04:12 2012
@@ -117,10 +117,6 @@ public class XMLSecurityStreamReader imp
}
}
- final private static int MASK_GET_ELEMENT_TEXT =
- (1 << CHARACTERS) | (1 << CDATA) | (1 << SPACE)
- | (1 << ENTITY_REFERENCE);
-
public String getElementText() throws XMLStreamException {
XMLSecEvent xmlSecEvent = getCurrentEvent();
if (xmlSecEvent.getEventType() != START_ELEMENT) {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/XMLSecurityStreamWriter.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/XMLSecurityStreamWriter.java?rev=1354962&r1=1354961&r2=1354962&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/XMLSecurityStreamWriter.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/XMLSecurityStreamWriter.java Thu Jun 28 12:04:12 2012
@@ -209,7 +209,8 @@ public class XMLSecurityStreamWriter imp
public void writeEndElement() throws XMLStreamException {
outputOpenStartElement();
QName element = startElementStack.pop();
- Map<String, XMLSecNamespace> namespaceMap = nsStack.pop();
+ // Map<String, XMLSecNamespace> namespaceMap = nsStack.pop();
+ nsStack.pop();
//todo namespaces which are going out of scope for endElement?
chainProcessEvent(XMLSecEventFactory.createXmlSecEndElement(element));
@@ -219,7 +220,8 @@ public class XMLSecurityStreamWriter imp
outputOpenStartElement();
Iterator<QName> startElements = startElementStack.iterator();
while (startElements.hasNext()) {
- Map<String, XMLSecNamespace> namespaceMap = nsStack.pop();
+ // Map<String, XMLSecNamespace> namespaceMap = nsStack.pop();
+ nsStack.pop();
//todo namespaces which are going out of scope for endElement?
chainProcessEvent(XMLSecEventFactory.createXmlSecEndElement(startElements.next()));
}
@@ -427,10 +429,8 @@ public class XMLSecurityStreamWriter imp
public void setPrefix(String prefix, String uri) throws XMLStreamException {
putNamespaceOntoStack(prefix, XMLSecEventFactory.createXMLSecNamespace(prefix, uri));
- if (openStartElement != null) {
- if (openStartElement.getNamespaceURI().equals(uri)) {
- openStartElement = new QName(openStartElement.getNamespaceURI(), openStartElement.getLocalPart(), prefix);
- }
+ if (openStartElement != null && openStartElement.getNamespaceURI().equals(uri)) {
+ openStartElement = new QName(openStartElement.getNamespaceURI(), openStartElement.getLocalPart(), prefix);
}
}