Skip to content

Commit

Permalink
sonarqube fixes. issue #2395
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Aug 15, 2024
1 parent d309a80 commit edf4e3b
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ public AssistantResultDialog(java.awt.Frame parent, boolean modal, AiRequestStat

if(status.getResponse().getOutputData()!=null && !status.getResponse().getOutputData().isEmpty()) {
for(OutputData d: status.getResponse().getOutputData()) {
if(d.getType().equalsIgnoreCase("string")) {
if(d.getType().equalsIgnoreCase(OutputData.TYPE_STRING)) {
this.taString.append(d.getStringData());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ public GenericAssistantDialog(AssistantConfig config, AiCapability c, AssistantI
this.taInputString.setText("");

for (InputData i : inputAdapter.getInputs(c)) {
if ("string".equalsIgnoreCase(i.getType())) {
if (InputData.TYPE_STRING.equalsIgnoreCase(i.getType())) {
this.taInputString.append(i.getStringData());
this.taInputString.append(System.lineSeparator());
} else {
Expand Down Expand Up @@ -1107,7 +1107,7 @@ private void startBackgroundTask() {
protected Void doInBackground() throws Exception {
List<InputData> inputs=inputAdapter.getInputs(capability);
for (InputData i : inputs) {
if ("string".equalsIgnoreCase(i.getType())) {
if (InputData.TYPE_STRING.equalsIgnoreCase(i.getType())) {
i.setStringData(taInputString.getText());
}
}
Expand All @@ -1134,14 +1134,14 @@ protected void done() {
if (status.getStatus().equalsIgnoreCase("error")) {
taResult.setText(status.getStatus() + ": " + status.getStatusDetails());
} else {
StringBuilder result = new StringBuilder();
StringBuilder resultString = new StringBuilder();
for (OutputData o : status.getResponse().getOutputData()) {
if (o.getType().equalsIgnoreCase("string")) {
result.append(o.getStringData()).append(System.lineSeparator()).append(System.lineSeparator());
if (o.getType().equalsIgnoreCase(OutputData.TYPE_STRING)) {
resultString.append(o.getStringData()).append(System.lineSeparator()).append(System.lineSeparator());
}

}
taResult.setText(result.toString());
taResult.setText(resultString.toString());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ public void processOutput(AiCapability c, AiRequestStatus status) {
status.getResponse();
StringBuilder result=new StringBuilder();
for(OutputData o: status.getResponse().getOutputData()) {
if(o.getType().equalsIgnoreCase("string"))
if(o.getType().equalsIgnoreCase(OutputData.TYPE_STRING))
result.append(o.getStringData()).append(System.lineSeparator()).append(System.lineSeparator());

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7363,7 +7363,7 @@ public List<InputData> getInputs(AiCapability c) {

InputData i = new InputData();
//i.setFileName("sound.wav");
i.setType("string");
i.setType(InputData.TYPE_STRING);
i.setBase64(false);
//i.setData(selectedText);
i.setStringData(docText);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2156,7 +2156,7 @@ public List<InputData> getInputs(AiCapability c) {
ArrayList<InputData> inputs = new ArrayList<>();
InputData i = new InputData();
//i.setFileName("sound.wav");
i.setType("string");
i.setType(InputData.TYPE_STRING);
i.setBase64(false);
//i.setData(selectedText);
i.setStringData(selectedText);
Expand All @@ -2176,7 +2176,7 @@ public void processOutput(AiCapability c, AiRequestStatus status) {
} else {
StringBuilder result = new StringBuilder();
for (OutputData o : status.getResponse().getOutputData()) {
if (o.getType().equalsIgnoreCase("string")) {
if (o.getType().equalsIgnoreCase(InputData.TYPE_STRING)) {
result.append(o.getStringData()).append(System.lineSeparator()).append(System.lineSeparator());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1204,8 +1204,7 @@ public List<InputData> getInputs(AiCapability c) {

ArrayList<InputData> inputs = new ArrayList<>();
InputData i = new InputData();
//i.setFileName("sound.wav");
i.setType("string");
i.setType(InputData.TYPE_STRING);
i.setBase64(false);
i.setStringData(contentText);

Expand All @@ -1226,7 +1225,7 @@ public void processOutput(AiCapability c, AiRequestStatus status) {
} else {
StringBuilder result = new StringBuilder();
for (OutputData o : status.getResponse().getOutputData()) {
if (o.getType().equalsIgnoreCase("string")) {
if (o.getType().equalsIgnoreCase(OutputData.TYPE_STRING)) {
result.append(o.getStringData()).append(System.lineSeparator()).append(System.lineSeparator());
}

Expand Down
2 changes: 2 additions & 0 deletions j-lawyer-fax/src/com/jdimension/jlawyer/ai/InputData.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

public class InputData implements Serializable {

public static final String TYPE_STRING="string";

private String type;
private String stringData;
private byte[] data;
Expand Down
3 changes: 3 additions & 0 deletions j-lawyer-fax/src/com/jdimension/jlawyer/ai/OutputData.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
* @author jens
*/
public class OutputData implements Serializable {

public static final String TYPE_STRING="string";

private String type;
private String stringData;
private byte[] data;
Expand Down

0 comments on commit edf4e3b

Please sign in to comment.