[Demonstration 1]

[Buggy Method]
@Override
protected Class<?>[] getRootConfigClasses() {
    return new Class[] { HibernateConfiguration.class, SecurityConfiguration.class, ApacheTilesViewConfiguration.class };
}

[Buggy Hunk]
return new Class[] { HibernateConfiguration.class, SecurityConfiguration.class, ApacheTilesViewConfiguration.class };

[Patch]
return new Class[] { HibernateConfiguration.class, SecurityConfiguration.class };

[Demonstration 2]

[Buggy Method]
private static PathnameDirectory getDirectory(final URI uri) {
    final String uriPath = uri.getPath();
    final String realURIPath = resolveUserHome(uriPath);
    String directoryPath = FilenameUtils.getFullPathNoEndSeparator(realURIPath);
    // This is used for building the path piece by piece so that we can detect symbolic links
    final StringBuilder currentPathBuilder = new StringBuilder();
    // Remove drive letter from the front if it exists
    if (DRIVE_LETTER_PATTERN.matcher(directoryPath).matches()) {
        directoryPath = StringUtils.substring(directoryPath, DRIVE_LETTER_LENGTH);
        final String pathPrefix = FilenameUtils.getPrefix(realURIPath);
        currentPathBuilder.append(pathPrefix);
    } else if ((realURIPath.length() == DRIVE_LETTER_LENGTH) && (realURIPath.charAt(1) == ':')) {
        directoryPath = "";
    }
    currentPathBuilder.append(File.separatorChar);
    final String[] tokens = PATHNAME_PATTERN.split(directoryPath);
    if (tokens.length == 0) {
        // No directories. Go ahead and return.
        return null;
    }
    final List<String> directoryStrings = new ArrayList<>(tokens.length);
    directoryStrings.addAll(Arrays.asList(tokens));
    // This means that the path started with a '/'; thus, the resulting empty string artifact would need to be removed
    if (tokens[0].isEmpty()) {
        directoryStrings.remove(0);
        if (directoryStrings.isEmpty()) {
            // Re-check for no directories. Go ahead and return.
            return null;
        }
    }
    final boolean isURIAbsolute = uri.isAbsolute();
    final File uriAsFile = new File(uri.toString());
    final boolean isFileAbsolute = uriAsFile.isAbsolute();
    final PathnameDirectoryType directoryType = (isURIAbsolute || isFileAbsolute) ? PathnameDirectoryType.ABSOLUTE : PathnameDirectoryType.RELATIVE;
    final List<PathnameDirectoryLevel> directoryLevels = new ArrayList<>(directoryStrings.size());
    for (final String directoryString : directoryStrings) {
        currentPathBuilder.append(File.separatorChar);
        currentPathBuilder.append(directoryString);
        PathnameDirectoryLevelType directoryLevelType = PathnameDirectoryLevelType.NULL;
        // Leave ".." in the directory list and convert any :BACK encountered
        // to a ".." in directory list to maintain functionality with other functions
        if (BACK_UP_STRING.equals(directoryString)) {
            final Path currentPath = Paths.get(currentPathBuilder.toString());
            // Back is for absolutes / up is for symbolic links
            if (Files.isSymbolicLink(currentPath)) {
                directoryLevelType = PathnameDirectoryLevelType.UP;
            } else {
                directoryLevelType = PathnameDirectoryLevelType.BACK;
            }
        } else if (WILDCARD_STRING.equals(directoryString)) {
            directoryLevelType = PathnameDirectoryLevelType.WILD;
        }
        final PathnameDirectoryLevel directoryLevel = new PathnameDirectoryLevel(directoryString, directoryLevelType);
        directoryLevels.add(directoryLevel);
    }
    final PathnameDirectoryComponent pathnameDirectoryComponent = new PathnameDirectoryComponent(directoryType, directoryLevels);
    return new PathnameDirectory(pathnameDirectoryComponent);
}

[Buggy Hunk]
final String uriPath = uri.getPath();

[Patch]
final String uriPath = StringUtils.defaultString(uri.getPath());

[Demonstration 3]

[Buggy Method]
@Override
public Uri insert(@NonNull Uri uri, ContentValues values) {
    SQLiteDatabase db = mDbHelper.getWritableDatabase();
    switch(sUriMatcher.match(uri)) {
        case CODE_COURSE:
            {
                long id = db.insert(KusssContentContract.Course.TABLE_NAME, null, values);
                if (id != -1)
                    getContext().getContentResolver().notifyChange(uri, null);
                return KusssContentContract.Course.CONTENT_URI.buildUpon().appendPath(String.valueOf(id)).build();
            }
        case CODE_EXAM:
            {
                long id = db.insert(KusssContentContract.Exam.TABLE_NAME, null, values);
                if (id != -1)
                    getContext().getContentResolver().notifyChange(uri, null);
                return KusssContentContract.Exam.CONTENT_URI.buildUpon().appendPath(String.valueOf(id)).build();
            }
        case CODE_GRADE:
            {
                long id = db.insert(KusssContentContract.Assessment.TABLE_NAME, null, values);
                if (id != -1)
                    getContext().getContentResolver().notifyChange(uri, null);
                return KusssContentContract.Assessment.CONTENT_URI.buildUpon().appendPath(String.valueOf(id)).build();
            }
        case CODE_CURRICULA:
            {
                long id = db.insert(KusssContentContract.Curricula.TABLE_NAME, null, values);
                if (id != -1)
                    getContext().getContentResolver().notifyChange(uri, null);
                return KusssContentContract.Curricula.CONTENT_URI.buildUpon().appendPath(String.valueOf(id)).build();
            }
        default:
            {
                throw new IllegalArgumentException("Unsupported URI: " + uri);
            }
    }
}

[Buggy Hunk]
SQLiteDatabase db = mDbHelper.getWritableDatabase();

[Patch]
SQLiteDatabase db = KusssDatabaseHelper.getInstance(getContext()).getWritableDatabase();