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 compilation with too long constant strings #26

Merged
merged 4 commits into from
Oct 31, 2020
Merged

Fix compilation with too long constant strings #26

merged 4 commits into from
Oct 31, 2020

Conversation

kelunik
Copy link
Collaborator

@kelunik kelunik commented Oct 31, 2020

@codecov-io
Copy link

codecov-io commented Oct 31, 2020

Codecov Report

Merging #26 into master will decrease coverage by 89.53%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #26       +/-   ##
============================================
- Coverage     89.53%   0.00%   -89.54%     
============================================
  Files            47      47               
  Lines          1978    1996       +18     
  Branches        329     336        +7     
============================================
- Hits           1771       0     -1771     
- Misses          123    1996     +1873     
+ Partials         84       0       -84     
Impacted Files Coverage Δ Complexity Δ
...rc/main/java/gg/jte/internal/TemplateCompiler.java 0.00% <0.00%> (-94.71%) 0.00 <0.00> (-31.00)
jte-runtime/src/main/java/gg/jte/Content.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-1.00%)
jte-runtime/src/main/java/gg/jte/ContentType.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-1.00%)
jte-runtime/src/main/java/gg/jte/CodeResolver.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-1.00%)
...runtime/src/main/java/gg/jte/html/HtmlContent.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-1.00%)
...untime/src/main/java/gg/jte/TemplateException.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-2.00%)
...ntime/src/main/java/gg/jte/internal/ClassInfo.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-4.00%)
...ntime/src/main/java/gg/jte/internal/DebugInfo.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-1.00%)
...ime/src/main/java/gg/jte/html/OwaspHtmlPolicy.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-1.00%)
...me/src/main/java/gg/jte/internal/TemplateMode.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-1.00%)
... and 38 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1f7c80a...50bf527. Read the comment docs.

@kelunik
Copy link
Collaborator Author

kelunik commented Oct 31, 2020

Interesting, Windows seems to have different constant pool sizes. I'll have a look.

D:\a\jte\jte\jte\jte-classes\gg\jte\generated\test\JtetemplateGenerated.java:2: error: UTF8 representation for string "?????..." is too long for the constant pool

@kelunik kelunik requested a review from casid October 31, 2020 13:30
@casid
Copy link
Owner

casid commented Oct 31, 2020

Nice, thanks for PR @kelunik! I'll try to hop over to my windows PC and have a look at the failing tests.

@casid
Copy link
Owner

casid commented Oct 31, 2020

Running the tests on Windows via IntelliJ results in no errors. Will try maven...

@casid
Copy link
Owner

casid commented Oct 31, 2020

@kelunik okay when I run the tests via maven on Windows all multibyte offset tests fail here as well. Maybe some difference in JVM startup parameters compared to maven?

@casid
Copy link
Owner

casid commented Oct 31, 2020

It seems that unicode output on Windows via maven doesn't give the desired output at all. Rendering a single Mr Poo works fine via IntelliJ launcher but fails when executed by maven surefire plugin. I committed the test to see if it is the case on Github Action, too.

[ERROR]   TemplateEngineTest.templateWithoutParameters_mrPoo:42->thenOutputIs:1136 
Expecting:
 <"💩">
to be equal to:
 <"💩">
but was not.

@kelunik
Copy link
Collaborator Author

kelunik commented Oct 31, 2020

Interesting, the GitHub Action says:

Expecting:
 <"💩">
to be equal to:
 <"?">

@casid
Copy link
Owner

casid commented Oct 31, 2020

Applying this argline to the surefire plugin worked for me locally, let's see what the Github Action is doing.

@kelunik
Copy link
Collaborator Author

kelunik commented Oct 31, 2020

I just committed the same change. 😄

@kelunik
Copy link
Collaborator Author

kelunik commented Oct 31, 2020

@casid What's the default encoding on your Windows JVM? java -XshowSettings should show it.

@casid
Copy link
Owner

casid commented Oct 31, 2020

@kelunik this seems to be file.encoding = Cp1252.

@kelunik
Copy link
Collaborator Author

kelunik commented Oct 31, 2020

I can reproduce it locally with <argLine>-Dfile.encoding=ISO-8859-1</argLine> :-)

@casid
Copy link
Owner

casid commented Oct 31, 2020

Nice! I've added one more test, just for the sake of coverage and would merge the PR after the build ran through. Thanks for fixing this @kelunik :-)

@casid casid merged commit 1a18a68 into master Oct 31, 2020
@casid casid deleted the fix-25 branch October 31, 2020 15:24
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.

Failed to compile template: constant string too long
3 participants