diff --git a/src/share/classes/javax/script/ScriptException.java b/src/share/classes/javax/script/ScriptException.java index 6ad481085f7c1402d74ff6b7e93fb58c459ef7a0..e9ffaabb220e69a0c94bfd4d6acd558be5e41b8e 100644 --- a/src/share/classes/javax/script/ScriptException.java +++ b/src/share/classes/javax/script/ScriptException.java @@ -36,6 +36,8 @@ package javax.script; */ public class ScriptException extends Exception { + private static final long serialVersionUID = 8265071037049225001L; + private String fileName; private int lineNumber; private int columnNumber; diff --git a/src/share/classes/javax/xml/crypto/NodeSetData.java b/src/share/classes/javax/xml/crypto/NodeSetData.java index a34302acfe321b388f7794f9c9f191bcea7b98b4..d83572993305a9209b340916b06bf7657489266a 100644 --- a/src/share/classes/javax/xml/crypto/NodeSetData.java +++ b/src/share/classes/javax/xml/crypto/NodeSetData.java @@ -52,5 +52,6 @@ public interface NodeSetData extends Data { * @return an Iterator over the nodes in this * NodeSetData in document order */ + @SuppressWarnings("rawtypes") Iterator iterator(); } diff --git a/src/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java b/src/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java index 79f72940148b6e3f0d22e5dfbce00c0aa7a81788..d13f384ba5a062c629e0801542dc5b8cbf19c275 100644 --- a/src/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java +++ b/src/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java @@ -47,13 +47,13 @@ import org.w3c.dom.Element; */ public class DOMCryptoContext implements XMLCryptoContext { - private HashMap nsMap = new HashMap(); - private HashMap idMap = new HashMap(); - private HashMap objMap = new HashMap(); + private HashMap nsMap = new HashMap<>(); + private HashMap idMap = new HashMap<>(); + private HashMap objMap = new HashMap<>(); private String baseURI; private KeySelector ks; private URIDereferencer dereferencer; - private HashMap propMap = new HashMap(); + private HashMap propMap = new HashMap<>(); private String defaultPrefix; /** @@ -73,7 +73,7 @@ public class DOMCryptoContext implements XMLCryptoContext { if (namespaceURI == null) { throw new NullPointerException("namespaceURI cannot be null"); } - String prefix = (String) nsMap.get(namespaceURI); + String prefix = nsMap.get(namespaceURI); return (prefix != null ? prefix : defaultPrefix); } @@ -87,7 +87,7 @@ public class DOMCryptoContext implements XMLCryptoContext { if (namespaceURI == null) { throw new NullPointerException("namespaceURI is null"); } - return (String) nsMap.put(namespaceURI, prefix); + return nsMap.put(namespaceURI, prefix); } public String getDefaultNamespacePrefix() { @@ -170,7 +170,7 @@ public class DOMCryptoContext implements XMLCryptoContext { if (idValue == null) { throw new NullPointerException("idValue is null"); } - return (Element) idMap.get(idValue); + return idMap.get(idValue); } /** @@ -219,6 +219,7 @@ public class DOMCryptoContext implements XMLCryptoContext { * * @return a read-only iterator over the set of mappings */ + @SuppressWarnings("rawtypes") public Iterator iterator() { return Collections.unmodifiableMap(idMap).entrySet().iterator(); } diff --git a/src/share/classes/javax/xml/crypto/dsig/Manifest.java b/src/share/classes/javax/xml/crypto/dsig/Manifest.java index ebb0ec1fa74dda536715cc6a32c0e1ad022c4c7a..0800a6435d0bef1ad7f148092125777eacfa3000 100644 --- a/src/share/classes/javax/xml/crypto/dsig/Manifest.java +++ b/src/share/classes/javax/xml/crypto/dsig/Manifest.java @@ -86,5 +86,6 @@ public interface Manifest extends XMLStructure { * * @return an unmodifiable list of one or more References */ + @SuppressWarnings("rawtypes") List getReferences(); } diff --git a/src/share/classes/javax/xml/crypto/dsig/Reference.java b/src/share/classes/javax/xml/crypto/dsig/Reference.java index 6725b14af57b8e4636c47f782c8b01c0872538e2..be71bbb9e12ffae6df92cb8ba87ae19b3a212265 100644 --- a/src/share/classes/javax/xml/crypto/dsig/Reference.java +++ b/src/share/classes/javax/xml/crypto/dsig/Reference.java @@ -85,6 +85,7 @@ public interface Reference extends URIReference, XMLStructure { * @return an unmodifiable list of Transforms * (may be empty but never null) */ + @SuppressWarnings("rawtypes") List getTransforms(); /** diff --git a/src/share/classes/javax/xml/crypto/dsig/SignatureProperties.java b/src/share/classes/javax/xml/crypto/dsig/SignatureProperties.java index 127143e84bea77342894e88e4b2c9e20233ebaf8..a6ef8e1e5d7669ba5bee3a1b0b52d8a5b8e7866f 100644 --- a/src/share/classes/javax/xml/crypto/dsig/SignatureProperties.java +++ b/src/share/classes/javax/xml/crypto/dsig/SignatureProperties.java @@ -87,5 +87,6 @@ public interface SignatureProperties extends XMLStructure { * @return an unmodifiable list of one or more * SignaturePropertys */ + @SuppressWarnings("rawtypes") List getProperties(); } diff --git a/src/share/classes/javax/xml/crypto/dsig/SignatureProperty.java b/src/share/classes/javax/xml/crypto/dsig/SignatureProperty.java index d6c8c8f123cd4c92090d5d0f5c3d43da56e6e3b9..c808456bab6c4f43bbc67cd5dbeffb03eb69b0f0 100644 --- a/src/share/classes/javax/xml/crypto/dsig/SignatureProperty.java +++ b/src/share/classes/javax/xml/crypto/dsig/SignatureProperty.java @@ -91,5 +91,6 @@ public interface SignatureProperty extends XMLStructure { * * @return an unmodifiable list of one or more XMLStructures */ + @SuppressWarnings("rawtypes") List getContent(); } diff --git a/src/share/classes/javax/xml/crypto/dsig/SignedInfo.java b/src/share/classes/javax/xml/crypto/dsig/SignedInfo.java index a603906ebe655a424fa8fe758ba277306d8d2df3..cba06dc57522ce2d7239745d8359f04fc8a88b18 100644 --- a/src/share/classes/javax/xml/crypto/dsig/SignedInfo.java +++ b/src/share/classes/javax/xml/crypto/dsig/SignedInfo.java @@ -80,6 +80,7 @@ public interface SignedInfo extends XMLStructure { * * @return an unmodifiable list of one or more {@link Reference}s */ + @SuppressWarnings("rawtypes") List getReferences(); /** diff --git a/src/share/classes/javax/xml/crypto/dsig/TransformService.java b/src/share/classes/javax/xml/crypto/dsig/TransformService.java index 70f4182bf370834676772ae0b3b63b0cb1193e60..b009b9a20ef89d6aab97a6c0011ea933a1ba1d2f 100644 --- a/src/share/classes/javax/xml/crypto/dsig/TransformService.java +++ b/src/share/classes/javax/xml/crypto/dsig/TransformService.java @@ -157,9 +157,9 @@ public abstract class TransformService implements Transform { if (mechanismType.equals("DOM")) { dom = true; } - List services = GetInstance.getServices("TransformService", algorithm); - for (Iterator t = services.iterator(); t.hasNext(); ) { - Service s = (Service)t.next(); + List services = GetInstance.getServices("TransformService", algorithm); + for (Iterator t = services.iterator(); t.hasNext(); ) { + Service s = t.next(); String value = s.getAttribute("MechanismType"); if ((value == null && dom) || (value != null && value.equals(mechanismType))) { @@ -277,7 +277,7 @@ public abstract class TransformService implements Transform { + " mechanism not available"); } - private static class MechanismMapEntry implements Map.Entry { + private static class MechanismMapEntry implements Map.Entry { private final String mechanism; private final String algorithm; private final String key; @@ -290,19 +290,19 @@ public abstract class TransformService implements Transform { if (!(o instanceof Map.Entry)) { return false; } - Map.Entry e = (Map.Entry) o; + Map.Entry e = (Map.Entry) o; return (getKey()==null ? e.getKey()==null : getKey().equals(e.getKey())) && (getValue()==null ? e.getValue()==null : getValue().equals(e.getValue())); } - public Object getKey() { + public String getKey() { return key; } - public Object getValue() { + public String getValue() { return mechanism; } - public Object setValue(Object value) { + public String setValue(String value) { throw new UnsupportedOperationException(); } public int hashCode() { diff --git a/src/share/classes/javax/xml/crypto/dsig/XMLObject.java b/src/share/classes/javax/xml/crypto/dsig/XMLObject.java index 88db693a73a814961b11aa5db9f229db5298d359..5763ba664236eda2a7fe42453e169bdb1820877f 100644 --- a/src/share/classes/javax/xml/crypto/dsig/XMLObject.java +++ b/src/share/classes/javax/xml/crypto/dsig/XMLObject.java @@ -100,6 +100,7 @@ public interface XMLObject extends XMLStructure { * @return an unmodifiable list of XMLStructures (may be empty * but never null) */ + @SuppressWarnings("rawtypes") List getContent(); /** diff --git a/src/share/classes/javax/xml/crypto/dsig/XMLSignature.java b/src/share/classes/javax/xml/crypto/dsig/XMLSignature.java index 829a41a17b7444231fc9c7f786110c2374367a60..533976a672a57b237d043ecc5e522cc62db0fe55 100644 --- a/src/share/classes/javax/xml/crypto/dsig/XMLSignature.java +++ b/src/share/classes/javax/xml/crypto/dsig/XMLSignature.java @@ -136,6 +136,7 @@ public interface XMLSignature extends XMLStructure { * @return an unmodifiable list of XMLObjects (may be empty * but never null) */ + @SuppressWarnings("rawtypes") List getObjects(); /** diff --git a/src/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java b/src/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java index 3d3426bf3c784cda030a306af4005f9459b9585d..e9932d5b4f194196caff702a4cb1cef2fe2ee488 100644 --- a/src/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java +++ b/src/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java @@ -365,6 +365,7 @@ public abstract class XMLSignatureFactory { * @throws ClassCastException if any of the objects are not of * type XMLObject */ + @SuppressWarnings("rawtypes") public abstract XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki, List objects, String id, String signatureValueId); @@ -398,6 +399,7 @@ public abstract class XMLSignatureFactory { * compliant * @throws NullPointerException if dm is null */ + @SuppressWarnings("rawtypes") public abstract Reference newReference(String uri, DigestMethod dm, List transforms, String type, String id); @@ -428,6 +430,7 @@ public abstract class XMLSignatureFactory { * @throws NullPointerException if dm or * digestValue is null */ + @SuppressWarnings("rawtypes") public abstract Reference newReference(String uri, DigestMethod dm, List transforms, String type, String id, byte[] digestValue); @@ -470,6 +473,7 @@ public abstract class XMLSignatureFactory { * appliedTransforms or result is * null */ + @SuppressWarnings("rawtypes") public abstract Reference newReference(String uri, DigestMethod dm, List appliedTransforms, Data result, List transforms, String type, String id); @@ -489,6 +493,7 @@ public abstract class XMLSignatureFactory { * @throws NullPointerException if any of the parameters * are null */ + @SuppressWarnings("rawtypes") public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm, SignatureMethod sm, List references); @@ -507,6 +512,7 @@ public abstract class XMLSignatureFactory { * @throws NullPointerException if cm, sm, or * references are null */ + @SuppressWarnings("rawtypes") public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm, SignatureMethod sm, List references, String id); @@ -524,6 +530,7 @@ public abstract class XMLSignatureFactory { * @throws ClassCastException if content contains any * entries that are not of type {@link XMLStructure} */ + @SuppressWarnings("rawtypes") public abstract XMLObject newXMLObject(List content, String id, String mimeType, String encoding); @@ -540,6 +547,7 @@ public abstract class XMLSignatureFactory { * @throws ClassCastException if references contains any * entries that are not of type {@link Reference} */ + @SuppressWarnings("rawtypes") public abstract Manifest newManifest(List references); /** @@ -556,6 +564,7 @@ public abstract class XMLSignatureFactory { * @throws ClassCastException if references contains any * entries that are not of type {@link Reference} */ + @SuppressWarnings("rawtypes") public abstract Manifest newManifest(List references, String id); /** @@ -574,6 +583,7 @@ public abstract class XMLSignatureFactory { * @throws ClassCastException if content contains any * entries that are not of type {@link XMLStructure} */ + @SuppressWarnings("rawtypes") public abstract SignatureProperty newSignatureProperty (List content, String target, String id); @@ -592,6 +602,7 @@ public abstract class XMLSignatureFactory { * @throws ClassCastException if properties contains any * entries that are not of type {@link SignatureProperty} */ + @SuppressWarnings("rawtypes") public abstract SignatureProperties newSignatureProperties (List properties, String id); diff --git a/src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java b/src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java index a9f9833b597bef788e5be9236eba0f9485f41972..74d8215c1bb69e96bb1be267b99e4e0666bc0f5e 100644 --- a/src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java +++ b/src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java @@ -94,6 +94,7 @@ public interface KeyInfo extends XMLStructure { * in this KeyInfo. Never returns null or an * empty list. */ + @SuppressWarnings("rawtypes") List getContent(); /** diff --git a/src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java b/src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java index 54fd53bc790cb724182b532633fcb0b90935e6cf..b1fbbd0e4b586cf1090baac50e96cf20cdab1e5c 100644 --- a/src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java +++ b/src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java @@ -305,6 +305,7 @@ public abstract class KeyInfoFactory { * @throws ClassCastException if content contains any entries * that are not of type {@link XMLStructure} */ + @SuppressWarnings("rawtypes") public abstract KeyInfo newKeyInfo(List content); /** @@ -324,6 +325,7 @@ public abstract class KeyInfoFactory { * @throws ClassCastException if content contains any entries * that are not of type {@link XMLStructure} */ + @SuppressWarnings("rawtypes") public abstract KeyInfo newKeyInfo(List content, String id); /** @@ -385,6 +387,7 @@ public abstract class KeyInfoFactory { * @throws ClassCastException if other contains any * entries that are not of type {@link XMLStructure} */ + @SuppressWarnings("rawtypes") public abstract PGPData newPGPData(byte[] keyId, byte[] keyPacket, List other); @@ -408,6 +411,7 @@ public abstract class KeyInfoFactory { * @throws ClassCastException if other contains any * entries that are not of type {@link XMLStructure} */ + @SuppressWarnings("rawtypes") public abstract PGPData newPGPData(byte[] keyPacket, List other); /** @@ -439,6 +443,7 @@ public abstract class KeyInfoFactory { * @throws ClassCastException if transforms contains any * entries that are not of type {@link Transform} */ + @SuppressWarnings("rawtypes") public abstract RetrievalMethod newRetrievalMethod(String uri, String type, List transforms); @@ -464,6 +469,7 @@ public abstract class KeyInfoFactory { * @throws ClassCastException if content contains any entries * that are not of one of the valid types mentioned above */ + @SuppressWarnings("rawtypes") public abstract X509Data newX509Data(List content); /** diff --git a/src/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java b/src/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java index 917cbdd2cef41e2b95c09f1b88606ac85aaa30a7..c60eb4267b5f035c6ada754afc57b5c1378c058a 100644 --- a/src/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java +++ b/src/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java @@ -112,5 +112,6 @@ public interface PGPData extends XMLStructure { * @return an unmodifiable list of XMLStructures (may be * empty, but never null) */ + @SuppressWarnings("rawtypes") List getExternalElements(); } diff --git a/src/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java b/src/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java index bffbe1a6bddf197eaaf174bcb9fbb242adfdfd81..0b3402db471206b15c6b1d79ec257b2eec2e6ff7 100644 --- a/src/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java +++ b/src/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java @@ -80,6 +80,7 @@ public interface RetrievalMethod extends URIReference, XMLStructure { * @return an unmodifiable list of Transform objects (may be * empty but never null). */ + @SuppressWarnings("rawtypes") List getTransforms(); /** diff --git a/src/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java b/src/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java index 88d696103defca7ce3db70970b91576acc98838f..e2c8c6a08d9c40f01895b4dc432473118cd65014 100644 --- a/src/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java +++ b/src/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java @@ -109,5 +109,6 @@ public interface X509Data extends XMLStructure { * @return an unmodifiable list of the content in this X509Data * (never null or empty) */ + @SuppressWarnings("rawtypes") List getContent(); } diff --git a/src/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java b/src/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java index af07c1fa27cbe13c9e66f082fb0bb0dc49288149..c686cfbbe4cb0d89dfe3c9b5508c078531ca8bf6 100644 --- a/src/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java +++ b/src/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java @@ -59,7 +59,7 @@ import java.util.List; */ public final class ExcC14NParameterSpec implements C14NMethodParameterSpec { - private List preList; + private List preList; /** * Indicates the default namespace ("#default"). @@ -71,7 +71,7 @@ public final class ExcC14NParameterSpec implements C14NMethodParameterSpec { * list. */ public ExcC14NParameterSpec() { - preList = Collections.EMPTY_LIST; + preList = Collections.emptyList(); } /** @@ -86,17 +86,22 @@ public final class ExcC14NParameterSpec implements C14NMethodParameterSpec { * @throws ClassCastException if any of the entries in the list are not * of type String */ + @SuppressWarnings("rawtypes") public ExcC14NParameterSpec(List prefixList) { if (prefixList == null) { throw new NullPointerException("prefixList cannot be null"); } - this.preList = new ArrayList(prefixList); - for (int i = 0, size = preList.size(); i < size; i++) { - if (!(preList.get(i) instanceof String)) { + List copy = new ArrayList<>((List)prefixList); + for (int i = 0, size = copy.size(); i < size; i++) { + if (!(copy.get(i) instanceof String)) { throw new ClassCastException("not a String"); } } - preList = Collections.unmodifiableList(preList); + + @SuppressWarnings("unchecked") + List temp = (List)copy; + + preList = Collections.unmodifiableList(temp); } /** @@ -109,6 +114,7 @@ public final class ExcC14NParameterSpec implements C14NMethodParameterSpec { * @return the inclusive namespace prefix list (may be empty but never * null) */ + @SuppressWarnings("rawtypes") public List getPrefixList() { return preList; } diff --git a/src/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java b/src/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java index 35854ab42a32f5dce25cdbd18df876c3e7857eae..6320f620238dfc7b67b227b904983206eb28bfa2 100644 --- a/src/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java +++ b/src/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java @@ -46,7 +46,7 @@ import javax.xml.crypto.dsig.Transform; */ public final class XPathFilter2ParameterSpec implements TransformParameterSpec { - private final List xPathList; + private final List xPathList; /** * Creates an XPathFilter2ParameterSpec. @@ -59,11 +59,12 @@ public final class XPathFilter2ParameterSpec implements TransformParameterSpec { * @throws NullPointerException if xPathList is * null */ + @SuppressWarnings("rawtypes") public XPathFilter2ParameterSpec(List xPathList) { if (xPathList == null) { throw new NullPointerException("xPathList cannot be null"); } - List xPathListCopy = new ArrayList(xPathList); + List xPathListCopy = new ArrayList<>((List)xPathList); if (xPathListCopy.isEmpty()) { throw new IllegalArgumentException("xPathList cannot be empty"); } @@ -74,7 +75,11 @@ public final class XPathFilter2ParameterSpec implements TransformParameterSpec { ("xPathList["+i+"] is not a valid type"); } } - this.xPathList = Collections.unmodifiableList(xPathListCopy); + + @SuppressWarnings("unchecked") + List temp = (List)xPathListCopy; + + this.xPathList = Collections.unmodifiableList(temp); } /** @@ -86,6 +91,7 @@ public final class XPathFilter2ParameterSpec implements TransformParameterSpec { * @return a List of XPathType objects * (never null or empty) */ + @SuppressWarnings("rawtypes") public List getXPathList() { return xPathList; } diff --git a/src/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java b/src/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java index 486bf27e9a9f3e3a0b5fda30cfcf9b7728ecd2c4..36adde5e8a84b8b82df17b62d784d741a83156cc 100644 --- a/src/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java +++ b/src/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java @@ -52,7 +52,7 @@ import java.util.Map.Entry; public final class XPathFilterParameterSpec implements TransformParameterSpec { private String xPath; - private Map nsMap; + private Map nsMap; /** * Creates an XPathFilterParameterSpec with the specified @@ -66,7 +66,7 @@ public final class XPathFilterParameterSpec implements TransformParameterSpec { throw new NullPointerException(); } this.xPath = xPath; - this.nsMap = Collections.EMPTY_MAP; + this.nsMap = Collections.emptyMap(); } /** @@ -83,21 +83,26 @@ public final class XPathFilterParameterSpec implements TransformParameterSpec { * @throws ClassCastException if any of the map's keys or entries are not * of type String */ + @SuppressWarnings("rawtypes") public XPathFilterParameterSpec(String xPath, Map namespaceMap) { if (xPath == null || namespaceMap == null) { throw new NullPointerException(); } this.xPath = xPath; - nsMap = new HashMap(namespaceMap); - Iterator entries = nsMap.entrySet().iterator(); + Map copy = new HashMap<>((Map)namespaceMap); + Iterator> entries = copy.entrySet().iterator(); while (entries.hasNext()) { - Map.Entry me = (Map.Entry) entries.next(); + Map.Entry me = entries.next(); if (!(me.getKey() instanceof String) || !(me.getValue() instanceof String)) { throw new ClassCastException("not a String"); } } - nsMap = Collections.unmodifiableMap(nsMap); + + @SuppressWarnings("unchecked") + Map temp = (Map)copy; + + nsMap = Collections.unmodifiableMap(temp); } /** @@ -120,6 +125,7 @@ public final class XPathFilterParameterSpec implements TransformParameterSpec { * @return a Map of namespace prefixes to namespace URIs (may * be empty, but never null) */ + @SuppressWarnings("rawtypes") public Map getNamespaceMap() { return nsMap; } diff --git a/src/share/classes/javax/xml/crypto/dsig/spec/XPathType.java b/src/share/classes/javax/xml/crypto/dsig/spec/XPathType.java index 8ad417c4410c940564b8cc732ae2affc90ec6111..751df6c515f6174f3d76222531352c182f31fc32 100644 --- a/src/share/classes/javax/xml/crypto/dsig/spec/XPathType.java +++ b/src/share/classes/javax/xml/crypto/dsig/spec/XPathType.java @@ -106,7 +106,7 @@ public class XPathType { private final String expression; private final Filter filter; - private Map nsMap; + private Map nsMap; /** * Creates an XPathType instance with the specified XPath @@ -127,7 +127,7 @@ public class XPathType { } this.expression = expression; this.filter = filter; - this.nsMap = Collections.EMPTY_MAP; + this.nsMap = Collections.emptyMap(); } /** @@ -147,21 +147,26 @@ public class XPathType { * @throws ClassCastException if any of the map's keys or entries are * not of type String */ + @SuppressWarnings("rawtypes") public XPathType(String expression, Filter filter, Map namespaceMap) { this(expression, filter); if (namespaceMap == null) { throw new NullPointerException("namespaceMap cannot be null"); } - nsMap = new HashMap(namespaceMap); - Iterator entries = nsMap.entrySet().iterator(); + Map copy = new HashMap<>((Map)namespaceMap); + Iterator> entries = copy.entrySet().iterator(); while (entries.hasNext()) { - Map.Entry me = (Map.Entry) entries.next(); + Map.Entry me = entries.next(); if (!(me.getKey() instanceof String) || !(me.getValue() instanceof String)) { throw new ClassCastException("not a String"); } } - nsMap = Collections.unmodifiableMap(nsMap); + + @SuppressWarnings("unchecked") + Map temp = (Map)copy; + + nsMap = Collections.unmodifiableMap(temp); } /** @@ -193,6 +198,7 @@ public class XPathType { * @return a Map of namespace prefixes to namespace URIs * (may be empty, but never null) */ + @SuppressWarnings("rawtypes") public Map getNamespaceMap() { return nsMap; }