?
Solved

Unhandled Exception - getXmlTemplate().replaceAll()

Posted on 2005-02-25
3
Medium Priority
?
228 Views
Last Modified: 2010-04-01
Hi!

The indidated line below gives me this error:
            org.apache.struts.action.RequestProcessor processException
                WARNING: Unhandled Exception thrown: class java.lang.NullPointerException

and this is getXmlTemplate() is just getter function.
++++++++++++++++++++++++      
public ActionForward create(ActionMapping mapping,
                                                       ActionForm form,
                                                       HttpServletRequest request,
                                                       HttpServletResponse response)
                  throws Exception {
                        
                        String typeId = request.getParameter("testSelection");
                        
                        AssessTestTypeDAO typeDAO = new AssessTestTypeDAO();
                        AssessTestType type = typeDAO.select(typeId);
               
                        typeDAO = null;
                        if (type != null)
                        {
                              
                            String xml = type.getXmlTemplate().replaceAll("\t|\n", ""); ------> error
                            String xsl = type.getHtmlXSLFile();
...
...
...+++++++++++++++

any idea?

thanks,
0
Comment
Question by:dkim18
[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
3 Comments
 
LVL 29

Accepted Solution

by:
bloodredsun earned 800 total points
ID: 13404843
You are checking that type != null but not "type.getXmlTemplate() != null".

When you call replaceAll on the String returned by .getXmlTemplate() it is failing as it is returning a null not a String.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
If you're a modern-day technology professional, you may be wondering if certifications are really necessary. They are. Here's why.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month9 days, 20 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