https://issues.apache.org/bugzilla/show_bug.cgi?id=52664

             Bug #: 52664
           Summary: An incomplete fix for the NPE bug in MAPIMessage.java
           Product: POI
           Version: unspecified
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSMF
        AssignedTo: dev@poi.apache.org
        ReportedBy: liangg...@sei.pku.edu.cn
    Classification: Unclassified


The fix revision 1171628 was aimed to remove an NPE bug on the  "nameIdChunks "
in the method "set7BitEncoding" of the file
"/poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java" , but it
is incomplete. 
Since the "nameIdChunks " could be null during the run-time execution, its
value should also be null-checked before being dereferenced in other methods. 

The buggy code locations the same fix needs to be applied at are as bellows: 

Line 454 of the method "has7BitEncodingStrings()".



public boolean has7BitEncodingStrings() {
      for(Chunk c : mainChunks.getAll()) {
         if(c instanceof StringChunk) {
            if( ((StringChunk)c).getType() == Types.ASCII_STRING ) {
               return true;
            }
         }
      }
[Line 454]      for(Chunk c : nameIdChunks.getAll()) {
         if(c instanceof StringChunk) {
            if( ((StringChunk)c).getType() == Types.ASCII_STRING ) {
               return true;
            }
         }
      }
      for(RecipientChunks rc : recipientChunks) {
         for(Chunk c : rc.getAll()) {
            if(c instanceof StringChunk) {
               if( ((StringChunk)c).getType() == Types.ASCII_STRING ) {
                  return true;
               }
            }
         }
      }
      return false;
   }

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to