Author: dgeraskov
Date: 2012-04-30 10:11:13 -0400 (Mon, 30 Apr 2012)
New Revision: 40640
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java
Log:
https://issues.jboss.org/browse/JBIDE-11368
Fix NPEs. Previous commit went to JBIDE-11364 by mistake
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java 2012-04-30
14:07:04 UTC (rev 40639)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java 2012-04-30
14:11:13 UTC (rev 40640)
@@ -32,7 +32,7 @@
* @throws JavaModelException
*/
public static Boolean isTypeImplementsInterface(IJavaProject javaProject, IType type,
String interfaceName) throws JavaModelException{
- if (type == null) return false;
+ if (type == null) return null;
boolean hasInconsistency = false;
String[] interfaces = type.getSuperInterfaceNames();
List<String> resolvedInterfaceNames = new LinkedList<String>();
@@ -58,10 +58,11 @@
if (interfaceName.equals(fullName))
return true;
IType parentType = javaProject.findType(fullName);
- if (parentType != null){
- if (isTypeImplementsInterface(javaProject, parentType, interfaceName)){
- return true;
- }
+ Boolean recursiveResult = isTypeImplementsInterface(javaProject, parentType,
interfaceName);
+ if (recursiveResult == null){
+ hasInconsistency = true;
+ } else if (recursiveResult == true){
+ return true;
}
} else {
hasInconsistency = true;
@@ -69,7 +70,10 @@
}
for (String interface_ : resolvedInterfaceNames) {
IType parentInterface = javaProject.findType(interface_);
- if (isTypeImplementsInterface(javaProject, parentInterface, interfaceName)){
+ Boolean recursiveResult = isTypeImplementsInterface(javaProject, parentInterface,
interfaceName);
+ if (recursiveResult == null){
+ hasInconsistency = true;
+ } else if (recursiveResult == true){
return true;
}
}