directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject directory-kerby git commit: DIRKRB-349 Fix findbugs Problems for kerby-asn1 module. Contributed by Yaning.
Date Wed, 15 Jul 2015 02:58:25 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/master 0d7b34f93 -> 02ccc7354


DIRKRB-349 Fix findbugs Problems for kerby-asn1 module. Contributed by Yaning.


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

Branch: refs/heads/master
Commit: 02ccc73544886cbae6fd94f08ab101bbee14f221
Parents: 0d7b34f
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Wed Jul 15 11:03:58 2015 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Wed Jul 15 11:03:58 2015 +0800

----------------------------------------------------------------------
 .../main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java | 4 ----
 .../main/java/org/apache/kerby/asn1/type/Asn1BmpString.java    | 2 +-
 .../src/main/java/org/apache/kerby/asn1/type/Asn1Choice.java   | 2 +-
 .../main/java/org/apache/kerby/asn1/type/Asn1Collection.java   | 6 +-----
 .../java/org/apache/kerby/asn1/type/Asn1CollectionType.java    | 2 +-
 5 files changed, 4 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/02ccc735/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 fe98c53..4f41998 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
@@ -24,7 +24,6 @@ import org.apache.kerby.asn1.LimitedByteBuffer;
 import org.apache.kerby.asn1.TagClass;
 import org.apache.kerby.asn1.TaggingOption;
 
-import java.io.EOFException;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
@@ -444,9 +443,6 @@ public abstract class AbstractAsn1Type<T> implements Asn1Type {
 
     public static int readLength(LimitedByteBuffer buffer) throws IOException {
         int bodyLength = buffer.readByte() & 0xff;
-        if (bodyLength < 0) {
-            throw new EOFException("Unexpected EOF");
-        }
 
         if (bodyLength > 127) {
             int length = bodyLength & 0x7f;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/02ccc735/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 0d3fbfe..4949be0 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
@@ -27,7 +27,7 @@ import java.io.IOException;
 
 public class Asn1BmpString extends Asn1Simple<String> {
     public Asn1BmpString() {
-        super(null);
+        super(UniversalTag.BMP_STRING);
     }
 
     public Asn1BmpString(String value) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/02ccc735/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 d0b17ac..77116fc 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
@@ -35,7 +35,7 @@ public class Asn1Choice extends AbstractAsn1Type<Asn1Type> {
     public Asn1Choice(Asn1FieldInfo[] fieldInfos) {
         super(TagClass.UNIVERSAL, UniversalTag.CHOICE.getValue());
         setValue(this);
-        this.fieldInfos = fieldInfos;
+        this.fieldInfos = fieldInfos.clone();
         this.fields = new Asn1Type[fieldInfos.length];
         getEncodingOption().useConstructed();
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/02ccc735/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Collection.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Collection.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Collection.java
index 4eaee19..af7fbd2 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Collection.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Collection.java
@@ -82,11 +82,7 @@ public class Asn1Collection extends AbstractAsn1Type<List<Asn1Item>>
{
         while (content.available()) {
             Asn1Type aValue = decodeOne(content);
             if (aValue != null) {
-                if (aValue instanceof Asn1Item) {
-                    addItem((Asn1Item) aValue);
-                } else {
-                    addItem(aValue);
-                }
+                addItem(aValue);
             } else {
                 throw new RuntimeException("Unexpected running into here");
             }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/02ccc735/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 521b661..194ae8c 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
@@ -36,7 +36,7 @@ public abstract class Asn1CollectionType extends AbstractAsn1Type<Asn1Collection
     public Asn1CollectionType(int universalTagNo, Asn1FieldInfo[] fieldInfos) {
         super(TagClass.UNIVERSAL, universalTagNo);
         setValue(this);
-        this.fieldInfos = fieldInfos;
+        this.fieldInfos = fieldInfos.clone();
         this.fields = new Asn1Type[fieldInfos.length];
         getEncodingOption().useConstructed();
     }


Mime
View raw message