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

foo.properties is not print idempotent due to key==value #4026

Closed
Bananeweizen opened this issue Feb 20, 2024 · 1 comment · Fixed by #4065
Closed

foo.properties is not print idempotent due to key==value #4026

Bananeweizen opened this issue Feb 20, 2024 · 1 comment · Fixed by #4065
Labels
bug Something isn't working

Comments

@Bananeweizen
Copy link
Contributor

What version of OpenRewrite are you using?

I am using

  • Maven/Gradle 5.2.1

What is the smallest, simplest way to reproduce the problem?

foo.properties containing

key==value

What is the full stack trace of any errors you encountered?

[WARNING] There were problems parsing foo.properties
[WARNING] java.lang.IllegalStateException: foo.properties is not print idempotent. 
... (skipped diff header output)
-key==value
+key=value
...
  org.openrewrite.Parser.requirePrintEqualsInput(Parser.java:52)

I checked the Javadoc of Properties and an equals sign immediately after the first equals should be considered part of the value. Also when loading "key==value" into Java properties, it returns "=value" when asking for "key".

Are you interested in contributing a fix to OpenRewrite?

Not for this one.

@Bananeweizen Bananeweizen added the bug Something isn't working label Feb 20, 2024
@timtebeek
Copy link
Contributor

Oh wow, curious case once again. Thanks for reporting it here!

@timtebeek timtebeek moved this to Backlog in OpenRewrite Feb 20, 2024
Bananeweizen added a commit to Bananeweizen/rewrite that referenced this issue Mar 2, 2024
knutwannheden pushed a commit that referenced this issue Mar 2, 2024
* Correctly parse property values starting with delimiter character

Fixes #4026.

* avoid arithmetic on state operations

Avoid arithmetic operations with the state variable and rather assign
the new value. Also convert to enum to make the states more easy to
understand for the next author.
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenRewrite Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants