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

openmrs / openmrs-core / 41048469876
67%
master: 65%

Build:
Build:
LAST BUILD BRANCH: 2.8.x
DEFAULT BRANCH: master
Ran 30 Oct 2026 11:33AM UTC
Jobs 1
Files 886
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:26AM UTC coverage: 66.723% (+0.04%) from 66.681%
41048469876

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%)

2 existing lines in 1 file now uncovered.

26221 of 39298 relevant lines covered (66.72%)

0.67 hits per line

Coverage Regressions

Lines Coverage ∆ File
2
94.53
-0.52% api/src/main/java/org/openmrs/util/ThreadSafeCircularFifoQueue.java
Jobs
ID Job ID Ran Files Coverage
1 41048469876.1 30 Oct 2026 11:33AM UTC 886
66.72
Source Files on build 41048469876
  • Tree
  • List 886
  • Changed 3
  • Source Changed 1
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #41048469876
  • 4572518d on github
  • Prev Build on 2.9.x (#40937569956)
  • Next Build on 2.9.x (#41051396794)
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