Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 318062 - NPE in HTMLEmitterUtil
Summary: NPE in HTMLEmitterUtil
Status: VERIFIED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: 2.6.1   Edit
Assignee: Jianchao Li CLA
QA Contact: Maggie Shen CLA
URL:
Whiteboard: Obsolete
Keywords:
: 318679 320639 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-06-25 19:24 EDT by Venkat CLA
Modified: 2010-09-15 02:41 EDT (History)
7 users (show)

See Also:


Attachments
test report (2.78 KB, application/octet-stream)
2010-07-09 05:25 EDT, Maggie Shen CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Venkat CLA 2010-06-25 19:24:48 EDT
Build Identifier: 20100617-1415

Between org.eclipse.birt.report.engine.emitter.html.HTMLVisionOptimize.buildCellStyle(...) and org.eclipse.birt.report.engine.emitter.html.util.HTMLEmitterUtil.buildOverflowStyle(...), there is improper handling of the 'style' variable. buildOverflowStyle(...) throws a NullPointerException when the 'style' parameter is null.
======
Calling method:
       /**
	 * Build the style of cell content.
	 */
	public void buildCellStyle( ICellContent cell, StringBuffer styleBuffer,
			boolean isHead, boolean fixedCellHeight )
	{
		IStyle style = getElementStyle( cell );
		// implement the cell's clip.
		if ( fixedReport )
		{
================================
			HTMLEmitterUtil.buildOverflowStyle( styleBuffer, style, true );
===============================
		}

		IStyle cellMergedStyle = new CellMergedStyle( cell );
========================
Exception Method:
	public static void buildOverflowStyle( StringBuffer buf, IStyle style,
			boolean outputHidden )
	{
===============PROBLEM STATEMENT (NO CHECK FOR NULL)==========
		String overflow = style.getOverflow( );
===========================================
		if ( outputHidden
				|| ( overflow != null && !CSSConstants.CSS_OVERFLOW_HIDDEN_VALUE.equals( overflow ) ) )
		{
			buf.append( " overflow:" );
			buf.append( overflow != null ? overflow
					: CSSConstants.CSS_OVERFLOW_HIDDEN_VALUE );
			buf.append( ";" );
		}
	}
=================



Reproducible: Always

Steps to Reproduce:
1. Migrating report from 2.5.2 to 2.6.0
2. Don't know exact reason for NULL value, but code should handle the condition.
3.
Comment 1 stoatbringer CLA 2010-06-30 08:19:04 EDT
(In reply to comment #0)
I am getting this exact same error as well, the only change is that I have gone from BIRT 2.5.2 to 2.6.0.
Note that in HTMLVisionOptimize.buildCellStyle(), the style variable is checked against null throughout except for the new call to buildOverflowStyle().
It looks like either buildOverflowStyle() should not be called when style==null or buildOverflowStyle() should check its incoming style parameter.
This defect has broken every report I've tried so far, and I will have to go back to 2.5.2 until this is resolved.
Comment 2 Jianchao Li CLA 2010-07-04 21:54:25 EDT
Add null checking logic at buildCellStyle and buildOverflowStyle method.
Comment 3 Maggie Shen CLA 2010-07-09 05:24:53 EDT
verified on build 2.6.1.v20100709-0630. 
To reproduce this bug in designer, need to add URL parameter __agentstyle=false.
Comment 4 Maggie Shen CLA 2010-07-09 05:25:27 EDT
Created attachment 173844 [details]
test report
Comment 5 Stanley CLA 2010-07-12 02:13:01 EDT
Is there any workaround for this using 2.6.0?   I don't really want to build the 2.6.1 snapshot.
Comment 6 Xiaoying Gu CLA 2010-08-10 03:01:19 EDT
Similar issue #321144
Comment 7 Xiaoying Gu CLA 2010-08-24 02:33:12 EDT
*** Bug 320639 has been marked as a duplicate of this bug. ***
Comment 8 Xiaoying Gu CLA 2010-09-15 02:41:21 EDT
*** Bug 318679 has been marked as a duplicate of this bug. ***