-
Notifications
You must be signed in to change notification settings - Fork 27
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
NPE while sorting imports using v1.4.1 #30
Comments
Going back to v1.3.0 of the plugin solves the issue. I do not know what source file is causing the error but could look into it. Suggested enhancement: Any error related to a specific source file should display the path of the offending file and even the offending line if possible. |
impsort plugin configured with
|
Do you have example code to test this with (preferably in the form of the minimal Maven project with the plugin configured) to reproduce this error? |
Sorry for all these notifications. I think I found the issue and I was working on a PR for it. It happens when a file is empty. As this is a valid Java file, we shouldn't throw an exception of it. I was able to solve that. But, then I got to thinking, what about a one-line Java file without a line-ending? This is a valid Java file, too, but I am unsure how to handle it, as the code really works off of the assumption that a newline is a delimiter, rather than, say, a semicolon. So that part didn't work, but perhaps I should split that into a separate PR and submit the one for zero-length files. |
@dwalluck Perhaps it'd be better if this maven plugin simply skipped any files where the detected line ending is
So, we could just emit a warning for files where the detected line ending is |
The way the code is currently written, We could reorder it to do the line-ending detection first, but then we also must change I think it would be OK to skip any file where the ending is |
@dwalluck I think it already detects and returns |
We already don't handle this case well. See #1 ; in any case, such a situation should probably pass through a formatter first, before using this plugin. |
I haven't seen your code, since you haven't created a pull request yet. But, we can have special logic that returns a special |
Fixed in #33 , but now it fails differently. See discussion there for proposed feature to ignore failures. |
The text was updated successfully, but these errors were encountered: