Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6258319

No exception with FileHandler file has %h, but %h does not exist

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 1.4.2
    • core-libs
    • Cause Known
    • x86
    • windows_2000

      FULL PRODUCT VERSION :
      $ java -version
      java version "1.4.1_02"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
      Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)



      ADDITIONAL OS VERSION INFORMATION :
      Windows 2000

      A DESCRIPTION OF THE PROBLEM :
      If I create a FileHandler using the %h within the file name, and the
      %h doesn't exist, then records are not logged but there is no exception.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Here is a test to reproduct the bug.

        To run the test

        java test2 c:/temp/junk2/%h/log1.log

      Here is the .java file for test2.
      ============================================

      import java.sql.*;
      import java.util.*;
      import java.util.logging.*;
      import java.io.*;
      import java.math.BigDecimal;

      public class test2
        {

        public static void main(String args[])
          {
          Logger lg = null;
          FileHandler fh = null;
          String f1 = args[0];

          try
            {
      System.out.println("Starting test...");
                System.out.println("");
                lg = Logger.getLogger("a.b.c");
                lg.setLevel(Level.ALL);
                System.out.println(" create FileHanler");
                System.out.println(" file name = " + f1);
                fh = new FileHandler(f1);
                System.out.println(" add Handler");
                lg.addHandler(fh);
                System.out.println(" log FINE message");
                lg.log(Level.FINE, "logging a FINE message");
                System.out.println("");
                System.out.println("Finished test.");
            }
          catch (Exception e)
            {
            e.printStackTrace();
            }

          } // end main

      } // end class test2



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expect an Exception to be thrown
      ACTUAL -
      No exception is thrown. No record is logged.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.sql.*;
      import java.util.*;
      import java.util.logging.*;
      import java.io.*;
      import java.math.BigDecimal;

      public class test2
        {

        public static void main(String args[])
          {
          Logger lg = null;
          FileHandler fh = null;
          String f1 = args[0];

          try
            {
      System.out.println("Starting test...");
                System.out.println("");
                lg = Logger.getLogger("a.b.c");
                lg.setLevel(Level.ALL);
                System.out.println(" create FileHanler");
                System.out.println(" file name = " + f1);
                fh = new FileHandler(f1);
                System.out.println(" add Handler");
                lg.addHandler(fh);
                System.out.println(" log FINE message");
                lg.log(Level.FINE, "logging a FINE message");
                System.out.println("");
                System.out.println("Finished test.");
            }
          catch (Exception e)
            {
            e.printStackTrace();
            }

          } // end main


      } // end class test2


      ---------- END SOURCE ----------
      ###@###.### 2005-04-20 12:05:25 GMT

            Unassigned Unassigned
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: