[Demonstration 1]

[Buggy Method]
@Override
public int compare(Job o1, Job o2) {
    Date createdDate1 = o1.getCreatedDate();
    Date createdDate2 = o2.getCreatedDate();
    if (createdDate1 == null || createdDate2 == null) {
        return -1;
    }
    return createdDate1.compareTo(createdDate2);
}

[Buggy Hunk]
return createdDate1.compareTo(createdDate2);

[Patch]
return createdDate2.compareTo(createdDate1);

[Demonstration 2]

[Buggy Method]
private Map<String, String> parseJson(JSONObject jsonObject, String prefix, long prefix) {
    Map<String, String> entities = new HashMap();
    if (jsonObject == null)
        return entities;
    if (prefix == null)
        prefix = "";
    try {
        Iterator<String> iterator = jsonObject.keys();
        while (iterator.hasNext()) {
            String key = iterator.next();
            try {
                Object value = jsonObject.get(key);
                if (value == null)
                    continue;
                if (value instanceof JSONObject) {
                    entities.putAll(parseJson((JSONObject) value, prefix + String.format(KEY_FORMAT, key), depth + 1));
                } else if (value instanceof JSONArray) {
                    //no brackets if we have a root element
                    if (depth == 0) {
                        for (int i = 0; i < ((JSONArray) value).length(); i++) {
                            entities.putAll(parseJson(((JSONArray) value).getJSONObject(i), prefix + key + String.format(KEY_FORMAT, String.valueOf(i)), depth + 1));
                        }
                    } else {
                        for (int i = 0; i < ((JSONArray) value).length(); i++) {
                            entities.putAll(parseJson(((JSONArray) value).getJSONObject(i), prefix + String.format(KEY_FORMAT, key) + String.format(KEY_FORMAT, String.valueOf(i)), depth + 1));
                        }
                    }
                } else {
                    if (//Don't add bracket to the root elements!
                    !TextUtils.isEmpty(prefix))
                        key = prefix + String.format(KEY_FORMAT, key);
                    entities.put(key, String.valueOf(value));
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return entities;
}

[Buggy Hunk]
private Map<String, String> parseJson(JSONObject jsonObject, String prefix, long prefix)

[Patch]
private Map<String, String> parseJson(JSONObject jsonObject, String prefix, long depth)

[Demonstration 3]

[Buggy Method]
@GET
@Path("/{id}")
public FavoriteCity getFavoriteCity(@PathParam(value = "id") String id, @Context SecurityContext ctx) {
    FavoriteCity retVal = null;
    Map<String, String> props = new HashMap<>();
    props = this.getTenant(ctx);
    EntityManager em = this.getEntityManagerFactory().createEntityManager(props);
    try {
        Query query = em.createNamedQuery("FavoriteCityById");
        query.setParameter("id", id);
        retVal = (FavoriteCity) query.getSingleResult();
    } catch (Exception ex) {
        ex.printStackTrace();
    } finally {
        em.close();
    }
    return retVal;
}

[Buggy Hunk]
Map<String, String> props = new HashMap<>();

[Patch]
Map<String, String> props = new HashMap<String, String>();