davsclaus opened a new pull request, #29110:
URL: https://github.com/apache/camel/pull/29110

   Fixes [CAMEL-26513](https://issues.apache.org/jira/browse/CAMEL-26513).
   
   Follow-up of #29016 (CAMEL-26193), which left this behaviour for its own 
issue.
   
   ### A doc flavor the print service does not support skipped the job silently
   
   **What was wrong:** `PrinterProducer.print` only printed when 
`printService.isDocFlavorSupported(flavor)` was true.
   Otherwise it did nothing and did not fail, so the exchange completed as if 
the document was printed.
   
   **What changed:** the producer now throws a `javax.print.PrintException` 
that names the print service and the doc
   flavor, and hints to set the `flavor` and `mimeType` options. This matches 
`DocPrintJob.print`, which fails for a doc
   flavor it cannot print. No print job is created. The check runs before the 
`sendToPrinter` branch, as before, so it
   also applies with `sendToPrinter=false` (that mode still writes the document 
to a file only when the flavor is
   supported).
   
   ### Tests
   
   New `PrinterProducerDocFlavorTest` runs the producer on a mocked 
`PrintService` (no print service lookup, nothing
   reaches a real printer):
   - an unsupported flavor (`DocFlavor.INPUT_STREAM` + `PDF`) fails with a 
`PrintException` naming the printer and the
     flavor, and creates no print job;
   - the same with `sendToPrinter=false` and the default flavor;
   - in a route, the exchange carries the `PrintException` and the next step is 
not reached;
   - a supported flavor is printed.
   
   Without the fix, the 3 unsupported-flavor tests fail. With the fix the 
module passes: 23 tests, 0 failures, 5 skipped
   (the existing `@Disabled` tests). Built with `-Psourcecheck`.
   
   ### Docs and generated files
   
   - `lpr-component.adoc`: a short paragraph under "Printer Producer" on the 
failure. Copied to `camel-catalog` docs.
   - Upgrade guide 4.24: new `camel-printer` entry next to the CAMEL-26193 one, 
since a route that "worked" before now
     fails.
   
   ### Not changed
   
   - No option, header or `@BodyTypes` change, so no regenerated JSON.
   
   _Claude Code on behalf of Claus Ibsen (davsclaus)_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to