{"id":231,"date":"2009-10-27T20:49:57","date_gmt":"2009-10-27T19:49:57","guid":{"rendered":"http:\/\/blog.pczone.be\/?p=231"},"modified":"2009-10-27T17:55:51","modified_gmt":"2009-10-27T16:55:51","slug":"dwr-weirdness","status":"publish","type":"post","link":"https:\/\/blog.pczone.be\/?p=231","title":{"rendered":"DWR weirdness"},"content":{"rendered":"<p>Like many developers I use DWR in my java enterprise app. This facilitates communication between Javascript and backend Java code. However for a new feature I overloaded the Java backend function. I also modified the frontend to add the new parameters where necessary. On my windows machine everything worked fine. I then pulled in the data on my Linux laptop and wanted to start a debug session. However when I tried the app, the filtering wasn&#8217;t working. Hmm pretty strange, after a long debugging session I finally found the issue. I&#8217;m still not sure why or how, but this is what I noticed.<\/p>\n<p>I&#8217;m sending 3 int values to the backend. It seems that for a weird reason on windows he converts the var productId = &#8216;4&#8217; to an int and on Linux he didn&#8217;t do this. What happened was that my old method was executed without the new argument (as he couldn&#8217;t convert it). I would have actually expected the ap to also do this on windows as the &#8216;4&#8217; isn&#8217;t an int in my eyes.<\/p>\n<p>From now on I will never use overloading with DWR services. As Javascript doesn&#8217;t really check the number of arguments supplied for a function, this can do weird things!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Like many developers I use DWR in my java enterprise app. This facilitates communication between Javascript and backend Java code. However for a new feature I overloaded the Java backend function. I also modified the frontend to add the new parameters where necessary. On my windows machine everything worked fine. I then pulled in the &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.pczone.be\/?p=231\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;DWR weirdness&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[4],"tags":[],"class_list":["post-231","post","type-post","status-publish","format-standard","hentry","category-informatics"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3U9nk-3J","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/blog.pczone.be\/index.php?rest_route=\/wp\/v2\/posts\/231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.pczone.be\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.pczone.be\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.pczone.be\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.pczone.be\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=231"}],"version-history":[{"count":1,"href":"https:\/\/blog.pczone.be\/index.php?rest_route=\/wp\/v2\/posts\/231\/revisions"}],"predecessor-version":[{"id":232,"href":"https:\/\/blog.pczone.be\/index.php?rest_route=\/wp\/v2\/posts\/231\/revisions\/232"}],"wp:attachment":[{"href":"https:\/\/blog.pczone.be\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.pczone.be\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.pczone.be\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}