Bug 47054 - [PATCH] HSSFCellStyle cloneStyleFrom always throws exception
Summary: [PATCH] HSSFCellStyle cloneStyleFrom always throws exception
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.5-dev
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
: 46302 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-04-20 05:00 UTC by Alexander Rytov
Modified: 2009-04-20 10:32 UTC (History)
1 user (show)



Attachments
clonestylepatch (1.69 KB, patch)
2009-04-20 05:06 UTC, Alexander Rytov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Rytov 2009-04-20 05:00:20 UTC
Please see code.
Index: src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java

    public void cloneStyleFrom(CellStyle source) {
		if(source instanceof HSSFCellStyle) {
			this.cloneStyleFrom((HSSFCellStyle)source);
		}
		throw new IllegalArgumentException("Can only clone from one HSSFCellStyle to another, not between HSSFCellStyle and XSSFCellStyle");
	}

it must be rewritten with

    public void cloneStyleFrom(CellStyle source) {
		if(source instanceof HSSFCellStyle) {
			this.cloneStyleFrom((HSSFCellStyle)source);
		} else {
		throw new IllegalArgumentException("Can only clone from one HSSFCellStyle to another, not between HSSFCellStyle and XSSFCellStyle");
                }
	}
Comment 1 Alexander Rytov 2009-04-20 05:06:25 UTC
Created attachment 23513 [details]
clonestylepatch
Comment 2 Yegor Kozlov 2009-04-20 10:00:45 UTC
Applied in r766755

Regards,
Yegor
Comment 3 Yegor Kozlov 2009-04-20 10:32:08 UTC
*** Bug 46302 has been marked as a duplicate of this bug. ***