/[schmitzm]
ViewVC logotype

Revision 1517


Jump to revision: Previous Next
Author: alfonx
Date: Thu Mar 17 23:28:00 2011 UTC (13 years, 11 months ago)
Changed paths: 1
Log Message:
Avoiding an excesiv errormessage in log when trying to download a cached JNLP resource, by making getFilename more error-prone.


	/**
	 * @return the "Filename" of an {@link URL}. e.g.
	 *         <code>http://www.bahn.de/exterme/index.html?k=v</code> returns
	 *         <code>index.html</code><br/>
	 *         <code>http://www.bahn.de/exterme/</code> and
	 *         <code>http://www.bahn.de/exterme<code> both return <code>exterme</code>
	 *         Any Exception will return "";
	 */
	public static String getFilename(URL url) {
		try {
			return new File(url.getPath()).getName();
		} catch (Exception e) {
			LOGGER.debug("Failed to get Filename for URL '" + url
					+ "'. Returning an empty string.", e);
			return "";
		}
	}


Changed paths

Path Details
Directorybranches/2.3.x/src/schmitzm/io/IOUtil.java modified , text changed

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26