2
0

Consistent SpotBugs configuration & warning fixes.

This commit is contained in:
Maarten Billemont
2019-09-24 11:19:21 -04:00
parent d0dc393d70
commit 36692ac10d
12 changed files with 62 additions and 34 deletions

View File

@@ -1,6 +1,5 @@
plugins {
id 'java-library'
id 'com.github.spotbugs' version '2.0.0'
}
description = 'Master Password Site Model'
@@ -8,7 +7,7 @@ description = 'Master Password Site Model'
dependencies {
implementation group: 'com.lyndir.lhunath.opal', name: 'opal-system', version: '1.7-p2'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.9.8'
implementation 'com.github.spotbugs:spotbugs-annotations:4.0.0-beta4'
implementation group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: '4.0.0-beta4'
api project( ':masterpassword-algorithm' )
api group: 'joda-time', name: 'joda-time', version: '2.10'

View File

@@ -21,6 +21,7 @@ package com.lyndir.masterpassword.model.impl;
import com.lyndir.lhunath.opal.system.logging.Logger;
import com.lyndir.masterpassword.*;
import com.lyndir.masterpassword.model.*;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.File;
import java.io.IOException;
import javax.annotation.Nonnull;
@@ -66,6 +67,7 @@ public class MPFileUser extends MPBasicUser<MPFileSite> {
MPMarshaller.ContentMode.PROTECTED, MPMarshalFormat.DEFAULT, location );
}
@SuppressFBWarnings("PATH_TRAVERSAL_IN")
public MPFileUser(final String fullName, @Nullable final byte[] keyID, final MPAlgorithm algorithm, final int avatar,
@Nullable final MPResultType defaultType, final ReadableInstant lastUsed, final boolean hidePasswords,
final MPMarshaller.ContentMode contentMode, final MPMarshalFormat format, final File location) {
@@ -169,6 +171,7 @@ public class MPFileUser extends MPBasicUser<MPFileSite> {
* The user's old file is either moved to the new or deleted. If the user's file was already at the destination, it doesn't change.
* If a file already exists at the destination, it is overwritten.
*/
@SuppressFBWarnings("PATH_TRAVERSAL_IN")
public void migrateTo(final File path, final MPMarshalFormat newFormat) {
MPMarshalFormat oldFormat = format;
File oldFile = file, newFile = new File( path, getFullName() + newFormat.fileSuffix() );