diff options
author | Ade Lee <alee@redhat.com> | 2012-01-11 12:57:53 -0500 |
---|---|---|
committer | Ade Lee <alee@redhat.com> | 2012-01-11 13:49:04 -0500 |
commit | 10cfe7756e967ac91c66d33b392aeab9cf3780fb (patch) | |
tree | d5ac9b58442265d2ce5ef60e31f041ddacba1b4f /pki/base/java-tools/src/com/netscape/cmstools/PrettyPrintCrl.java | |
parent | edcb24f65cc3700e75d0a1d14dc2483f210b0ee4 (diff) | |
download | pki-10cfe7756e967ac91c66d33b392aeab9cf3780fb.tar.gz pki-10cfe7756e967ac91c66d33b392aeab9cf3780fb.tar.xz pki-10cfe7756e967ac91c66d33b392aeab9cf3780fb.zip |
Formatting (no line wrap in comments or code)
Diffstat (limited to 'pki/base/java-tools/src/com/netscape/cmstools/PrettyPrintCrl.java')
-rw-r--r-- | pki/base/java-tools/src/com/netscape/cmstools/PrettyPrintCrl.java | 72 |
1 files changed, 35 insertions, 37 deletions
diff --git a/pki/base/java-tools/src/com/netscape/cmstools/PrettyPrintCrl.java b/pki/base/java-tools/src/com/netscape/cmstools/PrettyPrintCrl.java index b68f9fbc6..e191de027 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/PrettyPrintCrl.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/PrettyPrintCrl.java @@ -17,7 +17,6 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmstools; - import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.FileInputStream; @@ -38,33 +37,33 @@ import netscape.security.x509.OIDMap; import netscape.security.x509.X509CRLImpl; import netscape.security.x509.X509ExtensionException; - /** * The PrettyPrintCrl class is a utility program designed to "pretty print" - * a CRL. It assumes that the name of a data file is passed to the + * a CRL. It assumes that the name of a data file is passed to the * program via the command line, and that the contents contain a CRL - * encoded in an ASCII BASE 64 format. Note that the data file may contain + * encoded in an ASCII BASE 64 format. Note that the data file may contain * an optional "-----BEGIN" header and/or an optional "-----END" trailer. - * + * * <P> * The program may be invoked as follows: + * * <PRE> - * + * * PrettyPrintCrl <input filename> [output filename] - * + * * NOTE: <input filename> must contain an ASCII * BASE 64 encoded CRL - * + * * <output filename> contains a CRL displayed * in a "pretty print" ASCII format * </PRE> - * + * * @version $Revision$, $Date$ */ public class PrettyPrintCrl { // Define constants - public static final int ARGC = 2; + public static final int ARGC = 2; public static final String HEADER = "-----BEGIN"; public static final String TRAILER = "-----END"; @@ -83,33 +82,33 @@ public class PrettyPrintCrl { // (1) Check that at least one argument was submitted to the program if ((argv.length < 1) || (argv.length > ARGC)) { System.out.println("Usage: PrettyPrintCrl " + - "<input filename> " + - "[output filename]"); + "<input filename> " + + "[output filename]"); return; } try { OIDMap.addAttribute(DeltaCRLIndicatorExtension.class.getName(), - DeltaCRLIndicatorExtension.OID, - DeltaCRLIndicatorExtension.NAME); + DeltaCRLIndicatorExtension.OID, + DeltaCRLIndicatorExtension.NAME); } catch (CertificateException e) { } try { OIDMap.addAttribute(HoldInstructionExtension.class.getName(), - HoldInstructionExtension.OID, - HoldInstructionExtension.NAME); + HoldInstructionExtension.OID, + HoldInstructionExtension.NAME); } catch (CertificateException e) { } try { OIDMap.addAttribute(InvalidityDateExtension.class.getName(), - InvalidityDateExtension.OID, - InvalidityDateExtension.NAME); + InvalidityDateExtension.OID, + InvalidityDateExtension.NAME); } catch (CertificateException e) { } try { OIDMap.addAttribute(IssuingDistributionPointExtension.class.getName(), - IssuingDistributionPointExtension.OID, - IssuingDistributionPointExtension.NAME); + IssuingDistributionPointExtension.OID, + IssuingDistributionPointExtension.NAME); } catch (CertificateException e) { } @@ -119,11 +118,11 @@ public class PrettyPrintCrl { try { inputCrl = new BufferedReader(new InputStreamReader( new BufferedInputStream( - new FileInputStream( - argv[0])))); + new FileInputStream( + argv[0])))); } catch (FileNotFoundException e) { System.out.println("PrettyPrintCrl(): can''t find file " + - argv[0] + ":\n" + e); + argv[0] + ":\n" + e); return; } @@ -134,14 +133,14 @@ public class PrettyPrintCrl { try { while ((encodedBASE64CrlChunk = inputCrl.readLine()) != null) { if (!(encodedBASE64CrlChunk.startsWith(HEADER)) && - !(encodedBASE64CrlChunk.startsWith(TRAILER))) { + !(encodedBASE64CrlChunk.startsWith(TRAILER))) { encodedBASE64Crl += encodedBASE64CrlChunk.trim(); } } } catch (IOException e) { System.out.println("PrettyPrintCrl(): Unexpected BASE64 " + - "encoded error encountered in readLine():\n" + - e); + "encoded error encountered in readLine():\n" + + e); } // (4) Close the DataInputStream() object @@ -149,9 +148,9 @@ public class PrettyPrintCrl { inputCrl.close(); } catch (IOException e) { System.out.println("PrettyPrintCrl(): Unexpected BASE64 " + - "encoded error encountered in close():\n" + e); + "encoded error encountered in close():\n" + e); } - + // (5) Decode the ASCII BASE 64 CRL enclosed in the // String() object into a BINARY BASE 64 byte[] object @@ -163,14 +162,14 @@ public class PrettyPrintCrl { crl = new X509CRLImpl(decodedBASE64Crl); } catch (CRLException e) { System.out.println("PrettyPrintCrl(): Error encountered " + - "on parsing and initialization errors:\n" + e); + "on parsing and initialization errors:\n" + e); } catch (X509ExtensionException e) { System.out.println("PrettyPrintCrl(): Error encountered " + - "on parsing and initialization errors:\n" + e); + "on parsing and initialization errors:\n" + e); } // (7) For this utility, always specify the default Locale - aLocale = Locale.getDefault(); + aLocale = Locale.getDefault(); // (8) Create a CrlPrettyPrint() object CrlDetails = new CrlPrettyPrint(crl); @@ -187,7 +186,7 @@ public class PrettyPrintCrl { outputCrl = new FileOutputStream(argv[1]); } catch (IOException e) { System.out.println("PrettyPrintCrl(): unable to open file " + - argv[1] + " for writing:\n" + e); + argv[1] + " for writing:\n" + e); return; } @@ -195,18 +194,17 @@ public class PrettyPrintCrl { outputCrl.write(pp.getBytes()); } catch (IOException e) { System.out.println("PrettyPrintCrl(): I/O error " + - "encountered during write():\n" + - e); + "encountered during write():\n" + + e); } try { outputCrl.close(); } catch (IOException e) { System.out.println("PrettyPrintCrl(): Unexpected error " + - "encountered while attempting to close() " + - argv[1] + ":\n" + e); + "encountered while attempting to close() " + + argv[1] + ":\n" + e); } } } } - |