Problem getting the response of a web

David García <[email protected]>
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <[email protected]>
Hello,

when I try to get the response from the request of the web 
http://flagrantdisregard.com/flickr/mosaic.php I got the next error:

SyntaxError: unterminated string literal (httpunit; line 26)
    at 
org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:597)
    at 
org.mozilla.javascript.TokenStream.reportSyntaxError(TokenStream.java:1324)
    at org.mozilla.javascript.TokenStream.getToken(TokenStream.java:967)
    at org.mozilla.javascript.Parser.memberExprTail(Parser.java:1213)
    at org.mozilla.javascript.Parser.memberExpr(Parser.java:1204)
    at org.mozilla.javascript.Parser.unaryExpr(Parser.java:1115)
    at org.mozilla.javascript.Parser.mulExpr(Parser.java:1062)
    at org.mozilla.javascript.Parser.addExpr(Parser.java:1045)
    at org.mozilla.javascript.Parser.shiftExpr(Parser.java:1032)
    at org.mozilla.javascript.Parser.relExpr(Parser.java:1015)
    at org.mozilla.javascript.Parser.eqExpr(Parser.java:1002)
    at org.mozilla.javascript.Parser.bitAndExpr(Parser.java:991)
    at org.mozilla.javascript.Parser.bitXorExpr(Parser.java:980)
    at org.mozilla.javascript.Parser.bitOrExpr(Parser.java:969)
    at org.mozilla.javascript.Parser.andExpr(Parser.java:957)
    at org.mozilla.javascript.Parser.orExpr(Parser.java:945)
    at org.mozilla.javascript.Parser.condExpr(Parser.java:928)
    at org.mozilla.javascript.Parser.assignExpr(Parser.java:909)
    at org.mozilla.javascript.Parser.expr(Parser.java:898)
    at org.mozilla.javascript.Parser.statementHelper(Parser.java:791)
    at org.mozilla.javascript.Parser.statement(Parser.java:387)
    at org.mozilla.javascript.Parser.parse(Parser.java:128)
    at org.mozilla.javascript.Context.compile(Context.java:2053)
    at org.mozilla.javascript.Context.compile(Context.java:2006)
    at org.mozilla.javascript.Context.compileReader(Context.java:899)
    at org.mozilla.javascript.Context.evaluateReader(Context.java:817)
    at org.mozilla.javascript.Context.evaluateString(Context.java:784)
    at 
com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.executeScript(JavaScript.java:132)
    at 
com.meterware.httpunit.scripting.ScriptableDelegate.runScript(ScriptableDelegate.java:65)
    at 
com.meterware.httpunit.parsing.ScriptFilter.getTranslatedScript(ScriptFilter.java:151)
    at 
com.meterware.httpunit.parsing.ScriptFilter.endElement(ScriptFilter.java:131)
    at org.cyberneko.html.filters.DefaultFilter.endElement(Unknown Source)
    at org.cyberneko.html.filters.NamespaceBinder.endElement(Unknown Source)
    at org.cyberneko.html.HTMLTagBalancer.callEndElement(Unknown Source)
    at org.cyberneko.html.HTMLTagBalancer.endElement(Unknown Source)
    at org.cyberneko.html.HTMLScanner$SpecialScanner.scan(Unknown Source)
    at org.cyberneko.html.HTMLScanner.scanDocument(Unknown Source)
    at org.cyberneko.html.HTMLConfiguration.parse(Unknown Source)
    at org.cyberneko.html.HTMLConfiguration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at 
com.meterware.httpunit.parsing.NekoHTMLParser.parse(NekoHTMLParser.java:41)
    at com.meterware.httpunit.HTMLPage.parse(HTMLPage.java:255)
    at 
com.meterware.httpunit.WebResponse.getReceivedPage(WebResponse.java:1109)
    at com.meterware.httpunit.WebResponse.getFrames(WebResponse.java:1098)
    at 
com.meterware.httpunit.WebResponse.getFrameRequests(WebResponse.java:875)
    at com.meterware.httpunit.FrameHolder.updateFrames(FrameHolder.java:179)
    at 
com.meterware.httpunit.WebWindow.updateFrameContents(WebWindow.java:252)
    at 
com.meterware.httpunit.WebClient.updateFrameContents(WebClient.java:485)
    at com.meterware.httpunit.WebWindow.updateWindow(WebWindow.java:146)
    at 
com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:130)
    at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:121)
    at com.meterware.httpunit.WebClient.getResponse(WebClient.java:113)
    at URLQuery.getUrlQuery(URLQuery.java:30)
    at LaunchPictures.launching(LaunchPictures.java:21)
    at LaunchPictures.<init>(LaunchPictures.java:13)
    at Client.main(Client.java:19)
ERROR in getUrlQuery() method on URLQuery class: 
com.meterware.httpunit.ScriptException: Script '(function(){
function m(b){return b!=null?'"'+b+'"':'""'}
function B(b){if(typeof encodeURIComponent=="function"){return 
encodeURIComponent(b)}else{return escape(b)}}
function c(b,a){if(a){window.google_ad_url+="&"+b+"="+a}}
function g(b,a){if(a){c(b,B(a))}}
function l(b,a,d){if(a&&typeof a=="object"){a=a[d%a.length]}c("color_"+b,a)}
function D(b,a){var d=b.screen;var f=navigator.javaEnabled();var 
e=-a.getTimezoneOffset();if(d){c("u_h",d.height);c("u_w",d.width);c("u_ah",d.availHeight);c("u_aw",d.availWidth);c("u_cd",d.colorDepth)}c("u_tz",e);c("u_his",history.length);c("u_java",f);if(navigator.plugins){c("u_nplug",navigator.plugins.length)}if(navigator.mimeTypes){c("u_nmime",navigator.mimeTypes.length)}}
function 
y(b){b=b.toLowerCase();if(b.substring(0,3)!="ca-"){b="ca-"+b}return b}
function 
G(b,a,d){d=d.substring(0,1000);d=d.replace(/%\w?$/,"");if(b.google_ad_output=="js"&&(b.google_ad_request_done||b.google_radlink_request_done)){a.write('<script 
language="JavaScript1.1" src='+m(d)+"><\/script>")}else 
if(b.google_ad_output=="html"){if(b.name!="google_ads_frame"){a.write('<iframe 
name="google_ads_frame" width='+m(b.google_ad_width)+" 
height="+m(b.google_ad_height)+" 
frameborder="+m(b.google_ad_frameborder)+" src="+m(d)+' marginwidth="0" 
marginheight="0" vspace="0" hspace="0" allowtransparency="true" 
scrolling="no">'
);a.write("</iframe>")}}}
function F(b){var 
a=null;b.google_ad_frameborder=a;b.google_ad_format=a;b.google_page_url=a;b.google_language=a;b.google_gl=a;b.google_country=a;b.google_region=a;b.google_city=a;b.google_hints=a;b.google_safe=a;b.google_encoding=a;b.google_ad_output=a;b.google_max_num_ads=a;b.google_ad_channel=a;b.google_contents=a;b.google_alternate_ad_url=a;b.google_alternate_color=a;b.google_color_bg=a;b.google_color_text=a;b.google_color_link=a;b.google_color_url=a;b.google_color_border=a;b.google_color_line=
a;b.google_adtest=a;b.google_kw_type=a;b.google_kw=a;b.google_num_radlinks=a;b.google_max_radlink_len=a;b.google_rl_filtering=a;b.google_rl_mode=a;b.google_rt=a;b.google_ad_type=a;b.google_image_size=a;b.google_feedback=a;b.google_skip=a;b.google_page_location=a;b.google_referrer_url=a;b.google_ad_region=a;b.google_ad_section=a;b.google_bid=a;b.google_cpa_choice=a;b.google_cust_age=a;b.google_cust_gender=a;b.google_cust_interests=a;b.google_cust_id=a;b.google_cust_job=a}
function A(){var b=null;var a=window;var d=document;var f=new Date();var 
e=f.getTime();var 
j=a.google_ad_format;if(a.google_cpa_choice){a.google_ad_url="http://pagead2.googlesyndication.com/cpa/ads?";a.google_ad_url+="client="+escape(y(a.google_ad_client));a.google_ad_region="_google_cpa_region_";c("cpa_choice",a.google_cpa_choice)}else{a.google_ad_url="http://pagead2.googlesyndication.com/pagead/ads?";a.google_ad_url+="client="+escape(y(a.google_ad_client))}var 
k=a.google_num_slots_by_client;var w=
a.google_num_slots_by_channel;var 
i=a.google_prev_ad_formats_by_region;a.onerror=a.google_org_error_handler;if(a.google_ad_region==b&&a.google_ad_section!=b){a.google_ad_region=a.google_ad_section}var 
h=a.google_ad_region==b?"":a.google_ad_region;var 
q=false;if(j){q=j.indexOf("_0ads")>0}if(q){if(a.google_num_0ad_slots){a.google_num_0ad_slots=a.google_num_0ad_slots+1}else{a.google_num_0ad_slots=1}if(a.google_num_0ad_slots>1){return}}else 
if(!a.google_cpa_choice){if(a.google_num_ad_slots){a.google_num_ad_slots=
a.google_num_ad_slots+1}else{a.google_num_ad_slots=1}if(a.google_num_slots_to_rotate){i[h]=b;if(a.google_num_slot_to_show==b){a.google_num_slot_to_show=e%a.google_num_slots_to_rotate+1}if(a.google_num_slot_to_show!=a.google_num_ad_slots){return}}else 
if(a.google_num_ad_slots>3&&h==""){return}}c("dt",f.getTime());c("hl",a.google_language);if(a.google_country){c("gl",a.google_country)}else{c("gl",a.google_gl)}c("gr",a.google_region);g("gcs",a.google_city);g("hints",a.google_hints);c("adsafe",a.google_safe)
;c("oe",a.google_encoding);c("lmt",a.google_last_modified_time);g("alternate_ad_url",a.google_alternate_ad_url);c("alt_color",a.google_alternate_color);c("skip",a.google_skip);var 
n=a.google_ad_client;if(!k[n]){k[n]=1;k.length+=1}else{k[n]+=1}if(i[h]){g("prev_fmts",i[h].toLowerCase());if(k.length>1){c("slot",k[n])}}if(j){g("format",j.toLowerCase());if(i[h]){i[h]=i[h]+","+j}else{i[h]=j}}c("num_ads",a.google_max_num_ads);c("output",a.google_ad_output);c("adtest",a.google_adtest);if(a.google_ad_channel)
{var r=a.google_ad_channel.toLowerCase();g("channel",r);var s="";var 
t=r.split("+");for(var o=0;o<t.length;o++){var 
p=t[o];if(!w[p]){w[p]=1}else{s+=p+"+"}}g("pv_ch",s)}g("url",a.google_page_url);l("bg",a.google_color_bg,e);l("text",a.google_color_text,e);l("link",a.google_color_link,e);l("url",a.google_color_url,e);l("border",a.google_color_border,e);l("line",a.google_color_line,e);c("kw_type",a.google_kw_type);g("kw",a.google_kw);g("contents",a.google_contents);c("num_radlinks",a.google_num_radlinks)
;c("max_radlink_len",a.google_max_radlink_len);c("rl_filtering",a.google_rl_filtering);c("rl_mode",a.google_rl_mode);c("rt",a.google_rt);c("ad_type",a.google_ad_type);c("image_size",a.google_image_size);c("region",a.google_ad_region);c("feedback_link",a.google_feedback);g("ref",a.google_referrer_url);g("loc",a.google_page_location);c("bid",a.google_bid);c("cust_age",a.google_cust_age);c("cust_gender",a.google_cust_gender);c("cust_interests",a.google_cust_interests);c("cust_id",a.google_cust_id);c(
"cust_job",a.google_cust_job);if(z(a,d)&&d.body){var 
u=d.body.scrollHeight;var 
v=d.body.clientHeight;if(v&&u){g("cc",Math.round(v*100/u))}}D(a,f);G(a,d,a.google_ad_url);F(a)}
function C(b,a,d){A();return true}
function z(b,a){return b.top.location==a.location}
function x(b,a){var d=a.documentElement;if(z(b,a))return 
false;if(b.google_ad_width&&b.google_ad_height){var f=1;var 
e=1;if(b.innerHeight){f=b.innerWidth;e=b.innerHeight}else 
if(d&&d.clientHeight){f=d.clientWidth;e=d.clientHeight}else 
if(a.body){f=a.body.clientWidth;e=a.body.clientHeight}if(e>2*b.google_ad_height||f>2*b.google_ad_width){return 
false}}return true}
function E(){var b=window;var a=document;var d=a.location;var 
f=a.referrer;var 
e=null;b.google_org_error_handler=b.onerror;b.onerror=C;if(b.google_ad_frameborder==e){b.google_ad_frameborder=0}if(b.google_ad_output==e){b.google_ad_output="html"}if(b.google_ad_format==e&&b.google_ad_output=="html"){b.google_ad_format=b.google_ad_width+"x"+b.google_ad_height}if(b.google_page_url==e){b.google_page_url=f;if(!x(b,a)){b.google_page_url=d;b.google_last_modified_time=Date.parse(a.lastModified)/1000;b.google_referrer_url=
f}}else{b.google_page_location=f;if(!x(b,a)){b.google_page_location=d}}if(b.google_num_slots_by_channel==e){b.google_num_slots_by_channel=new 
Array()}if(b.google_num_slots_by_client==e){b.google_num_slots_by_client=new 
Array()}if(b.google_prev_ad_formats_by_region==e){b.google_prev_ad_formats_by_region=new 
Array()}}
E();A();

})()'' failed: SyntaxError: unterminated string literal (httpunit; line 26)


The code is:

try{

            //Create the conversation object which will maintain state 
for us
            WebConversation wc = new WebConversation();

            //Obtain the main page on the meterware web site
            WebRequest request = new GetMethodWebRequest(url);
            WebResponse response = wc.getResponse(request);
           
           //System.out.println(response.getElementNames());
           
        }
        catch(Exception e){
             
              System.err.println("ERROR in getUrlQuery() method on 
URLQuery class: " + e );
        }   


When I try with other webs I don't have any problem.

Thanks


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.