sonar fix

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1750162 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2016-06-24 20:26:08 +00:00
parent a3718f8166
commit 18c2ee3fdc

View File

@ -16,20 +16,12 @@
==================================================================== */ ==================================================================== */
package org.apache.poi.hsmf.datatypes; package org.apache.poi.hsmf.datatypes;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_ADDITIONAL_INFO;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_CONTENT_BASE;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_CONTENT_LOCATION;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_DATA; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_DATA;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_DISPOSITION;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_ENCODING;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_EXTENSION; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_EXTENSION;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_FILENAME; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_FILENAME;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_FLAGS;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_LONG_FILENAME; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_LONG_FILENAME;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_LONG_PATHNAME;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_MIME_TAG; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_MIME_TAG;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_RENDERING; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_RENDERING;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_SIZE;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;
@ -42,7 +34,7 @@ import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger; import org.apache.poi.util.POILogger;
/** /**
* Collection of convenence chunks for standard parts of the MSG file attachment. * Collection of convenience chunks for standard parts of the MSG file attachment.
*/ */
public class AttachmentChunks implements ChunkGroup { public class AttachmentChunks implements ChunkGroup {
private static POILogger logger = POILogFactory.getLogger(AttachmentChunks.class); private static POILogger logger = POILogFactory.getLogger(AttachmentChunks.class);
@ -120,16 +112,17 @@ public class AttachmentChunks implements ChunkGroup {
* Called by the parser whenever a chunk is found. * Called by the parser whenever a chunk is found.
*/ */
public void record(Chunk chunk) { public void record(Chunk chunk) {
if(chunk.getChunkId() == ATTACH_ADDITIONAL_INFO.id) { // TODO: add further members for other properties like:
// TODO // - ATTACH_ADDITIONAL_INFO
} // - ATTACH_CONTENT_BASE
else if(chunk.getChunkId() == ATTACH_CONTENT_BASE.id) { // - ATTACH_CONTENT_LOCATION
// TODO // - ATTACH_DISPOSITION
} // - ATTACH_ENCODING
else if(chunk.getChunkId() == ATTACH_CONTENT_LOCATION.id) { // - ATTACH_FLAGS
// TODO // - ATTACH_LONG_PATHNAME
} // - ATTACH_SIZE
else if(chunk.getChunkId() == ATTACH_DATA.id) { final int chunkId = chunk.getChunkId();
if (chunkId == ATTACH_DATA.id) {
if(chunk instanceof ByteChunk) { if(chunk instanceof ByteChunk) {
attachData = (ByteChunk)chunk; attachData = (ByteChunk)chunk;
} else if(chunk instanceof DirectoryChunk) { } else if(chunk instanceof DirectoryChunk) {
@ -137,37 +130,17 @@ public class AttachmentChunks implements ChunkGroup {
} else { } else {
logger.log(POILogger.ERROR, "Unexpected data chunk of type " + chunk); logger.log(POILogger.ERROR, "Unexpected data chunk of type " + chunk);
} }
} } else if(chunkId == ATTACH_EXTENSION.id) {
else if(chunk.getChunkId() == ATTACH_DISPOSITION.id) {
// TODO
}
else if(chunk.getChunkId() == ATTACH_ENCODING.id) {
// TODO
}
else if(chunk.getChunkId() == ATTACH_EXTENSION.id) {
attachExtension = (StringChunk)chunk; attachExtension = (StringChunk)chunk;
} } else if(chunkId == ATTACH_FILENAME.id) {
else if(chunk.getChunkId() == ATTACH_FILENAME.id) {
attachFileName = (StringChunk)chunk; attachFileName = (StringChunk)chunk;
} } else if(chunkId == ATTACH_LONG_FILENAME.id) {
else if(chunk.getChunkId() == ATTACH_FLAGS.id) {
// TODO
}
else if(chunk.getChunkId() == ATTACH_LONG_FILENAME.id) {
attachLongFileName = (StringChunk)chunk; attachLongFileName = (StringChunk)chunk;
} } else if(chunkId == ATTACH_MIME_TAG.id) {
else if(chunk.getChunkId() == ATTACH_LONG_PATHNAME.id) {
// TODO
}
else if(chunk.getChunkId() == ATTACH_MIME_TAG.id) {
attachMimeTag = (StringChunk)chunk; attachMimeTag = (StringChunk)chunk;
} } else if(chunkId == ATTACH_RENDERING.id) {
else if(chunk.getChunkId() == ATTACH_RENDERING.id) {
attachRenderingWMF = (ByteChunk)chunk; attachRenderingWMF = (ByteChunk)chunk;
} }
else if(chunk.getChunkId() == ATTACH_SIZE.id) {
// TODO
}
// And add to the main list // And add to the main list
allChunks.add(chunk); allChunks.add(chunk);