public String removeHtmlBreaks(String str) { str = StringUtils.replaceAll(str, "<br>", ""); str = StringUtils.replaceAll(str, "<br/>", ""); str = StringUtils.replaceAll(str, "<br />", ""); str = StringUtils.replaceAll(str, "<p>", ""); str = StringUtils.replaceAll(str, "</p>", ""); return str; }
private String escapeString(String string) { return StringUtils.escapeCP1252(string, encoding); }
public static boolean isStringISO_8859_1(String string) { return isStringOfCharSet(string, "ISO-8859-1"); }
private static boolean isAcceptableNameInt(String workflowName, @Nullable String fieldName, @Nullable ErrorCollection errorCollection) { if (org.apache.commons.lang.StringUtils.isBlank(workflowName)) { addError(errorCollection, fieldName, "admin.errors.you.must.specify.a.workflow.name"); return false; } else if (!StringUtils.isStringAllASCII(workflowName)) { addError(errorCollection, fieldName, "admin.errors.please.use.only.ascii.characters"); return false; } else if (!workflowName.trim().equals(workflowName)) { // JRA-29521 in MSSQL and MySQL (in postgresql and oracle this does not happen) comparison between char and varchar // does not take into account trailing spaces so in those databases 'a' = 'a ' // However those databases returns values for varchar according to ANSI specification with trailing spaces. // Because in JIRA workflow are identified by name when user copied workflow that was only different by // trailing space the java implementation though that this is different name but when OfBizWorkflowDescriptorStore // tried to get the workflow from db it go the original. So when the copy was saved the original was lost // and the data was corrupted. Issues and schema had assigned workflow that no longer exists (the one without space). addError(errorCollection, fieldName, "admin.errors.workflow.name.cannot.contain.leading.or.trailing.whitespaces"); return false; } return true; }
"Windows-1252".equalsIgnoreCase(encoding)) { addMapping(8216, "'", stringChars); addMapping(8217, "'", stringChars); addMapping(8220, "\"", stringChars); addMapping(8221, "\"", stringChars); addMapping(8230, "...", stringChars); addMapping(8211, "-", stringChars); addMapping(183, "- ", stringChars); // replace bullets } else if ("ISO-8859-1".equalsIgnoreCase(encoding)) { addMapping(145, "'", stringChars); addMapping(146, "'", stringChars); addMapping(147, "\"", stringChars); addMapping(148, "\"", stringChars); addMapping(133, "...", stringChars); addMapping(150, "-", stringChars); addMapping(183, "- ", stringChars); // replace bullets continue; // 9, 10, 13 are line feed and carriage return chars } else { addMapping(i, "", stringChars);
char[][] stringChars = getMappings(encoding);
public Validator.Result validate(String value) { String[] fields = value.split(","); ArrayList<String> badFields = new ArrayList<String>(); Collection<String> allowableFields = linkSortFields.get(); for (String f : fields) { String field = f.trim(); if (!allowableFields.contains(field)) { badFields.add(field); } } if (badFields.isEmpty()) { return new Success(value); } else { // TODO i18n String csv = StringUtils.createCommaSeperatedString(allowableFields); return new Failure("Only the following fields are allowed: " + csv); } }
protected void populateVelocityParams(Map params) { params.put("changehistory", this); params.put("metadataHelper", historyMetadataRenderHelper); params.put("stringUtils", new StringUtils()); }
if (!StringUtils.isStringAllASCII(value))
addMapping(8216, "'", stringChars); addMapping(8217, "'", stringChars); addMapping(8220, "\"", stringChars); addMapping(8221, "\"", stringChars); addMapping(8230, "...", stringChars); addMapping(8211, "-", stringChars); addMapping(183, "- ", stringChars); // replace bullets } else if ("ISO-8859-1".equalsIgnoreCase(encoding)) addMapping(145, "'", stringChars); addMapping(146, "'", stringChars); addMapping(147, "\"", stringChars); addMapping(148, "\"", stringChars); addMapping(133, "...", stringChars); addMapping(150, "-", stringChars); addMapping(183, "- ", stringChars); // replace bullets } else addMapping(i, "", stringChars);
char[][] stringChars = getMappings(encoding);
@Override public Result validate(String value) { final Set<String> options = enumerator.getEnumeration(); if (options.contains(value)) { return new Success(value); } else { String csv = StringUtils.createCommaSeperatedString(options); return new Failure("Only the following values are allowed: " + csv); } }
protected void populateVelocityParams(Map params) { params.put("issuecreatedaction", this); params.put("stringUtils", new StringUtils()); params.put("userformat", userFormatManager); params.put("i18n",i18nHelper); }
public static String normalise(String value) { // Replace all instances of '\r\n' with '\n' String normalised = replaceAll(value, "\r\n", "\n"); // As all '\r\n' combinations have been replaced, the only thing that should be left are single '\r' characters (if any) // Replace these with '\n' return replaceAll(normalised, "\r", "\n"); }
private String escapeString(String s) { return StringUtils.escapeCP1252(s, getEncoding()); }
public static boolean isStringISO_8859_1(String string) { return isStringOfCharSet(string, "ISO-8859-1"); }
String mesg = "The following fields are invalid: " + StringUtils.createCommaSeperatedString(badFields); return new Failure(mesg, TextUtils.htmlEncode(mesg));
public static String normalise(String value) { // Replace all instances of '\r\n' with '\n' String normalised = replaceAll(value, "\r\n", "\n"); // As all '\r\n' combinations have been replaced, the only thing that should be left are single '\r' characters (if any) // Replace these with '\n' return replaceAll(normalised, "\r", "\n"); }