You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by bp...@apache.org on 2016/07/28 00:26:16 UTC

svn commit: r1754348 - in /db/derby/code/trunk/java: engine/org/apache/derby/loc/messages.xml testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java

Author: bpendleton
Date: Thu Jul 28 00:26:16 2016
New Revision: 1754348

URL: http://svn.apache.org/viewvc?rev=1754348&view=rev
Log:
DERBY-5585: Improve error message when user function can't find class.

This patch was contributed by Danoja Dias (danojadias at gmail dot com)

Additional text is added to the 42x50 and 42x51 error messages suggesting
an additional possible cause of the error might be derby.database.classpath.


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml?rev=1754348&r1=1754347&r2=1754348&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml Thu Jul 28 00:26:16 2016
@@ -1897,7 +1897,7 @@ Guide.
 
             <msg>
                 <name>42X50</name>
-                <text>No method was found that matched the method call {0}.{1}({2}), tried all combinations of object and primitive types and any possible type conversion for any  parameters the method call may have. The method might exist but it is not public and/or static, or the parameter types are not method invocation convertible.</text>
+                <text>No method was found that matched the method call {0}.{1}({2}), tried all combinations of object and primitive types and any possible type conversion for any  parameters the method call may have. The method might exist but it is not public and/or static, or the parameter types are not method invocation convertible or the derby.database.classpath property is missing or incorrectly defined.</text>
                 <arg>className</arg>
                 <arg>methodName</arg>
                 <arg>parameterTypes</arg>
@@ -1905,7 +1905,7 @@ Guide.
 
             <msg>
                 <name>42X51</name>
-                <text>The class '{0}' does not exist or is inaccessible. This can happen if the class is not public.</text>
+                <text>The class '{0}' does not exist or is inaccessible. This can happen if the class is not public or the derby.database.classpath property is missing or incorrectly defined.</text>
                 <arg>className</arg>
             </msg>
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java?rev=1754348&r1=1754347&r2=1754348&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java Thu Jul 28 00:26:16 2016
@@ -1014,6 +1014,8 @@ public class TableFunctionTest extends B
         bulkInsert();
         
         miscBugs();
+
+	classpathError();
     }
     
     /**
@@ -1144,6 +1146,46 @@ public class TableFunctionTest extends B
              "    from TABLE( invert( 1 ) ) s\n"
              );
     }
+
+	/**
+     * test for DERBY-5585
+     */
+    private void classpathError()
+        throws Exception
+    {
+        goodStatement
+            (
+             "create function foo( a int )\n" +
+             "returns int\n" +
+             "language java\n" +
+             "parameter style java\n" +
+             "no sql\n" +
+             "external name 'Bop.doowop'\n"
+              );
+
+        
+        expectError
+            (
+             "42X51",
+             "values ( foo( 1 ) )"
+             );
+
+	goodStatement
+            (
+             "create function bar( a int )\n" +
+             "returns int\n" +
+             "language java\n" +
+             "parameter style java\n" +
+             "no sql\n" +
+             "external name 'java.lang.Integer.doowop'\n"
+             );
+
+        expectError
+            (
+             "42X50",
+             "values ( bar( 1 ) )"
+             );
+     }
     
     /**
      * Verify that a simple VTI returns the correct results.