Input:
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        boolean handled = false;
        if (!isVisible()) {
            return false;
        }
        final int iconCount = mRollo.mState.iconCount;
        if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER || keyCode == KeyEvent.KEYCODE_ENTER) {
            if (mArrowNavigation) {
                if (mLastSelection == SELECTION_HOME) {
                    reallyPlaySoundEffect(SoundEffectConstants.CLICK);
                    mLauncher.closeAllApps(true);
                } else {
                    int whichApp = mRollo.mState.selectedIconIndex;
                    if (whichApp >= 0) {
                        ApplicationInfo app = mAllAppsList.get(whichApp);
                        mLauncher.startActivitySafely(app.intent);
                        handled = true;
                    }
                }
            }
        }
        if (iconCount > 0) {
            mArrowNavigation = true;
            int currentSelection = mRollo.mState.selectedIconIndex;
            int currentTopRow = Math.round(mPosX);
            final int currentPageCol = currentSelection % Defines.COLUMNS_PER_PAGE;
            final int currentPageRow = (currentSelection - (currentTopRow*Defines.COLUMNS_PER_PAGE))
                    / Defines.ROWS_PER_PAGE;
            int newSelection = currentSelection;
            switch (keyCode) {
            case KeyEvent.KEYCODE_DPAD_UP:
                if (mLastSelection == SELECTION_HOME) {
                    mRollo.setHomeSelected(SELECTED_NONE);
                    int lastRowCount = iconCount % Defines.COLUMNS_PER_PAGE;
                    if (lastRowCount == 0) {
                        lastRowCount = Defines.COLUMNS_PER_PAGE;
                    }
                    newSelection = iconCount - lastRowCount + (Defines.COLUMNS_PER_PAGE / 2);
                    if (newSelection >= iconCount) {
                        newSelection = iconCount-1;
                    }
                    int target = (newSelection / Defines.COLUMNS_PER_PAGE)
                            - (Defines.ROWS_PER_PAGE - 1);
                    if (target < 0) {
                        target = 0;
                    }
                    if (currentTopRow != target) {
                        mRollo.moveTo(target);
                    }
                } else {
                    if (currentPageRow > 0) {
                        newSelection = currentSelection - Defines.COLUMNS_PER_PAGE;
                    } else if (currentTopRow > 0) {
                        newSelection = currentSelection - Defines.COLUMNS_PER_PAGE;
                        mRollo.moveTo(newSelection / Defines.COLUMNS_PER_PAGE);
                    } else if (currentPageRow != 0) {
                        newSelection = currentTopRow * Defines.ROWS_PER_PAGE;
                    }
                }
                handled = true;
                break;
            case KeyEvent.KEYCODE_DPAD_DOWN: {
                final int rowCount = iconCount / Defines.COLUMNS_PER_PAGE
                        + (iconCount % Defines.COLUMNS_PER_PAGE == 0 ? 0 : 1);
                final int currentRow = currentSelection / Defines.COLUMNS_PER_PAGE;
                if (mLastSelection != SELECTION_HOME) {
                    if (currentRow < rowCount-1) {
                        mRollo.setHomeSelected(SELECTED_NONE);
                        if (currentSelection < 0) {
                            newSelection = 0;
                        } else {
                            newSelection = currentSelection + Defines.COLUMNS_PER_PAGE;
                        }
                        if (newSelection >= iconCount) {
                            newSelection = iconCount - 1;
                        }
                        if (currentPageRow >= Defines.ROWS_PER_PAGE - 1) {
                            mRollo.moveTo((newSelection / Defines.COLUMNS_PER_PAGE) -
                                    Defines.ROWS_PER_PAGE + 1);
                        }
                    } else {
                        newSelection = -1;
                        mRollo.setHomeSelected(SELECTED_FOCUSED);
                    }
                }
                handled = true;
                break;
            }
            case KeyEvent.KEYCODE_DPAD_LEFT:
                if (currentPageCol > 0) {
                    newSelection = currentSelection - 1;
                }
                handled = true;
                break;
            case KeyEvent.KEYCODE_DPAD_RIGHT:
                if ((currentPageCol < Defines.COLUMNS_PER_PAGE - 1) &&
                        (currentSelection < iconCount - 1)) {
                    newSelection = currentSelection + 1;
                }
                handled = true;
                break;
            }
            if (newSelection != currentSelection) {
                mRollo.selectIcon(newSelection, SELECTED_FOCUSED);
                mRollo.mState.save();
            }
        }
        return handled;
    }

Output:
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        boolean handled = false;
        if (!isVisible()) {
            return false;
        }
        final int iconCount = mRollo.mState.iconCount;
        if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER || keyCode == KeyEvent.KEYCODE_ENTER) {
            if (mArrowNavigation) {
                if (mLastSelection == SELECTION_HOME) {
                    reallyPlaySoundEffect(SoundEffectConstants.CLICK);
                    mLauncher.closeAllApps(true);
                } else {
                    int whichApp = mRollo.mState.selectedIconIndex;
                    if (whichApp >= 0) {
                        ApplicationInfo app = mAllAppsList.get(whichApp);
                        mLauncher.startActivitySafely(app.intent);
                        handled = true;
                    }
                }
            }
        }
        if (iconCount > 0) {
            mArrowNavigation = true;
            int currentSelection = mRollo.mState.selectedIconIndex;
            int currentTopRow = Math.round(mPosX);
            final int currentPageCol = currentSelection % Defines.COLUMNS_PER_PAGE;
            final int currentPageRow = (currentSelection - (currentTopRow*Defines.COLUMNS_PER_PAGE))
                    / Defines.ROWS_PER_PAGE;
            int newSelection = currentSelection;
            switch (keyCode) {
            case KeyEvent.KEYCODE_DPAD_UP:
                if (mLastSelection == SELECTION_HOME) {
                    mRollo.setHomeSelected(SELECTED_NONE);
                    int lastRowCount = iconCount % Defines.COLUMNS_PER_PAGE;
                    if (lastRowCount == 0) {
                        lastRowCount = Defines.COLUMNS_PER_PAGE;
                    }
                    newSelection = iconCount - lastRowCount + (Defines.COLUMNS_PER_PAGE / 2);
                    if (newSelection >= iconCount) {
                        newSelection = iconCount-1;
                    }
                    int target = (newSelection / Defines.COLUMNS_PER_PAGE)
                            - (Defines.ROWS_PER_PAGE - 1);
                    if (target < 0) {
                        target = 0;
                    }
                    if (currentTopRow != target) {
                        mRollo.moveTo(target);
                    }
                } else {
                    if (currentPageRow > 0) {
                        newSelection = currentSelection - Defines.COLUMNS_PER_PAGE;
                    } else if (currentTopRow > 0) {
                        newSelection = currentSelection - Defines.COLUMNS_PER_PAGE;
                        mRollo.moveTo(newSelection / Defines.COLUMNS_PER_PAGE);
                    } else if (currentPageRow != 0) {
                        newSelection = currentTopRow * Defines.ROWS_PER_PAGE;
                    }
                }
                handled = true;
                break;
            case KeyEvent.KEYCODE_DPAD_DOWN: {
                final int rowCount = iconCount / Defines.COLUMNS_PER_PAGE
                        + (iconCount % Defines.COLUMNS_PER_PAGE == 0 ? 0 : 1);
                final int currentRow = currentSelection / Defines.COLUMNS_PER_PAGE;
                if (mLastSelection != SELECTION_HOME) {
                    if (currentRow < rowCount-1) {
                        mRollo.setHomeSelected(SELECTED_NONE);
                        if (currentSelection < 0) {
                            newSelection = 0;
                        } else {
                            newSelection = currentSelection + Defines.COLUMNS_PER_PAGE;
                        }
                        if (newSelection >= iconCount) {
                            newSelection = iconCount - 1;
                        }
                        if (currentPageRow >= Defines.ROWS_PER_PAGE - 1) {
                            mRollo.moveTo((newSelection / Defines.COLUMNS_PER_PAGE) -
                                    Defines.ROWS_PER_PAGE + 1);
                        }
                    } else {
                        newSelection = -1;
                        mRollo.setHomeSelected(SELECTED_FOCUSED);
                    }
                }
                handled = true;
                break;
            }
            case KeyEvent.KEYCODE_DPAD_LEFT:
                if (mLastSelection != SELECTION_HOME) {
                    if (currentPageCol > 0) {
                        newSelection = currentSelection - 1;
                    }
                }
                handled = true;
                break;
            case KeyEvent.KEYCODE_DPAD_RIGHT:
                if (mLastSelection != SELECTION_HOME) {
                    if ((currentPageCol < Defines.COLUMNS_PER_PAGE - 1) &&
                            (currentSelection < iconCount - 1)) {
                        newSelection = currentSelection + 1;
                    }
                }
                handled = true;
                break;
            }
            if (newSelection != currentSelection) {
                mRollo.selectIcon(newSelection, SELECTED_FOCUSED);
                mRollo.mState.save();
            }
        }
        return handled;
    }


Input:
	public Date deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
		SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
		String date = jp.getText();
		try {
			return format.parse(date);
		} catch (ParseException e) {
			logger.error("Failed to parse date json string value with format: dd/MM/yyyy.");
			throw new RuntimeException(e);
		}
	}

Output:
	public Date deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
		SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy");
		String date = jp.getText();
		try {
			return format.parse(date);
		} catch (ParseException e) {
			logger.error("Failed to parse date json string value with format: MM/dd/yyyy.");
			throw new RuntimeException(e);
		}
	}


Input:
    public Map<String, Object> getNotificationsFor(final @RequestParam(value = "uuid", required = true) String uuid,
                                            final @RequestParam(value = "sender", required = true) boolean sender,
                                            final @RequestParam(value = "search") String search,
                                            final @RequestParam(value = "pageNumber") Integer pageNumber,
                                            final @RequestParam(value = "pageSize") Integer pageSize) {
        Map<String, Object> response = new HashMap<String, Object>();
        Person person = Context.getPersonService().getPersonByUuid(uuid);
        DataService service = Context.getService(DataService.class);
        Integer pages;
        List<NotificationData> notificationDataList;
        if (sender) {
            pages = (service.countNotificationDataBySender(person, search) + pageSize - 1) / pageSize;
            notificationDataList = service.getNotificationDataBySender(person, search, pageNumber, pageSize);
        } else {
            pages = (service.countNotificationDataByReceiver(person, search) + pageSize - 1) / pageSize;
            notificationDataList = service.getNotificationDataByReceiver(person, search, pageNumber, pageSize);
        }
        List<Object> objects = new ArrayList<Object>();
        for (NotificationData notificationData : notificationDataList) {
            objects.add(NotificationDataConverter.convert(notificationData));
        }
        response.put("pages", pages);
        response.put("objects", objects);
        return response;
    }

Output:
    public Map<String, Object> getNotificationsFor(final @RequestParam(value = "uuid", required = true) String uuid,
                                            final @RequestParam(value = "sender", required = true) boolean sender,
                                            final @RequestParam(value = "search") String search,
                                            final @RequestParam(value = "pageNumber") Integer pageNumber,
                                            final @RequestParam(value = "pageSize") Integer pageSize) {
        Map<String, Object> response = new HashMap<String, Object>();
        Person person = Context.getPersonService().getPersonByUuid(uuid);
        DataService service = Context.getService(DataService.class);
        Integer pages;
        List<NotificationData> notificationDataList;
        if (sender) {
            pages = (service.countNotificationDataBySender(person, search).intValue() + pageSize - 1) / pageSize;
            notificationDataList = service.getNotificationDataBySender(person, search, pageNumber, pageSize);
        } else {
            pages = (service.countNotificationDataByReceiver(person, search).intValue() + pageSize - 1) / pageSize;
            notificationDataList = service.getNotificationDataByReceiver(person, search, pageNumber, pageSize);
        }
        List<Object> objects = new ArrayList<Object>();
        for (NotificationData notificationData : notificationDataList) {
            objects.add(NotificationDataConverter.convert(notificationData));
        }
        response.put("pages", pages);
        response.put("objects", objects);
        return response;
    }


Input:
    public static List<SmartPaymentValidationError> validatePaymentString(String paymentString) {
        List<SmartPaymentValidationError> errors = new LinkedList<SmartPaymentValidationError>();
        if (!paymentString.matches("^SPD\\*[0-9]+\\.[0-9]+\\*.*")) {
            SmartPaymentValidationError error = new SmartPaymentValidationError();
            error.setErrorCode(SmartPaymentValidationError.ERROR_NOT_SPAYD);
            error.setErrorDescription("Invalid data prefix - SPD*{$VERSION}* expected.");
            errors.add(error);
            return errors;
        }
        if (!paymentString.matches("^SPD\\*[0-9]+\\.[0-9]+(\\*[0-9A-Z $%*+-.]+:[^\\*]+)+\\*?$")) {
            SmartPaymentValidationError error = new SmartPaymentValidationError();
            error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_STRUCTURE);
            error.setErrorDescription("Payment String code didn't pass the basic regexp validation.");
            errors.add(error);
            return errors;
        }
        List<String> allowedKeyList = Arrays.asList(allowedKeys);
        String[] components = paymentString.split("\\*");
        boolean ibanFound = false;
        for (int i = 2; i < components.length; i++) {
            int index = components[i].indexOf(":");
            String key = components[i].substring(0, index);
            String value = components[i].substring(index + 1);
            if (!allowedKeyList.contains(key) && !key.startsWith("X-")) {
                SmartPaymentValidationError error = new SmartPaymentValidationError();
                error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_KEY_FOUND);
                error.setErrorDescription("Unknown key detected. Use 'X-' prefix to create your own key.");
                errors.add(error);
                continue;
            }
            if (key.equals("ACC")) {
                ibanFound = true;
                if (!value.matches("^([A-Z]{2,2}[0-9]+)(\\+([A-Z0-9]+))?$")) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_IBAN);
                    error.setErrorDescription("IBAN+BIC pair was not in the correct format.");
                    errors.add(error);
                }
            } else if (key.equals("ALT-ACC")) {
                ibanFound = true;
                if (!value.matches("^([A-Z]{2,2}[0-9]+)(\\+([A-Z0-9]+))?(,([A-Z]{2,2}[0-9]+)(\\+([A-Z0-9]+))?)*$")) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_ALTERNATE_IBAN);
                    error.setErrorDescription("Alternate accounts are not properly formatted - should be IBAN+BIC list with items separated by ',' character.");
                    errors.add(error);
                }
            } else if (key.equals("AM")) {
                if (!value.matches("^[0-9]{0,10}(\\.[0-9]{0,2})?$") || value.equals(".")) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_AMOUNT);
                    error.setErrorDescription("Amount must be a number with at most 2 decimal digits.");
                    errors.add(error);
                }
            } else if (key.equals("CC")) {
                try {
                    Currency.getInstance(value);
                } catch (IllegalArgumentException ex) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_CURRENCY);
                    error.setErrorDescription("Currency must be a valid currency from ISO 4271.");
                    errors.add(error);
                }
            } else if (key.equals("RF")) {
                if (value.length() > 16 || value.length() < 1 || !value.matches("^[0-9]+$")) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_SENDERS_REFERENCE);
                    error.setErrorDescription("Senders reference must be a decimal string with length between 1 and 16 characters.");
                    errors.add(error);
                }
            } else if (key.equals("RN")) {
                if (value.length() > 40 || value.length() < 1) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_RECIPIENT_NAME);
                    error.setErrorDescription("Recipient name must be a string with length between 1 and 40 characters.");
                    errors.add(error);
                }
            } else if (key.equals("NT")) {
                if (!value.equals("E") && !value.equals("P")) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_NOTIFICATION_TYPE);
                    error.setErrorDescription("Notification type must be 'E' (e-mail) or 'P' (phone).");
                    errors.add(error);
                }
            } else if (key.equals("DT")) {
                if (!value.matches("^[0-9]{8,8}$")) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_DUE_DATE);
                    error.setErrorDescription("Due date must be represented as a decimal string in YYYYmmdd format.");
                    errors.add(error);
                } else {
                    SimpleDateFormat df = new SimpleDateFormat("yyyymmdd");
                    Date date;
                    try {
                        date = df.parse(value);
                        if (date == null) {
                            SmartPaymentValidationError error = new SmartPaymentValidationError();
                            error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_DUE_DATE);
                            error.setErrorDescription("Due date must be represented as a decimal string in YYYYmmdd format.");
                            errors.add(error);
                        }
                    } catch (ParseException ex) {
                        SmartPaymentValidationError error = new SmartPaymentValidationError();
                        error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_DUE_DATE);
                        error.setErrorDescription("Due date must be represented as a decimal string in YYYYmmdd format.");
                        errors.add(error);
                    }
                }
            } else if (key.equals("PT")) {
                if (value.length() > 3 || value.length() < 1) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_PAYMENT_TYPE);
                    error.setErrorDescription("Payment type must be at represented as a string with length between 1 and 3 characters.");
                    errors.add(error);
                }
            } else if (key.equals("MSG")) {
                if (value.length() > 35 || value.length() < 1) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_MESSAGE);
                    error.setErrorDescription("Message must be at represented as a string with length between 1 and 35 characters.");
                    errors.add(error);
                }
            }
        }
        if (!ibanFound) {
            SmartPaymentValidationError error = new SmartPaymentValidationError();
            error.setErrorCode(SmartPaymentValidationError.ERROR_IBAN_NOT_FOUND);
            error.setErrorDescription("You must specify an account number.");
            errors.add(error);
        }
        return errors.isEmpty() ? null : errors;
    }

Output:
    public static List<SmartPaymentValidationError> validatePaymentString(String paymentString) {
        List<SmartPaymentValidationError> errors = new LinkedList<SmartPaymentValidationError>();
        if (!paymentString.matches("^SPD\\*[0-9]+\\.[0-9]+\\*.*")) {
            SmartPaymentValidationError error = new SmartPaymentValidationError();
            error.setErrorCode(SmartPaymentValidationError.ERROR_NOT_SPAYD);
            error.setErrorDescription("Invalid data prefix - SPD*{$VERSION}* expected.");
            errors.add(error);
            return errors;
        }
        if (!paymentString.matches("^SPD\\*[0-9]+\\.[0-9]+(\\*[0-9A-Z $%*+-.]+:[^\\*]+)+\\*?$")) {
            SmartPaymentValidationError error = new SmartPaymentValidationError();
            error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_STRUCTURE);
            error.setErrorDescription("Payment String code didn't pass the basic regexp validation.");
            errors.add(error);
            return errors;
        }
        List<String> allowedKeyList = Arrays.asList(allowedKeys);
        String[] components = paymentString.split("\\*");
        boolean ibanFound = false;
        for (int i = 2; i < components.length; i++) {
            int index = components[i].indexOf(":");
            if (index == -1) {
                SmartPaymentValidationError error = new SmartPaymentValidationError();
                error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_STRUCTURE);
                error.setErrorDescription("Payment String code didn't pass the basic regexp validation.");
                errors.add(error);
            }
            String key = components[i].substring(0, index);
            String value = components[i].substring(index + 1);
            if (!allowedKeyList.contains(key) && !key.startsWith("X-")) {
                SmartPaymentValidationError error = new SmartPaymentValidationError();
                error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_KEY_FOUND);
                error.setErrorDescription("Unknown key detected. Use 'X-' prefix to create your own key.");
                errors.add(error);
                continue;
            }
            if (key.equals("ACC")) {
                ibanFound = true;
                if (!value.matches("^([A-Z]{2,2}[0-9]+)(\\+([A-Z0-9]+))?$")) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_IBAN);
                    error.setErrorDescription("IBAN+BIC pair was not in the correct format.");
                    errors.add(error);
                }
            } else if (key.equals("ALT-ACC")) {
                ibanFound = true;
                if (!value.matches("^([A-Z]{2,2}[0-9]+)(\\+([A-Z0-9]+))?(,([A-Z]{2,2}[0-9]+)(\\+([A-Z0-9]+))?)*$")) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_ALTERNATE_IBAN);
                    error.setErrorDescription("Alternate accounts are not properly formatted - should be IBAN+BIC list with items separated by ',' character.");
                    errors.add(error);
                }
            } else if (key.equals("AM")) {
                if (!value.matches("^[0-9]{0,10}(\\.[0-9]{0,2})?$") || value.equals(".")) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_AMOUNT);
                    error.setErrorDescription("Amount must be a number with at most 2 decimal digits.");
                    errors.add(error);
                }
            } else if (key.equals("CC")) {
                try {
                    Currency.getInstance(value);
                } catch (IllegalArgumentException ex) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_CURRENCY);
                    error.setErrorDescription("Currency must be a valid currency from ISO 4271.");
                    errors.add(error);
                }
            } else if (key.equals("RF")) {
                if (value.length() > 16 || value.length() < 1 || !value.matches("^[0-9]+$")) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_SENDERS_REFERENCE);
                    error.setErrorDescription("Senders reference must be a decimal string with length between 1 and 16 characters.");
                    errors.add(error);
                }
            } else if (key.equals("RN")) {
                if (value.length() > 40 || value.length() < 1) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_RECIPIENT_NAME);
                    error.setErrorDescription("Recipient name must be a string with length between 1 and 40 characters.");
                    errors.add(error);
                }
            } else if (key.equals("NT")) {
                if (!value.equals("E") && !value.equals("P")) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_NOTIFICATION_TYPE);
                    error.setErrorDescription("Notification type must be 'E' (e-mail) or 'P' (phone).");
                    errors.add(error);
                }
            } else if (key.equals("DT")) {
                if (!value.matches("^[0-9]{8,8}$")) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_DUE_DATE);
                    error.setErrorDescription("Due date must be represented as a decimal string in YYYYmmdd format.");
                    errors.add(error);
                } else {
                    SimpleDateFormat df = new SimpleDateFormat("yyyymmdd");
                    Date date;
                    try {
                        date = df.parse(value);
                        if (date == null) {
                            SmartPaymentValidationError error = new SmartPaymentValidationError();
                            error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_DUE_DATE);
                            error.setErrorDescription("Due date must be represented as a decimal string in YYYYmmdd format.");
                            errors.add(error);
                        }
                    } catch (ParseException ex) {
                        SmartPaymentValidationError error = new SmartPaymentValidationError();
                        error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_DUE_DATE);
                        error.setErrorDescription("Due date must be represented as a decimal string in YYYYmmdd format.");
                        errors.add(error);
                    }
                }
            } else if (key.equals("PT")) {
                if (value.length() > 3 || value.length() < 1) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_PAYMENT_TYPE);
                    error.setErrorDescription("Payment type must be at represented as a string with length between 1 and 3 characters.");
                    errors.add(error);
                }
            } else if (key.equals("MSG")) {
                if (value.length() > 35 || value.length() < 1) {
                    SmartPaymentValidationError error = new SmartPaymentValidationError();
                    error.setErrorCode(SmartPaymentValidationError.ERROR_INVALID_MESSAGE);
                    error.setErrorDescription("Message must be at represented as a string with length between 1 and 35 characters.");
                    errors.add(error);
                }
            }
        }
        if (!ibanFound) {
            SmartPaymentValidationError error = new SmartPaymentValidationError();
            error.setErrorCode(SmartPaymentValidationError.ERROR_IBAN_NOT_FOUND);
            error.setErrorDescription("You must specify an account number.");
            errors.add(error);
        }
        return errors.isEmpty() ? null : errors;
    }


Input:
    public void testCreateAndCheckKey() throws Exception {
        String osPath = mTmpFile.getAbsolutePath();
        KeygenOutput keygenOutput = new KeygenOutput();
        long now = System.currentTimeMillis();
        DebugKeyProvider provider;
        try {
            provider = new DebugKeyProvider(osPath,  null , keygenOutput);
        } catch (Throwable t) {
            String msg = String.format("%1$s in %2$s\n%3$s",
                    t.getClass().getSimpleName(), osPath, t.toString());
            throw new Exception(msg, t);
        }
        assertNotNull(provider);
        assertEquals("", keygenOutput.getOut());
        assertEquals("", keygenOutput.getErr());
        PrivateKey key = provider.getDebugKey();
        assertNotNull(key);
        X509Certificate certificate = (X509Certificate) provider.getCertificate();
        assertNotNull(certificate);
        Calendar c = Calendar.getInstance();
        c.setTimeInMillis(now);
        assertTrue(certificate.getNotAfter().compareTo(c.getTime()) > 0);
        c.add(Calendar.DAY_OF_YEAR, 365);
        c.add(Calendar.SECOND, -1);
        assertTrue("1 year expiration failed",
                certificate.getNotAfter().compareTo(c.getTime()) > 0);
        c.add(Calendar.DAY_OF_YEAR, 29 * 365);
        c.add(Calendar.HOUR_OF_DAY, -1);
        assertTrue("30 year expiration failed",
                certificate.getNotAfter().compareTo(c.getTime()) > 0);
        c.add(Calendar.HOUR, 1);
        assertFalse("30 year and 1 hour expiration failed",
                certificate.getNotAfter().compareTo(c.getTime()) > 0);
    }

Output:
    public void testCreateAndCheckKey() throws Exception {
        String osPath = mTmpFile.getAbsolutePath();
        KeygenOutput keygenOutput = new KeygenOutput();
        long now = System.currentTimeMillis();
        DebugKeyProvider provider;
        try {
            provider = new DebugKeyProvider(osPath,  null , keygenOutput);
        } catch (Throwable t) {
            String msg = String.format("%1$s in %2$s\n%3$s",
                    t.getClass().getSimpleName(), osPath, t.toString());
            throw new Exception(msg, t);
        }
        assertNotNull(provider);
        assertEquals("", keygenOutput.getOut());
        assertEquals("", keygenOutput.getErr());
        PrivateKey key = provider.getDebugKey();
        assertNotNull(key);
        X509Certificate certificate = (X509Certificate) provider.getCertificate();
        assertNotNull(certificate);
        Calendar c = Calendar.getInstance();
        c.setTimeInMillis(now);
        assertTrue(certificate.getNotAfter().compareTo(c.getTime()) > 0);
        c.add(Calendar.DAY_OF_YEAR, 365);
        c.add(Calendar.SECOND, -1);
        assertTrue("1 year expiration failed",
                certificate.getNotAfter().compareTo(c.getTime()) > 0);
        c.add(Calendar.DAY_OF_YEAR, 29 * 365);
        c.add(Calendar.HOUR_OF_DAY, -1);
        assertTrue("30 year expiration failed",
                certificate.getNotAfter().compareTo(c.getTime()) > 0);
        c.add(Calendar.HOUR, 5);
        assertFalse("30 year and a few hours expiration failed",
                certificate.getNotAfter().compareTo(c.getTime()) > 0);
    }


Input:
    public synchronized static Bitmap getCover(Context context, Media media, int width) {
        String coverPath = null;
        Bitmap cover = null;
        String cachePath = null;
        if (!Util.hasExternalStorage() && width > 0)
            return null;
        try {
            int hash = MurmurHash.hash32(media.getArtist()+media.getAlbum());
            cachePath = COVER_DIR + (hash >= 0 ? "" + hash : "m" + (-hash)) + "_" + width;
            File cacheFile = new File(cachePath);
            if (cacheFile != null && cacheFile.exists()) {
                if (cacheFile.length() > 0)
                    coverPath = cachePath;
            }
            if (coverPath == null)
                coverPath = getCoverFromVlc(context, media);
            if (coverPath == null)
                coverPath = getCoverFromFolder(context, media);
            if (coverPath == null)
                coverPath = getCoverFromMediaStore(context, media);
            cover = readBitmap(coverPath);
            if (cover != null && width > 0)
                cover = Util.scaleDownBitmap(context, cover, width);
            writeBitmap(cover, cachePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return cover;
    }

Output:
    public synchronized static Bitmap getCover(Context context, Media media, int width) {
        String coverPath = null;
        Bitmap cover = null;
        String cachePath = null;
        if (!Util.hasExternalStorage() && width > 0)
            return null;
        try {
            int hash = MurmurHash.hash32(media.getArtist()+media.getAlbum());
            cachePath = COVER_DIR + (hash >= 0 ? "" + hash : "m" + (-hash)) + "_" + width;
            File cacheFile = new File(cachePath);
            if (cacheFile != null && cacheFile.exists()) {
                if (cacheFile.length() > 0)
                    coverPath = cachePath;
                else
                    return null;
            }
            if (coverPath == null)
                coverPath = getCoverFromVlc(context, media);
            if (coverPath == null)
                coverPath = getCoverFromFolder(context, media);
            if (coverPath == null)
                coverPath = getCoverFromMediaStore(context, media);
            cover = readBitmap(coverPath);
            if (cover != null && width > 0)
                cover = Util.scaleDownBitmap(context, cover, width);
            writeBitmap(cover, cachePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return cover;
    }


Input:
    public void run() {
        int currentState = 0;
        WizardUndo undoStack = new WizardUndo();
        Object ret;
        boolean wizardComplete = false;
        while (!wizardComplete) {
            if (wdlg.isStopClicked()) {
                m_log.info(states[currentState].getStateName() + " clicked stop ");
                wizardComplete = true;
            } else if (wdlg.isNextClicked()) {
                m_log.info(states[currentState].getStateName() + " clicked next ");
                if (currentState == states.length - 1) {
                    wdlg.whichState(WizardDialog.STATE_LAST);
                    wizardComplete = true;
                } else {
                    wdlg.whichState(WizardDialog.STATE_INTERMEDIATE);
                    System.out.println("Will evaluate " + states[currentState].getStateName());
                    ret = wdlg.getCurrentStateUI().evaluate();
                    if (ret == null) continue;
                    else undoStack.push(ret);
                    currentState++;
                    wdlg.setCurrentStateUI(states[currentState]);
                }
            } else if (wdlg.isBackClicked()) {
                m_log.info(states[currentState].getStateName() + " clicked back ");
                if (currentState == 0) {
                    wdlg.whichState(WizardDialog.STATE_FIRST);
                    continue;
                } else wdlg.whichState(WizardDialog.STATE_INTERMEDIATE);
                undoStack.undo(currentState);
                currentState--;
                wdlg.setCurrentStateUI(states[currentState]);
            } else if (wdlg.isCancelClicked()) {
                m_log.info(states[currentState].getStateName() + " clicked cancel ");
                undoStack.undoAll(currentState);
                wizardComplete = true;
            }
        }
    }

Output:
    public void run() {
        int currentState = 0;
        WizardUndo undoStack = new WizardUndo();
        Object ret;
        boolean wizardComplete = false;
        while (!wizardComplete) {
            if (wdlg.isStopClicked()) {
                m_log.info(states[currentState].getLabel().getText() + " clicked stop ");
                wizardComplete = true;
            } else if (wdlg.isNextClicked()) {
                m_log.info(states[currentState].getLabel().getText() + " clicked next ");
                if (currentState == states.length - 1) {
                    wdlg.whichState(WizardDialog.STATE_LAST);
                    wizardComplete = true;
                } else {
                    wdlg.whichState(WizardDialog.STATE_INTERMEDIATE);
                    ret = wdlg.getCurrentStateUI().evaluate();
                    if (ret == null) continue;
                    else undoStack.push(ret);
                    currentState++;
                    wdlg.setCurrentStateUI(states[currentState]);
                }
            } else if (wdlg.isBackClicked()) {
                m_log.info(states[currentState].getLabel().getText() + " clicked back ");
                if (currentState == 0) {
                    wdlg.whichState(WizardDialog.STATE_FIRST);
                    continue;
                } else wdlg.whichState(WizardDialog.STATE_INTERMEDIATE);
                undoStack.undo(currentState);
                currentState--;
                wdlg.setCurrentStateUI(states[currentState]);
            } else if (wdlg.isCancelClicked()) {
                m_log.info(states[currentState].getLabel().getText() + " clicked cancel ");
                undoStack.undoAll(currentState);
                wizardComplete = true;
            }
        }
    }


Input:
  protected void handleScoutTreeEventInSwt(TreeEvent e) {
    if (isDisposed()) {
      return;
    }
    ignoreSelectionEventsFromSwtToScoutUntilNextDisplayPost();
    switch (e.getType()) {
      case TreeEvent.TYPE_REQUEST_FOCUS: {
        getSwtField().setFocus();
        break;
      }
      case TreeEvent.TYPE_NODE_EXPANDED:
      case TreeEvent.TYPE_NODE_COLLAPSED: {
        setExpansionFromScout(e.getNode());
        break;
      }
      case TreeEvent.TYPE_NODES_INSERTED: {
        updateTreeStructureAndKeepSelection(e.getCommonParentNode());
        setExpansionFromScout(e.getCommonParentNode());
        break;
      }
      case TreeEvent.TYPE_NODES_UPDATED: {
        ISelection oldSelection = getSwtTreeViewer().getSelection();
        ISelection newSelection = new StructuredSelection(getScoutObject().getSelectedNodes());
        updateTreeStructureAndKeepSelection(e.getCommonParentNode());
        if (!newSelection.equals(oldSelection)) {
          getSwtTreeViewer().setSelection(newSelection);
        }
        setExpansionFromScout(e.getCommonParentNode());
        break;
      }
      case TreeEvent.TYPE_NODES_DELETED: {
        updateTreeStructureAndKeepSelection(e.getCommonParentNode());
        setExpansionFromScout(e.getCommonParentNode());
        break;
      }
      case TreeEvent.TYPE_NODE_FILTER_CHANGED: {
        updateTreeStructureAndKeepSelection(getScoutObject().getRootNode());
        setExpansionFromScout(getScoutObject().getRootNode());
        if (getSwtField().getSelectionCount() == 0) {
          getSwtField().showItem(getSwtField().getItem(0));
        }
        break;
      }
      case TreeEvent.TYPE_CHILD_NODE_ORDER_CHANGED: {
        updateTreeStructureAndKeepSelection(e.getCommonParentNode());
        setExpansionFromScout(e.getCommonParentNode());
        break;
      }
      case TreeEvent.TYPE_NODES_SELECTED: {
        setSelectionFromScout(e.getNodes());
        break;
      }
      case TreeEvent.TYPE_SCROLL_TO_SELECTION: {
        scrollToSelection();
        break;
      }
    }
  }

Output:
  protected void handleScoutTreeEventInSwt(TreeEvent e) {
    if (isDisposed()) {
      return;
    }
    ignoreSelectionEventsFromSwtToScoutUntilNextDisplayPost();
    switch (e.getType()) {
      case TreeEvent.TYPE_REQUEST_FOCUS: {
        getSwtField().setFocus();
        break;
      }
      case TreeEvent.TYPE_NODE_EXPANDED:
      case TreeEvent.TYPE_NODE_COLLAPSED: {
        setExpansionFromScout(e.getNode());
        break;
      }
      case TreeEvent.TYPE_NODES_INSERTED: {
        updateTreeStructureAndKeepSelection(e.getCommonParentNode());
        setExpansionFromScout(e.getCommonParentNode());
        break;
      }
      case TreeEvent.TYPE_NODES_UPDATED: {
        ISelection oldSelection = getSwtTreeViewer().getSelection();
        ISelection newSelection = new StructuredSelection(getScoutObject().getSelectedNodes());
        updateTreeStructureAndKeepSelection(e.getCommonParentNode());
        if (!newSelection.equals(oldSelection)) {
          getSwtTreeViewer().setSelection(newSelection);
        }
        setExpansionFromScout(e.getCommonParentNode());
        break;
      }
      case TreeEvent.TYPE_NODES_DELETED: {
        updateTreeStructureAndKeepSelection(e.getCommonParentNode());
        setExpansionFromScout(e.getCommonParentNode());
        break;
      }
      case TreeEvent.TYPE_NODE_FILTER_CHANGED: {
        updateTreeStructureAndKeepSelection(getScoutObject().getRootNode());
        setExpansionFromScout(getScoutObject().getRootNode());
        if (getSwtField().getSelectionCount() == 0 && getSwtField().getItemCount() > 0) {
          getSwtField().showItem(getSwtField().getItem(0));
        }
        break;
      }
      case TreeEvent.TYPE_CHILD_NODE_ORDER_CHANGED: {
        updateTreeStructureAndKeepSelection(e.getCommonParentNode());
        setExpansionFromScout(e.getCommonParentNode());
        break;
      }
      case TreeEvent.TYPE_NODES_SELECTED: {
        setSelectionFromScout(e.getNodes());
        break;
      }
      case TreeEvent.TYPE_SCROLL_TO_SELECTION: {
        scrollToSelection();
        break;
      }
    }
  }


Input:
    protected void onLayout(
            boolean changed, int left, int top, int right, int bottom) {
        int count = getChildCount();
        if (count == 0) return;
        int shutterButtonWidth = mShutterButton.getMeasuredWidth();
        mShutterButtonRadius = shutterButtonWidth / 2.0;
        int shutterButtonHeight = mShutterButton.getMeasuredHeight();
        mCenterY = (bottom - top) / 2;
        mShutterButton.layout(mCenterX - shutterButtonWidth / 2,
                mCenterY - shutterButtonHeight / 2,
                mCenterX + shutterButtonWidth / 2,
                mCenterY + shutterButtonHeight / 2);
        if (count == 1) return;
        mWheelRadius = mShutterButtonRadius + mStrokeWidth * 1.5;
        mCenterX = (int) (right - mShutterButtonRadius * 1.2);
        double intervalDegrees = 180.0 / (count - 2);
        double initialDegrees = 90.0;
        int index = 0;
        for (int i = 0; i < count; i++) {
            View view = getChildAt(i);
            if (view == mShutterButton) continue;
            double degree = initialDegrees + intervalDegrees * index;
            double radian = Math.toRadians(degree);
            int x = mCenterX + (int)(mWheelRadius * Math.cos(radian));
            int y = mCenterY - (int)(mWheelRadius * Math.sin(radian));
            int width = view.getMeasuredWidth();
            int height = view.getMeasuredHeight();
            view.layout(x - width / 2, y - height / 2, x + width / 2,
                    y + height / 2);
            index++;
        }
        mSectorInitialRadians = new double[count];
        mSectorInitialRadians[0] = Math.toRadians(
                initialDegrees - intervalDegrees / 2.0);
        for (int i = 1; i < count; i++) {
            mSectorInitialRadians[i] = mSectorInitialRadians[i - 1]
                    + Math.toRadians(intervalDegrees);
        }
    }

Output:
    protected void onLayout(
            boolean changed, int left, int top, int right, int bottom) {
        int count = getChildCount();
        if (count == 0) return;
        int shutterButtonWidth = mShutterButton.getMeasuredWidth();
        mShutterButtonRadius = shutterButtonWidth / 2.0;
        int shutterButtonHeight = mShutterButton.getMeasuredHeight();
        mCenterY = (bottom - top) / 2;
        mShutterButton.layout(mCenterX - shutterButtonWidth / 2,
                mCenterY - shutterButtonHeight / 2,
                mCenterX + shutterButtonWidth / 2,
                mCenterY + shutterButtonHeight / 2);
        if (count == 1) return;
        mWheelRadius = mShutterButtonRadius + mStrokeWidth * 1.5;
        mCenterX = (int) (right - mShutterButtonRadius * 1.2 - left);
        double intervalDegrees = 180.0 / (count - 2);
        double initialDegrees = 90.0;
        int index = 0;
        for (int i = 0; i < count; i++) {
            View view = getChildAt(i);
            if (view == mShutterButton) continue;
            double degree = initialDegrees + intervalDegrees * index;
            double radian = Math.toRadians(degree);
            int x = mCenterX + (int)(mWheelRadius * Math.cos(radian));
            int y = mCenterY - (int)(mWheelRadius * Math.sin(radian));
            int width = view.getMeasuredWidth();
            int height = view.getMeasuredHeight();
            view.layout(x - width / 2, y - height / 2, x + width / 2,
                    y + height / 2);
            index++;
        }
        mSectorInitialRadians = new double[count];
        mSectorInitialRadians[0] = Math.toRadians(
                initialDegrees - intervalDegrees / 2.0);
        for (int i = 1; i < count; i++) {
            mSectorInitialRadians[i] = mSectorInitialRadians[i - 1]
                    + Math.toRadians(intervalDegrees);
        }
    }


Input:
	private String getAgentInformation(Agent agent) {
		String info;
		if (agent.getCurrentAction() != null) {
			info = "Name: " + agent.getName() + "\n" + "Indentifier: "
					+ agent.getIdentifier() + "\n" + "Status: "
					+ agent.getState() + "\n" + "Current action: \n"
					+ "   - Name: "
					+ agent.getCurrentAction().getClass().getSimpleName()
					+ "\n" + "   - Type: " + agent.getCurrentAction().getType()
					+ "\n" + "   - State: "
					+ agent.getCurrentAction().getState() + "\n"
					+ "   - Description: "
					+ agent.getCurrentAction().getInformationDescription()
					+ "\n" + "   - Duration: "
					+ agent.getCurrentAction().getDuration() + " minutes\n"
					+ "Current position: " + agent.getCurrentPosition() + "\n";
			info = info + "Action pool:\n";
			for (AbstractAction abstractAction : agent.getActionPoolCopy()) {
				info = info + "  " + abstractAction.getInformationDescription()
						+ "\n";
			}
			info = info + "Todo list:\n";
			for (AbstractAction abstractAction : agent.getTodoListCopy()) {
				info = info + "  " + abstractAction.getInformationDescription()
						+ "\n";
			}
		} else {
			info = "Name: " + agent.getName() + "\n" + "Indentifier: "
					+ agent.getIdentifier() + "\n" + "Status: "
					+ agent.getState() + "\n" + "Current action: ---\n"
					+ "Current position: " + agent.getCurrentPosition();
			info = info + "Action pool:\n";
			for (AbstractAction abstractAction : agent.getActionPoolCopy()) {
				info = info + "  " + abstractAction.getInformationDescription()
						+ "\n";
			}
			info = info + "Todo list:\n";
			for (AbstractAction abstractAction : agent.getTodoListCopy()) {
				info = info + "  " + abstractAction.getInformationDescription()
						+ "\n";
			}
		}
		return info;
	}

Output:
	private String getAgentInformation(Agent agent) {
		String info;
		if (agent.getCurrentAction() != null) {
			info = "Name: " + agent.getName() + "\n" + "Indentifier: "
					+ agent.getIdentifier() + "\n" + "Status: "
					+ agent.getState() + "\n" + "Current action: \n"
					+ "   - Name: "
					+ agent.getCurrentAction().getClass().getSimpleName()
					+ "\n" + "   - Type: " + agent.getCurrentAction().getType()
					+ "\n" + "   - State: "
					+ agent.getCurrentAction().getState() + "\n"
					+ "   - Description: "
					+ agent.getCurrentAction().getInformationDescription()
					+ "\n" + "   - Duration: "
					+ agent.getCurrentAction().getDuration() + " minutes\n"
					+ "Current position: " + agent.getCurrentPosition() + "\n";
			info = info + "Action pool:\n";
			for (AbstractAction abstractAction : agent.getActionPoolCopy()) {
				info = info + "  " + abstractAction.getInformationDescription()
						+ "\n";
			}
			info = info + "Todo list:\n";
			for (AbstractAction abstractAction : agent.getTodoListCopy()) {
				info = info + "  " + abstractAction.getInformationDescription()
						+ "\n";
			}
		} else {
			info = "Name: " + agent.getName() + "\n" + "Indentifier: "
					+ agent.getIdentifier() + "\n" + "Status: "
					+ agent.getState() + "\n" + "Current action: ---\n"
					+ "Current position: " + agent.getCurrentPosition() + "\n";
			info = info + "Action pool:\n";
			for (AbstractAction abstractAction : agent.getActionPoolCopy()) {
				info = info + "  " + abstractAction.getInformationDescription()
						+ "\n";
			}
			info = info + "Todo list:\n";
			for (AbstractAction abstractAction : agent.getTodoListCopy()) {
				info = info + "  " + abstractAction.getInformationDescription()
						+ "\n";
			}
		}
		return info;
	}


Input:
    protected void configureTargetProduct(ProductConfigurer productConfigurer) {
        productConfigurer.copyMetadata();
        productConfigurer.copyTimeCoding();
        productConfigurer.copyGeoCoding();
        productConfigurer.copyTiePointGrids();
        Product targetProduct = productConfigurer.getTargetProduct();
        targetProduct.setName(sourceProduct.getName());
        if (doRadToRefl) {
            targetProduct.setProductType(String.format("%s_REFL", sourceProduct.getProductType()));
            targetProduct.setAutoGrouping("reflec");
        } else {
            targetProduct.setProductType(sourceProduct.getProductType());
            targetProduct.setAutoGrouping("radiance");
        }
        targetProduct.setDescription("MERIS L1b Radiometric Correction");
        for (final Band sourceBand : sourceProduct.getBands()) {
            if (sourceBand.getSpectralBandIndex() != -1) {
                final String targetBandName;
                final String targetBandDescription;
                final int dataType;
                final String unit;
                final double scalingFactor;
                final double scalingOffset;
                if (doRadToRefl) {
                    targetBandName = sourceBand.getName().replace("radiance", "reflec");
                    targetBandDescription = "Radiometry-corrected TOA reflectance";
                    dataType = ProductData.TYPE_FLOAT32;
                    unit = UNIT_DL;
                    scalingFactor = 1.0;
                    scalingOffset = 0;
                } else {
                    targetBandName = sourceBand.getName();
                    targetBandDescription = "Radiometry-corrected TOA radiance";
                    dataType = sourceBand.getDataType();
                    unit = sourceBand.getUnit();
                    scalingFactor = sourceBand.getScalingFactor();
                    scalingOffset = sourceBand.getScalingOffset();
                }
                final Band targetBand = targetProduct.addBand(targetBandName, dataType);
                targetBand.setScalingFactor(scalingFactor);
                targetBand.setScalingOffset(scalingOffset);
                targetBand.setDescription(targetBandDescription);
                targetBand.setUnit(unit);
                targetBand.setValidPixelExpression(sourceBand.getValidPixelExpression());
                ProductUtils.copySpectralBandProperties(sourceBand, targetBand);
            }
        }
        productConfigurer.copyBands(MERIS_DETECTOR_INDEX_DS_NAME, MERIS_L1B_FLAGS_DS_NAME);
        for (final Band sourceBand : sourceProduct.getBands()) {
            if (sourceBand.getSpectralBandIndex() == -1 && !targetProduct.containsBand(sourceBand.getName())) {
                productConfigurer.copyBands(sourceBand.getName());
            }
        }
    }

Output:
    protected void configureTargetProduct(ProductConfigurer productConfigurer) {
        productConfigurer.copyMetadata();
        productConfigurer.copyTimeCoding();
        productConfigurer.copyTiePointGrids();
        productConfigurer.copyGeoCoding();
        Product targetProduct = productConfigurer.getTargetProduct();
        targetProduct.setName(sourceProduct.getName());
        if (doRadToRefl) {
            targetProduct.setProductType(String.format("%s_REFL", sourceProduct.getProductType()));
            targetProduct.setAutoGrouping("reflec");
        } else {
            targetProduct.setProductType(sourceProduct.getProductType());
            targetProduct.setAutoGrouping("radiance");
        }
        targetProduct.setDescription("MERIS L1b Radiometric Correction");
        for (final Band sourceBand : sourceProduct.getBands()) {
            if (sourceBand.getSpectralBandIndex() != -1) {
                final String targetBandName;
                final String targetBandDescription;
                final int dataType;
                final String unit;
                final double scalingFactor;
                final double scalingOffset;
                if (doRadToRefl) {
                    targetBandName = sourceBand.getName().replace("radiance", "reflec");
                    targetBandDescription = "Radiometry-corrected TOA reflectance";
                    dataType = ProductData.TYPE_FLOAT32;
                    unit = UNIT_DL;
                    scalingFactor = 1.0;
                    scalingOffset = 0;
                } else {
                    targetBandName = sourceBand.getName();
                    targetBandDescription = "Radiometry-corrected TOA radiance";
                    dataType = sourceBand.getDataType();
                    unit = sourceBand.getUnit();
                    scalingFactor = sourceBand.getScalingFactor();
                    scalingOffset = sourceBand.getScalingOffset();
                }
                final Band targetBand = targetProduct.addBand(targetBandName, dataType);
                targetBand.setScalingFactor(scalingFactor);
                targetBand.setScalingOffset(scalingOffset);
                targetBand.setDescription(targetBandDescription);
                targetBand.setUnit(unit);
                targetBand.setValidPixelExpression(sourceBand.getValidPixelExpression());
                ProductUtils.copySpectralBandProperties(sourceBand, targetBand);
            }
        }
        productConfigurer.copyBands(MERIS_DETECTOR_INDEX_DS_NAME, MERIS_L1B_FLAGS_DS_NAME);
        for (final Band sourceBand : sourceProduct.getBands()) {
            if (sourceBand.getSpectralBandIndex() == -1 && !targetProduct.containsBand(sourceBand.getName())) {
                productConfigurer.copyBands(sourceBand.getName());
            }
        }
    }


Input:
	private void populateExtendedAggrInfo( String name, IAggregation aggrFunc,
			IConfigurationElement elem, AggrFunctionWrapper aggrWrapper )
	{
		IConfigurationElement[] uiInfo = elem.getChildren( ELEMENT_UIINFO );
		assert ( uiInfo != null && uiInfo.length == 1 );
		String paramInfo = uiInfo[0].getAttribute( ATTRIBUTE_PARAMETER_META_INFO );
		String textInfo = uiInfo[0].getAttribute( ATTRIBUTE_TEXT_DATA );
		aggrWrapper.setDisplayName( textInfo );
		List paramList = new ArrayList( );
		String[] paramInfos = paramInfo.split( "," );
		boolean[] paramFlags = aggrFunc.getParameterDefn( );
		if ( paramInfos != null && paramInfos.length > 0 )
		{
			populateDataFiledParameterDefn( paramList );
			for ( int k = 0; k < paramInfos.length; k++ )
			{
				final String s = paramInfos[k].trim( );
				int index = s.indexOf( ' ' );
				String paramName = null;
				if ( index > 0 )
				{
					paramName = s.substring( index + 1 ).trim( );
				}
				else
				{
					paramName = paramInfos[k];
				}
				if ( k + 1 >= paramFlags.length )
				{
					break;
				}
				ParameterDefn paramDefn = new ParameterDefn( paramName,
						paramName,
						!paramFlags[k + 1],
						false );
				paramList.add( paramDefn );
			}
		}
		aggrWrapper.setParameterDefn( null );
	}

Output:
	private void populateExtendedAggrInfo( String name, IAggregation aggrFunc,
			IConfigurationElement elem, AggrFunctionWrapper aggrWrapper )
	{
		IConfigurationElement[] uiInfo = elem.getChildren( ELEMENT_UIINFO );
		assert ( uiInfo != null && uiInfo.length == 1 );
		String paramInfo = uiInfo[0].getAttribute( ATTRIBUTE_PARAMETER_META_INFO );
		String textInfo = uiInfo[0].getAttribute( ATTRIBUTE_TEXT_DATA );
		aggrWrapper.setDisplayName( textInfo );
		List paramList = new ArrayList( );
		String[] paramInfos = paramInfo.split( "," );
		boolean[] paramFlags = aggrFunc.getParameterDefn( );
		if ( paramInfos != null && paramInfos.length > 0 )
		{
			populateDataFiledParameterDefn( paramList );
			for ( int k = 0; k < paramInfos.length; k++ )
			{
				final String s = paramInfos[k].trim( );
				int index = s.indexOf( ' ' );
				String paramName = null;
				if ( index > 0 )
				{
					paramName = s.substring( index + 1 ).trim( );
				}
				else
				{
					paramName = paramInfos[k];
				}
				if ( k + 1 >= paramFlags.length )
				{
					break;
				}
				ParameterDefn paramDefn = new ParameterDefn( paramName,
						paramName,
						!paramFlags[k + 1],
						false );
				paramList.add( paramDefn );
			}
		}
		IParameterDefn[] params = new IParameterDefn[paramList.size( )];
		paramList.toArray( params );
		aggrWrapper.setParameterDefn( params );
	}


Input:
    public void onEnable() {
        this.settings = new Settings(this);
        if (this.getSettings().useMySQL()) {
            if (!this.initMySQL()) {
                this.getLogger().severe("Something is wrong with the MySQL database, switching to flatfile!");
                this.getSettings().setUseMySQL(false);
            }
        }
        this.warpManager = new WarpManager(this);
        this.getCommand("sortal").setExecutor(new SortalExecutor(this));
        this.getServer().getPluginManager().registerEvents(new EventListener(this), this);
        if(!this.initVault()){
            this.getLogger().info("Vault error or not found, setting costs to 0!");
            this.getSettings().setWarpCreatePrice(0);
            this.getSettings().setWarpUsePrice(0);
        }else{
            this.getLogger().info("Hooked into Vault and Economy plugin succesfully!");
        }
        this.getServer().getScheduler().runTaskTimerAsynchronously(this, new Runnable(){
            public void run() {
                saveData();
                }
        }, 36000L, 36000L);
        this.startMetrics();
        if(this.getSettings().isUpdate()){
            new Updater(this, "sortal", this.getFile(), Updater.UpdateType.DEFAULT, true);
        }
        this.getServer().getPluginManager().getPermission("sortal.warp").setDefault(PermissionDefault.getByName(this.getSettings().getDefaultWarp()));
        this.getServer().getPluginManager().getPermission("sortal.createwarp").setDefault(PermissionDefault.getByName(this.getSettings().getDefaultCreateWarp()));
        this.getServer().getPluginManager().getPermission("sortal.delwarp").setDefault(PermissionDefault.getByName(this.getSettings().getDefaultDelWarp()));
        this.getServer().getPluginManager().getPermission("sortal.list").setDefault(PermissionDefault.getByName(this.getSettings().getDefaultList()));
        this.getServer().getPluginManager().getPermission("sortal.unregister").setDefault(PermissionDefault.getByName(this.getSettings().getDefaultUnregister()));
        this.getServer().getPluginManager().getPermission("sortal.directwarp").setDefault(PermissionDefault.getByName(this.getSettings().getDefaultDirectWarp()));
        this.getServer().getPluginManager().getPermission("sortal.placesign").setDefault(PermissionDefault.getByName(this.getSettings().getDefaultPlaceSign()));
        this.getServer().getPluginManager().getPermission("sortal.setuses").setDefault(PermissionDefault.getByName(this.getSettings().getDefaultSetUses()));
        this.getLogger().log(Level.INFO, String.format("Version %s build %s loaded!", this.getSettings().getVersion(), this.getDescription().getVersion()));
    }

Output:
    public void onEnable() {
        this.settings = new Settings(this);
        if (this.getSettings().useMySQL()) {
            if (!this.initMySQL()) {
                this.getLogger().severe("Something is wrong with the MySQL database, switching to flatfile!");
                this.getSettings().setUseMySQL(false);
            }
        }
        this.warpManager = new WarpManager(this);
        this.getCommand("sortal").setExecutor(new SortalExecutor(this));
        this.getServer().getPluginManager().registerEvents(new EventListener(this), this);
        if(!this.initVault()){
            this.getLogger().info("Vault error or not found, setting costs to 0!");
            this.getSettings().setWarpCreatePrice(0);
            this.getSettings().setWarpUsePrice(0);
        }else{
            this.getLogger().info("Hooked into Vault and Economy plugin succesfully!");
        }
        this.getServer().getScheduler().runTaskTimerAsynchronously(this, new Runnable(){
            public void run() {
                saveData();
            }
        }, 36000L, 36000L);
        this.startMetrics();
        if(this.getSettings().isUpdate()){
            new Updater(this, "sortal", this.getFile(), Updater.UpdateType.DEFAULT, true);
        }
        this.getServer().getPluginManager().getPermission("sortal.warp").setDefault(PermissionDefault.getByName(this.getSettings().getDefaultWarp()));
        this.getServer().getPluginManager().getPermission("sortal.createwarp").setDefault(PermissionDefault.getByName(this.getSettings().getDefaultCreateWarp()));
        this.getServer().getPluginManager().getPermission("sortal.delwarp").setDefault(PermissionDefault.getByName(this.getSettings().getDefaultDelWarp()));
        this.getServer().getPluginManager().getPermission("sortal.list").setDefault(PermissionDefault.getByName(this.getSettings().getDefaultList()));
        this.getServer().getPluginManager().getPermission("sortal.unregister").setDefault(PermissionDefault.getByName(this.getSettings().getDefaultUnregister()));
        this.getServer().getPluginManager().getPermission("sortal.directwarp").setDefault(PermissionDefault.getByName(this.getSettings().getDefaultDirectWarp()));
        this.getServer().getPluginManager().getPermission("sortal.placesign").setDefault(PermissionDefault.getByName(this.getSettings().getDefaultPlaceSign()));
        this.getServer().getPluginManager().getPermission("sortal.setuses").setDefault(PermissionDefault.getByName(this.getSettings().getDefaultSetUses()));
        this.getLogger().log(Level.INFO, String.format("Version %s build %s loaded!", this.getSettings().getVersion(), this.getDescription().getVersion()));
    }


Input:
    public synchronized void all(ServerSession remote, Message message) {
        if (message != null) {
        	if (messages.containsKey(message.getChannel())) {
        		messages.put(message.getChannel(), messages.get(message.getChannel())+1);
        	} else {
        		messages.put(message.getChannel(), 1);
        	}
        	if (log_messages) {
        		System.err.println(message.getJSON());
        	}
        	Object pageObj = message.get("page");
    		if (pageObj instanceof String) {
    			String page = (String)pageObj;
    			page = page.startsWith("http://") ? page.substring(7) : page;
    			page = page.startsWith("www") ? page.substring(3) : page;
    			page = page.startsWith("kabbalahgroup.info/internet/") ? page.substring(28) : page;
    			page = page.startsWith("localhost:3000/") ? page.substring(15) : page;
    			String language = page.substring(0, 2);
    			page = page.substring(2, page.length());
    			page = page.startsWith("#") ? page.substring(1) : page;
    			Map<String, Set<ServerSession>> page_data = null;
    			Set<ServerSession> sessions = null;
    			page_data = pages.get(page);
    			if (page_data == null) {
    				page_data = new TreeMap<String, Set<ServerSession>>();
    			}
    			sessions = page_data.get(language);
    			if (sessions == null) {
    				sessions = new HashSet<ServerSession>();
    			}
    			sessions.add(remote);
    			page_data.put(language, sessions);
    			pages.put(page, page_data);
        		if (users.containsKey(remote)) {
        			String[] lang_page = users.get(remote);
        			if (lang_page == null || lang_page.length < 2 ||
        				lang_page[0].compareTo(language) != 0 ||
        				lang_page[1].compareTo(page) != 0) {
		                Map<String, Set<ServerSession>> pages_page_data = pages.get(users.get(remote)[1]);
		                Set<ServerSession> pages_sessions = pages_page_data.get(language);
		                pages_sessions.remove(remote);
		            	if (pages_sessions.size() == 0) {
		            		pages_page_data.remove(language);
		            		if (pages_page_data.size() == 0) {
		            			pages.remove(users.get(remote));
		            		}
		            	}
        			}
        		}
    			users.put(remote, new String[] {language, page});
        	}
        }
        update();
    }

Output:
    public synchronized void all(ServerSession remote, Message message) {
        if (message != null) {
        	if (messages.containsKey(message.getChannel())) {
        		messages.put(message.getChannel(), messages.get(message.getChannel())+1);
        	} else {
        		messages.put(message.getChannel(), 1);
        	}
        	if (log_messages) {
        		System.err.println(message.getJSON());
        	}
        	Object pageObj = message.get("page");
    		if (pageObj instanceof String) {
    			String page = (String)pageObj;
    			page = page.startsWith("http://") ? page.substring(7) : page;
    			page = page.startsWith("www") ? page.substring(3) : page;
    			page = page.startsWith("kabbalahgroup.info/internet/") ? page.substring(28) : page;
    			page = page.startsWith("localhost:3000/") ? page.substring(15) : page;
    			String language = page.substring(0, 2);
    			page = page.substring(2, page.length());
    			page = page.startsWith("#") ? page.substring(1) : page;
    			Map<String, Set<ServerSession>> page_data = null;
    			Set<ServerSession> sessions = null;
    			page_data = pages.get(page);
    			if (page_data == null) {
    				page_data = new TreeMap<String, Set<ServerSession>>();
    			}
    			sessions = page_data.get(language);
    			if (sessions == null) {
    				sessions = new HashSet<ServerSession>();
    			}
    			sessions.add(remote);
    			page_data.put(language, sessions);
    			pages.put(page, page_data);
        		if (users.containsKey(remote)) {
        			String[] lang_page = users.get(remote);
        			if (lang_page == null || lang_page.length < 2 ||
        				lang_page[0].compareTo(language) != 0 ||
        				lang_page[1].compareTo(page) != 0) {
		                Map<String, Set<ServerSession>> pages_page_data = pages.get(users.get(remote)[1]);
		                Set<ServerSession> pages_sessions = pages_page_data.get(users.get(remote)[0]);
		                pages_sessions.remove(remote);
		            	if (pages_sessions.size() == 0) {
		            		pages_page_data.remove(language);
		            		if (pages_page_data.size() == 0) {
		            			pages.remove(users.get(remote));
		            		}
		            	}
        			}
        		}
    			users.put(remote, new String[] {language, page});
        	}
        }
        update();
    }


Input:
    public void readResourceTypes() throws ConfigurationException {
        try {
            DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder(true);
            Configuration config;
            config = builder.buildFromFile(resourceTypeConfigFile);
            if (log.isDebugEnabled()) log.debug("Resource types config file: " + resourceTypeConfigFile);
            Configuration resourceTypes[] = config.getChildren("resource-type");
            for (int i = 0; i < resourceTypes.length; i++) {
                try {
                    String packageName = resourceTypes[i].getAttribute("package");
                    log.info("Package: " + packageName);
                    URL packageURL = ResourceTypeRegistry.class.getClassLoader().getResource(packageName.replace('.','/'));
                    log.info("Package: " + packageURL.getFile());
                    File jarFile = new File(packageURL.getPath().substring(5, packageURL.getPath().indexOf("!")));
                    log.debug("Jar file: " + jarFile);
                    if (jarFile.isFile()) {
                        java.util.zip.ZipFile zipFile = new java.util.zip.ZipFile(jarFile);
                        java.util.Enumeration entries = zipFile.entries();
                        while (entries.hasMoreElements()) {
                            String entryName = ((java.util.zip.ZipEntry) entries.nextElement()).getName();
                            if (entryName.indexOf("resource.xml") >= 0 || entryName.indexOf("resource-") >= 0) {
                                log.info("Resource definition: " + entryName);
                                URL resourceURL = ResourceTypeRegistry.class.getClassLoader().getResource(entryName);
                                log.info("Resource config URL: " + resourceURL);
                                try {
                                    ResourceTypeDefinition rtd = new ResourceTypeDefinition(resourceURL.openStream());
                                    log.debug("Universal Name: " + rtd.getResourceTypeUniversalName());
                                    log.debug("Classname: " + rtd.getResourceTypeClassname());
                                    hm.put(rtd.getResourceTypeUniversalName(), rtd);
                                } catch (Exception exception) {
                                    log.error("Exception re registring resource with package '" + packageName + "' and resource definition URL '" + resourceURL + "'!");
                                    log.error(exception, exception);
                                }
                            }
                        }
                    } else {
                        log.error("No such file: " + jarFile);
                    }
                } catch (Exception e) {
                    log.info("No package attribute, hence try src attribute...");
                    File resConfigFile = new File(resourceTypes[i].getAttribute("src"));
                    log.info("Source: " + resConfigFile);
                    if (!resConfigFile.isAbsolute()) {
                        resConfigFile = FileUtil.file(resourceTypeConfigFile.getParentFile().getAbsolutePath(), resourceTypes[i].getAttribute("src"));
                    }
                    if (resConfigFile.isDirectory()) {
                        File resDir = resConfigFile;
                        Iterator iter = FileUtils.listFiles(resDir, new WildcardFilter("resource*.xml"), null).iterator();
                        while (iter.hasNext()) {
                            resConfigFile = (File)iter.next();
                            log.debug("found resource config: " + resConfigFile);
                            ResourceTypeDefinition rtd = new ResourceTypeDefinition(resConfigFile);
                            if (log.isDebugEnabled()) {
                                log.debug("Universal Name: " + rtd.getResourceTypeUniversalName());
                                log.debug("Classname: " + rtd.getResourceTypeClassname());
                            }
                            hm.put(rtd.getResourceTypeUniversalName(), rtd);
                        }
                    } else if (resConfigFile.isFile()) {
                        ResourceTypeDefinition rtd = new ResourceTypeDefinition(resConfigFile);
                        if (log.isDebugEnabled()) {
                            log.debug("Universal Name: " + rtd.getResourceTypeUniversalName());
                            log.debug("Classname: " + rtd.getResourceTypeClassname());
                        }
                        hm.put(rtd.getResourceTypeUniversalName(), rtd);
                    } else {
                        log.error("No such file or directory: " + resConfigFile);
                    }
                }
            }
        } catch (Exception e) {
            String errorMsg = "Failure while reading configuration: " + e.getMessage();
            log.error(errorMsg, e);
            throw new ConfigurationException(errorMsg, e);
        }
    }

Output:
    public void readResourceTypes() throws ConfigurationException {
        try {
            DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder(true);
            Configuration config;
            config = builder.buildFromFile(resourceTypeConfigFile);
            if (log.isDebugEnabled()) log.debug("Resource types config file: " + resourceTypeConfigFile);
            Configuration resourceTypes[] = config.getChildren("resource-type");
            for (int i = 0; i < resourceTypes.length; i++) {
                try {
                    String packageName = resourceTypes[i].getAttribute("package");
                    log.info("Package: " + packageName);
                    URL packageURL = ResourceTypeRegistry.class.getClassLoader().getResource(packageName.replace('.','/'));
                    log.info("Package: " + packageURL.getFile());
                    File jarFile = new File(packageURL.getPath().substring(5, packageURL.getPath().indexOf("!")));
                    log.debug("Jar file: " + jarFile);
                    if (jarFile.isFile()) {
                        java.util.zip.ZipFile zipFile = new java.util.zip.ZipFile(jarFile);
                        java.util.Enumeration entries = zipFile.entries();
                        while (entries.hasMoreElements()) {
                            String entryName = ((java.util.zip.ZipEntry) entries.nextElement()).getName();
                            if (entryName.indexOf("resource.xml") >= 0 || entryName.indexOf("resource-") >= 0) {
                                log.info("Resource definition: " + entryName);
                                URL resourceURL = ResourceTypeRegistry.class.getClassLoader().getResource(entryName);
                                log.info("Resource config URL: " + resourceURL);
                                try {
                                    ResourceTypeDefinition rtd = new ResourceTypeDefinition(resourceURL.openStream());
                                    log.debug("Universal Name: " + rtd.getResourceTypeUniversalName());
                                    log.debug("Classname: " + rtd.getResourceTypeClassname());
                                    hm.put(rtd.getResourceTypeUniversalName(), rtd);
                                } catch (Exception exception) {
                                    log.error("Exception re registring resource with package '" + packageName + "' and resource definition URL '" + resourceURL + "'!");
                                    log.error(exception, exception);
                                }
                            }
                        }
                    } else {
                        log.error("No such file: " + jarFile);
                    }
                } catch (Exception e) {
                    log.info("No package attribute, hence try src attribute...");
                    File resConfigFile = new File(resourceTypes[i].getAttribute("src"));
                    log.info("Source: " + resConfigFile);
                    if (!resConfigFile.isAbsolute()) {
                        resConfigFile = FileUtil.file(resourceTypeConfigFile.getParentFile().getAbsolutePath(), resourceTypes[i].getAttribute("src"));
                    }
                    if (resConfigFile.isDirectory()) {
                        File resDir = resConfigFile;
                        Iterator iter = FileUtils.listFiles(resDir, new WildcardFilter("resource*.xml"), null).iterator();
                        while (iter.hasNext()) {
                            resConfigFile = (File)iter.next();
                            log.debug("found resource config: " + resConfigFile);
                            ResourceTypeDefinition rtd = new ResourceTypeDefinition(resConfigFile);
                            if (log.isDebugEnabled()) {
                                log.debug("Universal Name: " + rtd.getResourceTypeUniversalName());
                                log.debug("Classname: " + rtd.getResourceTypeClassname());
                            }
                            hm.put(rtd.getResourceTypeUniversalName(), rtd);
                        }
                    } else if (resConfigFile.isFile()) {
                        ResourceTypeDefinition rtd = new ResourceTypeDefinition(resConfigFile);
                        if (log.isDebugEnabled()) {
                            log.debug("Universal Name: " + rtd.getResourceTypeUniversalName());
                            log.debug("Classname: " + rtd.getResourceTypeClassname());
                        }
                        hm.put(rtd.getResourceTypeUniversalName(), rtd);
                    } else {
                        log.error("No such file or directory: " + resConfigFile);
                    }
                }
            }
        } catch (Exception e) {
            log.error(e, e);
            String errorMsg = "Failure while reading configuration: " + e.getMessage();
            throw new ConfigurationException(errorMsg, e);
        }
    }


Input:
		public final Void call() throws Exception {
			if (isDone()) throw new IllegalStateException("This task is already done!");
			$IN $a = $src.readNow();
			if ($a == null) return null;
			$OUT $b = run($a);
			if ($b == null) return null;
			$sink.write($b);
			return null;
		}

Output:
		public final Void call() throws Exception {
			if (isDone()) return null;
			$IN $a = $src.readNow();
			if ($a == null) return null;
			$OUT $b = run($a);
			if ($b == null) return null;
			$sink.write($b);
			return null;
		}


Input:
    public void run() {
        while (!this.done) {
            synchronized (listLock) {
                LOG.trace("Iterating through decommissioned clients...");
                List<HttpClient> clientsToRemove = new ArrayList<HttpClient>();
                for (HttpClient client : clientList) {
                    String clientId = client.getParams().getParameter(CLIENT_INSTANCE_ID).toString();
                    if (userManager.hasUsers(clientId)) {
                        LOG.warn("Failed to shutdown connection pool client {} due to a connection still in " +
                                "use after last reconfiguration of Repose.", clientId);
                        break;
                    }
                    PoolingClientConnectionManager connMan = (PoolingClientConnectionManager) client.getConnectionManager();
                    PoolStats stats = connMan.getTotalStats();
                    if (stats.getLeased() == 0) {
                        LOG.debug("Shutting down client {}", clientId);
                        connMan.shutdown();
                        clientsToRemove.add(client);
                    }
                }
                for(HttpClient client: clientsToRemove) {
                    clientList.remove(client);
                    LOG.info("HTTP connection pool {} has been destroyed.", client.getParams().getParameter(CLIENT_INSTANCE_ID));
                }
            }
            try {
                Thread.sleep(DEFAULT_INTERVAL);
            } catch (InterruptedException ex) {
               break;
            }
        }
        LOG.error("Shutting down decommissioner");
        Thread.currentThread().interrupt();
    }

Output:
    public void run() {
        while (!this.done) {
            synchronized (listLock) {
                LOG.trace("Iterating through decommissioned clients...");
                List<HttpClient> clientsToRemove = new ArrayList<HttpClient>();
                for (HttpClient client : clientList) {
                    String clientId = client.getParams().getParameter(CLIENT_INSTANCE_ID).toString();
                    if (userManager.hasUsers(clientId)) {
                        LOG.warn("Failed to shutdown connection pool client {} due to a connection still in " +
                                "use after last reconfiguration of Repose.", clientId);
                        break;
                    }
                    PoolingClientConnectionManager connMan = (PoolingClientConnectionManager) client.getConnectionManager();
                    PoolStats stats = connMan.getTotalStats();
                    if (stats.getLeased() == 0) {
                        LOG.debug("Shutting down client {}", clientId);
                        connMan.shutdown();
                        clientsToRemove.add(client);
                    }
                }
                for(HttpClient client: clientsToRemove) {
                    clientList.remove(client);
                    LOG.info("HTTP connection pool {} has been destroyed.", client.getParams().getParameter(CLIENT_INSTANCE_ID));
                }
            }
            try {
                Thread.sleep(DEFAULT_INTERVAL);
            } catch (InterruptedException ex) {
               break;
            }
        }
        LOG.info("Shutting down HTTP Client Service Decommissioner");
        Thread.currentThread().interrupt();
    }


Input:
	public void onCreate(Bundle bundle) {
		super.onCreate(bundle);
		mContext = getActivity();
		if (getResources().getBoolean(R.bool.hide_accounts)) {
			PreferenceCategory accounts = (PreferenceCategory) getPreferenceScreen().getPreference(ACCOUNTS_SETTINGS_ID);
			accounts.removeAll();
			accounts.setLayoutResource(R.layout.hidden);
		}
		if (getResources().getBoolean(R.bool.hide_wizard)) {
			Preference wizard = (Preference) getPreferenceScreen().getPreference(WIZARD_SETTINGS_ID);
			wizard.setLayoutResource(R.layout.hidden);
		} else {
			addWizardPreferenceButton();
		}
		if (getResources().getBoolean(R.bool.disable_animations)) {
			uncheckDisableAndHideCheckbox(R.string.pref_animation_enable_key);
		}
		if (!getResources().getBoolean(R.bool.enable_linphone_friends)) {
			PreferenceCategory friends = (PreferenceCategory) getPreferenceScreen().getPreference(FRIENDS_SETTINGS_ID);
			friends.removeAll();
			friends.setLayoutResource(R.layout.hidden);
		}
		addTransportChecboxesListener();
		ecCalibratePref = findPreference(pref_echo_canceller_calibration_key);
		ecCalibratePref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
			public boolean onPreferenceClick(Preference preference) {
				startEcCalibration();
				return false;
			}
		});
		ecPref = (CheckBoxPreference) findPreference(pref_echo_cancellation_key);
		mencPref = (ListPreference) findPreference(pref_media_encryption_key);
		boolean fastCpu = Version.hasFastCpu();
		if (fastCpu) {
			detectAudioCodec(pref_codec_ilbc_key, "iLBC", 8000, 1, false);
			findPreference(pref_codec_speex16_key).setEnabled(true);
		}
		initializeMediaEncryptionPreferences();
		detectAudioCodec(pref_codec_amr_key,"AMR", 8000, 1, false);
		detectAudioCodec(pref_codec_amrwb_key,"AMR-WB", 16000, 1, false);
		detectAudioCodec(R.string.pref_codec_silk16_key,"SILK",16000, 1, true);
		detectAudioCodec(R.string.pref_codec_silk24_key,"SILK",24000, 1, true);
		detectAudioCodec(R.string.pref_codec_g729_key,"G729",8000, 1, true);
		if (!Version.isVideoCapable()) {
			uncheckAndDisableCheckbox(pref_video_enable_key);
		} else {
			if (!AndroidCameraConfiguration.hasFrontCamera()) {
				uncheckDisableAndHideCheckbox(R.string.pref_video_use_front_camera_key);
			}
		}
		if (prefs().getBoolean(LinphoneActivity.PREF_FIRST_LAUNCH,true)) {
			doOnFirstLaunch();
		}
		if (Hacks.hasBuiltInEchoCanceller()) {
			uncheckDisableAndHideCheckbox(R.string.pref_echo_cancellation_key);
			uncheckDisableAndHideCheckbox(R.string.pref_echo_canceller_calibration_key);
		}
		detectVideoCodec(R.string.pref_video_codec_h264_key, "H264");
		if (!Version.hasNeon())
		{
			findPreference(R.string.pref_video_codec_h264_key).setEnabled(false);
			findPreference(R.string.pref_video_codec_h264_key).setDefaultValue(false);
		}
		addEchoPrefsListener();
		if (Hacks.needSoftvolume()) {
			Log.w("Using Audio Hack");
			checkAndDisableCheckbox(R.string.pref_audio_hacks_use_galaxys_hack_key);
		}
		if (!LinphoneManager.getLc().isTunnelAvailable()) {
			hidePreferenceCategory(R.string.pref_tunnel_key);
		}
		if (getResources().getBoolean(R.bool.hide_camera_settings)) {
			PreferenceScreen screen = getPreferenceScreen();
			PreferenceCategory videoSettings = (PreferenceCategory) screen.getPreference(CAMERA_SETTINGS_ID);
			videoSettings.removeAll();
			videoSettings.setLayoutResource(R.layout.hidden);
			Preference enableVideo = findPreference(R.string.pref_video_enable_key);
			enableVideo.setLayoutResource(R.layout.hidden);
		}
		if (getResources().getBoolean(R.bool.display_about_in_settings)) {
			getPreferenceScreen().getPreference(ABOUT_SETTINGS_ID).setOnPreferenceClickListener(new OnPreferenceClickListener() {
				@Override
				public boolean onPreferenceClick(Preference preference) {
					if (LinphoneActivity.isInstanciated()) {
						LinphoneActivity.instance().displayAbout();
						return true;
					}
					return false;
				}
			});
		} else {
			getPreferenceScreen().getPreference(ABOUT_SETTINGS_ID).setLayoutResource(R.layout.hidden);
		}
	}

Output:
	public void onCreate(Bundle bundle) {
		super.onCreate(bundle);
		mContext = getActivity();
		if (getResources().getBoolean(R.bool.hide_accounts)) {
			PreferenceCategory accounts = (PreferenceCategory) getPreferenceScreen().getPreference(ACCOUNTS_SETTINGS_ID);
			accounts.removeAll();
			accounts.setLayoutResource(R.layout.hidden);
		}
		if (getResources().getBoolean(R.bool.hide_wizard)) {
			Preference wizard = (Preference) getPreferenceScreen().getPreference(WIZARD_SETTINGS_ID);
			wizard.setLayoutResource(R.layout.hidden);
		} else {
			addWizardPreferenceButton();
		}
		if (getResources().getBoolean(R.bool.disable_animations)) {
			uncheckDisableAndHideCheckbox(R.string.pref_animation_enable_key);
		}
		if (!getResources().getBoolean(R.bool.enable_linphone_friends)) {
			PreferenceCategory friends = (PreferenceCategory) getPreferenceScreen().getPreference(FRIENDS_SETTINGS_ID);
			friends.removeAll();
			friends.setLayoutResource(R.layout.hidden);
		}
		addTransportChecboxesListener();
		ecCalibratePref = findPreference(pref_echo_canceller_calibration_key);
		ecCalibratePref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
			public boolean onPreferenceClick(Preference preference) {
				startEcCalibration();
				return false;
			}
		});
		ecPref = (CheckBoxPreference) findPreference(pref_echo_cancellation_key);
		mencPref = (ListPreference) findPreference(pref_media_encryption_key);
		boolean fastCpu = Version.hasFastCpu();
		if (fastCpu) {
			detectAudioCodec(pref_codec_ilbc_key, "iLBC", 8000, 1, false);
			findPreference(pref_codec_speex16_key).setEnabled(true);
		}
		initializeMediaEncryptionPreferences();
		detectAudioCodec(pref_codec_amr_key,"AMR", 8000, 1, false);
		detectAudioCodec(pref_codec_amrwb_key,"AMR-WB", 16000, 1, false);
		detectAudioCodec(R.string.pref_codec_silk16_key,"SILK",16000, 1, true);
		detectAudioCodec(R.string.pref_codec_silk24_key,"SILK",24000, 1, true);
		detectAudioCodec(R.string.pref_codec_g729_key,"G729",8000, 1, true);
		if (!Version.isVideoCapable()) {
			uncheckAndDisableCheckbox(pref_video_enable_key);
		} else {
			if (!AndroidCameraConfiguration.hasFrontCamera()) {
				uncheckDisableAndHideCheckbox(R.string.pref_video_use_front_camera_key);
			}
		}
		if (prefs().getBoolean(LinphoneActivity.PREF_FIRST_LAUNCH,true)) {
			doOnFirstLaunch();
		}
		if (Hacks.hasBuiltInEchoCanceller()) {
			uncheckDisableAndHideCheckbox(R.string.pref_echo_cancellation_key);
			findPreference(R.string.pref_echo_canceller_calibration_key).setLayoutResource(R.layout.hidden);
		}
		detectVideoCodec(R.string.pref_video_codec_h264_key, "H264");
		if (!Version.hasNeon())
		{
			findPreference(R.string.pref_video_codec_h264_key).setEnabled(false);
			findPreference(R.string.pref_video_codec_h264_key).setDefaultValue(false);
		}
		addEchoPrefsListener();
		if (Hacks.needSoftvolume()) {
			Log.w("Using Audio Hack");
			checkAndDisableCheckbox(R.string.pref_audio_hacks_use_galaxys_hack_key);
		}
		if (!LinphoneManager.getLc().isTunnelAvailable()) {
			hidePreferenceCategory(R.string.pref_tunnel_key);
		}
		if (getResources().getBoolean(R.bool.hide_camera_settings)) {
			PreferenceScreen screen = getPreferenceScreen();
			PreferenceCategory videoSettings = (PreferenceCategory) screen.getPreference(CAMERA_SETTINGS_ID);
			videoSettings.removeAll();
			videoSettings.setLayoutResource(R.layout.hidden);
			Preference enableVideo = findPreference(R.string.pref_video_enable_key);
			enableVideo.setLayoutResource(R.layout.hidden);
		}
		if (getResources().getBoolean(R.bool.display_about_in_settings)) {
			getPreferenceScreen().getPreference(ABOUT_SETTINGS_ID).setOnPreferenceClickListener(new OnPreferenceClickListener() {
				@Override
				public boolean onPreferenceClick(Preference preference) {
					if (LinphoneActivity.isInstanciated()) {
						LinphoneActivity.instance().displayAbout();
						return true;
					}
					return false;
				}
			});
		} else {
			getPreferenceScreen().getPreference(ABOUT_SETTINGS_ID).setLayoutResource(R.layout.hidden);
		}
	}