question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Method mismatch when expecting a true or false result

See original GitHub issue

Since Boolean.getBoolean(str) will always return false in this code block if(!Boolean.getBoolean(StackProperties.KEEP_CRANS_AFTER_A_RESPONSE)), I believe it is in error and that this is actually what was intended if(!StackProperties.getBoolean(StackProperties.KEEP_CRANS_AFTER_A_RESPONSE, false))

This is the only way to get true via Boolean.getBoolean("true").

https://github.com/jitsi/ice4j/blob/94b3cb2661836f39477c1d18e14347b2a0174f16/src/main/java/org/ice4j/stack/StunClientTransaction.java#L495

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
bgrozevcommented, Jul 13, 2017

You might want to take a closer look @bgrozev before discounting what I’m informing you about.

I am not discounting what you wrote and I did take a closer look. In fact, I went as far as running a test program just in case I missed something:

import java.util.*;
import java.net.*;


public class Test
{
  public static void main(String[] argv)
  throws Exception
  {

   System.err.println(Boolean.getBoolean("org.ice4j.PROP"));
  }
}

The result is this:

$ java  -Dorg.ice4j.PROP=true Test
true
$ java  -Dorg.ice4j.PROP=false Test
false

What am I failing to get across here?

You are failing to read the documentation that I first quoted and then linked to.

1reaction
bgrozevcommented, Jul 13, 2017

As documented, the argument passed to Boolean.getBoolean() names a system property which will be checked, which is exactly what we provide: https://docs.oracle.com/javase/7/docs/api/java/lang/Boolean.html#getBoolean(java.lang.String)

Read more comments on GitHub >

github_iconTop Results From Across the Web

I get a message about data type mismatch - Microsoft Support
I get a message about data type mismatch ... This error indicates that Access cannot match an input value to the data type...
Read more >
Type mismatch error in method with generic return (Why do I ...
Usually the compiler infer a method generic type ( P in your case) from the method signature ( loadContext in your case). But...
Read more >
Type checking errors - Free Pascal
C.4 Type checking errors. This section lists all errors that can occur when type checking is performed. Error: Type mismatch: This can happen...
Read more >
[js] Type mismatch when using Bool default values #4793
The types are not the same, and it throws a compile error. If this were the real code, it would throw an error...
Read more >
How to Fix the Input Mismatch Exception in Java? - Rollbar
Since InputMismatchException is an unchecked exception, it does not need to be declared in the throws clause of a method or constructor.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found