﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
6752	JMapViewer Encounters java.lang.IllegalArgumentException: input == null!	jhuntley	team	"While loading images for tiles, the following exception is encountered:

Exception in thread ""AWT-EventQueue-0"" java.lang.IllegalArgumentException: input == null!
	at javax.imageio.ImageIO.read(Unknown Source)
	at org.openstreetmap.gui.jmapviewer.tilesources.BingAerialTileSource.getAttributionImage(BingAerialTileSource.java:171)
	at org.openstreetmap.gui.jmapviewer.JMapViewer.setTileSource(JMapViewer.java:703)
	at com.houghtonassociates.incident.ui.components.IncidentMapView$1.itemStateChanged(IncidentMapView.java:84)...

I've searched and found the following ticket:

https://josm.openstreetmap.de/ticket/5993

However, the fix for this ticket doesn't seem to be included or applicable to JMapViewer. I've since found the problem in code and am happy to supply a fix for JMapViewer, if not done already.

The following code fixes this problem in JMapViewer:

From BingAerialTileSource.java

{{{
    @Override
    public Image getAttributionImage() {
        try {
        	Image img=null;

        	InputStream is=getClass().getResourceAsStream(""images/bing_maps.png"");
        	
        	if (is!=null)
        		img=ImageIO.read(is);
        	
            	return img;
        	
		//Old Way encounters exception inline
        	//return ImageIO.read(getClass().getResourceAsStream(""images/bing_maps.png""));
        } catch (IOException e) {
            return null;
        }
    }
}}}
"	defect	closed	normal		Core	latest	worksforme	JMapViewer	
