-Поиск по дневнику

Поиск сообщений в rss_thedaily_wtf

 -Подписка по e-mail

 

 -Постоянные читатели

 -Статистика

Статистика LiveInternet.ru: показано количество хитов и посетителей
Создан: 06.04.2008
Записей:
Комментариев:
Написано: 0


Pass By NullPointer

Среда, 17 Декабря 2014 г. 14:00 + в цитатник

Maxime was having difficulty viewing a website with the NoScript add-on installed to her web browser. It wasn't a huge surprise - some websites just don't work right with NoScript running, but it was a surprise when her browser displayed Java exceptions. Enabling JavaScript made the error page go away, but what? Lack of JavaScript causing Java exceptions!?

She viewed the page source and found that the server expects an "innerCHK" parameter, perhaps some kind of session or security token, to be passed in via URL query string. If it isn't provided, the server returns an error page displaying a java.lang.NullPointerException. Fortunately the front-end developers concocted this brillant snippet of JavaScript to resolve this issue:

// Error check
if (document.body.innerHTML.indexOf('java.lang'+'.NullPointerException') != -1){   
   if (document.location.href.indexOf('innerCHK=') == -1){    
        document.location.href = document.location.href + "&innerCHK=" + Math.random()*10000 ;
   }
}
// End of check

That only scratches the tip of the iceberg; the page is loaded with anti-patterns, reinvented wheels, spare reinvented wheels, and flat reinvented wheels, all held on with duct tape. For a taste of some bizarre string conventions and the developers' pet anti-pattern of closing scripts only to open a new one on the next line, look at how Dojo is imported. Please take note that Dojo's cookie library is imported.

     
 

Some, but not all, of the CSS references are handled in this manner which I found at least three (identical) times in the source. Yet again, Dojo.cookie is imported.

http://thedailywtf.com/articles/pass-by-nullpointer

Метки:  

 

Добавить комментарий:
Текст комментария: смайлики

Проверка орфографии: (найти ошибки)

Прикрепить картинку:

 Переводить URL в ссылку
 Подписаться на комментарии
 Подписать картинку