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
|
@Beta
|
||||||
public abstract class XDDFChart extends POIXMLDocumentPart {
|
public abstract class XDDFChart extends POIXMLDocumentPart {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Underlying workbook
|
* Underlying workbook
|
||||||
*/
|
*/
|
||||||
|
@ -456,6 +455,8 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
||||||
&& chartWorkbookRelation != null
|
&& chartWorkbookRelation != null
|
||||||
&& chartFactory != null) {
|
&& chartFactory != null) {
|
||||||
worksheetPart = createWorksheetPart(chartRelation, chartWorkbookRelation, chartFactory);
|
worksheetPart = createWorksheetPart(chartRelation, chartWorkbookRelation, chartFactory);
|
||||||
|
} else {
|
||||||
|
throw new InvalidFormatException("unable to determine chart relations");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try (OutputStream xlsOut = worksheetPart.getOutputStream()) {
|
try (OutputStream xlsOut = worksheetPart.getOutputStream()) {
|
||||||
|
@ -610,7 +611,8 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
||||||
* @since POI 4.0.0
|
* @since POI 4.0.0
|
||||||
*/
|
*/
|
||||||
public String formatRange(CellRangeAddress range) {
|
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){
|
static XSLFGraphicFrame create(CTGraphicalObjectFrame shape, XSLFSheet sheet){
|
||||||
switch (getUri(shape)) {
|
final String uri = getUri(shape);
|
||||||
|
switch (uri == null ? "" : uri) {
|
||||||
case XSLFTable.TABLE_URI:
|
case XSLFTable.TABLE_URI:
|
||||||
return new XSLFTable(shape, sheet);
|
return new XSLFTable(shape, sheet);
|
||||||
case XSLFObjectShape.OLE_URI:
|
case XSLFObjectShape.OLE_URI:
|
||||||
|
|
|
@ -82,7 +82,8 @@ implements Notes<XSLFShape,XSLFTextParagraph> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XSLFTheme getTheme(){
|
public XSLFTheme getTheme(){
|
||||||
return getMasterSheet().getTheme();
|
final XSLFNotesMaster m = getMasterSheet();
|
||||||
|
return (m != null) ? m.getTheme() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -258,12 +258,19 @@ public class XSLFTableCell extends XSLFTextShape implements TableCell<XSLFShape,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBorderWidth(BorderEdge edge, double width) {
|
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));
|
ln.setW(Units.toEMU(width));
|
||||||
}
|
}
|
||||||
|
|
||||||
private CTLineProperties setBorderDefaults(BorderEdge edge) {
|
private CTLineProperties setBorderDefaults(BorderEdge edge) {
|
||||||
CTLineProperties ln = getCTLine(edge, true);
|
final CTLineProperties ln = getCTLine(edge, true);
|
||||||
|
if (ln == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (ln.isSetNoFill()) {
|
if (ln.isSetNoFill()) {
|
||||||
ln.unsetNoFill();
|
ln.unsetNoFill();
|
||||||
}
|
}
|
||||||
|
|
|
@ -605,6 +605,9 @@ public class XSLFTextRun implements TextRun {
|
||||||
|
|
||||||
void copyFrom(FontInfo fontInfo) {
|
void copyFrom(FontInfo fontInfo) {
|
||||||
CTTextFont tf = getXmlObject(true);
|
CTTextFont tf = getXmlObject(true);
|
||||||
|
if (tf == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
setTypeface(fontInfo.getTypeface());
|
setTypeface(fontInfo.getTypeface());
|
||||||
setCharset(fontInfo.getCharset());
|
setCharset(fontInfo.getCharset());
|
||||||
FontPitch pitch = fontInfo.getPitch();
|
FontPitch pitch = fontInfo.getPitch();
|
||||||
|
@ -638,7 +641,10 @@ public class XSLFTextRun implements TextRun {
|
||||||
@Override
|
@Override
|
||||||
public void setTypeface(String typeface) {
|
public void setTypeface(String typeface) {
|
||||||
if (typeface != null) {
|
if (typeface != null) {
|
||||||
getXmlObject(true).setTypeface(typeface);
|
final CTTextFont tf = getXmlObject(true);
|
||||||
|
if (tf != null) {
|
||||||
|
tf.setTypeface(typeface);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -681,6 +687,9 @@ public class XSLFTextRun implements TextRun {
|
||||||
@Override
|
@Override
|
||||||
public void setCharset(FontCharset charset) {
|
public void setCharset(FontCharset charset) {
|
||||||
CTTextFont tf = getXmlObject(true);
|
CTTextFont tf = getXmlObject(true);
|
||||||
|
if (tf == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (charset != null) {
|
if (charset != null) {
|
||||||
tf.setCharset((byte)charset.getNativeId());
|
tf.setCharset((byte)charset.getNativeId());
|
||||||
} else {
|
} else {
|
||||||
|
@ -699,7 +708,7 @@ public class XSLFTextRun implements TextRun {
|
||||||
@Override
|
@Override
|
||||||
public void setFamily(FontFamily family) {
|
public void setFamily(FontFamily family) {
|
||||||
CTTextFont tf = getXmlObject(true);
|
CTTextFont tf = getXmlObject(true);
|
||||||
if (family == null && !tf.isSetPitchFamily()) {
|
if (tf == null || (family == null && !tf.isSetPitchFamily())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FontPitch pitch = (tf.isSetPitchFamily())
|
FontPitch pitch = (tf.isSetPitchFamily())
|
||||||
|
@ -718,7 +727,7 @@ public class XSLFTextRun implements TextRun {
|
||||||
@Override
|
@Override
|
||||||
public void setPitch(FontPitch pitch) {
|
public void setPitch(FontPitch pitch) {
|
||||||
CTTextFont tf = getXmlObject(true);
|
CTTextFont tf = getXmlObject(true);
|
||||||
if (pitch == null && !tf.isSetPitchFamily()) {
|
if (tf == null || (pitch == null && !tf.isSetPitchFamily())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FontFamily family = (tf.isSetPitchFamily())
|
FontFamily family = (tf.isSetPitchFamily())
|
||||||
|
|
Loading…
Reference in New Issue