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.

a potential NPE in DmgServer.java

See original GitHub issue

Describe the bug

  1. In DmgFileReader.java (GPL/DMG/src/dmg/java/mobiledevices/dmg/reader/DmgFileReader.java), line 256 function getInfo returns null when path is null.

  2. In DmgServer.java (GPL/DMG/src/dmg/java/mobiledevices/dmg/server/DmgServer.java) line 106 List<String> infoList = dmgFileReader.getInfo(path); will assign infoList null.

  3. The expression infoList.size() in line 107 will NPE.

To Reproduce See above

Expected behavior N/A

Screenshots N/A

Attachments N/A

Environment (please complete the following information): N/A

Additional context N/A

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
mumbelcommented, Apr 11, 2020

As you say, you’re running static analysis and hoping others will validate your ‘findings’. Where is the stack trace, whats the user interaction that causes this, what is the input to cause this, do you have binary to load or a script or maybe a java test class, anything?

1reaction
HermioneSWcommented, Apr 11, 2020

Whatever I have does not prevent you from answering the question so here I go again. If the person is so confident path can not be null why not simply do

public List<String> getInfo( String path ) {
    DmgInfoGenerator info = new DmgInfoGenerator( this, path, parser );			
    return info.getInformation( );
}

I’d be very happy to hear your lecture on why that is the case or anything else you have to say. By the way feel free to close the issue as I don’t give a damn how great this codebase is written.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do I still receive warning for possible NPE in IntelliJ when ...
To my big surprise, I'm still getting: Method invocation ' Service.getConnectionManager().onAssetInfoChanged() ' at line 308 may produce ' java.
Read more >
How to Fix and Avoid NullPointerException in Java - Rollbar
NullPointerException in Java occurs when a variable is accessed which is not pointing to any object and refers to nothing or null.
Read more >
NullPointerException in Java: Causes and Ways to Avoid It
NullPointerException (NPE) is the most common exception in Java. The cause of this exception is ... Potentially, both of them might be null....
Read more >
Java NullPointerException - Detect, Fix, and Best Practices
NullPointerException is a runtime exception, so we don't need to catch it in the program. NullPointerException is raised in an application when ...
Read more >
How to deal with NullPointerException in Java with Examples
NullPointerException has outlined scenario when it could occur: 1) When you call the instance method on a null object. you won't get a...
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