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

Fix text decoration parsing (#473) #475

Merged
merged 2 commits into from
Oct 11, 2021
Merged

Conversation

Foorcee
Copy link
Contributor

@Foorcee Foorcee commented Oct 9, 2021

@kashike
Copy link
Member

kashike commented Oct 9, 2021

Please add some test coverage for this.

@kashike kashike self-assigned this Oct 11, 2021
@kashike kashike added this to the 4.10.0 milestone Oct 11, 2021
@kashike kashike merged commit 3d6eaaf into KyoriPowered:master Oct 11, 2021
Comment on lines +184 to +185
} else if (peek == JsonToken.STRING || peek == JsonToken.NUMBER) {
return Boolean.parseBoolean(in.nextString());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work with e.g. 1 as I see the intention here. Boolean#parseBoolean:

    public static boolean parseBoolean(String s) {
        return "true".equalsIgnoreCase(s);
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compared to JsonPrimitive#getAsBoolean():

  @Override
  public boolean getAsBoolean() {
    if (isBoolean()) {
      return ((Boolean) value).booleanValue();
    }
	// Check to see if the value as a String is "true" in any case.
    return Boolean.parseBoolean(getAsString());
  }

The method, is used by the client in Style.Serializer.

zml2008 pushed a commit that referenced this pull request Oct 31, 2021
Fix text decoration parsing

Add some tests
This was referenced Oct 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expected BOOLEAN but was STRING at path $.underlined
3 participants