Author: [email protected]
Date: Fri Dec 12 08:08:09 2008
New Revision: 2872
Modified:
branches/release-0.9.12/src/ca/sqlpower/architect/swingui/SwingUIProject.java
Log:
Backport of r2863 from the trunk. This will throw an exception if the
project tries to save a TablePane that is missing it's SQLTable reference.
This results in an broken project file. This will help us find the cause of
it if it happens again.
Modified:
branches/release-0.9.12/src/ca/sqlpower/architect/swingui/SwingUIProject.java
==============================================================================
---
branches/release-0.9.12/src/ca/sqlpower/architect/swingui/SwingUIProject.java
(original)
+++
branches/release-0.9.12/src/ca/sqlpower/architect/swingui/SwingUIProject.java
Fri Dec 12 08:08:09 2008
@@ -937,6 +937,12 @@
TablePane tp = (TablePane) ppc;
Point p = tp.getLocation();
+ if (sqlObjectSaveIdMap.get(tp.getModel()) == null) {
+ logger.error("Play pen tried to save a table pane at "
+ tp.getX() + ", " + tp.getY() + " with the model " + tp.getModel() + " and
reference id " + sqlObjectSaveIdMap.get(tp.getModel()) + "." +
+ "\nSaving a table pane with a null reference will
cause an NPE on loading.");
+ throw new NullPointerException("Play pen table is
saving a null reference.");
+ }
+
Color bgColor = tp.getBackgroundColor();
String bgColorString = String.format("0x%02x%02x%02x",
bgColor.getRed(), bgColor.getGreen(), bgColor.getBlue()); //$NON-NLS-1$
Color fgColor = tp.getForegroundColor();