×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    6

    what is wrong with following code snippet???

    1. File f = new File("C:/pics1");
    2. File[ ] files = f.listFiles();

    3. for (File f1 : files) {
    4. try {
    5. BufferedImage bufferedImage8 = ImageIO.read(f1);
    6. if (bufferedImage8.getHeight(null) != Constants.IMAGE_HEIGHT
    || bufferedImage8.getWidth(null) != Constants.IMAGE_WIDTH) {
    bufferedImage8 = GraphicsUtilities.resizeImage(bufferedImage8,
    Constants.IMAGE_WIDTH, Constants.IMAGE_HEIGHT);
    }
    // index.setFilePath(f.getAbsolutePath());
    //indexWriter.addIndex(index);
    Index index = indexWriter.getIndex(bufferedImage8);
    indexes.add(index);
    // numIndex++;
    } catch (IOException ex) {
    ex.printStackTrace();



    In the above at the 6th line am getting "Exception in thread "main" java.lang.NullPointerException" error...
    please tell me what is wrong with this....

  2. #2
    Nokia Developer Champion
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,192

    Re: what is wrong with following code snippet???

    hard to say without seeing the implementation of BufferedImage or not knowing if Constants.IMAGE... constants are properly defined. etc.

    Hartti

Similar Threads

  1. [moved] what is the wrong in this code snippet?
    By cenbek03 in forum Mobile Java General
    Replies: 2
    Last Post: 2008-11-18, 12:31
  2. What is wrong with this code? (resource file)
    By Audun Holme in forum Symbian
    Replies: 2
    Last Post: 2007-05-10, 06:02
  3. what is wrong with the code?
    By naneziris in forum Mobile Java General
    Replies: 1
    Last Post: 2006-06-01, 04:41
  4. Dynamic memory allocation : what is wrong with this code?
    By symbian_ravi in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2005-10-07, 03:58
  5. whats wrong with the following code
    By mankugupta in forum Symbian User Interface
    Replies: 1
    Last Post: 2003-10-31, 06:01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •