tballison commented on code in PR #2843:
URL: https://github.com/apache/tika/pull/2843#discussion_r3316820006


##########
tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java:
##########
@@ -771,16 +781,18 @@ private void usage() {
         out.println();
         out.println("    -g  or --gui           Start the Apache Tika GUI");
         out.println();
-        out.println("    --config=<tika-config.xml>");
-        out.println("        TikaConfig file. Must be specified before -g, -s, 
-f or the dump-x-config !");
+        out.println("    --config=<tika-config.json>");
+        out.println("        TikaConfig file (JSON as of Tika 4.x). Must be 
specified before -g, -s or -f !");

Review Comment:
   Confirmed — `-s`/`--server` is explicitly rejected at TikaCLI.java:562 with 
an `IllegalArgumentException` ("no longer supported as of Tika 2.0"), so 
listing it in the usage text was misleading. Removed `-s` from this line; it 
now reads "Must be specified before -g or -f !".



##########
tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java:
##########
@@ -604,27 +614,27 @@ public void process(String arg) throws Exception {
         System.out.println(localConfig.getConfig().toString());
     }*/
 
-    private void convertConfigXmlToJson(String paths) throws Exception {
-        String[] parts = paths.split(",");
-        if (parts.length != 2) {
-            System.err.println("Error: --convert-config-xml-to-json requires 
input and output paths separated by comma");
-            System.err.println("Usage: 
--convert-config-xml-to-json=<input.xml>,<output.json>");
+    private void convertConfigXmlToJson(String inputPath) throws Exception {
+        if (inputPath == null || inputPath.trim().isEmpty()) {
+            System.err.println("Error: --convert-config-xml-to-json requires 
an input XML path");
+            System.err.println("Usage: 
--convert-config-xml-to-json=<input.xml> > <output.json>");
             return;
         }
 
-        Path xmlPath = Paths.get(parts[0].trim());
-        Path jsonPath = Paths.get(parts[1].trim());
+        Path xmlPath = Paths.get(inputPath.trim());
 
         if (!Files.exists(xmlPath)) {
             System.err.println("Error: Input XML file not found: " + xmlPath);
             return;
         }

Review Comment:
   Fixed — replaced `Files.exists()` with `Files.isRegularFile()` (which 
handles both the missing-file and the directory cases) and added an explicit 
`Files.isReadable()` check, each with its own error message before opening the 
stream.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to