You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by hz...@apache.org on 2017/10/04 01:24:30 UTC

[4/7] incubator-trafodion git commit: [TRAFODION-2752] Fix error message when UDR method not found

[TRAFODION-2752] Fix error message when UDR method not found

The error message displayed only the signature, but not the
method name.


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/4b1c64c8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/4b1c64c8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/4b1c64c8

Branch: refs/heads/master
Commit: 4b1c64c892e68cfbecd1f87bc7ddc5327c52723c
Parents: 839f222
Author: Hans Zeller <hz...@apache.org>
Authored: Tue Oct 3 17:03:40 2017 +0000
Committer: Hans Zeller <hz...@apache.org>
Committed: Tue Oct 3 17:03:40 2017 +0000

----------------------------------------------------------------------
 core/sql/regress/udr/EXPECTED100.SB       | 21 +++++++++++++++++++++
 core/sql/regress/udr/TEST100              |  9 +++++++++
 core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp | 10 ++++------
 3 files changed, 34 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4b1c64c8/core/sql/regress/udr/EXPECTED100.SB
----------------------------------------------------------------------
diff --git a/core/sql/regress/udr/EXPECTED100.SB b/core/sql/regress/udr/EXPECTED100.SB
index e7fc86a..f2c0ea8 100644
--- a/core/sql/regress/udr/EXPECTED100.SB
+++ b/core/sql/regress/udr/EXPECTED100.SB
@@ -283,6 +283,27 @@
 
 --- SQL operation failed with errors.
 >>
+>>-- negative test case, method does not exist
+>>create procedure t100_nosuchmethod(in int, in int, out int)
++>external name 't100.nosuchname' language java parameter style java no sql
++>library T100;
+
+*** ERROR[11234] The Java method 'nosuchname(II[I)V' was not found in Java class 't100'.
+
+*** ERROR[1231] User-defined routine TRAFODION.SCH.T100_NOSUCHMETHOD could not be created.
+
+--- SQL operation failed with errors.
+>>
+>>-- negative test case, signature does not exist
+>>create procedure t100_nosuchsig(in date)
++>external name 't100.divide' language java parameter style java no sql
++>library T100;
+
+*** ERROR[11234] The Java method 'divide(Ljava/sql/Date;)V' was not found in Java class 't100'.
+
+*** ERROR[1231] User-defined routine TRAFODION.SCH.T100_NOSUCHSIG could not be created.
+
+--- SQL operation failed with errors.
 >>
 >>-- Create a table for SUBQUERY operations
 >>create table  t100sq (A int);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4b1c64c8/core/sql/regress/udr/TEST100
----------------------------------------------------------------------
diff --git a/core/sql/regress/udr/TEST100 b/core/sql/regress/udr/TEST100
index a9d84fd..9f736f9 100755
--- a/core/sql/regress/udr/TEST100
+++ b/core/sql/regress/udr/TEST100
@@ -331,6 +331,15 @@ create procedure t100_invalidstyle(in int, in int, out int)
 external name 't100.divide' language java parameter style sql no sql
 library T100;
 
+-- negative test case, method does not exist
+create procedure t100_nosuchmethod(in int, in int, out int)
+external name 't100.nosuchname' language java parameter style java no sql
+library T100;
+
+-- negative test case, signature does not exist
+create procedure t100_nosuchsig(in date)
+external name 't100.divide' language java parameter style java no sql
+library T100;
 
 -- Create a table for SUBQUERY operations
 create table  t100sq (A int);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4b1c64c8/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp b/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp
index 9a75d75..f37a836 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp
@@ -1527,8 +1527,6 @@ short CmpSeabaseDDL::validateRoutine(ExeCliInterface *cliInterface,
   cliInterface->getPtrAndLen(2, ptr, len);
   errCode = *(Int32 *)ptr;
 
-  // in code below methodName may need to be added to the signature that is printed 
-  // out in some error messages.
   // Check for errors returned from VALIDATEROUTINE
   switch (errCode)
   {
@@ -1560,25 +1558,25 @@ short CmpSeabaseDDL::validateRoutine(ExeCliInterface *cliInterface,
     case 11231://Method found but not public
       if(signature[0] NEQ '\0')
         *CmpCommon::diags() << DgSqlCode(-errCode)
-                            << DgString0(signature)
+                            << DgString0(NAString(methodName) + signature)
                             << DgString1(className);
       break;
     case 11232://Method found but not static
       if(signature[0] NEQ '\0')
         *CmpCommon::diags() << DgSqlCode(-errCode)
-                            << DgString0(signature)
+                            << DgString0(NAString(methodName) + signature)
                             << DgString1(className);
       break;
     case 11233://Method found but not void
         if(signature[0] NEQ '\0')
           *CmpCommon::diags() << DgSqlCode(-errCode)
-                              << DgString0(signature)
+                              << DgString0(NAString(methodName) + signature)
                               << DgString1(className);
         break;
     case 11234://Method not found
         if(signature[0] NEQ '\0')
           *CmpCommon::diags() << DgSqlCode(-errCode)
-                              << DgString0(signature)
+                              << DgString0(NAString(methodName) + signature)
                               << DgString1(className);
         break;
     default://Unknown error code