Changeset 7369 in josm for trunk/src


Ignore:
Timestamp:
2014-08-06T19:06:30+02:00 (5 years ago)
Author:
Don-vip
Message:

robustness to strange JAI configuration error occuring in unit tests when initializing ExtensionFileFilter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java

    r7048 r7369  
    88import java.util.LinkedList;
    99import java.util.List;
     10import java.util.ServiceConfigurationError;
    1011
    1112import javax.swing.JFileChooser;
     
    6566                MapView.addLayerChangeListener(importer);
    6667            } catch (Exception e) {
    67                 Main.debug(e.getMessage());
     68                if (Main.isDebugEnabled()) {
     69                    Main.debug(e.getMessage());
     70                }
     71            } catch (ServiceConfigurationError e) {
     72                // error seen while initializing WMSLayerImporter in plugin unit tests:
     73                // -
     74                // ServiceConfigurationError: javax.imageio.spi.ImageWriterSpi:
     75                // Provider com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageWriterSpi could not be instantiated
     76                // Caused by: java.lang.IllegalArgumentException: vendorName == null!
     77                //      at javax.imageio.spi.IIOServiceProvider.<init>(IIOServiceProvider.java:76)
     78                //      at javax.imageio.spi.ImageReaderWriterSpi.<init>(ImageReaderWriterSpi.java:231)
     79                //      at javax.imageio.spi.ImageWriterSpi.<init>(ImageWriterSpi.java:213)
     80                //      at com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageWriterSpi.<init>(CLibJPEGImageWriterSpi.java:84)
     81                // -
     82                // This is a very strange behaviour of JAI:
     83                // http://thierrywasyl.wordpress.com/2009/07/24/jai-how-to-solve-vendorname-null-exception/
     84                // -
     85                // that can lead to various problems, see #8583 comments
     86                Main.error(e);
    6887            }
    6988        }
     
    86105                MapView.addLayerChangeListener(exporter);
    87106            } catch (Exception e) {
    88                 Main.debug(e.getMessage());
     107                if (Main.isDebugEnabled()) {
     108                    Main.debug(e.getMessage());
     109                }
     110            } catch (ServiceConfigurationError e) {
     111                // see above in importers initialization
     112                Main.error(e);
    89113            }
    90114        }
Note: See TracChangeset for help on using the changeset viewer.