Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing findbugs warnings after plugin pom upgrade #41

Merged
merged 6 commits into from
Feb 14, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/findbugs/excludesFilter.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
<Match>
<Package name="org.jenkinsci.plugins.pipeline.utility.steps.shaded"/>
<Package name="~org\.jenkinsci\.plugins\.pipeline\.utility\.steps\.shaded.*"/>
</Match>
<Match>
<Class name="~.*\.Messages"/>
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
* @author Robert Sandell &lt;rsandell@cloudbees.com&gt;.
*/
public class ReadPropertiesStepExecution extends AbstractFileOrTextStepExecution<Map<String, Object>> {
private static final long serialVersionUID = 1L;

private transient ReadPropertiesStep step;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public String getDisplayName() {
}

public static class Execution extends SynchronousNonBlockingStepExecution<Void> {
private static final long serialVersionUID = 1L;

private transient WriteYamlStep step;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
* @author Robert Sandell &lt;rsandell@cloudbees.com&gt;.
*/
public class ReadManifestStepExecution extends AbstractFileOrTextStepExecution<SimpleManifest> {
private static final long serialVersionUID = 1L;

private transient ReadManifestStep step;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected String run() throws Exception {
return filePath.act(new ComputeSha1());
}

private class ComputeSha1 extends MasterToSlaveFileCallable<String> {
private static class ComputeSha1 extends MasterToSlaveFileCallable<String> {
@Override
public String invoke(File file, VirtualChannel virtualChannel) throws IOException, InterruptedException {
if (file.exists() && file.isFile()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
* @author Robert Sandell &lt;rsandell@cloudbees.com&gt;.
*/
public class FindFilesStepExecution extends SynchronousNonBlockingStepExecution<FileWrapper[]> {
private static final long serialVersionUID = 1L;

@Inject
private transient FindFilesStep step;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ public OutputStream decorateLogger(Run build, final OutputStream logger) throws
private static OutputStream append(FilePath fp) throws IOException, InterruptedException {
if (fp.getChannel() == null) {
File f = new File(fp.getRemote()).getAbsoluteFile();
f.getParentFile().mkdirs();
if (!f.getParentFile().exists() && !f.getParentFile().mkdirs()) {
throw new IOException("Failed to create directory " + f.getParentFile());
}
try {
return Files.newOutputStream(f.toPath(), StandardOpenOption.CREATE, StandardOpenOption.APPEND/*, StandardOpenOption.DSYNC*/);
} catch (InvalidPathException e) {
Expand All @@ -120,7 +122,9 @@ private static OutputStream append(FilePath fp) throws IOException, InterruptedE
@Override
public OutputStream invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
f = f.getAbsoluteFile();
f.getParentFile().mkdirs();
if (!f.getParentFile().exists() && !f.getParentFile().mkdirs()) {
throw new IOException("Failed to create directory " + f.getParentFile());
}
try {
return new RemoteOutputStream(Files.newOutputStream(f.toPath(), StandardOpenOption.CREATE, StandardOpenOption.APPEND/*, StandardOpenOption.DSYNC*/));
} catch (InvalidPathException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public FormValidation doCheckFile(@QueryParameter String value) {
* The execution of {@link TouchStep}.
*/
public static class ExecutionImpl extends SynchronousNonBlockingStepExecution<FileWrapper> {
private static final long serialVersionUID = 1L;

private transient TouchStep step;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
* @author Nikolas Falco
*/
public class ReadJSONStepExecution extends AbstractFileOrTextStepExecution<JSON> {
private static final long serialVersionUID = 1L;

private transient ReadJSONStep step;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
* @author Nikolas Falco
*/
public class WriteJSONStepExecution extends SynchronousNonBlockingStepExecution<Void> {
private static final long serialVersionUID = 1L;

private transient WriteJSONStep step;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public String getDisplayName() {
}

public static class Execution extends SynchronousNonBlockingStepExecution<Model> {
private static final long serialVersionUID = 1L;

private transient ReadMavenPomStep step;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public String getDisplayName() {
}

public static class Execution extends SynchronousNonBlockingStepExecution<Void> {
private static final long serialVersionUID = 1L;

private transient WriteMavenPomStep step;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
* @author Robert Sandell &lt;rsandell@cloudbees.com&gt;.
*/
public class UnZipStepExecution extends SynchronousNonBlockingStepExecution<Object> {
private static final long serialVersionUID = 1L;

private transient UnZipStep step;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
* @author Robert Sandell &lt;rsandell@cloudbees.com&gt;.
*/
public class ZipStepExecution extends SynchronousNonBlockingStepExecution<Void> {
private static final long serialVersionUID = 1L;

private transient ZipStep step;

Expand Down