stagesupport/src/main/java/com/streamsets/datacollector/util/EscapeUtil.java
public static String getLastFieldNameFromPath(String path) {
    String [] pathSplit = (path != null) ? path.split("/") : null;
    if(pathSplit != null && pathSplit.length > 0) {
      String lastFieldName = pathSplit[pathSplit.length - 1];

      //handle special case field name containing slash eg. /'foo/bar'
      boolean singleQuoted = lastFieldName.charAt(0) == QUOTE_CHAR
          && lastFieldName.charAt(lastFieldName.length() - 1) == QUOTE_CHAR;

      if(lastFieldName.contains("'") && !singleQuoted) {
        //If path contains slash inside name, split it by "/'"
        pathSplit = path.split("/'");
        if(pathSplit.length > 0) {
          lastFieldName = "'" + pathSplit[pathSplit.length - 1];
          singleQuoted = true;
        }
      }

      if (singleQuoted) {
        return singleQuoteUnescape(lastFieldName);
      } else {
        return lastFieldName;
      }
    }
    return path;
  }
public static String getLastFieldNameFromPath(String path) {
    String [] pathSplit = (path != null) ? path.split("/") : null;
    if(pathSplit != null && pathSplit.length > 0) {
      String lastFieldName = pathSplit[pathSplit.length - 1];

      //handle special case field name containing slash eg. /'foo/bar'
      boolean singleQuoted = lastFieldName.charAt(0) == QUOTE_CHAR
          && lastFieldName.charAt(lastFieldName.length() - 1) == QUOTE_CHAR;

      if(lastFieldName.contains("'") && !singleQuoted) {
        //If path contains slash inside name, split it by "/'"
        pathSplit = path.split("/'");
        if(pathSplit.length > 0) {
          lastFieldName = "'" + pathSplit[pathSplit.length - 1];
          singleQuoted = true;
        }
      }

      if (singleQuoted) {
        return singleQuoteUnescape(lastFieldName);
      } else {
        return lastFieldName;
      }
    }
    return path;
  }
public static String getLastFieldNameFromPath ( String path ) { String [ ] pathSplit = ( path != null ) ? path . split ( "/" ) : null ; if ( pathSplit != null && pathSplit . length > 0 ) { String lastFieldName = pathSplit [ pathSplit . length - 1 ] ; //handle special case field name containing slash eg. /'foo/bar' boolean singleQuoted = lastFieldName . charAt ( 0 ) == QUOTE_CHAR && lastFieldName . charAt ( lastFieldName . length ( ) - 1 ) == QUOTE_CHAR ; if ( lastFieldName . contains ( "'" ) && ! singleQuoted ) { //If path contains slash inside name, split it by "/'" pathSplit = path . split ( "/'" ) ; if ( pathSplit . length > 0 ) { lastFieldName = "'" + pathSplit [ pathSplit . length - 1 ] ; singleQuoted = true ; } } if ( singleQuoted ) { return singleQuoteUnescape ( lastFieldName ) ; } else { return lastFieldName ; } } return path ; }
This method is used during deserializer and sqpath (Single quote escaped path) is passed to determine the last field name.
This method is used during deserializer and sqpath ( Single quote escaped path ) is passed to determine the last field name .