[
https://jira.jboss.org/jira/browse/JBIDE-4538?page=com.atlassian.jira.plu...
]
Denis Golovin commented on JBIDE-4538:
--------------------------------------
why it cannot be fixed by adding null check?
protected void setAttribute(String attributeName, String value, String defaultValue) {
org.w3c.dom.Node attribNode = getNode().getAttributes().getNamedItem(attributeName);
if(attribNode!=null && safeEquals(value, defaultValue)) {
((Element)getNode()).removeAttribute(attributeName);
} else if (attribNode!=null && value!=null ) {
attribNode.setNodeValue(value);
} else if (attribNode == null && value!=null && !safeEquals(value,
defaultValue)) {
attribNode = getNode().getOwnerDocument().createAttribute(attributeName);
getNode().getAttributes().setNamedItem(attribNode);
attribNode.setNodeValue(value);
}
}
}
Hibernate Tools NPE when adding a table in reverse engineering file
(tab Table & Columns)
-----------------------------------------------------------------------------------------
Key: JBIDE-4538
URL:
https://jira.jboss.org/jira/browse/JBIDE-4538
Project: Tools (JBoss Tools)
Issue Type: Bug
Components: Hibernate, UpStream
Affects Versions: 3.1.0.M2
Environment: Eclipse Galileo 3.5, WinXP, Java 1.5.0_05, Hibernate Tools
3.2.4.GA-R200905070146-H18, Hibernate Tools 3.3.0.M1-N200906060434-H241, jtds-1.2.2.jar,
MSSQL 9.0
Reporter: Philipp Rosenhagen
Assignee: Vitali Yemialyanchyk
Attachments: hibernate.tools.error.log, screenshot-1.jpg
Using the new Eclipse 3.5 and either the latest stable release or milestone of Hibernate
Tools plugin I get a NullPointerException when adding a new table to reverse engineer.
Steps to reproduce:
- Open hibernate.reveng.xml
- In tab "Table Filters" add a global exclude for every table and one include
for the table to reverse engineer (so only the desired table is querried in the next
tab).
- In tab "Table & Columns" add the disired table (making sure to also
include the children / fields of the table by expanding the table and then check it - or
use the "select all children" button)
Now I would expect the table including its fields in the list so I can go on and alter
the column details. But unfortunately only the table is added - without children. And in
the error log the mentioned NPE is shown (I'll add the full stacktrace as a file
later).
Unhandled event loop exception
java.lang.NullPointerException
at
org.eclipse.wst.xml.core.internal.document.AttrImpl.setValueSource(AttrImpl.java:761)
It doesn't matter which table I choose. Even tables which were previously added
successfully (using Eclipse 3.4 and Hibernate Tools 3.2.4.GA-R200903141626-H5) are not
working anymore.
The hibernate.cfg.xml which I use:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property
name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property
name="hibernate.connection.password">[removed]</property>
<property
name="hibernate.connection.url">jdbc:jtds:sqlserver://[removed]/[removed]</property>
<property
name="hibernate.connection.username">[removed]</property>
<property
name="hibernate.default_catalog">[removed]</property>
<property name="hibernate.default_schema">dbo</property>
<property
name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<property
name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property
name="hibernate.cache.use_second_level_cache">false</property>
<property
name="hibernate.cache.use_query_cache">false</property>
<property
name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.use_outer_join">true</property>
</session-factory>
</hibernate-configuration>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira