diff --git a/src/main/java/com/mysema/codegen/CodegenException.java b/src/main/java/com/mysema/codegen/CodegenException.java new file mode 100644 index 000000000..531b35b30 --- /dev/null +++ b/src/main/java/com/mysema/codegen/CodegenException.java @@ -0,0 +1,18 @@ +package com.mysema.codegen; + +public class CodegenException extends RuntimeException{ + + private static final long serialVersionUID = -8704782349669898467L; + + public CodegenException(String msg){ + super(msg); + } + + public CodegenException(String msg, Throwable t){ + super(msg, t); + } + + public CodegenException(Throwable t){ + super(t); + } +} diff --git a/src/main/java/com/mysema/codegen/EvaluatorFactory.java b/src/main/java/com/mysema/codegen/EvaluatorFactory.java index 314679813..9f43be8f3 100644 --- a/src/main/java/com/mysema/codegen/EvaluatorFactory.java +++ b/src/main/java/com/mysema/codegen/EvaluatorFactory.java @@ -81,7 +81,7 @@ public class EvaluatorFactory { null, Collections.singletonList(javaFileObject)); if (!task.call().booleanValue()) { - throw new RuntimeException("Compilation of " + source + " failed.\n" + out.toString()); + throw new CodegenException("Compilation of " + source + " failed.\n" + out.toString()); } } @@ -115,15 +115,15 @@ public class EvaluatorFactory { } }; } catch (ClassNotFoundException e) { - throw new RuntimeException(e); + throw new CodegenException(e); } catch (SecurityException e) { - throw new RuntimeException(e); + throw new CodegenException(e); } catch (NoSuchMethodException e) { - throw new RuntimeException(e); + throw new CodegenException(e); } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); + throw new CodegenException(e); } catch (IOException e) { - throw new RuntimeException(e); + throw new CodegenException(e); } } diff --git a/src/main/java/com/mysema/codegen/JavaWriter.java b/src/main/java/com/mysema/codegen/JavaWriter.java index 68c886bef..2b4b44553 100644 --- a/src/main/java/com/mysema/codegen/JavaWriter.java +++ b/src/main/java/com/mysema/codegen/JavaWriter.java @@ -90,11 +90,11 @@ public final class JavaWriter implements Appendable, CodeWriter{ Object value = method.invoke(annotation); annotationConstant(value); } catch (IllegalArgumentException e) { - throw new RuntimeException(e); + throw new CodegenException(e); } catch (IllegalAccessException e) { - throw new RuntimeException(e); + throw new CodegenException(e); } catch (InvocationTargetException e) { - throw new RuntimeException(e); + throw new CodegenException(e); } first = false; } diff --git a/src/main/java/com/mysema/codegen/SimpleCompiler.java b/src/main/java/com/mysema/codegen/SimpleCompiler.java index e4b3b0828..ee4b188ca 100644 --- a/src/main/java/com/mysema/codegen/SimpleCompiler.java +++ b/src/main/java/com/mysema/codegen/SimpleCompiler.java @@ -45,7 +45,7 @@ public class SimpleCompiler implements JavaCompiler{ } return path.toString(); }catch(UnsupportedEncodingException e){ - throw new RuntimeException(e); + throw new CodegenException(e); } }