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

openmrs / openmrs-core / 14719695478

28 Apr 2025 11:11PM UTC coverage: 65.187% (+0.1%) from 65.081%
14719695478

push

github

web-flow
TRUNK-6335: Remove all vestiges of the core modules concept (#5019)

1 of 5 new or added lines in 3 files covered. (20.0%)

5 existing lines in 4 files now uncovered.

23400 of 35897 relevant lines covered (65.19%)

0.65 hits per line

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

33.33
/web/src/main/java/org/openmrs/web/filter/startuperror/StartupErrorFilter.java
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
3
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
4
 * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
5
 * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
6
 *
7
 * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
8
 * graphic logo is a trademark of OpenMRS Inc.
9
 */
10
package org.openmrs.web.filter.startuperror;
11

12
import java.io.IOException;
13
import java.util.HashMap;
14

15
import javax.servlet.FilterChain;
16
import javax.servlet.ServletException;
17
import javax.servlet.ServletRequest;
18
import javax.servlet.ServletResponse;
19
import javax.servlet.http.HttpServletRequest;
20
import javax.servlet.http.HttpServletResponse;
21
import org.openmrs.web.Listener;
22
import org.openmrs.web.filter.StartupFilter;
23

24
/**
25
 * This is the second filter that is processed. It is only active when OpenMRS has some liquibase
26
 * updates that need to be run. If updates are needed, this filter/wizard asks for a super user to
27
 * authenticate and review the updates before continuing.
28
 */
29
public class StartupErrorFilter extends StartupFilter {
1✔
30
        
31
        /**
32
         * The velocity macro page to redirect to if an error occurs or on initial startup
33
         */
34
        private static final String DEFAULT_PAGE = "generalerror.vm";
35
        
36
        /**
37
         * Called by {@link #doFilter(ServletRequest, ServletResponse, FilterChain)} on GET requests
38
         *
39
         * @param httpRequest
40
         * @param httpResponse
41
         */
42
        @Override
43
        protected void doGet(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
44
                throws IOException, ServletException {
45

NEW
46
                if (getUpdateFilterModel().errorAtStartup != null) {
×
UNCOV
47
                        renderTemplate(DEFAULT_PAGE, new HashMap<>(), httpResponse);
×
48
                }
49
        }
×
50
        
51
        /**
52
         * @see org.openmrs.web.filter.StartupFilter#doPost(javax.servlet.http.HttpServletRequest,
53
         *      javax.servlet.http.HttpServletResponse)
54
         */
55
        @Override
56
        protected void doPost(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
57
                throws IOException, ServletException {
58
                // No longer invoking doPost() since core module upload is deprecated
NEW
59
                httpResponse.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "POST not supported during setup.");
×
UNCOV
60
        }
×
61
        
62
        /**
63
         * @see org.openmrs.web.filter.StartupFilter#getUpdateFilterModel()
64
         */
65
        @Override
66
        protected StartupErrorFilterModel getUpdateFilterModel() {
67
                // this object was initialized in the #init(FilterConfig) method
68
                return new StartupErrorFilterModel(Listener.getErrorAtStartup());
1✔
69
        }
70
        
71
        /**
72
         * @see org.openmrs.web.filter.StartupFilter#skipFilter(HttpServletRequest)
73
         */
74
        @Override
75
        public boolean skipFilter(HttpServletRequest request) {
76
                return !Listener.errorOccurredAtStartup();
1✔
77
        }
78
        
79
        /**
80
         * @see org.openmrs.web.filter.StartupFilter#getTemplatePrefix()
81
         */
82
        @Override
83
        protected String getTemplatePrefix() {
84
                return "org/openmrs/web/filter/startuperror/";
×
85
        }
86
        
87
}
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