Examples of TubainaException


Examples of br.com.caelum.tubaina.TubainaException

        Process proc;
        try {
            LOG.debug("Executing: " + command);
            proc = Runtime.getRuntime().exec(command);
        } catch (IOException e) {
            throw new TubainaException("Could not execute command: "+command, e);
        }
       
        writeInput(input, proc);
        verifyExitStatus(command, proc);
        String output = readOutput(proc);
View Full Code Here

Examples of br.com.caelum.tubaina.TubainaException

          Utilities.getImageWithLogo(srcImage, stream, Utilities.getFormatName(srcImage), logo);
          stream.close();
        } catch (IOException e) {
          LOG.warn("Error while copying " + srcImage.getPath() + ":\n" +
              "\t\t" + e.getMessage());
          throw new TubainaException("Couldn't copy image", e);
        }
      } else {
        LOG.warn("Error while copying '" + srcImage.getPath() + "':\n" +
            "\t\tDestination image '" + destinationFile.getPath() + "' already exists");
      }
    } else {
      LOG.warn("Image: '" + srcImage.getPath() + "' doesn't exist");
      throw new TubainaException("Image Doesn't Exists");
    }
   
  }
View Full Code Here

Examples of br.com.caelum.tubaina.TubainaException

        try {
            LOG.debug("Executing: " + args);
            String[] argsArray = buildArgs(args);
            proc = Runtime.getRuntime().exec(argsArray);
        } catch (IOException e) {
            throw new TubainaException("Could not execute command: " + args, e);
        }
       
        writeInput(input, proc);
        verifyExitStatus(args.toString(), proc);
        String output = readOutput(proc);
View Full Code Here

Examples of br.com.caelum.tubaina.TubainaException

    private void verifyExitStatus(String command, Process proc) {
        try {
            proc.waitFor();
        } catch (InterruptedException e) {
            throw new TubainaException("Could not execute command: "+command, e);
        }
        if (proc.exitValue() != 0) {
            String commandOutput = "";
            Scanner scanner = new Scanner(proc.getErrorStream());
            scanner.useDelimiter("$$");
            if (scanner.hasNext())
                commandOutput = scanner.next();
            throw new TubainaException("Command: " + command + " could not be executed: " + commandOutput);
        }
    }
View Full Code Here

Examples of br.com.caelum.tubaina.TubainaException

    locator = new ResourceLocator(rootDir);
  }

  public static ResourceLocator getInstance() {
    if (locator == null) {
      throw new TubainaException("ResourceLocator has not been initialized");
    }
    return locator;
  }
View Full Code Here

Examples of br.com.caelum.tubaina.TubainaException

  public Image getImage(String path) {
    try {
      return Image.getInstance(rootDir + File.separator + path);
    } catch (IOException e) {
      throw new TubainaException("Image " + path + " not existant", e);
    } catch (NullPointerException e) {
      throw new TubainaException(path + " is not a valid image");
    } catch (BadElementException e) {
      throw new TubainaException(path + " is not a valid image");
    }
  }
View Full Code Here

Examples of br.com.caelum.tubaina.TubainaException

          accepted = true;
          break;
        }
      }
      if (!accepted)
        throw new TubainaException("There is a syntax error on chapter "+ ChapterBuilder.getChaptersCount() +
          ": Probably, there is some text inside an exercise tag, but outside a question tag, or " +
          "an unnacceptable tag at some place.");
    }
    return chunks;
  }
View Full Code Here

Examples of br.com.caelum.tubaina.TubainaException

  private static final String MESSAGE = "[java] Tag is deprecated and can't be used anymore. Use [code java] instead";

  @Override
  public String parse(JavaChunk chunk) {
    throw new TubainaException(MESSAGE);
  }
View Full Code Here

Examples of br.com.caelum.tubaina.TubainaException

  private static final String MESSAGE = "[ruby] Tag is deprecated and can't be used anymore. Use [code ruby] instead";

  @Override
  public String parse(RubyChunk chunk) {
    throw new TubainaException(MESSAGE);
  }
View Full Code Here

Examples of br.com.caelum.tubaina.TubainaException

  public String parse(TableChunk chunk) {
    String title = chunk.getTitle();
    boolean hasBorder = chunk.hasBorder();
    int numberOfColumns = chunk.getMaxNumberOfColumns();
    if (numberOfColumns <= 0)
      throw new TubainaException("There are no columns inside table " + title);
    String tag = "\\begin{table}[!h]\n\\caption{" + title + "}\n\\begin{center}\n";
    if (hasBorder)
      tag += "\\rowcolors[]{1}{gray!30}{gray!15}\n";
    tag += "\\begin{tabularx}{";
    for (int i = 0; i < numberOfColumns; i++)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.