From 5a23d0455d010e292433ab4b1a0ec4214dfb171c Mon Sep 17 00:00:00 2001 From: Patrick Linskey Date: Fri, 29 Jun 2007 10:53:05 +0000 Subject: [PATCH] Improved error messages git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@551845 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/openjpa/kernel/MethodStoreQuery.java | 4 ++++ .../resources/org/apache/openjpa/kernel/localizer.properties | 3 +++ 2 files changed, 7 insertions(+) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java index a69be2ece..141ac7850 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java @@ -248,6 +248,10 @@ public class MethodStoreQuery } if (!Modifier.isStatic(meth.getModifiers())) throw new UserException(_loc.get("method-not-static", meth)); + if (!ResultObjectProvider.class.isAssignableFrom( + meth.getReturnType())) + throw new UserException(_loc.get("method-return-type-invalid", + meth, meth.getReturnType())); _meth = meth; } diff --git a/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties b/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties index 89cf8454c..9de8e4926 100644 --- a/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties +++ b/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties @@ -300,6 +300,9 @@ bad-method-class: You set the method name of this openjpa.MethodQL query to \ qualify the class name or to import its package into this query if the \ class is not in the query candidate class'' package. method-not-static: Method "{0}" named in the MethodQL query must be static. +method-return-type-invalid: Method "{0}" named in the MethodQL query must \ + have a return type that is assignable from ResultObjectProvider. Return \ + type is: {1}. no-method: You must set the query filter to the name of the method to execute \ for this MethodQL query instance. method-error: There was an error invoking method "{0}" with arguments "{1}".