Code with Finding: |
class LabelBureauResource {
/**
* Get generic tree labels.
* @param request the incomminmg request
* @param format the pics format
* @param urls the urls to label
* @param services the services to ask
* @param data the URLDecoder
* @return A Reply instance
* @exception HTTPException if processing the request failed.
*/
protected Reply getGenericTreeLabels (Request request,
int format,
String urls[],
String services[],
URLDecoder data)
throws HTTPException
{
StringBuffer sb = new StringBuffer (128) ;
sb.append ("("+PICS.PICS_PROTOCOL_ID) ;
// Go through each service:
sloop:
for (int is = 0; is < services.length ; is++) {
LabelServiceInterface s = bureau.getLabelService (services[is]) ;
if ( s == null ) {
sb.append (" error " + "(no-ratings \"unknown service\")") ;
continue sloop ;
}
s.dump (sb, format) ;
sb.append (" labels ") ;
try {
uloop:
for (int iu = 0 ; iu < urls.length ; iu++) {
URL u = new URL (urls[iu]) ;
LabelInterface l[] = s.getGenericTreeLabels(u) ;
if ( l == null ) {
sb.append (" error "+"(not-labeled \""+urls[iu]+"\")");
continue uloop ;
}
sb.append ((iu == 0) ? "(" : " (") ;
for (int il = 0 ; il < l.length ; il++) {
if ( il != 0 )
sb.append (" ") ;
l[il].dump (sb, format) ;
}
sb.append (")") ;
}
} catch (MalformedURLException e) {
Reply error = request.makeReply(HTTP.BAD_REQUEST) ;
error.setContent ("You are requesting an invalid URL.") ;
throw new HTTPException (error) ;
}
}
sb.append (")") ;
return makePICSReply (request, sb) ;
}
}
|