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

hazendaz / sitemesh2 / 59

22 Mar 2026 02:30AM UTC coverage: 40.347%. Remained the same
59

push

github

hazendaz
[mvn] Update maven wrapper

698 of 1891 branches covered (36.91%)

Branch coverage included in aggregate %.

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

69.23
/src/main/java/com/opensymphony/module/sitemesh/parser/PartialPageParserHtmlPage.java
1
/*
2
 * SPDX-License-Identifier: Apache-2.0
3
 * Copyright 2011-2026 Hazendaz
4
 */
5
package com.opensymphony.module.sitemesh.parser;
6

7
import com.opensymphony.module.sitemesh.HTMLPage;
8
import com.opensymphony.module.sitemesh.SitemeshBuffer;
9
import com.opensymphony.module.sitemesh.SitemeshBufferFragment;
10

11
import java.io.IOException;
12
import java.io.StringWriter;
13
import java.io.Writer;
14
import java.util.Map;
15

16
/**
17
 * The Class PartialPageParserHtmlPage.
18
 */
19
public class PartialPageParserHtmlPage extends PartialPageParserPage implements HTMLPage {
20

21
    /** The head. */
22
    private final SitemeshBufferFragment head;
23

24
    /**
25
     * Instantiates a new partial page parser html page.
26
     *
27
     * @param sitemeshBuffer
28
     *            the sitemesh buffer
29
     * @param body
30
     *            the body
31
     * @param bodyProperties
32
     *            the body properties
33
     */
34
    public PartialPageParserHtmlPage(SitemeshBuffer sitemeshBuffer, SitemeshBufferFragment body,
35
            Map<String, String> bodyProperties) {
36
        this(sitemeshBuffer, body, bodyProperties, null, null, null, null);
1✔
37
    }
1✔
38

39
    /**
40
     * Instantiates a new partial page parser html page.
41
     *
42
     * @param sitemeshBuffer
43
     *            The buffer for the page
44
     * @param body
45
     *            The body fragment
46
     * @param bodyProperties
47
     *            The properties of the body
48
     * @param head
49
     *            The head section
50
     * @param title
51
     *            The title
52
     * @param metaAttributes
53
     *            The meta attributes found in the head section
54
     * @param pageProperties
55
     *            The page properties extracted from the head section
56
     */
57
    public PartialPageParserHtmlPage(SitemeshBuffer sitemeshBuffer, SitemeshBufferFragment body,
58
            Map<String, String> bodyProperties, SitemeshBufferFragment head, String title,
59
            Map<String, String> metaAttributes, Map<String, String> pageProperties) {
60
        super(sitemeshBuffer, body);
1✔
61
        this.head = head;
1✔
62
        if (title == null) {
1✔
63
            title = "";
1✔
64
        }
65
        addProperty("title", title);
1✔
66
        addProperties(metaAttributes, "meta.");
1✔
67
        addProperties(bodyProperties, "body.");
1✔
68
        addProperties(pageProperties, "page.");
1✔
69
    }
1✔
70

71
    /**
72
     * Adds the properties.
73
     *
74
     * @param properties
75
     *            the properties
76
     * @param prefix
77
     *            the prefix
78
     */
79
    private void addProperties(Map<String, String> properties, String prefix) {
80
        if (properties != null) {
1✔
81
            for (Map.Entry<String, String> property : properties.entrySet()) {
1✔
82
                addProperty(prefix + property.getKey(), property.getValue());
1✔
83
            }
1✔
84
        }
85
    }
1✔
86

87
    @Override
88
    public void writeHead(Writer out) throws IOException {
89
        if (head != null) {
1✔
90
            head.writeTo(out);
1✔
91
        }
92
    }
1✔
93

94
    @Override
95
    public String getHead() {
96
        if (head == null) {
×
97
            return "";
×
98
        }
99
        StringWriter headString = new StringWriter();
×
100
        try {
101
            head.writeTo(headString);
×
102
        } catch (IOException e) {
×
103
            throw new RuntimeException("IOException occured while writing to buffer?", e);
×
104
        }
×
105
        return headString.toString();
×
106
    }
107

108
    @Override
109
    public boolean isFrameSet() {
110
        return false;
×
111
    }
112

113
    @Override
114
    public void setFrameSet(boolean frameset) {
115
        throw new UnsupportedOperationException();
×
116
    }
117
}
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