Author: thomasobrien95
Date: Thu Dec 4 08:38:45 2008
New Revision: 2863
Modified:
trunk/src/ca/sqlpower/architect/swingui/SwingUIProject.java
Log:
Added a NPE check against missing table reference ids. This will help us
identify any problem similar to the forum post 2136. This will also stop
files from being corrupted with null reference ids.
Modified: trunk/src/ca/sqlpower/architect/swingui/SwingUIProject.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/SwingUIProject.java (original)
+++ trunk/src/ca/sqlpower/architect/swingui/SwingUIProject.java Thu Dec 4
08:38:45 2008
@@ -979,6 +979,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();