private void addToList(List<String> expressionsList, String addExpression) { addExpression = addExpression.trim(); if (format != null) { addExpression = String.format(format, addExpression); } if (!StringUtil.isEmpty(addExpression) && !expressionsList.contains(addExpression)) { expressionsList.add(addExpression); } }
/** * Checks if the message is an GreenPepper server tagged Exception. If so an * GreenPepperServerException will be thrown with the error id found. * * @param the error id found. * @throws GreenPepperServerException */ private static void checkErrors(Object object) throws GreenPepperServerException { if (object instanceof Exception) { throw new GreenPepperServerException( GreenPepperServerErrorKey.CALL_FAILED, ((Exception) object).getMessage()); } if (object instanceof String) { String msg = (String) object; if (!StringUtil.isEmpty(msg) && msg.indexOf(GreenPepperServerErrorKey.ERROR) > -1) { String errorId = msg.replace(GreenPepperServerErrorKey.ERROR, ""); if (errorId.startsWith(LicenseErrorKey.LICENSE)) { throw new GreenPepperLicenceException(errorId, errorId); } throw new GreenPepperServerException(errorId, errorId); } } }