Esempio n. 1
0
 /**
  * Converts the path to a string array, containing the single segments.
  *
  * @param path path, or {@code null}
  * @return path depth
  */
 public static String[] toSegments(final String path) {
   final StringList sl = new StringList();
   if (path != null) {
     final TokenBuilder tb = new TokenBuilder();
     for (int s = 0; s < path.length(); s++) {
       final char ch = path.charAt(s);
       if (ch == '/') {
         if (tb.isEmpty()) continue;
         sl.add(tb.toString());
         tb.reset();
       } else {
         tb.add(ch);
       }
     }
     if (!tb.isEmpty()) sl.add(tb.toString());
   }
   return sl.toArray();
 }
Esempio n. 2
0
 /**
  * Adds the error message to the message buffer {@link #info}.
  *
  * @param msg error message
  * @param ext error extension
  * @return {@code false}
  */
 protected final boolean error(final String msg, final Object... ext) {
   info.reset();
   info.addExt(msg == null ? "" : msg, ext);
   return false;
 }