Skip to content

Commit

Permalink
TEIID-2634 removing the assertion checks from constant
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Aug 21, 2013
1 parent 15f68ce commit eb97235
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
10 changes: 1 addition & 9 deletions engine/src/main/java/org/teiid/query/sql/symbol/Constant.java
Expand Up @@ -133,15 +133,7 @@ public Constant(Object value, Class<?> type) {
if(type == null) {
throw new IllegalArgumentException(QueryPlugin.Util.getString("ERR.015.010.0014")); //$NON-NLS-1$
}
Class<?> originalType = type;
while (type.isArray()) {
type = type.getComponentType();
}
if(! DataTypeManager.getAllDataTypeClasses().contains(type)) {
throw new IllegalArgumentException(QueryPlugin.Util.getString("ERR.015.010.0015", type.getName())); //$NON-NLS-1$
}
assert value == null || originalType.isArray() || originalType.isAssignableFrom(value.getClass()) : "Invalid value for specified type."; //$NON-NLS-1$
this.type = originalType;
this.type = type;
}

/**
Expand Down
Expand Up @@ -146,5 +146,24 @@ public class TestProcErrors {

helpTestProcess(plan, new List[0], dataManager, tm);
}

@Test public void testExceptionHandlingWithDynamic() throws Exception {
String ddl =
"create virtual procedure vproc (x integer) returns integer as begin " +
"raise sqlexception 'hello world' sqlstate 'abc', 5;" +
"exception e " +
"execute immediate 'select \"ERRORCODE\"' as x integer into #temp; " +
"\"return\" = (select x from #temp);"+
"end;";
TransformationMetadata tm = TestProcedureResolving.createMetadata(ddl);

String sql = "call vproc(1)"; //$NON-NLS-1$

ProcessorPlan plan = getProcedurePlan(sql, tm);

HardcodedDataManager dataManager = new HardcodedDataManager(tm);

helpTestProcess(plan, new List[] {Arrays.asList(5)}, dataManager, tm);
}

}

0 comments on commit eb97235

Please sign in to comment.