#16193 closed defect (fixed)
IAE: "Parameter 'cache' must not be null" opening a saved session file
Reported by: | mpasha | Owned by: | mpasha |
---|---|---|---|
Priority: | normal | Milestone: | 18.04 |
Component: | Core | Version: | latest |
Keywords: | template_report cache | Cc: | wiktorn |
Description (last modified by )
URL:https://josm.openstreetmap.de/svn/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2018-04-15 23:58:36 +0200 (Sun, 15 Apr 2018) Build-Date:2018-04-16 01:32:11 Revision:13640 Relative:URL: ^/trunk Identification: JOSM/1.5 (13640 ru) Windows 10 64-Bit OS Build number: Windows 10 Enterprise 2016 LTSB 1607 (14393) Memory Usage: 240 MB / 989 MB (75 MB allocated, but free) Java version: 1.8.0_131-b11, Oracle Corporation, Java HotSpot(TM) Client VM Screen: \Display0 1366x768 Maximum Screen Size: 1366x768 VM arguments: [-Djosm.home=<josm.pref>] Plugins: + BuildingGeneralization (23) + DirectDownload (34109) + DirectUpload (34109) + FastDraw (34109) + HouseNumberTaggingTool (34109) + Mapillary (v1.5.10) + OpeningHoursEditor (34095) + apache-commons (34109) + apache-http (34109) + buildings_tools (34109) + continuosDownload (68) + contourmerge (1032) + ejml (34126) + geotools (34125) + gson (34038) + imagery_offset_db (34109) + jogl (1.1.0) + jts (34038) + log4j (34038) + merge-overlap (34109) + namemanager (34109) + osm-obj-info (1509723997) + photoadjust (34109) + reltoolbox (34130) + tag2link (34109) + tageditor (34109) + terracer (34109) + utilsplugin2 (34109) Tagging presets: + https://josm.openstreetmap.de/josmfile?page=Presets/NewTags&zip=1 + https://josm.openstreetmap.de/josmfile?page=Presets/Towers&zip=1 + https://josm.openstreetmap.de/josmfile?page=Presets/Quick-stops&zip=1 + https://raw.githubusercontent.com/yopaseopor/traffic_signs_preset_JOSM/master/UA.zip + https://josm.openstreetmap.de/josmfile?page=Presets/Manholes&zip=1 Map paint styles: - https://github.com/GlassOceanos/indoor-JOSM-style/archive/master.zip + https://pasharm.github.io/New_basic_style_for_JOSM/New_basic_style.mapcss - D:\Programs\JOSM_Portable\Map Styles\Test\elemstyles standart JOSM.mapcss - D:\GitHub\New_basic_style_for_JOSM\New_basic_style.mapcss - D:\GitHub\Ones test style JOSM\Ones test.mapcss - D:\GitHub\New_basic_style_for_JOSM\New_basic_style - до reformat code.mapcss Validator rules: - <josm.pref>\validator\indoorhelper.validator.mapcss Last errors/warnings: - W: Already here java.net.UnknownHostException: pasharm.github.io - E: Не удалось найти изображение «https://pasharm.github.io/New_basic_style_for_JOSM/icon/farmland1.png» - W: java.net.UnknownHostException: pasharm.github.io - W: Already here java.net.UnknownHostException: pasharm.github.io - E: Не удалось найти изображение «https://pasharm.github.io/New_basic_style_for_JOSM/icon/farmland1.png» - W: java.net.UnknownHostException: api.openstreetmap.org - E: java.net.UnknownHostException: api.openstreetmap.org - W: org.openstreetmap.josm.io.OsmTransferException: Не удается соединиться с сервером OSM. Пожалуйста, проверьте Ваше интернет-соединение.. Причина: java.net.UnknownHostException: api.openstreetmap.org - W: java.io.IOException: Access denied - E: Handled by bug report queue: java.lang.IllegalArgumentException: Parameter 'cache' must not be null === REPORTED CRASH DATA === BugReportExceptionHandler#handleException: No data collected. Warning issued by: BugReportExceptionHandler#handleException === STACK TRACE === Thread: AWT-EventQueue-0 (17) of main java.lang.IllegalArgumentException: Parameter 'cache' must not be null at org.openstreetmap.josm.tools.CheckParameterUtil.ensureParameterNotNull(CheckParameterUtil.java:69) at org.openstreetmap.josm.data.imagery.CachedTileLoaderFactory.<init>(CachedTileLoaderFactory.java:40) at org.openstreetmap.josm.gui.layer.AbstractCachedTileSourceLayer.<init>(AbstractCachedTileSourceLayer.java:63) at org.openstreetmap.josm.gui.layer.TMSLayer.<init>(TMSLayer.java:55) at org.openstreetmap.josm.gui.layer.ImageryLayer.create(ImageryLayer.java:204) at org.openstreetmap.josm.io.session.ImagerySessionImporter.load(ImagerySessionImporter.java:46) at org.openstreetmap.josm.io.session.SessionReader.parseJos(SessionReader.java:562) at org.openstreetmap.josm.io.session.SessionReader.loadSession(SessionReader.java:744) at org.openstreetmap.josm.io.session.SessionReader.loadSession(SessionReader.java:704) at org.openstreetmap.josm.actions.SessionLoadAction$Loader.realRun(SessionLoadAction.java:180) at org.openstreetmap.josm.gui.PleaseWaitRunnable.doRealRun(PleaseWaitRunnable.java:95) at org.openstreetmap.josm.gui.PleaseWaitRunnable.run(PleaseWaitRunnable.java:143) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748)
Attachments (1)
Change History (15)
by , 7 years ago
comment:1 by , 7 years ago
Cc: | added |
---|---|
Keywords: | cache added |
comment:3 by , 7 years ago
Description: | modified (diff) |
---|
comment:4 by , 7 years ago
Owner: | changed from | to
---|---|
Status: | new → needinfo |
It looks like JOSM doesn't have access to the cache directory that you set in Imagery Preferences / Settings.
Can you share some details about this folder?
comment:5 by , 7 years ago
Please, share also session file that generates the problem. Although I revoked myself rights to cache folder I can't reproduce the problem
comment:6 by , 7 years ago
@Don-vip:
In following code:
if (cachePath != null && cacheDirLock != null ) { IDiskCacheAttributes diskAttributes = getDiskCacheAttributes(maxDiskObjects, cachePath, cacheName); try { if (cc.getAuxCaches().length == 0) { cc.setAuxCaches(new AuxiliaryCache[]{DISK_CACHE_FACTORY.createCache( diskAttributes, cacheManager, null, new StandardSerializer())}); } } catch (IOException e) { throw e; } catch (Exception e) { // NOPMD throw new IOException(e); } } return new CacheAccess<>(cc); }
Instead of thrown IOException we could just log it and return new CacheAccess<>(cc)
or return new CacheAccess<>(cacheManager.getCache(cacheName, getCacheAttributes(maxMemoryObjects)))
.
This has the drawback is that it will silently (apart from log message) fall back to memory only cache.
What do you think?
PS. Run out of ideas how to reproduce it though
comment:7 by , 7 years ago
I'm not sure to understand the chain of errors. What kind of exception did we catch in the first place?
comment:8 by , 7 years ago
My wild guess is, that we got IOException: Access Denied in getCache()
. Then we tried to use null cache to instantiate TMSLayer.
comment:9 by , 7 years ago
OK I think you're right for the Exception in getCache()
. But I don't think it comes from the piece of code you pasted, I don't see anywhere IOException being raised, even if we catch it. This sounds more suspect to me:
private static void initialize() throws IOException { /* ... */ if (!cacheDirLockPath.exists() && !cacheDirLockPath.createNewFile()) { Logging.warn("Cannot create cache dir lock file"); } cacheDirLock = FileChannel.open(cacheDirLockPath.toPath(), StandardOpenOption.WRITE).tryLock();
The calls createNewFile()
, open()
, and tryLock()
can throw IOException and we don't catch them.
comment:10 by , 7 years ago
As we already have a fallback:
if (cacheDirLock == null) Logging.warn("Cannot lock cache directory. Will not use disk cache");
I suggest to add a try/catch above and simply log any IOException
that could occur. What do you think?
follow-up: 12 comment:11 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | needinfo → closed |
In 13643/josm:
comment:12 by , 7 years ago
Milestone: | → 18.04 |
---|
Thanks! Can you please keep the // NOPMD
? It's needed if we want to keep Exception
in the catch clause.
comment:14 by , 7 years ago
Summary: | Error opening a saved session file → IAE: "Parameter 'cache' must not be null" opening a saved session file |
---|
Wiktor can you please take a look to this one? :)