- Programming & Marketing Job Vacancies: You Decide Where & When You Work!
- Full-Stack Developer Vacancy at HTK
- Job Vacancy: Java Developer at SupaPass
- Naked Element Vacancy: Executive PA / Office Manager
- SEO Consultant Job in Norwich with Further
- Job Vacancies at Thyngs
- Job Opportunity- Senior Programmer, Knit
- 3 Tech Vacancies at Aviva
- Full Time Business Analyst Required at Anglia Farmers
- New Year, New Jobs in Norwich
What do you do when you come across an error message on a web page that doesn’t show up in the server logs?
For starters, you might look a little confused whilst you make sure that you are in fact in the right log file, but then you knuckle down and find out what the issue is and how you can fix it.
I was faced with the above problem very recently and I can tell you, it’s a bit of a pain to solve sometimes. To add a bit of context, a client sent us an email saying that they had tried to run a piece of functionality on some software we are developing for them and had been given the typical “Sorry, an error has occurred” message on their page. That’s okay, in development sometimes bugs come up that we need to fix. I take a stroll into the server logs, expecting to see the error and have a quick fix for it. What do I find? Nothing, actually. Nothing that relates to the error, anyway. Rewind back to the first section of this post about looking a little confused for a while, that was me.
After realising that I probably wasn’t going to get anywhere looking at the server logs, I decided to fire up a development instance of the project, retrace the steps the client made and find the error message there instead. Because of the UI not being completely finished, it took quite some time to follow the steps (as it is a case of clicking checkboxes and adding values to arrays, more on that later) but alas, I got to the stage of being ready to submit the form. I hit submit, and the age old error message pops up. This time, however, we get the error message in the log. Progress.
Looking at the error message, I see that it is complaining about the index of my array of data. Any time the index goes over 256, the error is thrown (I had to check this by assuring 255 values went into the array first, then 256, then 257. It took time.).
So after discovering the problem, a quick Google Search and a StackOverflow question lead me to a quick solution to my problems. It turns out that Spring (view my other post about Spring and Spring Boot here) sets the default max index of an array to 256 and to override this, you need to add in a short function. Seems easy enough, and it was actually. A few lines of code and another test of the functionality and it just worked.
After celebrating my victory of conquering the error with no output, I realised that this problem was probably the same problem we were having with another system we were creating. This too had a large array of values that we were trying to create.
I confirmed the error message was the same, added in the same function that had fixed my first problem, tested it and found that it too had been fixed.
After feeling like I had accomplished greatness, I checked in my changes and went on my merry way. In the process, I learned that through a bit of trial and error, you can often find solutions to even the strangest of problems. You might even hit two birds with one stone.
Words by Lewis
Originally published on Naked Element