[Bug 70159] New: Caching of date pattern in DateUtilisADateFormat

[email protected] Mon, 20 Jul 2026 20:53:16 +0000
Newsgroups gmane.comp.jakarta.poi.devel
Message-ID <[email protected]/bugzilla/>
https://bz.apache.org/bugzilla/show_bug.cgi?id=3D70159

            Bug ID: 70159
           Summary: Caching of date pattern in DateUtilisADateFormat
           Product: POI
           Version: unspecified
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: SS Common
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Created attachment 40202
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=3D40202&action=3Dedit
Patch of fix with test.

Somewhat related to a very old bug:
https://bz.apache.org/bugzilla/show_bug.cgi?id=3D55611, I'm doing some prof=
iling
on a Tika document processor that is calling DateUtil.isADateFormat quite a=
 bit
and repeatedly hitting the line "if (! date_ptrn3a.matcher(fs).find()) {",
evaluating to true and then returning false.  Running over a 100+K document=
s,
it was surprising to me this line showed up at all, but it does look like it
could be cached, which should save a fair bit for future calls.

I believe the fix is simply:=20

if (! date_ptrn3a.matcher(fs).find()) {
>>>>           cache(formatString, formatIndex, false);
           return false;
        }

First time posting here, so apologies if I messed up something.  Not sure if
patches are still accepted, but one is attached.

--=20
You are receiving this mail because:
You are the assignee for the bug.=