Java Code Examples for org.apache.commons.lang.StringEscapeUtils.unescapeJava()

The following are Jave code examples for showing how to use unescapeJava() of the org.apache.commons.lang.StringEscapeUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: aliyun-maxcompute-data-collectors   File: DirectNetezzaManager.java   View Source Code Vote up 6 votes
private void checkNullValueStrings(String nullStrValue,
    String nullNonStrValue) throws IOException {

  if (!StringUtils.equals(nullStrValue, nullNonStrValue)) {
      throw new IOException(
        "Detected different values of --input-string and --input-non-string "
        + "parameters. Netezza direct manager does not support that. Please "
        + "either use the same values or omit the --direct parameter.");
  }


  // Null String values cannot be more 4 chars in length in the case
  // Netezza external tables.

  if (nullStrValue != null)  {
    nullStrValue = StringEscapeUtils.unescapeJava(nullStrValue);
    if (nullStrValue.length() > 4) {
      throw new IOException(
          "Null string (and null non string) values for Netezza direct mode"
        + " manager must be less than 4 characters in length");
    }
    options.getConf().set(NETEZZA_NULL_VALUE, nullStrValue);
  }
}