B4J Question Strange error

fishwolf

Well-Known Member
Licensed User
Longtime User
I have this error in many case during the debug

java.lang.NumberFormatException: For input string: "23:59"

i set TimeNext = "23:59" of if TimeNext == "23:59"

if i clean the project, the error go away
 

fishwolf

Well-Known Member
Licensed User
Longtime User
Are you sure you have not declared TimeNext as "numeric" (Int, Long, ...)?

as string, if i remove the ":" work fine

Strangely, "==" works; where can I find a list of operators (and key words)? [Should I open a new thread for this question?]

i have the similar problem with < or >, if i remove ":" work fine

i think that a string in this format it's confuse with date/time format
 
Upvote 0

fishwolf

Well-Known Member
Licensed User
Longtime User
Can you post the full error message from the logs?

Can you upload the project?

B4X:
Dim Item as Map
Dim TimeMeteo As String
Dim NameMeteo As String

   TimeMeteo = Item.Get("time")
   Log("TimeMeteo=" & TimeMeteo)
   If TimeMeteo >= "19:00" Or TimeMeteo <= "05:00" Then
     NameMeteo = "night_"
   Else
     NameMeteo = "day_"
   End If

error
B4X:
TimeMeteo=01:00
An error occurred:
(Line: 524) 524
java.lang.NumberFormatException: For input string: "19:00"

i haven't other similar errors, now i must clean the project for each run.

B4X:
IndTimes=0
time=01:00
TimeNext=
Error occurred on line: 44 (CustomListView)
*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[2]
Stack Trace: (
  CoreFoundation  __exceptionPreprocess + 182
  libobjc.A.dylib  objc_exception_throw + 44
  CoreFoundation  -[__NSPlaceholderArray initWithObjects:count:] + 405
  CoreFoundation  +[NSArray arrayWithObjects:count:] + 68
  MeteoSpot  -[b4i_forecasts _itemtimes::::::] + 769
  MeteoSpot  -[b4i_forecasts _showforecasts:] + 18683
  MeteoSpot  -[b4i_forecasts _jobdone:] + 4863
  CoreFoundation  __invoking___ + 29
  CoreFoundation  -[NSInvocation invoke] + 360
  MeteoSpot  +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 2069
 MeteoSpot  -[B4ICommon CallSubDebug4::::] + 894
 MeteoSpot  -[B4ICommon CallSubDebug2::::] + 350
 MeteoSpot  -[b4i_httpjob _complete::] + 887
 MeteoSpot  -[b4i_httputils2service _completejob::::] + 1723
 MeteoSpot  -[b4i_httputils2service _hc_responsesuccess::] + 771
 CoreFoundation  __invoking___ + 29
 CoreFoundation  -[NSInvocation invoke] + 360
 MeteoSpot  +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 2069
 MeteoSpot  -[B4IShell runMethod:] + 515
 MeteoSpot  -[B4IShell raiseEventImpl:method:args::] + 2519
 MeteoSpot  -[B4IShellBI raiseEvent:event:params:] + 1623
 MeteoSpot  __61-[B4IHttp URLSession:downloadTask:didFinishDownloadingToURL:]_block_invoke + 273
 libdispatch.dylib  _dispatch_client_callout + 14
 libdispatch.dylib  _dispatch_barrier_sync_f_slow_invoke + 54
 libdispatch.dylib  _dispatch_client_callout + 14
 libdispatch.dylib  _dispatch_main_queue_callback_4CF + 677
 CoreFoundation  __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
 CoreFoundation  __CFRunLoopRun + 2256
 CoreFoundation  CFRunLoopRunSpecific + 443
 CoreFoundation  CFRunLoopRunInMode + 123
 GraphicsServices  GSEventRunModal + 192
 GraphicsServices  GSEventRun + 104
 UIKit  UIApplicationMain + 1526
 MyApp main + 138
 libdyld.dylib  start + 1
)
 
Upvote 0
Top