Generic Jira: Code can generate nulpointer exceptions (Static code review)
Description
cloned from
Activity

amberg1 February 3, 2011 at 5:34 AM
Closing this umbrella Jira as we have had a 2.7 and 2.8 sweep.
Feel free to open new Jira's for specific issues.
Stephen Marquard April 24, 2009 at 1:19 PM
Changing component to Global so this doesn't up in the issue list for components for which it's already resolved (in subtasks).

amberg1 October 8, 2008 at 7:20 AM
Added examples of NPE's in real code per open subtask. see comments in Subtask
However, there are still a lot under no particular project. I assume the kernel.
Further, some NPE's have been added to some of the closed tasks
4443 if (edit != null)
4444 {
4445 addLiveResourceProperties(edit);
4446 }
4447 // track event - do we need this? no harm to keep track
4448 edit.setEvent(EVENT_RESOURCE_ADD);
If edit null then NPE on 4448
http://qa1-nl.sakaiproject.org/codereview/trunk/api/org/sakaiproject/jcr/jackrabbit/sakai/JCRSecurityServiceAdapterImpl.java.html#77
72 if (functionManager == null)
73 {
74 log.error("functionManager has not been set");
75 }
76
77 List<String> l = functionManager.getRegisteredFunctions("jcr."); //$NON-NLS-1$
Links to check are:
http://qa1-nl.sakaiproject.org/codereview/bug_dashboard/pmd_misplacednullcheck.html (three for mailtool)
And http://qa1-nl.sakaiproject.org/codereview/bug_dashboard/findbugs_generic_null.html

amberg1 March 6, 2008 at 9:24 AM
Updated code review with one tool pmd moving from 3.8 to 4.1. The rule MisplaceNullCheck has spotted another 5 obvious errors.
http://qa1-nl.sakaiproject.org/codereview/bug_dashboard/pmd_misplacednullcheck.html
postem-app/src/java/org/sakaiproject/tool/postem/PostemTool.java line:555
if(heading.equals("") || heading == null) {
postem-app/src/java/org/sakaiproject/tool/postem/PostemTool.java 994
if (usr.equals("") || usr == null) {
mailtool/src/java/org/sakaiproject/tool/mailtool/Mailtool.java 697
if (type.equals("") || type == null)
mailtool/src/java/org/sakaiproject/tool/mailtool/Mailtool.java 1538
if (editortype.equals("") || editortype == null) {
mailtool/src/java/org/sakaiproject/tool/mailtool/Mailtool.java line: 1563
if (editortype.equals("") || editortype == null) {

amberg1 March 6, 2008 at 3:03 AM
Cleaning up Null pointer exceptions is important as the majority of the live bug reports sent from the QA servers is of this type and hide underlying causes.
See: http://qa1-nl.sakaiproject.org/codereview/bug_dashboard/detail_stack.html
Currently Findbugs is still reporting 95 potential issues
http://qa1-nl.sakaiproject.org/codereview/bug_dashboard/findbugs_generic_null.html
Further, at the time of writting a PMD ruleset spotted 6 certain issues
http://qa1-nl.sakaiproject.org/codereview/bug_dashboard/pmd_brokennullcheck.html
At the time of commenting the if statements will generate a null pointer exception when the object is null.
site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteAction.java line 9350
if (pageToolList != null || pageToolList.size() != 0) {
samigo-audio/src/java/org/sakaiproject/tool/assessment/audio/AudioPanel.java line 262
if (file == null && !file.isDirectory())
api/src/java/uk/ac/lancs/e_science/sakaiproject/api/blogger/util/XMLHelper.java line 403
if (listaClave!=null || listaClave.isEmpty()) {
search-impl/impl/src/java/org/sakaiproject/search/index/impl/JDBCClusterIndexStore.java line 2300
if (sgi != null || sgi.isClusterSegment())
portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/PDAHandler.java 234
if (responseStr == null && responseStr.length() < 1) return;
portal-render-impl/impl/src/java/org/sakaiproject/portal/render/iframe/IFrameToolRenderService.java
if (responseStr == null && responseStr.length() < 1) return null;
So the question is how to use Jira for bug issues scattered across many projects in the most efficient and egonomic and developer engaging way.
Description: 109 locations that have the potential to trigger a nullpointer exception
See: http://qa1-nl.sakaiproject.org/codereview/bug_dashboard/findbugs_generic_null.html