code: private static String strip(String in) {
          if (in == null) {
              return null;
          }
          String out = in.trim();
          if (out.length() == 0) {
              return null;
          } else {
              return out;
          }
      }
docs: resulting string is empty in incoming string is null.