diff options
author | Ade Lee <alee@redhat.com> | 2011-12-08 21:15:59 -0500 |
---|---|---|
committer | Ade Lee <alee@redhat.com> | 2011-12-08 21:15:59 -0500 |
commit | 171aaece4f23709d33d180cf36eb3af5e454b0c9 (patch) | |
tree | 1485f9f0a7bd10de4ff25030db575dbb8dafae74 /pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java | |
parent | adad2fcee8a29fdb82376fbce07dedb11fccc182 (diff) | |
download | pki-171aaece4f23709d33d180cf36eb3af5e454b0c9.tar.gz pki-171aaece4f23709d33d180cf36eb3af5e454b0c9.tar.xz pki-171aaece4f23709d33d180cf36eb3af5e454b0c9.zip |
Revert "Formatting"
This reverts commit 32150d3ee32f8ac27118af7c792794b538c78a2f.
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java')
-rw-r--r-- | pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java | 182 |
1 files changed, 79 insertions, 103 deletions
diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java index 4109e10f5..ccc5b64d0 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java @@ -17,6 +17,7 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cms.crl; + import java.io.IOException; import java.util.Locale; import java.util.StringTokenizer; @@ -42,13 +43,14 @@ import com.netscape.certsrv.ca.ICRLIssuingPoint; import com.netscape.certsrv.common.NameValuePairs; import com.netscape.certsrv.logging.ILogger; + /** * This represents a issuing distribution point extension. - * + * * @version $Revision$, $Date$ */ -public class CMSIssuingDistributionPointExtension implements ICMSCRLExtension, - IExtendedPluginInfo { +public class CMSIssuingDistributionPointExtension + implements ICMSCRLExtension, IExtendedPluginInfo { public static final String PROP_POINTTYPE = "pointType"; public static final String PROP_POINTNAME = "pointName"; public static final String PROP_DIRNAME = "DirectoryName"; @@ -59,25 +61,33 @@ public class CMSIssuingDistributionPointExtension implements ICMSCRLExtension, public static final String PROP_INDIRECT = "indirectCRL"; public static final String PROP_REASONS = "onlySomeReasons"; - private static final String[] reasonFlags = { "unused", "keyCompromise", - "cACompromise", "affiliationChanged", "superseded", - "cessationOfOperation", "certificateHold", "privilegeWithdrawn" }; + private static final String[] reasonFlags = {"unused", + "keyCompromise", + "cACompromise", + "affiliationChanged", + "superseded", + "cessationOfOperation", + "certificateHold", + "privilegeWithdrawn"}; private ILogger mLogger = CMS.getLogger(); public CMSIssuingDistributionPointExtension() { } - public Extension setCRLExtensionCriticality(Extension ext, boolean critical) { - IssuingDistributionPointExtension issuingDPointExt = (IssuingDistributionPointExtension) ext; + public Extension setCRLExtensionCriticality(Extension ext, + boolean critical) { + IssuingDistributionPointExtension issuingDPointExt = + (IssuingDistributionPointExtension) ext; issuingDPointExt.setCritical(critical); return issuingDPointExt; } - public Extension getCRLExtension(IConfigStore config, Object ip, - boolean critical) { + public Extension getCRLExtension(IConfigStore config, + Object ip, + boolean critical) { CMS.debug("in CMSIssuingDistributionPointExtension::getCRLExtension."); ICRLIssuingPoint crlIssuingPoint = (ICRLIssuingPoint) ip; @@ -92,13 +102,9 @@ public class CMSIssuingDistributionPointExtension implements ICMSCRLExtension, try { pointType = config.getString(PROP_POINTTYPE); } catch (EPropertyNotFound e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CREATE_DIST_POINT_UNDEFINED", - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_UNDEFINED", e.toString())); } catch (EBaseException e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID", - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID", e.toString())); } if (pointType != null) { @@ -107,13 +113,9 @@ public class CMSIssuingDistributionPointExtension implements ICMSCRLExtension, try { pointName = config.getString(PROP_POINTNAME); } catch (EPropertyNotFound e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CREATE_DIST_POINT_UNDEFINED", - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_UNDEFINED", e.toString())); } catch (EBaseException e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID", - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID", e.toString())); } if (pointName != null && pointName.length() > 0) { @@ -121,9 +123,7 @@ public class CMSIssuingDistributionPointExtension implements ICMSCRLExtension, try { rdnName = new RDN(pointName); } catch (IOException e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CREATE_RDN", - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_RDN", e.toString())); } } else if (pointType.equalsIgnoreCase(PROP_DIRNAME)) { try { @@ -131,16 +131,14 @@ public class CMSIssuingDistributionPointExtension implements ICMSCRLExtension, names.addElement(dirName); } catch (IOException e) { - log(ILogger.LL_FAILURE, CMS.getLogMessage( - "CRL_CREATE_INVALID_500NAME", e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_INVALID_500NAME", e.toString())); } } else if (pointType.equalsIgnoreCase(PROP_URINAME)) { URIName uriName = new URIName(pointName); names.addElement(uriName); } else { - log(ILogger.LL_FAILURE, CMS.getLogMessage( - "CRL_INVALID_POTINT_TYPE", pointType)); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_POTINT_TYPE", pointType)); } } } @@ -151,11 +149,9 @@ public class CMSIssuingDistributionPointExtension implements ICMSCRLExtension, try { issuingDPoint.setFullName(names); } catch (IOException e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CANNOT_SET_NAME", e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CANNOT_SET_NAME", e.toString())); } catch (GeneralNamesException e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CANNOT_SET_NAME", e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CANNOT_SET_NAME", e.toString())); } } @@ -164,13 +160,11 @@ public class CMSIssuingDistributionPointExtension implements ICMSCRLExtension, try { reasons = config.getString(PROP_REASONS, null); } catch (EBaseException e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_INVALID_PROPERTY", PROP_REASONS, - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", PROP_REASONS, e.toString())); } if (reasons != null && reasons.length() > 0) { - boolean[] bits = { false, false, false, false, false, false, false }; + boolean[] bits = {false, false, false, false, false, false, false}; int k = 0; StringTokenizer st = new StringTokenizer(reasons, ","); @@ -199,9 +193,7 @@ public class CMSIssuingDistributionPointExtension implements ICMSCRLExtension, if (caCertsOnly) issuingDPoint.setOnlyContainsCACerts(caCertsOnly); } catch (EBaseException e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_INVALID_PROPERTY", "caCertsOnly", - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", "caCertsOnly", e.toString())); } try { boolean userCertsOnly = config.getBoolean(PROP_USERCERTS, false); @@ -209,8 +201,7 @@ public class CMSIssuingDistributionPointExtension implements ICMSCRLExtension, if (userCertsOnly) issuingDPoint.setOnlyContainsUserCerts(userCertsOnly); } catch (EBaseException e) { - log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", - "userCertsOnly", e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", "userCertsOnly", e.toString())); } try { boolean indirectCRL = config.getBoolean(PROP_INDIRECT, false); @@ -218,9 +209,7 @@ public class CMSIssuingDistributionPointExtension implements ICMSCRLExtension, if (indirectCRL) issuingDPoint.setIndirectCRL(indirectCRL); } catch (EBaseException e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_INVALID_PROPERTY", "indirectCRL", - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", "indirectCRL", e.toString())); } issuingDPointExt = new IssuingDistributionPointExtension(issuingDPoint); @@ -239,13 +228,9 @@ public class CMSIssuingDistributionPointExtension implements ICMSCRLExtension, try { pointType = config.getString(PROP_POINTTYPE); } catch (EPropertyNotFound e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CREATE_DIST_POINT_UNDEFINED", - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_UNDEFINED", e.toString())); } catch (EBaseException e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID", - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID", e.toString())); } if (pointType != null && pointType.length() > 0) { nvp.add("pointType", pointType); @@ -258,13 +243,9 @@ public class CMSIssuingDistributionPointExtension implements ICMSCRLExtension, try { pointName = config.getString(PROP_POINTNAME); } catch (EPropertyNotFound e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CREATE_DIST_POINT_UNDEFINED", - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_UNDEFINED", e.toString())); } catch (EBaseException e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID", - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID", e.toString())); } if (pointName != null && pointName.length() > 0) { nvp.add("pointName", pointName); @@ -277,9 +258,7 @@ public class CMSIssuingDistributionPointExtension implements ICMSCRLExtension, try { reasons = config.getString(PROP_REASONS, null); } catch (EBaseException e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_INVALID_PROPERTY", PROP_REASONS, - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", PROP_REASONS, e.toString())); } if (reasons != null && reasons.length() > 0) { nvp.add(PROP_REASONS, reasons); @@ -293,27 +272,28 @@ public class CMSIssuingDistributionPointExtension implements ICMSCRLExtension, nvp.add(PROP_CACERTS, String.valueOf(caCertsOnly)); } catch (EBaseException e) { nvp.add(PROP_CACERTS, "false"); - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_INVALID_PROPERTY", "caCertsOnly", - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", "caCertsOnly", e.toString())); } // Disable these for now unitl we support them fully - /* - * try { boolean userCertsOnly = config.getBoolean(PROP_USERCERTS, - * false); - * - * nvp.add(PROP_USERCERTS, String.valueOf(userCertsOnly)); } catch - * (EBaseException e) { nvp.add(PROP_USERCERTS, "false"); - * log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", - * "userCertsOnly", e.toString())); } - * - * try { boolean indirectCRL = config.getBoolean(PROP_INDIRECT, false); - * - * nvp.add(PROP_INDIRECT, String.valueOf(indirectCRL)); } catch - * (EBaseException e) { nvp.add(PROP_INDIRECT, "false"); - * log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", - * "indirectCRL", e.toString())); } - */ +/* + try { + boolean userCertsOnly = config.getBoolean(PROP_USERCERTS, false); + + nvp.add(PROP_USERCERTS, String.valueOf(userCertsOnly)); + } catch (EBaseException e) { + nvp.add(PROP_USERCERTS, "false"); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", "userCertsOnly", e.toString())); + } + + try { + boolean indirectCRL = config.getBoolean(PROP_INDIRECT, false); + + nvp.add(PROP_INDIRECT, String.valueOf(indirectCRL)); + } catch (EBaseException e) { + nvp.add(PROP_INDIRECT, "false"); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", "indirectCRL", e.toString())); + } +*/ } public String[] getExtendedPluginInfo(Locale locale) { @@ -325,36 +305,32 @@ public class CMSIssuingDistributionPointExtension implements ICMSCRLExtension, sb_reasons.append(reasonFlags[i]); } String[] params = { - // "type;choice(CRLExtension,CRLEntryExtension);"+ - // "CRL Extension type. This field is not editable.", + //"type;choice(CRLExtension,CRLEntryExtension);"+ + //"CRL Extension type. This field is not editable.", "enable;boolean;Check to enable Issuing Distribution Point CRL extension.", "critical;boolean;Set criticality for Issuing Distribution Point CRL extension.", - PROP_POINTTYPE + ";choice(" + PROP_DIRNAME + "," + PROP_URINAME - + "," + PROP_RDNNAME - + ");Select Issuing Distribution Point name type.", - PROP_POINTNAME - + ";string;Enter Issuing Distribution Point name " - + "corresponding to the selected point type.", - PROP_REASONS - + ";string;Select any combination of the following reasons: " - + sb_reasons.toString(), - PROP_CACERTS - + ";boolean;Check if CRL contains CA certificates only", - // Remove these from the UI until they can be supported fully. - // PROP_USERCERTS + - // ";boolean;Check if CRL contains user certificates only", - // PROP_INDIRECT + ";boolean;Check if CRL is built indirectly.", - IExtendedPluginInfo.HELP_TOKEN - + ";configuration-ca-edit-crlextension-issuingdistributionpoint", - IExtendedPluginInfo.HELP_TEXT - + ";The issuing distribution point is a critical CRL extension " - + "that identifies the CRL distribution point for a particular CRL." }; + PROP_POINTTYPE + ";choice(" + PROP_DIRNAME + "," + PROP_URINAME + "," + + PROP_RDNNAME + ");Select Issuing Distribution Point name type.", + PROP_POINTNAME + ";string;Enter Issuing Distribution Point name " + + "corresponding to the selected point type.", + PROP_REASONS + ";string;Select any combination of the following reasons: " + + sb_reasons.toString(), + PROP_CACERTS + ";boolean;Check if CRL contains CA certificates only", + // Remove these from the UI until they can be supported fully. + // PROP_USERCERTS + ";boolean;Check if CRL contains user certificates only", + // PROP_INDIRECT + ";boolean;Check if CRL is built indirectly.", + IExtendedPluginInfo.HELP_TOKEN + + ";configuration-ca-edit-crlextension-issuingdistributionpoint", + IExtendedPluginInfo.HELP_TEXT + + ";The issuing distribution point is a critical CRL extension " + + "that identifies the CRL distribution point for a particular CRL." + }; return params; } private void log(int level, String msg) { mLogger.log(ILogger.EV_SYSTEM, null, ILogger.S_CA, level, - "CMSIssuingDistributionPointExtension - " + msg); + "CMSIssuingDistributionPointExtension - " + msg); } -} +} |