Package melnorme.utilbox.core

Examples of melnorme.utilbox.core.CommonException


  }
 
  /* ----------------- ----------------- */
 
  protected CommonException createCommonException(String message, Throwable cause) {
    return new CommonException(message, cause);
  }
View Full Code Here


 
  public static Process startProcess(ProcessBuilder pb) throws CommonException {
    try {
      return pb.start();
    } catch (IOException ie) {
      throw new CommonException(ProcessHelperMessages.ExternalProcess_CouldNotStart, ie);
    }
  }
View Full Code Here

 
  public ExternalProcessResult strictAwaitTermination_(boolean throwOnNonZeroStatus) throws CommonException {
    ExternalProcessResult processResult = strictAwaitTermination_(NO_TIMEOUT);
   
    if(throwOnNonZeroStatus && processResult.exitValue != 0) {
      throw new CommonException("Process completed with non-zero exit value (" + processResult.exitValue + ")");
    }
    return processResult;
  }
View Full Code Here

      assertFail();
    }
  }
 
  protected final void handleUnknownLineSyntax(String line) {
    handleParseError(new CommonException("Unknown error line syntax: " + line));
  }
View Full Code Here

  }
 
  public ProcessBuilder createProcessBuilder(GoEnvironment goEnv, Path filePath, int offset) throws CommonException {
    GoPackageName goPackage = goEnv.findGoPackageForSourceModule(filePath);
    if(goPackage == null) {
      throw new CommonException(MessageFormat.format(
        "Could not determine Go package for Go file ({0}), file not in the Go environment.", filePath),
        null);
    }
   
    // go oracle requires this
View Full Code Here

    return goEnv.createProcessBuilder(commandLine);
  }
 
  public FindDefinitionResult parseJsonResult(ExternalProcessResult result) throws CommonException {
    if(result.exitValue != 0) {
      throw new CommonException("Program exited with non-zero status: " + result.exitValue, null);
    }
   
    String output = result.getStdOutBytes().toString();
   
    try {
      return parseJsonResult(output);
    } catch (JSONException e) {
      throw new CommonException("Error parsing JSON output: ", e);
    }
  }
View Full Code Here

    String lineStr = StringUtil.segmentAfterLastMatch(pathStr, ":");
    pathStr = StringUtil.substringUntilLastMatch(pathStr, ":");
   
   
    if(columnStr == null || lineStr == null) {
      throw new CommonException("No line or column position given.", null);
    }
    int line = parseInt(lineStr, "Invalid number for line: " + lineStr);
    int column = parseInt(columnStr, "Invalid number for column: " + columnStr);
   
    Path path = parsePath(pathStr);
View Full Code Here

  /* -----------------  ----------------- */
 
  protected Path parsePath(String pathStr) throws CommonException {
    Path path = MiscUtil.createPathOrNull(pathStr);
    if(path == null) {
      throw new CommonException("Invalid path: " + pathStr, null);
    }
    return path;
  }
View Full Code Here

  protected int parseInt(String integerString, String errorMessage) throws CommonException {
   
    try {
      return Integer.parseInt(integerString);
    } catch (NumberFormatException e) {
      throw new CommonException(errorMessage, null);
    }
  }
View Full Code Here

    ProcessBuilder pb = goEnvironment.createProcessBuilder(arguments);
   
    ExternalProcessResult processResult = runGocodeProcess(pb, bufferText);

    if(processResult.exitValue != 0) {
      throw new CommonException("Error, gocode returned non-zero status: " + processResult.exitValue);
    }
   
    return processResult;
  }
View Full Code Here

TOP

Related Classes of melnorme.utilbox.core.CommonException

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.