search problem

Hello,

when searching in one of my forms (just this one, it seems), I get an error:

Cannot format given Object as a Date

Strangely, whatever I search for - be it date or not - I get this error. I have a trace on that that shows that this query is sent:

select kontakte_emails.uid_email from kontakte_emails where kontakte_emails.empfaenger_to > ? order by kontakte_emails.uid_email

none of the fields envolved is a date field. The full error is this:

java.lang.IllegalArgumentException: Cannot format given Object as a Date
at java.text.DateFormat.format(Unknown Source)
at java.text.Format.format(Unknown Source)
at javax.swing.text.InternationalFormatter.valueToString(Unknown Source)
at com.servoy.j2db.dataui.DataField$d.valueToString(Unknown Source)
at javax.swing.JFormattedTextField$AbstractFormatter.install(Unknown Source)
at javax.swing.text.DefaultFormatter.install(Unknown Source)
at javax.swing.text.InternationalFormatter.install(Unknown Source)
at com.servoy.j2db.dataui.DataField$d.install(Unknown Source)
at javax.swing.JFormattedTextField.setFormatter(Unknown Source)
at com.servoy.j2db.dataui.DataField.setFormatter(Unknown Source)
at javax.swing.JFormattedTextField.setValue(Unknown Source)
at javax.swing.JFormattedTextField.setFormatterFactory(Unknown Source)
at com.servoy.j2db.dataui.DataField.setValidationEnabled(Unknown Source)
at com.servoy.j2db.dataprocessing.aw.setFindMode(Unknown Source)
at com.servoy.j2db.dataprocessing.d.if(Unknown Source)
at com.servoy.j2db.FormPanel.q(Unknown Source)
at com.servoy.j2db.FormPanel.performFind(Unknown Source)
at com.servoy.j2db.FormPanel$JSForm.js_search(Unknown Source)
at inv10.invoke()
at org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:537)
at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:453)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1242)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1940)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at com.servoy.j2db.develop.debugger.k.a(Unknown Source)
at com.servoy.j2db.develop.debugger.k.executeFunction(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.develop.debugger.k$h.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Servoy Developer
Version R2 2.2b1-build 316
Java version 1.5.0-b64 (Windows XP)
MS SQL 2000

Just got that error again. I searched for an ID (integer) > 0 and get this error. Is there any news on that?

Thanks
Patrick

query doesn’t have anything do do with it.

You do have somehow value that you have in a Date Textfield that is not a date object. Please check for date fields on that form.

hmm. I think I need some help with this. If I search manually there is no problem. If I use a method, it gets stuck. This is really strange; I have the impression, that the problem lies in a calculation of that table, but I see no problem there.

show the complete method.

I am stgill getting this. This is a little weird. The error generated is this:

sql select kontakte_emails.uid_email from kontakte_emails where (kontakte_emails.uid_benutzer = ? and kontakte_emails.uid_benutzer_emailordner = ? and kontakte_emails.geloescht < ? ) order by kontakte_emails.uid_emailquestiondata[0]= 4 ,type: java.lang.Integerquestiondata[1]= 6 ,type: java.lang.Integerquestiondata[2]= 1 ,type: java.lang.IntegerPingScanner woke up, queue [ 9fc15dfc-6b91-11d9-927e-ef239068a710(1106301059886) ]PingScanner sleeping for 300000 milliseconds, queue [ 9fc15dfc-6b91-11d9-927e-ef239068a710(1106301059886) ]spotlight: Closed connection, thread=AWT-EventQueue-0org.mozilla.javascript.JavaScriptException: java.lang.IllegalArgumentException: Cannot format given Object as a Dateorg.mozilla.javascript.JavaScriptException: java.lang.IllegalArgumentException: Cannot format given Object as a Date
at org.mozilla.javascript.JavaScriptException.wrapException(JavaScriptException.java:71)
at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:457)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1242)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1942)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1242)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1942)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at com.servoy.j2db.develop.debugger.k.a(Unknown Source)
at com.servoy.j2db.develop.debugger.k.executeFunction(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel$b.a(Unknown Source)
at com.servoy.j2db.dataui.DataComboBox.int(Unknown Source)
at com.servoy.j2db.dataui.DataComboBox.notifyLastNewValueWasChange(Unknown Source)
at com.servoy.j2db.dataprocessing.ar.commitEdit(Unknown Source)
at com.servoy.j2db.dataui.w.itemStateChanged(Unknown Source)
at com.servoy.j2db.dataui.DataComboBox.itemStateChanged(Unknown Source)
at javax.swing.JComboBox.fireItemStateChanged(Unknown Source)
at javax.swing.JComboBox.selectedItemChanged(Unknown Source)
at javax.swing.JComboBox.contentsChanged(Unknown Source)
at javax.swing.AbstractListModel.fireContentsChanged(Unknown Source)
at com.servoy.j2db.util.w.setSelectedItem(Unknown Source)
at javax.swing.JComboBox.setSelectedItem(Unknown Source)
at javax.swing.JComboBox.setSelectedIndex(Unknown Source)
at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at javax.swing.plaf.basic.BasicComboPopup$1.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

This error is only thrown if I do a query like the one in the trace. To me the query looks good. I checked all kinds of date objects on the forms based on this table and I don’t see a problem there…

what are you doing with the result of that query?
The query is fine. But somehow you are setting a value in a date field that can’t be formatted (so it is somehow not a date)

This is what generates the query and this is what gives me that error (I tthink the problem is somewhere else):

controller.find();
uid_benutzer = vUidBenutzer;
uid_benutzer_emailordner = vUidOrdner;
geloescht = '<1';
controller.search();

All columns and variables envolved are of type integer.

?

it is not the query
it is the result that that query has. Somehow it gives a value that should a date that is not a date. It looks like some column in the database is strange or something.

when ar you doing that query? in a method that is triggered with an onchange of a combo?
Because that is what i see a onchange does trigger the method that has the error.

yes, you are right. It is a “menu”, a global combobox that fires a search, basically. So if the menu is used, it will call a method that asks for the value of the global and executes the appropriate search.

I can also say that we get in trouble before the updateUI(), at least if I believe the debugger.