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

openmrs / openmrs-core / 41047853593
69%
master: 65%

Build:
Build:
LAST BUILD BRANCH: 2.8.x
DEFAULT BRANCH: master
Ran 30 Oct 2026 11:33AM UTC
Jobs 1
Files 830
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

30 Oct 2026 11:23AM UTC coverage: 68.893% (+0.06%) from 68.831%
41047853593

push

github

ibacher
TRUNK-6848: Reject invalid dates and times in Obs.setValueAsString for DT and TM datatypes (#6732)

* TRUNK-6848: Reject invalid dates and times in Obs.setValueAsString for DT and TM datatypes

Ticket: https://openmrs.atlassian.net/browse/TRUNK-6848

The DT and TM branches of Obs.setValueAsString parsed with a SimpleDateFormat in its default lenient mode, and DateFormat.parse does not require the whole string to be consumed. Invalid values were silently converted and stored as the obs value_datetime: "2023-02-30" was stored as 2023-03-02, "2023-06-15garbage" was accepted as 2023-06-15, and "25:70" was stored as 02:10 on the following day.

Both branches now switch lenient parsing off and parse through a ParsePosition, throwing the ParseException the method already declares unless the whole string is consumed. This matches the project's own OpenmrsDateFormat, which already defaults to non-lenient parsing. The same root cause in HL7Util is being fixed separately under TRUNK-6804, which does not cover these branches in Obs.

I verified the change with a harness calling the real compiled api classes (javac, UTC): the three invalid inputs above now throw ParseException, and the controls DT "2023-06-15" and TM "13:45" store exactly the same values as before the change.

One honest note: I could not run the Maven build in my environment because it cannot download the project dependencies, so the module test suite has not been executed yet and CI will be the first real run.

* TRUNK-6848: Add tests for Obs.setValueAsString DT and TM validation

Covers the valid DT and TM values and the invalid ones the fix now
rejects with a ParseException: a nonexistent date, trailing
characters after a date, and an out-of-range time. The cases mirror
the behaviour verified against the compiled api classes.

* TRUNK-6848: Add a test for trailing characters in TM values

* TRUNK-6848: Add a comment explaining the ParsePosition check in setValueAsString

* TRUNK-6848: Accept I... (continued)

34 of 34 new or added lines in 1 file covered. (100.0%)

24 existing lines in 6 files now uncovered.

26366 of 38271 relevant lines covered (68.89%)

0.69 hits per line

Coverage Regressions

Lines Coverage ∆ File
13
95.52
0.12% api/src/main/java/org/openmrs/api/db/hibernate/HibernateEncounterDAO.java
5
95.85
0.33% api/src/main/java/org/openmrs/api/impl/EncounterServiceImpl.java
2
86.67
-1.9% api/src/main/java/org/openmrs/validator/ConceptValidator.java
2
93.55
1.08% api/src/main/java/org/openmrs/validator/PatientProgramValidator.java
1
81.56
-0.19% api/src/main/java/org/openmrs/Concept.java
1
81.82
-0.57% api/src/main/java/org/openmrs/User.java
Jobs
ID Job ID Ran Files Coverage
1 41047853593.1 30 Oct 2026 11:33AM UTC 830
68.89
Source Files on build 41047853593
  • Tree
  • List 830
  • Changed 11
  • Source Changed 5
  • Coverage Changed 11
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #41047853593
  • 50de2713 on github
  • Prev Build on 2.8.x (#40937626819)
  • Next Build on 2.8.x (#41089295977)
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