Skip to content

Commit

Permalink
Investigating issue #68
Browse files Browse the repository at this point in the history
  • Loading branch information
ojcchar committed Jul 31, 2021
1 parent 88bf2a1 commit 449c8d6
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 1,201 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
import sealab.burt.qualitychecker.graph.db.GraphGenerator;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -72,17 +75,14 @@ public static void readGraph(String appName, String appVersion) throws Exception
String.join("-", packageName, appVersion)).toString();

String key = getKey(appName, appVersion);
// log.debug("Reading graph from JSON files for " + key);
log.debug("Reading graph from JSON files for " + key);

List<Execution> crashScopeExecutions = readExecutions(dataLocation);
GraphGenerator generator = new GraphGenerator();

// changed code: check if crashScopeExecutions is empty
// check if crashScopeExecutions is empty
if (!crashScopeExecutions.isEmpty()) {
App app = crashScopeExecutions.get(0).getApp();

//----------------------------------------

generator.generateGraph(crashScopeExecutions, app, GraphDataSource.CS);
}

Expand Down Expand Up @@ -144,27 +144,21 @@ private static void checkScreenshots(AppGraphInfo graphInfo) {

private static List<Execution> readExecutions(String dataLocation) throws Exception {

//--------------------------
// List<Path> executionFiles = Files.find(Paths.get(dataLocation), 1,
// (path, attr) -> path.toFile().getName().startsWith("Execution-"))
// .collect(Collectors.toList());
//------ changed code: check if the path exists---------------//
//------ check if the path exists---------------//
List<Path> executionFiles = new ArrayList<>();
File folder = new File(String.valueOf(Paths.get(dataLocation)));
if (folder.exists() && folder.isDirectory()){
File folder = new File(dataLocation);
if (folder.exists()){
executionFiles = Files.find(Paths.get(dataLocation), 1,
(path, attr) -> path.toFile().getName().startsWith("Execution-"))
.collect(Collectors.toList());
}
//------ new code: check if the path exists---------------//
//------ check if the path exists---------------//

if (executionFiles.isEmpty())
// throw new RuntimeException("There are no execution files in " + dataLocation);
log.debug("There are no execution files in " + dataLocation);

log.debug("Reading execution data from : " + executionFiles);


//----------------------
List<Execution> executions = new ArrayList<>();
Long componentId = 0L;
Expand All @@ -174,9 +168,11 @@ private static List<Execution> readExecutions(String dataLocation) throws Except
for (int i = 0; i < executionFiles.size(); i++) {
Path executionFile = executionFiles.get(i);


//Set up a new Gson object
JsonReader reader = new JsonReader(new FileReader(executionFile.toFile()));
// JsonReader reader = new JsonReader(new FileReader(executionFile.toFile()));
JsonReader reader = new JsonReader(new InputStreamReader(
new FileInputStream(executionFile.toFile()), StandardCharsets.UTF_8
));

// De-serialize the Execution object.
Execution execution = gson.fromJson(reader, Execution.class);
Expand Down
2 changes: 1 addition & 1 deletion burt-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<dependency>`
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.List;

Expand All @@ -25,7 +26,7 @@ class HTMLBugReportGenerator {
public void generateOutput(File outputFile, ConversationState state) throws Exception {
File htmlTemplate = new File(Path.of(".", "example", "template.html").toString());
String finalReport = generateHTML(htmlTemplate, state);
FileUtils.write(outputFile, finalReport, Charset.defaultCharset());
FileUtils.write(outputFile, finalReport, StandardCharsets.UTF_8);
bugReportId++;
}

Expand Down
62 changes: 47 additions & 15 deletions burt-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
<groupId>sealab.burt</groupId>
<artifactId>burt-tools</artifactId>
<version>0.0.1</version>

<name>burt-tools</name>
<description>BURTs miscellaneous tools</description>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<java.version>11</java.version>
</properties>

<dependencies>
Expand All @@ -24,18 +21,53 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>Android-Core</groupId>
<artifactId>Android-Core</artifactId>
<version>1.0</version>
<scope>compile</scope>

<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.18</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>dependency</classpathPrefix>
<mainClass>
class
</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>

</project>
11 changes: 11 additions & 0 deletions burt-tools/run_graph_generation.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

set CUR_DIR=%CD%

cd ..\burt-nlparser && call mvn clean install -DskipTests && @echo on
cd ..\burt-quality-checker && call mvn clean install -DskipTests && @echo on

cd "%CUR_DIR%"

call mvn package -DskipTests
REM call java -Dfile.encoding=UTF-8 -cp target\burt-tools-0.0.1.jar MainJSONGraphGenerator
call java -cp target\burt-tools-0.0.1.jar MainJSONGraphGenerator
12 changes: 12 additions & 0 deletions burt-tools/run_graph_generation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export CUR_DIR=`pwd`


cd $CUR_DIR

cd ../burt-nlparser && mvn clean install -DskipTests
#cd ../crashscope && mvn clean install -DskipTests
cd ../burt-quality-checker && mvn clean install -DskipTests
cd $CUR_DIR

mvn package -DskipTests
java -cp target/burt-tools-0.0.1.jar MainJSONGraphGenerator
42 changes: 0 additions & 42 deletions burt-tools/src/main/java/DBUtils.java

This file was deleted.

72 changes: 0 additions & 72 deletions burt-tools/src/main/java/DeviceUtils.java

This file was deleted.

Loading

0 comments on commit 449c8d6

Please sign in to comment.