Author: dgeraskov
Date: 2012-04-19 10:16:32 -0400 (Thu, 19 Apr 2012)
New Revision: 40343
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaTypeDefImpl.java
Log:
https://issues.jboss.org/browse/JBIDE-11585
Fix NPE when name is null
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaTypeDefImpl.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaTypeDefImpl.java 2012-04-19
14:01:51 UTC (rev 40342)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaTypeDefImpl.java 2012-04-19
14:16:32 UTC (rev 40343)
@@ -283,6 +283,23 @@
this.getNameTextRange(astRoot))
);
+ } else {
+ for (ListIterator<JavaTypeDef> stream = this.getPersistenceUnit().typeDefs();
stream.hasNext(); ) {
+ JavaTypeDef typeDef = stream.next();
+ if (this != typeDef){
+ if (this.name.equals(typeDef.getName())) {
+ messages.add(
+ HibernateJpaValidationMessage.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ TYPE_DEF_DUPLICATE_NAME,
+ new String[]{this.name},
+ this,
+ this.getNameTextRange(astRoot))
+ );
+ break;
+ }
+ }
+ }
}
if (!StringTools.stringIsEmpty(this.typeClass)){
@@ -303,25 +320,6 @@
// just ignore it!
}
}
-
-
- for (ListIterator<JavaTypeDef> stream = this.getPersistenceUnit().typeDefs();
stream.hasNext(); ) {
- JavaTypeDef typeDef = stream.next();
- if (this != typeDef){
- if (this.name.equals(typeDef.getName())) {
- messages.add(
- HibernateJpaValidationMessage.buildMessage(
- IMessage.HIGH_SEVERITY,
- TYPE_DEF_DUPLICATE_NAME,
- new String[]{this.name},
- this,
- this.getNameTextRange(astRoot))
- );
- break;
- }
- }
- }
-
}
}