This commit is contained in:
Timo Westkämper 2009-03-30 07:58:33 +00:00
parent b6c7b87440
commit d9d57d02b2
5 changed files with 20 additions and 8 deletions

View File

@ -129,7 +129,7 @@ public class AbstractColQuery<SubType extends AbstractColQuery<SubType>> impleme
try {
return query.count();
} catch (Exception e) {
throw new RuntimeException(e);
throw new RuntimeException(e.getMessage(), e);
}
}
@ -427,7 +427,7 @@ public class AbstractColQuery<SubType extends AbstractColQuery<SubType>> impleme
try {
return createIterator(projection);
} catch (Exception e) {
throw new RuntimeException("error", e);
throw new RuntimeException(e.getMessage(), e);
}
}

View File

@ -33,7 +33,7 @@ public class JaninoEvaluator implements Evaluator{
Class<?> type = expr.getType() != null ? expr.getType() : Object.class;
ev = new JavaSerializer(ops).handle(expr).createExpressionEvaluator(sources, type);
} catch (Exception e) {
throw new RuntimeException(e);
throw new RuntimeException(e.getMessage(), e);
}
}
@ -41,7 +41,11 @@ public class JaninoEvaluator implements Evaluator{
try {
return (T)ev.evaluate(args);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
if (e.getCause() instanceof NullPointerException){
throw new IllegalArgumentException("null path in expression");
}else{
throw new RuntimeException(e.getMessage(), e);
}
}
}

View File

@ -112,7 +112,7 @@ public class FilteringMultiIterator extends MultiIterator implements IteratorSou
} catch (Exception e) {
String error = "Caught " + e.getClass().getName();
logger.error(error, e);
throw new RuntimeException(error, e);
throw new RuntimeException(e.getMessage(), e);
}
}
return this;

View File

@ -73,8 +73,7 @@ public class JavaOps extends OperationPatterns {
add(op, "Math."+getPattern(op));
}
} catch (Exception e) {
String error = "Caught " + e.getClass().getName();
throw new RuntimeException(error, e);
throw new RuntimeException(e.getMessage(), e);
}
add(Ops.OpMath.MOD, "%s %% %s");

View File

@ -171,7 +171,16 @@ public class ColQueryTest extends AbstractQueryTest{
assertNotNull($(c.getKittensByName()));
assertNotNull($(c.getKittensByName().get("Kitty")));
from(c,cats)
.where($(c.getKittensByName().get("Kitty")).isnotnull()).list(cat);
.where($(c.getKittensByName().get("Kitty")).isnotnull()).list(cat);
// 11
try{
from(cat,cats).where(cat.mate.alive).list(cat);
fail("expected RuntimeException");
}catch(RuntimeException e){
assertEquals("null path in expression", e.getMessage());
}
}
@Test