• 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

44.44
/displaytag/src/main/java/org/displaytag/exception/BaseNestableJspTagException.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.exception;
8

9
import javax.servlet.jsp.JspTagException;
10

11
import org.displaytag.Messages;
12
import org.slf4j.Logger;
13
import org.slf4j.LoggerFactory;
14

15
/**
16
 * Base exception: extendes JspTagException providing logging and exception nesting functionalities.
17
 */
18
public abstract class BaseNestableJspTagException extends JspTagException {
19

20
    /**
21
     * Stable serialVersionUID.
22
     */
23
    private static final long serialVersionUID = 42L;
24

25
    /**
26
     * Class where the exception has been generated.
27
     */
28
    private final Class<?> sourceClass;
29

30
    /**
31
     * previous exception.
32
     */
33
    private Throwable nestedException;
34

35
    /**
36
     * Instantiate a new BaseNestableJspTagException.
37
     *
38
     * @param source
39
     *            Class where the exception is generated
40
     * @param message
41
     *            message
42
     */
43
    public BaseNestableJspTagException(final Class<?> source, final String message) {
44
        super(message);
1✔
45
        this.sourceClass = source;
1✔
46

47
        // log exception
48
        final Logger log = LoggerFactory.getLogger(source);
1✔
49

50
        // choose appropriate logging method
51
        if (this.getSeverity() == SeverityEnum.DEBUG) {
1!
52
            log.debug("{}", this);
×
53
        } else if (this.getSeverity() == SeverityEnum.INFO) {
1!
54
            log.info("{}", this);
×
55
        } else if (this.getSeverity() == SeverityEnum.WARN) {
1✔
56
            log.warn("{}", this);
1✔
57
        } else {
58
            // error - default
59
            log.error("{}", this);
1✔
60
        }
61

62
    }
1✔
63

64
    /**
65
     * Instantiate a new BaseNestableJspTagException.
66
     *
67
     * @param source
68
     *            Class where the exception is generated
69
     * @param message
70
     *            message
71
     * @param cause
72
     *            previous Exception
73
     */
74
    public BaseNestableJspTagException(final Class<?> source, final String message, final Throwable cause) {
75
        super(message);
×
76
        this.sourceClass = source;
×
77
        this.nestedException = cause;
×
78

79
        // log exception
80
        final Logger log = LoggerFactory.getLogger(source);
×
81

82
        // choose appropriate logging method
83
        if (this.getSeverity() == SeverityEnum.DEBUG) {
×
84
            log.debug("{}", this, cause);
×
85
        } else if (this.getSeverity() == SeverityEnum.INFO) {
×
86
            log.info("{}", this, cause);
×
87
        } else if (this.getSeverity() == SeverityEnum.WARN) {
×
88
            log.warn("{}", this, cause);
×
89
        } else {
90
            // error - default
91
            log.error("{}", this, cause);
×
92
        }
93

94
    }
×
95

96
    /**
97
     * returns the previous exception.
98
     *
99
     * @return Throwable previous exception
100
     */
101
    @Override
102
    public Throwable getCause() {
103
        return this.nestedException;
1✔
104
    }
105

106
    /**
107
     * basic toString. Returns the message plus the previous exception (if a previous exception exists).
108
     *
109
     * @return String
110
     */
111
    @Override
112
    public String toString() {
113
        String className = this.sourceClass.getName();
1✔
114
        className = className.substring(className.lastIndexOf('.'));
1✔
115

116
        if (this.nestedException == null) {
1!
117
            return Messages.getString("NestableException.msg", //$NON-NLS-1$
1✔
118
                    new Object[] { className, this.getMessage() });
1✔
119
        }
120

121
        return Messages.getString("NestableException.msgcause", //$NON-NLS-1$
×
122
                new Object[] { className, this.getMessage(), this.nestedException.getMessage() });
×
123
    }
124

125
    /**
126
     * subclasses need to define the getSeverity method to provide correct severity for logging.
127
     *
128
     * @return SeverityEnum exception severity
129
     *
130
     * @see org.displaytag.exception.SeverityEnum
131
     */
132
    public abstract SeverityEnum getSeverity();
133

134
}
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