#vulnerable code 
                                @Test
    public void testSystemImageName() {
        assertEquals("sys-img-x86-android-23", AndroidPlatform.valueOf("Google Inc.:Google APIs:23").getSystemImageName("x86"));
        assertEquals("sys-img-x86-android-24", AndroidPlatform.valueOf("Google Inc.:Google APIs:24").getSystemImageName("x86"));
        assertEquals("sys-img-x86_64-android-24", AndroidPlatform.valueOf("Apple Inc.:Apple APIs:24").getSystemImageName("x86_64"));
        assertEquals("sys-img-x86_64-android-24", AndroidPlatform.valueOf("MS Company:MS APIs:24").getSystemImageName("x86_64"));
        assertEquals("sys-img-armabi-v7a-android-23", AndroidPlatform.valueOf("android-23").getSystemImageName("armabi-v7a"));
        assertEquals("sys-img-armabi-v7a-android-24", AndroidPlatform.valueOf("android-24").getSystemImageName("armabi-v7a"));
        assertEquals("sys-img-arm64-v8a-android-26", AndroidPlatform.valueOf("android-26").getSystemImageName("arm64-v8a"));

        assertEquals("sys-img-x86-test-23", AndroidPlatform.valueOf("Google Inc.:Google APIs:23").getSystemImageName("test/x86"));
        assertEquals("sys-img-x86-test-24", AndroidPlatform.valueOf("Google Inc.:Google APIs:24").getSystemImageName("test/x86"));
        assertEquals("sys-img-x86_64-test-24", AndroidPlatform.valueOf("Apple Inc.:Apple APIs:24").getSystemImageName("test/x86_64"));
        assertEquals("sys-img-x86_64-test-24", AndroidPlatform.valueOf("MS Company:MS APIs:24").getSystemImageName("test/x86_64"));
        assertEquals("sys-img-armabi-v7a-test-23", AndroidPlatform.valueOf("android-23").getSystemImageName("test/armabi-v7a"));
        assertEquals("sys-img-armabi-v7a-test-24", AndroidPlatform.valueOf("android-24").getSystemImageName("test/armabi-v7a"));
        assertEquals("sys-img-arm64-v8a-test-26", AndroidPlatform.valueOf("android-26").getSystemImageName("test/arm64-v8a"));

        assertEquals("sys-img-x86-android-24", AndroidPlatform.valueOf("Google Inc.:Google APIs:24").getSystemImageName("/x86"));
        assertEquals("sys-img-x86-android-24", AndroidPlatform.valueOf("Google Inc.:Google APIs:24").getSystemImageName("///////x86"));

        assertEquals("sys-img-x86_64-android-24", AndroidPlatform.valueOf("Google Inc.:Google APIs:24").getSystemImageName("x86_64/"));
        assertEquals("sys-img-x86_64-android-24", AndroidPlatform.valueOf("Google Inc.:Google APIs:24").getSystemImageName("x86_64////"));
    } 
                            #location 3 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                @Test
    public void testSystemImageName() {
        assertEquals("sys-img-x86-android-23", AndroidPlatform.valueOf("android-23").getSystemImageName("x86"));
        assertEquals("sys-img-x86-google_apis-23", AndroidPlatform.valueOf("Google Inc.:Google APIs:23").getSystemImageName("x86"));
        assertEquals("sys-img-x86-google_apis-24", AndroidPlatform.valueOf("Google Inc.:Google APIs:24").getSystemImageName("x86"));
        assertEquals("sys-img-x86_64-apple_apis-24", AndroidPlatform.valueOf("Apple Inc.:Apple APIs:24").getSystemImageName("x86_64"));
        assertEquals("sys-img-x86_64-ms_apis-24", AndroidPlatform.valueOf("MS Company:MS APIs:24").getSystemImageName("x86_64"));
        assertEquals("sys-img-armabi-v7a-android-23", AndroidPlatform.valueOf("android-23").getSystemImageName("armabi-v7a"));
        assertEquals("sys-img-armabi-v7a-android-24", AndroidPlatform.valueOf("android-24").getSystemImageName("armabi-v7a"));
        assertEquals("sys-img-arm64-v8a-android-26", AndroidPlatform.valueOf("android-26").getSystemImageName("arm64-v8a"));

        assertEquals("sys-img-x86-test-23", AndroidPlatform.valueOf("Google Inc.:Google APIs:23").getSystemImageName("test/x86"));
        assertEquals("sys-img-x86-test-24", AndroidPlatform.valueOf("Google Inc.:Google APIs:24").getSystemImageName("test/x86"));
        assertEquals("sys-img-x86_64-test-24", AndroidPlatform.valueOf("Apple Inc.:Apple APIs:24").getSystemImageName("test/x86_64"));
        assertEquals("sys-img-x86_64-test-24", AndroidPlatform.valueOf("MS Company:MS APIs:24").getSystemImageName("test/x86_64"));
        assertEquals("sys-img-armabi-v7a-test-23", AndroidPlatform.valueOf("android-23").getSystemImageName("test/armabi-v7a"));
        assertEquals("sys-img-armabi-v7a-test-24", AndroidPlatform.valueOf("android-24").getSystemImageName("test/armabi-v7a"));
        assertEquals("sys-img-arm64-v8a-test-26", AndroidPlatform.valueOf("android-26").getSystemImageName("test/arm64-v8a"));

        assertEquals("sys-img-x86-google_apis-24", AndroidPlatform.valueOf("Google Inc.:Google APIs:24").getSystemImageName("/x86"));
        assertEquals("sys-img-x86-google_apis-24", AndroidPlatform.valueOf("Google Inc.:Google APIs:24").getSystemImageName("///////x86"));

        assertEquals("sys-img-x86_64-google_apis-24", AndroidPlatform.valueOf("Google Inc.:Google APIs:24").getSystemImageName("x86_64/"));
        assertEquals("sys-img-x86_64-google_apis-24", AndroidPlatform.valueOf("Google Inc.:Google APIs:24").getSystemImageName("x86_64////"));
    }