In my last posts I wrote about why I started open source and about my first merged PR in Zalando Logbook. This one is about a PR in the Adyen Java API Library , and it is a good example of how a very small bug can hide in plain sight.
What is the Adyen Java library?
Adyen is a global payments company, and this library is how Java applications talk to Adyen's APIs. The whole SDK has to build the correct base URL for every service, for both test and live environments. If that URL is wrong, the payment call goes to the wrong place.
The bug
The method createBaseURL in Service.java swaps test URLs for live URLs. It used String.replaceFirst() to do that.
Here is the catch: replaceFirst() takes a regex , not a plain string. In regex, a dot . means "any character". So a URL part like pal-test.adyen.com was not matching a literal dot. It was matching any character in that position.
Simplified, it looked like this:
// Before: the dots are treated as "any character" because this is a regex url = url .…