moved 'throw' into else clause avoiding exception on every call of cloneStyleFrom, see bugzilla 47054

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@766755 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yegor Kozlov 2009-04-20 16:58:29 +00:00
parent a5afdd38d2
commit fe50c3f15c
2 changed files with 4 additions and 2 deletions

View File

@ -814,9 +814,10 @@ public class HSSFCellStyle implements CellStyle
public void cloneStyleFrom(CellStyle source) { public void cloneStyleFrom(CellStyle source) {
if(source instanceof HSSFCellStyle) { if(source instanceof HSSFCellStyle) {
this.cloneStyleFrom((HSSFCellStyle)source); this.cloneStyleFrom((HSSFCellStyle)source);
} } else {
throw new IllegalArgumentException("Can only clone from one HSSFCellStyle to another, not between HSSFCellStyle and XSSFCellStyle"); throw new IllegalArgumentException("Can only clone from one HSSFCellStyle to another, not between HSSFCellStyle and XSSFCellStyle");
} }
}
public void cloneStyleFrom(HSSFCellStyle source) { public void cloneStyleFrom(HSSFCellStyle source) {
// First we need to clone the extended format // First we need to clone the extended format
// record // record

View File

@ -112,9 +112,10 @@ public class XSSFCellStyle implements CellStyle {
public void cloneStyleFrom(CellStyle source) { public void cloneStyleFrom(CellStyle source) {
if(source instanceof XSSFCellStyle) { if(source instanceof XSSFCellStyle) {
this.cloneStyleFrom(source); this.cloneStyleFrom(source);
} } else {
throw new IllegalArgumentException("Can only clone from one XSSFCellStyle to another, not between HSSFCellStyle and XSSFCellStyle"); throw new IllegalArgumentException("Can only clone from one XSSFCellStyle to another, not between HSSFCellStyle and XSSFCellStyle");
} }
}
/** /**
* Get the type of horizontal alignment for the cell * Get the type of horizontal alignment for the cell