/** * Log the specified Throwable. * @param t the Throwable to log. * @since 1.6.2 */ private void log(Throwable t) { log(StringUtils.getStackTrace(t), Project.MSG_ERR); }
/** * Splits up a string into a list of lines. It is equivalent * to <tt>split(data, '\n')</tt>. * @param data the string to split up into lines. * @return the list of lines available in the string. */ public static Vector<String> lineSplit(String data) { return split(data, '\n'); }
public int lastDelimiterPosition(StringBuffer buf, String currentLine) { if (strictDelimiterMatching) { if ((delimiterType.equals(DelimiterType.NORMAL) && StringUtils.endsWith(buf, delimiter)) || (delimiterType.equals(DelimiterType.ROW) && currentLine.equals(delimiter))) {
/** * Escapes backslashes so that they can parse properly. * * @param in - string with backslashes * @return string with backslashes escaped, or null, if passed null */ public static String escapeBackSlashesIfNotNull(String in) { if (in != null) { return StringUtils.replace(in, "\\", "\\\\"); } else { return null; } }
/** * Joins the string representation of the elements of an array to * a joined string with a given separator. * @param array Array of the data to be joined (may be null) * @param separator Separator between elements (may be null) * @return the joined string */ public static String join(Object[] array, CharSequence separator) { if (array == null) { return ""; } return join(Arrays.asList(array), separator); }
/** * Joins the string representation of the elements of a collection to * a joined string with a given separator. * @param collection Collection of the data to be joined (may be null) * @param separator Separator between elements (may be null) * @return the joined string */ public static String join(Collection<?> collection, CharSequence separator) { if (collection == null) { return ""; } return collection.stream().map(String::valueOf) .collect(joining(separator)); }
public static String toWindowsPath(final String path) { if (File.separatorChar != '\\' && path.indexOf(File.separatorChar) != -1) { return StringUtils.replace(path, File.separator, "\\"); } return path; }
@Override public void execute() { if (resources == null) { throw new BuildException("At least one resource-collection is required"); } Resource currentResource = null; try { for (Resource r : resources) { currentResource = r; try { PermissionUtils.setPermissions(r, permissions, this::posixPermissionsNotSupported); } catch (IOException ioe) { maybeThrowException(ioe, "Failed to set permissions on '%s' due to %s", r, ioe.getMessage()); } } } catch (ClassCastException cce) { maybeThrowException(null, "some specified permissions are not of type PosixFilePermission: %s", StringUtils.join(permissions, ", ")); } catch (SecurityException se) { maybeThrowException(null, "the SecurityManager denies role accessUserInformation or write access for SecurityManager.checkWrite for resource '%s'", currentResource); } catch (BuildException be) { // maybe thrown by callback method this::posixPermissionsNotSupported. maybeThrowException(be, be.getMessage()); } }
static void throwableMessage(StringBuffer m, Throwable error, boolean verbose) { while (error instanceof BuildException) { // #43398 Throwable cause = error.getCause(); if (cause == null) { break; } String msg1 = error.toString(); String msg2 = cause.toString(); if (msg1.endsWith(msg2)) { m.append(msg1, 0, msg1.length() - msg2.length()); error = cause; } else { break; } } if (verbose || !(error instanceof BuildException)) { m.append(StringUtils.getStackTrace(error)); } else { m.append(String.format("%s%n", error)); } }
public static String toUnixPath(final String path) { if (File.separatorChar != '/' && path.indexOf(File.separatorChar) != -1) { return StringUtils.replace(path, File.separator, "/"); } return path; }
final List<String> accept = StringUtils.split(validargs, ','); request = new MultipleChoiceInputRequest(message, accept); } else {
/** * read the output stream to retrieve the new task number. * @param is InputStream * @throws IOException on error */ @Override public void setProcessOutputStream(InputStream is) throws IOException { try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) { String buffer = reader.readLine(); if (buffer != null) { log("buffer:" + buffer, Project.MSG_DEBUG); String taskstring = buffer.substring(buffer.indexOf(' ')).trim(); taskstring = taskstring.substring(0, taskstring.lastIndexOf(' ')).trim(); setTask(taskstring); log("task is " + getTask(), Project.MSG_DEBUG); } } catch (NullPointerException npe) { log("error procession stream, null pointer exception", Project.MSG_ERR); log(StringUtils.getStackTrace(npe), Project.MSG_ERR); throw new BuildException(npe); } catch (Exception e) { log("error procession stream " + e.getMessage(), Project.MSG_ERR); throw new BuildException(e.getMessage()); } }
private static String processCommon(String template, Pattern pattern, String replacer) { Matcher m = pattern.matcher(template); String noMatchingParts = m.replaceAll(placeholder); String res = StringUtils.replace(noMatchingParts, placeholder, replacer); return res; }
public List<String> getDependsList() { if (this.depends != null) { return StringUtils.split(this.depends, ','); } return Collections.emptyList(); }
log(StringUtils.getStackTrace(ioe), Project.MSG_ERR); } finally { FileUtils.close(bw);
value = StringUtils.replace(value,"<strong>", "<b>"); value = StringUtils.replace(value,"</strong>", "</b>"); value = StringUtils.replace(value,"<em>", "<i>"); value = StringUtils.replace(value,"</em>", "</i>"); value = StringUtils.replace(value, "</HR>", ""); value = StringUtils.replace(value, "</BR>", ""); value = StringUtils.replace(value, "</IMG>", ""); value = StringUtils.replace(value, "<", "&lt;"); value = StringUtils.replace(value, ">", "&gt;");
if (Project.MSG_DEBUG <= msgOutputLevel && ex != null) { message.append(String.format("%n%s: ", ex.getClass().getSimpleName())) .append(StringUtils.getStackTrace(ex));
value = StringUtils.replace(value,"<b>", "<strong>"); value = StringUtils.replace(value,"</b>", "</strong>"); value = StringUtils.replace(value,"<B>", "<strong>"); value = StringUtils.replace(value,"</B>", "</strong>"); value = StringUtils.replace(value,"<i>", "<em>"); value = StringUtils.replace(value,"</i>", "</em>"); value = StringUtils.replace(value,"<I>", "<em>"); value = StringUtils.replace(value,"</I>", "</em>"); value = StringUtils.replace(value,"<u>", "<span style=\"text-decoration: underline;\">"); value = StringUtils.replace(value,"</u>", "</span>"); value = StringUtils.replace(value,"<U>", "<span style=\"text-decoration: underline;\">"); value = StringUtils.replace(value,"</U>", "</span>"); value = StringUtils.replace(value, "</HR>", ""); value = StringUtils.replace(value, "</BR>", ""); value = StringUtils.replace(value, "</IMG>", ""); value = StringUtils.replace(value, "<@WEB@>", "<@WEB@>");
Text errText = doc.createCDATASection(StringUtils.getStackTrace(t)); Element stacktrace = doc.createElement(STACKTRACE_TAG); stacktrace.appendChild(errText);
} catch (IOException e) { log("An IOException has occurred while trying to execute ejbc."); log(StringUtils.getStackTrace(e)); } catch (InterruptedException e) {