directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dran...@apache.org
Subject [23/30] directory-kerberos git commit: More code refactoring
Date Mon, 09 Feb 2015 06:28:04 GMT
More code refactoring


Project: http://git-wip-us.apache.org/repos/asf/directory-kerberos/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerberos/commit/f2ccbc32
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerberos/tree/f2ccbc32
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerberos/diff/f2ccbc32

Branch: refs/heads/installation
Commit: f2ccbc325dbc4c94c4741835d2a71c4623815a67
Parents: cacd283
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu Feb 5 11:28:41 2015 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Feb 5 11:28:41 2015 +0000

----------------------------------------------------------------------
 .../java/org/apache/kerby/asn1/Asn1Dump.java    |  6 +++--
 .../org/apache/kerby/asn1/Asn1OutputBuffer.java |  2 +-
 .../kerby/asn1/type/AbstractAsn1Type.java       |  4 ++-
 .../org/apache/kerby/asn1/type/Asn1Any.java     |  6 ++---
 .../apache/kerby/asn1/type/Asn1BmpString.java   |  6 ++---
 .../org/apache/kerby/asn1/type/Asn1Choice.java  | 22 ++++++++---------
 .../kerby/asn1/type/Asn1CollectionType.java     | 26 +++++++++++---------
 .../kerby/asn1/type/Asn1GeneralizedTime.java    |  4 ++-
 .../org/apache/kerby/asn1/type/Asn1Item.java    | 16 +++++++-----
 .../kerby/asn1/type/Asn1ObjectIdentifier.java   |  4 ++-
 .../org/apache/kerby/asn1/type/Asn1Tagging.java | 12 ++++-----
 .../org/apache/kerby/asn1/type/Asn1UtcTime.java |  3 +--
 .../apache/kerby/asn1/TestAsn1Collection.java   |  4 +--
 .../test/java/org/apache/kerby/asn1/Util.java   |  8 +++---
 14 files changed, 68 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/f2ccbc32/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Dump.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Dump.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Dump.java
index cfd9c5d..b9199fe 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Dump.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Dump.java
@@ -39,7 +39,9 @@ public class Asn1Dump {
         Asn1Type value;
         while (true) {
             value = buffer.read();
-            if (value == null) break;
+            if (value == null) {
+                break;
+            }
             dump(value, sb);
         }
 
@@ -54,7 +56,7 @@ public class Asn1Dump {
 
     private static void dump(Asn1Type value, StringBuilder buffer) {
         if (value instanceof Asn1Simple) {
-            buffer.append(((Asn1Simple) value).getValue().toString());
+            buffer.append(((Asn1Simple<?>) value).getValue().toString());
         } else if (value instanceof Asn1Item) {
             dump((Asn1Item) value, buffer);
         }

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/f2ccbc32/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1OutputBuffer.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1OutputBuffer.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1OutputBuffer.java
index 42f8ead..76e4d2b 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1OutputBuffer.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1OutputBuffer.java
@@ -56,7 +56,7 @@ public class Asn1OutputBuffer {
         int allLen = 0;
         for (Asn1Type item : objects) {
             if (item != null) {
-                allLen += ((AbstractAsn1Type) item).encodingLength();
+                allLen += ((AbstractAsn1Type<?>) item).encodingLength();
             }
         }
         return allLen;

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/f2ccbc32/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
index 9605646..a00591d 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
@@ -155,7 +155,9 @@ public abstract class AbstractAsn1Type<T> implements Asn1Type {
     public int tagFlags() {
         if (tagFlags == -1) {
             int flags = tagClass.getValue();
-            if (isConstructed()) flags |= EncodingOption.CONSTRUCTED_FLAG;
+            if (isConstructed()) {
+                flags |= EncodingOption.CONSTRUCTED_FLAG;
+            }
             return flags;
         }
         return tagFlags;

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/f2ccbc32/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Any.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Any.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Any.java
index 1474851..e73315d 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Any.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Any.java
@@ -32,16 +32,16 @@ public class Asn1Any extends AbstractAsn1Type<Asn1Type> {
 
     @Override
     protected int encodingBodyLength() {
-        return ((AbstractAsn1Type) getValue()).encodingBodyLength();
+        return ((AbstractAsn1Type<?>) getValue()).encodingBodyLength();
     }
 
     @Override
     protected void encodeBody(ByteBuffer buffer) {
-        ((AbstractAsn1Type) getValue()).encodeBody(buffer);
+        ((AbstractAsn1Type<?>) getValue()).encodeBody(buffer);
     }
 
     @Override
     protected void decodeBody(LimitedByteBuffer content) throws IOException {
-        ((AbstractAsn1Type) getValue()).decodeBody(content);
+        ((AbstractAsn1Type<?>) getValue()).decodeBody(content);
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/f2ccbc32/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1BmpString.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1BmpString.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1BmpString.java
index 125b9a2..aa59ed4 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1BmpString.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1BmpString.java
@@ -44,9 +44,9 @@ public class Asn1BmpString extends Asn1Simple<String>
         String strValue = getValue();
         int len = strValue.length();
         byte[] bytes = new byte[len * 2];
-        char c;
+        
         for (int i = 0; i != len; i++) {
-            c = strValue.charAt(i);
+            char c = strValue.charAt(i);
             bytes[2 * i] = (byte)(c >> 8);
             bytes[2 * i + 1] = (byte)c;
         }
@@ -55,7 +55,7 @@ public class Asn1BmpString extends Asn1Simple<String>
 
     protected void toValue() throws IOException {
         byte[] bytes = getBytes();
-        char[]  chars = new char[bytes.length / 2];
+        char[] chars = new char[bytes.length / 2];
         for (int i = 0; i != chars.length; i++) {
             chars[i] = (char)((bytes[2 * i] << 8) | (bytes[2 * i + 1] & 0xff));
         }

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/f2ccbc32/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Choice.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Choice.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Choice.java
index cb439b2..69b1fd6 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Choice.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Choice.java
@@ -44,13 +44,11 @@ public class Asn1Choice extends AbstractAsn1Type<Asn1Type> {
 
     @Override
     protected int encodingBodyLength() {
-        AbstractAsn1Type field;
-        TaggingOption taggingOption;
         for (int i = 0; i < fields.length; ++i) {
-            field = (AbstractAsn1Type) fields[i];
+            AbstractAsn1Type<?> field = (AbstractAsn1Type<?>) fields[i];
             if (field != null) {
                 if (fieldInfos[i].isTagged()) {
-                    taggingOption = fieldInfos[i].getTaggingOption();
+                    TaggingOption taggingOption = fieldInfos[i].getTaggingOption();
                     return field.taggedEncodingLength(taggingOption);
                 } else {
                     return field.encodingLength();
@@ -62,13 +60,11 @@ public class Asn1Choice extends AbstractAsn1Type<Asn1Type> {
 
     @Override
     protected void encodeBody(ByteBuffer buffer) {
-        Asn1Type field;
-        TaggingOption taggingOption;
         for (int i = 0; i < fields.length; ++i) {
-            field = fields[i];
+            Asn1Type field = fields[i];
             if (field != null) {
                 if (fieldInfos[i].isTagged()) {
-                    taggingOption = fieldInfos[i].getTaggingOption();
+                    TaggingOption taggingOption = fieldInfos[i].getTaggingOption();
                     field.taggedEncode(buffer, taggingOption);
                 } else {
                     field.encode(buffer);
@@ -105,7 +101,7 @@ public class Asn1Choice extends AbstractAsn1Type<Asn1Type> {
         }
 
         if (! item.isFullyDecoded()) {
-            AbstractAsn1Type fieldValue = (AbstractAsn1Type) fields[foundPos];
+            AbstractAsn1Type<?> fieldValue = (AbstractAsn1Type<?>) fields[foundPos];
             if (item.isContextSpecific()) {
                 item.decodeValueWith(fieldValue, fieldInfos[foundPos].getTaggingOption());
             } else {
@@ -139,7 +135,9 @@ public class Asn1Choice extends AbstractAsn1Type<Asn1Type> {
 
     protected String getFieldAsString(int index) {
         Asn1Type value = fields[index];
-        if (value == null) return null;
+        if (value == null) {
+            return null;
+        }
 
         if (value instanceof Asn1String) {
             return ((Asn1String) value).getValue();
@@ -150,7 +148,9 @@ public class Asn1Choice extends AbstractAsn1Type<Asn1Type> {
 
     protected byte[] getFieldAsOctets(int index) {
         Asn1OctetString value = getFieldAs(index, Asn1OctetString.class);
-        if (value != null) return value.getValue();
+        if (value != null) {
+            return value.getValue();
+        }
         return null;
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/f2ccbc32/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1CollectionType.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1CollectionType.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1CollectionType.java
index 28d8a15..4187209 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1CollectionType.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1CollectionType.java
@@ -50,13 +50,11 @@ public abstract class Asn1CollectionType extends AbstractAsn1Type<Asn1Collection
     @Override
     protected int encodingBodyLength() {
         int allLen = 0;
-        AbstractAsn1Type field;
-        TaggingOption taggingOption;
         for (int i = 0; i < fields.length; ++i) {
-            field = (AbstractAsn1Type) fields[i];
+            AbstractAsn1Type<?> field = (AbstractAsn1Type<?>) fields[i];
             if (field != null) {
                 if (fieldInfos[i].isTagged()) {
-                    taggingOption = fieldInfos[i].getTaggingOption();
+                    TaggingOption taggingOption = fieldInfos[i].getTaggingOption();
                     allLen += field.taggedEncodingLength(taggingOption);
                 } else {
                     allLen += field.encodingLength();
@@ -68,13 +66,11 @@ public abstract class Asn1CollectionType extends AbstractAsn1Type<Asn1Collection
 
     @Override
     protected void encodeBody(ByteBuffer buffer) {
-        Asn1Type field;
-        TaggingOption taggingOption;
         for (int i = 0; i < fields.length; ++i) {
-            field = fields[i];
+            Asn1Type field = fields[i];
             if (field != null) {
                 if (fieldInfos[i].isTagged()) {
-                    taggingOption = fieldInfos[i].getTaggingOption();
+                    TaggingOption taggingOption = fieldInfos[i].getTaggingOption();
                     field.taggedEncode(buffer, taggingOption);
                 } else {
                     field.encode(buffer);
@@ -111,7 +107,7 @@ public abstract class Asn1CollectionType extends AbstractAsn1Type<Asn1Collection
             }
 
             if (! item.isFullyDecoded()) {
-                AbstractAsn1Type fieldValue = (AbstractAsn1Type) fields[foundPos];
+                AbstractAsn1Type<?> fieldValue = (AbstractAsn1Type<?>) fields[foundPos];
                 if (item.isContextSpecific()) {
                     item.decodeValueWith(fieldValue, fieldInfos[foundPos].getTaggingOption());
                 } else {
@@ -137,7 +133,9 @@ public abstract class Asn1CollectionType extends AbstractAsn1Type<Asn1Collection
 
     protected <T extends Asn1Type> T getFieldAs(int index, Class<T> t) {
         Asn1Type value = fields[index];
-        if (value == null) return null;
+        if (value == null) {
+            return null;
+        }
         return (T) value;
     }
 
@@ -147,7 +145,9 @@ public abstract class Asn1CollectionType extends AbstractAsn1Type<Asn1Collection
 
     protected String getFieldAsString(int index) {
         Asn1Type value = fields[index];
-        if (value == null) return null;
+        if (value == null) {
+            return null;
+        }
 
         if (value instanceof Asn1String) {
             return ((Asn1String) value).getValue();
@@ -158,7 +158,9 @@ public abstract class Asn1CollectionType extends AbstractAsn1Type<Asn1Collection
 
     protected byte[] getFieldAsOctets(int index) {
         Asn1OctetString value = getFieldAs(index, Asn1OctetString.class);
-        if (value != null) return value.getValue();
+        if (value != null) {
+            return value.getValue();
+        }
         return null;
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/f2ccbc32/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1GeneralizedTime.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1GeneralizedTime.java
b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1GeneralizedTime.java
index 4346f65..020a7b4 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1GeneralizedTime.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1GeneralizedTime.java
@@ -105,7 +105,9 @@ public class Asn1GeneralizedTime extends Asn1Simple<Date> {
                 chr = dateStr.charAt(i);
                 if ('0' <= chr && chr <= '9') {
                     millDigits[j++] = chr;
-                } else break;
+                } else {
+                    break;
+                }
             }
         }
 

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/f2ccbc32/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Item.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Item.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Item.java
index a18d135..1249c20 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Item.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Item.java
@@ -58,7 +58,7 @@ public class Asn1Item extends AbstractAsn1Type<Asn1Type>
     @Override
     protected int encodingBodyLength() {
         if (getValue() != null) {
-            return ((AbstractAsn1Type) getValue()).encodingBodyLength();
+            return ((AbstractAsn1Type<?>) getValue()).encodingBodyLength();
         }
         return (int) bodyContent.hasLeft();
     }
@@ -66,7 +66,7 @@ public class Asn1Item extends AbstractAsn1Type<Asn1Type>
     @Override
     protected void encodeBody(ByteBuffer buffer) {
         if (getValue() != null) {
-            ((AbstractAsn1Type) getValue()).encodeBody(buffer);
+            ((AbstractAsn1Type<?>) getValue()).encodeBody(buffer);
         } else {
             try {
                 buffer.put(bodyContent.readAllLeftBytes());
@@ -86,7 +86,9 @@ public class Asn1Item extends AbstractAsn1Type<Asn1Type>
     }
 
     public void decodeValueAsSimple() throws IOException {
-        if (getValue() != null) return;
+        if (getValue() != null) {
+            return;
+        }
         if (! isSimple()) {
             throw new IllegalArgumentException("Attempting to decode non-simple value as
simple");
         }
@@ -96,7 +98,9 @@ public class Asn1Item extends AbstractAsn1Type<Asn1Type>
     }
 
     public void decodeValueAsCollection() throws IOException {
-        if (getValue() != null) return;
+        if (getValue() != null) {
+            return;
+        }
         if (! isCollection()) {
             throw new IllegalArgumentException("Attempting to decode non-collection value
as collection");
         }
@@ -117,7 +121,7 @@ public class Asn1Item extends AbstractAsn1Type<Asn1Type>
 
     public void decodeValueWith(Asn1Type value) throws IOException {
         setValue(value);
-        ((AbstractAsn1Type) value).decode(tagFlags(), tagNo(), bodyContent);
+        ((AbstractAsn1Type<?>) value).decode(tagFlags(), tagNo(), bodyContent);
     }
 
     public void decodeValueAsImplicitTagged(int originalTag, int originalTagNo) throws IOException
{
@@ -149,7 +153,7 @@ public class Asn1Item extends AbstractAsn1Type<Asn1Type>
         if (! isTagged()) {
             throw new IllegalArgumentException("Attempting to decode non-tagged value using
tagging way");
         }
-        ((AbstractAsn1Type) value).taggedDecode(tagFlags(), tagNo(), getBodyContent(), taggingOption);
+        ((AbstractAsn1Type<?>) value).taggedDecode(tagFlags(), tagNo(), getBodyContent(),
taggingOption);
         setValue(value);
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/f2ccbc32/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1ObjectIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1ObjectIdentifier.java
b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1ObjectIdentifier.java
index d12f6ca..0cec9c2 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1ObjectIdentifier.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1ObjectIdentifier.java
@@ -101,7 +101,9 @@ public class Asn1ObjectIdentifier extends Asn1Simple<String> {
     private byte[][] group(byte[] bytes) {
         int count = 0, i, j;
         int[] countArr = new int[bytes.length]; // how many bytes for each group
-        for (i = 0; i < countArr.length; ++i) countArr[i] = 0;
+        for (i = 0; i < countArr.length; ++i) {
+            countArr[i] = 0;
+        }
 
         for (j = 0, i = 0; i < bytes.length; ++i) {
             if ((bytes[i] & 0x80) != 0) {

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/f2ccbc32/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Tagging.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Tagging.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Tagging.java
index 9f56b39..b1e919c 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Tagging.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Tagging.java
@@ -46,7 +46,7 @@ public class Asn1Tagging<T extends Asn1Type> extends AbstractAsn1Type<T>
{
 
     @Override
     protected int encodingBodyLength() {
-        AbstractAsn1Type value = (AbstractAsn1Type) getValue();
+        AbstractAsn1Type<?> value = (AbstractAsn1Type<?>) getValue();
         if (getEncodingOption().isExplicit()) {
             return value.encodingLength();
         } else if (getEncodingOption().isImplicit()) {
@@ -61,7 +61,7 @@ public class Asn1Tagging<T extends Asn1Type> extends AbstractAsn1Type<T>
{
         if (getEncodingOption().isExplicit()) {
             return true;
         } else if (getEncodingOption().isImplicit()) {
-            AbstractAsn1Type value = (AbstractAsn1Type) getValue();
+            AbstractAsn1Type<?> value = (AbstractAsn1Type<?>) getValue();
             return value.isConstructed();
         }
         return false;
@@ -69,7 +69,7 @@ public class Asn1Tagging<T extends Asn1Type> extends AbstractAsn1Type<T>
{
 
     @Override
     protected void encodeBody(ByteBuffer buffer) {
-        AbstractAsn1Type value = (AbstractAsn1Type) getValue();
+        AbstractAsn1Type<?> value = (AbstractAsn1Type<?>) getValue();
         if (getEncodingOption().isExplicit()) {
             value.encode(buffer);
         } else if (getEncodingOption().isImplicit()) {
@@ -81,7 +81,7 @@ public class Asn1Tagging<T extends Asn1Type> extends AbstractAsn1Type<T>
{
 
     @Override
     protected void decodeBody(LimitedByteBuffer content) throws IOException {
-        AbstractAsn1Type value = (AbstractAsn1Type) getValue();
+        AbstractAsn1Type<?> value = (AbstractAsn1Type<?>) getValue();
         if (getEncodingOption().isExplicit()) {
             value.decode(content);
         } else if (getEncodingOption().isImplicit()) {
@@ -93,9 +93,9 @@ public class Asn1Tagging<T extends Asn1Type> extends AbstractAsn1Type<T>
{
 
     private void initValue() {
         Class<? extends Asn1Type> valueType = (Class<T>) ((ParameterizedType)
getClass().getGenericSuperclass()).getActualTypeArguments()[0];
-        AbstractAsn1Type value = null;
+        AbstractAsn1Type<?> value = null;
         try {
-            value = (AbstractAsn1Type) valueType.newInstance();
+            value = (AbstractAsn1Type<?>) valueType.newInstance();
         } catch (Exception e) {
             throw new RuntimeException("Failed to create tagged value", e);
         }

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/f2ccbc32/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1UtcTime.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1UtcTime.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1UtcTime.java
index c39dcdc..220e7c2 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1UtcTime.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1UtcTime.java
@@ -66,8 +66,7 @@ public class Asn1UtcTime extends Asn1Simple<Date>
             throw new IllegalArgumentException("Bad utc time string " + dateStr);
         }
 
-        SimpleDateFormat sdf;
-        sdf = new SimpleDateFormat("yyMMddHHmmssZ");
+        SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmssZ");
         sdf.setTimeZone(new SimpleTimeZone(0, "Z"));
         try {
             setValue(sdf.parse(fixedDateStr));

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/f2ccbc32/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Collection.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Collection.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Collection.java
index b3e81fc..16c368f 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Collection.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Collection.java
@@ -50,10 +50,10 @@ public class TestAsn1Collection {
     public void testSequenceDecoding() throws IOException {
         Asn1Sequence seq = new Asn1Sequence();
         seq.decode(EXPECTED_BYTES);
-        AbstractAsn1Type field = (AbstractAsn1Type) seq.getValue().get(0).getValue();
+        AbstractAsn1Type<?> field = (AbstractAsn1Type<?>) seq.getValue().get(0).getValue();
         assertThat(field.getValue()).isEqualTo(TEST_STR);
 
-        field = (AbstractAsn1Type) seq.getValue().get(1).getValue();
+        field = (AbstractAsn1Type<?>) seq.getValue().get(1).getValue();
         assertThat(field.getValue()).isEqualTo(TEST_BOOL);
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/f2ccbc32/kerby-asn1/src/test/java/org/apache/kerby/asn1/Util.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/Util.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/Util.java
index 446917a..d3a1570 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/Util.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/Util.java
@@ -50,7 +50,7 @@ public class Util {
      * 0x02 02 00 80
      */
     public static byte[] hex2bytes(String hexString) {
-        if (hexString==null) {
+        if (hexString == null) {
             throw new IllegalArgumentException("Invalid hex string to convert : null");
         }
         
@@ -60,7 +60,7 @@ public class Util {
             throw new IllegalArgumentException("Invalid hex string to convert : length below
4");
         }
         
-        if (( hexStr[0] != '0') || ((hexStr[1]!='x') && (hexStr[1]!='X'))) {
+        if (( hexStr[0] != '0') || ((hexStr[1] != 'x') && (hexStr[1] != 'X'))) {
             throw new IllegalArgumentException("Invalid hex string to convert : not starting
with '0x'");
         }
         
@@ -69,9 +69,9 @@ public class Util {
         boolean high = false;
         boolean prefix = true;
         
-        for (char c:hexStr) {
+        for (char c : hexStr) {
             if (prefix) {
-                if ((c == 'x')|| (c=='X')) {
+                if ((c == 'x') || (c=='X')) {
                     prefix = false;
                 }
                 


Mime
View raw message