Class Util


  • public class Util
    extends java.lang.Object



    Stateless Class:
    This class neither contains any program-state, nor can it be instantiated. The @StaticFunctional Annotation may also be called 'The Spaghetti Report'. Static-Functional classes are, essentially, C-Styled Files, without any constructors or non-static member fields. It is a concept very similar to the Java-Bean's @Stateless Annotation.

    • 1 Constructor(s), 1 declared private, zero-argument constructor
    • 2 Method(s), 2 declared static
    • 0 Field(s)


    • Method Summary

       
      Error Handling Methods
      Modifier and Type Method
      static void ERROR_EXIT​(String cmd)
      static void HALT_ON_ERROR​(OSResponse osr)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • ERROR_EXIT

        🡇     🗕  🗗  🗖
        public static void ERROR_EXIT​(java.lang.String cmd)
        Simple Method for exiting with a consistent error message.

        Terminates the JVM
        This method invokes the Java-Command 'System.exit'
        Parameters:
        cmd - The Command that was executed, leading to the error.
        Code:
        Exact Method Body:
         final String s =
             BBLUE_BKGND + ' ' + RESET + " There was an error, and build is halting: " +
             BRED + cmd + RESET;
        
         final int len = s.length() - (BBLUE_BKGND + RESET + BRED + RESET).length();
        
         System.err.println(
             Printing.ERROR_EXIT_LINE + '\n' +
        
             s + StringParse.nChars(' ', Printing.LEN + 40 - len - 1) +
                 BBLUE_BKGND + ' ' + RESET + '\n' +
        
             Printing.ERROR_EXIT_LINE + '\n'
         );
        
         System.exit(0);
        
      • HALT_ON_ERROR

        🡅     🗕  🗗  🗖
        public static void HALT_ON_ERROR​(OSResponse osr)
        Checks a Command's Response for errors. If Errors have occured, the response that was returned is printed, and an Error is thrown.
        Parameters:
        osr - The Command's Response
        Throws:
        BuildError - If an error has occured in executing an Operating System call.
        Code:
        Exact Method Body:
         if (    (osr.response != 0)
             // NOTE: You cannot do this check, because 'gsutil' literally writes all of its 
             //       output to standard-error.  It's quite madening.
             // ||  ((osr.stdErr != null) && (osr.stdErr.length() > 0))
         )
         {
             System.out.println('\n' + osr.toString() + '\n');
        
             throw new BuildError("OSResponse Had Errors, Look at StackTrace to See Where !");
         }