eclipse-jdt / eclipse.jdt.core

Eclipse Public License 2.0
156 stars 123 forks source link

Fix NullPointerException in JavaModel#isJmod because Path#fromOSSString can return null #2724

Closed alexsuter closed 1 month ago

alexsuter commented 1 month ago

What it does

How to test

Author checklist

alexsuter commented 1 month ago

Hi @iloveeclipse

I'm sorry. You are right. Path.fromOOString() does not return null. I think, my friend made this patch for 2022-03 and has implemented it defensively to check the path for null.

The issue was in Eclipse 2022-03 that path.getFileExtension() has returned null and the implementation was as follow:

public static boolean isJmod(File file) {
    IPath path = Path.fromOSString(file.getPath());
    if (path.getFileExtension().equalsIgnoreCase(SuffixConstants.EXTENSION_jmod)) {
        return true;
    }
    return false;
}

So this issue has already been fixed for me with the newest Eclipse platform. Therefore I close this PR.

Sorry for the noice.

iloveeclipse commented 1 month ago

No problem. Hope next time you would push a PR for a real bug :-)

alexsuter commented 1 month ago

sure ;)