JDK-6252456 : Printing (with LPRng print system) can't handle "-" in printer name
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 5.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2005-04-08
  • Updated: 2010-04-02
  • Resolved: 2005-11-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b62Fixed
Description
FULL PRODUCT VERSION :
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Redhat linux 9.0
Applicable to any linux distribution using LPRng or similar print system


A DESCRIPTION OF THE PROBLEM :
Printers with a dash ("-") in their name always shows status as "not accepting print jobs". It is not possible to print to such a printer.

By replacing the /usr/sbin/lpc command with a script which pauses, I am able to determine that java is attempting to determine the printer status by executing the following command pipeline:

  /usr/sbin/lpc status bluej-printer| grep -E '^[ 0-9a-zA-Z]*@' | awk '{print $2, $3}'

Contrast this to the command which is used to get the list of printers:

  /usr/sbin/lpc status | grep -E '^[ 0-9a-zA-Z_-]*@' | awk -F'@' '{print $1}'

The significant difference is the lack of the dash (and underline) at the end of the grep regular expression in the former case. This causes retrieval of printer status to fail.



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Setup a printer on an LPRng print system which has a dash in the printer name
2. Attempt to print to that printer using any java software


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
After 2, the printout should emerge from the printer.

ACTUAL -
When attempting 2, the printer status shows as "not accepting print jobs" and it is not possible to lodge the print job.


ERROR MESSAGES/STACK TRACES THAT OCCUR :
In the print dialog:

"Status: Not accepting jobs".


REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
Print to file, then print the file from the command line.
 - OR -
Rename the troublesome printer.
###@###.### 2005-04-08 08:53:01 GMT

Comments
EVALUATION It looks like when the code in UnixPrintServiceLookup had the "_-" added to fix : "4615473:Certain Print Queues not Discovered by lookupPrintServices() in Red Hat 7.2" ... that the same was not done in the cases in UnixPrintSerice that check the status and queue. Since the code in UnixPrintSerice pre-dates the fix to 4615473 that fix was in practice useless. Either the code was only later updated to invokes that test when printing (possible I suppose) or alternatively it sounds like that case was never tested to do actual printing (ie beyond printer discovery ) on lprng even though the example in the description of 4615473 looks like its lprng. I speculate that none of our linux printing test setups have a "-" in their printer name, and are mostly using CUPs anyway. ###@###.### 2005-04-12 21:36:16 GMT
12-04-2005