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

openmrs / openmrs-core / 43295168256

12 Nov 2026 03:43PM UTC coverage: 68.956% (+0.02%) from 68.932%
43295168256

push

github

ibacher
Restrict PersonAttribute hydration and type formats to permitted classes (#6799)

19 of 19 new or added lines in 2 files covered. (100.0%)

385 existing lines in 7 files now uncovered.

26426 of 38323 relevant lines covered (68.96%)

0.69 hits per line

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

34.11
/web/src/main/java/org/openmrs/module/web/WebModuleUtil.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.module.web;
11

12
import java.io.File;
13
import java.io.FileInputStream;
14
import java.io.FileNotFoundException;
15
import java.io.FileOutputStream;
16
import java.io.IOException;
17
import java.io.InputStream;
18
import java.io.OutputStream;
19
import java.io.StringReader;
20
import java.nio.file.Path;
21
import java.nio.file.Paths;
22
import java.util.ArrayDeque;
23
import java.util.ArrayList;
24
import java.util.Collection;
25
import java.util.Deque;
26
import java.util.Enumeration;
27
import java.util.HashMap;
28
import java.util.Iterator;
29
import java.util.LinkedHashMap;
30
import java.util.List;
31
import java.util.Map;
32
import java.util.Properties;
33
import java.util.concurrent.locks.Lock;
34
import java.util.concurrent.locks.ReentrantLock;
35
import java.util.jar.JarEntry;
36
import java.util.jar.JarFile;
37
import java.util.regex.Pattern;
38

39
import javax.servlet.Filter;
40
import javax.servlet.ServletConfig;
41
import javax.servlet.ServletContext;
42
import javax.servlet.ServletException;
43
import javax.servlet.ServletRequest;
44
import javax.servlet.http.HttpServlet;
45
import javax.servlet.http.HttpServletRequest;
46
import javax.xml.parsers.DocumentBuilder;
47
import javax.xml.parsers.DocumentBuilderFactory;
48
import javax.xml.parsers.ParserConfigurationException;
49
import javax.xml.transform.Transformer;
50
import javax.xml.transform.TransformerException;
51
import javax.xml.transform.TransformerFactory;
52
import javax.xml.transform.dom.DOMSource;
53
import javax.xml.transform.stream.StreamResult;
54

55
import org.openmrs.api.APIException;
56
import org.openmrs.api.context.Context;
57
import org.openmrs.module.Module;
58
import org.openmrs.module.ModuleException;
59
import org.openmrs.module.ModuleFactory;
60
import org.openmrs.module.ModuleUtil;
61
import org.openmrs.module.web.filter.ModuleFilterConfig;
62
import org.openmrs.module.web.filter.ModuleFilterDefinition;
63
import org.openmrs.module.web.filter.ModuleFilterMapping;
64
import org.openmrs.scheduler.SchedulerException;
65
import org.openmrs.scheduler.SchedulerService;
66
import org.openmrs.scheduler.TaskDefinition;
67
import org.openmrs.util.OpenmrsUtil;
68
import org.openmrs.util.PrivilegeConstants;
69
import org.openmrs.web.DispatcherServlet;
70
import org.openmrs.web.StaticDispatcherServlet;
71
import org.slf4j.Logger;
72
import org.slf4j.LoggerFactory;
73
import org.springframework.web.context.support.WebApplicationContextUtils;
74
import org.springframework.web.context.support.XmlWebApplicationContext;
75
import org.w3c.dom.Document;
76
import org.w3c.dom.Element;
77
import org.w3c.dom.NamedNodeMap;
78
import org.w3c.dom.Node;
79
import org.w3c.dom.NodeList;
80
import org.xml.sax.InputSource;
81

82
import static org.openmrs.util.XmlUtils.createDocumentBuilder;
83

84
public class WebModuleUtil {
85

86
        private WebModuleUtil() {
87
        }
88
        
89
        private static final Logger log = LoggerFactory.getLogger(WebModuleUtil.class);
1 ✔
90
        
91
        private static final Lock SERVLET_LOCK = new ReentrantLock();
1 ✔
92
        
93
        private static final Lock FILTERS_LOCK = new ReentrantLock();
1 ✔
94
        
95
        // caches all modules' mapped servlets
96
        private static final Map<String, HttpServlet> MODULE_SERVLETS = new HashMap<>();
1 ✔
97
        
98
        // caches all modules filters and filter-mappings
99
        private static final Map<Module, Collection<Filter>> MODULE_FILTERS = new HashMap<>();
1 ✔
100
        
101
        private static final Map<String, Filter> MODULE_FILTERS_BY_NAME = new HashMap<>();
1 ✔
102
        
103
        private static final Deque<ModuleFilterMapping> MODULE_FILTER_MAPPINGS = new ArrayDeque<>();
1 ✔
104
        
105
        private static DispatcherServlet dispatcherServlet = null;
1 ✔
106
        
107
        private static StaticDispatcherServlet staticDispatcherServlet = null;
1 ✔
108
        
109
        /**
110
         * Performs the webapp specific startup needs for modules Normal startup is done in
111
         * {@link ModuleFactory#startModule(Module)} If delayContextRefresh is true, the spring context
112
         * is not rerun. This will save a lot of time, but it also means that the calling method is
113
         * responsible for restarting the context if necessary (the calling method will also have to
114
         * call {@link #loadServlets(Module, ServletContext)} and
115
         * {@link #loadFilters(Module, ServletContext)}).<br>
116
         * <br>
117
         * If delayContextRefresh is true and this module should have caused a context refresh, a true
118
         * value is returned. Otherwise, false is returned
119
         *
120
         * @param mod Module to start
121
         * @param servletContext the current ServletContext
122
         * @param delayContextRefresh true/false whether or not to do the context refresh
123
         * @return boolean whether or not the spring context need to be refreshed
124
         */
125
        public static boolean startModule(Module mod, ServletContext servletContext, boolean delayContextRefresh) {
126
                
127
                log.debug("Trying to start module {}", mod);
1 ✔
128
                
129
                // only try and start this module if the api started it without a
130
                // problem.
131
                if (ModuleFactory.isModuleStarted(mod) && !mod.hasStartupError()) {
1 ✔
132
                        
133
                        String realPath = getRealPath(servletContext);
1 ✔
134
                        
135
                        if (realPath == null) {
1 ✔
136
                                realPath = System.getProperty("user.dir");
1 ✔
137
                        }
138
                        
139
                        File webInf = new File(realPath + "/WEB-INF".replace("/", File.separator));
1 ✔
140
                        if (!webInf.exists()) {
1 ✔
141
                                webInf.mkdir();
1 ✔
142
                        }
143
                        
144
                        // flag to tell whether we added any xml/dwr/etc changes that necessitate a refresh
145
                        // of the web application context
146
                        boolean moduleNeedsContextRefresh = false;
1 ✔
147
                        
148
                        // copy the html files into the webapp (from /web/module/ in the module)
149
                        // also looks for a spring context file. If found, schedules spring to be restarted
150
                        JarFile jarFile = null;
1 ✔
151
                        OutputStream outStream = null;
1 ✔
152
                        InputStream inStream = null;
1 ✔
153
                        try {
154
                                File modFile = mod.getFile();
1 ✔
UNCOV
155
                                jarFile = new JarFile(modFile);
×
156
                                Enumeration<JarEntry> entries = jarFile.entries();
×
157
                                
158
                                while (entries.hasMoreElements()) {
×
159
                                        JarEntry entry = entries.nextElement();
×
160
                                        String name = entry.getName();
×
UNCOV
161
                                        log.debug("Entry name: {}", name);
×
162
                                        if (name.startsWith("web/module/")) {
×
163
                                                // trim out the starting path of "web/module/"
164
                                                String filepath = name.substring(11);
×
165
                                                
UNCOV
166
                                                StringBuilder absPath = new StringBuilder(realPath + "/WEB-INF");
×
167
                                                
168
                                                // If this is within the tag file directory, copy it into /WEB-INF/tags/module/moduleId/...
169
                                                if (filepath.startsWith("tags/")) {
×
UNCOV
170
                                                        filepath = filepath.substring(5);
×
UNCOV
171
                                                        absPath.append("/tags/module/");
×
172
                                                }
173
                                                // Otherwise, copy it into /WEB-INF/view/module/moduleId/...
174
                                                else {
UNCOV
175
                                                        absPath.append("/view/module/");
×
176
                                                }
177
                                                
178
                                                // if a module id has a . in it, we should treat that as a /, i.e. files in the module
179
                                                // ui.springmvc should go in folder names like .../ui/springmvc/...
UNCOV
180
                                                absPath.append(mod.getModuleIdAsPath()).append("/").append(filepath);
×
UNCOV
181
                                                log.debug("Moving file from: {} to {}", name, absPath);
×
182
                                                
183
                                                // get the output file
184
                                                File outFile = new File(absPath.toString().replace("/", File.separator));
×
UNCOV
185
                                                if (!outFile.toPath().normalize().startsWith(webInf.toPath().normalize())) {
×
UNCOV
186
                                                        throw new UnsupportedOperationException("Attempted to write file '" + name
×
187
                                                                + "' rejected as it attempts to write outside the WEB-INF directory. This may be the result of a zip-slip style attack.");
188
                                                }
189
                                                if (entry.isDirectory()) {
×
UNCOV
190
                                                        if (!outFile.exists()) {
×
UNCOV
191
                                                                outFile.mkdirs();
×
192
                                                        }
193
                                                } else {
194
                                                        // make the parent directories in case it doesn't exist
195
                                                        File parentDir = outFile.getParentFile();
×
UNCOV
196
                                                        if (!parentDir.exists()) {
×
UNCOV
197
                                                                parentDir.mkdirs();
×
198
                                                        }
199
                                                        
200
                                                        // copy the contents over to the webapp for non directories
201
                                                        outStream = new FileOutputStream(outFile, false);
×
UNCOV
202
                                                        inStream = jarFile.getInputStream(entry);
×
203
                                                        OpenmrsUtil.copyFile(inStream, outStream);
×
204
                                                }
205
                                        } else if ("moduleApplicationContext.xml".equals(name) || "webModuleApplicationContext.xml".equals(name)) {
×
206
                                                moduleNeedsContextRefresh = true;
×
UNCOV
207
                                        } else if (name.equals(mod.getModuleId() + "Context.xml")) {
×
208
                                                String msg = "DEPRECATED: '" + name
×
209
                                                        + "' should be named 'moduleApplicationContext.xml' now. Please update/upgrade. ";
210
                                                throw new ModuleException(msg, mod.getModuleId());
×
211
                                        }
UNCOV
212
                                }
×
213
                        }
214
                        catch (IOException io) {
1 ✔
215
                                log.warn("Unable to copy files from module " + mod.getModuleId() + " to the web layer", io);
1 ✔
216
                        }
217
                        finally {
218
                                if (jarFile != null) {
1 ✔
219
                                        try {
220
                                                jarFile.close();
×
221
                                        }
222
                                        catch (IOException io) {
×
UNCOV
223
                                                log.warn("Couldn't close jar file: " + jarFile.getName(), io);
×
UNCOV
224
                                        }
×
225
                                }
226
                                if (inStream != null) {
1 ✔
227
                                        try {
228
                                                inStream.close();
×
229
                                        }
230
                                        catch (IOException io) {
×
UNCOV
231
                                                log.warn("Couldn't close InputStream: " + io);
×
UNCOV
232
                                        }
×
233
                                }
234
                                if (outStream != null) {
1 ✔
235
                                        try {
236
                                                outStream.close();
×
237
                                        }
238
                                        catch (IOException io) {
×
UNCOV
239
                                                log.warn("Couldn't close OutputStream: " + io);
×
UNCOV
240
                                        }
×
241
                                }
242
                        }
243
                        
244
                        // find and add the dwr code to the dwr-modules.xml file (if defined)
245
                        InputStream inputStream = null;
1 ✔
246
                        try {
247
                                Document config = mod.getConfig();
1 ✔
248
                                Element root = config.getDocumentElement();
1 ✔
249
                                if (root.getElementsByTagName("dwr").getLength() > 0) {
1 ✔
250
                                        
251
                                        // get the dwr-module.xml file that we're appending our code to
252
                                        File f = new File(realPath + "/WEB-INF/dwr-modules.xml".replace("/", File.separator));
1 ✔
253
                                        
254
                                        // testing if file exists
255
                                        if (!f.exists()) {
1 ✔
256
                                                // if it does not -> needs to be created
257
                                                createDwrModulesXml(realPath);
1 ✔
258
                                        }
259
                                        
260
                                        inputStream = new FileInputStream(f);
1 ✔
261
                                        Document dwrmodulexml = getDWRModuleXML(inputStream, realPath);
1 ✔
262
                                        Element outputRoot = dwrmodulexml.getDocumentElement();
1 ✔
263
                                        
264
                                        // loop over all of the children of the "dwr" tag
265
                                        Node node = root.getElementsByTagName("dwr").item(0);
1 ✔
266
                                        Node current = node.getFirstChild();
1 ✔
267
                                        
268
                                        while (current != null) {
1 ✔
269
                                                if ("allow".equals(current.getNodeName()) || "signatures".equals(current.getNodeName())
1 ✔
270
                                                        || "init".equals(current.getNodeName())) {
1 ✔
271
                                                        ((Element) current).setAttribute("moduleId", mod.getModuleId());
1 ✔
272
                                                        outputRoot.appendChild(dwrmodulexml.importNode(current, true));
1 ✔
273
                                                }
274
                                                
275
                                                current = current.getNextSibling();
1 ✔
276
                                        }
277
                                        
278
                                        moduleNeedsContextRefresh = true;
1 ✔
279
                                        
280
                                        // save the dwr-modules.xml file.
281
                                        OpenmrsUtil.saveDocument(dwrmodulexml, f);
1 ✔
282
                                }
283
                        }
UNCOV
284
                        catch (FileNotFoundException e) {
×
UNCOV
285
                                throw new ModuleException(realPath + "/WEB-INF/dwr-modules.xml file doesn't exist.", e);
×
286
                        }
287
                        finally {
288
                                if (inputStream != null) {
1 ✔
289
                                        try {
290
                                                inputStream.close();
1 ✔
291
                                        }
UNCOV
292
                                        catch (IOException io) {
×
UNCOV
293
                                                log.error("Error while closing input stream", io);
×
294
                                        }
1 ✔
295
                                }
296
                        }
297
                        
298
                        // mark to delete the entire module web directory on exit
299
                        // this will usually only be used when an improper shutdown has occurred.
300
                        String folderPath = realPath + "/WEB-INF/view/module/" + mod.getModuleIdAsPath();
1 ✔
301
                        File outFile = new File(folderPath.replace("/", File.separator));
1 ✔
302
                        outFile.deleteOnExit();
1 ✔
303
                        
304
                        // additional checks on module needing a context refresh
305
                        if (!moduleNeedsContextRefresh && mod.getAdvicePoints() != null && !mod.getAdvicePoints().isEmpty()) {
1 ✔
306
                                
307
                                // AOP advice points are only loaded during the context refresh now.
308
                                // if the context hasn't been marked to be refreshed yet, mark it
309
                                // now if this module defines some advice
UNCOV
310
                                moduleNeedsContextRefresh = true;
×
311
                                
312
                        }
313
                        
314
                        // refresh the spring web context to get the just-created xml
315
                        // files into it (if we copied an xml file)
316
                        if (moduleNeedsContextRefresh && !delayContextRefresh) {
1 ✔
UNCOV
317
                                log.debug("Refreshing context for module {}", mod.getModuleId());
×
318
                                
319
                                try {
UNCOV
320
                                        refreshWAC(servletContext, false, mod);
×
321
                                        log.debug("Done refreshing context for module {}", mod.getModuleId());
×
322
                                }
323
                                catch (Exception e) {
×
UNCOV
324
                                        String msg = "Unable to refresh the WebApplicationContext";
×
325
                                        mod.setStartupErrorMessage(msg, e);
×
326
                                        
UNCOV
327
                                        if (log.isWarnEnabled()) {
×
UNCOV
328
                                                log.warn(msg + " for module: " + mod.getModuleId(), e);
×
329
                                        }
330
                                        
331
                                        try {
UNCOV
332
                                                stopModule(mod, servletContext, true);
×
333
                                                ModuleFactory.stopModule(mod, true, true); //remove jar from classloader play
×
334
                                        }
335
                                        catch (Exception e2) {
×
336
                                                // exception expected with most modules here
UNCOV
337
                                                if (log.isWarnEnabled()) {
×
338
                                                        log.warn("Error while stopping a module that had an error on refreshWAC", e2);
×
339
                                                }
UNCOV
340
                                        }
×
341
                                        
342
                                        // try starting the application context again
343
                                        log.debug("Refreshing context for module {} (re-trying)", mod.getModuleId());
×
UNCOV
344
                                        refreshWAC(servletContext, false, mod);
×
345
                                        log.debug("Done refreshing context for module {} (re-trying)", mod.getModuleId());
×
346
                                        
UNCOV
347
                                        notifySuperUsersAboutModuleFailure(mod);
×
UNCOV
348
                                }
×
349
                                
350
                        }
351
                        
352
                        if (!delayContextRefresh && ModuleFactory.isModuleStarted(mod)) {
1 ✔
353
                                // only loading the servlets/filters if spring is refreshed because one
354
                                // might depend on files being available in spring
355
                                // if the caller wanted to delay the refresh then they are responsible for
356
                                // calling these two methods on the module
357
                                
358
                                // find and cache the module's servlets
359
                                //(only if the module started successfully previously)
360
                                log.debug("Loading servlets and filters for module {}", mod);
×
361
                                servletContext.setAttribute(OpenmrsJspServlet.OPENMRS_TLD_SCAN_NEEDED, true);
×
UNCOV
362
                                loadServlets(mod, servletContext);
×
UNCOV
363
                                loadFilters(mod, servletContext);
×
364
                        }
365
                        
366
                        // return true if the module needs a context refresh and we didn't do it here
367
                        return (moduleNeedsContextRefresh && delayContextRefresh);
1 ✔
368
                        
369
                }
370
                
371
                // we aren't processing this module, so a context refresh is not necessary
UNCOV
372
                return false;
×
373
        }
374
        
375
        /** Stops all tasks started by given module
376
         * @param mod
377
         */
378
        private static void stopTasks(Module mod) {
379
                SchedulerService schedulerService;
380
                try {
UNCOV
381
                        schedulerService = Context.getSchedulerService();
×
382
                } catch (NullPointerException | APIException e) {
×
383
                        // if we got here, the scheduler has already been shut down, so there's no work to do
UNCOV
384
                        return;
×
385
                }
×
386
                
UNCOV
387
                String modulePackageName = mod.getPackageName();
×
388
                for (TaskDefinition task : schedulerService.getRegisteredTasks()) {
×
389
                        
UNCOV
390
                        String taskClass = task.getTaskClass();
×
391
                        if (isModulePackageNameInTaskClass(modulePackageName, taskClass)) {
×
392
                                try {
393
                                        schedulerService.shutdownTask(task);
×
394
                                }
395
                                catch (SchedulerException e) {
×
UNCOV
396
                                        log.error("Couldn't stop task:" + task + " for module: " + mod);
×
397
                                }
×
398
                        }
UNCOV
399
                }
×
UNCOV
400
        }
×
401
        
402
        /**
403
         * Checks if module package name is in task class name
404
         * @param modulePackageName the package name of module
405
         * @param taskClass the class of given task
406
         * @return true if task and module are in the same package
407
         * <strong>Should</strong> return false for different package names
408
         * <strong>Should</strong> return false if module has longer package name
409
         * <strong>Should</strong> properly match subpackages
410
         * <strong>Should</strong> return false for empty package names
411
         */
412
        public static boolean isModulePackageNameInTaskClass(String modulePackageName, String taskClass) {
413
                return modulePackageName.length() <= taskClass.length()
1 ✔
414
                        && taskClass.matches(Pattern.quote(modulePackageName) + "(\\..*)+");
1 ✔
415
        }
416
        
417
        /**
418
         * Send an Alert to all super users that the given module did not start successfully.
419
         *
420
         * @param mod The Module that failed
421
         */
422
        private static void notifySuperUsersAboutModuleFailure(Module mod) {
423
                try {
424
                        // Add the privileges necessary for notifySuperUsers
UNCOV
425
                        Context.addProxyPrivilege(PrivilegeConstants.MANAGE_ALERTS);
×
UNCOV
426
                        Context.addProxyPrivilege(PrivilegeConstants.GET_USERS);
×
427
                        
428
                        // Send an alert to all administrators
UNCOV
429
                        Context.getAlertService().notifySuperUsers("Module.startupError.notification.message", null, mod.getName());
×
430
                }
431
                finally {
432
                        // Remove added privileges
UNCOV
433
                        Context.removeProxyPrivilege(PrivilegeConstants.GET_USERS);
×
434
                        Context.removeProxyPrivilege(PrivilegeConstants.MANAGE_ALERTS);
×
435
                }
UNCOV
436
        }
×
437
        
438
        /**
439
         * This method will find and cache this module's servlets (so that it doesn't have to look them
440
         * up every time)
441
         *
442
         * @param mod
443
         * @param servletContext the servlet context
444
         */
445
        public static void loadServlets(Module mod, ServletContext servletContext) {
446
                Element rootNode = mod.getConfig().getDocumentElement();
1 ✔
447
                NodeList servletTags = rootNode.getElementsByTagName("servlet");
1 ✔
448
                
449
                for (int i = 0; i < servletTags.getLength(); i++) {
1 ✔
450
                        Node node = servletTags.item(i);
1 ✔
451
                        NodeList childNodes = node.getChildNodes();
1 ✔
452
                        String name = "", className = "";
1 ✔
453

454
                        Map<String, String> initParams = new HashMap<>();
1 ✔
455
                        for (int j = 0; j < childNodes.getLength(); j++) {
1 ✔
456
                                Node childNode = childNodes.item(j);
1 ✔
457
                                if ("servlet-name".equals(childNode.getNodeName())) {
1 ✔
458
                                        if (childNode.getTextContent() != null) {
1 ✔
459
                                                name = childNode.getTextContent().trim();
1 ✔
460
                                        }
461
                                } else if ("servlet-class".equals(childNode.getNodeName()) && childNode.getTextContent() != null) {
1 ✔
462
                                        className = childNode.getTextContent().trim();
1 ✔
463
                                } else if ("init-param".equals(childNode.getNodeName())) {
1 ✔
464
                                        NodeList initParamChildren = childNode.getChildNodes();
1 ✔
465
                                        String paramName = null, paramValue = null;
1 ✔
466
                                        for (int k = 0; k < initParamChildren.getLength(); k++) {
1 ✔
467
                                                Node initParamChild = initParamChildren.item(k);
1 ✔
468
                                                if ("param-name".equals(initParamChild.getNodeName()) && initParamChild.getTextContent() != null) {
1 ✔
469
                                                        paramName = initParamChild.getTextContent().trim();
1 ✔
470
                                                } else if ("param-value".equals(initParamChild.getNodeName()) && initParamChild.getTextContent() != null) {
1 ✔
471
                                                        paramValue = initParamChild.getTextContent().trim();
1 ✔
472
                                                }
473
                                        }
474

475
                                        if (paramName != null && paramValue != null) {
1 ✔
476
                                                initParams.put(paramName, paramValue);
1 ✔
477
                                        }
478
                                }
479
                        }
480
                        if (name.length() == 0 || className.length() == 0) {
1 ✔
481
                                log.warn("both 'servlet-name' and 'servlet-class' are required for the 'servlet' tag. Given '" + name
×
UNCOV
482
                                        + "' and '" + className + "' for module " + mod.getName());
×
UNCOV
483
                                continue;
×
484
                        }
485
                        
486
                        HttpServlet httpServlet;
487
                        try {
488
                                httpServlet = (HttpServlet) ModuleFactory.getModuleClassLoader(mod).loadClass(className).newInstance();
1 ✔
489
                        }
490
                        catch (ClassCastException e) {
×
UNCOV
491
                                log.warn("Class {} from module {} is not a valid HttpServlet", className, mod, e);
×
492
                                continue;
×
493
                        }
494
                        catch (ClassNotFoundException e) {
×
UNCOV
495
                                log.warn("Class {} not found for servlet {} from module {}", className, name, mod, e);
×
496
                                continue;
×
497
                        }
498
                        catch (IllegalAccessException e) {
×
UNCOV
499
                                log.warn("Class {} cannot be accessed for servlet {} from module {}", className, name, mod, e);
×
500
                                continue;
×
501
                        }
502
                        catch (InstantiationException e) {
×
UNCOV
503
                                log.warn("Class {} cannot be instantiated for servlet {} from module {}", className, name, mod, e);
×
UNCOV
504
                                continue;
×
505
                        }
1 ✔
506
                        
507
                        try {
508
                                log.debug("Initializing {} servlet. - {}.", name, httpServlet);
1 ✔
509
                                ServletConfig servletConfig = new ModuleServlet.SimpleServletConfig(name, servletContext, initParams);
1 ✔
510
                                httpServlet.init(servletConfig);
1 ✔
511
                        }
512
                        catch (Exception e) {
×
UNCOV
513
                                log.warn("Unable to initialize servlet {}", name, e);
×
UNCOV
514
                                throw new ModuleException("Unable to initialize servlet " + name, mod.getModuleId(), e);
×
515
                        }
1 ✔
516
                        
517
                        // don't allow modules to overwrite servlets of other modules.
518
                        HttpServlet otherServletUsingSameName = MODULE_SERVLETS.get(name);
1 ✔
519
                        if (otherServletUsingSameName != null) {
1 ✔
UNCOV
520
                                String otherServletName = otherServletUsingSameName.getClass().getName();
×
UNCOV
521
                                throw new ModuleException("A servlet mapping with name " + name + " is already in use and pointing at: "
×
522
                                        + otherServletName + " from another installed module and this module is trying"
523
                                        + " to use that same name.  Either the module attempting to be installed (" + mod
524
                                        + ") will not work or the other one will not.  Please consult the developers of these two"
525
                                        + " modules to sort this out.");
526
                        }
527
                        
528
                        log.debug("Caching the {} servlet.", name);
1 ✔
529
                        
530
                        SERVLET_LOCK.lock();
1 ✔
531
                        try {
532
                                MODULE_SERVLETS.put(name, httpServlet);
1 ✔
533
                        } finally {
534
                                SERVLET_LOCK.unlock();
1 ✔
535
                        }
536
                }
537
        }
1 ✔
538
        
539
        /**
540
         * Remove the servlets defined for this module
541
         *
542
         * @param mod the module that is being stopped that needs its servlets removed
543
         */
544
        public static void unloadServlets(Module mod) {
545
                Element rootNode = mod.getConfig().getDocumentElement();
1 ✔
546
                NodeList servletTags = rootNode.getElementsByTagName("servlet");
1 ✔
547
                
548
                for (int i = 0; i < servletTags.getLength(); i++) {
1 ✔
549
                        Node node = servletTags.item(i);
1 ✔
550
                        NodeList childNodes = node.getChildNodes();
1 ✔
551
                        String name;
552
                        for (int j = 0; j < childNodes.getLength(); j++) {
1 ✔
553
                                Node childNode = childNodes.item(j);
1 ✔
554
                                if ("servlet-name".equals(childNode.getNodeName()) && childNode.getTextContent() != null) {
1 ✔
555
                                        name = childNode.getTextContent().trim();
1 ✔
556
                                        
557
                                        HttpServlet servlet;
558
                                        SERVLET_LOCK.lock();
1 ✔
559
                                        try {
560
                                                servlet = MODULE_SERVLETS.get(name);
1 ✔
561
                                        } finally {
562
                                                SERVLET_LOCK.unlock();
1 ✔
563
                                        }
564
                                        
565
                                        if (servlet != null) {
1 ✔
566
                                                // shut down the servlet
567
                                                servlet.destroy();
1 ✔
568
                                        }
569
                                        
570
                                        SERVLET_LOCK.lock();
1 ✔
571
                                        try {
572
                                                MODULE_SERVLETS.remove(name);
1 ✔
573
                                        } finally {
574
                                                SERVLET_LOCK.unlock();
1 ✔
575
                                        }
576
                                }
577
                        }
578
                }
579
        }
1 ✔
580
        
581
        /**
582
         * This method will initialize and store this module's filters
583
         *
584
         * @param module - The Module to load and register Filters
585
         * @param servletContext - The servletContext within which this method is called
586
         */
587
        public static void loadFilters(Module module, ServletContext servletContext) {
588
                
589
                // Load Filters
UNCOV
590
                Map<String, Filter> filters = new LinkedHashMap<>();
×
591
                
592
                Map<String, Filter> existingFilters;
593
                FILTERS_LOCK.lock();
×
594
                try {
595
                        existingFilters = new HashMap<>(MODULE_FILTERS_BY_NAME);
×
596
                } finally {
UNCOV
597
                        FILTERS_LOCK.unlock();
×
598
                }
599
                
600
                for (ModuleFilterDefinition def : ModuleFilterDefinition.retrieveFilterDefinitions(module)) {
×
UNCOV
601
                        String name = def.getFilterName();
×
602
                        String className = def.getFilterClass();
×
603
                        
604
                        if (existingFilters.containsKey(name)) {
×
UNCOV
605
                                throw new ModuleException("A filter with the name " + name + " is already in use and pointing at: "
×
UNCOV
606
                                        + existingFilters.get(name).getClass().getName()
×
607
                                        + " from another installed module and this module is trying"
608
                                        + " to use that same name.  Either the module attempting to be installed (" + module
609
                                        + ") will not work or the other one will not.  Please consult the developers of these two"
610
                                        + " modules to sort this out.");
611
                        }
612
                        
UNCOV
613
                        ModuleFilterConfig config = ModuleFilterConfig.getInstance(def, servletContext);
×
614
                        
615
                        Filter filter;
616
                        try {
617
                                filter = (Filter) ModuleFactory.getModuleClassLoader(module).loadClass(className).newInstance();
×
618
                        }
619
                        catch (ClassCastException e) {
×
UNCOV
620
                                log.warn("Class {} from module {} is not a valid Filter", className, module, e);
×
621
                                continue;
×
622
                        }
623
                        catch (ClassNotFoundException e) {
×
UNCOV
624
                                log.warn("Class {} not found for servlet {} from module {}", className, name, module, e);
×
625
                                continue;
×
626
                        }
627
                        catch (IllegalAccessException e) {
×
UNCOV
628
                                log.warn("Class {} cannot be accessed for servlet {} from module {}", className, name, module, e);
×
629
                                continue;
×
630
                        }
631
                        catch (InstantiationException e) {
×
632
                                log.warn("Class {} cannot be instantiated for servlet {} from module {}", className, name, module, e);
×
UNCOV
633
                                continue;
×
UNCOV
634
                        }
×
635
                        
636
                        try {
UNCOV
637
                                log.debug("Initializing {} filter. - {}.", name, filter);
×
638
                                filter.init(config);
×
639
                        }
640
                        catch (Exception e) {
×
641
                                log.warn("Unable to initialize servlet {}", name, e);
×
UNCOV
642
                                throw new ModuleException("Unable to initialize servlet " + name, module.getModuleId(), e);
×
643
                        }
×
644
                        
UNCOV
645
                        filters.put(name, filter);
×
646
                }
×
647

648
                FILTERS_LOCK.lock();
×
649
                try {
650
                        MODULE_FILTERS.put(module, filters.values());
×
UNCOV
651
                        MODULE_FILTERS_BY_NAME.putAll(filters);
×
UNCOV
652
                        log.debug("Module {} successfully loaded {} filters.", module, filters.size());
×
653
                        
654
                        // Load Filter Mappings
UNCOV
655
                        Deque<ModuleFilterMapping> modMappings = ModuleFilterMapping.retrieveFilterMappings(module);
×
656
                        
657
                        // IMPORTANT: Filter load order
658
                        // retrieveFilterMappings will return the list of filters in the order they occur in the config.xml file
659
                        // here we add them to the *front* of the filter mappings
660
                        modMappings.descendingIterator().forEachRemaining(MODULE_FILTER_MAPPINGS::addFirst);
×
661
                        
662
                        log.debug("Module {} successfully loaded {} filter mappings.", module, modMappings.size());
×
663
                } finally {
664
                        FILTERS_LOCK.unlock();
×
665
                }
UNCOV
666
        }
×
667
        
668
        /**
669
         * This method will destroy and remove all filters that were registered by the passed
670
         * {@link Module}
671
         *
672
         * @param module - The Module for which you want to remove and destroy filters.
673
         */
674
        public static void unloadFilters(Module module) {
675
                
676
                // Unload Filter Mappings
677
                for (Iterator<ModuleFilterMapping> mapIter = MODULE_FILTER_MAPPINGS.iterator(); mapIter.hasNext();) {
×
678
                        ModuleFilterMapping mapping = mapIter.next();
×
679
                        if (module.equals(mapping.getModule())) {
×
UNCOV
680
                                mapIter.remove();
×
681
                                log.debug("Removed ModuleFilterMapping: " + mapping);
×
682
                        }
UNCOV
683
                }
×
684
                
685
                // unload Filters
UNCOV
686
                Collection<Filter> filters = MODULE_FILTERS.get(module);
×
687
                if (filters != null) {
×
688
                        try {
689
                                for (Filter f : filters) {
×
UNCOV
690
                                        f.destroy();
×
691
                                }
×
692
                        }
693
                        catch (Exception e) {
×
UNCOV
694
                                log.warn("An error occurred while trying to destroy and remove module Filter.", e);
×
695
                        }
×
696
                        
UNCOV
697
                        log.debug("Module: " + module.getModuleId() + " successfully unloaded " + filters.size() + " filters.");
×
698
                        MODULE_FILTERS.remove(module);
×
699

700
                        MODULE_FILTERS_BY_NAME.values().removeIf(filters::contains);
×
701
                }
UNCOV
702
        }
×
703
        
704
        /**
705
         * This method will return all Filters that have been registered a module
706
         *
707
         * @return A Collection of {@link Filter}s that have been registered by a module
708
         */
709
        public static Collection<Filter> getFilters() {
UNCOV
710
                return MODULE_FILTERS_BY_NAME.values();
×
711
        }
712
        
713
        /**
714
         * This method will return all Filter Mappings that have been registered by a module
715
         *
716
         * @return A Collection of all {@link ModuleFilterMapping}s that have been registered by a
717
         *         Module
718
         */
719
        public static Collection<ModuleFilterMapping> getFilterMappings() {
UNCOV
720
                return new ArrayList<>(MODULE_FILTER_MAPPINGS);
×
721
        }
722
        
723
        /**
724
         * Return List of Filters that have been loaded through Modules that have mappings that pass for
725
         * the passed request
726
         *
727
         * @param request - The request to check for matching {@link Filter}s
728
         * @return List of all {@link Filter}s that have filter mappings that match the passed request
729
         */
730
        public static List<Filter> getFiltersForRequest(ServletRequest request) {
731
                
732
                List<Filter> filters = new ArrayList<>();
×
733
                if (request != null) {
×
UNCOV
734
                        HttpServletRequest httpRequest = (HttpServletRequest) request;
×
735
                        String requestPath = httpRequest.getRequestURI();
×
736
                        
737
                        if (requestPath != null) {
×
UNCOV
738
                                if (requestPath.startsWith(httpRequest.getContextPath())) {
×
739
                                        requestPath = requestPath.substring(httpRequest.getContextPath().length());
×
740
                                }
741
                                for (ModuleFilterMapping filterMapping : WebModuleUtil.getFilterMappings()) {
×
742
                                        if (ModuleFilterMapping.filterMappingPasses(filterMapping, requestPath)) {
×
743
                                                Filter passedFilter = MODULE_FILTERS_BY_NAME.get(filterMapping.getFilterName());
×
UNCOV
744
                                                if (passedFilter != null) {
×
745
                                                        filters.add(passedFilter);
×
746
                                                } else {
UNCOV
747
                                                        log.warn("Unable to retrieve filter that has a name of " + filterMapping.getFilterName()
×
748
                                                                + " in filter mapping.");
749
                                                }
750
                                        }
UNCOV
751
                                }
×
752
                        }
753
                }
UNCOV
754
                return filters;
×
755
        }
756
        
757
        /**
758
         * @param inputStream
759
         * @param realPath
760
         * @return
761
         */
762
        private static Document getDWRModuleXML(InputStream inputStream, String realPath) {
763
                Document dwrmodulexml;
764
                try {
765
                        DocumentBuilder db = createDocumentBuilder();
1 ✔
766
                        dwrmodulexml = db.parse(inputStream);
1 ✔
767
                }
UNCOV
768
                catch (Exception e) {
×
UNCOV
769
                        throw new ModuleException("Error parsing dwr-modules.xml file", e);
×
770
                }
1 ✔
771
                
772
                return dwrmodulexml;
1 ✔
773
        }
774
        
775
        /**
776
         * Reverses all activities done by startModule(org.openmrs.module.Module) Normal stop/shutdown
777
         * is done by ModuleFactory
778
         */
779
        public static void shutdownModules(ServletContext servletContext) {
780
                
UNCOV
781
                String realPath = getRealPath(servletContext);
×
782
                
783
                // clear the module messages
784
                String messagesPath = realPath + "/WEB-INF/";
×
UNCOV
785
                File folder = new File(messagesPath.replace("/", File.separator));
×
786
                
787
                File[] files = folder.listFiles();
×
788
                if (folder.exists() && files != null) {
×
UNCOV
789
                        Properties emptyProperties = new Properties();
×
790
                        for (File f : files) {
×
791
                                if (f.getName().startsWith("module_messages")) {
×
792
                                        OpenmrsUtil.storeProperties(emptyProperties, f, "");
×
793
                                }
794
                        }
795
                }
796
                
797
                // call web shutdown for each module
UNCOV
798
                for (Module mod : ModuleFactory.getLoadedModules()) {
×
UNCOV
799
                        stopModule(mod, servletContext, true);
×
UNCOV
800
                }
×
801
                
802
        }
×
803
        
804
        /**
805
         * Reverses all visible activities done by startModule(org.openmrs.module.Module)
806
         *
807
         * @param mod
808
         * @param servletContext
809
         */
810
        public static void stopModule(Module mod, ServletContext servletContext) {
UNCOV
811
                stopModule(mod, servletContext, false);
×
UNCOV
812
        }
×
813
        
814
        /**
815
         * Reverses all visible activities done by startModule(org.openmrs.module.Module)
816
         *
817
         * @param mod
818
         * @param servletContext
819
         * @param skipRefresh
820
         */
821
        public static void stopModule(Module mod, ServletContext servletContext, boolean skipRefresh) {
822
                
UNCOV
823
                String moduleId = mod.getModuleId();
×
UNCOV
824
                String modulePackage = mod.getPackageName();
×
825
                
826
                // stop all dependent modules
827
                for (Module dependentModule : ModuleFactory.getStartedModules()) {
×
UNCOV
828
                        if (!dependentModule.equals(mod) && dependentModule.getRequiredModules().contains(modulePackage)) {
×
UNCOV
829
                                stopModule(dependentModule, servletContext, skipRefresh);
×
830
                        }
831
                }
×
832
                
UNCOV
833
                String realPath = getRealPath(servletContext);
×
834
                
835
                // delete the web files from the webapp
836
                String absPath = realPath + "/WEB-INF/view/module/" + moduleId;
×
UNCOV
837
                File moduleWebFolder = new File(absPath.replace("/", File.separator));
×
UNCOV
838
                if (moduleWebFolder.exists()) {
×
839
                        try {
840
                                OpenmrsUtil.deleteDirectory(moduleWebFolder);
×
841
                        }
UNCOV
842
                        catch (IOException io) {
×
843
                                log.warn("Couldn't delete: " + moduleWebFolder.getAbsolutePath(), io);
×
UNCOV
844
                        }
×
845
                }
846
                
847
                // (not) deleting module message properties
848
                
849
                // remove the module's servlets
UNCOV
850
                unloadServlets(mod);
×
851
                
852
                // remove the module's filters and filter mappings
853
                unloadFilters(mod);
×
854
                
855
                // stop all tasks associated with mod
856
                stopTasks(mod);
×
857
                
858
                // remove this module's entries in the dwr xml file
859
                InputStream inputStream = null;
×
860
                try {
UNCOV
861
                        Document config = mod.getConfig();
×
862
                        Element root = config.getDocumentElement();
×
863
                        // if they defined any xml element
864
                        if (root.getElementsByTagName("dwr").getLength() > 0) {
×
865
                                
866
                                // get the dwr-module.xml file that we're appending our code to
867
                                File f = new File(realPath + "/WEB-INF/dwr-modules.xml".replace("/", File.separator));
×
868
                                
869
                                // testing if file exists
870
                                if (!f.exists()) {
×
871
                                        // if it does not -> needs to be created
UNCOV
872
                                        createDwrModulesXml(realPath);
×
873
                                }
874
                                
875
                                inputStream = new FileInputStream(f);
×
UNCOV
876
                                Document dwrmodulexml = getDWRModuleXML(inputStream, realPath);
×
UNCOV
877
                                Element outputRoot = dwrmodulexml.getDocumentElement();
×
878
                                
879
                                // loop over all of the children of the "dwr" tag
880
                                // and remove all "allow" and "signature" tags that have the
881
                                // same moduleId attr as the module being stopped
UNCOV
882
                                NodeList nodeList = outputRoot.getChildNodes();
×
UNCOV
883
                                int i = 0;
×
UNCOV
884
                                while (i < nodeList.getLength()) {
×
885
                                        Node current = nodeList.item(i);
×
886
                                        if ("allow".equals(current.getNodeName()) || "signatures".equals(current.getNodeName())) {
×
887
                                                NamedNodeMap attrs = current.getAttributes();
×
888
                                                Node attr = attrs.getNamedItem("moduleId");
×
889
                                                if (attr != null && moduleId.equals(attr.getNodeValue())) {
×
890
                                                        outputRoot.removeChild(current);
×
891
                                                } else {
892
                                                        i++;
×
893
                                                }
UNCOV
894
                                        } else {
×
895
                                                i++;
×
896
                                        }
897
                                }
×
898
                                
899
                                // save the dwr-modules.xml file.
900
                                OpenmrsUtil.saveDocument(dwrmodulexml, f);
×
901
                        }
902
                }
903
                catch (FileNotFoundException e) {
×
UNCOV
904
                        throw new ModuleException(realPath + "/WEB-INF/dwr-modules.xml file doesn't exist.", e);
×
905
                }
906
                finally {
907
                        if (inputStream != null) {
×
908
                                try {
UNCOV
909
                                        inputStream.close();
×
910
                                }
UNCOV
911
                                catch (IOException io) {
×
912
                                        log.error("Error while closing input stream", io);
×
UNCOV
913
                                }
×
914
                        }
915
                }
916
                
UNCOV
917
                if (!skipRefresh) {        
×
UNCOV
918
                        refreshWAC(servletContext, false, null);
×
919
                }
920
                
921
        }
×
922
        
923
        /**
924
         * Stops, closes, and refreshes the Spring context for the given <code>servletContext</code>
925
         *
926
         * @param servletContext
927
         * @param isOpenmrsStartup if this refresh is being done at application startup
928
         * @param startedModule the module that was just started and waiting on the context refresh
929
         * @return The newly refreshed webApplicationContext
930
         */
931
        public static XmlWebApplicationContext refreshWAC(ServletContext servletContext, boolean isOpenmrsStartup,
932
                Module startedModule) {
UNCOV
933
                XmlWebApplicationContext wac = (XmlWebApplicationContext) WebApplicationContextUtils
×
UNCOV
934
                        .getWebApplicationContext(servletContext);
×
UNCOV
935
                log.debug("Refreshing Web Application Context of class: {}", wac.getClass().getName());
×
936
                
937
                if (dispatcherServlet != null) {
×
938
                        dispatcherServlet.stopAndCloseApplicationContext();
×
939
                }
940
                
941
                if (staticDispatcherServlet != null) {
×
UNCOV
942
                        staticDispatcherServlet.stopAndCloseApplicationContext();
×
943
                }
944
                
945
                XmlWebApplicationContext newAppContext = (XmlWebApplicationContext) ModuleUtil.refreshApplicationContext(wac,
×
946
                    isOpenmrsStartup, startedModule);
947
                
948
                try {
949
                        // must "refresh" the spring dispatcherservlet as well to add in
950
                        //the new handlerMappings
UNCOV
951
                        if (dispatcherServlet != null) {
×
UNCOV
952
                                dispatcherServlet.reInitFrameworkServlet();
×
953
                        }
954
                        
955
                        if (staticDispatcherServlet != null) {
×
UNCOV
956
                                staticDispatcherServlet.refreshApplicationContext();
×
957
                        }
958
                }
959
                catch (ServletException se) {
×
UNCOV
960
                        log.warn("Caught a servlet exception while refreshing the dispatcher servlet", se);
×
UNCOV
961
                }
×
962
                
963
                return newAppContext;
×
964
        }
965
        
966
        /**
967
         * Save the dispatcher servlet for use later (reinitializing things)
968
         *
969
         * @param ds
970
         */
971
        public static void setDispatcherServlet(DispatcherServlet ds) {
972
                log.debug("Setting dispatcher servlet: " + ds);
1 ✔
973
                dispatcherServlet = ds;
1 ✔
974
        }
1 ✔
975
        
976
        /**
977
         * Save the static content dispatcher servlet for use later when refreshing spring
978
         *
979
         * @param ds
980
         */
981
        public static void setStaticDispatcherServlet(StaticDispatcherServlet ds) {
UNCOV
982
                log.debug("Setting dispatcher servlet for static content: " + ds);
×
UNCOV
983
                staticDispatcherServlet = ds;
×
UNCOV
984
        }
×
985
        
986
        /**
987
         * Finds the servlet defined by the servlet name
988
         *
989
         * @param servletName the name of the servlet out of the path
990
         * @return the current servlet or null if none defined
991
         */
992
        public static HttpServlet getServlet(String servletName) {
993
                return MODULE_SERVLETS.get(servletName);
1 ✔
994
        }
995
        
996
        /**
997
         * Retrieves a path to a folder that stores web files of a module. <br>
998
         * (path-to-openmrs/WEB-INF/view/module/moduleid)
999
         *
1000
         * @param moduleId module id (e.g., "basicmodule")
1001
         * @return a path to a folder that stores web files or null if not in a web environment
1002
         * <strong>Should</strong> return the correct module folder
1003
         * <strong>Should</strong> return null if the dispatcher servlet is not yet set
1004
         * <strong>Should</strong> return the correct module folder if real path has a trailing slash
1005
         */
1006
        public static String getModuleWebFolder(String moduleId) {
1007
                if (dispatcherServlet == null) {
1 ✔
1008
                        throw new ModuleException("Dispatcher servlet must be present in the web environment");
1 ✔
1009
                }
1010
                
1011
                String moduleFolder = "WEB-INF/view/module/";
1 ✔
1012
                String realPath = dispatcherServlet.getServletContext().getRealPath("");
1 ✔
1013
                String moduleWebFolder;
1014
                
1015
                //RealPath may contain '/' on Windows when running tests with the mocked servlet context
1016
                if (realPath.endsWith(File.separator) || realPath.endsWith("/")) {
1 ✔
1017
                        moduleWebFolder = realPath + moduleFolder;
1 ✔
1018
                } else {
1019
                        moduleWebFolder = realPath + "/" + moduleFolder;
1 ✔
1020
                }
1021
                
1022
                moduleWebFolder += moduleId;
1 ✔
1023
                
1024
                return moduleWebFolder.replace("/", File.separator);
1 ✔
1025
        }
1026
        
1027
        public static void createDwrModulesXml(String realPath) {
1028
                try {
1029
                        DocumentBuilder docBuilder = createDocumentBuilder();
1 ✔
1030
                        
1031
                        // root elements
1032
                        Document doc = docBuilder.newDocument();
1 ✔
1033
                        Element rootElement = doc.createElement("dwr");
1 ✔
1034
                        doc.appendChild(rootElement);
1 ✔
1035
                        
1036
                        // write the content into xml file
1037
                        TransformerFactory transformerFactory = TransformerFactory.newInstance();
1 ✔
1038
                        Transformer transformer = transformerFactory.newTransformer();
1 ✔
1039
                        DOMSource source = new DOMSource(doc);
1 ✔
1040
                        StreamResult result = new StreamResult(new File(realPath
1 ✔
1041
                                + "/WEB-INF/dwr-modules.xml".replace("/", File.separator)));
1 ✔
1042
                        
1043
                        transformer.transform(source, result);
1 ✔
1044
                        
1045
                }
UNCOV
1046
                catch (APIException pce) {
×
UNCOV
1047
                        log.error("Failed to parse document", pce);
×
1048
                }
UNCOV
1049
                catch (TransformerException tfe) {
×
UNCOV
1050
                        log.error("Failed to transorm xml source", tfe);
×
1051
                }
1 ✔
1052
        }
1 ✔
1053

1054
        public static String getRealPath(ServletContext servletContext) {
1055
                return servletContext.getRealPath("");
1 ✔
1056
        }
1057
        
1058
}
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