diff --git a/make/com/sun/org/apache/xml/Makefile b/make/com/sun/org/apache/xml/Makefile index e0c25e9d2733a3878d40194a5fea129787646fa8..f00135d8d1ebbfefd46e74ca1f77de0437afb300 100644 --- a/make/com/sun/org/apache/xml/Makefile +++ b/make/com/sun/org/apache/xml/Makefile @@ -30,6 +30,8 @@ BUILDDIR = ../../../../.. PACKAGE = com.sun.org.apache.xml PRODUCT = xml +JAVAC_MAX_WARNINGS = true +JAVAC_WARNINGS_FATAL = true include $(BUILDDIR)/common/Defs.gmk # diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/Init.java b/src/share/classes/com/sun/org/apache/xml/internal/security/Init.java index 5b1acfd6aa23dfc7c8f65db3480fe851c38b74c9..308d517a2c47f6f4bb5091725ca1bebab0317604 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/Init.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/Init.java @@ -115,9 +115,9 @@ public final class Init { // provider mechanism instead if implementing their own // transform or canonicalization algorithms. // InputStream is = Class.forName("com.sun.org.apache.xml.internal.security.Init").getResourceAsStream("resource/config.xml"); - InputStream is = (InputStream) AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { + InputStream is = AccessController.doPrivileged( + new PrivilegedAction() { + public InputStream run() { // String cfile = System.getProperty // ("com.sun.org.apache.xml.internal.security.resource.config"); return getClass().getResourceAsStream diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java index 7a239135920e75b4ee92eef2dad536d653e2b009..030795ba3628f7e885e6446cef743eef893a346e 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java @@ -45,9 +45,9 @@ public class JCEMapper { - private static Map uriToJCEName; + private static Map uriToJCEName; - private static Map algorithmsMap; + private static Map algorithmsMap; private static String providerName = null; /** @@ -63,8 +63,8 @@ public class JCEMapper { static void loadAlgorithms( Element algorithmsEl) { Element[] algorithms = XMLUtils.selectNodes(algorithmsEl.getFirstChild(),Init.CONF_NS,"Algorithm"); - uriToJCEName = new HashMap( algorithms.length * 2); - algorithmsMap = new HashMap( algorithms.length * 2); + uriToJCEName = new HashMap( algorithms.length * 2); + algorithmsMap = new HashMap( algorithms.length * 2); for (int i = 0 ;i < algorithms.length ;i ++) { Element el = algorithms[i]; String id = el.getAttribute("URI"); @@ -76,7 +76,7 @@ public class JCEMapper { } static Algorithm getAlgorithmMapping(String algoURI) { - return ((Algorithm)algorithmsMap.get(algoURI)); + return algorithmsMap.get(algoURI); } /** @@ -90,7 +90,7 @@ public class JCEMapper { if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Request for URI " + AlgorithmURI); - String jceName = (String) uriToJCEName.get(AlgorithmURI); + String jceName = uriToJCEName.get(AlgorithmURI); return jceName; } @@ -106,7 +106,7 @@ public class JCEMapper { if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Request for URI " + AlgorithmURI); - return ((Algorithm) algorithmsMap.get(AlgorithmURI)).algorithmClass; + return (algorithmsMap.get(AlgorithmURI)).algorithmClass; } /** @@ -116,7 +116,7 @@ public class JCEMapper { * @return The length of the key used in the alogrithm */ public static int getKeyLengthFromURI(String AlgorithmURI) { - return Integer.parseInt(((Algorithm) algorithmsMap.get(AlgorithmURI)).keyLength); + return Integer.parseInt((algorithmsMap.get(AlgorithmURI)).keyLength); } /** @@ -128,7 +128,7 @@ public class JCEMapper { */ public static String getJCEKeyAlgorithmFromURI(String AlgorithmURI) { - return ((Algorithm) algorithmsMap.get(AlgorithmURI)).requiredKey; + return (algorithmsMap.get(AlgorithmURI)).requiredKey; } diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/MessageDigestAlgorithm.java b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/MessageDigestAlgorithm.java index fa62ef3518f750316b7bb817335a8c5d49b3d3f4..63a808ba74542058b5f209eeb6e0824b3acee21a 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/MessageDigestAlgorithm.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/MessageDigestAlgorithm.java @@ -71,9 +71,10 @@ public class MessageDigestAlgorithm extends Algorithm { this.algorithm = messageDigest; } - static ThreadLocal instances=new ThreadLocal() { - protected Object initialValue() { - return new HashMap(); + static ThreadLocal> instances=new + ThreadLocal>() { + protected Map initialValue() { + return new HashMap(); }; }; @@ -92,7 +93,7 @@ public class MessageDigestAlgorithm extends Algorithm { } private static MessageDigest getDigestInstance(String algorithmURI) throws XMLSignatureException { - MessageDigest result=(MessageDigest) ((Map)instances.get()).get(algorithmURI); + MessageDigest result= instances.get().get(algorithmURI); if (result!=null) return result; String algorithmID = JCEMapper.translateURItoJCEID(algorithmURI); @@ -121,7 +122,7 @@ private static MessageDigest getDigestInstance(String algorithmURI) throws XMLSi throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs); } - ((Map)instances.get()).put(algorithmURI, md); + instances.get().put(algorithmURI, md); return md; } diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java index 567df3cbbd12c6fd17f8a944ec23e8c410e349ec..24fd47e0a2d33968b71983fb79cbd924f0923e76 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java @@ -51,28 +51,28 @@ public class SignatureAlgorithm extends Algorithm { static boolean _alreadyInitialized = false; /** All available algorithm classes are registered here */ - static HashMap _algorithmHash = null; + static Map> _algorithmHash = null; - static ThreadLocal instancesSigning=new ThreadLocal() { - protected Object initialValue() { - return new HashMap(); + static ThreadLocal> instancesSigning=new ThreadLocal>() { + protected Map initialValue() { + return new HashMap(); }; }; - static ThreadLocal instancesVerify=new ThreadLocal() { - protected Object initialValue() { - return new HashMap(); + static ThreadLocal> instancesVerify=new ThreadLocal>() { + protected Map initialValue() { + return new HashMap(); }; }; - static ThreadLocal keysSigning=new ThreadLocal() { - protected Object initialValue() { - return new HashMap(); + static ThreadLocal> keysSigning=new ThreadLocal>() { + protected Map initialValue() { + return new HashMap(); }; }; - static ThreadLocal keysVerify=new ThreadLocal() { - protected Object initialValue() { - return new HashMap(); + static ThreadLocal> keysVerify=new ThreadLocal>() { + protected Map initialValue() { + return new HashMap(); }; }; // boolean isForSigning=false; @@ -105,34 +105,34 @@ public class SignatureAlgorithm extends Algorithm { .engineGetContextFromElement(this._constructionElement); } private static SignatureAlgorithmSpi getInstanceForSigning(String algorithmURI) throws XMLSignatureException { - SignatureAlgorithmSpi result=(SignatureAlgorithmSpi) ((Map)instancesSigning.get()).get(algorithmURI); + SignatureAlgorithmSpi result= instancesSigning.get().get(algorithmURI); if (result!=null) { result.reset(); return result; } result=buildSigner(algorithmURI, result); - ((Map)instancesSigning.get()).put(algorithmURI,result); + instancesSigning.get().put(algorithmURI,result); return result; } private static SignatureAlgorithmSpi getInstanceForVerify(String algorithmURI) throws XMLSignatureException { - SignatureAlgorithmSpi result=(SignatureAlgorithmSpi) ((Map)instancesVerify.get()).get(algorithmURI); + SignatureAlgorithmSpi result= instancesVerify.get().get(algorithmURI); if (result!=null) { result.reset(); return result; } result=buildSigner(algorithmURI, result); - ((Map)instancesVerify.get()).put(algorithmURI,result); + instancesVerify.get().put(algorithmURI,result); return result; } private static SignatureAlgorithmSpi buildSigner(String algorithmURI, SignatureAlgorithmSpi result) throws XMLSignatureException { try { - Class implementingClass = + Class implementingClass = SignatureAlgorithm.getImplementingClass(algorithmURI); if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Create URI \"" + algorithmURI + "\" class \"" + implementingClass + "\""); - result=(SignatureAlgorithmSpi) implementingClass.newInstance(); + result= implementingClass.newInstance(); return result; } catch (IllegalAccessException ex) { Object exArgs[] = { algorithmURI, ex.getMessage() }; @@ -270,7 +270,7 @@ public class SignatureAlgorithm extends Algorithm { */ public void initSign(Key signingKey) throws XMLSignatureException { initializeAlgorithm(true); - Map map=(Map)keysSigning.get(); + Map map=keysSigning.get(); if (map.get(this.algorithmURI)==signingKey) { return; } @@ -329,7 +329,7 @@ public class SignatureAlgorithm extends Algorithm { */ public void initVerify(Key verificationKey) throws XMLSignatureException { initializeAlgorithm(false); - Map map=(Map)keysVerify.get(); + Map map=keysVerify.get(); if (map.get(this.algorithmURI)==verificationKey) { return; } @@ -375,7 +375,7 @@ public class SignatureAlgorithm extends Algorithm { log.log(java.util.logging.Level.FINE, "Init() called"); if (!SignatureAlgorithm._alreadyInitialized) { - SignatureAlgorithm._algorithmHash = new HashMap(10); + SignatureAlgorithm._algorithmHash = new HashMap>(10); SignatureAlgorithm._alreadyInitialized = true; } } @@ -388,6 +388,7 @@ public class SignatureAlgorithm extends Algorithm { * @throws AlgorithmAlreadyRegisteredException if specified algorithmURI is already registered * @throws XMLSignatureException */ + @SuppressWarnings("unchecked") public static void register(String algorithmURI, String implementingClass) throws AlgorithmAlreadyRegisteredException,XMLSignatureException { @@ -396,7 +397,7 @@ public class SignatureAlgorithm extends Algorithm { log.log(java.util.logging.Level.FINE, "Try to register " + algorithmURI + " " + implementingClass); // are we already registered? - Class registeredClassClass = + Class registeredClassClass = SignatureAlgorithm.getImplementingClass(algorithmURI); if (registeredClassClass!=null) { String registeredClass = registeredClassClass.getName(); @@ -409,7 +410,7 @@ public class SignatureAlgorithm extends Algorithm { } } try { - SignatureAlgorithm._algorithmHash.put(algorithmURI, Class.forName(implementingClass)); + SignatureAlgorithm._algorithmHash.put(algorithmURI, (Class )Class.forName(implementingClass)); } catch (ClassNotFoundException ex) { Object exArgs[] = { algorithmURI, ex.getMessage() }; @@ -431,13 +432,13 @@ public class SignatureAlgorithm extends Algorithm { * @param URI * @return the class that implements the URI */ - private static Class getImplementingClass(String URI) { + private static Class getImplementingClass(String URI) { if (SignatureAlgorithm._algorithmHash == null) { return null; } - return (Class) SignatureAlgorithm._algorithmHash.get(URI); + return SignatureAlgorithm._algorithmHash.get(URI); } /** diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/Canonicalizer.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/Canonicalizer.java index a4181233d6029ceaa3fb52b84574be5d5535b274..b435a988d511ea22219caecebc682882f1fd07a4 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/Canonicalizer.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/Canonicalizer.java @@ -28,6 +28,7 @@ import java.util.Set; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.xpath.XPath; import com.sun.org.apache.xml.internal.security.exceptions.AlgorithmAlreadyRegisteredException; import org.w3c.dom.Document; @@ -83,7 +84,7 @@ public class Canonicalizer { ALGO_ID_C14N11_OMIT_COMMENTS + "#WithComments"; static boolean _alreadyInitialized = false; - static Map _canonicalizerHash = null; + static Map> _canonicalizerHash = null; protected CanonicalizerSpi canonicalizerSpi = null; @@ -94,7 +95,7 @@ public class Canonicalizer { public static void init() { if (!Canonicalizer._alreadyInitialized) { - Canonicalizer._canonicalizerHash = new HashMap(10); + Canonicalizer._canonicalizerHash = new HashMap>(10); Canonicalizer._alreadyInitialized = true; } } @@ -109,10 +110,11 @@ public class Canonicalizer { throws InvalidCanonicalizerException { try { - Class implementingClass = getImplementingClass(algorithmURI); + Class implementingClass = + getImplementingClass(algorithmURI); this.canonicalizerSpi = - (CanonicalizerSpi) implementingClass.newInstance(); + implementingClass.newInstance(); this.canonicalizerSpi.reset=true; } catch (Exception e) { Object exArgs[] = { algorithmURI }; @@ -144,11 +146,12 @@ public class Canonicalizer { * @param implementingClass * @throws AlgorithmAlreadyRegisteredException */ + @SuppressWarnings("unchecked") public static void register(String algorithmURI, String implementingClass) throws AlgorithmAlreadyRegisteredException { // check whether URI is already registered - Class registeredClass = getImplementingClass(algorithmURI); + Class registeredClass = getImplementingClass(algorithmURI); if (registeredClass != null) { Object exArgs[] = { algorithmURI, registeredClass }; @@ -158,7 +161,7 @@ public class Canonicalizer { } try { - _canonicalizerHash.put(algorithmURI, Class.forName(implementingClass)); + _canonicalizerHash.put(algorithmURI, (Class) Class.forName(implementingClass)); } catch (ClassNotFoundException e) { throw new RuntimeException("c14n class not found"); } @@ -304,7 +307,7 @@ public class Canonicalizer { * @return the result of the c14n. * @throws CanonicalizationException */ - public byte[] canonicalizeXPathNodeSet(Set xpathNodeSet) + public byte[] canonicalizeXPathNodeSet(Set xpathNodeSet) throws CanonicalizationException { return this.canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet); } @@ -317,7 +320,7 @@ public class Canonicalizer { * @return the result of the c14n. * @throws CanonicalizationException */ - public byte[] canonicalizeXPathNodeSet(Set xpathNodeSet, + public byte[] canonicalizeXPathNodeSet(Set xpathNodeSet, String inclusiveNamespaces) throws CanonicalizationException { return this.canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet, inclusiveNamespaces); @@ -347,8 +350,8 @@ public class Canonicalizer { * @param URI * @return the name of the class that implements the given URI */ - private static Class getImplementingClass(String URI) { - return (Class) _canonicalizerHash.get(URI); + private static Class getImplementingClass(String URI) { + return _canonicalizerHash.get(URI); } /** diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/CanonicalizerSpi.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/CanonicalizerSpi.java index e55b67c9f134c4c8eb4d25cb1385a72819e468dd..48294fe34e988a437ad86147b2b0c6fa7c4e7594 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/CanonicalizerSpi.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/CanonicalizerSpi.java @@ -28,6 +28,7 @@ import java.util.Set; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.xpath.XPath; import com.sun.org.apache.xml.internal.security.utils.XMLUtils; import org.w3c.dom.Document; @@ -151,7 +152,7 @@ public abstract class CanonicalizerSpi { * @return the c14n bytes * @throws CanonicalizationException */ - public abstract byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet) + public abstract byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet) throws CanonicalizationException; /** @@ -162,7 +163,7 @@ public abstract class CanonicalizerSpi { * @return the c14n bytes * @throws CanonicalizationException */ - public abstract byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet, String inclusiveNamespaces) + public abstract byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet, String inclusiveNamespaces) throws CanonicalizationException; /** diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/helper/AttrCompare.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/helper/AttrCompare.java index 802abda2862d10a033e43d2541c4f123ad623693..8675b673c720aba33dd777b957e3eb9937b50410 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/helper/AttrCompare.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/helper/AttrCompare.java @@ -41,7 +41,7 @@ import java.util.Comparator; * * @author Christian Geuer-Pollmann */ -public class AttrCompare implements Comparator, Serializable { +public class AttrCompare implements Comparator, Serializable { private final static long serialVersionUID = -7113259629930576230L; private final static int ATTR0_BEFORE_ATTR1 = -1; @@ -62,16 +62,14 @@ public class AttrCompare implements Comparator, Serializable { * key (an empty namespace URI is lexicographically least). * * - * @param obj0 casted Attr - * @param obj1 casted Attr + * @param attr0 + * @param attr1 * @return returns a negative integer, zero, or a positive integer as * obj0 is less than, equal to, or greater than obj1 * */ - public int compare(Object obj0, Object obj1) { + public int compare(Attr attr0, Attr attr1) { - Attr attr0 = (Attr) obj0; - Attr attr1 = (Attr) obj1; String namespaceURI0 = attr0.getNamespaceURI(); String namespaceURI1 = attr1.getNamespaceURI(); diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer11.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer11.java index 4790fd890432a907e8c04e470b6aa4106f986cf9..e0a46963aced0965356d3946a2d7be3b6765aaeb 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer11.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer11.java @@ -25,6 +25,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Collection; +import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -33,6 +34,7 @@ import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import javax.xml.parsers.ParserConfigurationException; +import javax.xml.xpath.XPath; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -59,7 +61,7 @@ import com.sun.org.apache.xml.internal.security.utils.XMLUtils; */ public abstract class Canonicalizer11 extends CanonicalizerBase { boolean firstCall = true; - final SortedSet result = new TreeSet(COMPARE); + final SortedSet result = new TreeSet(COMPARE); static final String XMLNS_URI = Constants.NamespaceSpecNS; static final String XML_LANG_URI = Constants.XML_LANG_SPACE_SpecNS; @@ -72,9 +74,9 @@ public abstract class Canonicalizer11 extends CanonicalizerBase { static class XmlsStackElement { int level; boolean rendered = false; - List nodes = new ArrayList(); + List nodes = new ArrayList(); }; - List levels = new ArrayList(); + List levels = new ArrayList(); void push(int level) { currentLevel = level; if (currentLevel == -1) @@ -86,7 +88,7 @@ public abstract class Canonicalizer11 extends CanonicalizerBase { lastlevel = 0; return; } - lastlevel=((XmlsStackElement)levels.get(levels.size()-1)).level; + lastlevel=(levels.get(levels.size()-1)).level; } } void addXmlnsAttr(Attr n) { @@ -98,7 +100,7 @@ public abstract class Canonicalizer11 extends CanonicalizerBase { } cur.nodes.add(n); } - void getXmlnsAttr(Collection col) { + void getXmlnsAttr(Collection col) { if (cur == null) { cur = new XmlsStackElement(); cur.level = currentLevel; @@ -111,7 +113,7 @@ public abstract class Canonicalizer11 extends CanonicalizerBase { if (size == -1) { parentRendered = true; } else { - e = (XmlsStackElement) levels.get(size); + e = levels.get(size); if (e.rendered && e.level+1 == currentLevel) parentRendered = true; } @@ -121,17 +123,17 @@ public abstract class Canonicalizer11 extends CanonicalizerBase { return; } - Map loa = new HashMap(); - List baseAttrs = new ArrayList(); + Map loa = new HashMap(); + List baseAttrs = new ArrayList(); boolean successiveOmitted = true; for (;size>=0;size--) { - e = (XmlsStackElement) levels.get(size); + e = levels.get(size); if (e.rendered) { successiveOmitted = false; } - Iterator it = e.nodes.iterator(); + Iterator it = e.nodes.iterator(); while (it.hasNext() && successiveOmitted) { - Attr n = (Attr) it.next(); + Attr n = it.next(); if (n.getLocalName().equals("base")) { if (!e.rendered) { baseAttrs.add(n); @@ -141,11 +143,11 @@ public abstract class Canonicalizer11 extends CanonicalizerBase { } } if (!baseAttrs.isEmpty()) { - Iterator it = cur.nodes.iterator(); + Iterator it = cur.nodes.iterator(); String base = null; Attr baseAttr = null; while (it.hasNext()) { - Attr n = (Attr) it.next(); + Attr n = it.next(); if (n.getLocalName().equals("base")) { base = n.getValue(); baseAttr = n; @@ -154,7 +156,7 @@ public abstract class Canonicalizer11 extends CanonicalizerBase { } it = baseAttrs.iterator(); while (it.hasNext()) { - Attr n = (Attr) it.next(); + Attr n = it.next(); if (base == null) { base = n.getValue(); baseAttr = n; @@ -202,13 +204,13 @@ public abstract class Canonicalizer11 extends CanonicalizerBase { * @return the Attr[]s to be outputted * @throws CanonicalizationException */ - Iterator handleAttributesSubtree(Element E, NameSpaceSymbTable ns) + Iterator handleAttributesSubtree(Element E, NameSpaceSymbTable ns) throws CanonicalizationException { if (!E.hasAttributes() && !firstCall) { return null; } // result will contain the attrs which have to be outputted - final SortedSet result = this.result; + final SortedSet result = this.result; result.clear(); NamedNodeMap attrs = E.getAttributes(); int attrsLength = attrs.getLength(); @@ -236,7 +238,7 @@ public abstract class Canonicalizer11 extends CanonicalizerBase { if (n != null) { // Render the ns definition - result.add(n); + result.add((Attr)n); if (C14nHelper.namespaceIsRelative(N)) { Object exArgs[] = {E.getTagName(), NName, N.getNodeValue()}; throw new CanonicalizationException( @@ -251,13 +253,15 @@ public abstract class Canonicalizer11 extends CanonicalizerBase { // to the output. ns.getUnrenderedNodes(result); // output the attributes in the xml namespace. - xmlattrStack.getXmlnsAttr(result); + xmlattrStack.getXmlnsAttr(getSortedSetAsCollection(result)); firstCall = false; } return result.iterator(); } + + /** * Returns the Attr[]s to be outputted for the given element. *
@@ -271,7 +275,7 @@ public abstract class Canonicalizer11 extends CanonicalizerBase { * @return the Attr[]s to be outputted * @throws CanonicalizationException */ - Iterator handleAttributes(Element E, NameSpaceSymbTable ns) + Iterator handleAttributes(Element E, NameSpaceSymbTable ns) throws CanonicalizationException { // result will contain the attrs which have to be output xmlattrStack.push(ns.getLevel()); @@ -283,11 +287,11 @@ public abstract class Canonicalizer11 extends CanonicalizerBase { attrsLength = attrs.getLength(); } - SortedSet result = this.result; + SortedSet result = this.result; result.clear(); for (int i = 0; i < attrsLength; i++) { - Attr N = (Attr) attrs.item(i); + Attr N = (Attr)attrs.item(i); String NUri = N.getNamespaceURI(); if (XMLNS_URI != NUri) { @@ -332,7 +336,7 @@ public abstract class Canonicalizer11 extends CanonicalizerBase { // (NName, NValue, N, isRealVisible); Node n = ns.addMappingAndRender(NName, NValue, N); if (n != null) { - result.add(n); + result.add((Attr)n); if (C14nHelper.namespaceIsRelative(N)) { Object exArgs[] = { E.getTagName(), NName, N.getNodeValue() }; @@ -362,7 +366,7 @@ public abstract class Canonicalizer11 extends CanonicalizerBase { } // output the xmlns def if needed. if (n != null) { - result.add(n); + result.add((Attr)n); } // Float all xml:* attributes of the unselected parent elements to // this one. addXmlAttributes(E,result); @@ -381,7 +385,7 @@ public abstract class Canonicalizer11 extends CanonicalizerBase { * @return none it always fails * @throws CanonicalizationException always */ - public byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet, + public byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet, String inclusiveNamespaces) throws CanonicalizationException { throw new CanonicalizationException( "c14n.Canonicalizer.UnsupportedOperation"); diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315.java index 541c2d63c99574da4cd210b2d61d7d4479f3a57f..b0b2e0b729c54abf56aa2f369d61ec3144cef686 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315.java @@ -57,7 +57,7 @@ import org.xml.sax.SAXException; */ public abstract class Canonicalizer20010315 extends CanonicalizerBase { boolean firstCall=true; - final SortedSet result= new TreeSet(COMPARE); + final SortedSet result= new TreeSet(COMPARE); static final String XMLNS_URI=Constants.NamespaceSpecNS; static final String XML_LANG_URI=Constants.XML_LANG_SPACE_SpecNS; static class XmlAttrStack { @@ -67,9 +67,9 @@ public abstract class Canonicalizer20010315 extends CanonicalizerBase { static class XmlsStackElement { int level; boolean rendered=false; - List nodes=new ArrayList(); + List nodes=new ArrayList(); }; - List levels=new ArrayList(); + List levels=new ArrayList(); void push(int level) { currentLevel=level; if (currentLevel==-1) @@ -81,7 +81,7 @@ public abstract class Canonicalizer20010315 extends CanonicalizerBase { lastlevel=0; return; } - lastlevel=((XmlsStackElement)levels.get(levels.size()-1)).level; + lastlevel=(levels.get(levels.size()-1)).level; } } void addXmlnsAttr(Attr n) { @@ -93,7 +93,7 @@ public abstract class Canonicalizer20010315 extends CanonicalizerBase { } cur.nodes.add(n); } - void getXmlnsAttr(Collection col) { + void getXmlnsAttr(Collection col) { int size=levels.size()-1; if (cur==null) { cur=new XmlsStackElement(); @@ -106,7 +106,7 @@ public abstract class Canonicalizer20010315 extends CanonicalizerBase { if (size==-1) { parentRendered=true; } else { - e=(XmlsStackElement)levels.get(size); + e=levels.get(size); if (e.rendered && e.level+1==currentLevel) parentRendered=true; @@ -117,12 +117,12 @@ public abstract class Canonicalizer20010315 extends CanonicalizerBase { return; } - Map loa = new HashMap(); + Map loa = new HashMap(); for (;size>=0;size--) { - e=(XmlsStackElement)levels.get(size); - Iterator it=e.nodes.iterator(); + e=levels.get(size); + Iterator it=e.nodes.iterator(); while (it.hasNext()) { - Attr n=(Attr)it.next(); + Attr n=it.next(); if (!loa.containsKey(n.getName())) loa.put(n.getName(),n); } @@ -161,13 +161,13 @@ public abstract class Canonicalizer20010315 extends CanonicalizerBase { * @return the Attr[]s to be outputted * @throws CanonicalizationException */ - Iterator handleAttributesSubtree(Element E, NameSpaceSymbTable ns ) + Iterator handleAttributesSubtree(Element E, NameSpaceSymbTable ns ) throws CanonicalizationException { if (!E.hasAttributes() && !firstCall) { return null; } // result will contain the attrs which have to be outputted - final SortedSet result = this.result; + final SortedSet result = this.result; result.clear(); NamedNodeMap attrs = E.getAttributes(); int attrsLength = attrs.getLength(); @@ -194,7 +194,7 @@ public abstract class Canonicalizer20010315 extends CanonicalizerBase { if (n!=null) { //Render the ns definition - result.add(n); + result.add((Attr)n); if (C14nHelper.namespaceIsRelative(N)) { Object exArgs[] = { E.getTagName(), NName, N.getNodeValue() }; throw new CanonicalizationException( @@ -206,7 +206,7 @@ public abstract class Canonicalizer20010315 extends CanonicalizerBase { if (firstCall) { //It is the first node of the subtree //Obtain all the namespaces defined in the parents, and added to the output. - ns.getUnrenderedNodes(result); + ns.getUnrenderedNodes(getSortedSetAsCollection(result)); //output the attributes in the xml namespace. xmlattrStack.getXmlnsAttr(result); firstCall=false; @@ -227,7 +227,7 @@ public abstract class Canonicalizer20010315 extends CanonicalizerBase { * @return the Attr[]s to be outputted * @throws CanonicalizationException */ - Iterator handleAttributes(Element E, NameSpaceSymbTable ns ) throws CanonicalizationException { + Iterator handleAttributes(Element E, NameSpaceSymbTable ns ) throws CanonicalizationException { // result will contain the attrs which have to be outputted xmlattrStack.push(ns.getLevel()); boolean isRealVisible=isVisibleDO(E,ns.getLevel())==1; @@ -239,7 +239,7 @@ public abstract class Canonicalizer20010315 extends CanonicalizerBase { } - SortedSet result = this.result; + SortedSet result = this.result; result.clear(); for (int i = 0; i < attrsLength; i++) { @@ -277,7 +277,7 @@ public abstract class Canonicalizer20010315 extends CanonicalizerBase { //Node n=ns.addMappingAndRenderXNodeSet(NName,NValue,N,isRealVisible); Node n=ns.addMappingAndRender(NName,NValue,N); if (n!=null) { - result.add(n); + result.add((Attr)n); if (C14nHelper.namespaceIsRelative(N)) { Object exArgs[] = { E.getTagName(), NName, N.getNodeValue() }; throw new CanonicalizationException( @@ -306,12 +306,12 @@ public abstract class Canonicalizer20010315 extends CanonicalizerBase { } //output the xmlns def if needed. if (n!=null) { - result.add(n); + result.add((Attr)n); } //Float all xml:* attributes of the unselected parent elements to this one. //addXmlAttributes(E,result); xmlattrStack.getXmlnsAttr(result); - ns.getUnrenderedNodes(result); + ns.getUnrenderedNodes(getSortedSetAsCollection(result)); } @@ -325,7 +325,7 @@ public abstract class Canonicalizer20010315 extends CanonicalizerBase { * @return none it always fails * @throws CanonicalizationException always */ - public byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet, String inclusiveNamespaces) + public byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet, String inclusiveNamespaces) throws CanonicalizationException { /** $todo$ well, should we throw UnsupportedOperationException ? */ diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315Excl.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315Excl.java index 679c7b5088b7ca62547ca329e33a354d0f5f9015..9dec09b4588c69bea3aa545fc18ad00fe86b24db 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315Excl.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315Excl.java @@ -61,9 +61,9 @@ public abstract class Canonicalizer20010315Excl extends CanonicalizerBase { * This Set contains the names (Strings like "xmlns" or "xmlns:foo") of * the inclusive namespaces. */ - TreeSet _inclusiveNSSet = new TreeSet(); + TreeSet _inclusiveNSSet = new TreeSet(); static final String XMLNS_URI=Constants.NamespaceSpecNS; - final SortedSet result = new TreeSet(COMPARE); + final SortedSet result = new TreeSet(COMPARE); /** * Constructor Canonicalizer20010315Excl * @@ -106,8 +106,7 @@ public abstract class Canonicalizer20010315Excl extends CanonicalizerBase { */ public byte[] engineCanonicalizeSubTree(Node rootNode, String inclusiveNamespaces,Node excl) throws CanonicalizationException { - this._inclusiveNSSet = (TreeSet)InclusiveNamespaces - .prefixStr2Set(inclusiveNamespaces); + this._inclusiveNSSet = getInclusiveNameSpace(inclusiveNamespaces); return super.engineCanonicalizeSubTree(rootNode,excl); } /** @@ -117,10 +116,10 @@ public abstract class Canonicalizer20010315Excl extends CanonicalizerBase { * @return the rootNode c14n. * @throws CanonicalizationException */ + @SuppressWarnings("unchecked") public byte[] engineCanonicalize(XMLSignatureInput rootNode, String inclusiveNamespaces) throws CanonicalizationException { - this._inclusiveNSSet = (TreeSet)InclusiveNamespaces - .prefixStr2Set(inclusiveNamespaces); + this._inclusiveNSSet = getInclusiveNameSpace(inclusiveNamespaces); return super.engineCanonicalize(rootNode); } @@ -130,12 +129,12 @@ public abstract class Canonicalizer20010315Excl extends CanonicalizerBase { * @param E * @throws CanonicalizationException */ - Iterator handleAttributesSubtree(Element E,NameSpaceSymbTable ns) + Iterator handleAttributesSubtree(Element E,NameSpaceSymbTable ns) throws CanonicalizationException { // System.out.println("During the traversal, I encountered " + // XMLUtils.getXPath(E)); // result will contain the attrs which have to be outputted - SortedSet result = this.result; + SortedSet result = this.result; result.clear(); NamedNodeMap attrs=null; @@ -145,7 +144,7 @@ public abstract class Canonicalizer20010315Excl extends CanonicalizerBase { attrsLength = attrs.getLength(); } //The prefix visibly utilized(in the attribute or in the name) in the element - SortedSet visiblyUtilized =(SortedSet) _inclusiveNSSet.clone(); + SortedSet visiblyUtilized = getNSSetClone(); for (int i = 0; i < attrsLength; i++) { Attr N = (Attr) attrs.item(i); @@ -187,9 +186,9 @@ public abstract class Canonicalizer20010315Excl extends CanonicalizerBase { visiblyUtilized.add(prefix); //This can be optimezed by I don't have time - Iterator it=visiblyUtilized.iterator(); + Iterator it=visiblyUtilized.iterator(); while (it.hasNext()) { - String s=(String)it.next(); + String s=it.next(); Attr key=ns.getMapping(s); if (key==null) { continue; @@ -207,25 +206,35 @@ public abstract class Canonicalizer20010315Excl extends CanonicalizerBase { * @param inclusiveNamespaces * @throws CanonicalizationException */ - public byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet, + public byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet, String inclusiveNamespaces) throws CanonicalizationException { - - this._inclusiveNSSet = (TreeSet)InclusiveNamespaces - .prefixStr2Set(inclusiveNamespaces); + this._inclusiveNSSet = getInclusiveNameSpace(inclusiveNamespaces); return super.engineCanonicalizeXPathNodeSet(xpathNodeSet); } + @SuppressWarnings("unchecked") + private TreeSet getInclusiveNameSpace(String inclusiveNameSpaces) { + return (TreeSet)InclusiveNamespaces.prefixStr2Set(inclusiveNameSpaces); + } + + + @SuppressWarnings("unchecked") + private SortedSet getNSSetClone() { + return (SortedSet) this._inclusiveNSSet.clone(); + } + + /** * @inheritDoc * @param E * @throws CanonicalizationException */ - final Iterator handleAttributes(Element E, NameSpaceSymbTable ns) + final Iterator handleAttributes(Element E, NameSpaceSymbTable ns) throws CanonicalizationException { // result will contain the attrs which have to be outputted - SortedSet result = this.result; + SortedSet result = this.result; result.clear(); NamedNodeMap attrs = null; int attrsLength = 0; @@ -234,11 +243,11 @@ public abstract class Canonicalizer20010315Excl extends CanonicalizerBase { attrsLength = attrs.getLength(); } //The prefix visibly utilized(in the attribute or in the name) in the element - Set visiblyUtilized =null; + Set visiblyUtilized =null; //It's the output selected. boolean isOutputElement=isVisibleDO(E,ns.getLevel())==1; if (isOutputElement) { - visiblyUtilized = (Set) this._inclusiveNSSet.clone(); + visiblyUtilized = getNSSetClone(); } for (int i = 0; i < attrsLength; i++) { @@ -272,7 +281,7 @@ public abstract class Canonicalizer20010315Excl extends CanonicalizerBase { if (!isOutputElement && isVisible(N) && _inclusiveNSSet.contains(NName) && !ns.removeMappingIfRender(NName)) { Node n=ns.addMappingAndRender(NName,NNodeValue,N); if (n!=null) { - result.add(n); + result.add((Attr)n); if (C14nHelper.namespaceIsRelative(N)) { Object exArgs[] = { E.getTagName(), NName, N.getNodeValue() }; throw new CanonicalizationException( @@ -315,9 +324,9 @@ public abstract class Canonicalizer20010315Excl extends CanonicalizerBase { } //This can be optimezed by I don't have time //visiblyUtilized.addAll(this._inclusiveNSSet); - Iterator it=visiblyUtilized.iterator(); + Iterator it=visiblyUtilized.iterator(); while (it.hasNext()) { - String s=(String)it.next(); + String s=it.next(); Attr key=ns.getMapping(s); if (key==null) { continue; diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/CanonicalizerBase.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/CanonicalizerBase.java index 05f22d8c1e8cc6573a74fb3c6b204c49bcd6413e..77024c23403e7703f4af64bedcee83270424be8b 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/CanonicalizerBase.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/CanonicalizerBase.java @@ -33,9 +33,12 @@ import java.util.List; import java.util.ListIterator; import java.util.Map; import java.util.Set; +import java.util.SortedSet; +import java.util.Collection; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import javax.xml.xpath.XPath; import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException; import com.sun.org.apache.xml.internal.security.c14n.CanonicalizerSpi; @@ -94,10 +97,10 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi { } } - List nodeFilter; + List nodeFilter; boolean _includeComments; - Set _xpathNodeSet = null; + Set _xpathNodeSet = null; /** * The node to be skiped/excluded from the DOM tree * in subtree canonicalizations. @@ -130,7 +133,7 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi { * @param xpathNodeSet * @throws CanonicalizationException */ - public byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet) + public byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet) throws CanonicalizationException { this._xpathNodeSet = xpathNodeSet; return engineCanonicalizeXPathNodeSetInternal(XMLUtils.getOwnerDocument(this._xpathNodeSet)); @@ -251,7 +254,7 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi { final OutputStream writer=this._writer; final Node excludeNode=this._excludeNode; final boolean includeComments=this._includeComments; - Map cache=new HashMap(); + Map cache=new HashMap(); do { switch (currentNode.getNodeType()) { @@ -298,11 +301,11 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi { String name=currentElement.getTagName(); UtfHelpper.writeByte(name,writer,cache); - Iterator attrs = this.handleAttributesSubtree(currentElement,ns); + Iterator attrs = this.handleAttributesSubtree(currentElement,ns); if (attrs!=null) { //we output all Attrs which are available while (attrs.hasNext()) { - Attr attr = (Attr) attrs.next(); + Attr attr = attrs.next(); outputAttrToWriter(attr.getNodeName(),attr.getNodeValue(), writer,cache); } } @@ -394,7 +397,7 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi { Node parentNode=null; OutputStream writer=this._writer; int documentLevel=NODE_BEFORE_DOCUMENT_ELEMENT; - Map cache=new HashMap(); + Map cache=new HashMap(); do { switch (currentNode.getNodeType()) { @@ -464,11 +467,11 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi { ns.push(); } - Iterator attrs = handleAttributes(currentElement,ns); + Iterator attrs = handleAttributes(currentElement,ns); if (attrs!=null) { //we output all Attrs which are available while (attrs.hasNext()) { - Attr attr = (Attr) attrs.next(); + Attr attr = attrs.next(); outputAttrToWriter(attr.getNodeName(),attr.getNodeValue(), writer,cache); } } @@ -522,9 +525,9 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi { } int isVisibleDO(Node currentNode,int level) { if (nodeFilter!=null) { - Iterator it=nodeFilter.iterator(); + Iterator it=nodeFilter.iterator(); while (it.hasNext()) { - int i=((NodeFilter)it.next()).isNodeIncludeDO(currentNode,level); + int i=(it.next()).isNodeIncludeDO(currentNode,level); if (i!=1) return i; } @@ -535,9 +538,9 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi { } int isVisibleInt(Node currentNode) { if (nodeFilter!=null) { - Iterator it=nodeFilter.iterator(); + Iterator it=nodeFilter.iterator(); while (it.hasNext()) { - int i=((NodeFilter)it.next()).isNodeInclude(currentNode); + int i=(it.next()).isNodeInclude(currentNode); if (i!=1) return i; } @@ -549,9 +552,9 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi { boolean isVisible(Node currentNode) { if (nodeFilter!=null) { - Iterator it=nodeFilter.iterator(); + Iterator it=nodeFilter.iterator(); while (it.hasNext()) { - if (((NodeFilter)it.next()).isNodeInclude(currentNode)!=1) + if ((it.next()).isNodeInclude(currentNode)!=1) return false; } } @@ -589,7 +592,7 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi { * @param ns */ final void getParentNameSpaces(Element el,NameSpaceSymbTable ns) { - List parents=new ArrayList(10); + List parents=new ArrayList(10); Node n1=el.getParentNode(); if (!(n1 instanceof Element)) { return; @@ -605,9 +608,9 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi { parent=(Element)n; } //Visit them in reverse order. - ListIterator it=parents.listIterator(parents.size()); + ListIterator it=parents.listIterator(parents.size()); while (it.hasPrevious()) { - Element ele=(Element)it.previous(); + Element ele=it.previous(); handleParent(ele, ns); } Attr nsprefix; @@ -624,7 +627,7 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi { * @return the attributes nodes to output. * @throws CanonicalizationException */ - abstract Iterator handleAttributes(Element E, NameSpaceSymbTable ns ) + abstract Iterator handleAttributes(Element E, NameSpaceSymbTable ns ) throws CanonicalizationException; /** @@ -635,7 +638,7 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi { * @return the attributes nodes to output. * @throws CanonicalizationException */ - abstract Iterator handleAttributesSubtree(Element E, NameSpaceSymbTable ns) + abstract Iterator handleAttributesSubtree(Element E, NameSpaceSymbTable ns) throws CanonicalizationException; abstract void circumventBugIfNeeded(XMLSignatureInput input) throws CanonicalizationException, ParserConfigurationException, IOException, SAXException; @@ -660,7 +663,7 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi { * @throws IOException */ static final void outputAttrToWriter(final String name, final String value, final OutputStream writer, - final Map cache) throws IOException { + final Map cache) throws IOException { writer.write(' '); UtfHelpper.writeByte(name,writer,cache); writer.write(equalsStr); @@ -841,4 +844,10 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi { } } + @SuppressWarnings("unchecked") + protected Collection getSortedSetAsCollection(SortedSet result) { + return (Collection)(Collection)result; + } + + } diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/NameSpaceSymbTable.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/NameSpaceSymbTable.java index 538d369748c0da7e07d1d7d8bc97ec2b17d177b6..114bf7e0a86ef37b068f4a3d5785f93a9af277ff 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/NameSpaceSymbTable.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/NameSpaceSymbTable.java @@ -44,7 +44,7 @@ public class NameSpaceSymbTable { /**The level of nameSpaces (for Inclusive visibility).*/ int nameSpaces=0; /**The stacks for removing the definitions when doing pop.*/ - List level; + List level; boolean cloned=true; static final String XMLNS="xmlns"; final static SymbMap initialMap=new SymbMap(); @@ -57,7 +57,7 @@ public class NameSpaceSymbTable { * Default constractor **/ public NameSpaceSymbTable() { - level = new ArrayList(10); + level = new ArrayList(10); //Insert the default binding for xmlns. symb=(SymbMap) initialMap.clone(); } @@ -67,11 +67,11 @@ public class NameSpaceSymbTable { * For Inclusive rendering * @param result the list where to fill the unrendered xmlns definitions. **/ - public void getUnrenderedNodes(Collection result) { + public void getUnrenderedNodes(Collection result) { //List result=new ArrayList(); - Iterator it=symb.entrySet().iterator(); + Iterator it=symb.entrySet().iterator(); while (it.hasNext()) { - NameSpaceSymbEntry n=(NameSpaceSymbEntry)(it.next()); + NameSpaceSymbEntry n= it.next(); //put them rendered? if ((!n.rendered) && (n.n!=null)) { n=(NameSpaceSymbEntry) n.clone(); @@ -339,8 +339,8 @@ class SymbMap implements Cloneable { } } - List entrySet() { - List a=new ArrayList(); + List entrySet() { + List a=new ArrayList(); for (int i=0;i cache) throws IOException { + byte []result= cache.get(str); if (result==null) { result=getStringInUtf8(str); cache.put(str,result); diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/AgreementMethod.java b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/AgreementMethod.java index 81a49b4a28dcce510e0913044779e2f168bbf60e..803fca8c65fff4054c7700fac4ac729eac8dc38d 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/AgreementMethod.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/AgreementMethod.java @@ -95,7 +95,7 @@ public interface AgreementMethod { * Returns aditional information regarding the AgreementMethod. * @return */ - Iterator getAgreementMethodInformation(); + Iterator getAgreementMethodInformation(); /** * Adds additional AgreementMethod information. diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionMethod.java b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionMethod.java index 7700f4537729d719c69df63d778427be87c8f2f3..2664db9ae94523c1c77bd5040654063329a32dad 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionMethod.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionMethod.java @@ -89,7 +89,7 @@ public interface EncryptionMethod { * @return an Iterator over all the additional infomation * about the EncryptionMethod. */ - Iterator getEncryptionMethodInformation(); + Iterator getEncryptionMethodInformation(); /** * Adds encryption method information. diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionProperties.java b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionProperties.java index 307a13425958e9158c0eaf2b987e9fa8c9678f83..da1eb65d255f743d23104d4f6e23a0b4fd9e2700 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionProperties.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionProperties.java @@ -67,7 +67,7 @@ public interface EncryptionProperties { * * @return an Iterator over all the encryption properties. */ - Iterator getEncryptionProperties(); + Iterator getEncryptionProperties(); /** * Adds an EncryptionProperty. diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionProperty.java b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionProperty.java index 9f614958f12d577e96d09d870980c327f9fbefaa..4cd6c4696cd3912d60792f5fa6de58244b14511d 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionProperty.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionProperty.java @@ -101,7 +101,7 @@ public interface EncryptionProperty { * @return an Iterator over all the addiitonal encryption * information contained in this class. */ - Iterator getEncryptionInformation(); + Iterator getEncryptionInformation(); /** * Adds encryption information. diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/Reference.java b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/Reference.java index 0039a4191c5ca57896e7389097e67ae48d4471b3..4523a895aaf03877667c7a5fa981e480402bba25 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/Reference.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/Reference.java @@ -74,7 +74,7 @@ public interface Reference { * * @return child elements. */ - Iterator getElementRetrievalInformation(); + Iterator getElementRetrievalInformation(); /** * Adds retrieval information. diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/ReferenceList.java b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/ReferenceList.java index 7fd5b85f4983c0e86308aed2081a130425131142..2cf0ec5ed44efbc07008a6714a1492634fd653d8 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/ReferenceList.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/ReferenceList.java @@ -87,7 +87,7 @@ public interface ReferenceList { * * @return Iterator. */ - public Iterator getReferences(); + public Iterator getReferences(); /** * DataReference factory method. Returns a diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipher.java b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipher.java index 683acdbf003dc9a85579b3ff4a4576c37efec9f9..8479835c901b80e0e287bcf432bcc5395061bb1e 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipher.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipher.java @@ -2772,7 +2772,7 @@ public class XMLCipher { // private class AgreementMethodImpl implements AgreementMethod { private byte[] kaNonce = null; - private List agreementMethodInformation = null; + private List agreementMethodInformation = null; private KeyInfo originatorKeyInfo = null; private KeyInfo recipientKeyInfo = null; private String algorithmURI = null; @@ -2781,7 +2781,7 @@ public class XMLCipher { * @param algorithm */ public AgreementMethodImpl(String algorithm) { - agreementMethodInformation = new LinkedList(); + agreementMethodInformation = new LinkedList(); URI tmpAlgorithm = null; try { tmpAlgorithm = new URI(algorithm); @@ -2802,7 +2802,7 @@ public class XMLCipher { } /** @inheritDoc */ - public Iterator getAgreementMethodInformation() { + public Iterator getAgreementMethodInformation() { return (agreementMethodInformation.iterator()); } @@ -2879,9 +2879,9 @@ public class XMLCipher { _contextDocument.createTextNode(new String(kaNonce))); } if (!agreementMethodInformation.isEmpty()) { - Iterator itr = agreementMethodInformation.iterator(); + Iterator itr = agreementMethodInformation.iterator(); while (itr.hasNext()) { - result.appendChild((Element) itr.next()); + result.appendChild(itr.next()); } } if (null != originatorKeyInfo) { @@ -3486,7 +3486,7 @@ public class XMLCipher { private String algorithm = null; private int keySize = Integer.MIN_VALUE; private byte[] oaepParams = null; - private List encryptionMethodInformation = null; + private List encryptionMethodInformation = null; /** * * @param algorithm @@ -3499,7 +3499,7 @@ public class XMLCipher { // complain } this.algorithm = tmpAlgorithm.toString(); - encryptionMethodInformation = new LinkedList(); + encryptionMethodInformation = new LinkedList(); } /** @inheritDoc */ public String getAlgorithm() { @@ -3522,7 +3522,7 @@ public class XMLCipher { oaepParams = params; } /** @inheritDoc */ - public Iterator getEncryptionMethodInformation() { + public Iterator getEncryptionMethodInformation() { return (encryptionMethodInformation.iterator()); } /** @inheritDoc */ @@ -3565,8 +3565,8 @@ public class XMLCipher { new String(oaepParams)))); } if (!encryptionMethodInformation.isEmpty()) { - Iterator itr = encryptionMethodInformation.iterator(); - result.appendChild((Element) itr.next()); + Iterator itr = encryptionMethodInformation.iterator(); + result.appendChild(itr.next()); } return (result); @@ -3582,13 +3582,13 @@ public class XMLCipher { // private class EncryptionPropertiesImpl implements EncryptionProperties { private String id = null; - private List encryptionProperties = null; + private List encryptionProperties = null; /** * * */ public EncryptionPropertiesImpl() { - encryptionProperties = new LinkedList(); + encryptionProperties = new LinkedList(); } /** @inheritDoc */ public String getId() { @@ -3599,7 +3599,7 @@ public class XMLCipher { this.id = id; } /** @inheritDoc */ - public Iterator getEncryptionProperties() { + public Iterator getEncryptionProperties() { return (encryptionProperties.iterator()); } /** @inheritDoc */ @@ -3625,7 +3625,7 @@ public class XMLCipher { if (null != id) { result.setAttributeNS(null, EncryptionConstants._ATT_ID, id); } - Iterator itr = getEncryptionProperties(); + Iterator itr = getEncryptionProperties(); while (itr.hasNext()) { result.appendChild(((EncryptionPropertyImpl) itr.next()).toElement()); @@ -3647,15 +3647,15 @@ public class XMLCipher { private class EncryptionPropertyImpl implements EncryptionProperty { private String target = null; private String id = null; - private HashMap attributeMap = new HashMap(); - private List encryptionInformation = null; + private HashMap attributeMap = new HashMap(); + private List encryptionInformation = null; /** * * */ public EncryptionPropertyImpl() { - encryptionInformation = new LinkedList(); + encryptionInformation = new LinkedList(); } /** @inheritDoc */ public String getTarget() { @@ -3692,14 +3692,14 @@ public class XMLCipher { } /** @inheritDoc */ public String getAttribute(String attribute) { - return (String) attributeMap.get(attribute); + return attributeMap.get(attribute); } /** @inheritDoc */ public void setAttribute(String attribute, String value) { attributeMap.put(attribute, value); } /** @inheritDoc */ - public Iterator getEncryptionInformation() { + public Iterator getEncryptionInformation() { return (encryptionInformation.iterator()); } /** @inheritDoc */ @@ -3821,8 +3821,8 @@ public class XMLCipher { // // private class ReferenceListImpl implements ReferenceList { - private Class sentry; - private List references; + private Class sentry; + private List references; /** * * @param type @@ -3835,7 +3835,7 @@ public class XMLCipher { } else { throw new IllegalArgumentException(); } - references = new LinkedList(); + references = new LinkedList(); } /** @inheritDoc */ public void add(Reference reference) { @@ -3860,7 +3860,7 @@ public class XMLCipher { return (references.isEmpty()); } /** @inheritDoc */ - public Iterator getReferences() { + public Iterator getReferences() { return (references.iterator()); } @@ -3869,9 +3869,9 @@ public class XMLCipher { _contextDocument, EncryptionConstants.EncryptionSpecNS, EncryptionConstants._TAG_REFERENCELIST); - Iterator eachReference = references.iterator(); + Iterator eachReference = references.iterator(); while (eachReference.hasNext()) { - Reference reference = (Reference) eachReference.next(); + Reference reference = eachReference.next(); result.appendChild( ((ReferenceImpl) reference).toElement()); } @@ -3894,18 +3894,18 @@ public class XMLCipher { */ private abstract class ReferenceImpl implements Reference { private String uri; - private List referenceInformation; + private List referenceInformation; ReferenceImpl(String _uri) { this.uri = _uri; - referenceInformation = new LinkedList(); + referenceInformation = new LinkedList(); } /** @inheritDoc */ public String getURI() { return (uri); } /** @inheritDoc */ - public Iterator getElementRetrievalInformation() { + public Iterator getElementRetrievalInformation() { return (referenceInformation.iterator()); } /** @inheritDoc */ diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java index cf588b8d488fa6eac65c5b7ad333ee226961b13e..0a39b1acc17acc655fe1c8ab98fe9e6418f3daa7 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java @@ -97,12 +97,12 @@ public class KeyInfo extends SignatureElementProxy { /** {@link java.util.logging} logging facility */ static java.util.logging.Logger log = java.util.logging.Logger.getLogger(KeyInfo.class.getName()); - List x509Datas=null; - List encryptedKeys=null; + List x509Datas=null; + List encryptedKeys=null; - static final List nullList; + static final List nullList; static { - List list = new ArrayList(); + List list = new ArrayList(1); list.add(null); nullList = Collections.unmodifiableList(list); } @@ -297,7 +297,7 @@ public class KeyInfo extends SignatureElementProxy { */ public void add(X509Data x509data) { if (x509Datas==null) - x509Datas=new ArrayList(); + x509Datas=new ArrayList(); x509Datas.add(x509data); this._constructionElement.appendChild(x509data.getElement()); XMLUtils.addReturnToElement(this._constructionElement); @@ -313,7 +313,7 @@ public class KeyInfo extends SignatureElementProxy { public void add(EncryptedKey encryptedKey) throws XMLEncryptionException { if (encryptedKeys==null) - encryptedKeys=new ArrayList(); + encryptedKeys=new ArrayList(); encryptedKeys.add(encryptedKey); XMLCipher cipher = XMLCipher.getInstance(); this._constructionElement.appendChild(cipher.martial(encryptedKey)); @@ -541,7 +541,7 @@ public class KeyInfo extends SignatureElementProxy { */ public X509Data itemX509Data(int i) throws XMLSecurityException { if (x509Datas!=null) { - return (X509Data) x509Datas.get(i); + return x509Datas.get(i); } Element e = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(), Constants._TAG_X509DATA,i); @@ -562,7 +562,7 @@ public class KeyInfo extends SignatureElementProxy { public EncryptedKey itemEncryptedKey(int i) throws XMLSecurityException { if (encryptedKeys!=null) { - return (EncryptedKey) encryptedKeys.get(i); + return encryptedKeys.get(i); } Element e = XMLUtils.selectXencNode(this._constructionElement.getFirstChild(), @@ -728,16 +728,16 @@ public class KeyInfo extends SignatureElementProxy { PublicKey getPublicKeyFromStaticResolvers() throws KeyResolverException { int length=KeyResolver.length(); int storageLength=this._storageResolvers.size(); - Iterator it= KeyResolver.iterator(); + Iterator it= KeyResolver.iterator(); for (int i = 0; i < length; i++) { - KeyResolverSpi keyResolver = (KeyResolverSpi) it.next(); + KeyResolverSpi keyResolver = it.next(); Node currentChild=this._constructionElement.getFirstChild(); String uri= this.getBaseURI(); while (currentChild!=null) { if (currentChild.getNodeType() == Node.ELEMENT_NODE) { for (int k = 0; k < storageLength; k++) { StorageResolver storage = - (StorageResolver) this._storageResolvers.get(k); + this._storageResolvers.get(k); PublicKey pk = keyResolver.engineLookupAndResolvePublicKey((Element) currentChild, @@ -776,7 +776,7 @@ public class KeyInfo extends SignatureElementProxy { if (currentChild.getNodeType() == Node.ELEMENT_NODE) { for (int k = 0; k < storageLength; k++) { StorageResolver storage = - (StorageResolver) this._storageResolvers.get(k); + this._storageResolvers.get(k); PublicKey pk = keyResolver .engineLookupAndResolvePublicKey((Element) currentChild, uri, storage); @@ -845,9 +845,9 @@ public class KeyInfo extends SignatureElementProxy { String uri=this.getBaseURI(); int length= KeyResolver.length(); int storageLength=this._storageResolvers.size(); - Iterator it = KeyResolver.iterator(); + Iterator it = KeyResolver.iterator(); for (int i = 0; i it = KeyResolver.iterator(); for (int i = 0; i < length; i++) { - KeyResolverSpi keyResolver = (KeyResolverSpi) it.next(); + KeyResolverSpi keyResolver = it.next(); Node currentChild=this._constructionElement.getFirstChild(); String uri=this.getBaseURI(); @@ -954,7 +954,7 @@ public class KeyInfo extends SignatureElementProxy { if (currentChild.getNodeType() == Node.ELEMENT_NODE) { for (int k = 0; k < storageLength; k++) { StorageResolver storage = - (StorageResolver) this._storageResolvers.get(k); + this._storageResolvers.get(k); SecretKey sk = keyResolver.engineLookupAndResolveSecretKey((Element) currentChild, @@ -992,7 +992,7 @@ public class KeyInfo extends SignatureElementProxy { if (currentChild.getNodeType() == Node.ELEMENT_NODE) { for (int k = 0; k < storageLength; k++) { StorageResolver storage = - (StorageResolver) this._storageResolvers.get(k); + this._storageResolvers.get(k); SecretKey sk = keyResolver .engineLookupAndResolveSecretKey((Element) currentChild, uri, storage); @@ -1012,7 +1012,7 @@ public class KeyInfo extends SignatureElementProxy { /** * Stores the individual (per-KeyInfo) {@link KeyResolver}s */ - List _internalKeyResolvers = null; + List _internalKeyResolvers = null; /** * This method is used to add a custom {@link KeyResolverSpi} to a KeyInfo @@ -1022,7 +1022,7 @@ public class KeyInfo extends SignatureElementProxy { */ public void registerInternalKeyResolver(KeyResolverSpi realKeyResolver) { if (_internalKeyResolvers==null) { - _internalKeyResolvers=new ArrayList(); + _internalKeyResolvers=new ArrayList(); } this._internalKeyResolvers.add(realKeyResolver); } @@ -1044,11 +1044,11 @@ public class KeyInfo extends SignatureElementProxy { * @return the KeyResolverSpi for the index. */ KeyResolverSpi itemInternalKeyResolver(int i) { - return (KeyResolverSpi) this._internalKeyResolvers.get(i); + return this._internalKeyResolvers.get(i); } /** Field _storageResolvers */ - List _storageResolvers = nullList; + List _storageResolvers = nullList; /** * Method addStorageResolver @@ -1057,7 +1057,7 @@ public class KeyInfo extends SignatureElementProxy { */ public void addStorageResolver(StorageResolver storageResolver) { if (_storageResolvers == nullList ){ - _storageResolvers=new ArrayList(); + _storageResolvers=new ArrayList(); } this._storageResolvers.add(storageResolver); diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java index 1da9dbb362f6926468faa00cc42ccc529d7cfa97..a10cb417a8f9ba4f054ce0c79143d25282178219 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java @@ -52,7 +52,7 @@ public class KeyResolver { static boolean _alreadyInitialized = false; /** Field _resolverVector */ - static List _resolverVector = null; + static List _resolverVector = null; /** Field _resolverSpi */ protected KeyResolverSpi _resolverSpi = null; @@ -85,12 +85,12 @@ public class KeyResolver { return KeyResolver._resolverVector.size(); } - public static void hit(Iterator hintI) { + public static void hit(Iterator hintI) { ResolverIterator hint = (ResolverIterator) hintI; int i = hint.i; if (i!=1 && hint.res ==_resolverVector) { - List resolverVector=(List)((ArrayList)_resolverVector).clone(); - Object ob=resolverVector.remove(i-1); + List resolverVector=getResolverVectorClone(); + KeyResolver ob=resolverVector.remove(i-1); resolverVector.add(0,ob); _resolverVector=resolverVector; } else { @@ -113,12 +113,9 @@ public class KeyResolver { throws KeyResolverException { // use the old vector to not be hit by updates - List resolverVector = KeyResolver._resolverVector; - for (int i = 0; i < resolverVector.size(); i++) { - KeyResolver resolver= - (KeyResolver) resolverVector.get(i); - - if (resolver==null) { + List resolverVector = KeyResolver._resolverVector; + for (KeyResolver resolver : resolverVector) { + if (resolver==null) { Object exArgs[] = { (((element != null) && (element.getNodeType() == Node.ELEMENT_NODE)) @@ -157,10 +154,8 @@ public class KeyResolver { Element element, String BaseURI, StorageResolver storage) throws KeyResolverException { - List resolverVector = KeyResolver._resolverVector; - for (int i = 0; i < resolverVector.size(); i++) { - KeyResolver resolver= - (KeyResolver) resolverVector.get(i); + List resolverVector = KeyResolver._resolverVector; + for (KeyResolver resolver : resolverVector) { if (resolver==null) { Object exArgs[] = { @@ -176,11 +171,11 @@ public class KeyResolver { PublicKey cert=resolver.resolvePublicKey(element, BaseURI, storage); if (cert!=null) { - if (i!=0 && resolverVector==_resolverVector) { + if (resolverVector.indexOf(resolver)!=0 && resolverVector==_resolverVector) { //update resolver. - resolverVector=(List)((ArrayList)_resolverVector).clone(); - Object ob=resolverVector.remove(i); - resolverVector.add(0,ob); + resolverVector=getResolverVectorClone(); + resolverVector.remove(resolver); + resolverVector.add(0,resolver); _resolverVector=resolverVector; } return cert; @@ -195,13 +190,19 @@ public class KeyResolver { throw new KeyResolverException("utils.resolver.noClass", exArgs); } + + @SuppressWarnings("unchecked") + private static List getResolverVectorClone() { + return (List)((ArrayList)_resolverVector).clone(); + } + /** * The init() function is called by com.sun.org.apache.xml.internal.security.Init.init() */ public static void init() { if (!KeyResolver._alreadyInitialized) { - KeyResolver._resolverVector = new ArrayList(10); + KeyResolver._resolverVector = new ArrayList(10); _alreadyInitialized = true; } } @@ -230,8 +231,8 @@ public class KeyResolver { * * @param className */ - public static void registerAtStart(String className) { - KeyResolver._resolverVector.add(0, className); + public static void registerAtStart(String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException { + register(className); } /** @@ -322,11 +323,11 @@ public class KeyResolver { return this._resolverSpi.getClass().getName(); } - static class ResolverIterator implements Iterator { - List res; - Iterator it; + static class ResolverIterator implements Iterator { + List res; + Iterator it; int i; - public ResolverIterator(List list) { + public ResolverIterator(List list) { res = list; it = res.iterator(); } @@ -335,9 +336,9 @@ public class KeyResolver { return it.hasNext(); } - public Object next() { + public KeyResolverSpi next() { i++; - KeyResolver resolver = (KeyResolver) it.next(); + KeyResolver resolver = it.next(); if (resolver==null) { throw new RuntimeException("utils.resolver.noClass"); } @@ -351,7 +352,7 @@ public class KeyResolver { } }; - public static Iterator iterator() { + public static Iterator iterator() { return new ResolverIterator(_resolverVector); } } diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolverSpi.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolverSpi.java index dc2865bcfc4d67632320bda1a65d2b22e05e18a4..3e5c82ccfe57b59ff1b7718259d03b1e800953fb 100644 --- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolverSpi.java +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolverSpi.java @@ -32,7 +32,7 @@ import org.w3c.dom.Element; /** * This class is abstract class for a child KeyInfo Elemnet. * - * If you want the your KeyResolver, at firstly you must extand this class, and register + * If you want your KeyResolver, at first you must extend this class, and register * as following in config.xml *
  *  <KeyResolver URI="http://www.w3.org/2000/09/xmldsig#KeyValue"
@@ -177,7 +177,7 @@ public abstract class KeyResolverSpi {
    }
 
    /** Field _properties */
-   protected java.util.Map _properties = null;
+   protected java.util.Map _properties = null;
 
    protected boolean globalResolver=false;
 
@@ -189,7 +189,7 @@ public abstract class KeyResolverSpi {
     */
    public void engineSetProperty(String key, String value) {
            if (_properties==null)
-                   _properties=new HashMap();
+                   _properties=new HashMap();
       this._properties.put(key, value);
    }
 
@@ -203,7 +203,7 @@ public abstract class KeyResolverSpi {
            if (_properties==null)
                    return null;
 
-      return (String) this._properties.get(key);
+      return this._properties.get(key);
    }
 
    /**
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java
index 3dff21824457cf144b05888576feecc1ec74bd4b..80674426281400324ada70ad15881315f3c5f4b2 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java
@@ -278,18 +278,18 @@ public class RetrievalMethodResolver extends KeyResolverSpi {
       return null;
    }
 
-   static Element getDocumentElement(Set set) {
-           Iterator it=set.iterator();
+   static Element getDocumentElement(Set set) {
+           Iterator it=set.iterator();
            Element e=null;
            while (it.hasNext()) {
-                   Node currentNode=(Node)it.next();
+                   Node currentNode=it.next();
                    if (currentNode instanceof Element) {
                            e=(Element)currentNode;
                            break;
                    }
 
            }
-           List parents=new ArrayList(10);
+           List parents=new ArrayList(10);
 
                 //Obtain all the parents of the elemnt
                 do {
@@ -301,10 +301,10 @@ public class RetrievalMethodResolver extends KeyResolverSpi {
                         e=(Element)n;
                 } while (e!=null);
                 //Visit them in reverse order.
-                ListIterator it2=parents.listIterator(parents.size()-1);
+                ListIterator it2=parents.listIterator(parents.size()-1);
                 Element ele=null;
                 while (it2.hasPrevious()) {
-                        ele=(Element)it2.previous();
+                        ele=it2.previous();
                         if (set.contains(ele)) {
                                 return ele;
                         }
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolver.java
index f1a8dd3400d090235e1d1dfe9ea5c621a75c9bde..7b11e848e8fa7b1b52114b668f9b31dad3df0e59 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolver.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolver.java
@@ -42,10 +42,10 @@ public class StorageResolver {
         java.util.logging.Logger.getLogger(StorageResolver.class.getName());
 
    /** Field _storageResolvers */
-   List _storageResolvers = null;
+   List _storageResolvers = null;
 
    /** Field _iterator */
-   Iterator _iterator = null;
+   Iterator _iterator = null;
 
    /**
     * Constructor StorageResolver
@@ -69,7 +69,7 @@ public class StorageResolver {
     */
    public void add(StorageResolverSpi resolver) {
            if (_storageResolvers==null)
-                   _storageResolvers=new ArrayList();
+                   _storageResolvers=new ArrayList();
       this._storageResolvers.add(resolver);
 
       this._iterator = null;
@@ -121,11 +121,11 @@ public class StorageResolver {
     * @return the iterator for the resolvers.
     *
     */
-   public Iterator getIterator() {
+   public Iterator getIterator() {
 
       if (this._iterator == null) {
          if (_storageResolvers==null)
-                   _storageResolvers=new ArrayList();
+                   _storageResolvers=new ArrayList();
          this._iterator = new StorageResolverIterator(this._storageResolvers.iterator());
       }
 
@@ -141,7 +141,7 @@ public class StorageResolver {
 
       if (this._iterator == null) {
           if (_storageResolvers==null)
-                   _storageResolvers=new ArrayList();
+                   _storageResolvers=new ArrayList();
          this._iterator = new StorageResolverIterator(this._storageResolvers.iterator());
       }
 
@@ -163,17 +163,17 @@ public class StorageResolver {
     * @author $Author: mullan $
     * @version $Revision: 1.5 $
     */
-   static class StorageResolverIterator implements Iterator {
+   static class StorageResolverIterator implements Iterator {
 
       /** Field _resolvers */
-      Iterator _resolvers = null;
+      Iterator _resolvers = null;
 
       /**
        * Constructor FilesystemIterator
        *
        * @param resolvers
        */
-      public StorageResolverIterator(Iterator resolvers) {
+      public StorageResolverIterator(Iterator resolvers) {
          this._resolvers = resolvers;
       }
 
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolverSpi.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolverSpi.java
index 25f3e2828d2e8441ff81b32ebd5ee8f511410994..07211253d228c58517f94bc7b3e216702dc68adf 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolverSpi.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolverSpi.java
@@ -36,5 +36,5 @@ public abstract class StorageResolverSpi {
     *
     * @return the iterator for the storage
     */
-   public abstract Iterator getIterator();
+   public abstract Iterator getIterator();
 }
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/CertsInFilesystemDirectoryResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/CertsInFilesystemDirectoryResolver.java
index 06fb5694befe6849bc27c6f9729d567f38e71d37..3b38e4a257269f37e3613d71eed05d5e61557320 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/CertsInFilesystemDirectoryResolver.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/CertsInFilesystemDirectoryResolver.java
@@ -54,10 +54,10 @@ public class CertsInFilesystemDirectoryResolver extends StorageResolverSpi {
    String _merlinsCertificatesDir = null;
 
    /** Field _certs */
-   private List _certs = new ArrayList();
+   private List _certs = new ArrayList();
 
    /** Field _iterator */
-   Iterator _iterator = null;
+   Iterator _iterator = null;
 
    /**
     *
@@ -83,7 +83,7 @@ public class CertsInFilesystemDirectoryResolver extends StorageResolverSpi {
    private void readCertsFromHarddrive() throws StorageResolverException {
 
       File certDir = new File(this._merlinsCertificatesDir);
-      ArrayList al = new ArrayList();
+      ArrayList al = new ArrayList();
       String[] names = certDir.list();
 
       for (int i = 0; i < names.length; i++) {
@@ -108,7 +108,7 @@ public class CertsInFilesystemDirectoryResolver extends StorageResolverSpi {
 
       for (int i = 0; i < al.size(); i++) {
          String filename = certDir.getAbsolutePath() + File.separator
-                           + (String) al.get(i);
+                           + al.get(i);
          File file = new File(filename);
          boolean added = false;
          String dn = null;
@@ -146,7 +146,7 @@ public class CertsInFilesystemDirectoryResolver extends StorageResolverSpi {
    }
 
    /** @inheritDoc */
-   public Iterator getIterator() {
+   public Iterator getIterator() {
       return this._iterator;
    }
 
@@ -156,10 +156,10 @@ public class CertsInFilesystemDirectoryResolver extends StorageResolverSpi {
     * @author $Author: mullan $
     * @version $Revision: 1.5 $
     */
-   private static class FilesystemIterator implements Iterator {
+   private static class FilesystemIterator implements Iterator {
 
       /** Field _certs */
-      List _certs = null;
+      List _certs = null;
 
       /** Field _i */
       int _i;
@@ -169,7 +169,7 @@ public class CertsInFilesystemDirectoryResolver extends StorageResolverSpi {
        *
        * @param certs
        */
-      public FilesystemIterator(List certs) {
+      public FilesystemIterator(List certs) {
          this._certs = certs;
          this._i = 0;
       }
@@ -180,7 +180,7 @@ public class CertsInFilesystemDirectoryResolver extends StorageResolverSpi {
       }
 
       /** @inheritDoc */
-      public Object next() {
+      public X509Certificate next() {
          return this._certs.get(this._i++);
       }
 
@@ -206,8 +206,8 @@ public class CertsInFilesystemDirectoryResolver extends StorageResolverSpi {
          new CertsInFilesystemDirectoryResolver(
             "data/ie/baltimore/merlin-examples/merlin-xmldsig-eighteen/certs");
 
-      for (Iterator i = krs.getIterator(); i.hasNext(); ) {
-         X509Certificate cert = (X509Certificate) i.next();
+      for (Iterator i = krs.getIterator(); i.hasNext(); ) {
+         X509Certificate cert = i.next();
          byte[] ski =
             com.sun.org.apache.xml.internal.security.keys.content.x509.XMLX509SKI
                .getSKIBytesFromCert(cert);
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/KeyStoreResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/KeyStoreResolver.java
index 18632433ca515217153e33b1368751603006489b..2a5662101b8b3cf0c95da95e069fc59324d55d4a 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/KeyStoreResolver.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/KeyStoreResolver.java
@@ -42,7 +42,7 @@ public class KeyStoreResolver extends StorageResolverSpi {
    KeyStore _keyStore = null;
 
    /** Field _iterator */
-   Iterator _iterator = null;
+   Iterator _iterator = null;
 
    /**
     * Constructor KeyStoreResolver
@@ -56,7 +56,7 @@ public class KeyStoreResolver extends StorageResolverSpi {
    }
 
    /** @inheritDoc */
-   public Iterator getIterator() {
+   public Iterator getIterator() {
       return this._iterator;
    }
 
@@ -66,13 +66,13 @@ public class KeyStoreResolver extends StorageResolverSpi {
     * @author $Author: mullan $
     * @version $Revision: 1.5 $
     */
-   static class KeyStoreIterator implements Iterator {
+   static class KeyStoreIterator implements Iterator {
 
       /** Field _keyStore */
       KeyStore _keyStore = null;
 
       /** Field _aliases */
-      Enumeration _aliases = null;
+      Enumeration _aliases = null;
 
       /**
        * Constructor KeyStoreIterator
@@ -97,12 +97,13 @@ public class KeyStoreResolver extends StorageResolverSpi {
       }
 
       /** @inheritDoc */
-      public Object next() {
+      @SuppressWarnings("unchecked")
+      public X509Certificate next() {
 
-         String alias = (String) this._aliases.nextElement();
+         String alias = this._aliases.nextElement();
 
          try {
-            return this._keyStore.getCertificate(alias);
+            return (X509Certificate)this._keyStore.getCertificate(alias);
          } catch (KeyStoreException ex) {
             return null;
          }
@@ -135,8 +136,8 @@ public class KeyStoreResolver extends StorageResolverSpi {
 
       KeyStoreResolver krs = new KeyStoreResolver(ks);
 
-      for (Iterator i = krs.getIterator(); i.hasNext(); ) {
-         X509Certificate cert = (X509Certificate) i.next();
+      for (Iterator i = krs.getIterator(); i.hasNext(); ) {
+         X509Certificate cert = i.next();
          byte[] ski =
             com.sun.org.apache.xml.internal.security.keys.content.x509.XMLX509SKI
                .getSKIBytesFromCert(cert);
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/SingleCertificateResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/SingleCertificateResolver.java
index 7e61b2a244d23ed955dec16b304ad5221e6894d0..3048bb123acf081f9e4ab2d25797e8217e4cfd66 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/SingleCertificateResolver.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/SingleCertificateResolver.java
@@ -38,7 +38,7 @@ public class SingleCertificateResolver extends StorageResolverSpi {
    X509Certificate _certificate = null;
 
    /** Field _iterator */
-   Iterator _iterator = null;
+   Iterator _iterator = null;
 
    /**
     *
@@ -51,7 +51,7 @@ public class SingleCertificateResolver extends StorageResolverSpi {
    }
 
    /** @inheritDoc */
-   public Iterator getIterator() {
+   public Iterator getIterator() {
       return this._iterator;
    }
 
@@ -61,7 +61,7 @@ public class SingleCertificateResolver extends StorageResolverSpi {
     * @author $Author: mullan $
     * @version $Revision: 1.5 $
     */
-   static class InternalIterator implements Iterator {
+   static class InternalIterator implements Iterator {
 
       /** Field _alreadyReturned */
       boolean _alreadyReturned = false;
@@ -84,7 +84,7 @@ public class SingleCertificateResolver extends StorageResolverSpi {
       }
 
       /** @inheritDoc */
-      public Object next() {
+      public X509Certificate next() {
 
          this._alreadyReturned = true;
 
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Manifest.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Manifest.java
index 97ea7517c0eba6213146fb60d6eb610ecd5a94bf..440a0124f86822c2c352a87de7de4313f2a8fffa 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Manifest.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Manifest.java
@@ -28,6 +28,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
+import java.util.Map;
 
 import javax.xml.parsers.ParserConfigurationException;
 
@@ -62,17 +63,17 @@ public class Manifest extends SignatureElementProxy {
         java.util.logging.Logger.getLogger(Manifest.class.getName());
 
    /** Field _references */
-   List _references;
+   List _references;
    Element[] _referencesEl;
 
    /** Field verificationResults[] */
    private boolean verificationResults[] = null;
 
    /** Field _resolverProperties */
-   HashMap _resolverProperties = null;
+   Map _resolverProperties = null;
 
    /** Field _perManifestResolvers */
-   List _perManifestResolvers = null;
+   List _perManifestResolvers = null;
 
    /**
     * Consturts {@link Manifest}
@@ -85,7 +86,7 @@ public class Manifest extends SignatureElementProxy {
 
       XMLUtils.addReturnToElement(this._constructionElement);
 
-      this._references = new ArrayList();
+      this._references = new ArrayList();
    }
 
    /**
@@ -117,7 +118,7 @@ public class Manifest extends SignatureElementProxy {
       }
 
       // create Vector
-      this._references = new ArrayList(le);
+      this._references = new ArrayList(le);
 
       for (int i = 0; i < le; i++) {
          this._references.add(null);
@@ -175,7 +176,7 @@ public class Manifest extends SignatureElementProxy {
          for (int i = 0; i < this.getLength(); i++) {
 
             // update the cached Reference object, the Element content is automatically updated
-            Reference currentRef = (Reference) this._references.get(i);
+            Reference currentRef = this._references.get(i);
 
             currentRef.generateDigestValue();
          }
@@ -208,7 +209,7 @@ public class Manifest extends SignatureElementProxy {
             this._references.set(i, ref);
          }
 
-         return (Reference) this._references.get(i);
+         return this._references.get(i);
 
    }
 
@@ -323,12 +324,12 @@ public class Manifest extends SignatureElementProxy {
                 try {
                   XMLSignatureInput signedManifestNodes =
                     currentRef.dereferenceURIandPerformTransforms(null);
-                  Set nl = signedManifestNodes.getNodeSet();
+                  Set nl = signedManifestNodes.getNodeSet();
                   Manifest referencedManifest = null;
-                  Iterator nlIterator = nl.iterator();
+                  Iterator nlIterator = nl.iterator();
 
                   findManifest: while (nlIterator.hasNext()) {
-                     Node n = (Node) nlIterator.next();
+                     Node n =  nlIterator.next();
 
                      if ((n.getNodeType() == Node.ELEMENT_NODE) && ((Element) n)
                              .getNamespaceURI()
@@ -449,7 +450,7 @@ public class Manifest extends SignatureElementProxy {
           return;
       }
       if (_perManifestResolvers==null)
-          _perManifestResolvers = new ArrayList();
+          _perManifestResolvers = new ArrayList();
       this._perManifestResolvers.add(resolver);
 
    }
@@ -465,7 +466,7 @@ public class Manifest extends SignatureElementProxy {
           return;
       }
       if (_perManifestResolvers==null)
-                  _perManifestResolvers = new ArrayList();
+                  _perManifestResolvers = new ArrayList();
       this._perManifestResolvers.add(new ResourceResolver(resolverSpi));
 
    }
@@ -479,7 +480,7 @@ public class Manifest extends SignatureElementProxy {
     */
    public void setResolverProperty(String key, String value) {
            if (_resolverProperties==null) {
-                   _resolverProperties=new HashMap(10);
+                   _resolverProperties=new HashMap(10);
            }
       this._resolverProperties.put(key, value);
    }
@@ -491,7 +492,7 @@ public class Manifest extends SignatureElementProxy {
     * @return the value
     */
    public String getResolverProperty(String key) {
-      return (String) this._resolverProperties.get(key);
+      return this._resolverProperties.get(key);
    }
 
    /**
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java
index ed2c5689fa588e379b9de92781803692decd77ba..8e29839eb98a4dfd36e8238ccf3968605076294d 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java
@@ -436,6 +436,7 @@ private Element digestValueElement;
     *
     * @deprecated use getContentsBeforeTransformation
     */
+   @Deprecated
    public XMLSignatureInput getTransformsInput() throws ReferenceNotInitializedException
         {
                 XMLSignatureInput input=getContentsBeforeTransformation();
@@ -557,7 +558,7 @@ private Element digestValueElement;
 
       try {
          XMLSignatureInput nodes = this.getNodesetBeforeFirstCanonicalization();
-         Set inclusiveNamespaces = new HashSet();
+         Set inclusiveNamespaces = new HashSet();
 
          {
             Transforms transforms = this.getTransforms();
@@ -710,7 +711,7 @@ private Element digestValueElement;
          XMLSignatureInput output=this.dereferenceURIandPerformTransforms(os);
          // if signing and c14n11 property == true explicitly add
          // C14N11 transform if needed
-         if (this.useC14N11 && !validating &&
+         if (Reference.useC14N11 && !validating &&
              !output.isOutputStreamSet() && !output.isOctetStream()) {
              if (transforms == null) {
                  transforms = new Transforms(this._doc);
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInput.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInput.java
index e02e88992119a9e99d5657e24b58c74e012b2078..2ba9e25c91725eeface87e90d910f562638ce4bd 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInput.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInput.java
@@ -74,7 +74,7 @@ public class XMLSignatureInput implements Cloneable {
     /**
      * The original NodeSet for this XMLSignatureInput
      */
-    Set _inputNodeSet = null;
+    Set _inputNodeSet = null;
     /**
      * The original Element
      */
@@ -107,7 +107,7 @@ public class XMLSignatureInput implements Cloneable {
     /**
      * Node Filter list.
      */
-    List nodeFilters=new ArrayList();
+    List nodeFilters=new ArrayList();
 
     boolean needsToBeExpanded=false;
     OutputStream outputStream=null;
@@ -164,6 +164,7 @@ public class XMLSignatureInput implements Cloneable {
      * @deprecated
      * @param inputStr the input String which including XML document or node
      */
+    @Deprecated
     public XMLSignatureInput(String inputStr) {
         this(inputStr.getBytes());
     }
@@ -179,6 +180,7 @@ public class XMLSignatureInput implements Cloneable {
      * @param encoding the encoding of inputStr
      * @throws UnsupportedEncodingException
      */
+    @Deprecated
     public XMLSignatureInput(String inputStr, String encoding)
            throws UnsupportedEncodingException {
         this(inputStr.getBytes(encoding));
@@ -201,7 +203,7 @@ public class XMLSignatureInput implements Cloneable {
      * @param inputNodeSet
      * @param usedXPathAPI
      */
-    public XMLSignatureInput(Set inputNodeSet) {
+    public XMLSignatureInput(Set inputNodeSet) {
         this._inputNodeSet = inputNodeSet;
     }
 
@@ -215,7 +217,7 @@ public class XMLSignatureInput implements Cloneable {
      * @throws ParserConfigurationException
      * @throws CanonicalizationException
      */
-    public Set getNodeSet() throws CanonicalizationException,
+    public Set getNodeSet() throws CanonicalizationException,
         ParserConfigurationException, IOException, SAXException {
         return getNodeSet(false);
     }
@@ -231,7 +233,7 @@ public class XMLSignatureInput implements Cloneable {
      * @throws ParserConfigurationException
      * @throws CanonicalizationException
      */
-    public Set getNodeSet(boolean circumvent)
+    public Set getNodeSet(boolean circumvent)
            throws ParserConfigurationException, IOException, SAXException,
                   CanonicalizationException {
         if (this._inputNodeSet!=null) {
@@ -242,13 +244,13 @@ public class XMLSignatureInput implements Cloneable {
             if (circumvent) {
                 XMLUtils.circumventBug2650(XMLUtils.getOwnerDocument(_subNode));
             }
-            this._inputNodeSet = new HashSet();
+            this._inputNodeSet = new HashSet();
             XMLUtils.getSet(_subNode,this._inputNodeSet, excludeNode, this.excludeComments);
 
             return this._inputNodeSet;
         } else if (this.isOctetStream()) {
             convertToNodes();
-            HashSet result=new HashSet();
+            HashSet result=new HashSet();
             XMLUtils.getSet(_subNode, result,null,false);
             //this._inputNodeSet=result;
             return result;
@@ -447,7 +449,7 @@ public class XMLSignatureInput implements Cloneable {
      * @throws XMLSignatureException
      * @return The HTML representation for this XMLSignature
      */
-    public String getHTMLRepresentation(Set inclusiveNamespaces)
+    public String getHTMLRepresentation(Set inclusiveNamespaces)
            throws XMLSignatureException {
 
         XMLSignatureInputDebugger db = new XMLSignatureInputDebugger( this,
@@ -584,7 +586,7 @@ public class XMLSignatureInput implements Cloneable {
     /**
      * @return the node filters
      */
-    public List getNodeFilters() {
+    public List getNodeFilters() {
         // TODO Auto-generated method stub
         return nodeFilters;
     }
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInputDebugger.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInputDebugger.java
index 8fe1ca3bf4fb819baebf6411d6909453348fa6f5..3186ef4d6a89c24a2655fa517daefbafb0a43f17 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInputDebugger.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInputDebugger.java
@@ -47,9 +47,9 @@ public class XMLSignatureInputDebugger {
 
 
         /** Field _xmlSignatureInput */
-        private Set _xpathNodeSet;
+        private Set _xpathNodeSet;
 
-        private Set _inclusiveNamespaces;
+        private Set _inclusiveNamespaces;
 
         /** Field _doc */
         private Document _doc = null;
@@ -159,7 +159,7 @@ public class XMLSignatureInputDebugger {
          * @param inclusiveNamespace
          */
         public XMLSignatureInputDebugger(
-                        XMLSignatureInput xmlSignatureInput, Set inclusiveNamespace) {
+                        XMLSignatureInput xmlSignatureInput, Set inclusiveNamespace) {
 
                 this(xmlSignatureInput);
 
@@ -182,7 +182,7 @@ public class XMLSignatureInputDebugger {
                 {
 
                         // get only a single node as anchor to fetch the owner document
-                        Node n = (Node) this._xpathNodeSet.iterator().next();
+                        Node n = this._xpathNodeSet.iterator().next();
 
                         this._doc = XMLUtils.getOwnerDocument(n);
                 }
@@ -341,10 +341,10 @@ public class XMLSignatureInputDebugger {
                         // we output all Attrs which are available
                         NamedNodeMap attrs = currentElement.getAttributes();
                         int attrsLength = attrs.getLength();
-                        Object attrs2[] = new Object[attrsLength];
+                        Attr attrs2[] = new Attr[attrsLength];
 
                         for (int i = 0; i < attrsLength; i++) {
-                                attrs2[i] = attrs.item(i);
+                                attrs2[i] = (Attr)attrs.item(i);
                         }
 
                         Arrays.sort(attrs2, ATTR_COMPARE);
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java
index 74713133a7d64a299657b8d114d444244bf81a27..7e1a51913cd0956387f1a86a602d1d541855494f 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java
@@ -25,6 +25,7 @@ import java.io.OutputStream;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.HashMap;
+import java.util.Map;
 import javax.xml.parsers.ParserConfigurationException;
 
 import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
@@ -65,9 +66,9 @@ public final class Transform extends SignatureElementProxy {
     private static boolean alreadyInitialized = false;
 
     /** All available Transform classes are registered here */
-    private static HashMap transformClassHash = null;
+    private static Map> transformClassHash = null;
 
-    private static HashMap transformSpiHash = new HashMap();
+    private static Map transformSpiHash = new HashMap();
 
     private TransformSpi transformSpi = null;
 
@@ -209,7 +210,7 @@ public final class Transform extends SignatureElementProxy {
      */
     public static void init() {
         if (!alreadyInitialized) {
-            transformClassHash = new HashMap(10);
+            transformClassHash = new HashMap>(10);
             // make sure builtin algorithms are all registered first
             com.sun.org.apache.xml.internal.security.Init.init();
             alreadyInitialized = true;
@@ -231,7 +232,7 @@ public final class Transform extends SignatureElementProxy {
         throws AlgorithmAlreadyRegisteredException {
 
         // are we already registered?
-        Class registeredClass = getImplementingClass(algorithmURI);
+        Class registeredClass = getImplementingClass(algorithmURI);
         if ((registeredClass != null) ) {
             Object exArgs[] = { algorithmURI, registeredClass };
             throw new AlgorithmAlreadyRegisteredException(
@@ -331,20 +332,21 @@ public final class Transform extends SignatureElementProxy {
      * @param URI
      * @return The name of the class implementing the URI.
      */
-    private static Class getImplementingClass(String URI) {
-        return (Class) transformClassHash.get(URI);
+    @SuppressWarnings("unchecked")
+    private static Class getImplementingClass(String URI) {
+        return (Class)transformClassHash.get(URI);
     }
 
     private static TransformSpi getTransformSpi(String URI)
         throws InvalidTransformException {
         try {
-            Object value = transformSpiHash.get(URI);
+            TransformSpi value = transformSpiHash.get(URI);
             if (value != null) {
-                return (TransformSpi) value;
+                return value;
             }
-            Class cl = (Class) transformClassHash.get(URI);
+            Class cl = getImplementingClass(URI);
             if (cl != null) {
-                TransformSpi tr = (TransformSpi) cl.newInstance();
+                TransformSpi tr = cl.newInstance();
                 transformSpiHash.put(URI, tr);
                 return tr;
             }
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformSpi.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformSpi.java
index 11cc8df055768f0af1919f9c8f203275770c6af4..35aa9ff0f6e36695da8f93fa88fa787ebec211b4 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformSpi.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformSpi.java
@@ -41,6 +41,7 @@ public abstract class TransformSpi {
      * For API compatibility not thread safe.
      * @deprecated
      */
+    @Deprecated
     protected Transform _transformObject = null;
     /**
      * Set the transform object.
@@ -48,6 +49,7 @@ public abstract class TransformSpi {
      * @param transform the Transform
      * @deprecated
      */
+    @Deprecated
     protected void setTransform(Transform transform) {
         this._transformObject = transform;
     }
@@ -120,6 +122,7 @@ public abstract class TransformSpi {
      * @throws SAXException
      * @throws TransformationException
      */
+    @Deprecated
     protected XMLSignatureInput enginePerformTransform(
         XMLSignatureInput input)
         throws IOException,
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/FuncHere.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/FuncHere.java
index 8f9766e109ddaef82a381c8a5407645238a231ae..15c1b576df5b48141858bf8081fef51e124b36a9 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/FuncHere.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/FuncHere.java
@@ -154,6 +154,7 @@ public class FuncHere extends Function {
     * @param vars
     * @param globalsSize
     */
+   @SuppressWarnings("rawtypes")
    public void fixupVariables(java.util.Vector vars, int globalsSize) {
 
       // do nothing
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXPath2Filter.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXPath2Filter.java
index 4f0f1bb69f4f7cf8d0d6350ca66b95184e1146b4..d58453c4a0d4eb10eb7aed8cd37bc4c541517dac 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXPath2Filter.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXPath2Filter.java
@@ -96,9 +96,9 @@ public class TransformXPath2Filter extends TransformSpi {
            throws TransformationException {
           CachedXPathAPIHolder.setDoc(_transformObject.getElement().getOwnerDocument());
       try {
-          List unionNodes=new ArrayList();
-           List substractNodes=new ArrayList();
-           List intersectNodes=new ArrayList();
+          List unionNodes=new ArrayList();
+          List substractNodes=new ArrayList();
+          List intersectNodes=new ArrayList();
 
          CachedXPathFuncHereAPI xPathFuncHereAPI =
             new CachedXPathFuncHereAPI(CachedXPathAPIHolder.getCachedXPathAPI());
@@ -170,18 +170,15 @@ public class TransformXPath2Filter extends TransformSpi {
          throw new TransformationException("empty", ex);
       }
    }
-   static Set convertNodeListToSet(List l){
-           Set result=new HashSet();
-           for (int j=0;j convertNodeListToSet(List l){
+           Set result=new HashSet();
 
+           for (NodeList rootNodes : l) {
+               int length = rootNodes.getLength();
                for (int i = 0; i < length; i++) {
                     Node rootNode = rootNodes.item(i);
                     result.add(rootNode);
-
                  }
-
            }
            return result;
    }
@@ -191,8 +188,8 @@ class XPath2NodeFilter implements NodeFilter {
         boolean hasUnionNodes;
         boolean hasSubstractNodes;
         boolean hasIntersectNodes;
-        XPath2NodeFilter(Set unionNodes, Set substractNodes,
-                        Set intersectNodes) {
+        XPath2NodeFilter(Set unionNodes, Set substractNodes,
+                        Set intersectNodes) {
                 this.unionNodes=unionNodes;
                 hasUnionNodes=!unionNodes.isEmpty();
                 this.substractNodes=substractNodes;
@@ -200,9 +197,9 @@ class XPath2NodeFilter implements NodeFilter {
                 this.intersectNodes=intersectNodes;
                 hasIntersectNodes=!intersectNodes.isEmpty();
         }
-        Set unionNodes;
-        Set substractNodes;
-        Set intersectNodes;
+        Set unionNodes;
+        Set substractNodes;
+        Set intersectNodes;
 
 
    /**
@@ -282,16 +279,15 @@ class XPath2NodeFilter implements NodeFilter {
     *
     * @return if rooted bye the rootnodes
     */
-   static boolean  rooted(Node currentNode, Set nodeList ) {
+   static boolean  rooted(Node currentNode, Set nodeList ) {
            if (nodeList.contains(currentNode)) {
                    return true;
            }
-           Iterator it=nodeList.iterator();
-           while (it.hasNext()) {
-                        Node rootNode = (Node) it.next();
-                        if (XMLUtils.isDescendantOrSelf(rootNode,currentNode)) {
-                                   return true;
-                        }
+
+           for(Node rootNode : nodeList) {
+               if (XMLUtils.isDescendantOrSelf(rootNode,currentNode)) {
+                   return true;
+               }
            }
            return false;
    }
@@ -303,7 +299,7 @@ class XPath2NodeFilter implements NodeFilter {
        *
        * @return if rooted bye the rootnodes
        */
-      static boolean  inList(Node currentNode, Set nodeList ) {
+      static boolean  inList(Node currentNode, Set nodeList ) {
               return nodeList.contains(currentNode);
       }
 }
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXSLT.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXSLT.java
index 13da91308b702c71d4d1c3aaba95749e6643d926..8ff4b9f00d9c184ea37751eb15b7f9a0de56216f 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXSLT.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXSLT.java
@@ -62,14 +62,6 @@ public class TransformXSLT extends TransformSpi {
    static final String defaultXSLTSpecNSprefix = "xslt";
    static final String XSLTSTYLESHEET          = "stylesheet";
 
-   // check for secure processing feature
-   private static Class xClass = null;
-   static {
-      try {
-         xClass = Class.forName("javax.xml.XMLConstants");
-      } catch (Exception e) {}
-   }
-
    static java.util.logging.Logger log =
       java.util.logging.Logger.getLogger(
          TransformXSLT.class.getName());
@@ -101,10 +93,6 @@ public class TransformXSLT extends TransformSpi {
     protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input,OutputStream baos, Transform _transformObject)
     throws IOException,
            TransformationException {
-      if (xClass == null) {
-         Object exArgs[] = { "SECURE_PROCESSING_FEATURE not supported" };
-         throw new TransformationException("generic.EmptyMessage", exArgs);
-      }
       try {
          Element transformElement = _transformObject.getElement();
 
@@ -119,11 +107,9 @@ public class TransformXSLT extends TransformSpi {
          }
 
          TransformerFactory tFactory = TransformerFactory.newInstance();
-         Class c = tFactory.getClass();
-         Method m = c.getMethod("setFeature", new Class[] {String.class, boolean.class});
-         // Process XSLT stylesheets in a secure manner
-         m.invoke(tFactory, new Object[] {"http://javax.xml.XMLConstants/feature/secure-processing", Boolean.TRUE});
 
+         // Process XSLT stylesheets in a secure manner
+         tFactory.setFeature("http://javax.xml.XMLConstants/feature/secure-processing", Boolean.TRUE);
          /*
           * This transform requires an octet stream as input. If the actual
           * input is an XPath node-set, then the signature application should
@@ -192,18 +178,6 @@ public class TransformXSLT extends TransformSpi {
       } catch (TransformerException ex) {
          Object exArgs[] = { ex.getMessage() };
 
-         throw new TransformationException("generic.EmptyMessage", exArgs, ex);
-      } catch (NoSuchMethodException ex) {
-         Object exArgs[] = { ex.getMessage() };
-
-         throw new TransformationException("generic.EmptyMessage", exArgs, ex);
-      } catch (IllegalAccessException ex) {
-         Object exArgs[] = { ex.getMessage() };
-
-         throw new TransformationException("generic.EmptyMessage", exArgs, ex);
-      } catch (java.lang.reflect.InvocationTargetException ex) {
-         Object exArgs[] = { ex.getMessage() };
-
          throw new TransformationException("generic.EmptyMessage", exArgs, ex);
       }
    }
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/InclusiveNamespaces.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/InclusiveNamespaces.java
index c953869fb714169196c51cb87704b0e5da9f5fb7..f615881bade23aff578ebe6108497b41feda7ef3 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/InclusiveNamespaces.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/InclusiveNamespaces.java
@@ -74,19 +74,16 @@ public class InclusiveNamespaces extends ElementProxy
     * @param doc
     * @param prefixes
     */
-   public InclusiveNamespaces(Document doc, Set prefixes) {
+   public InclusiveNamespaces(Document doc, Set prefixes) {
 
       super(doc);
 
       StringBuffer sb = new StringBuffer();
-      SortedSet prefixList = new TreeSet(prefixes);
+      SortedSet prefixList = new TreeSet(prefixes);
 
 
-      Iterator it = prefixList.iterator();
-
-      while (it.hasNext()) {
-         String prefix = (String) it.next();
 
+      for (String prefix : prefixList) {
          if (prefix.equals("xmlns")) {
             sb.append("#default ");
          } else {
@@ -138,9 +135,9 @@ public class InclusiveNamespaces extends ElementProxy
     * @param inclusiveNamespaces
     * @return A set to string
     */
-   public static SortedSet prefixStr2Set(String inclusiveNamespaces) {
+   public static SortedSet prefixStr2Set(String inclusiveNamespaces) {
 
-      SortedSet prefixes = new TreeSet();
+      SortedSet prefixes = new TreeSet();
 
       if ((inclusiveNamespaces == null)
               || (inclusiveNamespaces.length() == 0)) {
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/CachedXPathAPIHolder.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/CachedXPathAPIHolder.java
index fa32270f3652d9175cb1c930c97613d3f86601ca..0a7503a9331ad50d66d6f0ca310a1a21d35336ff 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/CachedXPathAPIHolder.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/CachedXPathAPIHolder.java
@@ -28,8 +28,8 @@ import org.w3c.dom.Document;
  */
 public class CachedXPathAPIHolder {
 
-    static ThreadLocal  local=new ThreadLocal();
-    static ThreadLocal localDoc=new ThreadLocal();
+    static ThreadLocal  local=new ThreadLocal();
+    static ThreadLocal localDoc=new ThreadLocal();
 
     /**
      * Sets the doc for the xpath transformation. Resets the cache if needed
@@ -37,7 +37,7 @@ public class CachedXPathAPIHolder {
      */
     public static void setDoc(Document doc) {
         if (localDoc.get()!=doc) {
-            CachedXPathAPI cx=(CachedXPathAPI)local.get();
+            CachedXPathAPI cx=local.get();
             if (cx==null) {
                 cx=new CachedXPathAPI();
                 local.set(cx);
@@ -54,7 +54,7 @@ public class CachedXPathAPIHolder {
      * @return the cachexpathapi for this thread
      */
     public static CachedXPathAPI getCachedXPathAPI() {
-        CachedXPathAPI cx=(CachedXPathAPI)local.get();
+        CachedXPathAPI cx=local.get();
         if (cx==null) {
             cx=new CachedXPathAPI();
             local.set(cx);
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/CachedXPathFuncHereAPI.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/CachedXPathFuncHereAPI.java
index cd19e5f7bf6f7cc8b2e2558c52b18668eae879bb..fe1ae841755265ca5e03e749fc3802ef6032e63e 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/CachedXPathFuncHereAPI.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/CachedXPathFuncHereAPI.java
@@ -173,6 +173,7 @@ public class CachedXPathFuncHereAPI {
     * @throws TransformerException
     * @deprecated
     */
+   @Deprecated
    public NodeIterator selectNodeIterator(
            Node contextNode, Node xpathnode, Node namespaceNode)
               throws TransformerException {
@@ -195,6 +196,7 @@ public class CachedXPathFuncHereAPI {
     * @throws TransformerException
     * @deprecated
     */
+   @Deprecated
    public NodeList selectNodeList(Node contextNode, Node xpathnode)
            throws TransformerException {
       return selectNodeList(contextNode, xpathnode, getStrFromNode(xpathnode), contextNode);
@@ -239,6 +241,7 @@ public class CachedXPathFuncHereAPI {
     * @throws TransformerException
     * @deprecated
     */
+   @Deprecated
    public XObject eval(Node contextNode, Node xpathnode)
            throws TransformerException {
       return eval(contextNode, xpathnode, getStrFromNode(xpathnode),contextNode);
@@ -375,12 +378,12 @@ public class CachedXPathFuncHereAPI {
 
     private XPath createXPath(String str, PrefixResolver prefixResolver) throws TransformerException {
         XPath xpath = null;
-        Class[] classes = new Class[]{String.class, SourceLocator.class, PrefixResolver.class, int.class,
+        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);
+            Constructor constructor = XPath.class.getConstructor(classes);
+            xpath = constructor.newInstance(objects);
         } catch (Throwable t) {
         }
         if (xpath == null) {
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java
index 4a344b936e4961cf2b2373f9aa57040abbbe75b1..f44c76cef7e9c184204d270918d634776a80727b 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java
@@ -24,6 +24,7 @@ package com.sun.org.apache.xml.internal.security.utils;
 
 import java.math.BigInteger;
 import java.util.HashMap;
+import java.util.Map;
 
 import com.sun.org.apache.xml.internal.security.exceptions.Base64DecodingException;
 import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
@@ -370,6 +371,7 @@ public abstract class ElementProxy {
     * @return the bytes
     * @throws XMLSecurityException
     */
+   @Deprecated
    public byte[] getBytesFromChildElement(String localname, String namespace)
            throws XMLSecurityException {
 
@@ -392,14 +394,12 @@ public abstract class ElementProxy {
     */
    public String getTextFromChildElement(String localname, String namespace) {
 
-         Text t =
-             (Text) XMLUtils.selectNode(
-                        this._constructionElement.getFirstChild(),
-                        namespace,
-                        localname,
-                        0).getFirstChild();
+         return     XMLUtils.selectNode(
+                    this._constructionElement.getFirstChild(),
+                    namespace,
+                    localname,
+                    0).getFirstChild().getNodeValue();
 
-         return t.getData();
    }
 
    /**
@@ -493,8 +493,8 @@ public abstract class ElementProxy {
    }
 
    /** Field _prefixMappings */
-   static HashMap _prefixMappings = new HashMap();
-   static HashMap _prefixMappingsBindings = new HashMap();
+   static Map _prefixMappings = new HashMap();
+   static Map _prefixMappingsBindings = new HashMap();
 
     /**
      * Method setDefaultPrefix
@@ -533,10 +533,10 @@ public abstract class ElementProxy {
      * @return the default prefix bind to this element.
      */
     public static String getDefaultPrefix(String namespace) {
-        return (String) ElementProxy._prefixMappings.get(namespace);
+        return ElementProxy._prefixMappings.get(namespace);
     }
 
     public static String getDefaultPrefixBindings(String namespace) {
-        return (String) ElementProxy._prefixMappingsBindings.get(namespace);
+        return ElementProxy._prefixMappingsBindings.get(namespace);
     }
 }
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/HelperNodeList.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/HelperNodeList.java
index 360f099056495eaa5cf8e03b5736184d85d0f4e4..cd40b79d47a3dc7695b598076d265f4dcdeabc0a 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/HelperNodeList.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/HelperNodeList.java
@@ -21,6 +21,7 @@
 package com.sun.org.apache.xml.internal.security.utils;
 
 import java.util.ArrayList;
+import java.util.List;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
@@ -34,7 +35,7 @@ import org.w3c.dom.NodeList;
 public class HelperNodeList implements NodeList {
 
    /** Field nodes */
-   ArrayList nodes = new ArrayList(20);
+   List nodes = new ArrayList(20);
    boolean _allNodesMustHaveSameParent = false;
 
    /**
@@ -62,7 +63,7 @@ public class HelperNodeList implements NodeList {
 
       // log.log(java.util.logging.Level.FINE, "item(" + index + ") of " + this.getLength() + " nodes");
 
-      return (Node) nodes.get(index);
+      return nodes.get(index);
    }
 
    /**
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java
index da5c4960973c1e67d3cc7b4856688ba8661df1ce..61baa1595ad87c473e280a985f7c670c8bdd4d20 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java
@@ -23,6 +23,7 @@ package com.sun.org.apache.xml.internal.security.utils;
 import java.lang.ref.WeakReference;
 import java.util.Arrays;
 import java.util.WeakHashMap;
+import java.util.Map;
 
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
@@ -52,7 +53,8 @@ public class IdResolver {
     private static java.util.logging.Logger log =
         java.util.logging.Logger.getLogger(IdResolver.class.getName());
 
-    private static WeakHashMap docMap = new WeakHashMap();
+    private static Map>> docMap =
+                    new WeakHashMap>>();
 
     /**
      * Constructor IdResolver
@@ -70,15 +72,15 @@ public class IdResolver {
      */
     public static void registerElementById(Element element, String idValue) {
         Document doc = element.getOwnerDocument();
-        WeakHashMap elementMap;
+        Map> elementMap;
         synchronized (docMap) {
-            elementMap = (WeakHashMap) docMap.get(doc);
+            elementMap = docMap.get(doc);
             if (elementMap == null) {
-                elementMap = new WeakHashMap();
+                elementMap = new WeakHashMap>();
                 docMap.put(doc, elementMap);
             }
         }
-        elementMap.put(idValue, new WeakReference(element));
+        elementMap.put(idValue, new WeakReference(element));
     }
 
     /**
@@ -156,20 +158,20 @@ public class IdResolver {
     private static Element getElementByIdType(Document doc, String id) {
         if (log.isLoggable(java.util.logging.Level.FINE))
             log.log(java.util.logging.Level.FINE, "getElementByIdType() Search for ID " + id);
-        WeakHashMap elementMap;
+        Map> elementMap;
         synchronized (docMap) {
-            elementMap = (WeakHashMap) docMap.get(doc);
+            elementMap = docMap.get(doc);
         }
         if (elementMap != null) {
-            WeakReference weakReference = (WeakReference) elementMap.get(id);
+            WeakReference weakReference =  elementMap.get(id);
             if (weakReference != null) {
-                return (Element) weakReference.get();
+                return weakReference.get();
             }
         }
         return null;
     }
 
-    private static java.util.List names;
+    private static java.util.List names;
     private static int namesLength;
     static {
         String namespaces[]={
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/UnsyncBufferedOutputStream.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/UnsyncBufferedOutputStream.java
index 3347b04c0bc18f80f100a86e2c4d0505ae3ab53d..e9a7935e7eaeeaa192460e1568c7c491484ad256 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/UnsyncBufferedOutputStream.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/UnsyncBufferedOutputStream.java
@@ -33,8 +33,8 @@ public class UnsyncBufferedOutputStream extends OutputStream {
 
         final byte[] buf;
         static final int size=8*1024;
-        private static ThreadLocal bufCahce = new ThreadLocal() {
-        protected synchronized Object initialValue() {
+        private static ThreadLocal bufCahce = new ThreadLocal() {
+        protected synchronized byte[] initialValue() {
             return new byte[size];
         }
     };
@@ -44,7 +44,7 @@ public class UnsyncBufferedOutputStream extends OutputStream {
          * @param out the outputstream to buffer
          */
         public UnsyncBufferedOutputStream(OutputStream out) {
-                buf=(byte[])bufCahce.get();
+                buf=bufCahce.get();
                 this.out=out;
         }
 
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/UnsyncByteArrayOutputStream.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/UnsyncByteArrayOutputStream.java
index bfba75dd2ae251804775e7fcd36eb99d59f52bbe..2a2f7ddbd0315016601a9538099a76661d6e1956 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/UnsyncByteArrayOutputStream.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/UnsyncByteArrayOutputStream.java
@@ -29,8 +29,8 @@ import java.io.OutputStream;
  */
 public class UnsyncByteArrayOutputStream extends OutputStream  {
     private static final int INITIAL_SIZE = 8192;
-    private static ThreadLocal bufCache = new ThreadLocal() {
-        protected synchronized Object initialValue() {
+    private static ThreadLocal bufCache = new ThreadLocal() {
+        protected synchronized byte[] initialValue() {
             return new byte[INITIAL_SIZE];
         }
     };
@@ -40,7 +40,7 @@ public class UnsyncByteArrayOutputStream extends OutputStream  {
     private int pos = 0;
 
     public UnsyncByteArrayOutputStream() {
-        buf = (byte[])bufCache.get();
+        buf = bufCache.get();
     }
 
     public void write(byte[] arg0) {
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java
index 92ca11a9db554d51d865037e77db6aae066751e4..5df2b6ed26e96835b4b4ce9e5d3e1145d78f6b5c 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java
@@ -82,13 +82,15 @@ public class XMLUtils {
     * @param exclude
     * @param com wheather comments or not
     */
-   public static void getSet(Node rootNode,Set result,Node exclude ,boolean com) {
+   public static void getSet(Node rootNode,Set result,Node exclude ,boolean com) {
           if ((exclude!=null) && isDescendantOrSelf(exclude,rootNode)){
                 return;
       }
       getSetRec(rootNode,result,exclude,com);
    }
-   static final void getSetRec(final Node rootNode,final Set result,
+
+   @SuppressWarnings("fallthrough")
+   static final void getSetRec(final Node rootNode,final Set result,
         final Node exclude ,final boolean com) {
            //Set result = new HashSet();
        if (rootNode==exclude) {
@@ -104,7 +106,7 @@ public class XMLUtils {
                                         result.add(nl.item(i));
                                 }
                 }
-                //no return keep working
+                //no return keep working - ignore fallthrough warning
                 case Node.DOCUMENT_NODE:
                                 for (Node r=rootNode.getFirstChild();r!=null;r=r.getNextSibling()){
                                         if (r.getNodeType()==Node.TEXT_NODE) {
@@ -230,7 +232,7 @@ public class XMLUtils {
 
 
    static  String dsPrefix=null;
-   static Map namePrefixes=new HashMap();
+   static Map namePrefixes=new HashMap();
    /**
     * Creates an Element in the XML Signature specification namespace.
     *
@@ -248,7 +250,7 @@ public class XMLUtils {
       if ((dsPrefix == null) || (dsPrefix.length() == 0)) {
          return doc.createElementNS(Constants.SignatureSpecNS, elementName);
       }
-      String namePrefix=(String) namePrefixes.get(elementName);
+      String namePrefix= namePrefixes.get(elementName);
       if (namePrefix==null) {
           StringBuffer tag=new StringBuffer(dsPrefix);
           tag.append(':');
@@ -318,11 +320,9 @@ public class XMLUtils {
      * @param xpathNodeSet
      * @return the owner document
      */
-    public static Document getOwnerDocument(Set xpathNodeSet) {
+    public static Document getOwnerDocument(Set xpathNodeSet) {
        NullPointerException npe = null;
-       Iterator iterator = xpathNodeSet.iterator();
-       while(iterator.hasNext()) {
-           Node node = (Node) iterator.next();
+       for (Node node : xpathNodeSet) {
            int nodeType =node.getNodeType();
            if (nodeType == Node.DOCUMENT_NODE) {
               return (Document) node;
@@ -397,14 +397,14 @@ public class XMLUtils {
     * @param xpathNodeSet
     * @return the set with the nodelist
     */
-   public static Set convertNodelistToSet(NodeList xpathNodeSet) {
+   public static Set convertNodelistToSet(NodeList xpathNodeSet) {
 
       if (xpathNodeSet == null) {
-         return new HashSet();
+         return new HashSet();
       }
 
       int length = xpathNodeSet.getLength();
-      Set set = new HashSet(length);
+      Set set = new HashSet(length);
 
       for (int i = 0; i < length; i++) {
          set.add(xpathNodeSet.item(i));
@@ -446,6 +446,7 @@ public class XMLUtils {
     * @param node
     * @see Namespace axis resolution is not XPath compliant 
     */
+   @SuppressWarnings("fallthrough")
    private static void circumventBug2650internal(Node node) {
            Node parent=null;
            Node sibling=null;
@@ -642,12 +643,12 @@ public class XMLUtils {
     * @param inputSet
     * @return nodes with the constrain
     */
-    public static Set excludeNodeFromSet(Node signatureElement, Set inputSet) {
-          Set resultSet = new HashSet();
-          Iterator iterator = inputSet.iterator();
+    public static Set excludeNodeFromSet(Node signatureElement, Set inputSet) {
+          Set resultSet = new HashSet();
+          Iterator iterator = inputSet.iterator();
 
           while (iterator.hasNext()) {
-            Node inputNode = (Node) iterator.next();
+            Node inputNode = iterator.next();
 
             if (!XMLUtils
                     .isDescendantOrSelf(signatureElement, inputNode)) {
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolver.java
index 8a960767e5acd56b97d1ad90454804b0ae4f39e2..5d5719b69ec5ba83297dba103628a28e25621101 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolver.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolver.java
@@ -56,7 +56,7 @@ public class ResourceResolver {
    static boolean _alreadyInitialized = false;
 
    /** these are the system-wide resolvers */
-   static List _resolverVector = null;
+   static List _resolverVector = null;
 
    static boolean allThreadSafeInList=true;
 
@@ -102,7 +102,7 @@ public class ResourceResolver {
       int length=ResourceResolver._resolverVector.size();
       for (int i = 0; i < length; i++) {
                   ResourceResolver resolver =
-            (ResourceResolver) ResourceResolver._resolverVector.get(i);
+            ResourceResolver._resolverVector.get(i);
                   ResourceResolver resolverTmp=null;
                   try {
                         resolverTmp =  allThreadSafeInList || resolver._resolverSpi.engineIsThreadSafe() ? resolver :
@@ -120,7 +120,7 @@ public class ResourceResolver {
                  if (i!=0) {
                  //update resolver.
                          //System.out.println("Swaping");
-                         List resolverVector=(List)((ArrayList)_resolverVector).clone();
+                         List resolverVector=getResolverVectorClone();
                          resolverVector.remove(i);
                          resolverVector.add(0,resolver);
                          _resolverVector=resolverVector;
@@ -139,6 +139,17 @@ public class ResourceResolver {
       throw new ResourceResolverException("utils.resolver.noClass", exArgs,
                                           uri, BaseURI);
    }
+
+   /**
+    * Method getResolverVectorClone
+    *
+    * @return clone of _resolverVector
+    */
+   @SuppressWarnings("unchecked")
+   private static List getResolverVectorClone() {
+       return (List)((ArrayList)_resolverVector).clone();
+   }
+
    /**
     * Method getInstance
     *
@@ -150,7 +161,7 @@ public class ResourceResolver {
     * @throws ResourceResolverException
     */
    public static final ResourceResolver getInstance(
-           Attr uri, String BaseURI, List individualResolvers)
+           Attr uri, String BaseURI, List individualResolvers)
               throws ResourceResolverException {
       if (log.isLoggable(java.util.logging.Level.FINE)) {
 
@@ -163,7 +174,7 @@ public class ResourceResolver {
       if ((individualResolvers != null) && ((size=individualResolvers.size()) > 0)) {
          for (int i = 0; i < size; i++) {
             ResourceResolver resolver =
-               (ResourceResolver) individualResolvers.get(i);
+               individualResolvers.get(i);
 
             if (resolver != null) {
                String currentClass = resolver._resolverSpi.getClass().getName();
@@ -186,7 +197,7 @@ public class ResourceResolver {
    public static void init() {
 
       if (!ResourceResolver._alreadyInitialized) {
-         ResourceResolver._resolverVector = new ArrayList(10);
+         ResourceResolver._resolverVector = new ArrayList(10);
          _alreadyInitialized = true;
       }
    }
@@ -288,7 +299,7 @@ public class ResourceResolver {
     *
     * @param properties
     */
-   public void addProperties(Map properties) {
+   public void addProperties(Map properties) {
       this._resolverSpi.engineAddProperies(properties);
    }
 
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolverSpi.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolverSpi.java
index bed9420a6acab34e4af068ef0711d09e57ebf4ab..1ff89b78c5f4f94fcb6b79231a6ac49a0418ad66 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolverSpi.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolverSpi.java
@@ -41,7 +41,7 @@ public abstract class ResourceResolverSpi {
                     ResourceResolverSpi.class.getName());
 
    /** Field _properties */
-   protected java.util.Map _properties = null;
+   protected java.util.Map _properties = null;
 
    /**
     * This is the workhorse method used to resolve resources.
@@ -63,7 +63,7 @@ public abstract class ResourceResolverSpi {
     */
    public void engineSetProperty(String key, String value) {
           if (_properties==null) {
-                  _properties=new HashMap();
+                  _properties=new HashMap();
           }
       this._properties.put(key, value);
    }
@@ -78,17 +78,17 @@ public abstract class ResourceResolverSpi {
           if (_properties==null) {
                         return null;
           }
-      return (String) this._properties.get(key);
+      return this._properties.get(key);
    }
 
    /**
     *
     * @param properties
     */
-   public void engineAddProperies(Map properties) {
+   public void engineAddProperies(Map properties) {
           if (properties!=null) {
                   if (_properties==null) {
-                          _properties=new HashMap();
+                          _properties=new HashMap();
                   }
                   this._properties.putAll(properties);
           }
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverDirectHTTP.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverDirectHTTP.java
index 7b23e7a23a0d60308438270d216bf8babe092e01..706cccc6a4d56b9988ebbc9a9b11823b774d5c03 100644
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverDirectHTTP.java
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverDirectHTTP.java
@@ -289,7 +289,7 @@ public class ResolverDirectHTTP extends ResourceResolverSpi {
     * @inheritDoc
     */
    public String[] engineGetPropertyKeys() {
-      return (String[]) ResolverDirectHTTP.properties.clone();
+      return ResolverDirectHTTP.properties.clone();
    }
 
    private URI getNewURI(String uri, String BaseURI)