< prev index next >

test/jdk/javax/imageio/AppletResourceTest.java

Print this page


   1 /*
   2  * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 4481957
  27  * @key headful
  28  * @summary Tests that applet-supplied ImageReader, ImageWriter, and
  29  *          IIOMetadataFormat implementations do not throw unexpected exceptions
  30  *          when indirectly attempting to access ResourceBundles
  31  * @run main AppletResourceTest
  32  * @run applet AppletResourceTest.html
  33  */
  34 
  35 import java.applet.Applet;
  36 import java.awt.Rectangle;
  37 import java.awt.image.BufferedImage;
  38 import java.io.IOException;
  39 import java.util.Iterator;
  40 import java.util.ListResourceBundle;
  41 import java.util.Locale;
  42 import java.util.MissingResourceException;
  43 import java.util.Vector;
  44 
  45 import javax.imageio.IIOException;
  46 import javax.imageio.ImageReadParam;
  47 import javax.imageio.ImageReader;
  48 import javax.imageio.ImageTypeSpecifier;
  49 import javax.imageio.event.IIOReadWarningListener;
  50 import javax.imageio.metadata.IIOInvalidTreeException;
  51 import javax.imageio.metadata.IIOMetadata;
  52 import javax.imageio.spi.ImageReaderSpi;
  53 
  54 import org.w3c.dom.Node;
  55 
  56 public class AppletResourceTest extends Applet {
  57 
  58     public static void main(String[] argv) {
  59         new AppletResourceTest().init();
  60     }
  61 
  62     public void init() {
  63         DummyImageReaderImpl reader;
  64         MyReadWarningListener listener = new MyReadWarningListener();
  65         Locale[] locales = {new Locale("ru"),
  66                             new Locale("fr"),
  67                             new Locale("uk")};
  68 
  69         reader = new DummyImageReaderImpl(new DummyImageReaderSpiImpl());
  70         reader.setAvailableLocales(locales);
  71         reader.setLocale(new Locale("fr"));
  72         reader.addIIOReadWarningListener(listener);
  73 
  74         String baseName = "AppletResourceTest$BugStats";
  75         try {
  76             reader.processWarningOccurred("WarningMessage");


   1 /*
   2  * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 4481957

  27  * @summary Tests that applet-supplied ImageReader, ImageWriter, and
  28  *          IIOMetadataFormat implementations do not throw unexpected exceptions
  29  *          when indirectly attempting to access ResourceBundles
  30  * @run main AppletResourceTest

  31  */
  32 

  33 import java.awt.Rectangle;
  34 import java.awt.image.BufferedImage;
  35 import java.io.IOException;
  36 import java.util.Iterator;
  37 import java.util.ListResourceBundle;
  38 import java.util.Locale;
  39 import java.util.MissingResourceException;
  40 import java.util.Vector;
  41 
  42 import javax.imageio.IIOException;
  43 import javax.imageio.ImageReadParam;
  44 import javax.imageio.ImageReader;
  45 import javax.imageio.ImageTypeSpecifier;
  46 import javax.imageio.event.IIOReadWarningListener;
  47 import javax.imageio.metadata.IIOInvalidTreeException;
  48 import javax.imageio.metadata.IIOMetadata;
  49 import javax.imageio.spi.ImageReaderSpi;
  50 
  51 import org.w3c.dom.Node;
  52 
  53 public class AppletResourceTest {
  54 
  55     public static void main(String[] argv) {
  56         new AppletResourceTest().init();
  57     }
  58 
  59     public void init() {
  60         DummyImageReaderImpl reader;
  61         MyReadWarningListener listener = new MyReadWarningListener();
  62         Locale[] locales = {new Locale("ru"),
  63                             new Locale("fr"),
  64                             new Locale("uk")};
  65 
  66         reader = new DummyImageReaderImpl(new DummyImageReaderSpiImpl());
  67         reader.setAvailableLocales(locales);
  68         reader.setLocale(new Locale("fr"));
  69         reader.addIIOReadWarningListener(listener);
  70 
  71         String baseName = "AppletResourceTest$BugStats";
  72         try {
  73             reader.processWarningOccurred("WarningMessage");


< prev index next >