Application broken on August, 1st
Tags: JavaScript
Today I received a phone call from one of our customers. I had built an enhancement for the CMS templates used for the customer's website - www.mainz.de. I had tested it accurately and sent an email to the customer to have them test it also.
The new feature enhances the option to maintain a list of links (teasers) on the home page and the main entry pages of the website: they can now set a start time and an end time for each link/teaser. The dates will be monitored for each access to the web pages, to have a very accurate control over the "hot topics". You can also preview the pages for a user specified date and time, to simulate the homepage/teaser list for some time in the future.
Today nothing worked at all. The teaser lists were gone completely.
Last week everything worked.
Good thing: I had installed this on the test system. Seems to be a good approach.
After a lot of searching I found out what's going on: we are using server based JavaScript (embedded in a servlet environment) to render the pages (i.e. TMLScript of WebGate Anywhere 3.1.1). I had to do some date calculations, getting text from the page documents. Therefore I'm getting the date in text format (string), converting this (via parseInt) to integer to create Date objects.
I had not read the complete definition of parseInt: if parseInt encounters numbers with leading zeroes, it will consider them to be octal values instead of decimal.
So for July everything worked well:
parseInt ("07")= = 7, and
parseint ("29") == 29.
but parseInt ("08") == NaN, because there is no 8 in octal numbers....
Solution: parseInt ("08", 10) == 8
Easy enough. I'm happy this happened in the test system, and that it happened now - in 2 weeks I'm off for holiday, and I'd rather not think about the homepage of this (very heavy used) website being completely without contents....
Today I received a phone call from one of our customers. I had built an enhancement for the CMS templates used for the customer's website - www.mainz.de. I had tested it accurately and sent an email to the customer to have them test it also.
The new feature enhances the option to maintain a list of links (teasers) on the home page and the main entry pages of the website: they can now set a start time and an end time for each link/teaser. The dates will be monitored for each access to the web pages, to have a very accurate control over the "hot topics". You can also preview the pages for a user specified date and time, to simulate the homepage/teaser list for some time in the future.
Today nothing worked at all. The teaser lists were gone completely.
Last week everything worked.
Good thing: I had installed this on the test system. Seems to be a good approach.
After a lot of searching I found out what's going on: we are using server based JavaScript (embedded in a servlet environment) to render the pages (i.e. TMLScript of WebGate Anywhere 3.1.1). I had to do some date calculations, getting text from the page documents. Therefore I'm getting the date in text format (string), converting this (via parseInt) to integer to create Date objects.
I had not read the complete definition of parseInt: if parseInt encounters numbers with leading zeroes, it will consider them to be octal values instead of decimal.
So for July everything worked well:
parseInt ("07")= = 7, and
parseint ("29") == 29.
but parseInt ("08") == NaN, because there is no 8 in octal numbers....
Solution: parseInt ("08", 10) == 8
Easy enough. I'm happy this happened in the test system, and that it happened now - in 2 weeks I'm off for holiday, and I'd rather not think about the homepage of this (very heavy used) website being completely without contents....









