SonarQube fix

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1779285 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2017-01-18 00:59:19 +00:00
parent 75c630f976
commit c0986ebe7a

View File

@ -53,17 +53,18 @@ import org.apache.poi.util.Units;
public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformShape<HSLFShape,HSLFTextParagraph> { public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformShape<HSLFShape,HSLFTextParagraph> {
private static final POILogger LOG = POILogFactory.getLogger(HSLFFreeformShape.class); private static final POILogger LOG = POILogFactory.getLogger(HSLFFreeformShape.class);
public static final byte[] SEGMENTINFO_MOVETO = new byte[]{0x00, 0x40}; private static final byte[] SEGMENTINFO_MOVETO = new byte[]{0x00, 0x40};
public static final byte[] SEGMENTINFO_LINETO = new byte[]{0x00, (byte)0xAC}; private static final byte[] SEGMENTINFO_LINETO = new byte[]{0x00, (byte)0xAC};
public static final byte[] SEGMENTINFO_ESCAPE = new byte[]{0x01, 0x00}; private static final byte[] SEGMENTINFO_ESCAPE = new byte[]{0x01, 0x00};
public static final byte[] SEGMENTINFO_ESCAPE2 = new byte[]{0x01, 0x20}; private static final byte[] SEGMENTINFO_ESCAPE2 = new byte[]{0x01, 0x20};
public static final byte[] SEGMENTINFO_CUBICTO = new byte[]{0x00, (byte)0xAD}; private static final byte[] SEGMENTINFO_CUBICTO = new byte[]{0x00, (byte)0xAD};
public static final byte[] SEGMENTINFO_CUBICTO2 = new byte[]{0x00, (byte)0xB3}; //OpenOffice inserts 0xB3 instead of 0xAD. // OpenOffice inserts 0xB3 instead of 0xAD.
public static final byte[] SEGMENTINFO_CLOSE = new byte[]{0x01, (byte)0x60}; // private static final byte[] SEGMENTINFO_CUBICTO2 = new byte[]{0x00, (byte)0xB3};
public static final byte[] SEGMENTINFO_END = new byte[]{0x00, (byte)0x80}; private static final byte[] SEGMENTINFO_CLOSE = new byte[]{0x01, (byte)0x60};
private static final byte[] SEGMENTINFO_END = new byte[]{0x00, (byte)0x80};
private static BitField PATH_INFO = BitFieldFactory.getInstance(0xE000); private static final BitField PATH_INFO = BitFieldFactory.getInstance(0xE000);
private static BitField ESCAPE_INFO = BitFieldFactory.getInstance(0x1F00); // private static final BitField ESCAPE_INFO = BitFieldFactory.getInstance(0x1F00);
enum PathInfo { enum PathInfo {
lineTo(0),curveTo(1),moveTo(2),close(3),end(4),escape(5),clientEscape(6); lineTo(0),curveTo(1),moveTo(2),close(3),end(4),escape(5),clientEscape(6);
@ -235,7 +236,7 @@ public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformSh
if(!isClosed) { if(!isClosed) {
segInfo.add(SEGMENTINFO_LINETO); segInfo.add(SEGMENTINFO_LINETO);
} }
segInfo.add(new byte[]{0x00, (byte)0x80}); segInfo.add(SEGMENTINFO_END);
AbstractEscherOptRecord opt = getEscherOptRecord(); AbstractEscherOptRecord opt = getEscherOptRecord();
opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__SHAPEPATH, 0x4)); opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__SHAPEPATH, 0x4));
@ -302,7 +303,7 @@ public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformSh
PathInfo pi = getPathInfo(segElem); PathInfo pi = getPathInfo(segElem);
switch (pi) { switch (pi) {
case escape: { case escape: {
handleEscapeInfo(path, segElem, vertIter); // handleEscapeInfo(path, segElem, vertIter);
break; break;
} }
case moveTo: { case moveTo: {
@ -389,60 +390,59 @@ public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformSh
return prop; return prop;
} }
// FIXME: FindBugs-JDK8 identified that this method does nothing // private void handleEscapeInfo(Path2D path, byte segElem[], Iterator<byte[]> vertIter) {
private void handleEscapeInfo(Path2D path, byte segElem[], Iterator<byte[]> vertIter) { // EscapeInfo ei = getEscapeInfo(segElem);
EscapeInfo ei = getEscapeInfo(segElem); // switch (ei) {
switch (ei) { // case EXTENSION:
case EXTENSION: // break;
break; // case ANGLE_ELLIPSE_TO:
case ANGLE_ELLIPSE_TO: // break;
break; // case ANGLE_ELLIPSE:
case ANGLE_ELLIPSE: // break;
break; // case ARC_TO:
case ARC_TO: // break;
break; // case ARC:
case ARC: // break;
break; // case CLOCKWISE_ARC_TO:
case CLOCKWISE_ARC_TO: // break;
break; // case CLOCKWISE_ARC:
case CLOCKWISE_ARC: // break;
break; // case ELLIPTICAL_QUADRANT_X:
case ELLIPTICAL_QUADRANT_X: // break;
break; // case ELLIPTICAL_QUADRANT_Y:
case ELLIPTICAL_QUADRANT_Y: // break;
break; // case QUADRATIC_BEZIER:
case QUADRATIC_BEZIER: // break;
break; // case NO_FILL:
case NO_FILL: // break;
break; // case NO_LINE:
case NO_LINE: // break;
break; // case AUTO_LINE:
case AUTO_LINE: // break;
break; // case AUTO_CURVE:
case AUTO_CURVE: // break;
break; // case CORNER_LINE:
case CORNER_LINE: // break;
break; // case CORNER_CURVE:
case CORNER_CURVE: // break;
break; // case SMOOTH_LINE:
case SMOOTH_LINE: // break;
break; // case SMOOTH_CURVE:
case SMOOTH_CURVE: // break;
break; // case SYMMETRIC_LINE:
case SYMMETRIC_LINE: // break;
break; // case SYMMETRIC_CURVE:
case SYMMETRIC_CURVE: // break;
break; // case FREEFORM:
case FREEFORM: // break;
break; // case FILL_COLOR:
case FILL_COLOR: // break;
break; // case LINE_COLOR:
case LINE_COLOR: // break;
break; // default:
default: // break;
break; // }
} // }
}
private static PathInfo getPathInfo(byte elem[]) { private static PathInfo getPathInfo(byte elem[]) {
@ -451,9 +451,9 @@ public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformSh
return PathInfo.valueOf(pathInfo); return PathInfo.valueOf(pathInfo);
} }
private static EscapeInfo getEscapeInfo(byte elem[]) { // private static EscapeInfo getEscapeInfo(byte elem[]) {
int elemUS = LittleEndian.getUShort(elem, 0); // int elemUS = LittleEndian.getUShort(elem, 0);
int escInfo = ESCAPE_INFO.getValue(elemUS); // int escInfo = ESCAPE_INFO.getValue(elemUS);
return EscapeInfo.valueOf(escInfo); // return EscapeInfo.valueOf(escInfo);
} // }
} }