Author: vyemialyanchyk
Date: 2008-10-31 08:29:14 -0400 (Fri, 31 Oct 2008)
New Revision: 11396
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/HBMInfoExtractor.java
Log:
JBIDE-2960 - add check to prevent null pointer exception
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/HBMInfoExtractor.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/HBMInfoExtractor.java 2008-10-31
11:15:07 UTC (rev 11395)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/HBMInfoExtractor.java 2008-10-31
12:29:14 UTC (rev 11396)
@@ -584,21 +584,23 @@
if(parentTypeName!=null) {
String componentName = componentPropertyNodeName.getNodeValue();
IType parentType = project.findType(parentTypeName);
- IField field = parentType.getField(componentName);
- if(field.exists()) {
- String fieldTypeSignature = field.getTypeSignature();
- String qualifier = Signature.getSignatureQualifier(fieldTypeSignature);
- String simpleName = Signature.getSignatureSimpleName(fieldTypeSignature);
- if(!StringHelper.isEmpty(qualifier)) {
- simpleName = Signature.toQualifiedName(new String[] { qualifier, simpleName });
+ if(parentType!=null) { // check to avoid null pointer exception
+ IField field = parentType.getField(componentName);
+ if(field.exists()) {
+ String fieldTypeSignature = field.getTypeSignature();
+ String qualifier = Signature.getSignatureQualifier(fieldTypeSignature);
+ String simpleName = Signature.getSignatureSimpleName(fieldTypeSignature);
+ if(!StringHelper.isEmpty(qualifier)) {
+ simpleName = Signature.toQualifiedName(new String[] { qualifier, simpleName });
+ }
+
+ String[][] possibleTypes = null;
+ possibleTypes = parentType.resolveType(simpleName);
+ if(possibleTypes != null && possibleTypes.length>0) {
+ typename = Signature.toQualifiedName(possibleTypes[0]);
+ }
+
}
-
- String[][] possibleTypes = null;
- possibleTypes = parentType.resolveType(simpleName);
- if(possibleTypes != null && possibleTypes.length>0) {
- typename = Signature.toQualifiedName(possibleTypes[0]);
- }
-
}
}
}