This is an automated email from the ASF dual-hosted git repository. niketanpansare pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/systemml.git
The following commit(s) were added to refs/heads/master by this push: new a060f83 [MINOR] Throw a controlled exception when the expected number of inputs of UDF does not match the actual number of inputs a060f83 is described below commit a060f83f01b268a9fd0582517993d8ebdbe2848a Author: Niketan Pansare <npan...@us.ibm.com> AuthorDate: Mon Mar 11 14:40:53 2019 -0700 [MINOR] Throw a controlled exception when the expected number of inputs of UDF does not match the actual number of inputs --- .../org/apache/sysml/hops/ipa/InterProceduralAnalysis.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/org/apache/sysml/hops/ipa/InterProceduralAnalysis.java b/src/main/java/org/apache/sysml/hops/ipa/InterProceduralAnalysis.java index 72aa9cb..213991e 100644 --- a/src/main/java/org/apache/sysml/hops/ipa/InterProceduralAnalysis.java +++ b/src/main/java/org/apache/sysml/hops/ipa/InterProceduralAnalysis.java @@ -529,6 +529,17 @@ public class InterProceduralAnalysis ArrayList<Hop> inputOps = fop.getInput(); String fkey = fop.getFunctionKey(); + // Throw a controlled exception when the expected number of inputs doesnot match the actual number of inputs + // instead of array out of bounds exception. + if(inputOps.size() != funArgNames.length) { + String argsList = funArgNames.length > 0 ? funArgNames[0] : ""; + for( int i=1; i<funArgNames.length; i++ ) { + argsList += ", " + funArgNames[i]; + } + throw new HopsException("The function definition has " + funArgNames.length + + " arguments (" + argsList + "), but the function invocation has " + inputOps.size() + " arguments."); + } + for( int i=0; i<funArgNames.length; i++ ) { //create mapping between input hops and vars