[Demonstration 1]

[Buggy Method]
@Override
public String getUrlName() {
    if (getReportUrl().contains(Jenkins.getInstance().getRootUrl())) {
        return AllureReportPlugin.URL_PATH;
    } else {
        return getReportUrl();
    }
}

[Buggy Hunk]
if (getReportUrl().contains(Jenkins.getInstance().getRootUrl())) {

[Patch]
if (getReportUrl() == null || getReportUrl().contains(getRootUrl())) {

[Demonstration 2]

[Buggy Method]
public String getLocation() {
    if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION }, MY_PERMISSION_GET_LOCATION_PERMISSIONS);
    }
    String city = "";
    String state = "";
    String zip = "";
    Geocoder geocoder = new Geocoder(this);
    List<Address> locations;
    Location lastLocation;
    if (locationManager != null) {
        lastLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
    } else {
        return "";
    }
    try {
        if (lastLocation == null) {
            return "";
        }
        locations = geocoder.getFromLocation(lastLocation.getLatitude(), lastLocation.getLongitude(), 10);
    } catch (IOException e) {
        locations = null;
    }
    if (locations != null) {
        if (!locations.isEmpty()) {
            Address address = locations.get(0);
            city = address.getLocality();
            state = address.getAdminArea().toUpperCase().substring(0, 2);
            zip = address.getPostalCode();
        } else {
            return latLongLocation;
        }
    }
    if (city != null && state != null && zip != null) {
        // Can use this if we need only city and state.
        return city + ", " + state;
        // Below returns City, State, and ZIP.
        // return city + ", " + state + " " + zip;
    } else {
        return "";
    }
}

[Buggy Hunk]
if (city != null && state != null && zip != null) {

[Patch]
if (city != null && !city.equals("") && state != null && !state.equals("") && zip != null && !zip.equals("")) {

[Demonstration 3]

[Buggy Method]
private void setUnreadCount(TextView targetView, Element rawContainer) {
    if (rawContainer != null) {
        try {
            int count = NumberFormat.getNumberInstance(Locale.US).parse(rawContainer.text()).intValue();
            if (count > 100) {
                targetView.setText(getString(R.string.menu_unread_count_over100));
            } else {
                targetView.setText(String.valueOf(count));
            }
            targetView.setVisibility(View.VISIBLE);
        } catch (Exception e) {
            targetView.setText("");
            targetView.setVisibility(View.GONE);
        }
    } else {
        targetView.setText("");
        targetView.setVisibility(View.GONE);
    }
}

[Buggy Hunk]
if (rawContainer != null) {

[Patch]
if (rawContainer != null && targetView != null) {