summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/uic
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/uic')
-rw-r--r--src/main/java/org/uic/barcode/Decoder.java55
-rw-r--r--src/main/java/org/uic/barcode/Encoder.java64
-rw-r--r--src/main/java/org/uic/barcode/asn1/datatypes/Asn1Integer.java2
-rw-r--r--src/main/java/org/uic/barcode/asn1/datatypesimpl/SequenceOfUnrestrictedLong.java2
-rw-r--r--src/main/java/org/uic/barcode/asn1/uper/BitStringCoder.java3
-rw-r--r--src/main/java/org/uic/barcode/asn1/uper/BooleanCoder.java2
-rw-r--r--src/main/java/org/uic/barcode/asn1/uper/ByteCoder.java2
-rw-r--r--src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java11
-rw-r--r--src/main/java/org/uic/barcode/dynamicFrame/v1/DynamicFrame.java4
-rw-r--r--src/main/java/org/uic/barcode/dynamicFrame/v1/DynamicFrameCoderV1.java2
-rw-r--r--src/main/java/org/uic/barcode/dynamicFrame/v2/DynamicFrame.java4
-rw-r--r--src/main/java/org/uic/barcode/dynamicFrame/v2/DynamicFrameCoderV2.java5
-rw-r--r--src/main/java/org/uic/barcode/dynamicFrame/v2/Level1DataType.java6
-rw-r--r--src/main/java/org/uic/barcode/ssbFrame/SsbFrame.java9
-rw-r--r--src/main/java/org/uic/barcode/staticFrame/StaticFrame.java98
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/CarCarriageReservationData.java3
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/CustomerCardData.java8
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/DelayConfirmation.java6
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/IssuingData.java8
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/LuggageRestrictionType.java4
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/ReservationData.java6
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfActivatedDays.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCarrierNum.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCountries.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfPlaceNum.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfServiceBrands.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfTravelerId.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/TariffType.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/TicketDetailData.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/TrainLinkType.java4
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/TravelerType.java4
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodType.java4
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/VoucherData.java16
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/CarCarriageReservationData.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/CustomerCardData.java8
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/DelayConfirmation.java6
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java4
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/IssuingData.java8
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/LuggageRestrictionType.java4
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java1
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/PassData.java1
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/ReservationData.java6
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfActivatedDays.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCarrierNum.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCountries.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfPlaceNum.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfServiceBrands.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTransportTypes.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTravelerId.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/TariffType.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/TicketDetailData.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java6
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java4
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/VoucherData.java16
-rw-r--r--src/main/java/org/uic/barcode/utils/SecurityUtils.java11
56 files changed, 234 insertions, 211 deletions
diff --git a/src/main/java/org/uic/barcode/Decoder.java b/src/main/java/org/uic/barcode/Decoder.java
index d9f20ff..1e0a02d 100644
--- a/src/main/java/org/uic/barcode/Decoder.java
+++ b/src/main/java/org/uic/barcode/Decoder.java
@@ -56,7 +56,17 @@ public class Decoder {
/** The data. */
byte[] data = null;
+ private Provider defaultProvider = null;
+
+ public Provider getDefaultProvider() {
+ return defaultProvider;
+ }
+
+ public void setDefaultProvider(Provider defaultProvider) {
+ this.defaultProvider = defaultProvider;
+ }
+
/**
* Instantiates a new decoder.
*
@@ -67,6 +77,11 @@ public class Decoder {
*/
public Decoder (byte[] data) throws IOException, EncodingFormatException, DataFormatException {
this.data = data;
+
+ if (defaultProvider == null) {
+ defaultProvider = SecurityUtils.getDefaultProvider();
+ }
+
decode(data);
}
@@ -86,22 +101,7 @@ public class Decoder {
* @deprecated
*/
public int validateLevel1(PublicKey key) throws InvalidKeyException, NoSuchAlgorithmException, SignatureException, IllegalArgumentException, UnsupportedOperationException, IOException, EncodingFormatException {
- if (dynamicFrame != null) {
- return dynamicFrame.validateLevel1(key) ;
- } else if (staticFrame != null) {
- if (staticFrame.verifyByAlgorithmOid(key,null)) {
- return Constants.LEVEL1_VALIDATION_OK;
- } else {
- return Constants.LEVEL1_VALIDATION_FRAUD;
- }
- } else if (ssbFrame!= null) {
- if (ssbFrame.verifyByAlgorithmOid(key,null, null)) {
- return Constants.LEVEL1_VALIDATION_OK;
- } else {
- return Constants.LEVEL1_VALIDATION_FRAUD;
- }
- }
- return Constants.LEVEL1_VALIDATION_NO_SIGNATURE;
+ return validateLevel1(key,null, defaultProvider);
}
/**
@@ -120,22 +120,7 @@ public class Decoder {
* @deprecated
*/
public int validateLevel1(PublicKey key, String signingAlg) throws InvalidKeyException, NoSuchAlgorithmException, SignatureException, IllegalArgumentException, UnsupportedOperationException, IOException, EncodingFormatException {
- if (dynamicFrame != null ) {
- return dynamicFrame.validateLevel1(key, signingAlg) ;
- } else if (staticFrame != null) {
- if (staticFrame.verifyByAlgorithmOid(key,signingAlg)) {
- return Constants.LEVEL1_VALIDATION_OK;
- } else {
- return Constants.LEVEL1_VALIDATION_FRAUD;
- }
- } else if (ssbFrame!= null) {
- if (ssbFrame.verifyByAlgorithmOid(key,signingAlg, null)) {
- return Constants.LEVEL1_VALIDATION_OK;
- } else {
- return Constants.LEVEL1_VALIDATION_FRAUD;
- }
- }
- return Constants.LEVEL1_VALIDATION_NO_SIGNATURE;
+ return validateLevel1(key, signingAlg, defaultProvider);
}
/**
@@ -184,11 +169,7 @@ public class Decoder {
* @deprecated
*/
public int validateLevel2() throws EncodingFormatException {
- if (!isStaticHeader(data) && dynamicFrame != null) {
- return dynamicFrame.validateLevel2() ;
- } else {
- return Constants.LEVEL2_VALIDATION_NO_SIGNATURE;
- }
+ return validateLevel2(defaultProvider);
}
/*
diff --git a/src/main/java/org/uic/barcode/Encoder.java b/src/main/java/org/uic/barcode/Encoder.java
index 3eb2faf..e9874cf 100644
--- a/src/main/java/org/uic/barcode/Encoder.java
+++ b/src/main/java/org/uic/barcode/Encoder.java
@@ -29,6 +29,7 @@ import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.UicRailTicketCoder;
import org.uic.barcode.ticket.api.spec.IUicRailTicket;
import org.uic.barcode.utils.ECKeyEncoder;
+import org.uic.barcode.utils.SecurityUtils;
/**
@@ -59,6 +60,17 @@ public class Encoder {
/** The UIC bar code type SSB. */
public static String UIC_BARCODE_TYPE_SSB = "UIC_SSB";
+ private Provider defaultProvider = null;
+
+
+ public Provider getDefaultProvider() {
+ return defaultProvider;
+ }
+
+ public void setDefaultProvider(Provider defaultProvider) {
+ this.defaultProvider = defaultProvider;
+ }
+
/**
* Instantiates a new encoder.
*
@@ -72,6 +84,10 @@ public class Encoder {
*/
public Encoder(IUicRailTicket ticket, TicketLayout layout, String barcodeType, int version, int fcbVersion) throws IOException, EncodingFormatException {
+ if (defaultProvider == null) {
+ defaultProvider = SecurityUtils.getDefaultProvider();
+ }
+
if (barcodeType == UIC_BARCODE_TYPE_CLASSIC) {
staticFrame = new StaticFrame();
@@ -145,6 +161,9 @@ public class Encoder {
*/
public Encoder(byte[] level1DataBin, byte[] signatureLevel1, int version) throws IOException, EncodingFormatException {
+ if (defaultProvider == null) {
+ defaultProvider = SecurityUtils.getDefaultProvider();
+ }
dynamicFrame = new SimpleDynamicFrame();
dynamicFrame.setLevel2Data(new SimpleLevel2Data());
@@ -189,6 +208,10 @@ public class Encoder {
*/
public Encoder(byte[] encoded, int version) throws IOException, EncodingFormatException, DataFormatException {
+ if (defaultProvider == null) {
+ defaultProvider = SecurityUtils.getDefaultProvider();
+ }
+
Decoder decoder = new Decoder(encoded);
if (decoder.getDynamicFrame() == null) {
@@ -237,9 +260,7 @@ public class Encoder {
* @deprecated
*/
public void signLevel2(PrivateKey key) throws Exception {
- if (dynamicFrame != null) {
- dynamicFrame.signLevel2(key);
- }
+ signLevel2(key, defaultProvider);
}
/**
@@ -371,32 +392,7 @@ public class Encoder {
* @deprecated
*/
public void signLevel1(String securityProvider,PrivateKey key,String signingAlg, String keyId) throws Exception {
- if (dynamicFrame != null) {
- if (securityProvider != null && securityProvider.length() > 0) {
- dynamicFrame.getLevel2Data().getLevel1Data().setSecurityProvider(securityProvider);
- }
- dynamicFrame.getLevel2Data().getLevel1Data().setLevel1SigningAlg(signingAlg);
- dynamicFrame.getLevel2Data().getLevel1Data().setKeyId(Long.parseLong(keyId));
- dynamicFrame.signLevel1(key);
- } else if (staticFrame != null) {
- staticFrame.setSignatureKey(keyId);
- staticFrame.setSecurityProvider(securityProvider);
- if (securityProvider != null &&
- securityProvider.length() > 0 &&
- staticFrame.getHeaderRecord()!= null) {
- staticFrame.getHeaderRecord().setIssuer(securityProvider);
- }
- if (securityProvider != null &&
- securityProvider.length() > 0 &&
- staticFrame.getuFlex() != null &&
- staticFrame.getuFlex().getTicket() != null &&
- staticFrame.getuFlex().getTicket().getIssuerDetails() != null) {
- staticFrame.getuFlex().getTicket().getIssuerDetails().setSecurityProvider(securityProvider);
- }
- staticFrame.signByAlgorithmOID(key,signingAlg);
- } else if (ssbFrame != null) {
- ssbFrame.signLevel1(key, null, keyId, signingAlg);
- }
+ signLevel1(securityProvider,key,signingAlg, keyId, defaultProvider);
}
/**
@@ -418,9 +414,17 @@ public class Encoder {
} else if (staticFrame != null) {
staticFrame.setSignatureKey(keyId);
staticFrame.setSecurityProvider(securityProvider);
- if (staticFrame.getHeaderRecord()!= null && staticFrame.getHeaderRecord().getIssuer() == null) {
+ if (staticFrame.getHeaderRecord()!= null &&
+ staticFrame.getHeaderRecord().getIssuer() == null) {
staticFrame.getHeaderRecord().setIssuer(securityProvider);
}
+ if (securityProvider != null &&
+ securityProvider.length() > 0 &&
+ staticFrame.getuFlex() != null &&
+ staticFrame.getuFlex().getTicket() != null &&
+ staticFrame.getuFlex().getTicket().getIssuerDetails() != null) {
+ staticFrame.getuFlex().getTicket().getIssuerDetails().setSecurityProvider(securityProvider);
+ }
staticFrame.signByAlgorithmOID(key,signingAlg,prov);
} else if (ssbFrame != null) {
ssbFrame.signLevel1(key, prov, keyId, signingAlg);
diff --git a/src/main/java/org/uic/barcode/asn1/datatypes/Asn1Integer.java b/src/main/java/org/uic/barcode/asn1/datatypes/Asn1Integer.java
index e12f8ec..e5cfb4c 100644
--- a/src/main/java/org/uic/barcode/asn1/datatypes/Asn1Integer.java
+++ b/src/main/java/org/uic/barcode/asn1/datatypes/Asn1Integer.java
@@ -19,7 +19,7 @@ public class Asn1Integer {
}
public Long longObject () {
- return new Long(value());
+ return Long.valueOf(value());
}
public Asn1Integer(Long num) {
diff --git a/src/main/java/org/uic/barcode/asn1/datatypesimpl/SequenceOfUnrestrictedLong.java b/src/main/java/org/uic/barcode/asn1/datatypesimpl/SequenceOfUnrestrictedLong.java
index 6af7352..fdd72e8 100644
--- a/src/main/java/org/uic/barcode/asn1/datatypesimpl/SequenceOfUnrestrictedLong.java
+++ b/src/main/java/org/uic/barcode/asn1/datatypesimpl/SequenceOfUnrestrictedLong.java
@@ -17,7 +17,7 @@ public class SequenceOfUnrestrictedLong extends Asn1SequenceOf<Long> {
public SequenceOfUnrestrictedLong(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/asn1/uper/BitStringCoder.java b/src/main/java/org/uic/barcode/asn1/uper/BitStringCoder.java
index 6f435c4..0b6c9bd 100644
--- a/src/main/java/org/uic/barcode/asn1/uper/BitStringCoder.java
+++ b/src/main/java/org/uic/barcode/asn1/uper/BitStringCoder.java
@@ -36,7 +36,8 @@ class BitStringCoder implements Decoder, Encoder {
throw new AssertionError("Field should be a list of booleans!");
}
- List<Boolean> list = (List<Boolean>)obj;
+ @SuppressWarnings("unchecked")
+ List<Boolean> list = (List<Boolean>)obj;
if (list.size() != size.value()) {
throw new AssertionError(
"Declared size (" + size.value() +
diff --git a/src/main/java/org/uic/barcode/asn1/uper/BooleanCoder.java b/src/main/java/org/uic/barcode/asn1/uper/BooleanCoder.java
index 892f851..9f88e37 100644
--- a/src/main/java/org/uic/barcode/asn1/uper/BooleanCoder.java
+++ b/src/main/java/org/uic/barcode/asn1/uper/BooleanCoder.java
@@ -23,7 +23,7 @@ class BooleanCoder implements Decoder, Encoder {
@Override public <T> T decode(BitBuffer bitbuffer,
Class<T> classOfT, Field field,
Annotation[] extraAnnotations, AsnExtractor extractor) {
- Boolean result = new Boolean(bitbuffer.get());
+ Boolean result = Boolean.valueOf(bitbuffer.get());
UperEncoder.logger.debug(String.format("BOOL: decoded as %s",result));
return (T) result;
}
diff --git a/src/main/java/org/uic/barcode/asn1/uper/ByteCoder.java b/src/main/java/org/uic/barcode/asn1/uper/ByteCoder.java
index 5ecb925..4d722de 100644
--- a/src/main/java/org/uic/barcode/asn1/uper/ByteCoder.java
+++ b/src/main/java/org/uic/barcode/asn1/uper/ByteCoder.java
@@ -23,7 +23,7 @@ class ByteCoder implements Decoder, Encoder {
Class<T> classOfT, Field field,
Annotation[] extraAnnotations, AsnExtractor extractor) {
UperEncoder.logger.debug("BYTE");
- return (T) new Byte((byte) UperEncoder.decodeConstrainedInt(bitbuffer, UperEncoder.newRange(0, 255, false)));
+ return (T) Byte.valueOf((byte) UperEncoder.decodeConstrainedInt(bitbuffer, UperEncoder.newRange(0, 255, false)));
}
@Override
diff --git a/src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java b/src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java
index c256b4f..647a550 100644
--- a/src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java
+++ b/src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java
@@ -334,7 +334,7 @@ public final class UperEncoder {
parameterTypes[i] = parameters[i].getClass();
}
Constructor<T> constructor = findConsturctor(classOfT, parameters);
- boolean constructorIsAccessible = constructor.isAccessible();
+ //boolean constructorIsAccessible = constructor.isAccessible();
constructor.setAccessible(true);
T result;
try {
@@ -342,7 +342,7 @@ public final class UperEncoder {
} catch (IllegalArgumentException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
throw new IllegalArgumentException("Can't instantiate " + classOfT.getName(), e);
}
- constructor.setAccessible(constructorIsAccessible);
+ //constructor.setAccessible(constructorIsAccessible);
return result;
}
@@ -441,7 +441,7 @@ public final class UperEncoder {
List<Field> optionalOrdinaryFields = new ArrayList<>();
List<Field> allFields = new ArrayList<>(); // Excluding test instrumentation.
- Map<Field, Boolean> originalAccess = new HashMap<>();
+ //Map<Field, Boolean> originalAccess = new HashMap<>();
Asn1ContainerFieldSorter(Class<?> type) {
@@ -472,7 +472,7 @@ public final class UperEncoder {
if (isTestInstrumentation(f) || isNonAsn1Field(f) ) {
continue;
}
- originalAccess.put(f, f.isAccessible());
+ //originalAccess.put(f, f.isAccessible());
f.setAccessible(true);
if (isExtension(f)) {
extensionFields.add(f);
@@ -496,10 +496,13 @@ public final class UperEncoder {
}
}
+
public void revertAccess() {
+ /*
for (Entry<Field, Boolean> entry : originalAccess.entrySet()) {
entry.getKey().setAccessible(entry.getValue());
}
+ */
}
}
diff --git a/src/main/java/org/uic/barcode/dynamicFrame/v1/DynamicFrame.java b/src/main/java/org/uic/barcode/dynamicFrame/v1/DynamicFrame.java
index 7dbd131..aad76d7 100644
--- a/src/main/java/org/uic/barcode/dynamicFrame/v1/DynamicFrame.java
+++ b/src/main/java/org/uic/barcode/dynamicFrame/v1/DynamicFrame.java
@@ -1,8 +1,5 @@
package org.uic.barcode.dynamicFrame.v1;
-import java.security.PrivateKey;
-import java.security.Provider;
-import java.security.Signature;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.CharacterRestriction;
import org.uic.barcode.asn1.datatypes.FieldOrder;
@@ -14,7 +11,6 @@ import org.uic.barcode.dynamicContent.api.DynamicContentCoder;
import org.uic.barcode.dynamicContent.api.IUicDynamicContent;
import org.uic.barcode.dynamicContent.fdc1.UicDynamicContentDataFDC1;
import org.uic.barcode.ticket.EncodingFormatException;
-import org.uic.barcode.utils.AlgorithmNameResolver;
/**
diff --git a/src/main/java/org/uic/barcode/dynamicFrame/v1/DynamicFrameCoderV1.java b/src/main/java/org/uic/barcode/dynamicFrame/v1/DynamicFrameCoderV1.java
index 71de58e..cdc1843 100644
--- a/src/main/java/org/uic/barcode/dynamicFrame/v1/DynamicFrameCoderV1.java
+++ b/src/main/java/org/uic/barcode/dynamicFrame/v1/DynamicFrameCoderV1.java
@@ -2,8 +2,6 @@ package org.uic.barcode.dynamicFrame.v1;
import org.uic.barcode.asn1.datatypesimpl.OctetString;
import org.uic.barcode.asn1.uper.UperEncoder;
-import org.uic.barcode.dynamicFrame.v1.DynamicFrame;
-import org.uic.barcode.dynamicFrame.v1.Level1DataType;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.dynamicFrame.api.IData;
import org.uic.barcode.dynamicFrame.api.IDynamicFrame;
diff --git a/src/main/java/org/uic/barcode/dynamicFrame/v2/DynamicFrame.java b/src/main/java/org/uic/barcode/dynamicFrame/v2/DynamicFrame.java
index cb5c37a..7237110 100644
--- a/src/main/java/org/uic/barcode/dynamicFrame/v2/DynamicFrame.java
+++ b/src/main/java/org/uic/barcode/dynamicFrame/v2/DynamicFrame.java
@@ -7,10 +7,6 @@ import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypesimpl.OctetString;
import org.uic.barcode.asn1.uper.UperEncoder;
-import org.uic.barcode.dynamicContent.api.DynamicContentCoder;
-import org.uic.barcode.dynamicContent.api.IUicDynamicContent;
-import org.uic.barcode.dynamicContent.fdc1.UicDynamicContentDataFDC1;
-import org.uic.barcode.ticket.EncodingFormatException;
/**
diff --git a/src/main/java/org/uic/barcode/dynamicFrame/v2/DynamicFrameCoderV2.java b/src/main/java/org/uic/barcode/dynamicFrame/v2/DynamicFrameCoderV2.java
index 5d980dd..c6ff7c7 100644
--- a/src/main/java/org/uic/barcode/dynamicFrame/v2/DynamicFrameCoderV2.java
+++ b/src/main/java/org/uic/barcode/dynamicFrame/v2/DynamicFrameCoderV2.java
@@ -2,7 +2,6 @@ package org.uic.barcode.dynamicFrame.v2;
import org.uic.barcode.asn1.datatypesimpl.OctetString;
import org.uic.barcode.asn1.uper.UperEncoder;
-import org.uic.barcode.dynamicFrame.v2.DynamicFrame;
import org.uic.barcode.dynamicFrame.api.IData;
import org.uic.barcode.dynamicFrame.api.IDynamicFrame;
import org.uic.barcode.dynamicFrame.api.ILevel1Data;
@@ -10,10 +9,6 @@ import org.uic.barcode.dynamicFrame.api.ILevel2Data;
import org.uic.barcode.dynamicFrame.api.SimpleData;
import org.uic.barcode.dynamicFrame.api.SimpleLevel1Data;
import org.uic.barcode.dynamicFrame.api.SimpleLevel2Data;
-import org.uic.barcode.dynamicFrame.v2.Level2DataType;
-import org.uic.barcode.dynamicFrame.v2.DataType;
-import org.uic.barcode.dynamicFrame.v2.Level1DataType;
-import org.uic.barcode.dynamicFrame.v2.SequenceOfDataType;
import org.uic.barcode.ticket.EncodingFormatException;
public class DynamicFrameCoderV2 {
diff --git a/src/main/java/org/uic/barcode/dynamicFrame/v2/Level1DataType.java b/src/main/java/org/uic/barcode/dynamicFrame/v2/Level1DataType.java
index b42e9dc..a7d4b01 100644
--- a/src/main/java/org/uic/barcode/dynamicFrame/v2/Level1DataType.java
+++ b/src/main/java/org/uic/barcode/dynamicFrame/v2/Level1DataType.java
@@ -323,11 +323,11 @@ public class Level1DataType {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
- this.endOfValidityYear = new Long( cal.get(Calendar.YEAR));
- this.endOfValidityDay = new Long (cal.get(Calendar.DAY_OF_YEAR));
+ this.endOfValidityYear = Long.valueOf( cal.get(Calendar.YEAR));
+ this.endOfValidityDay = Long.valueOf (cal.get(Calendar.DAY_OF_YEAR));
int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE);
if (time >= 0) {
- this.endOfValidityTime = new Long (time );
+ this.endOfValidityTime = Long.valueOf (time );
}
TimeZone.setDefault(local);
diff --git a/src/main/java/org/uic/barcode/ssbFrame/SsbFrame.java b/src/main/java/org/uic/barcode/ssbFrame/SsbFrame.java
index 2c8f66f..b7c5501 100644
--- a/src/main/java/org/uic/barcode/ssbFrame/SsbFrame.java
+++ b/src/main/java/org/uic/barcode/ssbFrame/SsbFrame.java
@@ -359,13 +359,18 @@ public class SsbFrame {
}
}
}
-
}
if (algo == null) {
throw new NoSuchAlgorithmException("No service for algorithm found: " + signingAlg);
}
- Signature sig = Signature.getInstance(algo);
+
+ Signature sig = null;
+ if (prov != null) {
+ sig = Signature.getInstance(algo,prov);
+ } else {
+ sig = Signature.getInstance(algo);
+ }
sig.initVerify(key);
sig.update(getDataForSignature());
diff --git a/src/main/java/org/uic/barcode/staticFrame/StaticFrame.java b/src/main/java/org/uic/barcode/staticFrame/StaticFrame.java
index a8d7651..c0f03c8 100644
--- a/src/main/java/org/uic/barcode/staticFrame/StaticFrame.java
+++ b/src/main/java/org/uic/barcode/staticFrame/StaticFrame.java
@@ -705,22 +705,41 @@ public class StaticFrame {
* @throws EncodingFormatException
* @throws IOException
*/
- public boolean verifyByAlgorithmOid(PublicKey key, String signingAlg, Provider prov) throws InvalidKeyException, NoSuchAlgorithmException, SignatureException, IllegalArgumentException, UnsupportedOperationException, IOException, EncodingFormatException {
+ public boolean verifyByAlgorithmOid(PublicKey key, String signatureAlgorithmOid, Provider prov) throws InvalidKeyException, NoSuchAlgorithmException, SignatureException, IllegalArgumentException, UnsupportedOperationException, IOException, EncodingFormatException {
- if ((signingAlg == null || signingAlg.length() < 1) && this.getSignature() != null) {
- signingAlg = SecurityUtils.getDsaAlgorithm(this.getSignature());
+ if ((signatureAlgorithmOid == null || signatureAlgorithmOid.length() < 1) && this.getSignature() != null) {
+ signatureAlgorithmOid = SecurityUtils.getDsaAlgorithm(this.getSignature());
}
//find the algorithm name for the signature OID
String algo = null;
- Service service = prov.getService("Signature",signingAlg);
- if (service != null) {
- algo = service.getAlgorithm();
- }
+ if (prov != null) {
+ Service service = prov.getService("Signature",signatureAlgorithmOid);
+ if (service != null) {
+ algo = service.getAlgorithm();
+ }
+ } else {
+ Provider[] provs = Security.getProviders();
+ for (Provider p : provs) {
+ if (algo == null) {
+ Service service = p.getService("Signature",signatureAlgorithmOid);
+ if (service != null) {
+ algo = service.getAlgorithm();
+ }
+ }
+ }
+ }
if (algo == null) {
- throw new NoSuchAlgorithmException("No service for algorithm found: " + signingAlg);
+ throw new NoSuchAlgorithmException("No service for algorithm found: " + signatureAlgorithmOid);
}
- Signature sig = Signature.getInstance(algo);
+
+ Signature sig = null;
+ if (prov != null) {
+ sig = Signature.getInstance(algo,prov);
+ } else {
+ sig = Signature.getInstance(algo);
+ }
+
sig.initVerify(key);
sig.update(getDataForSignature());
return sig.verify(this.getSignature());
@@ -739,13 +758,23 @@ public class StaticFrame {
* @throws SignatureException the signature exception
* @throws EncodingFormatException
* @throws IOException
+ * @deprecated
*/
- public void signByAlgorithmOID(PrivateKey key,String signingAlg) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, IOException, EncodingFormatException {
+ public void signByAlgorithmOID(PrivateKey key,String signatureAlgorithmOid) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, IOException, EncodingFormatException {
+ //find the algorithm name for the signature OID
//find the algorithm name for the signature OID
String algo = null;
- algo = getAlgo(signingAlg);
+ Provider[] provs = Security.getProviders();
+ for (Provider p : provs) {
+ if (algo == null) {
+ Service service = p.getService("Signature",signatureAlgorithmOid);
+ if (service != null) {
+ algo = service.getAlgorithm();
+ }
+ }
+ }
if (algo == null) {
- throw new NoSuchAlgorithmException("No service for algorthm found: " + signingAlg);
+ throw new NoSuchAlgorithmException("No service for algorithm found: " + signatureAlgorithmOid);
}
Signature sig = Signature.getInstance(algo);
sig.initSign(key);
@@ -754,16 +783,7 @@ public class StaticFrame {
signature = sig.sign();
}
- private String getAlgo(String signingAlg) {
- Provider[] provs = Security.getProviders();
- for (Provider prov : provs) {
- Service service = prov.getService("Signature",signingAlg);
- if (service != null) {
- return service.getAlgorithm();
- }
- }
- return null;
- }
+
@@ -781,17 +801,36 @@ public class StaticFrame {
* @throws EncodingFormatException
* @throws IOException
*/
- public void signByAlgorithmOID(PrivateKey key,String signingAlg, Provider prov) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, IOException, EncodingFormatException {
+ public void signByAlgorithmOID(PrivateKey key,String signatureAlgorithmOid, Provider prov) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, IOException, EncodingFormatException {
+
//find the algorithm name for the signature OID
String algo = null;
- Service service = prov.getService("Signature",signingAlg);
- if (service != null) {
- algo = service.getAlgorithm();
- }
+ if (prov != null) {
+ Service service = prov.getService("Signature",signatureAlgorithmOid);
+ if (service != null) {
+ algo = service.getAlgorithm();
+ }
+ } else {
+ Provider[] provs = Security.getProviders();
+ for (Provider p : provs) {
+ if (algo == null) {
+ Service service = p.getService("Signature",signatureAlgorithmOid);
+ if (service != null) {
+ algo = service.getAlgorithm();
+ }
+ }
+ }
+ }
if (algo == null) {
- throw new NoSuchAlgorithmException("No service for algorthm found: " + signingAlg);
+ throw new NoSuchAlgorithmException("No service for algorithm found: " + signatureAlgorithmOid);
+ }
+
+ Signature sig = null;
+ if (prov == null) {
+ sig = Signature.getInstance(algo);
+ } else {
+ sig = Signature.getInstance(algo,prov);
}
- Signature sig = Signature.getInstance(algo,prov);
sig.initSign(key);
signedData = getDataForSignature();
@@ -813,6 +852,7 @@ public class StaticFrame {
* @throws SignatureException the signature exception
* @throws EncodingFormatException
* @throws IOException
+ * @deprecated
*/
public void signUsingAlgorithmName(PrivateKey key,String algo) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, IOException, EncodingFormatException {
Signature sig = Signature.getInstance(algo);
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/CarCarriageReservationData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/CarCarriageReservationData.java
index 6729d08..a55b619 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/CarCarriageReservationData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/CarCarriageReservationData.java
@@ -33,7 +33,6 @@ import org.uic.barcode.asn1.datatypes.IntRange;
import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCarrierNum;
import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@@ -232,7 +231,7 @@ public class CarCarriageReservationData extends Object {
public Long getBeginLoadingTime() {
- if (beginLoadingTime == null) return new Long(0);
+ if (beginLoadingTime == null) return Long.valueOf(0);
return beginLoadingTime;
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/CustomerCardData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/CustomerCardData.java
index 0d8bdcd..ae9d513 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/CustomerCardData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/CustomerCardData.java
@@ -244,8 +244,8 @@ public class CustomerCardData extends Object {
fromCal.clear();
fromCal.setTime(fromDate);
- this.validFromYear = new Long( fromCal.get(Calendar.YEAR));
- this.validFromDay = new Long (fromCal.get(Calendar.DAY_OF_YEAR));
+ this.validFromYear = Long.valueOf( fromCal.get(Calendar.YEAR));
+ this.validFromDay = Long.valueOf(fromCal.get(Calendar.DAY_OF_YEAR));
if (untilDate == null) return;
@@ -256,8 +256,8 @@ public class CustomerCardData extends Object {
int untildays = untilCal.get(Calendar.DAY_OF_YEAR);
int yearDiff = untilCal.get(Calendar.YEAR) - fromCal.get(Calendar.YEAR);
- this.validUntilYear = new Long( yearDiff);
- this.validUntilDay = new Long (untildays);
+ this.validUntilYear = Long.valueOf( yearDiff);
+ this.validUntilDay = Long.valueOf (untildays);
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/DelayConfirmation.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/DelayConfirmation.java
index a3df48b..32e6c97 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/DelayConfirmation.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/DelayConfirmation.java
@@ -282,11 +282,11 @@ public class DelayConfirmation extends Object {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
- this.plannedArrivalYear = new Long( cal.get(Calendar.YEAR));
- this.plannedArrivalDay = new Long (cal.get(Calendar.DAY_OF_YEAR));
+ this.plannedArrivalYear = Long.valueOf( cal.get(Calendar.YEAR));
+ this.plannedArrivalDay = Long.valueOf (cal.get(Calendar.DAY_OF_YEAR));
int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE);
if (time > 0) {
- this.plannedArrivalTime = new Long (time );
+ this.plannedArrivalTime = Long.valueOf (time );
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/IssuingData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/IssuingData.java
index 5a150dc..4c3a5ff 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/IssuingData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/IssuingData.java
@@ -184,7 +184,7 @@ public class IssuingData extends Object {
public Long getCurrencyFract() {
if (currencyFract == null) {
- return new Long(2);
+ return Long.valueOf(2);
}
return this.currencyFract;
}
@@ -323,11 +323,11 @@ public class IssuingData extends Object {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
- this.issuingYear = new Long( cal.get(Calendar.YEAR));
- this.issuingDay = new Long (cal.get(Calendar.DAY_OF_YEAR));
+ this.issuingYear = Long.valueOf( cal.get(Calendar.YEAR));
+ this.issuingDay = Long.valueOf (cal.get(Calendar.DAY_OF_YEAR));
int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE);
if (time >= 0) {
- this.issuingTime = new Long (time );
+ this.issuingTime = Long.valueOf (time );
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/LuggageRestrictionType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/LuggageRestrictionType.java
index 04f4309..86f75d9 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/LuggageRestrictionType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/LuggageRestrictionType.java
@@ -54,7 +54,7 @@ public class LuggageRestrictionType extends Object {
public Long getMaxHandLuggagePieces() {
if (maxHandLuggagePieces == null) {
- return new Long(3);
+ return Long.valueOf(3);
}
return this.maxHandLuggagePieces;
@@ -63,7 +63,7 @@ public class LuggageRestrictionType extends Object {
public Long getMaxNonHandLuggagePieces() {
if (maxNonHandLuggagePieces == null) {
- return new Long(1);
+ return Long.valueOf(1);
}
return this.maxNonHandLuggagePieces;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ReservationData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ReservationData.java
index 5bd951b..8a813b5 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ReservationData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ReservationData.java
@@ -314,7 +314,7 @@ public class ReservationData extends Object {
public Long getArrivalDate() {
if (arrivalDate == null) {
- return new Long(0);
+ return Long.valueOf(0);
}
return this.arrivalDate;
@@ -397,7 +397,7 @@ public class ReservationData extends Object {
public Long getTypeOfSupplement() {
if (typeOfSupplement == null){
- return new Long(0);
+ return Long.valueOf(0);
}
@@ -407,7 +407,7 @@ public class ReservationData extends Object {
public Long getNumberOfSupplements() {
if (numberOfSupplements == null) {
- return new Long(0);
+ return Long.valueOf(0);
}
return this.numberOfSupplements;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfActivatedDays.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfActivatedDays.java
index 2d1eebd..775d145 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfActivatedDays.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfActivatedDays.java
@@ -14,7 +14,7 @@ public class SequenceOfActivatedDays extends Asn1SequenceOf<Long> {
public SequenceOfActivatedDays(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCarrierNum.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCarrierNum.java
index 9d75e83..8d8d708 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCarrierNum.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCarrierNum.java
@@ -15,7 +15,7 @@ public class SequenceOfCarrierNum extends Asn1SequenceOf<Long> {
public SequenceOfCarrierNum(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
public static SequenceOfCarrierNum getSequence(List<Long> numList) {
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCountries.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCountries.java
index e6dd46b..ea3213c 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCountries.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCountries.java
@@ -15,7 +15,7 @@ public class SequenceOfCountries extends Asn1SequenceOf<Long> {
public SequenceOfCountries(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfPlaceNum.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfPlaceNum.java
index c8ec7ce..07d7950 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfPlaceNum.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfPlaceNum.java
@@ -16,7 +16,7 @@ public class SequenceOfPlaceNum extends Asn1SequenceOf<Long> {
public SequenceOfPlaceNum(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfServiceBrands.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfServiceBrands.java
index 3edd7fb..e8fde5a 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfServiceBrands.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfServiceBrands.java
@@ -15,7 +15,7 @@ public class SequenceOfServiceBrands extends Asn1SequenceOf<Long> {
public SequenceOfServiceBrands(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfTravelerId.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfTravelerId.java
index 3a1b1ec..b1d61ba 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfTravelerId.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/SequenceOfTravelerId.java
@@ -14,7 +14,7 @@ public class SequenceOfTravelerId extends Asn1SequenceOf<Long> {
public SequenceOfTravelerId(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TariffType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TariffType.java
index 66cb399..6927416 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TariffType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TariffType.java
@@ -82,7 +82,7 @@ public class TariffType extends Object {
public Long getNumberOfPassengers() {
if (numberOfPassengers == null) {
- return new Long(1);
+ return Long.valueOf(1);
}
return this.numberOfPassengers;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TicketDetailData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TicketDetailData.java
index 7a86d56..b137f4c 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TicketDetailData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TicketDetailData.java
@@ -24,8 +24,6 @@ package org.uic.barcode.ticket.api.asn.omv1;
import org.uic.barcode.asn1.datatypes.Choice;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
-import org.uic.barcode.ticket.api.asn.omv1.DelayConfirmation;
-import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
@Choice
@HasExtensionMarker
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TrainLinkType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TrainLinkType.java
index 6cc1c42..9bd4fe4 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TrainLinkType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TrainLinkType.java
@@ -43,7 +43,7 @@ public class TrainLinkType extends Object {
@Asn1Optional public String trainIA5;
@FieldOrder(order = 2)
- @IntRange(minValue=0,maxValue=370)
+ @IntRange(minValue=-1,maxValue=370)
public Long travelDate;
@FieldOrder(order = 3)
@@ -168,7 +168,7 @@ public class TrainLinkType extends Object {
public void setDepartureTimeZone(Date dateLocal, Date dateUTC ) {
// -- (UTC = local + offset * 15 Minutes)
- this.departureUTCOffset = new Long(dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15);
+ this.departureUTCOffset = Long.valueOf(dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15);
}
public Date getDepartureDate(Date issuingDate){
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TravelerType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TravelerType.java
index 7f512fc..f9663c5 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TravelerType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TravelerType.java
@@ -295,8 +295,8 @@ public class TravelerType extends Object {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
- this.yearOfBirth = new Long( cal.get(Calendar.YEAR));
- this.dayOfBirth = new Long (cal.get(Calendar.DAY_OF_YEAR));
+ this.yearOfBirth = Long.valueOf ( cal.get(Calendar.YEAR));
+ this.dayOfBirth = Long.valueOf (cal.get(Calendar.DAY_OF_YEAR));
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodType.java
index a72d55b..e9a0ce8 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodType.java
@@ -62,7 +62,7 @@ public class ValidityPeriodType extends Object {
public Long getValidFromDay() {
if (validFromDay == null) {
- return new Long(0);
+ return Long.valueOf(0);
}
return this.validFromDay;
@@ -76,7 +76,7 @@ public class ValidityPeriodType extends Object {
public Long getValidUntilDay() {
if (validUntilDay == null) {
- return new Long(0);
+ return Long.valueOf(0);
}
return this.validUntilDay;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/VoucherData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/VoucherData.java
index 521f32a..796e15e 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/VoucherData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/VoucherData.java
@@ -241,8 +241,8 @@ public class VoucherData extends Object {
fromCal.clear();
fromCal.setTime(fromDate);
- this.validFromYear = new Long( fromCal.get(Calendar.YEAR));
- this.validFromDay = new Long (fromCal.get(Calendar.DAY_OF_YEAR));
+ this.validFromYear = Long.valueOf( fromCal.get(Calendar.YEAR));
+ this.validFromDay = Long.valueOf (fromCal.get(Calendar.DAY_OF_YEAR));
if (untilDate == null) return;
@@ -250,8 +250,8 @@ public class VoucherData extends Object {
untilCal.clear();
untilCal.setTime(untilDate);
- this.validUntilYear = new Long( untilCal.get(Calendar.YEAR));
- this.validUntilDay = new Long (untilCal.get(Calendar.DAY_OF_YEAR));
+ this.validUntilYear = Long.valueOf( untilCal.get(Calendar.YEAR));
+ this.validUntilDay = Long.valueOf(untilCal.get(Calendar.DAY_OF_YEAR));
}
@@ -264,8 +264,8 @@ public class VoucherData extends Object {
fromCal.clear();
fromCal.setTime(fromDate);
- this.validFromYear = new Long( fromCal.get(Calendar.YEAR));
- this.validFromDay = new Long (fromCal.get(Calendar.DAY_OF_YEAR));
+ this.validFromYear = Long.valueOf( fromCal.get(Calendar.YEAR));
+ this.validFromDay = Long.valueOf(fromCal.get(Calendar.DAY_OF_YEAR));
}
@@ -277,8 +277,8 @@ public class VoucherData extends Object {
untilCal.clear();
untilCal.setTime(untilDate);
- this.validUntilYear = new Long( untilCal.get(Calendar.YEAR));
- this.validUntilDay = new Long (untilCal.get(Calendar.DAY_OF_YEAR));
+ this.validUntilYear = Long.valueOf( untilCal.get(Calendar.YEAR));
+ this.validUntilDay = Long.valueOf (untilCal.get(Calendar.DAY_OF_YEAR));
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/CarCarriageReservationData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/CarCarriageReservationData.java
index 4e0bb5f..5a3af74 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/CarCarriageReservationData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/CarCarriageReservationData.java
@@ -231,7 +231,7 @@ public class CarCarriageReservationData extends Object {
public Long getBeginLoadingTime() {
- if (beginLoadingTime == null) return new Long(0);
+ if (beginLoadingTime == null) return Long.valueOf(0);
return beginLoadingTime;
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/CustomerCardData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/CustomerCardData.java
index 5d8603f..161106d 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/CustomerCardData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/CustomerCardData.java
@@ -242,8 +242,8 @@ public class CustomerCardData extends Object {
fromCal.clear();
fromCal.setTime(fromDate);
- this.validFromYear = new Long( fromCal.get(Calendar.YEAR));
- this.validFromDay = new Long (fromCal.get(Calendar.DAY_OF_YEAR));
+ this.validFromYear = Long.valueOf( fromCal.get(Calendar.YEAR));
+ this.validFromDay = Long.valueOf (fromCal.get(Calendar.DAY_OF_YEAR));
if (untilDate == null) return;
@@ -255,8 +255,8 @@ public class CustomerCardData extends Object {
int yearDiff = untilCal.get(Calendar.YEAR) - fromCal.get(Calendar.YEAR);
- this.validUntilYear = new Long( yearDiff);
- this.validUntilDay = new Long (untildays);
+ this.validUntilYear = Long.valueOf( yearDiff);
+ this.validUntilDay = Long.valueOf (untildays);
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/DelayConfirmation.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/DelayConfirmation.java
index acf99d5..0fe13c4 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/DelayConfirmation.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/DelayConfirmation.java
@@ -281,11 +281,11 @@ public class DelayConfirmation extends Object {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
- this.plannedArrivalYear = new Long( cal.get(Calendar.YEAR));
- this.plannedArrivalDay = new Long (cal.get(Calendar.DAY_OF_YEAR));
+ this.plannedArrivalYear = Long.valueOf( cal.get(Calendar.YEAR));
+ this.plannedArrivalDay = Long.valueOf (cal.get(Calendar.DAY_OF_YEAR));
int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE);
if (time > 0) {
- this.plannedArrivalTime = new Long (time );
+ this.plannedArrivalTime = Long.valueOf (time );
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java
index 4cfe708..3a301d1 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java
@@ -385,12 +385,12 @@ public class IncludedOpenTicketType extends Object {
public void setValidFromTimeZone(Date dateLocal, Date dateUTC ) {
// -- (UTC = local + offset * 15 Minutes)
- this.validFromUTCOffset = new Long(dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15);
+ this.validFromUTCOffset = Long.valueOf(dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15);
}
public void setValidUntilTimeZone(Date dateLocal, Date dateUTC ) {
// -- (UTC = local + offset * 15 Minutes)
- this.validUntilUTCOffset = new Long(dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15);
+ this.validUntilUTCOffset = Long.valueOf(dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15);
if (this.validFromUTCOffset.longValue() == this.validUntilUTCOffset.longValue()) {
this.validUntilUTCOffset = null;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/IssuingData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/IssuingData.java
index 74c516c..82e3d69 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/IssuingData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/IssuingData.java
@@ -184,7 +184,7 @@ public class IssuingData extends Object {
public Long getCurrencyFract() {
if (currencyFract == null) {
- return new Long(2);
+ return Long.valueOf(2);
}
return this.currencyFract;
}
@@ -323,11 +323,11 @@ public class IssuingData extends Object {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
- this.issuingYear = new Long( cal.get(Calendar.YEAR));
- this.issuingDay = new Long (cal.get(Calendar.DAY_OF_YEAR));
+ this.issuingYear = Long.valueOf( cal.get(Calendar.YEAR));
+ this.issuingDay = Long.valueOf (cal.get(Calendar.DAY_OF_YEAR));
int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE);
if (time >= 0) {
- this.issuingTime = new Long (time );
+ this.issuingTime = Long.valueOf (time );
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/LuggageRestrictionType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/LuggageRestrictionType.java
index caa1caa..403afc0 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/LuggageRestrictionType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/LuggageRestrictionType.java
@@ -54,7 +54,7 @@ public class LuggageRestrictionType extends Object {
public Long getMaxHandLuggagePieces() {
if (maxHandLuggagePieces == null) {
- return new Long(3);
+ return Long.valueOf(3);
}
return this.maxHandLuggagePieces;
@@ -63,7 +63,7 @@ public class LuggageRestrictionType extends Object {
public Long getMaxNonHandLuggagePieces() {
if (maxNonHandLuggagePieces == null) {
- return new Long(1);
+ return Long.valueOf(1);
}
return this.maxNonHandLuggagePieces;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java
index 3b5ae99..f69155e 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java
@@ -35,7 +35,6 @@ import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypes.SizeRange;
import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfActivatedDays;
import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/PassData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/PassData.java
index 3a8c3b1..ab86564 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/PassData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/PassData.java
@@ -34,7 +34,6 @@ import org.uic.barcode.asn1.datatypes.IntRange;
import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfActivatedDays;
import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ReservationData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ReservationData.java
index a42a3e1..604717f 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ReservationData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ReservationData.java
@@ -314,7 +314,7 @@ public class ReservationData extends Object {
public Long getArrivalDate() {
if (arrivalDate == null) {
- return new Long(0);
+ return Long.valueOf(0);
}
return this.arrivalDate;
@@ -397,7 +397,7 @@ public class ReservationData extends Object {
public Long getTypeOfSupplement() {
if (typeOfSupplement == null){
- return new Long(0);
+ return Long.valueOf(0);
}
@@ -407,7 +407,7 @@ public class ReservationData extends Object {
public Long getNumberOfSupplements() {
if (numberOfSupplements == null) {
- return new Long(0);
+ return Long.valueOf(0);
}
return this.numberOfSupplements;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfActivatedDays.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfActivatedDays.java
index 776c774..7b632bb 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfActivatedDays.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfActivatedDays.java
@@ -14,7 +14,7 @@ public class SequenceOfActivatedDays extends Asn1SequenceOf<Long> {
public SequenceOfActivatedDays(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCarrierNum.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCarrierNum.java
index 53417c2..09f1861 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCarrierNum.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCarrierNum.java
@@ -15,7 +15,7 @@ public class SequenceOfCarrierNum extends Asn1SequenceOf<Long> {
public SequenceOfCarrierNum(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
public static SequenceOfCarrierNum getSequence(List<Long> numList) {
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCountries.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCountries.java
index 2dca27a..a4ee40b 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCountries.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCountries.java
@@ -15,7 +15,7 @@ public class SequenceOfCountries extends Asn1SequenceOf<Long> {
public SequenceOfCountries(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfPlaceNum.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfPlaceNum.java
index 3cc6471..9b8afcb 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfPlaceNum.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfPlaceNum.java
@@ -16,7 +16,7 @@ public class SequenceOfPlaceNum extends Asn1SequenceOf<Long> {
public SequenceOfPlaceNum(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfServiceBrands.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfServiceBrands.java
index 4eb829b..30a2d48 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfServiceBrands.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfServiceBrands.java
@@ -15,7 +15,7 @@ public class SequenceOfServiceBrands extends Asn1SequenceOf<Long> {
public SequenceOfServiceBrands(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTransportTypes.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTransportTypes.java
index b8e2b64..19b4b2b 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTransportTypes.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTransportTypes.java
@@ -15,7 +15,7 @@ public class SequenceOfTransportTypes extends Asn1SequenceOf<Long> {
public SequenceOfTransportTypes(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTravelerId.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTravelerId.java
index eb9c3e2..16c57ce 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTravelerId.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTravelerId.java
@@ -14,7 +14,7 @@ public class SequenceOfTravelerId extends Asn1SequenceOf<Long> {
public SequenceOfTravelerId(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TariffType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TariffType.java
index efc5d3b..2834b4e 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TariffType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TariffType.java
@@ -81,7 +81,7 @@ public class TariffType extends Object {
public Long getNumberOfPassengers() {
if (numberOfPassengers == null) {
- return new Long(1);
+ return Long.valueOf(1);
}
return this.numberOfPassengers;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TicketDetailData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TicketDetailData.java
index 47c48da..9e54a20 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TicketDetailData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TicketDetailData.java
@@ -24,8 +24,6 @@ package org.uic.barcode.ticket.api.asn.omv2;
import org.uic.barcode.asn1.datatypes.Choice;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
-import org.uic.barcode.ticket.api.asn.omv2.DelayConfirmation;
-import org.uic.barcode.ticket.api.asn.omv2.ExtensionData;
@Choice
@HasExtensionMarker
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java
index 4724db6..ed2ee12 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java
@@ -168,7 +168,7 @@ public class TrainLinkType extends Object {
public void setDepartureTimeZone(Date dateLocal, Date dateUTC ) {
// -- (UTC = local + offset * 15 Minutes)
- this.departureUTCOffset = new Long(dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15);
+ this.departureUTCOffset = Long.valueOf(dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15);
}
public Date getDepartureDate(Date issuingDate){
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java
index 2522355..8c3ba01 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java
@@ -305,9 +305,9 @@ public class TravelerType extends Object {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
- this.yearOfBirth = new Long( cal.get(Calendar.YEAR));
- this.monthOfBirth = new Long(cal.get(Calendar.MONTH) + 1);
- this.dayOfBirth = new Long (cal.get(Calendar.DAY_OF_MONTH));
+ this.yearOfBirth = Long.valueOf( cal.get(Calendar.YEAR));
+ this.monthOfBirth = Long.valueOf(cal.get(Calendar.MONTH) + 1);
+ this.dayOfBirth = Long.valueOf(cal.get(Calendar.DAY_OF_MONTH));
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java
index e22cf3b..392da59 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java
@@ -62,7 +62,7 @@ public class ValidityPeriodType extends Object {
public Long getValidFromDay() {
if (validFromDay == null) {
- return new Long(0);
+ return Long.valueOf(0);
}
return this.validFromDay;
@@ -76,7 +76,7 @@ public class ValidityPeriodType extends Object {
public Long getValidUntilDay() {
if (validUntilDay == null) {
- return new Long(0);
+ return Long.valueOf(0);
}
return this.validUntilDay;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/VoucherData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/VoucherData.java
index 1395976..a4b3328 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/VoucherData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/VoucherData.java
@@ -239,8 +239,8 @@ public class VoucherData extends Object {
fromCal.clear();
fromCal.setTime(fromDate);
- this.validFromYear = new Long( fromCal.get(Calendar.YEAR));
- this.validFromDay = new Long (fromCal.get(Calendar.DAY_OF_YEAR));
+ this.validFromYear = Long.valueOf( fromCal.get(Calendar.YEAR));
+ this.validFromDay = Long.valueOf(fromCal.get(Calendar.DAY_OF_YEAR));
if (untilDate == null) return;
@@ -248,8 +248,8 @@ public class VoucherData extends Object {
untilCal.clear();
untilCal.setTime(untilDate);
- this.validUntilYear = new Long( untilCal.get(Calendar.YEAR));
- this.validUntilDay = new Long (untilCal.get(Calendar.DAY_OF_YEAR));
+ this.validUntilYear = Long.valueOf( untilCal.get(Calendar.YEAR));
+ this.validUntilDay = Long.valueOf(untilCal.get(Calendar.DAY_OF_YEAR));
}
@@ -262,8 +262,8 @@ public class VoucherData extends Object {
fromCal.clear();
fromCal.setTime(fromDate);
- this.validFromYear = new Long( fromCal.get(Calendar.YEAR));
- this.validFromDay = new Long (fromCal.get(Calendar.DAY_OF_YEAR));
+ this.validFromYear = Long.valueOf( fromCal.get(Calendar.YEAR));
+ this.validFromDay = Long.valueOf(fromCal.get(Calendar.DAY_OF_YEAR));
}
@@ -275,8 +275,8 @@ public class VoucherData extends Object {
untilCal.clear();
untilCal.setTime(untilDate);
- this.validUntilYear = new Long( untilCal.get(Calendar.YEAR));
- this.validUntilDay = new Long (untilCal.get(Calendar.DAY_OF_YEAR));
+ this.validUntilYear = Long.valueOf( untilCal.get(Calendar.YEAR));
+ this.validUntilDay = Long.valueOf(untilCal.get(Calendar.DAY_OF_YEAR));
}
diff --git a/src/main/java/org/uic/barcode/utils/SecurityUtils.java b/src/main/java/org/uic/barcode/utils/SecurityUtils.java
index 8f19e4b..b17bbb9 100644
--- a/src/main/java/org/uic/barcode/utils/SecurityUtils.java
+++ b/src/main/java/org/uic/barcode/utils/SecurityUtils.java
@@ -348,4 +348,15 @@ public class SecurityUtils {
return Constants.DSA_SHA1;
}
}
+
+ /*
+ * get a default security provider to be used in case a provider is missing
+ * bouncyCastle is assumed to be implemented
+ * if bouncyCastel is missing in the environment the provider stays empty.
+ */
+ public static Provider getDefaultProvider() {
+
+ return Security.getProvider("BC");
+
+ }
}