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

   # Description
   
   Part of [CAMEL-23832](https://issues.apache.org/jira/browse/CAMEL-23832). 
The umbrella ticket stays open.
   
   ## Summary
   
   This PR rewrites 15 texts of camel-printer (scheme `lpr`): the component 
description, 13 endpoint options and the
   `PrinterJobName` header. The new texts say how the producer looks up the 
printer by name, which values `flavor`,
   `mimeType`, `mediaSize`, `sides` and `mediaTray` take, what the defaults do, 
and when a value fails the producer start
   or the endpoint creation.
   
   What was wrong with the old texts:
   
   - `mediaTray` named `javax.print.DocFlavor` and the example value `upper`. 
The trays are
     `javax.print.attribute.standard.MediaTray` names such as `top`, `middle`, 
`bottom` or `manual`, matched with the same
     case.
   - `port` said "Port number of the printer", but the producer does not use 
it: it looks up the printer by name.
   - `sendToPrinter` was cut off ("etting this option ...") and did not say 
where the document is written instead.
   - `flavor` and `docFlavor` had the same text, "Sets DocFlavor to use.", and 
`mimeType` did not say that it takes the
     names of `DocFlavor` constants (`AUTOSENSE`, `PDF`, `TEXT_PLAIN_UTF_8`, 
...) rather than MIME types.
   - `printerPrefix` said it helps "when the printer name does not start with 
//hostname/printer", which does not match how
     the name is matched (a print service matches when one of the names ends 
with the other).
   
   Sources: the Camel code (`PrinterConfiguration`, `PrinterProducer`, 
`PrinterOperations`, `DocFlavorAssigner`,
   `MediaSizeAssigner`) and the Java Print Service API of the JDK 
(`javax.print.DocFlavor`, `PrintServiceLookup`,
   `javax.print.attribute.standard.MediaSizeName`, `MediaTray`, `Sides`, 
`OrientationRequested`).
   
   ### Found, not changed
   
   - With `sendToPrinter=false` and no `mimeType` set, 
`PrinterOperations.print` calls `mimeType.equalsIgnoreCase(...)` on
     `null` and fails with a `NullPointerException`: the `AUTOSENSE` default is 
applied only to a local variable in
     `PrinterConfiguration.assignDocFlavor`, not to the option.
   - `flavor` (code default `DocFlavor.BYTE_ARRAY`) and `mimeType` (code 
default `AUTOSENSE`) have no `defaultValue` in the
     metadata.
   - A `flavor` and `mimeType` combination that `DocFlavorAssigner` does not 
know (for example the default
     `DocFlavor.BYTE_ARRAY` with `mimeType=TEXT_PLAIN`, or a misspelled value) 
silently falls back to
     `DocFlavor.BYTE_ARRAY.AUTOSENSE` instead of failing.
   - `PrintDocument` always hands the body to the print service as an 
`InputStream`, also for the `SERVICE_FORMATTED`
     doc flavors (`mimeType` `PAGEABLE`, `PRINTABLE`, `RENDERABLE_IMAGE`), 
whose print data must be a `Pageable`,
     `Printable` or `RenderableImage` object.
   - The `port` path parameter is not used to look up the printer, only in the 
service location of the endpoint.
   - `sendToPrinter=false` writes to `./target` of the working directory and 
fails if that directory does not exist.
   - The Javadoc of `PrinterEndpoint` still has two old paragraphs after the 
component description ("Obviously the payload
     ...", "line printer"); the build does not use them.
   
   ## Tests
   
   - There is no new test, as only description text changes.
   - A script compared the component JSON with the parent commit: only 
`description` fields changed (15 texts: 1
     component, 13 options, 1 header).
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [x] I ran the formatter and built the module, then regenerated the catalog 
copy, `dsl/camel-endpointdsl` and `dsl/camel-componentdsl`, and committed all 
generated changes.
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
   
   _Claude Code on behalf of 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