protected void validate ( ) { // make sure that the source uri is set correctly. if ( mSourceUri == null ) { throw new BuilderException ( "Source must be set!" ) ; } // For local resource we require caller to specify statically generated resource id as a path. if ( UriUtil . isLocalResourceUri ( mSourceUri ) ) { if ( ! mSourceUri . isAbsolute ( ) ) { throw new BuilderException ( "Resource URI path must be absolute." ) ; } if ( mSourceUri . getPath ( ) . isEmpty ( ) ) { throw new BuilderException ( "Resource URI must not be empty" ) ; } try { Integer . parseInt ( mSourceUri . getPath ( ) . substring ( 1 ) ) ; } catch ( NumberFormatException ignored ) { throw new BuilderException ( "Resource URI path must be a resource id." ) ; } } // For local asset we require caller to specify absolute path of an asset, which will be // resolved by AssetManager relative to configured asset folder of an app. if ( UriUtil . isLocalAssetUri ( mSourceUri ) && ! mSourceUri . isAbsolute ( ) ) { throw new BuilderException ( "Asset URI path must be absolute." ) ; } }
Performs validation .