(String[] args)
| 73 | } |
| 74 | |
| 75 | private void process(String[] args) throws Exception { |
| 76 | CommandLine options = parseCommandLine(args); |
| 77 | if (options == null) { |
| 78 | return; |
| 79 | } |
| 80 | String sourceFileName = options.getOptionValue(SOURCE_FILE); |
| 81 | File sourceFile = new File(sourceFileName); |
| 82 | if (!sourceFile.exists()) { |
| 83 | throw new Exception("File does not exist: " + sourceFileName); |
| 84 | } |
| 85 | long maxFileSize = Long.parseLong(options.getOptionValue(MAX_FILE_SIZE)); |
| 86 | String outputDirName = null; |
| 87 | if (options.hasOption(OUTPUT_DIR)) { |
| 88 | outputDirName = options.getOptionValue(OUTPUT_DIR); |
| 89 | } else { |
| 90 | outputDirName = System.getProperty("user.dir"); |
| 91 | } |
| 92 | String prefix = (options.hasOption(OUT_FILENAME_PREFIX)) ? options.getOptionValue(OUT_FILENAME_PREFIX) : ""; |
| 93 | boolean hasHeaderRow = options.hasOption(HAS_HEADER_ROW); |
| 94 | |
| 95 | if (options.hasOption(DEBUG) && "true".equalsIgnoreCase(options.getOptionValue(DEBUG))) { |
| 96 | System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); |
| 97 | System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true"); |
| 98 | System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "DEBUG"); |
| 99 | System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.wire", "ERROR"); |
| 100 | } |
| 101 | try { |
| 102 | FileUtil.splitLineBasedFile(sourceFile, outputDirName, maxFileSize, hasHeaderRow, sourceFile.getName(), prefix); |
| 103 | } catch (Exception e) { |
| 104 | e.printStackTrace(); |
| 105 | System.out.println("Processing error occurred: " + e.getMessage()); |
| 106 | System.exit(-1); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | public static void main(String[] args) { |
| 111 | try { |
no test coverage detected