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

hazendaz / sitemesh2 / 101

21 May 2026 01:02PM UTC coverage: 40.347%. Remained the same
101

Pull #197

github

web-flow
Apply modernization API updates

Agent-Logs-Url: https://github.com/hazendaz/sitemesh2/sessions/c77472e0-2181-4223-86a6-5b5ce1819ca7

Co-authored-by: hazendaz <975267+hazendaz@users.noreply.github.com>
Pull Request #197: Modernize collection API usage flagged by Modernizer

698 of 1891 branches covered (36.91%)

Branch coverage included in aggregate %.

2 of 3 new or added lines in 2 files covered. (66.67%)

1555 of 3693 relevant lines covered (42.11%)

0.42 hits per line

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

40.74
/src/main/java/com/opensymphony/module/sitemesh/mapper/DefaultDecorator.java
1
/*
2
 * SPDX-License-Identifier: Apache-2.0
3
 * Copyright 2011-2026 Hazendaz
4
 */
5
/*
6
 * Title:        DefaultDecorator
7
 * Description:
8
 *
9
 * This software is published under the terms of the OpenSymphony Software
10
 * License version 1.1, of which a copy has been included with this
11
 * distribution in the LICENSE.txt file.
12
 */
13

14
package com.opensymphony.module.sitemesh.mapper;
15

16
import com.opensymphony.module.sitemesh.Decorator;
17

18
import java.util.Iterator;
19
import java.util.Map;
20

21
/**
22
 * Default implementation of Decorator. All properties are set by the constructor.
23
 *
24
 * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a>
25
 *
26
 * @see com.opensymphony.module.sitemesh.Decorator
27
 */
28
public class DefaultDecorator implements Decorator {
29

30
    /**
31
     * The page.
32
     *
33
     * @see #getPage()
34
     */
35
    protected String page;
36

37
    /**
38
     * The name.
39
     *
40
     * @see #getName()
41
     */
42
    protected String name;
43

44
    /**
45
     * The uri path.
46
     *
47
     * @see #getURIPath()
48
     */
49
    protected String uriPath;
50

51
    /**
52
     * The role.
53
     *
54
     * @see #getRole()
55
     */
56
    protected String role;
57

58
    /**
59
     * The parameters.
60
     *
61
     * @see #getInitParameter(java.lang.String)
62
     */
63
    protected Map<Object, Object> parameters;
64

65
    /**
66
     * Constructor to set name, page and parameters.
67
     *
68
     * @param name
69
     *            the name
70
     * @param page
71
     *            the page
72
     * @param parameters
73
     *            the parameters
74
     */
75
    public DefaultDecorator(String name, String page, Map<Object, Object> parameters) {
76
        this(name, page, null, null, parameters);
×
77
    }
×
78

79
    /**
80
     * Constructor to set all properties.
81
     *
82
     * @param name
83
     *            the name
84
     * @param page
85
     *            the page
86
     * @param uriPath
87
     *            the uri path
88
     * @param parameters
89
     *            the parameters
90
     */
91
    public DefaultDecorator(String name, String page, String uriPath, Map<Object, Object> parameters) {
92
        this(name, page, uriPath, null, parameters);
×
93
    }
×
94

95
    /**
96
     * Constructor to set all properties.
97
     *
98
     * @param name
99
     *            the name
100
     * @param page
101
     *            the page
102
     * @param uriPath
103
     *            the uri path
104
     * @param role
105
     *            the role
106
     * @param parameters
107
     *            the parameters
108
     */
109
    public DefaultDecorator(String name, String page, String uriPath, String role, Map<Object, Object> parameters) {
1✔
110
        this.name = name;
1✔
111
        this.page = page;
1✔
112
        this.uriPath = uriPath;
1✔
113
        this.role = role;
1✔
114
        this.parameters = parameters;
1✔
115
    }
1✔
116

117
    /**
118
     * URI of the Servlet/JSP to dispatch the request to (relative to the web-app context).
119
     */
120
    @Override
121
    public String getPage() {
122
        return page;
1✔
123
    }
124

125
    /** Name of Decorator. For information purposes only. */
126
    @Override
127
    public String getName() {
128
        return name;
1✔
129
    }
130

131
    /** URI path of the Decorator. Enables support for decorators defined in seperate web-apps. */
132
    @Override
133
    public String getURIPath() {
134
        return uriPath;
1✔
135
    }
136

137
    /** Role the user has to be in to get this decorator applied. */
138
    @Override
139
    public String getRole() {
140
        return role;
1✔
141
    }
142

143
    /**
144
     * Returns a String containing the value of the named initialization parameter, or null if the parameter does not
145
     * exist.
146
     *
147
     * @param paramName
148
     *            Key of parameter.
149
     *
150
     * @return Value of parameter or null if not found.
151
     */
152
    @Override
153
    public String getInitParameter(String paramName) {
154
        if (parameters == null || !parameters.containsKey(paramName)) {
×
155
            return null;
×
156
        }
157

158
        return (String) parameters.get(paramName);
×
159
    }
160

161
    /**
162
     * Returns the names of the Decorator's initialization parameters as an Iterator of String objects, or an empty
163
     * Iterator if the Decorator has no initialization parameters.
164
     */
165
    @Override
166
    public Iterator<Object> getInitParameterNames() {
167
        if (parameters == null) {
×
168
            // make sure we always return an empty iterator
NEW
169
            return Map.of().keySet().iterator();
×
170
        }
171

172
        return parameters.keySet().iterator();
×
173
    }
174
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc