profile
viewpoint

destan/github-label-manager 82

Manage and migrate your Github labels

destan/imdb-data-parser 6

Parses the IMDB dumps into CSV and Relational Database insert queries

destan/searcheverything 2

Search Everything clone for Linux

destan/angularjs-sunum 1

Google'ın AngularJs'i - Özgür Web Teknolojileri Günleri 2013

kodgemisi-blog/jira-cloud-oauth2-client-with-spring-boot 1

Jira Cloud OAuth2 Client with Spring Boot

destan/devlet-yazilim-iliskisi-sunumu 0

"Devlet ve Özgür Yazılım İlişkisi Nasıl Olabilir(di)?" konulu Türkçe sunum

issue commentthymeleaf/thymeleaf

Bug in numbers.formatInteger and numbers.formatDecimal

OK, thank you.

mahozad

comment created time in a day

issue commentthymeleaf/thymeleaf

Bug in numbers.formatInteger and numbers.formatDecimal

This is already in 3.0.12-SNAPSHOT.

Note however that the Thymeleaf core does not create any instances of DateTimeFormatter because its code is Java6-compatible. I suggest you create an equivalent ticket at the https://github.com/thymeleaf/thymeleaf-extras-java8time subproject so that this can be correctly dealt with at the java.time-related artifacts, which will be part of the core in a future version.

mahozad

comment created time in a day

PR closed thymeleaf/thymeleaf

Fixes #782 - Set the locale to the current instead of a fixed one

Fixes #782

+1 -1

1 comment

1 changed file

mahozad

pr closed time in a day

pull request commentthymeleaf/thymeleaf

Fixes #782 - Set the locale to the current instead of a fixed one

Fixed with some code differences by 283f70a

mahozad

comment created time in a day

push eventthymeleaf/thymeleaf

Daniel Fernández

commit sha 283f70ace2648bbc0b4da3f788358c69a502bcf4

Fixed #782 - #numbers.format*() expression utility methods not producing numbers using the correct digit symbols for locales that use them, in JDK versions where NumberFormat does this (currently >= JDK15).

view details

push time in a day

issue closedthymeleaf/thymeleaf

Bug in numbers.formatInteger and numbers.formatDecimal

<h1>Description</h1>

  • Thymeleaf v3.0.11.RELEASE
  • Spring Boot v2.1.0.RELEASE (irrelevant to the bug)
  • JDK v12.0.2 (Java 11 or higher)

Update 2020-11-17

There might be other subtle problems as well. For example thousands separators are not the same in different European countries and I think Thymeleaf does not produce correct formatting in this case either. So by fixing The issue and also doing the following, all (or most of) the problems may be resolved.

Note that there was also a bug in Java DateTimeFormatter class. I filed an issue here and the bug was fixed in Java 15.

In addition to the fix for The issue, any DateTimeFormatter creation should be accompanied by localizedBy(locale):

  • DateTimeFormatter#withLocale(locale) should be replaced with DateTimeFormatter#localizedBy(locale)
  • DateTimeFormatter.ofPattern(...); etc. should be accompanied by .localizedBy(locale) like this: DateTimeFormatter.ofPattern(...).localizedBy(locale);

Also note that for The issue, if Java version is < 15, then the problem may still exist unless JDK developers backport the DateTimeFormatter fix to earlier Java versions.

The issue

${#numbers.formatInteger} and ${#numbers.formatDecimal} do not work correctly for locales other than en_US. This is also true for numbers returened by ${#temporals.format()} (for example year).

Steps to reproduce the bug:

  1. Somehow set the locale that Thymeleaf uses to fa (Persian language)
    • Note: Creating Persian locale: Locale locale = Locale.forLanguageTag("fa");
  2. Output a text in an element with th:text="${#numbers.formatInteger(1234, 1)}"
  3. The result should be ۱۲۳۴ but it is 1234

An easier way to see the bug:

public static void main(String[] args) {
    Locale locale = Locale.forLanguageTag("fa");
    DecimalFormat format = (DecimalFormat) NumberFormat.getNumberInstance(locale);
    // TODO: Replace Locale.US below with locale and see what happens
    format.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
    System.out.println(format.format(2020));
}

This bug has not been detected probably because languages such as English, French, Spanish and... use the same symbols and characters to represent numbers. Languages such as Persian, Arabic and maybe some others use different symbols and characters to represent numbers.

The origin of the bug and the solution

The problem is in the following line which sets the locale to Locale.US (intentional or just a mistake?) :

https://github.com/thymeleaf/thymeleaf/blob/3a8366126d51461e59bfdc5676fea334b1184a72/src/main/java/org/thymeleaf/util/NumberUtils.java#L226

It can be easily resolved by modifying the above line to use the locale parameter of the function:

https://github.com/thymeleaf/thymeleaf/blob/6903e0a5c545b054a3e60544d214c3d753f7035c/src/main/java/org/thymeleaf/util/NumberUtils.java#L226

@danielfernandez, @ultraq

closed time in a day

mahozad

push eventthymeleaf/thymeleaf

Daniel Fernández

commit sha 283f70ace2648bbc0b4da3f788358c69a502bcf4

Fixed #782 - #numbers.format*() expression utility methods not producing numbers using the correct digit symbols for locales that use them, in JDK versions where NumberFormat does this (currently >= JDK15).

view details

push time in a day

startedruzickap/packer-templates

started time in 3 days

starteddebuerreotype/debuerreotype

started time in 3 days

startediam4722202468/ThinkpadBattery

started time in 3 days

issue commentthymeleaf/thymeleaf

Provide support for Servlet 5.0

All right, i'm doing it, thanks!

chkal

comment created time in 4 days

issue commentthymeleaf/thymeleaf

Provide support for Servlet 5.0

The current version of Thymeleaf should work fine with Jave/Jakarta EE 8. I guess your problem is caused by something else. Perhaps you should file a new issue and include all the information you have. Including the exact error message. Thanks.

chkal

comment created time in 4 days

issue commentthymeleaf/thymeleaf

Provide support for Servlet 5.0

@chkal Sorry for the wrong nomenclature. I am developing a WebProfile Intellij Idea project, with Java EE 8 (Jakarta EE 8), but i'm facing an issue on resolving the Thymeleaf dependency using that technology, since some methods are expecting "javax. ...". So what dependency should i use? On MVNrepository of thymeleaf (https://mvnrepository.com/artifact/org.thymeleaf.extras/thymeleaf-extras-java8time) i found this one from Thymeleaf Extras Java8time (in addition the another nomal one from org.thymeleaf):

<!-- https://mvnrepository.com/artifact/org.thymeleaf.extras/thymeleaf-extras-java8time --> <dependency> <groupId>org.thymeleaf.extras</groupId> <artifactId>thymeleaf-extras-java8time</artifactId> <version>3.0.4.RELEASE</version> </dependency>

chkal

comment created time in 4 days

issue commentthymeleaf/thymeleaf

Provide support for Servlet 5.0

@chkal Sorry for the wrong nomenclature. I am developing a WebProfile Intellij Idea project, with Java EE 8 (Jakarta EE 8), but i'm facing an issue on resolving the Thymeleaf dependency using that technology, since some methods are expecting "javax. ...".

chkal

comment created time in 4 days

issue commentthymeleaf/thymeleaf

Provide support for Servlet 5.0

@federicoromeo I'm not sure if I fully understand your question. Thymeleaf supports Jakarta EE 8 (which is essentially the same as Java EE 8). But Jakarta EE 9, which has just been released a few days ago, is not supported yet.

chkal

comment created time in 4 days

issue commentthymeleaf/thymeleaf

Provide support for Servlet 5.0

@danielfernandez In the new version jakarta, is thymeleaf supported? If yes, can someone send me the maven dependencie?

chkal

comment created time in 5 days

push eventthymeleaf/thymeleaf

Daniel Fernández

commit sha 77d1942948d05a83bc1303d298f0d727583ea492

Improved mechanism for internally processing library versions

view details

Daniel Fernández

commit sha 30e8b8d1d29d9904222177984df3d3f52a7f6ce5

Made version parsing mechanism more lenient

view details

push time in 5 days

push eventthymeleaf/thymeleaf

Daniel Fernández

commit sha 30e8b8d1d29d9904222177984df3d3f52a7f6ce5

Made version parsing mechanism more lenient

view details

push time in 5 days

push eventthymeleaf/thymeleaf

Daniel Fernández

commit sha 77d1942948d05a83bc1303d298f0d727583ea492

Improved mechanism for internally processing library versions

view details

push time in 6 days

startedjarun/nnn

started time in 9 days

startedGalicarnax/dcvim

started time in 9 days

issue commentthymeleaf/thymeleaf

Does't display currency symbol in Thymeleaf Template

Hey Sandeep. You can use indian currency like as [(${lineItem.currency})] instead of <span th:text="${lineItem.currency}"></span>. Where lineItem is you dto that have currency HEXA code.

knavadiya

comment created time in 10 days

created repositoryapixandru/dashboard1

created time in 13 days

startedunicode-org/cldr

started time in 13 days

startedPeter-Easton/GrapheneOS-Knowledge

started time in 13 days

startedeserozvataf/hex

started time in 14 days

startedeserozvataf/hex-service

started time in 14 days

issue commentthymeleaf/thymeleaf

Block "javascript:" scheme in Link Expressions

Thymeleaf can make sure that the javascript: scheme is not used in the base of a link expression (@{...}) and that looks helpful, but nothing can stop a developer from writing things like this:

<a href="" data-th-href="${name}">clickme</a>

Sanitizing context variables (model attributes in Spring jargon) cannot be the responsibility of the template engine.

Of course. In fact I've never cited non-link expressions - that's not something that the template engine could and should act upon. My only surprise was in link expressions.

So I believe forbidding javascript schemes in the base of link expressions (@{...}) will be a good addition, and that's what will be implemented.

OK, seems reasonable. I'd probably like the documentation to explain the behaviour with a bit more detail, I'll try contributing a PR soon. URLs are an easy attack vector sometimes.

Thanks for your interest.

alanfranz

comment created time in 15 days

push eventthymeleaf/thymeleaf

Daniel Fernández

commit sha 0b6f046289cbba9b559fa9d99e4ebed4e9570eb5

Apply trim() on link base before processing in order for schemes to be dealt with properly

view details

Daniel Fernández

commit sha 44eefb4af23e6fa5ed8b073aab3c9f84bf5d624e

Closes #754 - Block "javascript:" scheme in Link Expressions

view details

push time in 16 days

more