[jira] [Commented] (NET-710) Timestamp parsing fails around the change to daylight savings

2024-05-06 Thread Sebb (Jira)


[ 
https://issues.apache.org/jira/browse/NET-710?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17844070#comment-17844070
 ] 

Sebb commented on NET-710:
--

Cannot reproduce the error on 3.10.0 or 3.9.0 using Java8 and Ubuntu.
See the GHA log here
https://github.com/apache/commons-net/actions/runs/8977664771

We will need more details on OS and Java versions

> Timestamp parsing fails around the change to daylight savings
> -
>
> Key: NET-710
> URL: https://issues.apache.org/jira/browse/NET-710
> Project: Commons Net
>  Issue Type: Bug
>  Components: FTP
>Affects Versions: 3.3, 3.8.0
>Reporter: Mike Baranczak
>Priority: Major
>
> {{String ts = "Mar 13 02:33";}}
> {{Calendar serverTime = Calendar.getInstance(TimeZone.getTimeZone("EDT"), 
> Locale.US);}}
> {{serverTime.set(2022, 2, 16, 14, 0);}}
> {{Calendar c = new FTPTimestampParserImpl().parseTimestamp(ts, serverTime);}}
>  
> {{Result:}}
>  
> {{java.text.ParseException: Timestamp 'Mar 13 02:33' could not be parsed 
> using a server time of Wed Mar 16 10:00:54 EDT 2022}}
> {{    at 
> org.apache.commons.net.ftp.parser.FTPTimestampParserImpl.parseTimestamp 
> (FTPTimestampParserImpl.java:246)}}
>  
> I can't tell what's going on, but this seems to have something to do with the 
> transition to Daylight Savings Time, which happened on Sunday, March 13. I 
> ran into this bug when trying to get a list of recent files from an FTP 
> server.  (UnixFTPEntryParser ignores the exception silently, which isn't a 
> great idea, either.)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: [PR] Validator CASNumberCheckDigit for Chemical Registry CAS Numbers and ECNumberCheckDigit [commons-validator]

2024-05-06 Thread via GitHub


homebeaver commented on code in PR #217:
URL: https://github.com/apache/commons-validator/pull/217#discussion_r1591470221


##
src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java:
##
@@ -154,7 +154,11 @@ public void testCalculateInvalid() {
 log.debug("   " + i + " Testing Invalid Check Digit, 
Code=[" + code + "]");
 }
 final String expected = checkDigit(code);
-final String actual = 
routine.calculate(removeCheckDigit(code));
+String codeWithNoCheckDigit = removeCheckDigit(code);
+if (codeWithNoCheckDigit == null) {
+throw new CheckDigitException("Invalid Code=[" + code + 
"]");

Review Comment:
   the default invalid test in `class AbstractCheckDigitTest` is
   ```
   protected String[] invalid = { "12345678A" };
   ```
   
   method `removeCheckDigit` returns null if `REGEX_VALIDATOR.validate(code)` 
== null. This is the case for "12345678A" because this code is invalid due to 
its regex.
   
   When using `fail()` as you suggests the test `testCalculateInvalid()` would 
fail 
   but it should `assertTrue(e.getMessage().startsWith("Invalid ") ...` because 
"12345678A"  IS INVALID!
   
   So we `throw new CheckDigitException("Invalid Code=[" + code + "]");` and 
catch it in
   ```
   } catch (final CheckDigitException e) {
   // possible failure messages:
   // Invalid ISBN Length ...
   // Invalid Character[ ...
   // Are there any others?
   assertTrue(e.getMessage().startsWith("Invalid "), "Invalid 
Character[" + i + "]=" + e.getMessage());
   ```
   
   NB: `testCalculateInvalid()` is not my idea. I needed a while to understand 
how it works :-)
   
   Regards



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

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



Re: [PR] Validator CASNumberCheckDigit for Chemical Registry CAS Numbers and ECNumberCheckDigit [commons-validator]

2024-05-06 Thread via GitHub


homebeaver commented on PR #217:
URL: 
https://github.com/apache/commons-validator/pull/217#issuecomment-2096673914

   > OK, then please add a test for that, something like `testMinimum()`, and 
the whatever the max value is (if there is one, if not something that looks 
very large).
   
   Boundary tests are included in commit 
deb39a25ac8684334447ebfad4829191ca27c192 [MIN MAX tests]
   
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

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



Re: [PR] COLLECTIONS-842: deprecate Lists incompatible with Java 21, add new variant of AbstractLinkedList [commons-collections]

2024-05-06 Thread via GitHub


reschke commented on PR #485:
URL: 
https://github.com/apache/commons-collections/pull/485#issuecomment-2096510411

   @aherbert - thanks for helping out!


-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

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



Re: [PR] Update AnnotationUtils.java [commons-lang]

2024-05-06 Thread via GitHub


Wuclan closed pull request #1211: Update AnnotationUtils.java
URL: https://github.com/apache/commons-lang/pull/1211


-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

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



[PR] Update AnnotationUtils.java [commons-lang]

2024-05-06 Thread via GitHub


Wuclan opened a new pull request, #1211:
URL: https://github.com/apache/commons-lang/pull/1211

   @pixeebot


-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

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



Re: [PR] Validator CASNumberCheckDigit for Chemical Registry CAS Numbers and ECNumberCheckDigit [commons-validator]

2024-05-06 Thread via GitHub


garydgregory commented on code in PR #217:
URL: https://github.com/apache/commons-validator/pull/217#discussion_r1591128203


##
src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java:
##
@@ -154,7 +154,11 @@ public void testCalculateInvalid() {
 log.debug("   " + i + " Testing Invalid Check Digit, 
Code=[" + code + "]");
 }
 final String expected = checkDigit(code);
-final String actual = 
routine.calculate(removeCheckDigit(code));
+String codeWithNoCheckDigit = removeCheckDigit(code);
+if (codeWithNoCheckDigit == null) {
+throw new CheckDigitException("Invalid Code=[" + code + 
"]");

Review Comment:
   Why not just call `fail()` here?
   



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

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



Re: [PR] Validator CASNumberCheckDigit for Chemical Registry CAS Numbers and ECNumberCheckDigit [commons-validator]

2024-05-06 Thread via GitHub


garydgregory commented on PR #217:
URL: 
https://github.com/apache/commons-validator/pull/217#issuecomment-2096227738

   > The theoretical MIN valid EC-Number is 000-001-6;
   
   OK, then please add a test for that, something like `testMinimum()`, and the 
whatever the max value is (if there is one, if not something that looks very 
large). 
   
   My concern is that if the RE says "this segment can be 1, 2, or 3 digits", 
then there should be assertions for that.
   
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

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



Re: [PR] Validator CASNumberCheckDigit for Chemical Registry CAS Numbers and ECNumberCheckDigit [commons-validator]

2024-05-06 Thread via GitHub


homebeaver commented on PR #217:
URL: 
https://github.com/apache/commons-validator/pull/217#issuecomment-2096067917

   > ...I don't see tests that make sure _invalid_ input is in fact invalid. 
For example, when the check digit is incorrect.
   
   @garydgregory 
   
   Test `AbstractCheckDigitTest.testIsValidFalse` implemets it and it runs :-)
   
   The theoretical MIN valid EC-Number is 000-001-6; `testIsValidFalse` 
generates all invalid check digits!  See log:
   
   ```
  0 Testing Invalid Check Digit, Code=[010]
  1 Testing Invalid Check Digit, Code=[011]
  2 Testing Invalid Check Digit, Code=[012]
  3 Testing Invalid Check Digit, Code=[013]
  4 Testing Invalid Check Digit, Code=[014]
  5 Testing Invalid Check Digit, Code=[015]
  6 Testing Invalid Check Digit, Code=[017]
  7 Testing Invalid Check Digit, Code=[018]
  8 Testing Invalid Check Digit, Code=[019]
  9 Testing Invalid Check Digit, Code=[01 ]
  10 Testing Invalid Check Digit, Code=[01A]
  11 Testing Invalid Check Digit, Code=[01B]
  12 Testing Invalid Check Digit, Code=[01C]
  13 Testing Invalid Check Digit, Code=[01D]
  14 Testing Invalid Check Digit, Code=[01E]
  15 Testing Invalid Check Digit, Code=[01F]
  16 Testing Invalid Check Digit, Code=[01H]
  17 Testing Invalid Check Digit, Code=[01I]
  18 Testing Invalid Check Digit, Code=[01J]
  19 Testing Invalid Check Digit, Code=[01K]
  20 Testing Invalid Check Digit, Code=[01L]
  21 Testing Invalid Check Digit, Code=[01M]
  22 Testing Invalid Check Digit, Code=[01N]
  23 Testing Invalid Check Digit, Code=[01O]
  24 Testing Invalid Check Digit, Code=[01P]
  25 Testing Invalid Check Digit, Code=[01Q]
  26 Testing Invalid Check Digit, Code=[01R]
  27 Testing Invalid Check Digit, Code=[01S]
  28 Testing Invalid Check Digit, Code=[01T]
  29 Testing Invalid Check Digit, Code=[01U]
  30 Testing Invalid Check Digit, Code=[01V]
  31 Testing Invalid Check Digit, Code=[01W]
  32 Testing Invalid Check Digit, Code=[01X]
  33 Testing Invalid Check Digit, Code=[01Y]
  34 Testing Invalid Check Digit, Code=[01Z]
  35 Testing Invalid Check Digit, Code=[01  ]
   ...
   ```
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

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



Re: [PR] COLLECTIONS-853: Change LayerManager to use List and added generics to LayerdedBloomFilter [commons-collections]

2024-05-06 Thread via GitHub


Claudenw commented on code in PR #481:
URL: 
https://github.com/apache/commons-collections/pull/481#discussion_r1590990785


##
src/main/java/org/apache/commons/collections4/bloomfilter/LayeredBloomFilter.java:
##
@@ -89,19 +90,35 @@ public boolean test(BloomFilter x) {
 return true;
 }
 }
+
+/**
+ * Creates a fixed size layered bloom filter that adds new filters to the 
list,
+ * but never merges them. List will never exceed maxDepth. As additional 
filters
+ * are added earlier filters are removed.  Uses SimpleBloomFilters.
+ *
+ * @param shapeThe shape for the enclosed Bloom filters.
+ * @param maxDepth The maximum depth of layers.
+ * @return An empty layered Bloom filter of the specified shape and depth.
+ */
+public static  LayeredBloomFilter fixed(final Shape shape, 
int maxDepth) {

Review Comment:
   Let's just remove it all together.



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

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



Re: [PR] COLLECTIONS-842: deprecate Lists incompatible with Java 21, add new variant of AbstractLinkedList [commons-collections]

2024-05-06 Thread via GitHub


aherbert commented on PR #485:
URL: 
https://github.com/apache/commons-collections/pull/485#issuecomment-2095927165

   Given that a lot of dynamically generated Junit4 tests were lost in the 
conversion to JUnit5, we may have to write some more tests just to get this 
into a working build. My initial investigation into fixing the lost tests 
discovered only that it is a larger task which is out-of-scope here.
   
   Try pasting this into the current test. These are copied from 
`CursorableLinkedListTest`:
   ```java
   @Test
   @SuppressWarnings("unchecked")
   public void testSubList() {
   List list = makeObject();
   list.add((E) "A");
   list.add((E) "B");
   list.add((E) "C");
   list.add((E) "D");
   list.add((E) "E");
   
   assertEquals("[A, B, C, D, E]", list.toString());
   assertEquals("[A, B, C, D, E]", list.subList(0, 5).toString());
   assertEquals("[B, C, D, E]", list.subList(1, 5).toString());
   assertEquals("[C, D, E]", list.subList(2, 5).toString());
   assertEquals("[D, E]", list.subList(3, 5).toString());
   assertEquals("[E]", list.subList(4, 5).toString());
   assertEquals("[]", list.subList(5, 5).toString());
   }
   
   @Test
   @SuppressWarnings("unchecked")
   public void testSubListAddBegin() {
   List list = makeObject();
   list.add((E) "A");
   list.add((E) "B");
   list.add((E) "C");
   list.add((E) "D");
   list.add((E) "E");
   
   final List sublist = list.subList(0, 0);
   sublist.add((E) "a");
   assertEquals("[a, A, B, C, D, E]", list.toString());
   assertEquals("[a]", sublist.toString());
   sublist.add((E) "b");
   assertEquals("[a, b, A, B, C, D, E]", list.toString());
   assertEquals("[a, b]", sublist.toString());
   }
   
   @Test
   @SuppressWarnings("unchecked")
   public void testSubListAddEnd() {
   List list = makeObject();
   list.add((E) "A");
   list.add((E) "B");
   list.add((E) "C");
   list.add((E) "D");
   list.add((E) "E");
   
   final List sublist = list.subList(5, 5);
   sublist.add((E) "F");
   assertEquals("[A, B, C, D, E, F]", list.toString());
   assertEquals("[F]", sublist.toString());
   sublist.add((E) "G");
   assertEquals("[A, B, C, D, E, F, G]", list.toString());
   assertEquals("[F, G]", sublist.toString());
   }
   
   @Test
   @SuppressWarnings("unchecked")
   public void testSubListAddMiddle() {
   List list = makeObject();
   list.add((E) "A");
   list.add((E) "B");
   list.add((E) "C");
   list.add((E) "D");
   list.add((E) "E");
   
   final List sublist = list.subList(1, 3);
   sublist.add((E) "a");
   assertEquals("[A, B, C, a, D, E]", list.toString());
   assertEquals("[B, C, a]", sublist.toString());
   sublist.add((E) "b");
   assertEquals("[A, B, C, a, b, D, E]", list.toString());
   assertEquals("[B, C, a, b]", sublist.toString());
   }
   
   @Test
   @SuppressWarnings("unchecked")
   public void testSubListRemove() {
   List list = makeObject();
   list.add((E) "A");
   list.add((E) "B");
   list.add((E) "C");
   list.add((E) "D");
   list.add((E) "E");
   
   final List sublist = list.subList(1, 4);
   assertEquals("[B, C, D]", sublist.toString());
   assertEquals("[A, B, C, D, E]", list.toString());
   sublist.remove("C");
   assertEquals("[B, D]", sublist.toString());
   assertEquals("[A, B, D, E]", list.toString());
   sublist.remove(1);
   assertEquals("[B]", sublist.toString());
   assertEquals("[A, B, E]", list.toString());
   sublist.clear();
   assertEquals("[]", sublist.toString());
   assertEquals("[A, E]", list.toString());
   }
   ```
   
   When I added this locally the coverage is above 85% which may be enough to 
get green lights on the build.


-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

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



Re: [PR] Validator CASNumberCheckDigit for Chemical Registry CAS Numbers and ECNumberCheckDigit [commons-validator]

2024-05-06 Thread via GitHub


garydgregory commented on code in PR #217:
URL: https://github.com/apache/commons-validator/pull/217#discussion_r1590936802


##
src/main/java/org/apache/commons/validator/routines/checkdigit/ModulusCheckDigit.java:
##
@@ -185,6 +185,16 @@ protected int toInt(final char character, final int 
leftPos, final int rightPos)
 throw new CheckDigitException("Invalid Character[" + leftPos + "] = '" 
+ character + "'");
 }
 
+/**
+ * A convenient method to check empty Strings.
+ *
+ * @param code The code to check
+ * @return {@code true} if code is null or empty, otherwise {@code false}
+ */
+protected boolean isEmpty(final String code) {
+return code == null || code.isEmpty();

Review Comment:
   Oops, I realized yesterday we already have this: 
`org.apache.commons.validator.GenericValidator.isBlankOrNull(String)` so 
replace call sites to this with calls to `isBlankOrNull()`. Sorry about that!



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

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



[PR] Validator CASNumberCheckDigit for Chemical Registry CAS Numbers and ECNumberCheckDigit [commons-validator]

2024-05-06 Thread via GitHub


homebeaver opened a new pull request, #217:
URL: https://github.com/apache/commons-validator/pull/217

   Hi @garydgregory 
   I incidently closed PR #216 - so I open a new one.  Your hints from 
yesterday are done with last two commits. 
   
   Same description:
   
   CASNumberCheckDigit - CAS Chemical Abstracts Service RN Registry No
   
   CAS Numbers are unique identification numbers used to identify chemical
   substance described in the open scientific literature.
   
   see [wikipedia 
CAS_Registry_Number](https://en.wikipedia.org/wiki/CAS_Registry_Number)
   
   Also add Validator for EC number - ECN is a unique seven-digit identifier 
that is assigned to chemical substances
   
   regards


-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

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



Re: [PR] Validator CASNumberCheckDigit for Chemical Registry CAS Numbers and ECNumberCheckDigit [commons-validator]

2024-05-06 Thread via GitHub


homebeaver closed pull request #216: Validator CASNumberCheckDigit for Chemical 
Registry CAS Numbers and ECNumberCheckDigit
URL: https://github.com/apache/commons-validator/pull/216


-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

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



Re: [PR] COLLECTIONS-842: deprecate Lists incompatible with Java 21, add new variant of AbstractLinkedList [commons-collections]

2024-05-06 Thread via GitHub


reschke commented on PR #485:
URL: 
https://github.com/apache/commons-collections/pull/485#issuecomment-2095601759

   Ths helped, but still fails with:
   ~~~
   [WARNING] Rule violated for bundle commons-collections4: instructions 
covered ratio is 0.84, but expected minimum is 0.85
   ~~~


-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

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