Because local PrintService objects on Windows have a name which is not their 
UNC path, the PrinterProducer can never find them.
-------------------------------------------------------------------------------------------------------------------------------

                 Key: CAMEL-4478
                 URL: https://issues.apache.org/jira/browse/CAMEL-4478
             Project: Camel
          Issue Type: Bug
    Affects Versions: 2.8.1
         Environment: Windows 7 64-bit, jdk 1.6.0_20
            Reporter: Denis Robert


In org.apache.camel.component.printer.PrinterProducer, the line:

setPrinter("\\\\" + config.getHostname() + "\\" + config.getPrintername());

reconstructs a UNC path which is expected to match the name of a PrintService 
on the system. For local printers on Windows, the name of the PrintService is 
simply the name of the printer without the host and any backslashes, so the 
PrinterProducer is never able to find them.

So when config.getHostname() is "localhost", at least on Windows, the line 
should be simply:

setPrinter(config.getPrintername())

so that we'd have code like:

if ("localhost".equalsIgnoreCase(config.getHostname())) {
  setPrinter(config.getPrintername());
} else {
  setPrinter("\\\\" + config.getHostname() + "\\" + config.getPrintername());
}

This can only work if issue CAMEL-4477 about the error in parseURI() in 
PrinterConfiguration is also fixed.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to