Skip to content

feat: Allow unicode javadoc comments#162

Merged
lqiu96 merged 2 commits intomainfrom
main-allow_unicode_javadoc_comments
Nov 8, 2022
Merged

feat: Allow unicode javadoc comments#162
lqiu96 merged 2 commits intomainfrom
main-allow_unicode_javadoc_comments

Conversation

@lqiu96
Copy link
Copy Markdown
Member

@lqiu96 lqiu96 commented Nov 8, 2022

Fixes #161

This is the new ...Field.Builder.yml file:

- uid: "com.google.cloud.bigquery.Field.Builder.setPrecision(java.lang.Long)"
  id: "setPrecision(java.lang.Long)"
  parent: "com.google.cloud.bigquery.Field.Builder"
  langs:
  - "java"
  name: "setPrecision(Long precision)"
  nameWithType: "Field.Builder.setPrecision(Long precision)"
  fullName: "com.google.cloud.bigquery.Field.Builder.setPrecision(Long precision)"
  overload: "com.google.cloud.bigquery.Field.Builder.setPrecision*"
  type: "Method"
  package: "com.google.cloud.bigquery"
  summary: "Precision can be used to constrain the maximum number of total digits allowed for NUMERIC or\n BIGNUMERIC types. It is invalid to set values for Precision for types other than // NUMERIC\n or BIGNUMERIC. For NUMERIC type, acceptable values for Precision must be: 1 ≤ (Precision -\n Scale) ≤ 29. Values for Scale must be: 0 ≤ Scale ≤ 9. For BIGNUMERIC type, acceptable values\n for Precision must be: 1 ≤ (Precision - Scale) ≤ 38. Values for Scale must be: 0 ≤ Scale ≤\n 38."
  syntax:
    content: "public Field.Builder setPrecision(Long precision)"
    parameters:
    - id: "precision"
      type: "java.lang.Long"
    return:
      type: "com.google.cloud.bigquery.Field.Builder"

Issue seems to be from bodyItem.toString() (https://www.javadoc.io/static/org.kohsuke.sorcerer/sorcerer-javac/0.11/com/sun/tools/javac/tree/DCTree.DCText.html) which renders the with unicode escapes. Use apache-commons-text to render the unicode escapes back to unicode values.

@lqiu96 lqiu96 requested review from a team and suztomo November 8, 2022 17:03
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>${apache.commons-text.version}</version>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

<apache.commons-lang.version>3.12.0</apache.commons-lang.version>
<apache.commons-collections.version>4.4</apache.commons-collections.version>
<apache.commons-io.version>2.11.0</apache.commons-io.version>
<apache.commons-text.version>1.10.0</apache.commons-text.version>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This version is safe. But commons text is often marked as CVEs.

https://security.netapp.com/advisory/ntap-20221020-0004/

@lqiu96 lqiu96 changed the title Main allow unicode javadoc comments feat: Allow unicode javadoc comments Nov 8, 2022
@lqiu96 lqiu96 merged commit 1d930fe into main Nov 8, 2022
@lqiu96 lqiu96 deleted the main-allow_unicode_javadoc_comments branch November 8, 2022 20:16
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

Successfully merging this pull request may close these issues.

BigQuery Unicode Javadoc not rendering correctly

2 participants