List of usage examples for javax.servlet.jsp.el ELException getMessage
public String getMessage()
From source file:gov.nih.nci.cabig.caaers.utils.el.EL.java
public String evaluate(String input) { try {/*from www. j a v a 2s . co m*/ StringReader rdr = new StringReader(input); ELParser parser = new ELParser(rdr); Object result = parser.ExpressionString(); if (result instanceof String) { return (String) result; } else if (result instanceof Expression) { Expression expr = (Expression) result; result = expr.evaluate(this.resolver); return result == null ? null : result.toString(); } else if (result instanceof ExpressionString) { Expression expr = (Expression) result; result = expr.evaluate(this.resolver); return result == null ? null : result.toString(); } else if (result instanceof BinaryOperatorExpression) { BinaryOperatorExpression expr = (BinaryOperatorExpression) result; result = expr.evaluate(this.resolver, this.mapper, null); return result.toString(); } else if (result instanceof BooleanLiteral) { BooleanLiteral expr = (BooleanLiteral) result; result = expr.evaluate(this.resolver, this.mapper, null); return result.toString(); } else { System.out.println("Incorrect type returned; not String, Expression or ExpressionString"); return ""; } } catch (ParseException pe) { throw new RuntimeException("ParseException thrown: " + pe.getMessage(), pe); } catch (ELException ele) { throw new RuntimeException("ELException thrown: " + ele.getMessage(), ele); } }
From source file:org.apache.falcon.snapshots.retention.HdfsSnapshotEvictor.java
protected static void evictSnapshots(DistributedFileSystem fs, String dirName, String ageLimit, int numSnapshots) throws FalconException { try {//from w w w . ja v a 2 s . c o m LOG.info("Started evicting snapshots on dir {}{} using policy {}, agelimit {}, numSnapshot {}", fs.getUri(), dirName, ageLimit, numSnapshots); long evictionTime = System.currentTimeMillis() - EvictionHelper.evalExpressionToMilliSeconds(ageLimit); dirName = StringUtils.removeEnd(dirName, Path.SEPARATOR); String snapshotDir = dirName + Path.SEPARATOR + HdfsSnapshotUtil.SNAPSHOT_DIR_PREFIX + Path.SEPARATOR; FileStatus[] snapshots = fs.listStatus(new Path(snapshotDir)); if (snapshots.length <= numSnapshots) { // no eviction needed return; } // Sort by last modified time, ascending order. Arrays.sort(snapshots, new Comparator<FileStatus>() { @Override public int compare(FileStatus f1, FileStatus f2) { return Long.compare(f1.getModificationTime(), f2.getModificationTime()); } }); for (int i = 0; i < (snapshots.length - numSnapshots); i++) { // delete if older than ageLimit while retaining numSnapshots if (snapshots[i].getModificationTime() < evictionTime) { fs.deleteSnapshot(new Path(dirName), snapshots[i].getPath().getName()); } } } catch (ELException ele) { LOG.warn("Unable to parse retention age limit {} {}", ageLimit, ele.getMessage()); throw new FalconException("Unable to parse retention age limit " + ageLimit, ele); } catch (IOException ioe) { LOG.warn("Unable to evict snapshots from dir {} {}", dirName, ioe); throw new FalconException("Unable to evict snapshots from dir " + dirName, ioe); } }