public static void verifyForHdfsUse(String sb) throws IllegalArgumentException {
        Preconditions.checkArgument(
                sb != null && !sb.trim().isEmpty(),
                "null or empty hdfs endpoint"
                );

        int mask = conversionMaskFor(sb);
        boolean hasDateConversion = (mask & DATE) == DATE;

        Preconditions.checkArgument(
                (mask & HDFS_MASK) == HDFS_MASK,
                "hdfs endpoint \"" + sb
                + "\" must contain the (%t)able, the (%p)artition, and the (%g) generation conversions"
                );

        final String tn = "__IMPROBABLE_TABLE_NAME__";
        final int pn = Integer.MIN_VALUE;
        final long gn = Long.MIN_VALUE;
        final Date dt = new Date(0);
        final String fmtd = hasDateConversion ? new SimpleDateFormat(DATE_FORMAT).format(dt) : "";

        URI uri = URI.create(expand(sb, tn, pn, gn, dt));
        String path = uri.getPath();

        List<String> missing = new ArrayList<>();
        if (!path.contains(tn)) missing.add("%t");
        if (!path.contains(Integer.toString(pn))) missing.add("%p");
        if (!path.contains(Long.toString(gn,Character.MAX_RADIX))) missing.add("%g");
        if (hasDateConversion && !path.contains(fmtd)) missing.add("%d");

        if (!missing.isEmpty()) {
            String notInPath = Joiner.on(", ").join(missing);
            throw new IllegalArgumentException(
                    "hdfs enpoint \"" + sb
                    + "\" does not contain conversion(s) " + notInPath
                    + " in the path element of the URL");
        }
    }
public static void verifyForHdfsUse ( String sb ) throws IllegalArgumentException { Preconditions . checkArgument ( sb != null && ! sb . trim ( ) . isEmpty ( ) , "null or empty hdfs endpoint" ) ; int mask = conversionMaskFor ( sb ) ; boolean hasDateConversion = ( mask & DATE ) == DATE ; Preconditions . checkArgument ( ( mask & HDFS_MASK ) == HDFS_MASK , "hdfs endpoint \"" + sb + "\" must contain the (%t)able, the (%p)artition, and the (%g) generation conversions" ) ; final String tn = "__IMPROBABLE_TABLE_NAME__" ; final int pn = Integer . MIN_VALUE ; final long gn = Long . MIN_VALUE ; final Date dt = new Date ( 0 ) ; final String fmtd = hasDateConversion ? new SimpleDateFormat ( DATE_FORMAT ) . format ( dt ) : "" ; URI uri = URI . create ( expand ( sb , tn , pn , gn , dt ) ) ; String path = uri . getPath ( ) ; List < String > missing = new ArrayList < > ( ) ; if ( ! path . contains ( tn ) ) missing . add ( "%t" ) ; if ( ! path . contains ( Integer . toString ( pn ) ) ) missing . add ( "%p" ) ; if ( ! path . contains ( Long . toString ( gn , Character . MAX_RADIX ) ) ) missing . add ( "%g" ) ; if ( hasDateConversion && ! path . contains ( fmtd ) ) missing . add ( "%d" ) ; if ( ! missing . isEmpty ( ) ) { String notInPath = Joiner . on ( ", " ) . join ( missing ) ; throw new IllegalArgumentException ( "hdfs enpoint \"" + sb + "\" does not contain conversion(s) " + notInPath + " in the path element of the URL" ) ; } }
Verifies that given endpoint format string specifies all the required hdfs
conversions in the path portion of the endpoint.

@param sb format string
@throws IllegalArgumentException when verification fails