Skip to content
Snippets Groups Projects
Commit ce2d3ac5 authored by hansen's avatar hansen
Browse files

bug-free with respect to Findbugs

parent 991212c7
Branches
Tags
No related merge requests found
...@@ -11,40 +11,15 @@ sourceCompatibility = 1.5 ...@@ -11,40 +11,15 @@ sourceCompatibility = 1.5
repositories { repositories {
mavenCentral() mavenCentral()
mavenRepo name: 'cobra_ext', url: "http://cobra.cs.uni-duesseldorf.de/artifactory/repo" maven {
url "http://cobra.cs.uni-duesseldorf.de/artifactory/repo"
}
} }
configurations { // configuration that holds jars to copy into lib configurations { // configuration that holds jars to copy into lib
releaseJars releaseJars
} }
jacoco {
toolVersion = "0.6.2.201302030002"
reportsDir = file("$buildDir/customJacocoReportDir")
}
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination "${buildDir}/jacocoHtml"
}
}
tasks.withType(FindBugs) {
reports {
xml.enabled = false
html.enabled = true
}
}
findbugs {
ignoreFailures = true
}
def parser_version = '2.4.22-SNAPSHOT' def parser_version = '2.4.22-SNAPSHOT'
dependencies { dependencies {
...@@ -71,6 +46,31 @@ dependencies { ...@@ -71,6 +46,31 @@ dependencies {
releaseJars (group: 'de.prob', name: 'ltlparser', version: parser_version) releaseJars (group: 'de.prob', name: 'ltlparser', version: parser_version)
} }
jacoco {
toolVersion = "0.6.2.201302030002"
reportsDir = file("$buildDir/customJacocoReportDir")
}
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination "${buildDir}/jacocoHtml"
}
}
tasks.withType(FindBugs) {
reports {
xml.enabled = false
html.enabled = true
}
}
findbugs {
ignoreFailures = true
}
test { test {
exclude('de/tlc4b/tlc/integration/probprivate') exclude('de/tlc4b/tlc/integration/probprivate')
......
...@@ -409,27 +409,6 @@ public class TLC4B { ...@@ -409,27 +409,6 @@ public class TLC4B {
} }
} }
// try {
// out = new BufferedWriter(new OutputStreamWriter(
// new FileOutputStream(file), "UTF-8"));
// out.write(text);
// out.close();
// // FileWriter fw;
// // fw = new FileWriter(file);
// // fw.write(text);
// // fw.close();
// return file;
// } catch (IOException e) {
// e.printStackTrace();
// throw new TLC4BIOException(e.getMessage());
// } finally {
// try {
// out.close();
// } catch (IOException e) {
// e.printStackTrace();
// throw new TLC4BIOException(e.getMessage());
// }
// }
} }
} }
package de.tlc4b.prettyprint;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
public class Tester {
public Tester(String module, String config) {
File moduleFile;
moduleFile = new File("test.tla");
try {
moduleFile.createNewFile();
} catch (IOException e) {
System.err.println("Could not create File.");
return;
}
Writer fw = null;
try {
String res = module;
fw = new FileWriter(moduleFile);
fw.write(res);
fw.close();
System.out.println("TLA Module test.tla created.");
} catch (IOException e) {
System.err.println("Error while creating file ");
}
File configFile;
configFile = new File("test.cfg");
try {
configFile.createNewFile();
} catch (IOException e) {
System.err.println("Could not create File.");
return;
}
Writer fw2 = null;
try {
String res = config;
fw2 = new FileWriter(configFile);
fw2.write(res);
fw2.close();
System.out.println("TLA Config test.cfg created.");
} catch (IOException e) {
System.err.println("Error while creating file ");
}
}
}
...@@ -134,30 +134,6 @@ public class TestUtil { ...@@ -134,30 +134,6 @@ public class TestUtil {
return translator.getModuleString(); return translator.getModuleString();
} }
public static void createTempfile(String dir, String fileName,
String moduleString) {
File d = new File(dir);
d.mkdirs();
File tempFile = new File(dir + fileName);
try {
tempFile.createNewFile();
System.out
.println("Testfile:'" + tempFile.getName() + "' created.");
} catch (IOException e1) {
e1.printStackTrace();
}
FileWriter fw;
try {
fw = new FileWriter(tempFile);
fw.write(moduleString);
fw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public static TLCResult test(String[] args) throws IOException { public static TLCResult test(String[] args) throws IOException {
System.out.println("Starting JVM..."); System.out.println("Starting JVM...");
final Process p = startJVM("", TLC4BTester.class.getCanonicalName(), args); final Process p = startJVM("", TLC4BTester.class.getCanonicalName(), args);
...@@ -230,14 +206,13 @@ class StreamGobbler extends Thread { ...@@ -230,14 +206,13 @@ class StreamGobbler extends Thread {
public void run() { public void run() {
try { try {
InputStreamReader isr = new InputStreamReader(is); InputStreamReader isr = new InputStreamReader(is, "UTF-8");
BufferedReader br = new BufferedReader(isr); BufferedReader br = new BufferedReader(isr);
String line = null; String line = null;
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
System.out.println("> " + line); System.out.println("> " + line);
log.add(line); log.add(line);
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -50,7 +50,7 @@ public class CompoundScopeTest { ...@@ -50,7 +50,7 @@ public class CompoundScopeTest {
ArrayList<String> list = new ArrayList<String>(map.keySet()); ArrayList<String> list = new ArrayList<String>(map.keySet());
Hashtable<String, MachineContext> machineContextsTable = new Hashtable<String, MachineContext>(); //Hashtable<String, MachineContext> machineContextsTable = new Hashtable<String, MachineContext>();
//Hashtable<String, Typechecker> typecheckerTable = new Hashtable<String, Typechecker>(); //Hashtable<String, Typechecker> typecheckerTable = new Hashtable<String, Typechecker>();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
String name = list.get(i); String name = list.get(i);
......
...@@ -35,7 +35,7 @@ public class CompoundTest { ...@@ -35,7 +35,7 @@ public class CompoundTest {
pragmas.addAll(parser.getPragmas()); pragmas.addAll(parser.getPragmas());
r.loadAllMachines(machineFile, tree, parser.getSourcePositions(), parser.getDefinitions(), pragmas); r.loadAllMachines(machineFile, tree, parser.getSourcePositions(), parser.getDefinitions(), pragmas);
r.printAsProlog(new PrintWriter(System.out), false); //r.printAsProlog(new PrintWriter(System.out), false);
} }
} }
package testing; package testing;
import static de.tlc4b.tlc.TLCResults.TLCResult.*; import static de.tlc4b.tlc.TLCResults.TLCResult.*;
import static org.junit.Assert.assertEquals;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -24,17 +23,15 @@ public class Testing extends AbstractParseMachineTest{ ...@@ -24,17 +23,15 @@ public class Testing extends AbstractParseMachineTest{
private final File machine; private final File machine;
private final TLCResult error;
public Testing(File machine, TLCResult result) { public Testing(File machine, TLCResult result) {
this.machine = machine; this.machine = machine;
this.error = result;
} }
@Test @Test
public void testRunTLC() throws Exception { public void testRunTLC() throws Exception {
String[] a = new String[] { machine.getPath()}; String[] a = new String[] { machine.getPath()};
//B2TLA.main(a); TLC4B.main(a);
//assertEquals(error, B2TLA.test(a,false)); //assertEquals(error, B2TLA.test(a,false));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment