Mercurial > hg > digilib-old
diff servlet/src/digilib/io/FileOps.java @ 209:f8c82fea551a
Servlet version 1.18b9 -- cleanup and bugfixes
- fixed bug with slow color JPEGs
- better pathname handling
- better filehandle cleanup (hopefully)
author | robcast |
---|---|
date | Fri, 12 Mar 2004 19:52:07 +0100 |
parents | bb4ed821d06e |
children | aaf6eace011d |
line wrap: on
line diff
--- a/servlet/src/digilib/io/FileOps.java Fri Mar 12 19:52:06 2004 +0100 +++ b/servlet/src/digilib/io/FileOps.java Fri Mar 12 19:52:07 2004 +0100 @@ -192,15 +192,18 @@ return null; } int a = 0; - int e = pathname.length(); + int e = pathname.length() - 1; + if (e < 0) { + return pathname; + } // leading and trailing "/" are removed - if (pathname.startsWith("/")) { + while ((a <= e) && (pathname.charAt(a) == '/')) { a++; } - if (pathname.endsWith("/")) { + while ((a < e) && (pathname.charAt(e) == '/')) { e--; } - return pathname.substring(a, e); + return pathname.substring(a, e + 1); }