openGeeksLab / codenameone

Automatically exported from code.google.com/p/codenameone
0 stars 0 forks source link

iOS app crashes when accessing a NULL field in the SQLITE database #1333

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
IMPORTANT: This is not a place to ask questions! Please ask questions here:
http://www.codenameone.com/discussion-forum.html
If you are unsure about an issue go to the discussion forum first. Remove
these lines to indicate that you read and understood them.

Please clearly state whether the issue relates to a device/the simulator or
the tools.
If related to a device be sure to specify exactly which device with as much
details as possible.

What steps will reproduce the problem?
1. Run the attached test project
2.
3.

What is the expected output? What do you see instead?
com.codename1.db.Row.getString() will crash the iOS app if the cell value is 
NULL

What version of the product are you using? On what operating system?
latest codenameone and windows 7

Please provide any additional information below.

Original issue reported on code.google.com by eStart...@gmail.com on 5 Feb 2015 at 4:19

Attachments:

GoogleCodeExporter commented 8 years ago
The test case doesn't work:
java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (no such 
table: Employee)
    at org.sqlite.DB.newSQLException(DB.java:886)   at org.sqlite.DB.newSQLException(DB.java:886)
    at org.sqlite.DB.newSQLException(DB.java:897)
    at org.sqlite.DB.throwex(DB.java:864)
[EDT] 0:0:0,0 - Exception: [SQLITE_ERROR] SQL error or missing database (no 
such table: Employee)
    at org.sqlite.NativeDB.prepare(Native Method)
    at org.sqlite.DB.prepare(DB.java:207)
    at org.sqlite.PrepStmt.<init>(PrepStmt.java:50)
    at org.sqlite.SQLiteConnection.prepareStatement(SQLiteConnection.java:616)
    at org.sqlite.SQLiteConnection.prepareStatement(SQLiteConnection.java:606)
    at org.sqlite.SQLiteConnection.prepareStatement(SQLiteConnection.java:578)
    at com.codename1.impl.javase.SEDatabase.executeQuery(SEDatabase.java:161)
    at userclasses.StateMachine.beforeMain(StateMachine.java:49)
    at generated.StateMachineBase.beforeShow(StateMachineBase.java:154)
    at com.codename1.ui.util.UIBuilder.showForm(UIBuilder.java:2507)
    at com.codename1.ui.util.UIBuilder.showForm(UIBuilder.java:2554)
    at generated.StateMachineBase.startApp(StateMachineBase.java:56)
    at generated.StateMachineBase.<init>(StateMachineBase.java:31)
    at generated.StateMachineBase.<init>(StateMachineBase.java:98)
    at userclasses.StateMachine.<init>(StateMachine.java:22)
    at com.transmobiles.testbuild.TestBuild.start(TestBuild.java:32)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.codename1.impl.javase.Executor$1.run(Executor.java:95)
    at com.codename1.ui.Display.processSerialCalls(Display.java:1110)
    at com.codename1.ui.Display.mainEDTLoop(Display.java:932)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
    at org.sqlite.DB.newSQLException(DB.java:886)

BTW we normally prefer non-gui builder test cases that only include the 
application source file as a single file. Its easier to debug that way.

Original comment by shai.almog on 5 Feb 2015 at 7:27

GoogleCodeExporter commented 8 years ago
Nevermind, looking at the code I see a problem and its fixed in SVN.

Original comment by shai.almog on 5 Feb 2015 at 7:33