Ghidra is a software reverse engineering (SRE) framework
GP-7031: Updating test and fixing warning
Ryan Kurtzd9a2d109fb53
diff --git a/Ghidra/Features/Base/ghidra_scripts/ExportFunctionInfoScript.java b/Ghidra/Features/Base/ghidra_scripts/ExportFunctionInfoScript.javaindex aa6718162f..6076fd96dd 100644--- a/Ghidra/Features/Base/ghidra_scripts/ExportFunctionInfoScript.java+++ b/Ghidra/Features/Base/ghidra_scripts/ExportFunctionInfoScript.java@@ -16,22 +16,13 @@// Export function information in various formats (JSON, CSV, DOT)//@category Functions-import java.io.BufferedWriter;-import java.io.File;-import java.io.FileWriter;-import java.io.IOException;-import java.util.Arrays;-import java.util.HashMap;-import java.util.HashSet;-import java.util.List;-import java.util.Map;-import java.util.Set;+import java.io.*;+import java.util.*;import com.google.gson.*;import com.google.gson.stream.JsonWriter;import ghidra.app.script.GhidraScript;-import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressSetView;import ghidra.program.model.block.CodeBlockIterator;import ghidra.program.model.block.SimpleBlockModel;@@ -173,8 +164,8 @@ public class ExportFunctionInfoScript extends GhidraScript {summary.addProperty("selection_applied", scope != null);root.add("summary", summary);- try (FileWriter writer = new FileWriter(outputFile)) {- gson.toJson(root, writer);+ try (FileWriter w = new FileWriter(outputFile)) {+ gson.toJson(root, w);}}diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/script/ExportFunctionInfoScriptTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/script/ExportFunctionInfoScriptTest.javaindex 4f70cd7450..04379f40e7 100644--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/script/ExportFunctionInfoScriptTest.java+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/script/ExportFunctionInfoScriptTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,6 +15,7 @@*/package ghidra.app.plugin.core.script;+import static org.hamcrest.MatcherAssert.assertThat;import static org.hamcrest.Matchers.*;import static org.junit.Assert.*;@@ -22,6 +23,8 @@ import java.io.*;import java.util.ArrayList;import java.util.List;+import javax.swing.JDialog;+import org.junit.Before;import org.junit.Test;@@ -77,6 +80,9 @@ public class ExportFunctionInfoScriptTest extends AbstractGhidraHeadedIntegratioScriptTaskListener listener = env.runScript(script);+ JDialog dialog = waitForJDialog("Choose Export Format");+ pressButtonByText(dialog, "OK");+chooseFile(outputFile);waitForScriptCompletion(listener, 20000);