• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hazendaz / displaytag / 1753

12 Feb 2026 03:17AM UTC coverage: 77.321% (-0.01%) from 77.334%
1753

push

github

web-flow
Merge pull request #1102 from hazendaz/renovate/javax-support-logback-monorepo

Update dependency ch.qos.logback:logback-classic to v1.5.29 (javax-support)

1438 of 2003 branches covered (71.79%)

Branch coverage included in aggregate %.

4034 of 5074 relevant lines covered (79.5%)

0.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

25.0
/displaytag/src/main/java/org/displaytag/export/excel/DefaultHssfExportView.java
1
/*
2
 * SPDX-License-Identifier: MIT
3
 * See LICENSE file for details.
4
 *
5
 * Copyright 2002-2026 Fabrizio Giustina, the Displaytag team
6
 */
7
package org.displaytag.export.excel;
8

9
import java.io.IOException;
10
import java.io.OutputStream;
11

12
import javax.servlet.jsp.JspException;
13

14
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
15
import org.displaytag.Messages;
16
import org.displaytag.exception.BaseNestableJspTagException;
17
import org.displaytag.exception.SeverityEnum;
18
import org.displaytag.export.BinaryExportView;
19
import org.displaytag.model.TableModel;
20
import org.displaytag.render.HssfTableWriter;
21

22
/**
23
 * Excel exporter using POI.
24
 */
25
public class DefaultHssfExportView implements BinaryExportView {
1✔
26
    /**
27
     * TableModel to render.
28
     */
29
    protected TableModel model;
30

31
    /**
32
     * Do export.
33
     *
34
     * @param out
35
     *            the out
36
     *
37
     * @throws IOException
38
     *             Signals that an I/O exception has occurred.
39
     * @throws JspException
40
     *             the jsp exception
41
     *
42
     * @see org.displaytag.export.BinaryExportView#doExport(java.io.OutputStream)
43
     */
44
    @Override
45
    public void doExport(final OutputStream out) throws IOException, JspException {
46
        try {
47
            final HSSFWorkbook wb = new HSSFWorkbook();
×
48
            this.getHssfTableWriter(wb).writeTable(this.model, "-1");
×
49
            wb.write(out);
×
50
            wb.close();
×
51
        } catch (final Exception e) {
×
52
            throw new HssfGenerationException(e);
×
53
        }
×
54
    }
×
55

56
    /**
57
     * Convenience method.
58
     *
59
     * @param wb
60
     *            the wb
61
     *
62
     * @return the hssf table writer
63
     */
64
    protected HssfTableWriter getHssfTableWriter(final HSSFWorkbook wb) {
65
        return new HssfTableWriter(wb);
1✔
66
    }
67

68
    /**
69
     * Sets the parameters.
70
     *
71
     * @param model
72
     *            the model
73
     * @param exportFullList
74
     *            the export full list
75
     * @param includeHeader
76
     *            the include header
77
     * @param decorateValues
78
     *            the decorate values
79
     *
80
     * @see org.displaytag.export.ExportView#setParameters(org.displaytag.model.TableModel, boolean, boolean, boolean)
81
     */
82
    @Override
83
    public void setParameters(final TableModel model, final boolean exportFullList, final boolean includeHeader,
84
            final boolean decorateValues) {
85
        this.model = model;
1✔
86
    }
1✔
87

88
    /**
89
     * Gets the mime type.
90
     *
91
     * @return "application/vnd.ms-excel"
92
     *
93
     * @see org.displaytag.export.BaseExportView#getMimeType()
94
     */
95
    @Override
96
    public String getMimeType() {
97
        return "application/vnd.ms-excel"; //$NON-NLS-1$
×
98
    }
99

100
    /**
101
     * Wraps POI-generated exceptions.
102
     */
103
    static class HssfGenerationException extends BaseNestableJspTagException {
104
        /**
105
         * Serial ID.
106
         */
107
        private static final long serialVersionUID = 899149338534L;
108

109
        /**
110
         * Instantiate a new PdfGenerationException with a fixed message and the given cause.
111
         *
112
         * @param cause
113
         *            Previous exception
114
         */
115
        public HssfGenerationException(final Throwable cause) {
116
            super(DefaultHssfExportView.class, Messages.getString("DefaultHssfExportView.errorexporting"), cause); //$NON-NLS-1$
×
117
        }
×
118

119
        /**
120
         * Gets the severity.
121
         *
122
         * @return the severity
123
         *
124
         * @see org.displaytag.exception.BaseNestableJspTagException#getSeverity()
125
         */
126
        @Override
127
        public SeverityEnum getSeverity() {
128
            return SeverityEnum.ERROR;
×
129
        }
130
    }
131
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc