src/org/ohmage/domain/Image.java
public boolean urlExists(final URL url) {

		// check for file protocol
	    if (url.getProtocol().equals("file")) {
	    	LOGGER.debug("check via a file protocol");
	    	File file = new File(url.getPath());
	    	if (file.exists())
	    		return true; 
	    	else return false;
	    } else { 
	    	// use the URL method
			try {
				url.openStream().close();
				LOGGER.debug("Size.getURL exists: " + url.toString());
				return true;
			}
			// The file does not exist.
			catch(IOException e) {
				LOGGER.debug("Size.getURL doesn't exists: " + url.toString());
				return false;
			}
	    }

	}
/**
	 * Check whether the URL endpoint exists. If it is the file protocol, 
	 * manually check whether the file exists.
	 * 
	 * @throws DomainException
	 *         The data could not be read or is not valid image data.
	 */
Check whether the URL endpoint exists. If it is the file protocol,
manually check whether the file exists.

@throws DomainException
The data could not be read or is not valid image data.
Check whether the URL endpoint exists . If it is the file protocol manually check whether the file exists . @throws DomainException The data could not be read or is not valid image data .
public boolean urlExists(final URL url) {
	    if (url.getProtocol().equals("file")) {
	    	LOGGER.debug("check via a file protocol");
	    	File file = new File(url.getPath());
	    	if (file.exists())
	    		return true; 
	    	else return false;
	    } else { 
			try {
				url.openStream().close();
				LOGGER.debug("Size.getURL exists: " + url.toString());
				return true;
			}
			catch(IOException e) {
				LOGGER.debug("Size.getURL doesn't exists: " + url.toString());
				return false;
			}
	    }
	}
public boolean urlExists ( final URL url ) { if ( url . getProtocol ( ) . equals ( "file" ) ) { LOGGER . debug ( "check via a file protocol" ) ; File file = new File ( url . getPath ( ) ) ; if ( file . exists ( ) ) return true ; else return false ; } else { try { url . openStream ( ) . close ( ) ; LOGGER . debug ( "Size.getURL exists: " + url . toString ( ) ) ; return true ; } catch ( IOException e ) { LOGGER . debug ( "Size.getURL doesn't exists: " + url . toString ( ) ) ; return false ; } } }
Check whether the URL endpoint exists.
Check whether the URL endpoint exists .
// check for file protocol // use the URL method // The file does not exist.