src.samples.java.ex.SG_Sample Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fb-contrib Show documentation
Show all versions of fb-contrib Show documentation
An auxiliary findbugs.sourceforge.net plugin for java bug detectors that fall outside the narrow scope of detectors to be packaged with the product itself.
package ex;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.ByteArrayInputStream;
import java.io.FileReader;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
@SuppressWarnings("all")
public class SG_Sample implements ActionListener, WindowListener {
String s = " ";
public void actionPerformed(ActionEvent ae) {
FileReader fr = null;
try {
fr = new FileReader("c:/a.out");
} catch (Exception e) {
} finally {
try {
fr.close();
} catch (Exception ee) {
}
}
}
public void windowClosing(WindowEvent we) {
String s = getRoot();
}
private String getRoot() {
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document d = db.parse(new ByteArrayInputStream(s.getBytes()));
return d.getDocumentElement().getNodeName();
} catch (Exception e) {
return "";
}
}
public void windowActivated(WindowEvent arg0) {
}
public void windowClosed(WindowEvent arg0) {
}
public void windowDeactivated(WindowEvent arg0) {
}
public void windowDeiconified(WindowEvent arg0) {
}
public void windowIconified(WindowEvent arg0) {
}
public void windowOpened(WindowEvent arg0) {
}
}