Bug 318062 NPE in HTMLEmitterUtil
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.
engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/HTMLPerformanceOptimize.java
/*******************************************************************************
 * Copyright (c) 2004, 2007 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/
package org.eclipse.birt.report.engine.emitter.html;
import org.eclipse.birt.report.engine.content.ICellContent;
import org.eclipse.birt.report.engine.content.IColumn;
import org.eclipse.birt.report.engine.content.IContainerContent;
import org.eclipse.birt.report.engine.content.IForeignContent;
import org.eclipse.birt.report.engine.content.IImageContent;
import org.eclipse.birt.report.engine.content.IRowContent;
import org.eclipse.birt.report.engine.content.IStyle;
import org.eclipse.birt.report.engine.content.ITableContent;
import org.eclipse.birt.report.engine.content.ITextContent;
import org.eclipse.birt.report.engine.emitter.HTMLTags;
import org.eclipse.birt.report.engine.emitter.HTMLWriter;
import org.eclipse.birt.report.engine.emitter.html.util.HTMLEmitterUtil;
import org.eclipse.birt.report.engine.ir.DimensionType;
import org.w3c.dom.css.CSSValue;
/**
 * 
 */
public class HTMLPerformanceOptimize extends HTMLEmitter