?
Solved

Creating Images - JavaME

Posted on 2011-02-10
4
Medium Priority
?
404 Views
Last Modified: 2013-11-24
I am creating images using the following code..However, my app will stop after printing out STATEMENT 3 which means I can't use Image image = Image.createImage(input);

Is there anyway I can ctach this type of excpetion beside IOexception and Exception?
Does anyone have any idea? Thank in advance.

FileConnection filenames = (FileConnection)Connector.open(main_directory +  "testFolder" + "/"
                                                + imageName ,Connector.READ);
InputStream input = filenames.openInputStream();
try {
                                                Logger.logEventInfo("STATEMENT 3");
                                                Image image = Image.createImage(input);
                                                Logger.logEventInfo("READING: " + imageName +"\n");
                                                Logger.logEventInfo("STATEMENT 4");
                                                if(image != null){               
                                                      Logger.logEventInfo("STATEMENT 5");                                                
                                                }
                                                else continue;                                      
                                                Logger.logEventInfo("STATEMENT 7");
                                          }
                                          catch (IOException e) {
                                                Logger.logEventInfo("STATEMENT 8");                                                
                                                description = e.toString();
                                                Logger.logEventInfo("STATEMENT 9");
                                                Logger.logEventInfo("READING: " + imageName +"\n");
                                          } catch (Exception e)  {
                                                Logger.logEventInfo("STATEMENT 11");
                                                Exceptiondescription = e.toString();
                                                Logger.logEventInfo("STATEMENT 12");                                                
                                                updateContent("READING: " + imageName);      
                                                Logger.logEventInfo("READING: " + imageName +"\n");
                                                Logger.logEventInfo("STATEMENT 13");
                                          }                              
                                          Logger.logEventInfo("STATEMENT 14");
                                          input.close();
0
Comment
Question by:bbdriver
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 1

Expert Comment

by:Shura85
ID: 34875435
Can you show the code you use to get and configure the logger?  That might provide some insight into why it is throwing an error to begin with.  
0
 

Author Comment

by:bbdriver
ID: 34881364
I am not sure if it's about the logger cause some of other images are able to pass STATEMENT 3 and goes into either createimage or Exception. However, for some image, it was unable to go anywhere
0
 

Author Comment

by:bbdriver
ID: 34885007
What kind can I use to catch the exception beside IOException and Exception?
0
 
LVL 1

Accepted Solution

by:
Shura85 earned 2000 total points
ID: 34888442
Exception is the mother of all java exceptions, so it should be catching any and all runtime exceptions this code throws.  However, Image.createImage also throws a NullPointerException - try catching that, and if it works, it probably means there is a scope issue with your image location.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month9 days, 19 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question