//#
//# Map Example of a Bad Exception
//# $Revision: 1.1 $
//# Copyright 2004 by Eric Y. Theriault
//# All Rights Reserved.
//# http://www.eyt.ca/CORBA
//#
package ca.eyt.tests;

/**
 * Demonstrates an example of a bad exception.
 *
 * @author Eric Y. Theriault <eric@eyt.ca>
 */
public class MapExample {
   /**
    * main
    *
    * @param args Ignored.
    */
   public static void main( String args[] ) {
      try {
         // Create a map
         java.util.Map map = new java.util.TreeMap();

         // Add an item; this is OK.
         java.net.URL url = new java.net.URL( "http://www.eyt.ca" );
         map.put( url, "A description" );

         // This will throw an exception
         String description = (String) map.get( url );
      } catch ( Throwable t ) {
         System.err.println( "Exception raised: " );
         t.printStackTrace();
      }
   }
};

