You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2019/08/17 23:07:55 UTC

svn commit: r1865376 - /commons/scripts/NexusGet.java

Author: sebb
Date: Sat Aug 17 23:07:55 2019
New Revision: 1865376

URL: http://svn.apache.org/viewvc?rev=1865376&view=rev
Log:
Error Handling

Modified:
    commons/scripts/NexusGet.java

Modified: commons/scripts/NexusGet.java
URL: http://svn.apache.org/viewvc/commons/scripts/NexusGet.java?rev=1865376&r1=1865375&r2=1865376&view=diff
==============================================================================
--- commons/scripts/NexusGet.java (original)
+++ commons/scripts/NexusGet.java Sat Aug 17 23:07:55 2019
@@ -30,7 +30,7 @@ import javax.xml.stream.XMLStreamReader;
 /**
  * Utility class to parse Nexus staging repo and optionally download all the Maven artifacts for a given RC.
  * <p>
- * $ java NexusGet nexusId [download folder]
+ * $ java NexusGet nexusId [download folder] [.type]
  * <p>
  * The nexusId is either a 4 digit id, in which case it is assumed to be under orgapachecommons,
  * <br>
@@ -49,7 +49,12 @@ public class NexusGet {
 
     public static void main(String[] args) throws Exception {
         if (args.length == 0) {
-            System.err.println("Need Nexus number, e.g. 1234 or full URL to /content/ or below");
+            System.err.println("Syntax: java NexusGet nexusId [download folder] [.type]");
+            System.err.println("Need nexusId, e.g.");
+            System.err.println("\t1234 (orgapachecommons is assumed) or");
+            System.err.println("\torgapachecommons-1234 or");
+            System.err.println("\tURL to https://repository.apache.org/service/local/repositories/{project}-nnnn/content/ or below");
+            System.err.println("\tIf the download folder name starts with '.' it is assumed to be the file type, and the contents are displayed");
             return;
         }
         
@@ -80,6 +85,9 @@ public class NexusGet {
             while ((len = is.read(buffer)) > 0) {  
                 fos.write(buffer, 0, len);
             }
+        } catch (IOException e) {
+            System.err.println("Error writing file: " + e);
+            System.exit(1);
         }
     }
 
@@ -103,6 +111,7 @@ public class NexusGet {
                                 parseNexus(text, folder, fact);
                             } catch (IOException ioe){
                                 System.out.println("Retrying once; Nexus sometimes objects " + ioe);
+                                ioe.printStackTrace();
                                 parseNexus(text, folder, fact);                                
                             }
                         } else {