aspose file tools*
The moose likes JSP and the fly likes Tag throwing null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Tag throwing null" Watch "Tag throwing null" New topic
Author

Tag throwing null

Benjamin Madore
Greenhorn

Joined: Jan 24, 2012
Posts: 11

Hello, this is my first time posting here, this place has been coming up on my searches for a while now and it seems pretty friendly.

Here's my problem - I've inherited a web application that does assignments and homework, and the server was updated just before I started, leaving me to chase bugs around.

My latest problem is with a tag, and I'm not very sure what it is trying to tell me. (I'm no means a Java expert, I had been using PHP for the last few years.)



I've chased down several NULL-related issues already, it seems that newer versions are much more strict then the when the app was created, and the author(s) used a lot of NULL checks and assignments.


Linguistics Department server/application manager & programmer.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61648
    
  67

The information in the stack trace, specifically:

at org.apache.jsp.tag.web.organization.assignStep0_tag.doTag(assignStep0_tag.java:505)

says that a null pointer exec potion is being thrown at line 505 of the assignStep0_tag.java class. What's there?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Benjamin Madore
Greenhorn

Joined: Jan 24, 2012
Posts: 11

That's also confusing me, and forgive me if I don't have tags figured out yet, the assignStep0.tag file is 257 lines long. (below) I'm not sure if it's expanding somewhere, or if I have the wrong place.

Benjamin Madore
Greenhorn

Joined: Jan 24, 2012
Posts: 11

I think this is the relevant part:

They're set as follows:

And they're all objects, is that affecting it? Could there be an embedded null?
Benjamin Madore
Greenhorn

Joined: Jan 24, 2012
Posts: 11

Also, in the file "assignStep0.tag" when it does this:


could that be causing the tag error, or am I off.

Is there some intermediate file I need to find?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61648
    
  67

One of the many many reasons that scriptlets in JSPs have been discredited for 10 years now (they were replaced with the JSTL and EL with JSP2 in 2002!) is the difficulty in diagnosing problems such as this.

When modern JSPs contain only JSTL and EL, it's almost impossible for these types of errors to occur.

My advice at this point can only be to update your JSP knowledge with JSTL and EL and move all that Java code out of your JSPs and tags.

You might want to read this article for information on structuring modern web apps.
Koen Aerts
Ranch Hand

Joined: Feb 07, 2012
Posts: 344

Can you find anything by looking at the JSP source file directly under the tomcat work directory? I don't know how and where your tomcat is set up, but to give you an idea:
/web/apache-tomcat-6.0.29/work/Catalina/yourwebsite/_/org/apache/jsp/assignHomework_jsp.java
Benjamin Madore
Greenhorn

Joined: Jan 24, 2012
Posts: 11

Koen,

That helps a lot! I understand the file names now.

505 is:

I'm guessing the description is either returning null error or a null string, I'll look into it. I recall from looking around one "fix" in a java update was to strictly enforce some nulls in strings.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18898
    
    8

If you're getting a NullPointerException at that line, then either out is null or questionType is null.

The former is inconceivable so it follows that questionType is null. So just go through that big clump of Java/scriptlet/JSP and find where it's used.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tag throwing null