Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 418388

Summary: [null] Invalid Null Pointer access warning
Product: [Eclipse Project] JDT Reporter: Steven Tamm <stamm>
Component: CoreAssignee: Stephan Herrmann <stephan.herrmann>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: srikanth_sankaran
Version: 4.3.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug

Description Steven Tamm CLA 2013-09-30 18:37:44 EDT
public static void nullPointerTest() {
        List<String> strings = Arrays.asList("Test1,Test2".split(","));
        String result = null;
        for (String string : strings) {
            if (string.startsWith("Test")) {
                result = string.substring("Test".length());
                if(result.charAt(0) == '"') {
                    result = result.substring(1);
                }
 // Next line: Null pointer access: The variable result can only be null at this location
                if(result.charAt(result.length() - 1) == '"') {
                    result = result.substring(0, result.length() - 1);
                }
                break;

            }
        }
    }

It's not a warning in 4.3
Comment 1 Steven Tamm CLA 2013-09-30 18:38:59 EDT
It's not a warning in 4.2 (sorry for the confusion)
Comment 2 Eclipse Genie CLA 2020-05-07 09:45:05 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.