Feed aggregator
CodeSOD: Finally, a Null
Eric writes:
Yes, we actually do have code reviews and testing practices. A version of this code was tested successfully prior to this version being merged in, somehow.
Well, that's ominous. Let's look at the code.
public static SqsClient create() { try { SqsClient sqsClient = SqsClient.builder() ... .build(); return sqsClient; } catch (Exception e) { log.error("SQS - exception creating sqs client", e); } finally { // Uncomment this to test the sqs in a test environment // return SqsClient.builder(). ... .build(); return null; } }Eric found this when he discovered that the application wasn't sending messages to their queue. According to the logs, there were messages to send, they just weren't being sent.
Eric made the mistake of looking for log messages around sending messages, when instead he should have been looking at module startup, where the error message above appeared.
This code attempts to create a connection, and if it fails for any reason, it logs an error and returns null. With a delightful "comment this out" for running in the test environment, which, please, god no. Don't do configuration management by commenting out lines of code. Honestly, that's the worst thing in this code, to me.
In any case, the calling code "properly" handled nulls by just disabling sending to the queue silently, which made this harder to debug than it needed to be.
.comment { border: none; } [Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!New Hack Uses Prompt Injection To Corrupt Gemini's Long-Term Memory
Read more of this story at Slashdot.
'Ne Zha 2' Becomes First Non-Hollywood Film To Hit $1 Billion
Read more of this story at Slashdot.
'Serial Swatter' Who Made Nearly 400 Threatening Calls Gets 4 Years In Prison
Read more of this story at Slashdot.
KDE Plasma 6.3 Released
Read more of this story at Slashdot.
Tumblr To Join the Fediverse After WordPress Migration Completes
Read more of this story at Slashdot.
PassMark Sees the First Yearly Drop In Average CPU Performance In Its 20 Years
Read more of this story at Slashdot.
AUKUS Blasts Holes In LockBit's Bulletproof Hosting Provider
Read more of this story at Slashdot.
Thomson Reuters Wins First Major AI Copyright Case In the US
Read more of this story at Slashdot.
Anduril To Take Over Managing Microsoft Goggles for US Army
Read more of this story at Slashdot.
Google Chrome May Soon Use 'AI' To Replace Compromised Passwords
Read more of this story at Slashdot.
FTC Fines DoNotPay Over Misleading Claims of 'Robot Lawyer'
Read more of this story at Slashdot.
Hackers Call Current AI Security Testing 'Bullshit'
Read more of this story at Slashdot.
Only One Big Economy Is Aiming for Paris Agreement's 1.5C Goal
Read more of this story at Slashdot.
Kickstarter Will Alert Backers When a Project Has Failed
Read more of this story at Slashdot.
EU Pledges $200 Billion in AI Spending in Bid To Catch Up With US, China
Read more of this story at Slashdot.
Meta Starts Eliminating Jobs in Shift To Find AI Talent
Read more of this story at Slashdot.
YouTube Surprise: CEO Says TV Overtakes Mobile as 'Primary Device' for Viewing
Read more of this story at Slashdot.
Microplastics Can Block Blood Vessels in Mice Brains, Researchers Find
Read more of this story at Slashdot.
UK and US Refuse To Sign International AI Declaration
Read more of this story at Slashdot.