Modify ↓
#11869 closed enhancement (fixed)
Replace CacheFiles by JCS?
Reported by: | simon04 | Owned by: | team |
---|---|---|---|
Priority: | minor | Milestone: | 15.09 |
Component: | Core | Version: | |
Keywords: | Cc: | wiktorn |
Description
While investigating #11867, I came across org.openstreetmap.josm.io.CacheFiles
. This class is only used in ThumbsLoader
and might be replaced by a JCS cache?
Attachments (1)
Change History (5)
by , 9 years ago
Attachment: | cache_files_to_jcs.patch added |
---|
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Some thoughts:
- When the cache initialization fails (
IOException
in the constructor), we will run into NPE while accessing the cache. So check forcache != null
inif (!cacheOff)
(2×)? - Maybe you can give some context for the
Main.warn
calls, e.g., "Thumbnail cache initialization failed" and "Thumbnail cache access failed". - Java 7 provides the
try (ByteArrayOutputStream output = new ByteArrayOutputStream()) { /* ... */ }
construct to automatically close the stream at the end. Might not be necessary forByteArrayOutputStream
, but is used through-out the code …
Note:
See TracTickets
for help on using tickets.
I doesn't look like hard thing. I attach a patch that does this for review. But I didn't it test thoroughly yet.