Bug 47054

Summary: [PATCH] HSSFCellStyle cloneStyleFrom always throws exception
Product: POI Reporter: Alexander Rytov <arytov>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: patrick.radtke
Priority: P2    
Version: 3.5-dev   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: clonestylepatch

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. ***