import java.io.StringWriter;
import java.net.URL;
import java.util.Arrays;
+
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
-import org.onap.policy.api.main.PolicyApiException;
-import org.onap.policy.api.main.PolicyApiRuntimeException;
+import org.onap.policy.api.main.exception.PolicyApiException;
+import org.onap.policy.api.main.exception.PolicyApiRuntimeException;
import org.onap.policy.common.utils.resources.ResourceUtils;
-
/**
* This class reads and handles command line parameters for the policy api main program.
*/
final String[] remainingArgs = commandLine.getArgs();
if (remainingArgs.length > 0 && commandLine.hasOption('c') || remainingArgs.length > 0) {
- throw new PolicyApiException(
- "too many command line arguments specified : " + Arrays.toString(args));
+ throw new PolicyApiException("too many command line arguments specified : " + Arrays.toString(args));
}
if (remainingArgs.length == 1) {
}
if (commandLine.hasOption('h')) {
- return help(Main.class.getCanonicalName());
+ return help(Main.class.getName());
}
if (commandLine.hasOption('v')) {
if (!theFile.exists()) {
throw new PolicyApiException(fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" does not exist");
}
- if (!theFile.isFile()) {
- throw new PolicyApiException(
- fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" is not a normal file");
- }
- if (!theFile.canRead()) {
- throw new PolicyApiException(fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" is ureadable");
- }
}
}