Package js.tinyvm

Examples of js.tinyvm.TinyVMException


         {
            result = new GnuParser().parse(options, args);
         }
         catch (ParseException e)
         {
            throw new TinyVMException(e.getMessage(), e);
         }

         if (result.hasOption("h"))
         {
            throw new TinyVMException("Help:");
         }
      }
      catch (TinyVMException e)
      {
         StringWriter writer = new StringWriter();
         PrintWriter printWriter = new PrintWriter(writer);
         printWriter.println(e.getMessage());
        
         String commandName = System.getProperty("COMMAND_NAME", "lejos.pc.tools.Console");

         String usage = commandName + " [options]";
         new HelpFormatter().printHelp(printWriter, 80, usage.toString(), null,
            options, 0, 2, null);

         throw new TinyVMException(writer.toString());
      }

      assert result != null: "Postconditon: result != null";
      return result;
   }
View Full Code Here


         {
            result = new GnuParser().parse(options, args);
         }
         catch (ParseException e)
         {
            throw new TinyVMException(e.getMessage(), e);
         }

         if (result.hasOption("h"))
         {
            throw new TinyVMException("Help:");
         }

         if (result.getArgs().length == 0)
         {
            throw new TinyVMException("No file name specified");
         }
        
         if (result.getArgs().length > 1)
         {
            throw new TinyVMException("Only one file name allowed");
         }
      }
      catch (TinyVMException e)
      {
         StringWriter writer = new StringWriter();
         PrintWriter printWriter = new PrintWriter(writer);
         printWriter.println(e.getMessage());
        
         String commandName = System.getProperty("COMMAND_NAME", "java lejos.pc.tools.NXJUpload");

         String usage = commandName + " [options] filename";
         new HelpFormatter().printHelp(printWriter, 80, usage.toString(), null,
            options, 0, 2, null);

         throw new TinyVMException(writer.toString());
      }

      assert result != null: "Postconditon: result != null";
      return result;
   }
View Full Code Here

           {
              result = new GnuParser().parse(options, args);
           }
           catch (ParseException e)
           {
              throw new TinyVMException(e.getMessage(), e);
           }

           if (result.hasOption("h"))
           {
              throw new TinyVMException("Help:");
           }
        }
        catch (TinyVMException e)
        {
           StringWriter writer = new StringWriter();
           PrintWriter printWriter = new PrintWriter(writer);
           printWriter.println(e.getMessage());
          
           String commandName = System.getProperty("COMMAND_NAME", "lejos.pc.tools.SocketProxy");

           String usage = commandName + " [options]";
           new HelpFormatter().printHelp(printWriter, 80, usage.toString(), null,
              options, 0, 2, null);

           throw new TinyVMException(writer.toString());
        }

        assert result != null: "Postconditon: result != null";
        return result;
     }
View Full Code Here

         {
            result = new GnuParser().parse(options, args);
         }
         catch (ParseException e)
         {
            throw new TinyVMException(e.getMessage(), e);
         }

         if (result.hasOption("h"))
         {
            throw new TinyVMException("Help:");
         }

      }
      catch (TinyVMException e)
      {
         StringWriter writer = new StringWriter();
         PrintWriter printWriter = new PrintWriter(writer);
         printWriter.println(e.getMessage());
        
         String commandName = System.getProperty("COMMAND_NAME", "java lejos.pc.tools.NXJBrowser");

         String usage = commandName + " [options]";
         new HelpFormatter().printHelp(printWriter, 80, usage.toString(), null,
            options, 0, 2, null);

         throw new TinyVMException(writer.toString());
      }

      assert result != null: "Postconditon: result != null";
      return result;
   }
View Full Code Here

    try {
      try {
        result = new GnuParser().parse(options, args);
      } catch (ParseException e) {
        System.out.println("Parse error " + e);
        throw new TinyVMException(e.getMessage(), e);
      }

      if (result.hasOption("h"))
        throw new TinyVMException("Help:");

      if (result.getArgs().length == 1)
        throw new TinyVMException(
            "Must provide firmware and menu files");

      if (result.getArgs().length > 2)
        throw new TinyVMException("Too many files");
    } catch (TinyVMException e) {
      StringWriter writer = new StringWriter();
      PrintWriter printWriter = new PrintWriter(writer);
      printWriter.println(e.getMessage());

      String commandName = System.getProperty("COMMAND_NAME",
          "java lejos.pc.tools.NXJFlash");

      String usage = commandName + " [options] [firmware menu]";
      new HelpFormatter().printHelp(printWriter, 80, usage.toString(),
          null, options, 0, 2, null);

      throw new TinyVMException(writer.toString());
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of js.tinyvm.TinyVMException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.