Issues Report
OpenMRS - Sep 21, 2017 8:08:52 PM

New issues

241

Resolved issues

16

1
New issues
108
		this.nonCodedAllergen = nonCodedAllergen;
109
		if (StringUtils.isNotBlank(nonCodedAllergen)) {
110
			if (codedAllergen != null && !codedAllergen.getUuid().equals(getOtherNonCodedConceptUuid())) {
Merge this if statement with the enclosing one.     NEW  
Collapsible "if" statements should be merged
111
				codedAllergen = null;
112
			}
2
New issues
90
	/**
91
	 * Convenience method that voids all existing attributes of the given type, and sets this new one.
92
	 * TODO fail if minOccurs > 1
Complete the task associated to this TODO comment.     NEW  
"TODO" tags should be handled
93
	 * TODO decide whether this should require maxOccurs=1
Complete the task associated to this TODO comment.     NEW  
"TODO" tags should be handled
94
	 * @should void the attribute if an attribute with same attribute type already exists and the maxOccurs is set to 1
95
	 * @should work for attributes with datatypes whose values are stored in other tables
1
New issues
1 duplicated blocks of code must be removed.     NEW
Source files should not have any duplicated blocks
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
1
New issues
156
			}
157
			// this should be all that is needed unless the encounter has been built by hand
158
			//if (o.isVoided() == false && o.isObsGrouping() == false)
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
159
			//	ret.add(o);
160
		}
1
New issues
122
	 */
123
	public void setAttributeName(String attributeName) {
124
		// this.dirty = true;
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
125
		this.attributeName = attributeName;
126
	}
1
New issues
867
	 */
868
	public boolean isComplex() {
869
		//		if (getValueComplex() != null) {
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
870
		//			return true;
871
		//		}
3
New issues
48
	 * as pointers, each individual element is not copied. <br>
49
	 * <br>
50
	 * TODO Should the patient specific attributes be copied? (like identifiers)
Complete the task associated to this TODO comment.     NEW  
"TODO" tags should be handled
51
	 * 
52
	 * @param person the person object to copy onto a new Patient
217
	 * @return Returns the "preferred" patient identifier.
218
	 */
219
	public PatientIdentifier getPatientIdentifier() {
The Cyclomatic Complexity of this method "getPatientIdentifier" is 11 which is greater than 10 authorized.     NEW  
Methods should not be too complex
220
		// normally the DAO layer returns these in the correct order, i.e. preferred and non-voided first, but it's possible that someone
221
		// has fetched a Patient, changed their identifiers around, and then calls this method, so we have to be careful.
323
			for (PatientIdentifier pi : getIdentifiers()) {
324
				if (!pi.isVoided()) {
325
					if (pi.isPreferred()) {
Refactor this code to not nest more than 3 if/for/while/switch/try statements.     NEW  
Control flow statements "if", "for", "while", "switch" and "try" should not be nested too deeply
326
						ids.add(pi);
327
					} else {
1
New issues
225
	 */
226
	@SuppressWarnings("squid:S1210")
227
	public int compareTo(PatientIdentifier other) {
Add the missing @Deprecated annotation.     NEW  
Deprecated elements should have both the annotation and the Javadoc tag
228
		DefaultComparator piDefaultComparator = new DefaultComparator();
229
		return piDefaultComparator.compare(this, other);
1
New issues
67
	private String formatDescription;
68
	
69
	private Boolean checkDigit = Boolean.FALSE;
Remove this unused "checkDigit" private field.     NEW  
Unused private fields should be removed
70
	
71
	private String validator;
1
New issues
214
	@JsonIgnore
215
	public Boolean isBirthdateEstimated() {
216
		// if (this.birthdateEstimated == null) {
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
217
		// return new Boolean(false);
218
		// }
1
New issues
138
	public boolean hasRole(String r, boolean ignoreSuperUser) {
139
		if (!ignoreSuperUser) {
140
			if (isSuperUser()) {
Merge this if statement with the enclosing one.     NEW  
Collapsible "if" statements should be merged
141
				return true;
142
			}
1
New issues
118
		
119
		// quick check to make sure we're only being called by ourselves
120
		//Class<?> callerClass = Reflection.getCallerClass(0);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
121
		Class<?> callerClass = new OpenmrsSecurityManager().getCallerClass(0);
122
		if (!TimerSchedulerTask.class.isAssignableFrom(callerClass)) {
1
New issues
119
		
120
		for (String property : propertyValues.keySet()) {
121
			if (changePropertyValue(currentState, propertyNames, property, propertyValues.get(property), setNullOnly)) {
org.openmrs.api.db.hibernate.AuditableInterceptor.changeProperties(Object[], String[], boolean, Map, Boolean) makes inefficient use of keySet iterator instead of entrySet iterator     NEW  
Performance - Inefficient use of keySet iterator instead of entrySet iterator
122
				objectWasChanged = true;
123
			}
1
New issues
245
		if (personTypes.contains(PERSON_TYPE.PERSON)) {
246
			// all observations are already on person's.  Limit to non-patient and non-users here?
247
			//criteria.createAlias("Person", "person");
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
248
			//criteria.add(Restrictions.eqProperty("obs.person.personId", "person.personId"));
249
		}
5
New issues
10
package org.openmrs.api.db.hibernate;
11

                  
12
import java.lang.reflect.Field;
Remove this unused import 'java.lang.reflect.Field'.     NEW  
Useless imports should be removed
13
import java.util.ArrayList;
14
import java.util.Collections;
16
import java.util.Date;
17
import java.util.HashMap;
18
import java.util.HashSet;
Remove this unused import 'java.util.HashSet'.     NEW  
Useless imports should be removed
19
import java.util.LinkedList;
20
import java.util.List;
115
			// and Persons are the same objects.  So it sees a Person object in the
116
			// cache and claims it is a duplicate of this Patient object.
117
			//patient = (Patient) sessionFactory.getCurrentSession().merge(patient);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
118
			sessionFactory.getCurrentSession().saveOrUpdate(patient);
119
			
261
		}
262
		
263
		// TODO add junit test for getting by identifier type
Complete the task associated to this TODO comment.     NEW  
"TODO" tags should be handled
264
		if (!patientIdentifierTypes.isEmpty()) {
265
			criteria.add(Restrictions.in("identifierType", patientIdentifierTypes));
270
		}
271
		
272
		// TODO add junit test for getting by patients
Complete the task associated to this TODO comment.     NEW  
"TODO" tags should be handled
273
		if (!patients.isEmpty()) {
274
			criteria.add(Restrictions.in("patient", patients));
1
New issues
227
			serializedObject.setName(metaObj.getName());
228
			serializedObject.setDescription(metaObj.getDescription());
229
			serializedObject.setRetired(metaObj.isRetired() == Boolean.TRUE);
Suspicious comparison of Boolean references in org.openmrs.api.db.hibernate.HibernateSerializedObjectDAO.saveObject(OpenmrsObject, OpenmrsSerializer)     NEW  
Correctness - Suspicious reference comparison of Boolean values
230
			serializedObject.setRetiredBy(metaObj.getRetiredBy());
231
			serializedObject.setDateRetired(metaObj.getDateRetired());
1
New issues
312
		}
313
		
314
		// TODO add a junit test for patientIdentifierType restrictions	
Complete the task associated to this TODO comment.     NEW  
"TODO" tags should be handled
315
		
316
		// do the type restriction
1
New issues
343
	public List<T> list() {
344
		//debug
345
		/*FullTextQuery fullTextQuery = buildQuery();
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
346
		fullTextQuery.setProjection(
347
				FullTextQuery.DOCUMENT_ID,
2
New issues
271
				}
272
			} else if (gp.getProperty().equals(OpenmrsConstants.GLOBAL_PROPERTY_DEFAULT_LOCALE)) {
273
				if (gp.getPropertyValue() != null) {
Merge this if statement with the enclosing one.     NEW  
Collapsible "if" statements should be merged
274
					List<Locale> localeList = getAllowedLocales();
275
					
276
					if (!localeList.contains(LocaleUtility.fromSpecification(gp.getPropertyValue().trim()))) {
Refactor this code to not nest more than 3 if/for/while/switch/try statements.     NEW  
Control flow statements "if", "for", "while", "switch" and "try" should not be nested too deeply
277
						String value = gp.getPropertyValue();
278
						gp.setPropertyValue(LocaleUtility.getDefaultLocale().toString());
1
New issues
231
		}
232

                  
233
		Concept conceptToReturn = dao.saveConcept(concept);
Immediately return this expression instead of assigning it to the temporary variable "conceptToReturn".     NEW  
Local Variables should not be declared and then immediately returned or thrown
234
		
235
		return conceptToReturn;
1
New issues
64
public class EncounterServiceImpl extends BaseOpenmrsService implements EncounterService {
65
	
66
	// private Log log = LogFactory.getLog(this.getClass());
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
67
	
68
	private EncounterDAO dao;
3
New issues
102
	public Form duplicateForm(Form form) throws APIException {
103
		// Map of /Old FormFieldId/ to /New FormField Object/
104
		//TreeMap<Integer, FormField> formFieldMap = new TreeMap<Integer, FormField>();
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
105
		//formFieldMap.put(null, null); //for parentless formFields
106
		checkIfFormsAreLocked();
109
		
110
		for (FormField formField : form.getFormFields()) {
111
			//formFieldMap.put(formField.getFormFieldId(), formField);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
112
			formField.setUuid(null);
113
			formField.setFormFieldId(null);
114
			//formField.setParent(formFieldMap.get(formField.getParent().getFormFieldId()));
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
115
		}
116
		// this is required because Hibernate would recognize the original collection
3
New issues
270
				int minutes = cal.get(Calendar.MINUTE);
271
				int seconds = cal.get(Calendar.SECOND);
272
				int milliseconds = cal.get(Calendar.MILLISECOND);
Dead store to milliseconds in org.openmrs.api.impl.OrderServiceImpl.saveOrderInternal(Order, OrderContext)     NEW  
Dodgy - Dead store to local variable
Remove this unused "milliseconds" local variable.     NEW  
Unused local variables should be removed
273
				//roll autoExpireDate to end of day (23:59:59) if no time portion is specified
274
				if (hours == 0 && minutes == 0 && seconds == 0) {
754
	public OrderFrequency saveOrderFrequency(OrderFrequency orderFrequency) throws APIException {
755
		if (orderFrequency.getOrderFrequencyId() != null) {
756
			if (dao.isOrderFrequencyInUse(orderFrequency)) {
Merge this if statement with the enclosing one.     NEW  
Collapsible "if" statements should be merged
757
				throw new CannotUpdateObjectInUseException("Order.frequency.cannot.edit");
758
			}
5
New issues
116
	 * @see org.openmrs.api.PatientService#savePatient(org.openmrs.Patient)
117
	 */
118
	public Patient savePatient(Patient patient) throws APIException {
The Cyclomatic Complexity of this method "savePatient" is 27 which is greater than 10 authorized.     NEW  
Methods should not be too complex
119
		if (patient.getPatientId() == null) {
120
			Context.requirePrivilege(PrivilegeConstants.ADD_PATIENTS);
256
	 */
257
	@Transactional(readOnly = true)
258
	public void checkPatientIdentifiers(Patient patient) throws PatientIdentifierException {
The Cyclomatic Complexity of this method "checkPatientIdentifiers" is 17 which is greater than 10 authorized.     NEW  
Methods should not be too complex
259
		// check patient has at least one identifier
260
		if (!patient.isVoided() && patient.getActiveIdentifiers().isEmpty()) {
262
		}
263
		
264
		List<PatientIdentifier> identifiers = new Vector<PatientIdentifier>();
Replace the synchronized class "Vector" by an unsynchronized one such as "ArrayList" or "LinkedList".     NEW  
Synchronized classes Vector, Hashtable, Stack and StringBuffer should not be used
265
		identifiers.addAll(patient.getIdentifiers());
266
		List<String> identifiersUsed = new Vector<String>();
Replace the synchronized class "Vector" by an unsynchronized one such as "ArrayList" or "LinkedList".     NEW  
Synchronized classes Vector, Hashtable, Stack and StringBuffer should not be used
267
		List<PatientIdentifierType> requiredTypes = Context.getPatientService().getPatientIdentifierTypes(null, null, true,
268
		    null);
863
		}
864
		/*
865
		 * if (preferred.getRace() == null || preferred.getRace().equals(""))
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
866
		 * preferred.setRace(notPreferred.getRace());
867
		 */
7
New issues
25 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
275
	 * @see org.openmrs.api.PersonService#savePerson(org.openmrs.Person)
276
	 */
277
	public Person savePerson(Person person) throws APIException {
The Cyclomatic Complexity of this method "savePerson" is 15 which is greater than 10 authorized.     NEW  
Methods should not be too complex
278
		PersonName preferredName = null;
279
		PersonName possiblePreferredName = person.getPersonName();
526
	 */
527
	@Transactional(readOnly = true)
528
	public List<PersonAttributeType> getPersonAttributeTypes(PERSON_TYPE personType, ATTR_VIEW_TYPE viewType)
The Cyclomatic Complexity of this method "getPersonAttributeTypes" is 25 which is greater than 10 authorized.     NEW  
Methods should not be too complex
529
	        throws APIException {
530
		AdministrationService as = Context.getAdministrationService();
534
		final String fatalString = "Should not be here.";
535

                  
536
		// TODO cache the global properties to speed this up??
Complete the task associated to this TODO comment.     NEW  
"TODO" tags should be handled
537
		// Is hibernate taking care of caching and not hitting the db every time? (hopefully it is)
538
		if (viewType == null) {
580
		
581
		// the java list object to hold the values from the global properties
582
		List<String> attrNames = new Vector<String>();
Replace the synchronized class "Vector" by an unsynchronized one such as "ArrayList" or "LinkedList".     NEW  
Synchronized classes Vector, Hashtable, Stack and StringBuffer should not be used
583
		
584
		// split the comma delimited string into a java list object
587
				if (s != null) {
588
					s = s.trim();
589
					if (s.length() > 0) {
Refactor this code to not nest more than 3 if/for/while/switch/try statements.     NEW  
Control flow statements "if", "for", "while", "switch" and "try" should not be nested too deeply
590
						attrNames.add(s);
591
					}
595
		
596
		// the actual list we'll be returning
597
		List<PersonAttributeType> attrObjects = new Vector<PersonAttributeType>();
Replace the synchronized class "Vector" by an unsynchronized one such as "ArrayList" or "LinkedList".     NEW  
Synchronized classes Vector, Hashtable, Stack and StringBuffer should not be used
598
		
599
		// get the PersonAttribute objects for each name/id
1
New issues
374
					nextVisit.setStopDatetime(stopDate);
375
					dao.saveVisit(nextVisit);
376
					if (counter++ > 50) {
Refactor this code to not nest more than 3 if/for/while/switch/try statements.     NEW  
Control flow statements "if", "for", "while", "switch" and "try" should not be nested too deeply
377
						//ensure changes are persisted to DB before reclaiming memory
378
						Context.flushSession();
1
New issues
43
		String name = "";
44
		if (concept != null) {
45
			if (concept.getName() != null) {
Merge this if statement with the enclosing one.     NEW  
Collapsible "if" statements should be merged
46
				name = concept.getName().getName();
47
			}
1
New issues
73
		 * Use this code snippet instead if we think that fetching the clob is fast enough
74
		 * 
75
		ClobDatatypeStorage storage = Context.getDatatypeService().getClobDatatypeStorageByUuid(referenceString);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
76
		if (storage == null)
77
			return Context.getMessageSourceService().getMessage("CustomDatatype.error.missingValue");
4
New issues
184
		// TODO: ideally, we would branch or alter our behavior based on the
185
		// sending application.
186
		// String sendingApplication = getSendingApplication(oru);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
187
		
188
		// validate message
204
		}
205
		
206
		HL7Service hl7Service = Context.getHL7Service();
Remove this unused "hl7Service" local variable.     NEW  
Unused local variables should be removed
Dead store to hl7Service in org.openmrs.hl7.handler.ORUR01Handler.processORU_R01(ORU_R01)     NEW  
Dodgy - Dead store to local variable
207
		
208
		// create the encounter
1205
		Calendar cal = Calendar.getInstance();
1206
		cal.set(year, month, day, hour, min, sec);
1207
		// if (cal.getTimeZone().getRawOffset() != timeZoneOffsetMillis) {
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
1208
		// TimeZone tz = (TimeZone)TimeZone.getDefault().clone();
1209
		// tz.setRawOffset(timeZoneOffsetMillis);
6
New issues
420
		// unused
421
		// String assigningAuthority = xcn.getAssigningAuthority()
422
		// .getUniversalID().getValue();
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
423
		
424
		/*
425
		 * if ("null".equals(familyName)) familyName = null; if
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
426
		 * ("null".equals(givenName)) givenName = null; if
427
		 * ("null".equals(assigningAuthority)) assigningAuthority = null;
428
		 */
429
		if (idNumber != null && idNumber.length() > 0) {
430
			// log.debug("searching for user by id " + idNumber);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
431
			try {
432
				Integer userId = Integer.valueOf(idNumber);
439
			}
440
		} else {
441
			// log.debug("searching for user by name");
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
442
			try {
443
				List<User> users = Context.getUserService().getUsersByName(givenName,familyName,true);
450
					return null;
451
				}
452
				else { // size == 0
Move this trailing comment on the previous empty line.     NEW  
Comments should not be located at the end of lines of code
453
					// legacy behavior is looking up by username
454
					StringBuilder username = new StringBuilder();
586
		// TODO other potential identifying characteristics in PID we could use
587
		// to identify the patient
588
		// XPN[] patientName = pid.getPersonName();
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
589
		// String gender = pid.getAdministrativeSex().getValue();
590
		// TS dateOfBirth = pid.getDateTimeOfBirth();
4
New issues
102
					currToken.put("displaySize", this.getSizeMappings().get(realToken));
103
					currToken.put("codeName", realToken);
104
					//numTokens++;
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
105
					ret.add(currToken);
106
				}
121
					currToken.put("displaySize", this.getSizeMappings().get(realToken));
122
					currToken.put("codeName", realToken);
123
					//numTokens++;
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
124
					ret.add(currNonToken);
125
					ret.add(currToken);
141
						currToken.put("displaySize", this.getSizeMappings().get(realToken));
142
						currToken.put("codeName", realToken);
143
						//numTokens++;
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
144
						ret.add(currToken);
145
					}
164
			currToken.put("displaySize", this.getSizeMappings().get(realToken));
165
			currToken.put("codeName", realToken);
166
			//numTokens++;
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
167
			
168
			ret.add(currToken);
1
New issues
102
	 */
103
	public void putAll(Map<? extends String, ? extends PresentationMessage> t) {
104
		//Map<String, PresentationMessage> compatibleMap = new HashMap<String, PresentationMessage>();
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
105
		for (Entry<? extends String, ? extends PresentationMessage> entry : t.entrySet()) {
106
			put(entry.getKey(), entry.getValue());
1
New issues
58
		
59
		for (Locale locale : localizedMap.keySet()) {
60
			PresentationMessageMap codeMessageMap = localizedMap.get(locale);
org.openmrs.messagesource.impl.CachedMessageSource.getPresentations() makes inefficient use of keySet iterator instead of entrySet iterator     NEW  
Performance - Inefficient use of keySet iterator instead of entrySet iterator
61
			allMessages.addAll(codeMessageMap.values());
62
		}
4
New issues
292
		PatientService ps = Context.getPatientService();
293
		List<PatientProgram> patientPrograms = new ArrayList<PatientProgram>();
294
		//List<PatientState> patientStates = new ArrayList<PatientState>();
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
295
		Map<String, PatientProgram> knownPatientPrograms = new HashMap<String, PatientProgram>();
296
		Map<String, Program> programsByName = new HashMap<String, Program>();
331
				String[] temp = s.split(",");
332
				/* We're using a cache of 'knownPatientPrograms' instead of the following commented code
333
				PatientIdentifierType pit = ps.getPatientIdentifierType(temp[0]);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
334
				String identifier = temp[1];
335
				List<PatientIdentifier> pis = ps.getPatientIdentifiers(identifier, pit);
342
					throw new RuntimeException("Couldn't find program \"" + temp[2] + "\" in " + programsByName);
343
				}
344
				//ProgramWorkflow wf = pws.getWorkflow(program, temp[3]);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
345
				ProgramWorkflow wf = program.getWorkflowByName(temp[3]);
346
				if (wf == null) {
348
					        + program.getAllWorkflows() + ")");
349
				}
350
				//ProgramWorkflowState st = pws.getState(wf, temp[4]);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
351
				ProgramWorkflowState st = wf.getStateByName(temp[4]);
352
				if (st == null) {
7
New issues
76
	 * This is also used to fix: https://tickets.openmrs.org/browse/TRUNK-4053
77
	 */
78
	private Map<String, Class<?>> loadedClasses = new HashMap<String, Class<?>>();
Remove this unused "loadedClasses" private field.     NEW  
Unused private fields should be removed
79
	
80
	/**
742
		String libname = System.mapLibraryName(name);
743
		String result = null;
744
		//TODO
Complete the task associated to this TODO comment.     NEW  
"TODO" tags should be handled
745
		//PathResolver pathResolver = ModuleFactory.getPathResolver();
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
746
		//		for (Library lib : getModule().getLibraries()) {
747
		//			if (lib.isCodeLibrary()) {
756
		//				if (log.isDebugEnabled()) {
757
		//					log.debug("findLibrary(String): URL " + libUrl
758
		//							+ " resolved as local file " + libFile);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
759
		//				}
760
		//				if (libFile.isFile()) {
766
		//			// we have some kind of non-local URL
767
		//			// try to copy it to local temporary file
768
		//			libFile = (File) libraryCache.get(libUrl);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
769
		//			if (libFile != null) {
770
		//				if (libFile.isFile()) {
776
		//			if (libraryCache.containsKey(libUrl)) {
777
		//				// already tried to cache this library
778
		//				break;
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
779
		//			}
780
		//			libFile = cacheLibrary(libUrl, libname);
1004
			}
1005
		}
1006
		//		if (resourceLoader != null) {
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
1007
		//			for (Enumeration enm = resourceLoader.findResources(name);
1008
		//					enm.hasMoreElements();) {
3
New issues
206
		Map<String, Module> loadedModulesMap = getLoadedModulesMapPackage();
207
		for (String key : loadedModules.keySet()) {
208
			Module m = loadedModules.get(key);
org.openmrs.module.ModuleFactory.loadModules(List) makes inefficient use of keySet iterator instead of entrySet iterator     NEW  
Performance - Inefficient use of keySet iterator instead of entrySet iterator
209
			Map<String, String> startBeforeModules = m.getStartBeforeModulesMap();
210
			if (startBeforeModules.size() > 0) {
481
		Map<String, Module> map = new WeakHashMap<String, Module>();
482
		for (String key : loadedModules.keySet()) {
483
			map.put(loadedModules.get(key).getPackageName(), loadedModules.get(key));
org.openmrs.module.ModuleFactory.getLoadedModulesMapPackage() makes inefficient use of keySet iterator instead of entrySet iterator     NEW  
Performance - Inefficient use of keySet iterator instead of entrySet iterator
484
		}
485
		return map;
698
				// into spring yet.  All advice for all modules must be reloaded
699
				// a spring context refresh anyway, so skip the advice loading here
700
				// loadAdvice(module);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
701
				
702
				// map extension point to a list of extensions for this module only
2
New issues
1158
				
1159
				if (packagesProvided.add(packageName)) {
1160
					if (log.isTraceEnabled()) {
Refactor this code to not nest more than 3 if/for/while/switch/try statements.     NEW  
Control flow statements "if", "for", "while", "switch" and "try" should not be nested too deeply
Merge this if statement with the enclosing one.     NEW  
Collapsible "if" statements should be merged
1161
						log.trace("Adding module's jarentry with package: " + packageName);
1162
					}
1
New issues
101
			// getting here means we passed in no user or a blank user.
102
			// a null recipient column means get stuff for the anonymous user
103
			//crit.add(Expression.isNull("recipient.recipient"));
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
104
			
105
			// returning an empty list for now because the above throws an error.
2
New issues
164
		User user = Context.getUserService().getUser(recipientId);
165
		message.addRecipient(user.getUserProperty(OpenmrsConstants.USER_PROPERTY_NOTIFICATION_ADDRESS));
166
		// message.setFormat( user( OpenmrsConstants.USER_PROPERTY_NOTIFICATION_FORMAT ) );
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
167
		Context.getMessageService().sendMessage(message);
168
	}
180
			message.addRecipient(address);
181
		}
182
		// message.setFormat( user.getProperty( OpenmrsConstants.USER_PROPERTY_NOTIFICATION_FORMAT ) );
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
183
		Context.getMessageService().sendMessage(message);
184
	}
1
New issues
96
		MimeMessage mimeMessage = new MimeMessage(session);
97
		
98
		// TODO Need to test the null case.  
Complete the task associated to this TODO comment.     NEW  
"TODO" tags should be handled
99
		// Transport should use default mail.from value defined in properties.
100
		if (message.getSender() != null) {
2
New issues
77
			title = title.replace("." + extension, "");
78
			outputfile = new File(dir, title + "." + extension);
79
			// outputfile = new File(dir, title);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
80
		}
81
		
149
		} else if (file.delete()) {
150
			obs.setComplexData(null);
151
			// obs.setValueComplex(null);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
152
			return true;
153
		}
1
New issues
290
	}
291
	
292
	//public void setPriorDateOfDeathEstimated(boolean priorDateOfDeathEstimated) {
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
293
	public void setPriorDateOfDeathEstimated(Boolean priorDateOfDeathEstimated) {
294
		this.priorDateOfDeathEstimated = priorDateOfDeathEstimated;
3
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
28
public class CohortEditor extends PropertyEditorSupport {
29
	
30
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
31
	
32
	public CohortEditor() {
37
	 * @should set using uuid
38
	 */
39
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
40
		if (StringUtils.hasText(text)) {
41
			try {
3
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class ConceptAnswerEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	public ConceptAnswerEditor() {
38
	 * @should set using uuid
39
	 */
40
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
41
		ConceptService cs = Context.getConceptService();
42
		if (StringUtils.hasText(text)) {
2
New issues
6 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
33
	 * @see java.beans.PropertyEditorSupport#setAsText(java.lang.String)
34
	 */
35
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
36
		ConceptService conceptService = Context.getConceptService();
37
		if (Context.isAuthenticated() && StringUtils.hasText(text)) {
4
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class ConceptClassEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	public ConceptClassEditor() {
38
	 * @should set using uuid
39
	 */
40
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
41
		log.debug("Setting text: " + text);
42
		ConceptService cs = Context.getConceptService();
45
				setValue(cs.getConceptClass(Integer.valueOf(text)));
46
			}
47
			catch (Exception ex) {
Either log or rethrow this exception.     NEW  
Exception handlers should preserve the original exception
48
				ConceptClass conceptClass = cs.getConceptClassByUuid(text);
49
				setValue(conceptClass);
3
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class ConceptDatatypeEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	public ConceptDatatypeEditor() {
38
	 * @should set using uuid
39
	 */
40
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
41
		log.debug("setting text: " + text);
42
		ConceptService cs = Context.getConceptService();
3
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class ConceptEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	public ConceptEditor() {
38
	 * @should set using uuid
39
	 */
40
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
41
		ConceptService cs = Context.getConceptService();
42
		if (StringUtils.hasText(text)) {
1
New issues
4 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
3
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class ConceptNameEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	public ConceptNameEditor() {
40
	 * @see java.beans.PropertyEditorSupport#setAsText(java.lang.String)
41
	 */
42
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
43
		ConceptService cs = Context.getConceptService();
44
		if (StringUtils.hasText(text)) {
3
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class ConceptNumericEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	public ConceptNumericEditor() {
38
	 * @should set using uuid
39
	 */
40
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
41
		ConceptService cs = Context.getConceptService();
42
		if (StringUtils.hasText(text)) {
1
New issues
4 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
3
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class ConceptSourceEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	public ConceptSourceEditor() {
38
	 * @should set using uuid
39
	 */
40
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
41
		log.debug("Setting text: " + text);
42
		ConceptService cs = Context.getConceptService();
3
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class DrugEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	public DrugEditor() {
44
	 * @should fail if drug does not exist with non-empty identifier
45
	 */
46
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
47
		ConceptService es = Context.getConceptService();
48
		if (StringUtils.hasText(text)) {
3
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class EncounterEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	public EncounterEditor() {
38
	 * @should set using uuid
39
	 */
40
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
41
		EncounterService es = Context.getEncounterService();
42
		if (StringUtils.hasText(text)) {
3
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class EncounterTypeEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	public EncounterTypeEditor() {
38
	 * @should set using uuid
39
	 */
40
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
41
		EncounterService ps = Context.getEncounterService();
42
		if (StringUtils.hasText(text)) {
3
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class FormEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	public FormEditor() {
38
	 * @should set using uuid
39
	 */
40
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
41
		FormService ps = Context.getFormService();
42
		if (StringUtils.hasText(text)) {
2
New issues
6 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
38
	 * @see java.beans.PropertyEditorSupport#setAsText(java.lang.String)
39
	 */
40
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
41
		LocationService ls = Context.getLocationService();
42
		if (Context.isAuthenticated() && StringUtils.hasText(text)) {
5
New issues
5 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class LocationEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	public LocationEditor() {
38
	 * @should set using uuid
39
	 */
40
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
41
		LocationService ls = Context.getLocationService();
42
		if (StringUtils.hasText(text)) {
60
		Location t = (Location) getValue();
61
		if (t == null && Context.isAuthenticated()) {
62
			return null; //return Context.getAuthenticatedUser().getUserProperty(OpenmrsConstants.USER_PROPERTY_DEFAULT_LOCATION);
Move this trailing comment on the previous empty line.     NEW  
Comments should not be located at the end of lines of code
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
63
		} else {
64
			if (t != null) {
3
New issues
3 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
27
public class LocationTagEditor extends PropertyEditorSupport {
28
	
29
	private static Log log = LogFactory.getLog(LocationTagEditor.class);
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
30
	
31
	public LocationTagEditor() {
38
	 * @see java.beans.PropertyEditorSupport#setAsText(java.lang.String)
39
	 */
40
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
41
		LocationService ls = Context.getLocationService();
42
		if (Context.isAuthenticated() && StringUtils.hasText(text)) {
3
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class OrderEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	/**
37
	 * @see java.beans.PropertyEditorSupport#setAsText(java.lang.String)
38
	 */
39
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
40
		OrderService ps = Context.getOrderService();
41
		if (StringUtils.hasText(text)) {
3
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class PatientEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	/**
37
	 * @see java.beans.PropertyEditorSupport#setAsText(java.lang.String)
38
	 */
39
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
40
		PatientService ps = Context.getPatientService();
41
		if (StringUtils.hasText(text)) {
3
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class PatientIdentifierTypeEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	public PatientIdentifierTypeEditor() {
38
	 * @should set using uuid
39
	 */
40
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
41
		PatientService ps = Context.getPatientService();
42
		if (StringUtils.hasText(text)) {
3
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class PersonAttributeEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	/**
35
	 * @should set using uuid
36
	 */
37
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
38
		PersonService ps = Context.getPersonService();
39
		if (StringUtils.hasText(text)) {
3
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class PersonAttributeTypeEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	/**
35
	 * @should set using uuid
36
	 */
37
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
38
		PersonService ps = Context.getPersonService();
39
		if (StringUtils.hasText(text)) {
1
New issues
4 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
3
New issues
3 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class ProgramWorkflowEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	public ProgramWorkflowEditor() {
38
	 * @should set using uuid
39
	 */
40
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
41
		ProgramWorkflowService pws = Context.getProgramWorkflowService();
42
		if (StringUtils.hasText(text)) {
3
New issues
3 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class ProgramWorkflowStateEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	public ProgramWorkflowStateEditor() {
38
	 * @should set using uuid
39
	 */
40
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
41
		ProgramWorkflowService pws = Context.getProgramWorkflowService();
42
		if (StringUtils.hasText(text)) {
1
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
3
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
29
public class UserEditor extends PropertyEditorSupport {
30
	
31
	private Log log = LogFactory.getLog(this.getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
32
	
33
	public UserEditor() {
38
	 * @should set using uuid
39
	 */
40
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
41
		UserService ps = Context.getUserService();
42
		if (StringUtils.hasText(text)) {
5
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
27
public class VisitEditor extends PropertyEditorSupport {
28
	
29
	private static final Log log = LogFactory.getLog(VisitEditor.class);
Rename the "log" logger to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
Remove this unused "log" private field.     NEW  
Unused private fields should be removed
30
	
31
	public VisitEditor() {
36
	 * @should set using uuid
37
	 */
38
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
39
		VisitService vs = Context.getVisitService();
40
		if (StringUtils.hasText(text)) {
42
				setValue(vs.getVisit(Integer.valueOf(text)));
43
			}
44
			catch (Exception ex) {
Either log or rethrow this exception.     NEW  
Exception handlers should preserve the original exception
45
				Visit v = vs.getVisitByUuid(text);
46
				setValue(v);
5
New issues
2 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.     NEW
Branches should have sufficient coverage by unit tests
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
27
public class VisitTypeEditor extends PropertyEditorSupport {
28
	
29
	private static final Log log = LogFactory.getLog(VisitTypeEditor.class);
Remove this unused "log" private field.     NEW  
Unused private fields should be removed
Rename the "log" logger to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
30
	
31
	public VisitTypeEditor() {
36
	 * @should set using uuid
37
	 */
38
	public void setAsText(String text) throws IllegalArgumentException {
Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception.     NEW  
Throws declarations should not be redundant
39
		VisitService vs = Context.getVisitService();
40
		if (StringUtils.hasText(text)) {
42
				setValue(vs.getVisitType(Integer.valueOf(text)));
43
			}
44
			catch (Exception ex) {
Either log or rethrow this exception.     NEW  
Exception handlers should preserve the original exception
45
				VisitType v = vs.getVisitTypeByUuid(text);
46
				setValue(v);
4
New issues
77
	public static final int DAYS_PER_WEEK = 7;
78
	
79
	//public static DEFAULT_DATE_FORMAT = new SimpleDateFormat("MM-dd-yyyy hh:mm:ss");
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
80
	public static final int DAILY = MILLISECONDS_PER_SECOND * SECONDS_PER_MINUTE * MINUTES_PER_HOUR;
81
	
82
	public static final int WEEKLY = DAILY * DAYS_PER_WEEK;
83
	
84
	//public static final int MONTHLY; 
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
85
	//public static final int ANNUALLY;
86
	
201
	 * @param startTime start time for the task
202
	 */
203
	/*	public void setStartTime(String startTime) { 
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
204
			try {
205
		            this.startTime = this.dateFormatter.parse(startTime);
207
			catch (Exception e) { 
208
				//If there's an error, we'll just set the start time to now.
209
				// TODO: This might not be the desired behavior, so I'll have to come back to it.
Complete the task associated to this TODO comment.     NEW  
"TODO" tags should be handled
210
		             this.startTime = new	             Date(); 
211
		             }
2
New issues
10
package org.openmrs.scheduler;
11

                  
12
import java.io.PrintWriter;
Remove this unused import 'java.io.PrintWriter'.     NEW  
Useless imports should be removed
13
import java.io.StringWriter;
Remove this unused import 'java.io.StringWriter'.     NEW  
Useless imports should be removed
14
import java.util.Calendar;
15
import java.util.Date;
4
New issues
78
	 * @throws DAOException
79
	 */
80
	//public void createSchedule(Schedule schedule) throws DAOException;
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
81
	/**
82
	 * Get schedule by internal identifier
103
	 * @throws DAOException
104
	 */
105
	//public void updateSchedule(Schedule schedule) throws DAOException;
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
106
	/**
107
	 * Get all schedules.
110
	 * @throws DAOException
111
	 */
112
	//public Set<Schedule> getSchedules() throws DAOException;
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
113
	/**
114
	 * Delete schedule from database.
117
	 * @throws DAOException
118
	 */
119
	//public void deleteSchedule(Schedule schedule) throws DAOException;
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
120
}
4
New issues
148
	 * @throws DAOException
149
	 */
150
	//public void createSchedule(Schedule schedule) throws DAOException;
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
151
	/**
152
	 * Get schedule by internal identifier
172
	 * @throws DAOException
173
	 */
174
	//public void updateSchedule(Schedule schedule) throws DAOException;
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
175
	/**
176
	 * Get all schedules.
179
	 * @throws DAOException
180
	 */
181
	//public Set<Schedule> getAllSchedules() throws DAOException;
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
182
	/**
183
	 * Delete schedule from database.
186
	 * @throws DAOException
187
	 */
188
	//public void deleteSchedule(Schedule schedule) throws DAOException;	
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
189
}
1
New issues
207
			TimerSchedulerTask schedulerTask = scheduledTasks.get(taskDefinition.getId());
208
			if (schedulerTask != null) {
209
				//schedulerTask.cancel();					
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
210
				log.info("Shutting down the existing instance of this task to avoid conflicts!!");
211
				schedulerTask.shutdown();
1
New issues
100
				
101
				// returning null causes the field to be blanked out
102
				//return null;
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
103
			}
104
		}
3
New issues
245
	 * @should always have a valid update to latest file
246
	 */
247
	public static boolean updatesRequired() throws Exception {
Define and throw a dedicated exception instead of using a generic one.     NEW  
Generic exceptions should never be thrown
248
		log.debug("checking for updates");
249
		List<OpenMRSChangeSet> changesets = getUnrunDatabaseChanges();
581
	 */
582
	@Authorized(PrivilegeConstants.GET_DATABASE_CHANGES)
583
	public static List<OpenMRSChangeSet> getUnrunDatabaseChanges() throws Exception {
Define and throw a dedicated exception instead of using a generic one.     NEW  
Generic exceptions should never be thrown
584
		return getUnrunDatabaseChanges(CHANGE_LOG_FILE);
585
	}
595
	 */
596
	@Authorized(PrivilegeConstants.GET_DATABASE_CHANGES)
597
	public static List<OpenMRSChangeSet> getUnrunDatabaseChanges(String... changeLogFilenames) throws Exception {
Define and throw a dedicated exception instead of using a generic one.     NEW  
Generic exceptions should never be thrown
598
		log.debug("Getting unrun changesets");
599
		
1
New issues
222
	public static String conceptToString(Concept concept, ConceptName localizedName) {
223
		return concept.getConceptId() + "^" + localizedName.getName() + "^" + HL7Constants.HL7_LOCAL_CONCEPT; // + "^"
224
		// + localizedName.getConceptNameId() + "^" + localizedName.getName() + "^" + FormConstants.HL7_LOCAL_CONCEPT_NAME;
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
225
	}
226
	
2
New issues
10
package org.openmrs.util;
11

                  
12
import java.io.PrintWriter;
Remove this unused import 'java.io.PrintWriter'.     NEW  
Useless imports should be removed
13
import java.io.StringWriter;
Remove this unused import 'java.io.StringWriter'.     NEW  
Useless imports should be removed
14
import java.text.DateFormat;
15
import java.text.NumberFormat;
1
New issues
16
import org.apache.commons.logging.LogFactory;
17

                  
18
import sun.net.www.http.KeepAliveCache;
Replace this usage of Sun classes by ones from the Java API.     NEW  
Classes from "sun.*" packages should not be used
19

                  
20
/**
3
New issues
360
		log.info("this classloader hashcode: " + OpenmrsClassLoaderHolder.INSTANCE.hashCode());
361
		
362
		//		List<Thread> threads = listThreads(rootGroup, "");
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
363
		//		for (Thread thread : threads) {
364
		//			if (thread.getContextClassLoader() != null) {
365
		//				log.debug("context classloader on thread: " + thread.getName() + " is: "
366
		//				        + thread.getContextClassLoader().getClass().getName() + ":"
367
		//				        + thread.getContextClassLoader().hashCode());
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
368
		//				if (thread.getContextClassLoader() == OpenmrsClassLoaderHolder.INSTANCE) {
369
		//					thread.setContextClassLoader(OpenmrsClassLoaderHolder.INSTANCE.getParent());
370
		//					log.error("Cleared context classloader to save the world from memory leaks. thread: " + thread.getName()
371
		//					        + " ");
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
372
		//				}
373
		//			}
2
New issues
84
import org.openmrs.Form;
85
import org.openmrs.Location;
86
import org.openmrs.Patient;
Remove this unused import 'org.openmrs.Patient'.     NEW  
Useless imports should be removed
87
import org.openmrs.PersonAttributeType;
88
import org.openmrs.Program;
122
public class OpenmrsUtil {
123
	
124
	private static Log log = LogFactory.getLog(OpenmrsUtil.class);
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
125
	
126
	private static Map<Locale, SimpleDateFormat> dateFormatCache = new HashMap<Locale, SimpleDateFormat>();
1
New issues
20
import java.util.List;
21

                  
22
import org.azeckoski.reflectutils.ClassData;
Remove this unused import 'org.azeckoski.reflectutils.ClassData'.     NEW  
Useless imports should be removed
23
import org.azeckoski.reflectutils.ClassDataCacher;
24
import org.azeckoski.reflectutils.ClassFields;
2
New issues
330
		new SecureRandom().nextBytes(initVector);
331
		
332
		// TODO get the following (better) method working
Complete the task associated to this TODO comment.     NEW  
"TODO" tags should be handled
333
		// Cipher cipher = Cipher.getInstance(CIPHER_CONFIGURATION);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
334
		// AlgorithmParameters params = cipher.getParameters();
335
		// byte[] initVector = params.getParameterSpec(IvParameterSpec.class).getIV();
1
New issues
40
		String conceptId = null;
41
		try {
42
			FileInputStream fis = new FileInputStream(appDataDir + System.getProperty("file.separator")
org.openmrs.util.UpgradeUtil.getConceptIdForUnits(String) may fail to close stream     NEW  
Bad practice - Method may fail to close stream
43
			        + DatabaseUtil.ORDER_ENTRY_UPGRADE_SETTINGS_FILENAME);
44
			props.load(fis);
2
New issues
140
				
141
				//for each name in the locale
142
				for (ConceptName nameInLocale : localeConceptNamesMap.get(conceptNameLocale)) {
org.openmrs.util.databasechange.ConceptValidatorChangeSet.validateAndCleanUpConcepts(JdbcConnection) makes inefficient use of keySet iterator instead of entrySet iterator     NEW  
Performance - Inefficient use of keySet iterator instead of entrySet iterator
143
					if (StringUtils.isBlank(nameInLocale.getName())) {
144
						updateWarnings.add("ConceptName with id " + nameInLocale.getConceptNameId() + " ("
256
					        + conceptId + "' in locale '" + conceptNameLocale.getDisplayName() + "'");
257
					
258
					/*ConceptName chosenName = null;
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
259
					List<ConceptName> voidedNames = new ArrayList<ConceptName>();
260
					for (ConceptName duplicate : entry.getValue()) {
1
New issues
182
					connection.setAutoCommit(initialAutoCommit);
183
				}
184
				// connection.close();
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
185
			}
186
			catch (DatabaseException e) {
1
New issues
224
					
225
				}
226
				/*if (map.getConceptMapType() == null) {
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
227
					errors.rejectValue("conceptMappings[" + index + "].conceptMapType", "Concept.map.typeRequired",
228
					    "The concept map type is required for a concept map");
1
New issues
134
	private void validateSamePatientInOrderAndEncounter(Order order, Errors errors) {
135
		if (order.getEncounter() != null && order.getPatient() != null) {
136
			if (!order.getEncounter().getPatient().equals(order.getPatient())) {
Merge this if statement with the enclosing one.     NEW  
Collapsible "if" statements should be merged
137
				errors.rejectValue("encounter", "Order.error.encounterPatientMismatch");
138
			}
1
New issues
98
		if (!errors.hasErrors()) {
99
			// Validate PatientIdentifers
100
			if (patient.getIdentifiers() != null) {
Merge this if statement with the enclosing one.     NEW  
Collapsible "if" statements should be merged
101
				for (PatientIdentifier identifier : patient.getIdentifiers()) {
102
					errors.pushNestedPath("identifiers[" + index + "]");
1
New issues
59
	 */
60
	@Override
61
	public void validate(Object target, Errors errors) {
The Cyclomatic Complexity of this method "validate" is 11 which is greater than 10 authorized.     NEW  
Methods should not be too complex
62
		if (log.isDebugEnabled()) {
63
			log.debug(this.getClass().getName() + ".validate...");
5
New issues
186
							}
187
							
188
							//if (outFile.getName().endsWith(".jsp") == false)
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
189
							//	outFile = new File(absPath.replace("/", File.separator) + MODULE_NON_JSP_EXTENSION);
190
							
482
			HttpServlet otherServletUsingSameName = moduleServlets.get(name);
483
			if (otherServletUsingSameName != null) {
484
				//log.debug("A servlet mapping with name " + name + " already exists. " + mod.getModuleId() + "'s servlet is overwriting it");
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
485
				String otherServletName = otherServletUsingSameName.getClass().getPackage() + "."
486
				        + otherServletUsingSameName.getClass().getName();
595
			for (Iterator<String> i = moduleFiltersByName.keySet().iterator(); i.hasNext();) {
596
				String filterName = i.next();
597
				Filter filterVal = moduleFiltersByName.get(filterName);
org.openmrs.module.web.WebModuleUtil.unloadFilters(Module) makes inefficient use of keySet iterator instead of entrySet iterator     NEW  
Performance - Inefficient use of keySet iterator instead of entrySet iterator
598
				if (filters.contains(filterVal)) {
599
					i.remove();
827
		
828
		if (!skipRefresh) {
829
			//try {
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
830
			//	if (dispatcherServlet != null)
831
			//		dispatcherServlet.reInitFrameworkServlet();
966
			
967
			// Output to console for testing
968
			// StreamResult result = new StreamResult(System.out);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
969
			
970
			transformer.transform(source, result);
2
New issues
46
		// refresh the application context to look for module xml config files as well
47
		
48
		//XmlWebApplicationContext wac = ((XmlWebApplicationContext)getWebApplicationContext());
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
49
		Thread.currentThread().setContextClassLoader(OpenmrsClassLoader.getInstance());
50
		//wac.refresh();
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
51
		
52
		log.debug("Framework being initialized");
13
New issues
72
 * modules 2) Copy the custom look/images/messages over into the web layer
73
 */
74
public final class Listener extends ContextLoader implements ServletContextListener { // extends ContextLoaderListener {
Move this trailing comment on the previous empty line.     NEW  
Comments should not be located at the end of lines of code
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
75

                  
76
	protected final Log log = LogFactory.getLog(getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
77

                  
78
	private static boolean runtimePropertiesFound = false;
137
	@Override
138
	public void contextInitialized(ServletContextEvent event) {
139
		Log log = LogFactory.getLog(Listener.class);
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
140

                  
141
		log.debug("Starting the OpenMRS webapp");
183
				copyCustomizationIntoWebapp(servletContext, props);
184

                  
185
				//super.contextInitialized(event);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
186
				// also see commented out line in contextDestroyed
187

                  
232

                  
233
		//Ensure that we are being called from WebDaemon
234
		//TODO this did not work because callerClass was org.openmrs.web.WebDaemon$1 instead of org.openmrs.web.WebDaemon
Complete the task associated to this TODO comment.     NEW  
"TODO" tags should be handled
235
		/*Class<?> callerClass = new OpenmrsSecurityManager().getCallerClass(0);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
236
		if (!WebDaemon.class.isAssignableFrom(callerClass))
237
			throw new APIException("This method can only be called from the WebDaemon class, not " + callerClass.getName());*/
351
	 */
352
	private void clearDWRFile(ServletContext servletContext) {
353
		Log log = LogFactory.getLog(Listener.class);
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
354

                  
355
		String realPath = servletContext.getRealPath("");
406
	 */
407
	private void copyCustomizationIntoWebapp(ServletContext servletContext, Properties props) {
408
		Log log = LogFactory.getLog(Listener.class);
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
409

                  
410
		String realPath = servletContext.getRealPath("");
470
	 */
471
	private boolean copyFile(String fromPath, String toPath) {
472
		Log log = LogFactory.getLog(Listener.class);
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
473

                  
474
		FileInputStream inputStream = null;
512
	 */
513
	public static void loadBundledModules(ServletContext servletContext) {
514
		Log log = LogFactory.getLog(Listener.class);
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
515

                  
516
		String path = servletContext.getRealPath("");
580

                  
581
		// commented out because we are not init'ing it in the contextInitialization anymore
582
		// super.contextDestroyed(event);
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
583

                  
584
		try {
638
	public static void performWebStartOfModules(Collection<Module> startedModules, ServletContext servletContext)
639
	        throws ModuleMustStartException, Exception {
640
		Log log = LogFactory.getLog(Listener.class);
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
641

                  
642
		boolean someModuleNeedsARefresh = false;
1
New issues
135
		
136
		// can't really do this because PropertyEditors are not told what type of class they are changing :-(
137
		//wdb.registerCustomEditor(OpenmrsObject.class, new OpenmrsObjectByUuidEditor());
This block of commented-out lines of code should be removed.     NEW  
Sections of code should not be "commented out"
138
	}
139
	
1
New issues
84
public class InitializationFilter extends StartupFilter {
85
	
86
	private static final Log log = LogFactory.getLog(InitializationFilter.class);
Rename the "log" logger to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
87
	
88
	private static final String LIQUIBASE_SCHEMA_DATA = "liquibase-schema-only.xml";
2
New issues
10
package org.openmrs.web.filter.startuperror;
11

                  
12
import java.io.PrintWriter;
Remove this unused import 'java.io.PrintWriter'.     NEW  
Useless imports should be removed
13
import java.io.StringWriter;
Remove this unused import 'java.io.StringWriter'.     NEW  
Useless imports should be removed
14

                  
15
import org.apache.commons.lang.exception.ExceptionUtils;
2
New issues
66
public class UpdateFilter extends StartupFilter {
67
	
68
	protected final Log log = LogFactory.getLog(getClass());
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".     NEW  
Loggers should be "private static final" and should share a naming convention
69
	
70
	/**
461
	 * @should return false if given user does not have the super user role
462
	 */
463
	protected boolean isSuperUser(Connection connection, Integer userId) throws Exception {
Define and throw a dedicated exception instead of using a generic one.     NEW  
Generic exceptions should never be thrown
464
		// the 'Administrator' part of this string is necessary because if the database was upgraded
465
		// by OpenMRS 1.6 alpha then System Developer was renamed to that. This has to be here so we