问题
Thanks in advance for your support.
In UDJC step, the following code gives me Janino exception,
In processRow method
Hashtable hastable=getConfigData() // This method return Hashtable
Set set=hashtable.get("ERROR_2001").keySet(); ---> //hashtable.get("ERROR_2001"), This returns another hashtable
Exception: A method named "keySet" is not declared in any enclosing class nor any supertype, nor through a static import
In forums I could not find the turn around solution to fix this. I am using JDK 1.7 and PDI 5.1 (latest download)
回答1:
AFAIK, you can't use generics in Janino, so Janino can not determine exact class of the object returned by hashtable.get("ERROR_2001")
method, so it assumes that Object
is returned, which has no keySet()
method defined.
Try to cast the result of hashtable.get("ERROR_2001")
to the value class, contained in your hashtable
collection:
Hashtable errorEntry = (Hashtable) hashtable.get("ERROR_2001");
Set set = errorEntry.keySet();
来源:https://stackoverflow.com/questions/34211217/janino-compile-exception-udjc-step