This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch STABLE-4.2
in repository https://gitbox.apache.org/repos/asf/cayenne.git


The following commit(s) were added to refs/heads/STABLE-4.2 by this push:
     new f0d7fe783 CAY-2790 EOModel import: NPE importing EOFetchSpecification
     new aa9b58fe6 Merge pull request #561 from 
Ivan-nikitko/CAY-2790_EOModel_import_NPE_importing_EOFetchSpecification
f0d7fe783 is described below

commit f0d7fe78361c1a2392bbb4cd028561bb66cdfd1c
Author: Ivan Nikitka <70625960+ivan-niki...@users.noreply.github.com>
AuthorDate: Wed Feb 1 15:19:11 2023 +0100

    CAY-2790 EOModel import: NPE importing EOFetchSpecification
---
 .../src/main/java/org/apache/cayenne/wocompat/EOQuery.java          | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/modeler/cayenne-wocompat/src/main/java/org/apache/cayenne/wocompat/EOQuery.java
 
b/modeler/cayenne-wocompat/src/main/java/org/apache/cayenne/wocompat/EOQuery.java
index e06efa6a7..44fdabda3 100644
--- 
a/modeler/cayenne-wocompat/src/main/java/org/apache/cayenne/wocompat/EOQuery.java
+++ 
b/modeler/cayenne-wocompat/src/main/java/org/apache/cayenne/wocompat/EOQuery.java
@@ -30,6 +30,8 @@ import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.ObjRelationship;
 import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.query.SortOrder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -252,6 +254,7 @@ public class EOQuery<T> extends SelectQuery<T> {
                private static final String OBJ_C = ":"; // Objective-C syntax 
addition.
 
                private static Map<String, Integer> selectorToExpressionBridge;
+               private static final Logger logger = 
LoggerFactory.getLogger(EOFetchSpecificationParser.class);
 
                /**
                 * selectorToExpressionBridge is just a mapping of EOModeler's 
selector
@@ -483,7 +486,7 @@ public class EOQuery<T> extends SelectQuery<T> {
                                try {
                                        keyExp = 
entity.translateToDbPath(keyExp);
                                } catch (Exception dbpathEx) {
-                                       return null;
+                                       logger.warn("Couldn't find " + keyExp + 
" in " + entity.getName() + " in EOModel");
                                }
                        }
 
@@ -494,6 +497,7 @@ public class EOQuery<T> extends SelectQuery<T> {
                                exp.setOperand(1, comparisonValue);
                                return exp;
                        } catch (ExpressionException e) {
+                               logger.warn(e.getUnlabeledMessage());
                                return null;
                        }
                }

Reply via email to