Skip to content

Commit 2f8ff5c

Browse files
committed
Make spotbugs happy
1 parent b741445 commit 2f8ff5c

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

src/main/java/com/fortify/plugin/jenkins/FortifyPlugin.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,9 +1443,8 @@ private String sanitizeUnicodeControls(String unsafeInput) {
14431443
}
14441444
String trimmed = unsafeInput.trim();
14451445
// we are limited with validation by the chars SSC supports for their application and version names
1446-
//String withoutUnicodeControls = trimmed.replaceAll("[\\p{C}&&\\p{Cntrl}]", "?");
1447-
//return withoutUnicodeControls;
1448-
return trimmed;
1446+
String withoutUnicodeControls = trimmed.replaceAll("[\\p{C}&&\\p{Cntrl}]", "?");
1447+
return withoutUnicodeControls;
14491448
}
14501449

14511450
private StringBuilder appVersionToJson(String appName, Map<String, Long> appVersions) {

src/main/java/com/fortify/plugin/jenkins/TableAction.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package com.fortify.plugin.jenkins;
1717

1818
import java.io.IOException;
19+
import java.io.ObjectInputStream;
1920
import java.io.Serializable;
2021
import java.nio.charset.Charset;
2122
import java.util.ArrayList;
@@ -516,11 +517,12 @@ public static class View implements Comparable, Serializable {
516517
private int page;
517518
private SortOrder sortOrder;
518519
private boolean sortDownNotUp;
519-
private List<IssueBean> issuesByFolder;
520-
private Boolean needsUpdate;
521520
private int pageSize;
522521
private boolean showingAllNotNew;
523-
private String SelectedGrouping;
522+
private String selectedGrouping;
523+
524+
private transient List<IssueBean> issuesByFolder = null;
525+
private transient Boolean needsUpdate = null;
524526

525527
public View(IssueFolderBean descriptor, FortifyUpload manager, int pageNum) {
526528
this.folder = descriptor;
@@ -530,13 +532,19 @@ public View(IssueFolderBean descriptor, FortifyUpload manager, int pageNum) {
530532
sortOrder = SortOrder.location;
531533
pageSize = manager.getIssuePageSize();
532534
showingAllNotNew = true;
533-
SelectedGrouping = "Category";
535+
selectedGrouping = "Category";
534536
scheduleUpdate();
535537
}
536538

539+
private void readObject(ObjectInputStream aInputStream) throws ClassNotFoundException, IOException {
540+
needsUpdate = null;
541+
issuesByFolder = null;
542+
aInputStream.defaultReadObject();
543+
}
544+
537545
@JavaScriptMethod
538546
public String getSelectedGrouping() {
539-
return SelectedGrouping;
547+
return selectedGrouping;
540548
}
541549

542550
@JavaScriptMethod

src/main/java/com/fortify/plugin/jenkins/bean/IssueFolderBean.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@
1515
*******************************************************************************/
1616
package com.fortify.plugin.jenkins.bean;
1717

18+
import java.io.Serializable;
1819
import java.io.UnsupportedEncodingException;
1920
import java.net.URLEncoder;
2021
import java.util.List;
2122

2223
import com.fortify.plugin.jenkins.FortifyPlugin;
2324

24-
public class IssueFolderBean implements Comparable {
25+
public class IssueFolderBean implements Comparable, Serializable {
26+
private static final long serialVersionUID = 9056328734887354382L;
27+
2528
public static final String ATTRIBUTE_VALUE_ALL = "All";
2629

2730
public static final String NAME_CRITICAL = "Critical";

src/main/java/com/fortify/plugin/jenkins/steps/FortifyUpload.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717

1818
import java.io.File;
1919
import java.io.IOException;
20+
import java.io.ObjectInputStream;
2021
import java.io.OutputStreamWriter;
2122
import java.io.PrintStream;
2223
import java.io.PrintWriter;
24+
import java.io.Serializable;
2325
import java.io.Writer;
2426
import java.nio.charset.Charset;
2527
import java.util.ArrayList;
@@ -71,7 +73,8 @@
7173
import net.sf.json.JSONException;
7274
import net.sf.json.JSONObject;
7375

74-
public class FortifyUpload extends FortifyStep {
76+
public class FortifyUpload extends FortifyStep implements Serializable {
77+
private static final long serialVersionUID = -8308672776705963290L;
7578

7679
private boolean accessToProject = true;
7780
private int pageSize = 0;
@@ -879,7 +882,7 @@ private <T> T runWithFortifyClient(String token, FortifyClient.Command<T> cmd) t
879882
}
880883

881884
private static class Execution extends SynchronousNonBlockingStepExecution<Void> {
882-
private transient FortifyUpload upload;
885+
private FortifyUpload upload;
883886

884887
protected Execution(FortifyUpload upload, StepContext context) {
885888
super(context);
@@ -896,6 +899,5 @@ protected Void run() throws Exception {
896899
}
897900

898901
private static final long serialVersionUID = 1L;
899-
900902
}
901903
}

0 commit comments

Comments
 (0)