Skip to content

Commit 67ca9c5

Browse files
author
Stueypoo
committed
Added to 'results' if there is an error detected in the filename.
1 parent f73881d commit 67ca9c5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/ejbca-ejb-cli/src/org/ejbca/ui/cli/ca/CaImportCertDirCommand.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.cesecore.util.EjbRemoteHelper;
3636
import org.ejbca.core.ejb.ra.raadmin.EndEntityProfileSessionRemote;
3737
import org.ejbca.core.model.authorization.AccessRulesConstants;
38+
import org.ejbca.ui.cli.ca.CertificateImporter.Result;
3839
import org.ejbca.ui.cli.infrastructure.command.CommandResult;
3940
import org.ejbca.ui.cli.infrastructure.parameter.Parameter;
4041
import org.ejbca.ui.cli.infrastructure.parameter.ParameterContainer;
@@ -254,6 +255,7 @@ public CommandResult execute(final ParameterContainer parameters) {
254255
final String[] sa = file.getName().split("!");
255256
if (sa.length <3) {
256257
log.error("ERROR: The revocation details are not found in filename '"+file.getName()+"'. Ignoring this file.");
258+
results.add( Result.GENERAL_IMPORT_ERROR);
257259
continue;
258260
} else {
259261
// Process the REASON from 2nd last string in array
@@ -264,6 +266,7 @@ public CommandResult execute(final ParameterContainer parameters) {
264266
revocationReason = RevocationReasons.getFromDatabaseValue(iRevCode);
265267
if(revocationReason == null) {
266268
log.error("ERROR: '" + iRevCode + "' is not a valid revocation reason code. Ignoring this file '"+file.getName()+"'.");
269+
results.add( Result.GENERAL_IMPORT_ERROR);
267270
continue;
268271
}
269272

@@ -281,7 +284,8 @@ public CommandResult execute(final ParameterContainer parameters) {
281284
revocationReason = RevocationReasons.getFromCliValue(sRevCode.toUpperCase());
282285
if(revocationReason == null) {
283286
log.error("ERROR: '" + sRevCode + "' is not a valid revocation reason. Ignoring this file '"+file.getName()+"'.");
284-
continue;
287+
results.add( Result.GENERAL_IMPORT_ERROR);
288+
continue;
285289
}
286290
}
287291

@@ -291,6 +295,7 @@ public CommandResult execute(final ParameterContainer parameters) {
291295
revocationTime = new SimpleDateFormat(DATE_FORMAT_WINSAFE).parse( sRevTime);
292296
} catch (ParseException e) {
293297
log.error("ERROR: '" + sRevTime + "' was not a valid revocation time. Use this time format '"+DATE_FORMAT_WINSAFE+"'. Ignoring this file '"+file.getName()+"'.");
298+
results.add( Result.GENERAL_IMPORT_ERROR);
294299
continue;
295300
}
296301
}

0 commit comments

Comments
 (0)