Package com.github.mustachejava

Examples of com.github.mustachejava.MustacheException


      }
      cw.visitEnd();
      Class<?> aClass = defineClass(className, cw.toByteArray());
      return (IndyWrapper) aClass.getConstructor(ReflectionWrapper.class).newInstance(rw);
    } catch (Exception e) {
      throw new MustacheException(e);
    }
  }
View Full Code Here


  protected Writer handleCallable(Writer writer, final Callable callable, final Object[] scopes) {
    if (les == null) {
      try {
        writer = execute(writer, callable.call(), scopes);
      } catch (Exception e) {
        throw new MustacheException(e);
      }
    } else {
      // Flush the current writer
      try {
        writer.flush();
      } catch (IOException e) {
        throw new MustacheException("Failed to flush writer", e);
      }
      final Writer originalWriter = writer;
      final LatchedWriter latchedWriter = new LatchedWriter(writer);
      writer = latchedWriter;
      // Scopes must not cross thread boundaries as they
View Full Code Here

        Object apply = function.apply(capture.toString());
        if (apply != null) {
          writer.write(apply.toString());
        }
      } catch (IOException e) {
        throw new MustacheException("Failed to write function result", e);
      }
    }
    return writer;
  }
View Full Code Here

          seen.remove(mustache);
        }
      }
      return code;
    } catch (CloneNotSupportedException e) {
      throw new MustacheException("Clone not supported");
    }
  }
View Full Code Here

      return binding.get(scopes);
    } catch (MustacheException e) {
      e.setContext(tc);
      throw e;
    } catch (Throwable e) {
      throw new MustacheException(e.getMessage(), e, tc);
    }
  }
View Full Code Here

          tag(writer, "/");
        }
      }
      appendText(writer);
    } catch (IOException e) {
      throw new MustacheException(e);
    }
  }
View Full Code Here

  protected Writer appendText(Writer writer) {
    if (appended != null) {
      try {
        writer.write(appended);
      } catch (IOException e) {
        throw new MustacheException(e);
      }
    }
    return writer;
  }
View Full Code Here

        return field.get(scope);
      } else {
        return method.invoke(scope, arguments);
      }
    } catch (IllegalArgumentException e) {
      throw new MustacheException("Error accessing " + getTargetDescription() + " on " + elementToString(scope)
          + ", scope: [" + elementsToString(scopes, scopeIndex) + "]" + ", guards: " + Arrays.toString(guards), e);
    } catch (IllegalAccessException e) {
      throw new MustacheException("Error accessing " + getTargetDescription() + " on " + elementToString(scope)
          + ", scope: [" + elementsToString(scopes, scopeIndex) + "]" + ", guards: " + Arrays.toString(guards), e);
    } catch (InvocationTargetException e) {
      throw new MustacheException("Error invoking " + getTargetDescription() + " on " + elementToString(scope), e.getTargetException());
    } catch (Exception e) {
      throw new MustacheException("Error invoking " + getTargetDescription() + " on " + elementToString(scope), e);
    }
  }
View Full Code Here

   *
   * @param fileRoot
   */
  public FileSystemResolver(File fileRoot) {
    if (!fileRoot.exists()) {
      throw new MustacheException(fileRoot + " does not exist");
    }
    if (!fileRoot.isDirectory()) {
      throw new MustacheException(fileRoot + " is not a directory");
    }
    this.fileRoot = fileRoot;
  }
View Full Code Here

        File parent = file.getCanonicalFile();
        while ((parent = parent.getParentFile()) != null) {
          if (parent.equals(checkRoot)) break;
        }
        if (parent == null) {
          throw new MustacheException("File not under root: " + checkRoot.getAbsolutePath());
        }
        is = new FileInputStream(file);
      } catch (IOException e) {
        throw new MustacheException("Found file, could not open: " + file, e);
      }
    }
    if (is != null) {
      return new BufferedReader(new InputStreamReader(is, Charsets.UTF_8));
    } else {
View Full Code Here

TOP

Related Classes of com.github.mustachejava.MustacheException

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.