[jira] [Work logged] (LANG-1641) Over Stack Issue

2021-02-21 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1641?focusedWorklogId=555421&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-555421
 ]

ASF GitHub Bot logged work on LANG-1641:


Author: ASF GitHub Bot
Created on: 21/Feb/21 15:15
Start Date: 21/Feb/21 15:15
Worklog Time Spent: 10m 
  Work Description: XenoAmess removed a comment on pull request #703:
URL: https://github.com/apache/commons-lang/pull/703#issuecomment-782873371


   why make class GmtTimeZone final?



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 555421)
Time Spent: 1.5h  (was: 1h 20m)

> Over Stack Issue
> 
>
> Key: LANG-1641
> URL: https://issues.apache.org/jira/browse/LANG-1641
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.time.*
>Affects Versions: 3.7
>Reporter: Xia Yun
>Priority: Major
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> {code:java}
> //this is the demo
> package com.wcs233;
> import java.util.Date;
> import java.util.TimeZone;
> import org.apache.commons.lang3.time.DateFormatUtils;
> import org.apache.commons.lang3.time.FastTimeZone;
> public class GmtTimeZoneIssue {
> public static void main(String[] args) {
> final String timeZoneString = "GMT+7:00";
> final String ISO8601_DATE_FORMAT = "-MM-dd'T'HH:mm:ssZZ";
> for (int i = 0; i < 100; i++) {
> Date date = new Date();
> TimeZone timeZone = FastTimeZone.getTimeZone(timeZoneString);
> String dateString = DateFormatUtils.format(date, 
> ISO8601_DATE_FORMAT, timeZone);
> System.out.println(dateString);
> }
> }
> }{code}
> when running the code above , there is over stack risk
> 1. When invoking FastTimeZone.getTimeZone(timeZoneString), a new GmtTimeZone 
> will be created
> {code:java}
> GmtTimeZone(final boolean negate, final int hours, final int minutes) {
> if (hours >= HOURS_PER_DAY) {
> throw new IllegalArgumentException(hours + " hours out of range");
> }
> if (minutes >= MINUTES_PER_HOUR) {
> throw new IllegalArgumentException(minutes + " minutes out of 
> range");
> }
> final int milliseconds = (minutes + (hours * MINUTES_PER_HOUR)) * 
> MILLISECONDS_PER_MINUTE;
> offset = negate ? -milliseconds : milliseconds;
> zoneId = twoDigits(
> twoDigits(new StringBuilder(9).append("GMT").append(negate ? '-' 
> : '+'), hours)
> .append(':'), minutes).toString();
> }
> {code}
> the every GmtTimeZone instance , the zoneIds instance are different , even 
> through the values are the same.
> 2. When invoking DateFormatUtils.format(), there is a ConCurrentHashMap in 
> FormatCache with key is MultipartKey. when invoking 
> FormatCache.getInstance(), first get from cInstanceCache, if value is null, 
> putIfAbsent, but because GmtTimeZone instances are different, when invoking 
> GmtTimeZone.equals, the logic is 
> {code:java}
> @Override
> public boolean equals(final Object other) {
> if (!(other instanceof GmtTimeZone)) {
> return false;
> }
> return zoneId == ((GmtTimeZone) other).zoneId;
> }
> {code}
> every zoneId address are different so, equals function return false, but 
> actually the zoneId values are the same.
> so FastDateFormat will be put into cInstanceCache in FormatCache again and 
> again, which will increase the capability of the map, and cause over stack 
> risk, also, it will cause application  run much slower.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (LANG-1641) Over Stack Issue

2021-02-21 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1641?focusedWorklogId=555422&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-555422
 ]

ASF GitHub Bot logged work on LANG-1641:


Author: ASF GitHub Bot
Created on: 21/Feb/21 15:15
Start Date: 21/Feb/21 15:15
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on a change in pull request #703:
URL: https://github.com/apache/commons-lang/pull/703#discussion_r579821503



##
File path: src/main/java/org/apache/commons/lang3/time/GmtTimeZone.java
##
@@ -17,14 +17,16 @@
 package org.apache.commons.lang3.time;
 
 import java.util.Date;
+import java.util.Objects;
+import java.util.SimpleTimeZone;
 import java.util.TimeZone;
 
 /**
  * Custom time zone that contains offset from GMT.
  *
  * @since 3.7
  */
-class GmtTimeZone extends TimeZone {
+final class GmtTimeZone extends TimeZone {

Review comment:
   why make class GmtTimeZone final?





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 555422)
Time Spent: 1h 40m  (was: 1.5h)

> Over Stack Issue
> 
>
> Key: LANG-1641
> URL: https://issues.apache.org/jira/browse/LANG-1641
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.time.*
>Affects Versions: 3.7
>Reporter: Xia Yun
>Priority: Major
>  Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> {code:java}
> //this is the demo
> package com.wcs233;
> import java.util.Date;
> import java.util.TimeZone;
> import org.apache.commons.lang3.time.DateFormatUtils;
> import org.apache.commons.lang3.time.FastTimeZone;
> public class GmtTimeZoneIssue {
> public static void main(String[] args) {
> final String timeZoneString = "GMT+7:00";
> final String ISO8601_DATE_FORMAT = "-MM-dd'T'HH:mm:ssZZ";
> for (int i = 0; i < 100; i++) {
> Date date = new Date();
> TimeZone timeZone = FastTimeZone.getTimeZone(timeZoneString);
> String dateString = DateFormatUtils.format(date, 
> ISO8601_DATE_FORMAT, timeZone);
> System.out.println(dateString);
> }
> }
> }{code}
> when running the code above , there is over stack risk
> 1. When invoking FastTimeZone.getTimeZone(timeZoneString), a new GmtTimeZone 
> will be created
> {code:java}
> GmtTimeZone(final boolean negate, final int hours, final int minutes) {
> if (hours >= HOURS_PER_DAY) {
> throw new IllegalArgumentException(hours + " hours out of range");
> }
> if (minutes >= MINUTES_PER_HOUR) {
> throw new IllegalArgumentException(minutes + " minutes out of 
> range");
> }
> final int milliseconds = (minutes + (hours * MINUTES_PER_HOUR)) * 
> MILLISECONDS_PER_MINUTE;
> offset = negate ? -milliseconds : milliseconds;
> zoneId = twoDigits(
> twoDigits(new StringBuilder(9).append("GMT").append(negate ? '-' 
> : '+'), hours)
> .append(':'), minutes).toString();
> }
> {code}
> the every GmtTimeZone instance , the zoneIds instance are different , even 
> through the values are the same.
> 2. When invoking DateFormatUtils.format(), there is a ConCurrentHashMap in 
> FormatCache with key is MultipartKey. when invoking 
> FormatCache.getInstance(), first get from cInstanceCache, if value is null, 
> putIfAbsent, but because GmtTimeZone instances are different, when invoking 
> GmtTimeZone.equals, the logic is 
> {code:java}
> @Override
> public boolean equals(final Object other) {
> if (!(other instanceof GmtTimeZone)) {
> return false;
> }
> return zoneId == ((GmtTimeZone) other).zoneId;
> }
> {code}
> every zoneId address are different so, equals function return false, but 
> actually the zoneId values are the same.
> so FastDateFormat will be put into cInstanceCache in FormatCache again and 
> again, which will increase the capability of the map, and cause over stack 
> risk, also, it will cause application  run much slower.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (LANG-1641) Over Stack Issue

2021-02-21 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1641?focusedWorklogId=555420&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-555420
 ]

ASF GitHub Bot logged work on LANG-1641:


Author: ASF GitHub Bot
Created on: 21/Feb/21 15:13
Start Date: 21/Feb/21 15:13
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on pull request #703:
URL: https://github.com/apache/commons-lang/pull/703#issuecomment-782873371


   why make class GmtTimeZone final?



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 555420)
Time Spent: 1h 20m  (was: 1h 10m)

> Over Stack Issue
> 
>
> Key: LANG-1641
> URL: https://issues.apache.org/jira/browse/LANG-1641
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.time.*
>Affects Versions: 3.7
>Reporter: Xia Yun
>Priority: Major
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> {code:java}
> //this is the demo
> package com.wcs233;
> import java.util.Date;
> import java.util.TimeZone;
> import org.apache.commons.lang3.time.DateFormatUtils;
> import org.apache.commons.lang3.time.FastTimeZone;
> public class GmtTimeZoneIssue {
> public static void main(String[] args) {
> final String timeZoneString = "GMT+7:00";
> final String ISO8601_DATE_FORMAT = "-MM-dd'T'HH:mm:ssZZ";
> for (int i = 0; i < 100; i++) {
> Date date = new Date();
> TimeZone timeZone = FastTimeZone.getTimeZone(timeZoneString);
> String dateString = DateFormatUtils.format(date, 
> ISO8601_DATE_FORMAT, timeZone);
> System.out.println(dateString);
> }
> }
> }{code}
> when running the code above , there is over stack risk
> 1. When invoking FastTimeZone.getTimeZone(timeZoneString), a new GmtTimeZone 
> will be created
> {code:java}
> GmtTimeZone(final boolean negate, final int hours, final int minutes) {
> if (hours >= HOURS_PER_DAY) {
> throw new IllegalArgumentException(hours + " hours out of range");
> }
> if (minutes >= MINUTES_PER_HOUR) {
> throw new IllegalArgumentException(minutes + " minutes out of 
> range");
> }
> final int milliseconds = (minutes + (hours * MINUTES_PER_HOUR)) * 
> MILLISECONDS_PER_MINUTE;
> offset = negate ? -milliseconds : milliseconds;
> zoneId = twoDigits(
> twoDigits(new StringBuilder(9).append("GMT").append(negate ? '-' 
> : '+'), hours)
> .append(':'), minutes).toString();
> }
> {code}
> the every GmtTimeZone instance , the zoneIds instance are different , even 
> through the values are the same.
> 2. When invoking DateFormatUtils.format(), there is a ConCurrentHashMap in 
> FormatCache with key is MultipartKey. when invoking 
> FormatCache.getInstance(), first get from cInstanceCache, if value is null, 
> putIfAbsent, but because GmtTimeZone instances are different, when invoking 
> GmtTimeZone.equals, the logic is 
> {code:java}
> @Override
> public boolean equals(final Object other) {
> if (!(other instanceof GmtTimeZone)) {
> return false;
> }
> return zoneId == ((GmtTimeZone) other).zoneId;
> }
> {code}
> every zoneId address are different so, equals function return false, but 
> actually the zoneId values are the same.
> so FastDateFormat will be put into cInstanceCache in FormatCache again and 
> again, which will increase the capability of the map, and cause over stack 
> risk, also, it will cause application  run much slower.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (LANG-1641) Over Stack Issue

2021-02-21 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1641?focusedWorklogId=555417&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-555417
 ]

ASF GitHub Bot logged work on LANG-1641:


Author: ASF GitHub Bot
Created on: 21/Feb/21 15:05
Start Date: 21/Feb/21 15:05
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #703:
URL: https://github.com/apache/commons-lang/pull/703#issuecomment-782872141


   Hi @mdbuck77 
   Thank for your PR. I do not see what this really fixes. If I apply the test 
portion of the patch, that test class still passes.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 555417)
Time Spent: 1h 10m  (was: 1h)

> Over Stack Issue
> 
>
> Key: LANG-1641
> URL: https://issues.apache.org/jira/browse/LANG-1641
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.time.*
>Affects Versions: 3.7
>Reporter: Xia Yun
>Priority: Major
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> {code:java}
> //this is the demo
> package com.wcs233;
> import java.util.Date;
> import java.util.TimeZone;
> import org.apache.commons.lang3.time.DateFormatUtils;
> import org.apache.commons.lang3.time.FastTimeZone;
> public class GmtTimeZoneIssue {
> public static void main(String[] args) {
> final String timeZoneString = "GMT+7:00";
> final String ISO8601_DATE_FORMAT = "-MM-dd'T'HH:mm:ssZZ";
> for (int i = 0; i < 100; i++) {
> Date date = new Date();
> TimeZone timeZone = FastTimeZone.getTimeZone(timeZoneString);
> String dateString = DateFormatUtils.format(date, 
> ISO8601_DATE_FORMAT, timeZone);
> System.out.println(dateString);
> }
> }
> }{code}
> when running the code above , there is over stack risk
> 1. When invoking FastTimeZone.getTimeZone(timeZoneString), a new GmtTimeZone 
> will be created
> {code:java}
> GmtTimeZone(final boolean negate, final int hours, final int minutes) {
> if (hours >= HOURS_PER_DAY) {
> throw new IllegalArgumentException(hours + " hours out of range");
> }
> if (minutes >= MINUTES_PER_HOUR) {
> throw new IllegalArgumentException(minutes + " minutes out of 
> range");
> }
> final int milliseconds = (minutes + (hours * MINUTES_PER_HOUR)) * 
> MILLISECONDS_PER_MINUTE;
> offset = negate ? -milliseconds : milliseconds;
> zoneId = twoDigits(
> twoDigits(new StringBuilder(9).append("GMT").append(negate ? '-' 
> : '+'), hours)
> .append(':'), minutes).toString();
> }
> {code}
> the every GmtTimeZone instance , the zoneIds instance are different , even 
> through the values are the same.
> 2. When invoking DateFormatUtils.format(), there is a ConCurrentHashMap in 
> FormatCache with key is MultipartKey. when invoking 
> FormatCache.getInstance(), first get from cInstanceCache, if value is null, 
> putIfAbsent, but because GmtTimeZone instances are different, when invoking 
> GmtTimeZone.equals, the logic is 
> {code:java}
> @Override
> public boolean equals(final Object other) {
> if (!(other instanceof GmtTimeZone)) {
> return false;
> }
> return zoneId == ((GmtTimeZone) other).zoneId;
> }
> {code}
> every zoneId address are different so, equals function return false, but 
> actually the zoneId values are the same.
> so FastDateFormat will be put into cInstanceCache in FormatCache again and 
> again, which will increase the capability of the map, and cause over stack 
> risk, also, it will cause application  run much slower.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (LANG-1641) Over Stack Issue

2021-02-21 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1641?focusedWorklogId=555411&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-555411
 ]

ASF GitHub Bot logged work on LANG-1641:


Author: ASF GitHub Bot
Created on: 21/Feb/21 14:13
Start Date: 21/Feb/21 14:13
Worklog Time Spent: 10m 
  Work Description: mdbuck77 commented on pull request #703:
URL: https://github.com/apache/commons-lang/pull/703#issuecomment-782864492


   Let me know if I need to do anything else.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 555411)
Time Spent: 1h  (was: 50m)

> Over Stack Issue
> 
>
> Key: LANG-1641
> URL: https://issues.apache.org/jira/browse/LANG-1641
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.time.*
>Affects Versions: 3.7
>Reporter: Xia Yun
>Priority: Major
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> {code:java}
> //this is the demo
> package com.wcs233;
> import java.util.Date;
> import java.util.TimeZone;
> import org.apache.commons.lang3.time.DateFormatUtils;
> import org.apache.commons.lang3.time.FastTimeZone;
> public class GmtTimeZoneIssue {
> public static void main(String[] args) {
> final String timeZoneString = "GMT+7:00";
> final String ISO8601_DATE_FORMAT = "-MM-dd'T'HH:mm:ssZZ";
> for (int i = 0; i < 100; i++) {
> Date date = new Date();
> TimeZone timeZone = FastTimeZone.getTimeZone(timeZoneString);
> String dateString = DateFormatUtils.format(date, 
> ISO8601_DATE_FORMAT, timeZone);
> System.out.println(dateString);
> }
> }
> }{code}
> when running the code above , there is over stack risk
> 1. When invoking FastTimeZone.getTimeZone(timeZoneString), a new GmtTimeZone 
> will be created
> {code:java}
> GmtTimeZone(final boolean negate, final int hours, final int minutes) {
> if (hours >= HOURS_PER_DAY) {
> throw new IllegalArgumentException(hours + " hours out of range");
> }
> if (minutes >= MINUTES_PER_HOUR) {
> throw new IllegalArgumentException(minutes + " minutes out of 
> range");
> }
> final int milliseconds = (minutes + (hours * MINUTES_PER_HOUR)) * 
> MILLISECONDS_PER_MINUTE;
> offset = negate ? -milliseconds : milliseconds;
> zoneId = twoDigits(
> twoDigits(new StringBuilder(9).append("GMT").append(negate ? '-' 
> : '+'), hours)
> .append(':'), minutes).toString();
> }
> {code}
> the every GmtTimeZone instance , the zoneIds instance are different , even 
> through the values are the same.
> 2. When invoking DateFormatUtils.format(), there is a ConCurrentHashMap in 
> FormatCache with key is MultipartKey. when invoking 
> FormatCache.getInstance(), first get from cInstanceCache, if value is null, 
> putIfAbsent, but because GmtTimeZone instances are different, when invoking 
> GmtTimeZone.equals, the logic is 
> {code:java}
> @Override
> public boolean equals(final Object other) {
> if (!(other instanceof GmtTimeZone)) {
> return false;
> }
> return zoneId == ((GmtTimeZone) other).zoneId;
> }
> {code}
> every zoneId address are different so, equals function return false, but 
> actually the zoneId values are the same.
> so FastDateFormat will be put into cInstanceCache in FormatCache again and 
> again, which will increase the capability of the map, and cause over stack 
> risk, also, it will cause application  run much slower.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (LANG-1641) Over Stack Issue

2021-02-06 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1641?focusedWorklogId=549058&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-549058
 ]

ASF GitHub Bot logged work on LANG-1641:


Author: ASF GitHub Bot
Created on: 06/Feb/21 12:33
Start Date: 06/Feb/21 12:33
Worklog Time Spent: 10m 
  Work Description: coveralls edited a comment on pull request #703:
URL: https://github.com/apache/commons-lang/pull/703#issuecomment-770428498


   
   [![Coverage 
Status](https://coveralls.io/builds/36919471/badge)](https://coveralls.io/builds/36919471)
   
   Coverage increased (+0.001%) to 94.983% when pulling 
**9cabf7483af3215a1b80a33aa07af38965e8ea44 on mdbuck77:LANG_1641** into 
**3e27e51770124866c530ed321f21368ea07e7740 on apache:master**.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 549058)
Time Spent: 50m  (was: 40m)

> Over Stack Issue
> 
>
> Key: LANG-1641
> URL: https://issues.apache.org/jira/browse/LANG-1641
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.time.*
>Affects Versions: 3.7
>Reporter: Xia Yun
>Priority: Major
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> {code:java}
> //this is the demo
> package com.wcs233;
> import java.util.Date;
> import java.util.TimeZone;
> import org.apache.commons.lang3.time.DateFormatUtils;
> import org.apache.commons.lang3.time.FastTimeZone;
> public class GmtTimeZoneIssue {
> public static void main(String[] args) {
> final String timeZoneString = "GMT+7:00";
> final String ISO8601_DATE_FORMAT = "-MM-dd'T'HH:mm:ssZZ";
> for (int i = 0; i < 100; i++) {
> Date date = new Date();
> TimeZone timeZone = FastTimeZone.getTimeZone(timeZoneString);
> String dateString = DateFormatUtils.format(date, 
> ISO8601_DATE_FORMAT, timeZone);
> System.out.println(dateString);
> }
> }
> }{code}
> when running the code above , there is over stack risk
> 1. When invoking FastTimeZone.getTimeZone(timeZoneString), a new GmtTimeZone 
> will be created
> {code:java}
> GmtTimeZone(final boolean negate, final int hours, final int minutes) {
> if (hours >= HOURS_PER_DAY) {
> throw new IllegalArgumentException(hours + " hours out of range");
> }
> if (minutes >= MINUTES_PER_HOUR) {
> throw new IllegalArgumentException(minutes + " minutes out of 
> range");
> }
> final int milliseconds = (minutes + (hours * MINUTES_PER_HOUR)) * 
> MILLISECONDS_PER_MINUTE;
> offset = negate ? -milliseconds : milliseconds;
> zoneId = twoDigits(
> twoDigits(new StringBuilder(9).append("GMT").append(negate ? '-' 
> : '+'), hours)
> .append(':'), minutes).toString();
> }
> {code}
> the every GmtTimeZone instance , the zoneIds instance are different , even 
> through the values are the same.
> 2. When invoking DateFormatUtils.format(), there is a ConCurrentHashMap in 
> FormatCache with key is MultipartKey. when invoking 
> FormatCache.getInstance(), first get from cInstanceCache, if value is null, 
> putIfAbsent, but because GmtTimeZone instances are different, when invoking 
> GmtTimeZone.equals, the logic is 
> {code:java}
> @Override
> public boolean equals(final Object other) {
> if (!(other instanceof GmtTimeZone)) {
> return false;
> }
> return zoneId == ((GmtTimeZone) other).zoneId;
> }
> {code}
> every zoneId address are different so, equals function return false, but 
> actually the zoneId values are the same.
> so FastDateFormat will be put into cInstanceCache in FormatCache again and 
> again, which will increase the capability of the map, and cause over stack 
> risk, also, it will cause application  run much slower.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (LANG-1641) Over Stack Issue

2021-02-06 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1641?focusedWorklogId=549051&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-549051
 ]

ASF GitHub Bot logged work on LANG-1641:


Author: ASF GitHub Bot
Created on: 06/Feb/21 12:24
Start Date: 06/Feb/21 12:24
Worklog Time Spent: 10m 
  Work Description: mdbuck77 commented on a change in pull request #703:
URL: https://github.com/apache/commons-lang/pull/703#discussion_r571429319



##
File path: src/main/java/org/apache/commons/lang3/time/GmtTimeZone.java
##
@@ -33,8 +35,7 @@
 // Serializable!
 static final long serialVersionUID = 1L;
 
-private final int offset;
-private final String zoneId;
+private final SimpleTimeZone m_delegate;
 

Review comment:
   done

##
File path: src/main/java/org/apache/commons/lang3/time/GmtTimeZone.java
##
@@ -67,39 +69,43 @@ public void setRawOffset(final int offsetMillis) {
 
 @Override
 public int getRawOffset() {
-return offset;
+return m_delegate.getRawOffset();
 }
 
 @Override
 public String getID() {
-return zoneId;
+return m_delegate.getID();
 }
 
 @Override
 public boolean useDaylightTime() {
-return false;
+return m_delegate.useDaylightTime();
 }
 
 @Override
 public boolean inDaylightTime(final Date date) {
-return false;
+return m_delegate.inDaylightTime(date);
 }
 
 @Override
 public String toString() {
-return "[GmtTimeZone id=\"" + zoneId + "\",offset=" + offset + ']';
+return "[GmtTimeZone id=\"" + getID() + "\",offset=" + getRawOffset() 
+ ']';
 }
 
 @Override
-public int hashCode() {
-return offset;
+public boolean equals(Object o) {
+if (this == o) {
+return true;
+}
+if (o == null || getClass() != o.getClass()) {

Review comment:
   I made the class final.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 549051)
Time Spent: 40m  (was: 0.5h)

> Over Stack Issue
> 
>
> Key: LANG-1641
> URL: https://issues.apache.org/jira/browse/LANG-1641
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.time.*
>Affects Versions: 3.7
>Reporter: Xia Yun
>Priority: Major
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {code:java}
> //this is the demo
> package com.wcs233;
> import java.util.Date;
> import java.util.TimeZone;
> import org.apache.commons.lang3.time.DateFormatUtils;
> import org.apache.commons.lang3.time.FastTimeZone;
> public class GmtTimeZoneIssue {
> public static void main(String[] args) {
> final String timeZoneString = "GMT+7:00";
> final String ISO8601_DATE_FORMAT = "-MM-dd'T'HH:mm:ssZZ";
> for (int i = 0; i < 100; i++) {
> Date date = new Date();
> TimeZone timeZone = FastTimeZone.getTimeZone(timeZoneString);
> String dateString = DateFormatUtils.format(date, 
> ISO8601_DATE_FORMAT, timeZone);
> System.out.println(dateString);
> }
> }
> }{code}
> when running the code above , there is over stack risk
> 1. When invoking FastTimeZone.getTimeZone(timeZoneString), a new GmtTimeZone 
> will be created
> {code:java}
> GmtTimeZone(final boolean negate, final int hours, final int minutes) {
> if (hours >= HOURS_PER_DAY) {
> throw new IllegalArgumentException(hours + " hours out of range");
> }
> if (minutes >= MINUTES_PER_HOUR) {
> throw new IllegalArgumentException(minutes + " minutes out of 
> range");
> }
> final int milliseconds = (minutes + (hours * MINUTES_PER_HOUR)) * 
> MILLISECONDS_PER_MINUTE;
> offset = negate ? -milliseconds : milliseconds;
> zoneId = twoDigits(
> twoDigits(new StringBuilder(9).append("GMT").append(negate ? '-' 
> : '+'), hours)
> .append(':'), minutes).toString();
> }
> {code}
> the every GmtTimeZone instance , the zoneIds instance are different , even 
> through the values are the same.
> 2. When invoking DateFormatUtils.format(), there is a ConCurrentHashMap in 
> FormatCache with key is MultipartKey. when invoking 
> FormatCache.getInstance(), first get from cInstanceCache, if value is null, 
> putIfAbsent, but because GmtTimeZone instances are different, when invoking 
> GmtTimeZone.equals, the logic is 
> {code:java}
> @Override
> public boolea

[jira] [Work logged] (LANG-1641) Over Stack Issue

2021-02-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1641?focusedWorklogId=545330&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-545330
 ]

ASF GitHub Bot logged work on LANG-1641:


Author: ASF GitHub Bot
Created on: 01/Feb/21 13:28
Start Date: 01/Feb/21 13:28
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on a change in pull request #703:
URL: https://github.com/apache/commons-lang/pull/703#discussion_r567823371



##
File path: src/main/java/org/apache/commons/lang3/time/GmtTimeZone.java
##
@@ -67,39 +69,43 @@ public void setRawOffset(final int offsetMillis) {
 
 @Override
 public int getRawOffset() {
-return offset;
+return m_delegate.getRawOffset();
 }
 
 @Override
 public String getID() {
-return zoneId;
+return m_delegate.getID();
 }
 
 @Override
 public boolean useDaylightTime() {
-return false;
+return m_delegate.useDaylightTime();
 }
 
 @Override
 public boolean inDaylightTime(final Date date) {
-return false;
+return m_delegate.inDaylightTime(date);
 }
 
 @Override
 public String toString() {
-return "[GmtTimeZone id=\"" + zoneId + "\",offset=" + offset + ']';
+return "[GmtTimeZone id=\"" + getID() + "\",offset=" + getRawOffset() 
+ ']';
 }
 
 @Override
-public int hashCode() {
-return offset;
+public boolean equals(Object o) {
+if (this == o) {
+return true;
+}
+if (o == null || getClass() != o.getClass()) {

Review comment:
   Either this class should be final or this check should allow subclasses.
   WDYT?

##
File path: src/main/java/org/apache/commons/lang3/time/GmtTimeZone.java
##
@@ -33,8 +35,7 @@
 // Serializable!
 static final long serialVersionUID = 1L;
 
-private final int offset;
-private final String zoneId;
+private final SimpleTimeZone m_delegate;
 

Review comment:
   No weird prefix on names please.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 545330)
Time Spent: 0.5h  (was: 20m)

> Over Stack Issue
> 
>
> Key: LANG-1641
> URL: https://issues.apache.org/jira/browse/LANG-1641
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.time.*
>Affects Versions: 3.7
>Reporter: Xia Yun
>Priority: Major
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> {code:java}
> //this is the demo
> package com.wcs233;
> import java.util.Date;
> import java.util.TimeZone;
> import org.apache.commons.lang3.time.DateFormatUtils;
> import org.apache.commons.lang3.time.FastTimeZone;
> public class GmtTimeZoneIssue {
> public static void main(String[] args) {
> final String timeZoneString = "GMT+7:00";
> final String ISO8601_DATE_FORMAT = "-MM-dd'T'HH:mm:ssZZ";
> for (int i = 0; i < 100; i++) {
> Date date = new Date();
> TimeZone timeZone = FastTimeZone.getTimeZone(timeZoneString);
> String dateString = DateFormatUtils.format(date, 
> ISO8601_DATE_FORMAT, timeZone);
> System.out.println(dateString);
> }
> }
> }{code}
> when running the code above , there is over stack risk
> 1. When invoking FastTimeZone.getTimeZone(timeZoneString), a new GmtTimeZone 
> will be created
> {code:java}
> GmtTimeZone(final boolean negate, final int hours, final int minutes) {
> if (hours >= HOURS_PER_DAY) {
> throw new IllegalArgumentException(hours + " hours out of range");
> }
> if (minutes >= MINUTES_PER_HOUR) {
> throw new IllegalArgumentException(minutes + " minutes out of 
> range");
> }
> final int milliseconds = (minutes + (hours * MINUTES_PER_HOUR)) * 
> MILLISECONDS_PER_MINUTE;
> offset = negate ? -milliseconds : milliseconds;
> zoneId = twoDigits(
> twoDigits(new StringBuilder(9).append("GMT").append(negate ? '-' 
> : '+'), hours)
> .append(':'), minutes).toString();
> }
> {code}
> the every GmtTimeZone instance , the zoneIds instance are different , even 
> through the values are the same.
> 2. When invoking DateFormatUtils.format(), there is a ConCurrentHashMap in 
> FormatCache with key is MultipartKey. when invoking 
> FormatCache.getInstance(), first get from cInstanceCache, if value is null, 
> putIfAbsent, but because GmtTimeZone instances are different, when 

[jira] [Work logged] (LANG-1641) Over Stack Issue

2021-01-31 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1641?focusedWorklogId=544935&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-544935
 ]

ASF GitHub Bot logged work on LANG-1641:


Author: ASF GitHub Bot
Created on: 31/Jan/21 18:37
Start Date: 31/Jan/21 18:37
Worklog Time Spent: 10m 
  Work Description: coveralls commented on pull request #703:
URL: https://github.com/apache/commons-lang/pull/703#issuecomment-770428498


   
   [![Coverage 
Status](https://coveralls.io/builds/36729615/badge)](https://coveralls.io/builds/36729615)
   
   Coverage increased (+0.001%) to 94.983% when pulling 
**1e770771b93b7084f0471f811da9993391c20df5 on mdbuck77:LANG_1641** into 
**3e27e51770124866c530ed321f21368ea07e7740 on apache:master**.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 544935)
Time Spent: 20m  (was: 10m)

> Over Stack Issue
> 
>
> Key: LANG-1641
> URL: https://issues.apache.org/jira/browse/LANG-1641
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.time.*
>Affects Versions: 3.7
>Reporter: Xia Yun
>Priority: Major
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> {code:java}
> //this is the demo
> package com.wcs233;
> import java.util.Date;
> import java.util.TimeZone;
> import org.apache.commons.lang3.time.DateFormatUtils;
> import org.apache.commons.lang3.time.FastTimeZone;
> public class GmtTimeZoneIssue {
> public static void main(String[] args) {
> final String timeZoneString = "GMT+7:00";
> final String ISO8601_DATE_FORMAT = "-MM-dd'T'HH:mm:ssZZ";
> for (int i = 0; i < 100; i++) {
> Date date = new Date();
> TimeZone timeZone = FastTimeZone.getTimeZone(timeZoneString);
> String dateString = DateFormatUtils.format(date, 
> ISO8601_DATE_FORMAT, timeZone);
> System.out.println(dateString);
> }
> }
> }{code}
> when running the code above , there is over stack risk
> 1. When invoking FastTimeZone.getTimeZone(timeZoneString), a new GmtTimeZone 
> will be created
> {code:java}
> GmtTimeZone(final boolean negate, final int hours, final int minutes) {
> if (hours >= HOURS_PER_DAY) {
> throw new IllegalArgumentException(hours + " hours out of range");
> }
> if (minutes >= MINUTES_PER_HOUR) {
> throw new IllegalArgumentException(minutes + " minutes out of 
> range");
> }
> final int milliseconds = (minutes + (hours * MINUTES_PER_HOUR)) * 
> MILLISECONDS_PER_MINUTE;
> offset = negate ? -milliseconds : milliseconds;
> zoneId = twoDigits(
> twoDigits(new StringBuilder(9).append("GMT").append(negate ? '-' 
> : '+'), hours)
> .append(':'), minutes).toString();
> }
> {code}
> the every GmtTimeZone instance , the zoneIds instance are different , even 
> through the values are the same.
> 2. When invoking DateFormatUtils.format(), there is a ConCurrentHashMap in 
> FormatCache with key is MultipartKey. when invoking 
> FormatCache.getInstance(), first get from cInstanceCache, if value is null, 
> putIfAbsent, but because GmtTimeZone instances are different, when invoking 
> GmtTimeZone.equals, the logic is 
> {code:java}
> @Override
> public boolean equals(final Object other) {
> if (!(other instanceof GmtTimeZone)) {
> return false;
> }
> return zoneId == ((GmtTimeZone) other).zoneId;
> }
> {code}
> every zoneId address are different so, equals function return false, but 
> actually the zoneId values are the same.
> so FastDateFormat will be put into cInstanceCache in FormatCache again and 
> again, which will increase the capability of the map, and cause over stack 
> risk, also, it will cause application  run much slower.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (LANG-1641) Over Stack Issue

2021-01-31 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1641?focusedWorklogId=544929&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-544929
 ]

ASF GitHub Bot logged work on LANG-1641:


Author: ASF GitHub Bot
Created on: 31/Jan/21 18:20
Start Date: 31/Jan/21 18:20
Worklog Time Spent: 10m 
  Work Description: mdbuck77 opened a new pull request #703:
URL: https://github.com/apache/commons-lang/pull/703


   LANG-1641: GmtTimeZone now implements #equals(Object) using it's time zone 
ID. Added tests to verify caching of GmtTimeZone instances.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 544929)
Remaining Estimate: 0h
Time Spent: 10m

> Over Stack Issue
> 
>
> Key: LANG-1641
> URL: https://issues.apache.org/jira/browse/LANG-1641
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.time.*
>Affects Versions: 3.7
>Reporter: Xia Yun
>Priority: Major
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> {code:java}
> //this is the demo
> package com.wcs233;
> import java.util.Date;
> import java.util.TimeZone;
> import org.apache.commons.lang3.time.DateFormatUtils;
> import org.apache.commons.lang3.time.FastTimeZone;
> public class GmtTimeZoneIssue {
> public static void main(String[] args) {
> final String timeZoneString = "GMT+7:00";
> final String ISO8601_DATE_FORMAT = "-MM-dd'T'HH:mm:ssZZ";
> for (int i = 0; i < 100; i++) {
> Date date = new Date();
> TimeZone timeZone = FastTimeZone.getTimeZone(timeZoneString);
> String dateString = DateFormatUtils.format(date, 
> ISO8601_DATE_FORMAT, timeZone);
> System.out.println(dateString);
> }
> }
> }{code}
> when running the code above , there is over stack risk
> 1. When invoking FastTimeZone.getTimeZone(timeZoneString), a new GmtTimeZone 
> will be created
> {code:java}
> GmtTimeZone(final boolean negate, final int hours, final int minutes) {
> if (hours >= HOURS_PER_DAY) {
> throw new IllegalArgumentException(hours + " hours out of range");
> }
> if (minutes >= MINUTES_PER_HOUR) {
> throw new IllegalArgumentException(minutes + " minutes out of 
> range");
> }
> final int milliseconds = (minutes + (hours * MINUTES_PER_HOUR)) * 
> MILLISECONDS_PER_MINUTE;
> offset = negate ? -milliseconds : milliseconds;
> zoneId = twoDigits(
> twoDigits(new StringBuilder(9).append("GMT").append(negate ? '-' 
> : '+'), hours)
> .append(':'), minutes).toString();
> }
> {code}
> the every GmtTimeZone instance , the zoneIds instance are different , even 
> through the values are the same.
> 2. When invoking DateFormatUtils.format(), there is a ConCurrentHashMap in 
> FormatCache with key is MultipartKey. when invoking 
> FormatCache.getInstance(), first get from cInstanceCache, if value is null, 
> putIfAbsent, but because GmtTimeZone instances are different, when invoking 
> GmtTimeZone.equals, the logic is 
> {code:java}
> @Override
> public boolean equals(final Object other) {
> if (!(other instanceof GmtTimeZone)) {
> return false;
> }
> return zoneId == ((GmtTimeZone) other).zoneId;
> }
> {code}
> every zoneId address are different so, equals function return false, but 
> actually the zoneId values are the same.
> so FastDateFormat will be put into cInstanceCache in FormatCache again and 
> again, which will increase the capability of the map, and cause over stack 
> risk, also, it will cause application  run much slower.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)