File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/main/java/org/algorithm_visualizer Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 13
13
import java .io .InputStreamReader ;
14
14
import java .io .Writer ;
15
15
import java .nio .file .Files ;
16
+ import java .nio .file .Path ;
16
17
import java .nio .file .Paths ;
17
18
import java .util .ArrayList ;
18
19
import java .util .List ;
@@ -31,8 +32,12 @@ public Response handleRequest(String code, Context context) {
31
32
compile (sourceFile );
32
33
run (tmpDir );
33
34
34
- String commands = new String (Files .readAllBytes (Paths .get (tmpDir .toString (), "visualization.json" )));
35
+ Path visualizationPath = Paths .get (tmpDir .toString (), "visualization.json" );
36
+ if (!visualizationPath .toFile ().exists ())
37
+ throw new Exception ("Visualization Not Found" );
38
+ String commands = new String (Files .readAllBytes (visualizationPath ));
35
39
return new Response (commands );
40
+
36
41
} catch (Exception e ) {
37
42
return new Response (e );
38
43
}
You can’t perform that action at this time.
0 commit comments