2
0

JDK 8 support for Android platform.

This commit is contained in:
Maarten Billemont
2018-06-10 15:22:37 -04:00
parent 4909479b0f
commit 9a564ff35e
19 changed files with 67 additions and 299 deletions

View File

@@ -9,7 +9,7 @@ configurations {
}
dependencies {
implementation group: 'com.lyndir.lhunath.opal', name: 'opal-system', version: '1.7-p1'
implementation group: 'com.lyndir.lhunath.opal', name: 'opal-system', version: '1.7-p2'
api group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.9.5'
api group: 'org.jetbrains', name: 'annotations', version: '13.0'

View File

@@ -8,7 +8,7 @@ description = 'Master Password GUI'
mainClassName = 'com.lyndir.masterpassword.gui.GUI'
dependencies {
implementation group: 'com.lyndir.lhunath.opal', name: 'opal-system', version: '1.7-p1'
implementation group: 'com.lyndir.lhunath.opal', name: 'opal-system', version: '1.7-p2'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.2'
implementation group: 'com.yuvimasory', name: 'orange-extensions', version: '1.3.0'

View File

@@ -19,7 +19,7 @@
package com.lyndir.masterpassword.gui;
import com.lyndir.lhunath.opal.system.util.ConversionUtils;
import com.lyndir.masterpassword.model.MPConstant;
import com.lyndir.masterpassword.model.MPConstants;
/**
@@ -35,6 +35,6 @@ public class Config {
}
public boolean checkForUpdates() {
return ConversionUtils.toBoolean( System.getenv( MPConstant.env_checkUpdates ) ).orElse( true );
return ConversionUtils.toBoolean( System.getenv( MPConstants.env_checkUpdates ) ).orElse( true );
}
}

View File

@@ -6,7 +6,7 @@ plugins {
description = 'Master Password Site Model'
dependencies {
implementation group: 'com.lyndir.lhunath.opal', name: 'opal-system', version: '1.7-p1'
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.5'
api project( ':masterpassword-algorithm' )

View File

@@ -25,7 +25,7 @@ import org.joda.time.format.ISODateTimeFormat;
/**
* @author lhunath, 2016-10-29
*/
public final class MPConstant {
public final class MPConstants {
/* Environment */
@@ -40,7 +40,5 @@ public final class MPConstant {
/* Algorithm */
public static final int MS_PER_S = 1000;
public static final DateTimeFormatter dateTimeFormatter = ISODateTimeFormat.dateTimeNoMillis().withZoneUTC();
}

View File

@@ -45,7 +45,7 @@ public class MPFileUserManager extends MPUserManager<MPFileUser> {
private static final MPFileUserManager instance;
static {
String rcDir = System.getenv( MPConstant.env_rcDir );
String rcDir = System.getenv( MPConstants.env_rcDir );
if (rcDir != null)
instance = create( new File( rcDir ) );
else

View File

@@ -23,7 +23,7 @@ import static com.lyndir.lhunath.opal.system.util.StringUtils.*;
import com.lyndir.masterpassword.MPAlgorithmException;
import com.lyndir.masterpassword.MPKeyUnavailableException;
import com.lyndir.masterpassword.model.MPConstant;
import com.lyndir.masterpassword.model.MPConstants;
import javax.annotation.Nonnull;
import org.joda.time.Instant;
@@ -46,7 +46,7 @@ public class MPFlatMarshaller implements MPMarshaller {
content.append( "# \n" );
content.append( "##\n" );
content.append( "# Format: " ).append( FORMAT ).append( '\n' );
content.append( "# Date: " ).append( MPConstant.dateTimeFormatter.print( new Instant() ) ).append( '\n' );
content.append( "# Date: " ).append( MPConstants.dateTimeFormatter.print( new Instant() ) ).append( '\n' );
content.append( "# User Name: " ).append( user.getFullName() ).append( '\n' );
content.append( "# Full Name: " ).append( user.getFullName() ).append( '\n' );
content.append( "# Avatar: " ).append( user.getAvatar() ).append( '\n' );
@@ -68,7 +68,7 @@ public class MPFlatMarshaller implements MPMarshaller {
}
content.append( strf( "%s %8d %8s %25s\t%25s\t%s\n", //
MPConstant.dateTimeFormatter.print( site.getLastUsed() ), // lastUsed
MPConstants.dateTimeFormatter.print( site.getLastUsed() ), // lastUsed
site.getUses(), // uses
strf( "%d:%d:%d", //
site.getResultType().getType(), // type

View File

@@ -25,7 +25,7 @@ import com.lyndir.lhunath.opal.system.CodeUtils;
import com.lyndir.lhunath.opal.system.logging.Logger;
import com.lyndir.lhunath.opal.system.util.ConversionUtils;
import com.lyndir.masterpassword.*;
import com.lyndir.masterpassword.model.MPConstant;
import com.lyndir.masterpassword.model.MPConstants;
import com.lyndir.masterpassword.model.MPIncorrectMasterPasswordException;
import java.io.*;
import java.util.regex.Matcher;
@@ -123,7 +123,7 @@ public class MPFlatUnmarshaller implements MPUnmarshaller {
MPResultType.forType( ConversionUtils.toIntegerNN( siteMatcher.group( 3 ) ) ),
clearContent? null: siteMatcher.group( 6 ),
null, null, null, ConversionUtils.toIntegerNN( siteMatcher.group( 2 ) ),
MPConstant.dateTimeFormatter.parseDateTime( siteMatcher.group( 1 ) ).toInstant() );
MPConstants.dateTimeFormatter.parseDateTime( siteMatcher.group( 1 ) ).toInstant() );
if (clearContent)
site.setSitePassword( site.getResultType(), siteMatcher.group( 6 ) );
break;
@@ -137,7 +137,7 @@ public class MPFlatUnmarshaller implements MPUnmarshaller {
clearContent? null: siteMatcher.group( 8 ),
MPResultType.GeneratedName, clearContent? null: siteMatcher.group( 6 ), null,
ConversionUtils.toIntegerNN( siteMatcher.group( 2 ) ),
MPConstant.dateTimeFormatter.parseDateTime( siteMatcher.group( 1 ) ).toInstant() );
MPConstants.dateTimeFormatter.parseDateTime( siteMatcher.group( 1 ) ).toInstant() );
if (clearContent) {
site.setSitePassword( site.getResultType(), siteMatcher.group( 8 ) );
site.setLoginName( MPResultType.StoredPersonal, siteMatcher.group( 6 ) );

View File

@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.primitives.UnsignedInteger;
import com.lyndir.lhunath.opal.system.CodeUtils;
import com.lyndir.masterpassword.*;
import com.lyndir.masterpassword.model.MPConstant;
import com.lyndir.masterpassword.model.MPConstants;
import com.lyndir.masterpassword.model.MPIncorrectMasterPasswordException;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.LinkedHashMap;
@@ -54,14 +54,14 @@ public class MPJSONFile extends MPJSONAnyObject {
export = new Export();
export.format = 1;
export.redacted = modelUser.getContentMode().isRedacted();
export.date = MPConstant.dateTimeFormatter.print( new Instant() );
export.date = MPConstants.dateTimeFormatter.print( new Instant() );
// Section: "user"
if (user == null)
user = new User();
user.avatar = modelUser.getAvatar();
user.full_name = modelUser.getFullName();
user.last_used = MPConstant.dateTimeFormatter.print( modelUser.getLastUsed() );
user.last_used = MPConstants.dateTimeFormatter.print( modelUser.getLastUsed() );
user.key_id = modelUser.exportKeyID();
user.algorithm = modelUser.getAlgorithm().version();
user.default_type = modelUser.getDefaultType();
@@ -96,7 +96,7 @@ public class MPJSONFile extends MPJSONAnyObject {
site.login_type = modelSite.getLoginType();
site.uses = modelSite.getUses();
site.last_used = MPConstant.dateTimeFormatter.print( modelSite.getLastUsed() );
site.last_used = MPConstants.dateTimeFormatter.print( modelSite.getLastUsed() );
if (site._ext_mpw == null)
site._ext_mpw = new Site.Ext();
@@ -141,7 +141,7 @@ public class MPJSONFile extends MPJSONAnyObject {
MPFileUser model = new MPFileUser(
user.full_name, CodeUtils.decodeHex( user.key_id ), algorithm, user.avatar,
(user.default_type != null)? user.default_type: algorithm.mpw_default_result_type(),
(user.last_used != null)? MPConstant.dateTimeFormatter.parseDateTime( user.last_used ): new Instant(),
(user.last_used != null)? MPConstants.dateTimeFormatter.parseDateTime( user.last_used ): new Instant(),
MPMarshalFormat.JSON, export.redacted? MPMarshaller.ContentMode.PROTECTED: MPMarshaller.ContentMode.VISIBLE );
model.setJSON( this );
if (masterPassword != null)
@@ -155,7 +155,7 @@ public class MPJSONFile extends MPJSONAnyObject {
export.redacted? fileSite.password: null,
fileSite.login_type, export.redacted? fileSite.login_name: null,
(fileSite._ext_mpw != null)? fileSite._ext_mpw.url: null, fileSite.uses,
(fileSite.last_used != null)? MPConstant.dateTimeFormatter.parseDateTime( fileSite.last_used ): new Instant() );
(fileSite.last_used != null)? MPConstants.dateTimeFormatter.parseDateTime( fileSite.last_used ): new Instant() );
if (!export.redacted) {
if (fileSite.password != null)

View File

@@ -5,7 +5,7 @@ plugins {
description = 'Master Password Test Suite'
dependencies {
implementation group: 'com.lyndir.lhunath.opal', name: 'opal-system', version: '1.7-p1'
implementation group: 'com.lyndir.lhunath.opal', name: 'opal-system', version: '1.7-p2'
compile project( ':masterpassword-algorithm' )
compile project( ':masterpassword-model' )