mirror of https://github.com/apache/poi.git
sonar fixes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1832131 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8c5c92761d
commit
e345646b9f
|
@ -74,7 +74,6 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableColumns;
|
|||
|
||||
@Beta
|
||||
public abstract class XDDFChart extends POIXMLDocumentPart {
|
||||
|
||||
/**
|
||||
* Underlying workbook
|
||||
*/
|
||||
|
@ -456,6 +455,8 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||
&& chartWorkbookRelation != null
|
||||
&& chartFactory != null) {
|
||||
worksheetPart = createWorksheetPart(chartRelation, chartWorkbookRelation, chartFactory);
|
||||
} else {
|
||||
throw new InvalidFormatException("unable to determine chart relations");
|
||||
}
|
||||
}
|
||||
try (OutputStream xlsOut = worksheetPart.getOutputStream()) {
|
||||
|
@ -610,7 +611,8 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||
* @since POI 4.0.0
|
||||
*/
|
||||
public String formatRange(CellRangeAddress range) {
|
||||
return range.formatAsString(getSheet().getSheetName(), true);
|
||||
final XSSFSheet sheet = getSheet();
|
||||
return (sheet == null) ? null : range.formatAsString(sheet.getSheetName(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -87,7 +87,8 @@ public class XSLFGraphicFrame extends XSLFShape implements GraphicalFrame<XSLFSh
|
|||
|
||||
|
||||
static XSLFGraphicFrame create(CTGraphicalObjectFrame shape, XSLFSheet sheet){
|
||||
switch (getUri(shape)) {
|
||||
final String uri = getUri(shape);
|
||||
switch (uri == null ? "" : uri) {
|
||||
case XSLFTable.TABLE_URI:
|
||||
return new XSLFTable(shape, sheet);
|
||||
case XSLFObjectShape.OLE_URI:
|
||||
|
|
|
@ -82,7 +82,8 @@ implements Notes<XSLFShape,XSLFTextParagraph> {
|
|||
|
||||
@Override
|
||||
public XSLFTheme getTheme(){
|
||||
return getMasterSheet().getTheme();
|
||||
final XSLFNotesMaster m = getMasterSheet();
|
||||
return (m != null) ? m.getTheme() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -258,12 +258,19 @@ public class XSLFTableCell extends XSLFTextShape implements TableCell<XSLFShape,
|
|||
|
||||
@Override
|
||||
public void setBorderWidth(BorderEdge edge, double width) {
|
||||
CTLineProperties ln = getCTLine(edge, true);
|
||||
final CTLineProperties ln = getCTLine(edge, true);
|
||||
if (ln == null) {
|
||||
return;
|
||||
}
|
||||
ln.setW(Units.toEMU(width));
|
||||
}
|
||||
|
||||
private CTLineProperties setBorderDefaults(BorderEdge edge) {
|
||||
CTLineProperties ln = getCTLine(edge, true);
|
||||
final CTLineProperties ln = getCTLine(edge, true);
|
||||
if (ln == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (ln.isSetNoFill()) {
|
||||
ln.unsetNoFill();
|
||||
}
|
||||
|
|
|
@ -605,6 +605,9 @@ public class XSLFTextRun implements TextRun {
|
|||
|
||||
void copyFrom(FontInfo fontInfo) {
|
||||
CTTextFont tf = getXmlObject(true);
|
||||
if (tf == null) {
|
||||
return;
|
||||
}
|
||||
setTypeface(fontInfo.getTypeface());
|
||||
setCharset(fontInfo.getCharset());
|
||||
FontPitch pitch = fontInfo.getPitch();
|
||||
|
@ -638,7 +641,10 @@ public class XSLFTextRun implements TextRun {
|
|||
@Override
|
||||
public void setTypeface(String typeface) {
|
||||
if (typeface != null) {
|
||||
getXmlObject(true).setTypeface(typeface);
|
||||
final CTTextFont tf = getXmlObject(true);
|
||||
if (tf != null) {
|
||||
tf.setTypeface(typeface);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -681,6 +687,9 @@ public class XSLFTextRun implements TextRun {
|
|||
@Override
|
||||
public void setCharset(FontCharset charset) {
|
||||
CTTextFont tf = getXmlObject(true);
|
||||
if (tf == null) {
|
||||
return;
|
||||
}
|
||||
if (charset != null) {
|
||||
tf.setCharset((byte)charset.getNativeId());
|
||||
} else {
|
||||
|
@ -699,7 +708,7 @@ public class XSLFTextRun implements TextRun {
|
|||
@Override
|
||||
public void setFamily(FontFamily family) {
|
||||
CTTextFont tf = getXmlObject(true);
|
||||
if (family == null && !tf.isSetPitchFamily()) {
|
||||
if (tf == null || (family == null && !tf.isSetPitchFamily())) {
|
||||
return;
|
||||
}
|
||||
FontPitch pitch = (tf.isSetPitchFamily())
|
||||
|
@ -718,7 +727,7 @@ public class XSLFTextRun implements TextRun {
|
|||
@Override
|
||||
public void setPitch(FontPitch pitch) {
|
||||
CTTextFont tf = getXmlObject(true);
|
||||
if (pitch == null && !tf.isSetPitchFamily()) {
|
||||
if (tf == null || (pitch == null && !tf.isSetPitchFamily())) {
|
||||
return;
|
||||
}
|
||||
FontFamily family = (tf.isSetPitchFamily())
|
||||
|
|
Loading…
Reference in New Issue