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 2011/11/18 22:18:18 UTC
svn commit: r1203846 - in
/santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom:
DOMKeyInfo.java DOMKeyInfoFactory.java DOMPGPData.java
DOMRetrievalMethod.java DOMX509Data.java
Author: mullan
Date: Fri Nov 18 21:18:17 2011
New Revision: 1203846
URL: http://svn.apache.org/viewvc?rev=1203846&view=rev
Log:
Generifying internal implementation.
Modified:
santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMKeyInfo.java
santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java
santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMPGPData.java
santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java
santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMX509Data.java
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMKeyInfo.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMKeyInfo.java?rev=1203846&r1=1203845&r2=1203846&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMKeyInfo.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMKeyInfo.java Fri Nov 18 21:18:17 2011
@@ -58,21 +58,21 @@ public final class DOMKeyInfo extends DO
* @throws ClassCastException if <code>content</code> contains any entries
* that are not of type {@link XMLStructure}
*/
- public DOMKeyInfo(List<XMLStructure> content, String id) {
+ public DOMKeyInfo(List<? extends XMLStructure> content, String id) {
if (content == null) {
throw new NullPointerException("content cannot be null");
}
- List<XMLStructure> typesCopy = new ArrayList<XMLStructure>(content);
- if (typesCopy.isEmpty()) {
+ this.keyInfoTypes =
+ Collections.unmodifiableList(new ArrayList<XMLStructure>(content));
+ if (this.keyInfoTypes.isEmpty()) {
throw new IllegalArgumentException("content cannot be empty");
}
- for (int i = 0, size = typesCopy.size(); i < size; i++) {
- if (!(typesCopy.get(i) instanceof XMLStructure)) {
+ for (int i = 0, size = this.keyInfoTypes.size(); i < size; i++) {
+ if (!(this.keyInfoTypes.get(i) instanceof XMLStructure)) {
throw new ClassCastException
("content["+i+"] is not a valid KeyInfo type");
}
}
- this.keyInfoTypes = Collections.unmodifiableList(typesCopy);
this.id = id;
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java?rev=1203846&r1=1203845&r2=1203846&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java Fri Nov 18 21:18:17 2011
@@ -48,6 +48,7 @@ public final class DOMKeyInfoFactory ext
return newKeyInfo(content, null);
}
+ @SuppressWarnings("unchecked")
public KeyInfo newKeyInfo(List content, String id) {
return new DOMKeyInfo(content, id);
}
@@ -73,10 +74,12 @@ public final class DOMKeyInfoFactory ext
return newPGPData(keyId, null, null);
}
+ @SuppressWarnings("unchecked")
public PGPData newPGPData(byte[] keyId, byte[] keyPacket, List other) {
return new DOMPGPData(keyId, keyPacket, other);
}
+ @SuppressWarnings("unchecked")
public PGPData newPGPData(byte[] keyPacket, List other) {
return new DOMPGPData(keyPacket, other);
}
@@ -85,6 +88,7 @@ public final class DOMKeyInfoFactory ext
return newRetrievalMethod(uri, null, null);
}
+ @SuppressWarnings("unchecked")
public RetrievalMethod newRetrievalMethod(String uri, String type,
List transforms) {
if (uri == null) {
@@ -93,6 +97,7 @@ public final class DOMKeyInfoFactory ext
return new DOMRetrievalMethod(uri, type, transforms);
}
+ @SuppressWarnings("unchecked")
public X509Data newX509Data(List content) {
return new DOMX509Data(content);
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMPGPData.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMPGPData.java?rev=1203846&r1=1203845&r2=1203846&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMPGPData.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMPGPData.java Fri Nov 18 21:18:17 2011
@@ -65,21 +65,21 @@ public final class DOMPGPData extends DO
* @throws ClassCastException if <code>other</code> contains any
* entries that are not of type {@link XMLStructure}
*/
- public DOMPGPData(byte[] keyPacket, List<XMLStructure> other) {
+ public DOMPGPData(byte[] keyPacket, List<? extends XMLStructure> other) {
if (keyPacket == null) {
throw new NullPointerException("keyPacket cannot be null");
}
if (other == null || other.isEmpty()) {
this.externalElements = Collections.emptyList();
} else {
- List<XMLStructure> otherCopy = new ArrayList<XMLStructure>(other);
- for (int i = 0, size = otherCopy.size(); i < size; i++) {
- if (!(otherCopy.get(i) instanceof XMLStructure)) {
+ this.externalElements =
+ Collections.unmodifiableList(new ArrayList<XMLStructure>(other));
+ for (int i = 0, size = this.externalElements.size(); i < size; i++) {
+ if (!(this.externalElements.get(i) instanceof XMLStructure)) {
throw new ClassCastException
("other["+i+"] is not a valid PGPData type");
}
}
- this.externalElements = Collections.unmodifiableList(otherCopy);
}
this.keyPacket = (byte[])keyPacket.clone();
checkKeyPacket(keyPacket);
@@ -106,7 +106,8 @@ public final class DOMPGPData extends DO
* @throws ClassCastException if <code>other</code> contains any
* entries that are not of type {@link XMLStructure}
*/
- public DOMPGPData(byte[] keyId, byte[] keyPacket, List<XMLStructure> other)
+ public DOMPGPData(byte[] keyId, byte[] keyPacket,
+ List<? extends XMLStructure> other)
{
if (keyId == null) {
throw new NullPointerException("keyId cannot be null");
@@ -118,14 +119,14 @@ public final class DOMPGPData extends DO
if (other == null || other.isEmpty()) {
this.externalElements = Collections.emptyList();
} else {
- List<XMLStructure> otherCopy = new ArrayList<XMLStructure>(other);
- for (int i = 0, size = otherCopy.size(); i < size; i++) {
- if (!(otherCopy.get(i) instanceof XMLStructure)) {
+ this.externalElements =
+ Collections.unmodifiableList(new ArrayList<XMLStructure>(other));
+ for (int i = 0, size = this.externalElements.size(); i < size; i++) {
+ if (!(this.externalElements.get(i) instanceof XMLStructure)) {
throw new ClassCastException
("other["+i+"] is not a valid PGPData type");
}
}
- this.externalElements = Collections.unmodifiableList(otherCopy);
}
this.keyId = (byte[])keyId.clone();
this.keyPacket = keyPacket == null ? null
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java?rev=1203846&r1=1203845&r2=1203846&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java Fri Nov 18 21:18:17 2011
@@ -79,7 +79,7 @@ public final class DOMRetrievalMethod ex
* entries that are not of type {@link Transform}
*/
public DOMRetrievalMethod(String uri, String type,
- List<Transform> transforms)
+ List<? extends Transform> transforms)
{
if (uri == null) {
throw new NullPointerException("uri cannot be null");
@@ -87,15 +87,14 @@ public final class DOMRetrievalMethod ex
if (transforms == null || transforms.isEmpty()) {
this.transforms = Collections.emptyList();
} else {
- List<Transform> transformsCopy =
- new ArrayList<Transform>(transforms);
- for (int i = 0, size = transformsCopy.size(); i < size; i++) {
- if (!(transformsCopy.get(i) instanceof Transform)) {
+ this.transforms = Collections.unmodifiableList(
+ new ArrayList<Transform>(transforms));
+ for (int i = 0, size = this.transforms.size(); i < size; i++) {
+ if (!(this.transforms.get(i) instanceof Transform)) {
throw new ClassCastException
("transforms["+i+"] is not a valid type");
}
}
- this.transforms = Collections.unmodifiableList(transformsCopy);
}
this.uri = uri;
if ((uri != null) && (!uri.equals(""))) {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMX509Data.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMX509Data.java?rev=1203846&r1=1203845&r2=1203846&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMX509Data.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMX509Data.java Fri Nov 18 21:18:17 2011
@@ -67,7 +67,7 @@ public final class DOMX509Data extends D
* @throws ClassCastException if <code>content</code> contains any entries
* that are not of one of the valid types mentioned above
*/
- public DOMX509Data(List<Object> content) {
+ public DOMX509Data(List<?> content) {
if (content == null) {
throw new NullPointerException("content cannot be null");
}
@@ -250,6 +250,7 @@ public final class DOMX509Data extends D
}
}
+ @Override
public boolean equals(Object o) {
if (this == o) {
return true;