• 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

0.0
/displaytag/src/main/java/org/displaytag/exception/BaseNestableRuntimeException.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 org.displaytag.Messages;
10
import org.slf4j.Logger;
11
import org.slf4j.LoggerFactory;
12

13
/**
14
 * Base runtime exception: extendes RuntimeException providing logging and exception nesting functionalities.
15
 */
16
public abstract class BaseNestableRuntimeException extends RuntimeException {
17

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

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

28
    /**
29
     * previous exception.
30
     */
31
    private Throwable nestedException;
32

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

45
        // log exception
46
        final Logger log = LoggerFactory.getLogger(source);
×
47

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

60
    }
×
61

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

77
        // log exception
78
        final Logger log = LoggerFactory.getLogger(source);
×
79

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

92
    }
×
93

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

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

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

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

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

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