Skip to content

Improved AMDJS merge implementation#149

Merged
yumaoka merged 4 commits intoIBM-Cloud:masterfrom
yumaoka:amdjs-merge
Aug 23, 2019
Merged

Improved AMDJS merge implementation#149
yumaoka merged 4 commits intoIBM-Cloud:masterfrom
yumaoka:amdjs-merge

Conversation

@yumaoka
Copy link
Contributor

@yumaoka yumaoka commented Aug 23, 2019

  • Changed AMDJS merge implementation to use Rhino JS parser. Previous implementation used regex matcher for each line, and trying to replace value. This implementation was fragile and it does not work various different cases.
  • Previous merge operation tried to wrap long lines, but the new implementation put translated value in a single line. We may revisit this and re-implement line wrapping logic with the new code base.
  • Fixed Resource filter for AMDJS throws NoSuchElementException #148 caused by the previous merge implementation.
  • Previous AMDJS filter write/merge implementation did not escape string literal properly - such as \n for line feed, \" for quoataion and so on (note: parser worked OK because Rhino parser does unescaping). Added proper string literal escape code.
  • Added new data drive test framework. With this framework, we can easily add parse/write/merge test cases without writing new JUnit test methods.
  • Deleted old AMDJS test case files not used.

- Changed AMDJS merge implementation to use Rhino JS parser. Previous implementation used regex matcher for each line, and trying to replace value. This implementation was fragile and it does not work various different cases.
- Previous merge operation tried to wrap long lines, but the new implementation put translated value in a single line. We may revisit this and re-implement line wrapping logic with the new code base.
- Fixed IBM-Cloud#148 caused by the previous merge implementation.
- Previous AMDJS filter write/merge implementation did not escape string literal properly - such as `\n` for line feed, `\"` for quoataion and so on (note: parser worked OK because Rhino parser does unescaping). Added proper string literal escape code.
- Added new data drive test framework. With this framework, we can easily add parse/write/merge test cases without writing new JUnit test methods.
- Deleted old AMDJS test case files not used.
@srl295
Copy link
Contributor

srl295 commented Aug 23, 2019

probably rebase on #150 to fix the build issue

Copy link
Contributor

@srl295 srl295 left a comment

Choose a reason for hiding this comment

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

LGTM but let's get the ci to pass

while (true) {
int tmp = brkItr.next();
if (tmp == BreakIterator.DONE || tmp >= maxLen) {
static String escapeString(String str, Character quoteChar) {
Copy link
Contributor

Choose a reason for hiding this comment

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

could this be done as part of gson?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is JS, not JSON. quote character might be quotation mark, or apostrophe.
There might be a standard library code to do this, but it's simple enough - so I just decided to implement it here.

Copy link
Contributor

Choose a reason for hiding this comment

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

fair enough and good point.

fix jdk versions
yoshito-umaoka added 2 commits August 23, 2019 16:59
- Changed AMDJS merge implementation to use Rhino JS parser. Previous implementation used regex matcher for each line, and trying to replace value. This implementation was fragile and it does not work various different cases.
- Previous merge operation tried to wrap long lines, but the new implementation put translated value in a single line. We may revisit this and re-implement line wrapping logic with the new code base.
- Fixed IBM-Cloud#148 caused by the previous merge implementation.
- Previous AMDJS filter write/merge implementation did not escape string literal properly - such as `\n` for line feed, `\"` for quoataion and so on (note: parser worked OK because Rhino parser does unescaping). Added proper string literal escape code.
- Added new data drive test framework. With this framework, we can easily add parse/write/merge test cases without writing new JUnit test methods.
- Deleted old AMDJS test case files not used.
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.06%) to 52.606% when pulling 2925577 on yumaoka:amdjs-merge into 77b2b0b on IBM-Cloud:master.

@yumaoka yumaoka merged commit e8118b2 into IBM-Cloud:master Aug 23, 2019
@yumaoka yumaoka deleted the amdjs-merge branch August 23, 2019 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resource filter for AMDJS throws NoSuchElementException

3 participants