Author: michiel
Date: 2010-06-01 11:23:40 +0200 (Tue, 01 Jun 2010)
New Revision: 42356
Modified:
mmbase/trunk/core/src/main/java/org/mmbase/core/CoreField.java
Log:
datatype setting can be postponed, so this hack should be repeated then too
Modified: mmbase/trunk/core/src/main/java/org/mmbase/core/CoreField.java
===================================================================
--- mmbase/trunk/core/src/main/java/org/mmbase/core/CoreField.java
2010-06-01 09:21:51 UTC (rev 42355)
+++ mmbase/trunk/core/src/main/java/org/mmbase/core/CoreField.java
2010-06-01 09:23:40 UTC (rev 42356)
@@ -378,8 +378,23 @@
public void setDataType(DataType dataType) throws IllegalArgumentException
{
super.setDataType(dataType);
- // datatype can be influenced by size
- setMaxLength(maxLength);
+ if (maxLength == -1) { // unset
+ // obtain maxlength from datatype where applicable
+ if (dataType instanceof LengthDataType) {
+ // maxlength is an int, but LengthDataType stores longs.
+ // this is part of the bridge, so the conflict may be hard to
solve
+ // without breaking backward compatibility in the bridge
+ long length = ((LengthDataType)dataType).getMaxLength();
+ if (length > Integer.MAX_VALUE) {
+ maxLength = Integer.MAX_VALUE;
+ } else {
+ maxLength = (int)length;
+ }
+ }
+ } else {
+ // datatype can be influenced by size
+ setMaxLength(maxLength);
+ }
hashcodeChanged = true;
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs