You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2012/02/14 11:08:46 UTC

DO NOT REPLY [Bug 52664] New: An incomplete fix for the NPE bug in MAPIMessage.java

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: lianggt08@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-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52664] An incomplete fix for the NPE bug in MAPIMessage.java

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52664

lianggt08@sei.pku.edu.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #2 from lianggt08@sei.pku.edu.cn 2012-02-15 05:54:35 UTC ---
You have checked a wrong code location. Please check the line 454 of the method
"has7BitEncodingStrings", not the method "set7BitEncoding". 


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-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52664] An incomplete fix for the NPE bug in MAPIMessage.java

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52664

Nick Burch <ni...@alfresco.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Nick Burch <ni...@alfresco.com> 2012-02-14 12:58:22 UTC ---
nameIdChunks seems to already be null checked:

      if (nameIdChunks!=null) {
         for(Chunk c : nameIdChunks.getAll()) {
            if(c instanceof StringChunk) {
                ((StringChunk)c).set7BitEncoding(charset);
            }
         }
      }

Is something else needed, or does this problem refer to an older version of
POI?

-- 
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-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52664] An incomplete fix for the NPE bug in MAPIMessage.java

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52664

lianggt08@sei.pku.edu.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lianggt08@sei.pku.edu.cn
         OS/Version|                            |All
           Severity|normal                      |critical

-- 
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-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52664] An incomplete fix for the NPE bug in MAPIMessage.java

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52664

Nick Burch <ni...@alfresco.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Nick Burch <ni...@alfresco.com> 2012-02-15 11:47:21 UTC ---
Thanks, fixed in r1244449.

-- 
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-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org