src/share/classes/javax/imageio/metadata/IIOMetadataNode.java
Print this page
rev 9293 : 8034998: Fix raw and unchecked lint warnings in javax.imageio
Reviewed-by:
*** 48,81 ****
}
}
class IIONamedNodeMap implements NamedNodeMap {
! List nodes;
! public IIONamedNodeMap(List nodes) {
this.nodes = nodes;
}
public int getLength() {
return nodes.size();
}
public Node getNamedItem(String name) {
! Iterator iter = nodes.iterator();
while (iter.hasNext()) {
! Node node = (Node)iter.next();
if (name.equals(node.getNodeName())) {
return node;
}
}
return null;
}
public Node item(int index) {
! Node node = (Node)nodes.get(index);
return node;
}
public Node removeNamedItem(java.lang.String name) {
throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
--- 48,81 ----
}
}
class IIONamedNodeMap implements NamedNodeMap {
! List<? extends Node> nodes;
! public IIONamedNodeMap(List<? extends Node> nodes) {
this.nodes = nodes;
}
public int getLength() {
return nodes.size();
}
public Node getNamedItem(String name) {
! Iterator<? extends Node> iter = nodes.iterator();
while (iter.hasNext()) {
! Node node = iter.next();
if (name.equals(node.getNodeName())) {
return node;
}
}
return null;
}
public Node item(int index) {
! Node node = nodes.get(index);
return node;
}
public Node removeNamedItem(java.lang.String name) {
throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
*** 109,121 ****
}
}
class IIONodeList implements NodeList {
! List nodes;
! public IIONodeList(List nodes) {
this.nodes = nodes;
}
public int getLength() {
return nodes.size();
--- 109,121 ----
}
}
class IIONodeList implements NodeList {
! List<? extends Node> nodes;
! public IIONodeList(List<? extends Node> nodes) {
this.nodes = nodes;
}
public int getLength() {
return nodes.size();
*** 123,133 ****
public Node item(int index) {
if (index < 0 || index > nodes.size()) {
return null;
}
! return (Node)nodes.get(index);
}
}
class IIOAttr extends IIOMetadataNode implements Attr {
--- 123,133 ----
public Node item(int index) {
if (index < 0 || index > nodes.size()) {
return null;
}
! return nodes.get(index);
}
}
class IIOAttr extends IIOMetadataNode implements Attr {
*** 283,293 ****
/**
* A <code>List</code> of <code>IIOAttr</code> nodes representing
* attributes.
*/
! private List attributes = new ArrayList();
/**
* Constructs an empty <code>IIOMetadataNode</code>.
*/
public IIOMetadataNode() {}
--- 283,293 ----
/**
* A <code>List</code> of <code>IIOAttr</code> nodes representing
* attributes.
*/
! private List<IIOAttr> attributes = new ArrayList<>();
/**
* Constructs an empty <code>IIOMetadataNode</code>.
*/
public IIOMetadataNode() {}
*** 787,797 ****
}
private void removeAttribute(String name, boolean checkPresent) {
int numAttributes = attributes.size();
for (int i = 0; i < numAttributes; i++) {
! IIOAttr attr = (IIOAttr)attributes.get(i);
if (name.equals(attr.getName())) {
attr.setOwnerElement(null);
attributes.remove(i);
return;
}
--- 787,797 ----
}
private void removeAttribute(String name, boolean checkPresent) {
int numAttributes = attributes.size();
for (int i = 0; i < numAttributes; i++) {
! IIOAttr attr = attributes.get(i);
if (name.equals(attr.getName())) {
attr.setOwnerElement(null);
attributes.remove(i);
return;
}
*** 871,886 ****
removeAttribute(oldAttr.getName());
return oldAttr;
}
public NodeList getElementsByTagName(String name) {
! List l = new ArrayList();
getElementsByTagName(name, l);
return new IIONodeList(l);
}
! private void getElementsByTagName(String name, List l) {
if (nodeName.equals(name)) {
l.add(this);
}
Node child = getFirstChild();
--- 871,886 ----
removeAttribute(oldAttr.getName());
return oldAttr;
}
public NodeList getElementsByTagName(String name) {
! List<Node> l = new ArrayList<>();
getElementsByTagName(name, l);
return new IIONodeList(l);
}
! private void getElementsByTagName(String name, List<Node> l) {
if (nodeName.equals(name)) {
l.add(this);
}
Node child = getFirstChild();