B4J Question java.lang.NumberFormatException: empty String

noxius3

Member
Hello. Sorry for the English, I'm writing through a translator. I can't handle the error. The error occurs when using the IF <>= command. It doesn't matter if it's a string or numbers.

B4J:
                Dim kef1 As Double=kefname1
                Dim kef2 As Double=kefname2
                If (kefname1*1000)>(kefname2*1000)   Then
                    Log(kefname1*1000)
                    Dim nnnkef As Int=kef2*1000
                    Log(nnnkef)
                    If nnnkef<12 Then
                    Dim     text1 As String = "ИТМ1 9,5  Текущий коэфициент:"&minkef1
                    Dim message As String=    $"

Errors:
An error occurred:
(Line: 148) 148 7 in code
java.lang.NumberFormatException: пустая строка

Log line 6 - 1680
 

MicroDrie

Well-Known Member
Licensed User
Longtime User
IF <>= command
"<>" is not equal to and "=" is equal to. The combination "<>=" is a very unusual contradiction.
Furthermore, the last line of code is incomplete. Or you can use a normal string with "<text>" or a literal string combination of $"<text>"$ in which you can also include a variable with ${Variable}.
Put a break point near which you think your code is wrong and go single step to the line where the error occurs. If you then include the code in the forum, you can indicate where the error occurs by means of a comment. Now it is not clear where the error occurs.
 
Upvote 0

noxius3

Member
"<>" is not equal to and "=" is equal to. The combination "<>=" is a very unusual contradiction.
Furthermore, the last line of code is incomplete. Or you can use a normal string with "<text>" or a literal string combination of $"<text>"$ in which you can also include a variable with ${Variable}.
Put a break point near which you think your code is wrong and go single step to the line where the error occurs. If you then include the code in the forum, you can indicate where the error occurs by means of a comment. Now it is not clear where the error occurs.
I put it wrong. The error occurs with any shutter. '< ' or '> ' or '='.
I set a breakpoint. The error occurs when the 'IF' command is executed.
 
Upvote 0

noxius3

Member
b4j:
If colroot.Get("NP")="1-я Партия" Then
                Dim name1 As String=A
                Dim name2 As String=H
                Dim urligr As String = U
                Dim kef1 As Double=kefname1
                Dim kef2 As Double=kefname2
                Log($"kef1-${kef1} : kef2-${kef2}"$$)
                Log($"kefname1-${kefname1} : kefname2-${kefname2}"$$)
                If kefname1>kefname2 And kefname2>1.41  Then
                    Log(kefname2)
                    Dim     text1 As String = "ИТМ1 9,5  Текущий коэфициент:"&minkef1
                    Dim message As String=    $"${NmLiga}
    Время начала: ${tmigra} МСК
    ${name1} - ${name2}
    П1:${kef1}   П2:${kef2}
    ${text1}
    1xStavka - ${urligr}"$
                End If

kef1-2.94 : kef2-1.37
kefname1-2.94 : kefname2-1.37
An error occurred:
(Line: 139) 139
java.lang.NumberFormatException: empty String
 
Upvote 0

noxius3

Member

When starting in Release, an error appears -
main._appstart (java line: 77)
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NumberFormatException: empty String
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:518)
at anywheresoftware.b4a.keywords.Common.access$0(Common.java:489)
at anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Common.java:563)
at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:47)
at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:43)
at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:175)
at b4j.example.main._appstart(main.java:77)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:109)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:96)
at b4j.example.main.main(main.java:28)
Caused by: java.lang.RuntimeException: java.lang.NumberFormatException: empty String
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:138)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:509)
... 13 more
Caused by: java.lang.NumberFormatException: empty String
at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1842)
at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.base/java.lang.Double.parseDouble(Double.java:543)
at b4j.example.main$ResumableSub_getmatchs.resume(main.java:504)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:154)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:103)
... 14 more
 
Upvote 0

noxius3

Member
Thank you all for your help. Solved the problem. The error turned out to be in another place. I don't understand why debugging pointed to this line.
 
Upvote 0
Top