directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject [1/3] directory-kerby git commit: Acdded some Javadoc, and a check on the elements : if it's null, we shoul return an empty list.
Date Wed, 30 Dec 2015 10:27:18 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/trunk 2a5efa35a -> 663b8902f


Acdded some Javadoc, and a check on the elements : if it's null, we
shoul return an empty list.

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

Branch: refs/heads/trunk
Commit: 96047c2ffc4526e21c78a7cd3be480a1d120c5e5
Parents: 2fdd50d
Author: Emmanuel L├ęcharny <elecharny@symas.com>
Authored: Wed Dec 30 00:01:30 2015 +0100
Committer: Emmanuel L├ęcharny <elecharny@symas.com>
Committed: Wed Dec 30 00:01:30 2015 +0100

----------------------------------------------------------------------
 .../kerberos/kerb/type/KrbSequenceOfType.java   | 27 ++++++++++++++++----
 1 file changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/96047c2f/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/KrbSequenceOfType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/KrbSequenceOfType.java
b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/KrbSequenceOfType.java
index 06bfdd8..10e2832 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/KrbSequenceOfType.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/KrbSequenceOfType.java
@@ -19,18 +19,34 @@
  */
 package org.apache.kerby.kerberos.kerb.type;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.kerby.asn1.type.Asn1SequenceOf;
 import org.apache.kerby.asn1.type.Asn1String;
 import org.apache.kerby.asn1.type.Asn1Type;
 
-import java.util.ArrayList;
-import java.util.List;
-
+/**
+ * A class that represents a SequenceOf Kerberos elements. 
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ *
+ * @param <T> The KrbSequence type
+ */
 public class KrbSequenceOfType<T extends Asn1Type> extends Asn1SequenceOf<T>
{
-
+    /**
+     * @return A String List of the Kerberos Elements in this sequenceOf.
+     */
     public List<String> getAsStrings() {
         List<T> elements = getElements();
-        List<String> results = new ArrayList<String>();
+        
+        // may be spurious... Careful check of the elements nullity.
+        if (elements == null) {
+            return new ArrayList<String>();
+        }
+        
+        List<String> results = new ArrayList<String>(elements.size());
+        
         for (T ele : elements) {
             if (ele instanceof Asn1String) {
                 results.add(((Asn1String) ele).getValue());
@@ -38,6 +54,7 @@ public class KrbSequenceOfType<T extends Asn1Type> extends Asn1SequenceOf<T>
{
                 throw new RuntimeException("The targeted field type isn't of string");
             }
         }
+        
         return results;
     }
 }


Mime
View raw message