MCPcopy Index your code
hub / github.com/SummerSec/SPATool / handle

Method handle

src/main/java/com/sumsec/core/ast/core/ASTJSON.java:35–52  ·  view source on GitHub ↗
(String content,String filepath)

Source from the content-addressed store, hash-verified

33 return "JSON";
34 }
35 @Override
36 public void handle(String content,String filepath) {
37 log.info("handle JSON");
38 CompilationUnit cu = parse(content);
39 JavaParserJsonSerializer jsonSerializer = new JavaParserJsonSerializer();
40 Map<String, ?> config = new HashMap<>();
41 config.put(JsonGenerator.PRETTY_PRINTING, null);
42 StringWriter writer = new StringWriter();
43 JsonGeneratorFactory generatorFactory = Json.createGeneratorFactory(config);
44 JsonGenerator jsonGenerator = generatorFactory.createGenerator(writer);
45 jsonSerializer.serialize(cu,jsonGenerator);
46 FileWriter fileWriter = new FileWriter(filepath);
47 fileWriter.write(writer.toString());
48
49 log.info("write JSON to file");
50 log.info("Json file path: {}",filepath);
51 log.info("handle JSON end");
52 }
53
54}

Callers

nothing calls this directly

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected