Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cups printer getPrinterState() returns 'null' #52

Open
rajibdk opened this issue May 31, 2021 · 4 comments
Open

cups printer getPrinterState() returns 'null' #52

rajibdk opened this issue May 31, 2021 · 4 comments

Comments

@rajibdk
Copy link

rajibdk commented May 31, 2021

I am using 0.7.8 release along with CUPS v2.2.1. However when I try to get the state of a printer I get 'null' value. I have investigated and found that in class 'PrinterStateEnum' you've compared incoming state value (string, eg 'idle') with toString of enum getValue. If you see your enum declaration the values are in integer, however the incoming state value is string - something like 'idle' or so. Hence we get a 'null' assigned to printer state as if condition fails. For example see below code, so instead of using getValue, getStateName should solve this issue.

for (PrinterStateEnum printerState : PrinterStateEnum.values()) {
System.out.println(printerState.getValue().toString());
}

output: 3 4 5

for (PrinterStateEnum printerState : PrinterStateEnum.values()) {
System.out.println(printerState.getStateName().toString());
}

output: idle printing stopped

@rajibdk
Copy link
Author

rajibdk commented May 31, 2021

I have created a pull request - #53

@jrodguitar
Copy link

I m seeing same behaviour. it will be nice if the next release included this fix.

@jrodguitar
Copy link

jrodguitar commented Oct 7, 2021

Even after your fix @rajibdk , getPrinterState still returns null. what you fixed is the method getState().
Although i am using CUPS 2.2.10

@bangert
Copy link

bangert commented Feb 11, 2022

it sounds to me like there may be a printer state value that cups4j does not know about (yet) - and therefor the state parser returns null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants