2
0

Reformat to code style.

This commit is contained in:
Maarten Billemont
2018-04-26 13:05:45 -04:00
parent 10698284d2
commit 9c8566b537
38 changed files with 142 additions and 132 deletions

View File

@@ -6,13 +6,13 @@ plugins {
description = 'Master Password Site Model'
dependencies {
compile project(':masterpassword-algorithm')
compile project( ':masterpassword-algorithm' )
compile group: 'joda-time', name: 'joda-time', version:'2.4'
compile group: 'joda-time', name: 'joda-time', version: '2.4'
compileOnly group: 'com.google.auto.value', name: 'auto-value', version: '1.2'
apt group: 'com.google.auto.value', name: 'auto-value', version: '1.2'
apt group: 'com.google.auto.value', name: 'auto-value', version: '1.2'
testCompile group: 'org.testng', name: 'testng', version:'6.8.5'
testCompile group: 'ch.qos.logback', name: 'logback-classic', version:'1.1.2'
testCompile group: 'org.testng', name: 'testng', version: '6.8.5'
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.2'
}
test.useTestNG()

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- PROJECT METADATA -->
@@ -32,10 +33,10 @@
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value</artifactId>
<version>1.0-rc1</version>
<scope>provided</scope>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value</artifactId>
<version>1.0-rc1</version>
<scope>provided</scope>
</dependency>
<!-- TESTING -->

View File

@@ -180,7 +180,8 @@ public class MPFileSite extends MPSite {
this.loginContent = null;
else
this.loginContent = masterKey.siteState(
siteName, MPAlgorithm.mpw_default_counter, MPKeyPurpose.Identification, null, this.loginType, result, algorithmVersion );
siteName, MPAlgorithm.mpw_default_counter, MPKeyPurpose.Identification, null, this.loginType, result,
algorithmVersion );
}
@Nullable

View File

@@ -58,7 +58,7 @@ public class MPFlatMarshaller implements MPMarshaller {
for (final MPFileSite site : user.getSites()) {
String loginName = site.getLoginContent();
String password = site.getSiteContent();
String password = site.getSiteContent();
if (!contentMode.isRedacted()) {
loginName = site.loginFor( masterKey );
password = site.resultFor( masterKey );

View File

@@ -37,7 +37,7 @@ import org.joda.time.DateTime;
*/
public class MPFlatUnmarshaller implements MPUnmarshaller {
private static final Logger logger = Logger.get( MPFlatUnmarshaller.class );
private static final Logger logger = Logger.get( MPFlatUnmarshaller.class );
private static final Pattern[] unmarshallFormats = {
Pattern.compile( "^([^ ]+) +(\\d+) +(\\d+)(:\\d+)? +([^\t]+)\t(.*)" ),
Pattern.compile( "^([^ ]+) +(\\d+) +(\\d+)(:\\d+)?(:\\d+)? +([^\t]*)\t *([^\t]+)\t(.*)" ) };
@@ -73,7 +73,8 @@ public class MPFlatUnmarshaller implements MPUnmarshaller {
headerStarted = true;
else
// Ends the header.
user = new MPFileUser( fullName, keyID, MPMasterKey.Version.fromInt( mpVersion ), avatar, defaultType, new DateTime( 0 ), MPMarshalFormat.Flat );
user = new MPFileUser( fullName, keyID, MPMasterKey.Version.fromInt( mpVersion ), avatar, defaultType,
new DateTime( 0 ), MPMarshalFormat.Flat );
// Comment.
else if (line.startsWith( "#" )) {
@@ -116,7 +117,7 @@ public class MPFlatUnmarshaller implements MPUnmarshaller {
user.getAlgorithmVersion().getAlgorithm().mpw_default_counter,
MPResultType.forType( ConversionUtils.toIntegerNN( siteMatcher.group( 3 ) ) ),
MPMasterKey.Version.fromInt( ConversionUtils.toIntegerNN(
colon.matcher( siteMatcher.group( 4 ) ).replaceAll( "" ) ) ),
colon.matcher( siteMatcher.group( 4 ) ).replaceAll( "" ) ) ),
null, null, null, ConversionUtils.toIntegerNN( siteMatcher.group( 2 ) ),
MPConstant.dateTimeFormatter.parseDateTime( siteMatcher.group( 1 ) ).toInstant() );
break;
@@ -127,7 +128,7 @@ public class MPFlatUnmarshaller implements MPUnmarshaller {
UnsignedInteger.valueOf( colon.matcher( siteMatcher.group( 5 ) ).replaceAll( "" ) ),
MPResultType.forType( ConversionUtils.toIntegerNN( siteMatcher.group( 3 ) ) ),
MPMasterKey.Version.fromInt( ConversionUtils.toIntegerNN(
colon.matcher( siteMatcher.group( 4 ) ).replaceAll( "" ) ) ),
colon.matcher( siteMatcher.group( 4 ) ).replaceAll( "" ) ) ),
siteMatcher.group( 6 ), MPResultType.GeneratedName, null,
ConversionUtils.toIntegerNN( siteMatcher.group( 2 ) ),
MPConstant.dateTimeFormatter.parseDateTime( siteMatcher.group( 1 ) ).toInstant() );

View File

@@ -38,7 +38,7 @@ public class MPJSONUnmarshaller implements MPUnmarshaller {
@Nonnull
@Override
public MPFileUser unmarshall(@Nonnull final String content)
throws MPMarshalException{
throws MPMarshalException {
throw new MPMarshalException( "Not yet implemented" );
}
}

View File

@@ -36,8 +36,8 @@ public interface MPMarshaller {
PROTECTED( "Export of site names and stored passwords (unless device-private) encrypted with the master key." ),
VISIBLE( "Export of site names and passwords in clear-text." );
private final String description;
private boolean redacted;
private final String description;
private boolean redacted;
ContentMode(final String description) {
this.description = description;

View File

@@ -59,7 +59,8 @@ public abstract class MPSite {
throws MPInvalidatedException {
return masterKey.siteResult(
getSiteName(), MPAlgorithm.mpw_default_counter, MPKeyPurpose.Identification, null, loginType, loginContent, getAlgorithmVersion() );
getSiteName(), MPAlgorithm.mpw_default_counter, MPKeyPurpose.Identification, null, loginType, loginContent,
getAlgorithmVersion() );
}
@Override

View File

@@ -29,7 +29,7 @@ import java.util.*;
public abstract class MPUserManager {
private final Map<String, MPFileUser> usersByName = Maps.newHashMap();
static MPUserManager instance;
static MPUserManager instance;
public static MPUserManager get() {
return instance;

View File

@@ -17,7 +17,6 @@
//==============================================================================
/**
*
* @author lhunath, 15-02-04
*/