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; }
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?
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; }
Thanks, fixed in r1244449.