Fixed warnings

This commit is contained in:
Carlos Galindo 2019-03-26 20:25:29 +01:00
parent cf7f5f2f18
commit 782a4361c2
Signed by untrusted user who does not match committer: kauron
GPG key ID: 83E68706DEE119A3
3 changed files with 20 additions and 20 deletions

View file

@ -86,7 +86,7 @@ public class GraphViz
private final static long serialVersionUID = 1L; { private final static long serialVersionUID = 1L; {
try { try {
load(new FileInputStream(cfgProp)); load(new FileInputStream(cfgProp));
} catch (Exception e) {} } catch (Exception ignored) {}
} }
}; };
@ -166,7 +166,7 @@ private static String DOT = configFile.getProperty("dotFor" + osName);
* Adds a string to the graph's source (with newline). * Adds a string to the graph's source (with newline).
*/ */
public void addln(String line) { public void addln(String line) {
this.graph.append(line + "\n"); this.graph.append(line).append("\n");
} }
/** /**
@ -189,14 +189,14 @@ private static String DOT = configFile.getProperty("dotFor" + osName);
public byte[] getGraph(String dot_source, String type) public byte[] getGraph(String dot_source, String type)
{ {
File dot; File dot;
byte[] img_stream = null; byte[] img_stream;
try { try {
dot = writeDotSourceToFile(dot_source); dot = writeDotSourceToFile(dot_source);
if (dot != null) if (dot != null)
{ {
img_stream = get_img_stream(dot, type); img_stream = get_img_stream(dot, type);
if (dot.delete() == false) if (!dot.delete())
System.err.println("Warning: " + dot.getAbsolutePath() + " could not be deleted!"); System.err.println("Warning: " + dot.getAbsolutePath() + " could not be deleted!");
return img_stream; return img_stream;
} }
@ -258,9 +258,9 @@ private static String DOT = configFile.getProperty("dotFor" + osName);
img_stream = new byte[in.available()]; img_stream = new byte[in.available()];
in.read(img_stream); in.read(img_stream);
// Close it if we need to // Close it if we need to
if( in != null ) in.close(); in.close();
if (img.delete() == false) if (!img.delete())
System.err.println("Warning: " + img.getAbsolutePath() + " could not be deleted!"); System.err.println("Warning: " + img.getAbsolutePath() + " could not be deleted!");
} }
catch (java.io.IOException ioe) { catch (java.io.IOException ioe) {

View file

@ -52,19 +52,19 @@ public class Transformador {
// Imprime el grafo en la pantalla // Imprime el grafo en la pantalla
private static String imprimirGrafo(List<String> arcos) private static String imprimirGrafo(List<String> arcos)
{ {
String dotInfo=""; StringBuilder dotInfo= new StringBuilder();
for(String arco:arcos) { for(String arco:arcos) {
dotInfo += arco; dotInfo.append(arco);
System.out.println("ARCO: "+arco); System.out.println("ARCO: "+arco);
} }
System.out.println("\nCFG:"); System.out.println("\nCFG:");
System.out.println(dotInfo); System.out.println(dotInfo);
return dotInfo; return dotInfo.toString();
} }
// Elimina todos los comentarios de un nodo y sus hijos // Elimina todos los comentarios de un nodo y sus hijos
static void quitarComentarios(Node node){ private static void quitarComentarios(Node node){
node.removeComment(); node.removeComment();
for (Comment comment : node.getOrphanComments()) for (Comment comment : node.getOrphanComments())
{ {

View file

@ -12,18 +12,18 @@ import com.github.javaparser.ast.visitor.VoidVisitorAdapter;
public class Visitador extends VoidVisitorAdapter<List<String>> public class Visitador extends VoidVisitorAdapter<List<String>>
{ {
/********************************************************/ //********************************************************/
/********************** Atributos ***********************/ //********************** Atributos ***********************/
/********************************************************/ //********************************************************/
// Usamos un contador para numerar las instrucciones // Usamos un contador para numerar las instrucciones
int contador=1; private int contador=1;
String nodoAnterior = "Start"; private String nodoAnterior = "Start";
String nodoActual = ""; private String nodoActual = "";
/********************************************************/ //********************************************************/
/*********************** Metodos ************************/ //*********************** Metodos ************************/
/********************************************************/ //********************************************************/
// Visitador de métodos // Visitador de métodos
// Este visitador añade el nodo final al CFG // Este visitador añade el nodo final al CFG