directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject [06/19] directory-kerby git commit: Print the dumping data with multi lines.
Date Wed, 09 Dec 2015 02:13:18 GMT
Print the dumping data with multi lines.


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

Branch: refs/heads/pkinit-support
Commit: c726e9117a7a50c59081544a389ccb26ceb1b516
Parents: 8c02c23
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Mon Dec 7 15:55:13 2015 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Mon Dec 7 15:55:13 2015 +0800

----------------------------------------------------------------------
 .../main/java/org/apache/kerby/asn1/Asn1.java   |  9 +++++-
 .../org/apache/kerby/asn1/PersonnelRecord.java  | 30 ++++++++++----------
 .../apache/kerby/asn1/TestPersonnelRecord.java  |  2 +-
 3 files changed, 24 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/c726e911/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1.java
index ec891f8..4c52588 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1.java
@@ -96,7 +96,14 @@ public final class Asn1 {
     public static void dump(byte[] content) throws IOException {
         String hexStr = HexUtil.bytesToHex(content);
         System.out.println("Dumping data:");
-        System.out.println(hexStr);
+        int range = 100;
+        int pos = range;
+        while (pos < hexStr.length()) {
+            System.out.println(hexStr.substring(pos - range, pos));
+            pos = pos + range;
+        }
+        System.out.println(hexStr.substring(pos - range, hexStr.length()));
+
         Asn1Dumper dumper = new Asn1Dumper();
         dumper.dump(content);
         String output = dumper.output();

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/c726e911/kerby-asn1/src/test/java/org/apache/kerby/asn1/PersonnelRecord.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/PersonnelRecord.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/PersonnelRecord.java
index 14f3b79..1810186 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/PersonnelRecord.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/PersonnelRecord.java
@@ -28,11 +28,11 @@ import org.apache.kerby.asn1.type.Asn1TaggingSet;
 import org.apache.kerby.asn1.type.Asn1VisibleString;
 
 import static org.apache.kerby.asn1.PersonnelRecord.ChildInformation.MyEnum.CHILD_NAME;
-import static org.apache.kerby.asn1.PersonnelRecord.ChildInformation.MyEnum.DATEOFBIRTH;
+import static org.apache.kerby.asn1.PersonnelRecord.ChildInformation.MyEnum.DATE_OF_BIRTH;
 import static org.apache.kerby.asn1.PersonnelRecord.MyEnum.CHILDREN;
-import static org.apache.kerby.asn1.PersonnelRecord.MyEnum.DATEOFHIRE;
+import static org.apache.kerby.asn1.PersonnelRecord.MyEnum.DATE_OF_HIRE;
 import static org.apache.kerby.asn1.PersonnelRecord.MyEnum.NAME;
-import static org.apache.kerby.asn1.PersonnelRecord.MyEnum.NAMEOFSPOUSE;
+import static org.apache.kerby.asn1.PersonnelRecord.MyEnum.NAME_OF_SPOUSE;
 import static org.apache.kerby.asn1.PersonnelRecord.MyEnum.NUMBER;
 import static org.apache.kerby.asn1.PersonnelRecord.MyEnum.TITLE;
 import static org.apache.kerby.asn1.PersonnelRecord.Name.MyEnum.FAMILYNAME;
@@ -48,8 +48,8 @@ public class PersonnelRecord extends Asn1TaggingSet {
         NAME,
         TITLE,
         NUMBER,
-        DATEOFHIRE,
-        NAMEOFSPOUSE,
+        DATE_OF_HIRE,
+        NAME_OF_SPOUSE,
         CHILDREN;
 
         @Override
@@ -67,8 +67,8 @@ public class PersonnelRecord extends Asn1TaggingSet {
             new ExplicitField(NAME, -1, Name.class),
             new ExplicitField(TITLE, 0, Asn1VisibleString.class),
             new ExplicitField(NUMBER, -1, EmployeeNumber.class),
-            new ExplicitField(DATEOFHIRE, 1, Date.class),
-            new ExplicitField(NAMEOFSPOUSE, 2, Name.class),
+            new ExplicitField(DATE_OF_HIRE, 1, Date.class),
+            new ExplicitField(NAME_OF_SPOUSE, 2, Name.class),
             new ImplicitField(CHILDREN, 3, Children.class)
     };
 
@@ -101,19 +101,19 @@ public class PersonnelRecord extends Asn1TaggingSet {
     }
 
     public void setDateOfHire(Date dateOfHire) {
-        setFieldAs(DATEOFHIRE, dateOfHire);
+        setFieldAs(DATE_OF_HIRE, dateOfHire);
     }
 
     public Date getDateOfHire() {
-        return getFieldAs(DATEOFHIRE, Date.class);
+        return getFieldAs(DATE_OF_HIRE, Date.class);
     }
 
     public void setNameOfSpouse(Name spouse) {
-        setFieldAs(NAMEOFSPOUSE, spouse);
+        setFieldAs(NAME_OF_SPOUSE, spouse);
     }
 
     public Name getNameOfSpouse() {
-        return getFieldAs(NAMEOFSPOUSE, Name.class);
+        return getFieldAs(NAME_OF_SPOUSE, Name.class);
     }
 
     public void setChildren(Children children) {
@@ -140,7 +140,7 @@ public class PersonnelRecord extends Asn1TaggingSet {
     public static class ChildInformation extends Asn1SetType {
         protected enum MyEnum implements EnumType {
             CHILD_NAME,
-            DATEOFBIRTH;
+            DATE_OF_BIRTH;
 
             @Override
             public int getValue() {
@@ -155,7 +155,7 @@ public class PersonnelRecord extends Asn1TaggingSet {
 
         static Asn1FieldInfo[] tags = new Asn1FieldInfo[] {
                 new ExplicitField(CHILD_NAME, -1, Name.class),
-                new ExplicitField(DATEOFBIRTH, 0, Date.class)
+                new ExplicitField(DATE_OF_BIRTH, 0, Date.class)
         };
 
         public ChildInformation() {
@@ -171,11 +171,11 @@ public class PersonnelRecord extends Asn1TaggingSet {
         }
 
         public void setDateOfBirth(Date date) {
-            setFieldAs(DATEOFBIRTH, date);
+            setFieldAs(DATE_OF_BIRTH, date);
         }
 
         public Date getDateOfBirth() {
-            return getFieldAs(DATEOFBIRTH, Date.class);
+            return getFieldAs(DATE_OF_BIRTH, Date.class);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/c726e911/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestPersonnelRecord.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestPersonnelRecord.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestPersonnelRecord.java
index 2afe998..c7f4fde 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestPersonnelRecord.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestPersonnelRecord.java
@@ -77,7 +77,7 @@ public class TestPersonnelRecord {
         PersonnelRecord expected = TestData.createSamplePersonnel();
         byte[] data = TestData.createSammplePersonnelEncodingData();
         PersonnelRecord decoded = new PersonnelRecord();
-        //Asn1.dump(data);
+        Asn1.dump(data);
         decoded.decode(data);
         Asn1.dump(decoded);
 


Mime
View raw message