* Parse numeric value unless we have previously
* seen text data for this attribute type
*/
- if (type == null || type == Datatype.Number)
+ if (type == null && couldBeNumber(value) || type == Datatype.Number)
{
try
{
}
/**
+ * This quick check will save significant time avoiding numerous NumberFormatExceptions.
+ *
+ * @param f
+ * @return
+ */
+ public boolean couldBeNumber(String f)
+ {
+ int len = f.length();
+ if (len == 0)
+ return false;
+ char ch = f.charAt(0);
+ switch (ch) {
+ case '.':
+ case '+':
+ case '-':
+ return len > 1;
+ }
+ return (ch <= '9' && ch >= '0');
+ }
+
+ /**
* Answers true if at least one attribute is known for the given feature type,
* else false
*