Java API GetPrinters() Error

Michael Sweet mike at easysw.com
Fri May 5 11:02:35 PDT 2006


Benjamin Wagner wrote:
> Hi all,
> 
> i posted this some days ago in the bugs forum, but with no response - hopefully here i'm a bit more lucky...
> 
> i want to use the CUPS Java API in my web app to print some file on the server side. Im using CUPS 1.1.23, Java 1.5, JBoss 4.0.3SP1 all running on a suse 9.3 system. I have 2 Problems:

Doesn't Java 1.5 already provide CUPS support via the standard print
provider interface?

> 1. this seems to me a bug in the API:
> somtimes the cups.cupsGetPrinters() seems to hang - like its waiting for a response. The problem is in the 'case REQ_STATE_READ_RESPONSE:' Block of the Cups.doRequest() function:
> when the http.read_header() function returns 0 while the http.status is OK (which is sometimes the case for me), the state flag is never changed and the loop is never ended - the http.read_header() function is called over and over again.
> I made 2 changes to fix it:
> a) added these two lines (line 750-755 including comments)
>   case REQ_STATE_READ_RESPONSE:
> +    if (http.status == IPPHttp.HTTP_OK)
> +        http.status = 0;
>     read_length = http.read_header();
 > ...

That's possible.  Please file a STR for all of these issues at:

     http://www.cups.org/str.php

I can pretty much guarantee that these issues will not be fixed in
1.2, though...

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com
Internet Printing and Document Software          http://www.easysw.com




More information about the cups mailing list