[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Creating Images - JavaME

Posted on 2011-02-10
4
Medium Priority
?
405 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

649 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