Package br.com.caelum.tubaina

Examples of br.com.caelum.tubaina.TubainaException


            LOG.warn("Image: '" + srcImage.getPath() + "' is too big for the page");
          }
          FileUtils.copyFileToDirectory(srcImage, this.imagePath);
        } 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 '"
            + destinationPath.getPath() + "' already exists");
      }
    } else {
      LOG.warn("Image: '" + srcImage.getPath() + "' doesn't exists");
      throw new TubainaException("Image doesn't exists");
    }

  }
View Full Code Here


        stream.append("");
      else
        stream.append(answer);
      stream.close();
    } catch (FileNotFoundException e) {
      throw new TubainaException("couldn't copy answer", e);
    } catch (UnsupportedEncodingException e) {
      throw new TubainaException("Invalid Encoding", e);
    }
  }
View Full Code Here

        stream.append("");
      else
        stream.append(answer);
      stream.close();
    } catch (FileNotFoundException e) {
      throw new TubainaException("couldn't copy answer", e);
    } catch (UnsupportedEncodingException e) {
      throw new TubainaException("Invalid Encoding", e);
    }   
  }
View Full Code Here

    PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(destination), "UTF-8"));
    try {
      Template temp = configuration.getTemplate(template);
      temp.process(map, out);
    } catch (Exception e) {
      throw new TubainaException(e);
    }
    out.flush();
  }
View Full Code Here

    PrintWriter out = new PrintWriter(writer);
    try {
      Template temp = configuration.getTemplate(template);
      temp.process(map, out);
    } catch (Exception e) {
      throw new TubainaException(e);
    }
    out.flush();
    return writer.getBuffer();
  }
View Full Code Here

          }
          Utilities.getImageWithLogo(srcImage, stream, Utilities.getFormatName(srcImage), logo);
        } 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

        LOG.warn("Failed to read file", e);
      }
    }
    int maxLineLenght = Utilities.maxLineLength(content) - Utilities.getMinIndent(content);
    if(maxLineLenght >Tubaina.MAX_LINE_LENGTH)
      throw new TubainaException ("Chapter " + Chapter.getChaptersCount() +
                    "  -  Java code has " + maxLineLenght + " columns:\n\n" + content);
    return new JavaChunk(options, content);
  }
View Full Code Here

  }

  @Override
  public Chunk createChunk(String options, String content) {
    if (options == null || options.trim().length() == 0) {
      throw new TubainaException("Boxes must have a non-empty title");
    }
    String title = options.trim();
    List<Chunk> body = new ChunkSplitter(resources, "box").splitChunks(content);
    return new BoxChunk(title, body);
  }
View Full Code Here

  @Override
  public Chunk createChunk(String options, String content) {
    int maxLineLenght = Utilities.maxLineLength(content) - Utilities.getMinIndent(content);
    if(maxLineLenght >Tubaina.MAX_LINE_LENGTH)
      throw new TubainaException ("Chapter " + Chapter.getChaptersCount() +
                    "  -  Code has " + maxLineLenght + " columns:\n\n" + content);
    return new CodeChunk(content, options);
  }
View Full Code Here

        }
      } else { //is closeTag ([/tag])
        if (stack.peek().equalsIgnoreCase(tagName)) {
          stack.pop();
        } else {
          throw new TubainaException("Tag " + tagName + " was closed unproperly");
        }
      }
    }
    if (!stack.isEmpty()) { //tag was not closed properly
      throw new TubainaException("There is(are) unclosed tag(s) : " + stack.toString());
    }
    String content = text.substring(contentStart, contentStart + tagMatcher.start());
   
    chunks.add(createChunk(options, content));
    return text.substring(contentStart + tagMatcher.end());
View Full Code Here

TOP

Related Classes of br.com.caelum.tubaina.TubainaException

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.