Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-970

error using read(char[ ] array) of reader class

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Won't Fix
    • 1.0-beta-9
    • 1.0-JSR-3
    • None
    • Windows XP

    Description

      I get this run tme error when I try to run this code,it compiles successfully.But when I say groovy Arr.groovy,it gives me this
      on command line:

      caught: java.lang.NullPointerException at Arr.main,

      I want to read from an input stream into an char array using read(char[ ] array) method of reder class,but it gives me this runtime error.I'm sure the file does exists,read( ) method works fine but I can't read into an char array.

      The code of my file is :

      import java.io.*

      class Arr
      {
      public static void main(args)

      { String dirName = "C:\\mydata" String fileName = "proverbs.txt" File input = new File(dirName, fileName) BufferedReader inFile = new BufferedReader( new FileReader(input)) char[] chr = new char[10] c = inFile.read(chr) }

      }

      Thank you

      Attachments

        1. Arr.groovy
          0.4 kB
          amit wadhwa
        2. Arr2.groovy
          0.4 kB
          Kim, Pilho

        Activity

          People

            phkim Kim, Pilho
            amity amit wadhwa
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 72h
                72h
                Remaining:
                Remaining Estimate - 72h
                72h
                Logged:
                Time Spent - Not Specified
                Not Specified