[jira] [Updated] (COLLECTIONS-804) testCollectionToArray2() is non deterministic
[ https://issues.apache.org/jira/browse/COLLECTIONS-804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Vivek Gupta updated COLLECTIONS-804: Priority: Major (was: Minor) > testCollectionToArray2() is non deterministic > - > > Key: COLLECTIONS-804 > URL: https://issues.apache.org/jira/browse/COLLECTIONS-804 > Project: Commons Collections > Issue Type: Bug > Components: Collection >Affects Versions: 4.4 >Reporter: Vivek Gupta >Priority: Major > > The test > {{org.apache.commons.collections4.collection.AbstractCollectionTest.testCollectionToArray2()}} > can fail if two {{toArray()}} calls return elements in a different order. > One can check for that using the NonDex tool > ([https://github.com/TestingResearchIllinois/NonDex]). > Bug repoduction: > # Clone the repo and cd into it. > # {{mvn test > -Dtest=org.apache.commons.collections4.bidimap.DualHashBidiMapTest#testCollectionToArray2 > -Drat.skip}} This test will pass. > # {{mvn edu.illinois:nondex-maven-plugin:1.1.2:nondex > -Dtest=org.apache.commons.collections4.bidimap.DualHashBidiMapTest#testCollectionToArray2 > -Drat.skip}} This command runs the NonDex tool on the the test. Near the end > of the output, you will see a summary of test failures, where you will find > {{testCollectionToArray2()}} function listed. > The source of the bug: > The test gets an array representation of the collections and then compares > them, taking the order into account. However, Java Collections need not be > necessarily ordered. Its member function {{toArray()}} also does not > guarantee a deterministic order of the elements in its returned list. As > such, we should ignore the order of the elements in the assertion. > Proposed fix: > We ignore the order of array lists by putting its elements into separate > multisets and then comparing those multisets for equality. Multiset is not a > part of the standard Java library. However, conveniently enough, this > repository already had an implementation of multiset called HashBags, which I > used. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (NET-707) FTPClient::listFiles() doesn't include files with spaces for AS400
[ https://issues.apache.org/jira/browse/NET-707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17496372#comment-17496372 ] Sebb commented on NET-707: -- Thanks! So what does FTP show for these files? > FTPClient::listFiles() doesn't include files with spaces for AS400 > -- > > Key: NET-707 > URL: https://issues.apache.org/jira/browse/NET-707 > Project: Commons Net > Issue Type: Bug > Environment: AS400 ftp server >Reporter: Dmytro Sylaiev >Priority: Major > > For the FTP server on AS400 I got the different response size for > FTPClient::listFiles() and FTPClient::listNames() (first one doesn't include > file with spaces) > > TheOS400FTPEntryParser pattern is > {noformat} > private static final String REGEX = > "(\\S+)\\s+" // user > + "(?:(\\d+)\\s+)?" // size, empty for members > + "(?:(\\S+)\\s+(\\S+)\\s+)?" // date stuff, empty for members > + "(\\*STMF|\\*DIR|\\*FILE|\\*MEM)\\s+" // *STMF/*DIR/*FILE/*MEM > + "(?:(\\S+)\\s*)?"; // file name, missing, when CWD is a > *FILE{noformat} > and the server response for LIST command > {noformat} > MYUSER 3 06/12/21 18:31:29 *STMF file with space.txt {noformat} > doesn't match that regex. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[GitHub] [commons-codec] garydgregory merged pull request #78: Validate byte and string
garydgregory merged pull request #78: URL: https://github.com/apache/commons-codec/pull/78 -- 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
[GitHub] [commons-codec] arturobernalg commented on pull request #78: Validate byte and string
arturobernalg commented on pull request #78: URL: https://github.com/apache/commons-codec/pull/78#issuecomment-1048110711 > Hi @arturobernalg > Would you please resolve the one conflict? done -- 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
[GitHub] [commons-codec] garydgregory commented on pull request #78: Validate byte and string
garydgregory commented on pull request #78: URL: https://github.com/apache/commons-codec/pull/78#issuecomment-1048108862 Hi @arturobernalg Would you please resolve the one conflict? -- 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
[GitHub] [commons-codec] garydgregory merged pull request #113: CODEC-285-JUnit5
garydgregory merged pull request #113: URL: https://github.com/apache/commons-codec/pull/113 -- 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
[GitHub] [commons-codec] itamarc edited a comment on pull request #113: CODEC-285-JUnit5
itamarc edited a comment on pull request #113: URL: https://github.com/apache/commons-codec/pull/113#issuecomment-1048099824 I made the rebase with the origin/master and looks like I solved all conflicts and I just squashed the commits into 1. I also removed the extra curly braces like pointed by @garydgregory If there are something else I need to do, please point 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
[GitHub] [commons-codec] itamarc commented on pull request #113: CODEC-285-JUnit5
itamarc commented on pull request #113: URL: https://github.com/apache/commons-codec/pull/113#issuecomment-1048099824 I made the rebase with the origin/master and looks like I solved all conflicts and I just squashed the commits into 1. I also removed the extra curly braces like pointed by @garydgregory -- 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
[GitHub] [commons-codec] arturobernalg commented on a change in pull request #78: Validate byte and string
arturobernalg commented on a change in pull request #78: URL: https://github.com/apache/commons-codec/pull/78#discussion_r812241151 ## File path: src/test/java/org/apache/commons/codec/binary/StringUtilsTest.java ## @@ -121,6 +121,7 @@ public void testGetBytesUncheckedNullInput() { Assert.assertNull(StringUtils.getBytesUnchecked(null, "UNKNOWN")); } + Review comment: removed. -- 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
[GitHub] [commons-text] arturobernalg closed pull request #298: Make more clear passing null value.
arturobernalg closed pull request #298: URL: https://github.com/apache/commons-text/pull/298 -- 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
[jira] [Commented] (NET-707) FTPClient::listFiles() doesn't include files with spaces for AS400
[ https://issues.apache.org/jira/browse/NET-707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17496234#comment-17496234 ] Dmytro Sylaiev commented on NET-707: [~sebb] I got the AS400 env on pub400.com. It's not possible to create file with spaces with IBM i env, but when I connect to the same server using SSH it supports filename with spaces and with leading spaces as well. {noformat} ssh li...@pub400.com -p li...@pub400.com's password: Welcome to PUB400! $ ls ' a1.txt' file tempDir $ pwd /home/LIMMY $ uname -a OS400 WWW 4 7 00781B91 powerpc Os $ touch abc\ abc $ ls ' a1.txt' 'abc abc' file tempDir{noformat} > FTPClient::listFiles() doesn't include files with spaces for AS400 > -- > > Key: NET-707 > URL: https://issues.apache.org/jira/browse/NET-707 > Project: Commons Net > Issue Type: Bug > Environment: AS400 ftp server >Reporter: Dmytro Sylaiev >Priority: Major > > For the FTP server on AS400 I got the different response size for > FTPClient::listFiles() and FTPClient::listNames() (first one doesn't include > file with spaces) > > TheOS400FTPEntryParser pattern is > {noformat} > private static final String REGEX = > "(\\S+)\\s+" // user > + "(?:(\\d+)\\s+)?" // size, empty for members > + "(?:(\\S+)\\s+(\\S+)\\s+)?" // date stuff, empty for members > + "(\\*STMF|\\*DIR|\\*FILE|\\*MEM)\\s+" // *STMF/*DIR/*FILE/*MEM > + "(?:(\\S+)\\s*)?"; // file name, missing, when CWD is a > *FILE{noformat} > and the server response for LIST command > {noformat} > MYUSER 3 06/12/21 18:31:29 *STMF file with space.txt {noformat} > doesn't match that regex. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[GitHub] [commons-codec] garydgregory commented on a change in pull request #113: CODEC-285-JUnit5
garydgregory commented on a change in pull request #113: URL: https://github.com/apache/commons-codec/pull/113#discussion_r811945196 ## File path: src/test/java/org/apache/commons/codec/binary/Base16InputStreamTest.java ## @@ -327,33 +323,21 @@ public void testReadOutOfBounds() throws IOException { final ByteArrayInputStream bin = new ByteArrayInputStream(decoded); try (final Base16InputStream in = new Base16InputStream(bin, true)) { -try { -in.read(buf, -1, 0); -fail("Expected Base16InputStream.read(buf, -1, 0) to throw IndexOutOfBoundsException"); -} catch (final IndexOutOfBoundsException e) { -// Expected -} +assertThrows(IndexOutOfBoundsException.class, () -> { Review comment: @itamarc Same comment as for the other extra {} in other files... TY! -- 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
[GitHub] [commons-configuration] mpkorstanje commented on pull request #162: How about turning off the default build reports generation feature
mpkorstanje commented on pull request #162: URL: https://github.com/apache/commons-configuration/pull/162#issuecomment-1047735875 This user has been spamming similar MR's across many different projects. Would advise against merging. -- 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
[GitHub] [commons-configuration] garydgregory commented on pull request #162: How about turning off the default build reports generation feature
garydgregory commented on pull request #162: URL: https://github.com/apache/commons-configuration/pull/162#issuecomment-1047732082 -1: If you don't want reports, don't run them for your invocation on the command line. -- 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
[jira] [Work logged] (COMPRESS-514) SevenZFile fails with encoded header over 2GiB
[ https://issues.apache.org/jira/browse/COMPRESS-514?focusedWorklogId=730843=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-730843 ] ASF GitHub Bot logged work on COMPRESS-514: --- Author: ASF GitHub Bot Created on: 22/Feb/22 12:08 Start Date: 22/Feb/22 12:08 Worklog Time Spent: 10m Work Description: akelday commented on a change in pull request #98: URL: https://github.com/apache/commons-compress/pull/98#discussion_r811876816 ## File path: src/main/java/org/apache/commons/compress/archivers/sevenz/HeaderChannelBuffer.java ## @@ -0,0 +1,174 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.commons.compress.archivers.sevenz; + +import org.apache.commons.compress.utils.IOUtils; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.BufferUnderflowException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; +import java.util.zip.CRC32; + +/** + * Enables little-endian primitive type reads from a {@link ReadableByteChannel} + * or {@link InputStream}, internally using a paged-in {@link ByteBuffer}. + * + * Access is serial only but does allow a + * virtual buffer capacity of {@code Long.MAX_VALUE}. + * If the requested capacity is within the maximum page size (default 16MiB) + * the buffer will be fully read and held in a {@link HeaderInMemoryBuffer}. + * + * @NotThreadSafe + * @since 1.21 + */ +class HeaderChannelBuffer implements HeaderBuffer { +private static final int DEFAULT_PAGE_MAX = 16_777_216; +// This must match the largest get (currently getLong) +private static final int MAX_GET_ELEMENT_SIZE = 8; +private final ReadableByteChannel channel; +private final ByteBuffer buffer; +private long remaining; + +private HeaderChannelBuffer(final ReadableByteChannel channel, final long capacity, final int maxPageBytes) { +this.channel = channel; +int limit = (int) Math.min(maxPageBytes, capacity); +this.buffer = ByteBuffer.allocate(limit).order(ByteOrder.LITTLE_ENDIAN); +this.remaining = capacity; +} + +public static HeaderBuffer create(final ReadableByteChannel channel, final long capacity, final int maxPageBytes) +throws IOException { +if (maxPageBytes < MAX_GET_ELEMENT_SIZE) { +throw new IllegalArgumentException("Page size must be at least " + MAX_GET_ELEMENT_SIZE); +} +if (capacity <= maxPageBytes) { +ByteBuffer buf = ByteBuffer.allocate((int) capacity).order(ByteOrder.LITTLE_ENDIAN); +IOUtils.readFully(channel, buf); +buf.flip(); +return new HeaderInMemoryBuffer(buf); +} +HeaderChannelBuffer channelBuffer = new HeaderChannelBuffer(channel, capacity, maxPageBytes); +channelBuffer.fill(); +return channelBuffer; +} + +public static HeaderBuffer create(final ReadableByteChannel channel, final long capacity) throws IOException { +return HeaderChannelBuffer.create(channel, capacity, DEFAULT_PAGE_MAX); +} + +public static HeaderBuffer create(final InputStream inputStream, final long capacity, final int maxPageBytes) +throws IOException { +return create(Channels.newChannel(inputStream), capacity, maxPageBytes); +} + +public static HeaderBuffer create(final InputStream inputStream, final long capacity) throws IOException { +return create(Channels.newChannel(inputStream), capacity, DEFAULT_PAGE_MAX); +} + +@Override +public boolean hasCRC() { +return false; +} + +@Override +public CRC32 getCRC() throws IOException { +throw new IOException("CRC is not implemented for this header type"); +} + +@Override +public void get(byte[] dst) throws IOException { +int remainingBytes = dst.length; +do { +int length = Math.min(buffer.remaining(), remainingBytes); +buffer.get(dst, dst.length - remainingBytes, length); +
[GitHub] [commons-compress] akelday commented on a change in pull request #98: COMPRESS-514: SevenZFile header buffers over 2G
akelday commented on a change in pull request #98: URL: https://github.com/apache/commons-compress/pull/98#discussion_r811876816 ## File path: src/main/java/org/apache/commons/compress/archivers/sevenz/HeaderChannelBuffer.java ## @@ -0,0 +1,174 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.commons.compress.archivers.sevenz; + +import org.apache.commons.compress.utils.IOUtils; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.BufferUnderflowException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; +import java.util.zip.CRC32; + +/** + * Enables little-endian primitive type reads from a {@link ReadableByteChannel} + * or {@link InputStream}, internally using a paged-in {@link ByteBuffer}. + * + * Access is serial only but does allow a + * virtual buffer capacity of {@code Long.MAX_VALUE}. + * If the requested capacity is within the maximum page size (default 16MiB) + * the buffer will be fully read and held in a {@link HeaderInMemoryBuffer}. + * + * @NotThreadSafe + * @since 1.21 + */ +class HeaderChannelBuffer implements HeaderBuffer { +private static final int DEFAULT_PAGE_MAX = 16_777_216; +// This must match the largest get (currently getLong) +private static final int MAX_GET_ELEMENT_SIZE = 8; +private final ReadableByteChannel channel; +private final ByteBuffer buffer; +private long remaining; + +private HeaderChannelBuffer(final ReadableByteChannel channel, final long capacity, final int maxPageBytes) { +this.channel = channel; +int limit = (int) Math.min(maxPageBytes, capacity); +this.buffer = ByteBuffer.allocate(limit).order(ByteOrder.LITTLE_ENDIAN); +this.remaining = capacity; +} + +public static HeaderBuffer create(final ReadableByteChannel channel, final long capacity, final int maxPageBytes) +throws IOException { +if (maxPageBytes < MAX_GET_ELEMENT_SIZE) { +throw new IllegalArgumentException("Page size must be at least " + MAX_GET_ELEMENT_SIZE); +} +if (capacity <= maxPageBytes) { +ByteBuffer buf = ByteBuffer.allocate((int) capacity).order(ByteOrder.LITTLE_ENDIAN); +IOUtils.readFully(channel, buf); +buf.flip(); +return new HeaderInMemoryBuffer(buf); +} +HeaderChannelBuffer channelBuffer = new HeaderChannelBuffer(channel, capacity, maxPageBytes); +channelBuffer.fill(); +return channelBuffer; +} + +public static HeaderBuffer create(final ReadableByteChannel channel, final long capacity) throws IOException { +return HeaderChannelBuffer.create(channel, capacity, DEFAULT_PAGE_MAX); +} + +public static HeaderBuffer create(final InputStream inputStream, final long capacity, final int maxPageBytes) +throws IOException { +return create(Channels.newChannel(inputStream), capacity, maxPageBytes); +} + +public static HeaderBuffer create(final InputStream inputStream, final long capacity) throws IOException { +return create(Channels.newChannel(inputStream), capacity, DEFAULT_PAGE_MAX); +} + +@Override +public boolean hasCRC() { +return false; +} + +@Override +public CRC32 getCRC() throws IOException { +throw new IOException("CRC is not implemented for this header type"); +} + +@Override +public void get(byte[] dst) throws IOException { +int remainingBytes = dst.length; +do { +int length = Math.min(buffer.remaining(), remainingBytes); +buffer.get(dst, dst.length - remainingBytes, length); +remainingBytes -= length; +} while (refilled(remainingBytes)); +} + +private boolean refilled(final int remainingBytes) throws IOException { +if (remainingBytes <= 0) { +return false; + } Review comment: Hi, do we think this PR is still appropriate? I currently have no files large enough to test the issue it resolved, and haven't found time to create one yet. No
[GitHub] [commons-configuration] CAIWan1998 opened a new pull request #162: How about turning off the default build reports generation feature
CAIWan1998 opened a new pull request #162: URL: https://github.com/apache/commons-configuration/pull/162 That report generation takes time, slowing down the overall build. Reports are definitely useful, but do you need them every time you run the build. We can conditionally disable generating test reports by setting `true`. If you need to generate reports, just add `-DcloseTestReports=false` to the end of mvn build command. = If there are any inappropriate modifications in this PR, please give me a reply and I will change them. -- 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