[IO] Improvements to CharSequenceReader

2019-08-01 Thread Rob Spoor
Hi, CharSequenceReader is great, but I think there can be two improvements: 1) read(char[], int, int) currently calls read() several times, which delegates to charSequence.charAt. That's fine in Java 8 and before, but in Java 9 the internal storage of String, StringBuilder and StringBuffer is

[IO] Missing Reader / Writer implementations

2019-08-01 Thread Rob Spoor
Hi, I noticed that a lot of InputStream / OutputStream implementations do not have a matching Reader / Writer implementation. Some would really be useful. I've made an overview of classes that could be added: * AutoCloseReader * BrokenReader * CloseShieldReader * ClosedReader * CountingReader

Re: [IO] Improvements to CharSequenceReader

2019-08-01 Thread Rob Spoor
On 01/08/2019 12:31, Rob Spoor wrote: Hi, CharSequenceReader is great, but I think there can be two improvements: 1) read(char[], int, int) currently calls read() several times, which delegates to charSequence.charAt. That's fine in Java 8 and before, but in Java 9 the internal stora

Re: [IO] Missing Reader / Writer implementations

2019-08-01 Thread Rob Spoor
code coverage with unit tests for new code in your PRs ;-) Gary On Thu, Aug 1, 2019 at 6:39 AM Rob Spoor wrote: Hi, I noticed that a lot of InputStream / OutputStream implementations do not have a matching Reader / Writer implementation. Some would really be useful. I've made an over

Re: [IO] Missing Reader / Writer implementations

2019-08-01 Thread Rob Spoor
Sure :) On 01/08/2019 18:03, Gary Gregory wrote: May I suggest one PR per class so we can avoid a giant PR to review? Gary On Thu, Aug 1, 2019, 11:57 Rob Spoor wrote: I guess that the full list is not necessary, but I've been working on a project where I could have used the foll

[IO] Travis builds fail for Java 7, 13 and ea

2019-08-01 Thread Rob Spoor
See subject. This occurs for both master and pull requests. For instance: https://travis-ci.org/apache/commons-io/builds/561807075?utm_source=github_status&utm_medium=notification - To unsubscribe, e-mail: dev-unsubscr...@commo

Re: [IO] Missing Reader / Writer implementations

2019-08-02 Thread Rob Spoor
Spoor wrote: Sure :) On 01/08/2019 18:03, Gary Gregory wrote: May I suggest one PR per class so we can avoid a giant PR to review? Gary On Thu, Aug 1, 2019, 11:57 Rob Spoor wrote: I guess that the full list is not necessary, but I've been working on a project where I could have use

[IO] Build fails with 3 checkstyle errors

2019-08-09 Thread Rob Spoor
See https://travis-ci.org/apache/commons-io/jobs/569951808. Two of the errors report an unused import which is in fact used in Javadoc. The other is a protected method without Javadoc. - To unsubscribe, e-mail: dev-unsubscr...@

Re: [IO] Improvements to CharSequenceReader

2019-08-10 Thread Rob Spoor
On 09/08/2019 23:18, Gary Gregory wrote: Hi Rob, Do you plan on creating a PR? Gary On Thu, Aug 1, 2019 at 7:00 AM Rob Spoor wrote: On 01/08/2019 12:31, Rob Spoor wrote: Hi, CharSequenceReader is great, but I think there can be two improvements: 1) read(char[], int, int) currently calls

Re: [lang] org.apache.commons.text.lookup.IllegalArgumentExceptions to [lang].

2019-09-03 Thread Rob Spoor
Why limit this to IllegalArgument? Why not make it more generic? For instance, in ExceptionUtils: public static T format(final FunctionString, ? extends T> factory, final String format, final Object... args) { return factory.apply(String.format(format, args)); } public static T format(fi

Re: [lang] org.apache.commons.text.lookup.IllegalArgumentExceptions to [lang].

2019-09-04 Thread Rob Spoor
x27;s own call sites updated to use the new code. Gary On Tue, Sep 3, 2019 at 2:13 PM Gary Gregory wrote: On Tue, Sep 3, 2019 at 1:19 PM Rob Spoor wrote: Why limit this to IllegalArgument? Why not make it more generic? For instance, in ExceptionUtils: public static T format(final Function f

[IO] Travis build fails due to missing package documentation

2019-11-05 Thread Rob Spoor
See https://travis-ci.org/apache/commons-io/jobs/607784753. The reason is commit 14d6f4c6dbb429ebb915b530ea61fe911d36b20b, which added interface IOConsumer in package org.apache.commons.io.function, but forgot to add a package-info.java or package.html. In case you're interested, you can possi

Re: [text.CaseUtils] adding support for snake_case and kebab-case

2019-12-07 Thread Rob Spoor
On 07/12/2019 18:19, sebb wrote: On Sat, 7 Dec 2019 at 17:05, Bryan Rickman wrote: I recently used the text.CaseUtils for converting to camelCase and PascalCase. I also needed to convert to snake_case and kebab-case, and ended up writing my own code for that (I wasn't really a big fan of other

Re: [commons-lang] branch master updated: Use Collection#toArray(new T[0]) instead of a presized array as it is faster on modern JVMs.

2019-12-29 Thread Rob Spoor
One possible reason to use T[0] is because that's how the new (since Java 11) toArray method does it. From java.util.Collection, OpenJDK version 13: default T[] toArray(IntFunction generator) { return toArray(generator.apply(0)); } This method has, as of yet, not been overridd

Re: some questions (/bug?) about commons-vfs2 make me confused.

2020-01-19 Thread Rob Spoor
The class was there in release 2.4.1: https://github.com/apache/commons-vfs/blob/rel/commons-vfs-2.4.1/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java. In the next release, 2.5.0, it can indeed no longer be found. A bit of investigating showed that the

Re: some questions (/bug?) about commons-vfs2 make me confused.

2020-01-19 Thread Rob Spoor
added into vfs's pom as a dependency, or just move class VFS into that project aswell. Otherwise we should not let the VFS.getManager() rely on this class. Thanks for finding this class though. btw I tested 2.4, 2.4 is correct. Rob Spoor 于2020年1月19日周日 下午10:00写道: The class was there in re

Re: [lang] org.apache.commons.lang3.StringUtils.join(Object[], char) backward

2020-03-11 Thread Rob Spoor
Apparently you guys forgot about joinWith: https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#joinWith-java.lang.String-java.lang.Object...- However, even without this method, StringUtils.join can easily be replaced with streams: Stream.of(x,

Commons Lang website not updated for version 3.10

2020-04-05 Thread Rob Spoor
Hi all, I noticed that https://commons.apache.org/proper/commons-lang/ still mentions version 3.9 as being the latest (apart from the top bar which is probably automatically generated based on the pom). Kind regards, Rob -

Re: [configuration] org.apache.commons.configuration2.ImmutableConfiguration.getEnum()?

2020-04-27 Thread Rob Spoor
Why use a String as default and not a T? default > T getEnum(String key, Class enumType, T defaultEnum) { String value = getString(key, null); return value != null ? Enum.valueOf(enumType, value) : defaultEnum); } On 27/04/2020 06:28, Xeno Amess wrote: I really think we shall have a

Re: [io] can we delete release 20030203.000550 in maven central?

2020-06-14 Thread Rob Spoor
On 14/06/2020 12:40, Xeno Amess wrote: every time my update tool chain thinks 20030203.000550 is a greater version than 2.7 (actually it is, if see it in number). So have we some way to delete it from maven central? (or rename it?) The same problem happened in BeanUtils, version 20030211.134440

Re: About binary compatibility

2020-06-14 Thread Rob Spoor
On 14/06/2020 15:41, Gary Gregory wrote: In order to avoid posting the same answer here and on GitHib over and over, I tried to explain BC here: https://garygregory.wordpress.com/2020/06/14/how-we-handle-binary-compatibility-at-apache-commons/ Feedback is most welcome. Gary You mention that a

[IO] CharSequenceReader improvements

2020-07-08 Thread Rob Spoor
Hi, I was replacing my own copy of CharSequenceReader with the one from commons-io, but I had some test failures. I found out that there were two reasons: * It doesn't override ready(), and therefore always returns false, even if there are still characters to be read. That's not incorrect ac

Re: [IO] CharSequenceReader improvements

2020-07-11 Thread Rob Spoor
Thanks! On 10/07/2020 14:25, Gary Gregory wrote: Thanks Rob, I merged both PRs to master. Gary On Wed, Jul 8, 2020 at 3:49 PM Rob Spoor wrote: Hi, I was replacing my own copy of CharSequenceReader with the one from commons-io, but I had some test failures. I found out that there were two

Re: [LANG] Null-safe 'operator'

2020-07-18 Thread Rob Spoor
Can't you just use java.util.Optional? That was added way back (ahum) in Java 8. Converting your example: SubSubSubProperty value = Optional.ofNullable(object) .map(ObjectType::getProperty) .map(Property::getSubProperty) .map(SubProperty::getSubSubProperty

Re: [LANG] Null-safe 'operator'

2020-07-19 Thread Rob Spoor
ap(ObjectType::getProperty).or(() -> Optional.of(DEFAULT_PROPERTY)) .orElse(null); It seems to me a bit heavy, but I agree, it's possible. So you would recommend not including it in the library? Thanks, Juraj+ On Sat, 18 Jul 2020 at 15:44, Rob Spoor wrote: Can't you just use

Re: [CONFIGURATION-794] Unclosed file handle when reading config from JAR file URL

2020-10-11 Thread Rob Spoor
I've found the cause of the issue, in sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream. By default caching is enabled, so while the JarURLInputStream is closed, the JarFile isn't, probably to prevent having to keep opening JAR files. I've put my findings in JIRA plus a quick fix tha

Re: [lang] ObjectUtils enhancement - consumer with non-null value

2020-12-28 Thread Rob Spoor
applyIfNonNull looks to be a version of Optional without the Optional object. The following is the same as suggested but with an additional Optional object: Optional.ofNullable(valueX).ifPresent(bean::setValue); Optional.ofNullable(valueX).ifPresent(v -> someObject.compute(v, "bar"));

Re: [VOTE] Release Apache Commons IO 2.9.0 based on RC1

2021-05-22 Thread Rob Spoor
I think there are two errors in the release notes. I did not contribute to QueueInputStream and QueueOutputStream (#171). I also can't remember contributing to IO-429 / #175. On 22/05/2021 19:49, Gary Gregory wrote: We have fixed a few bugs and added enhancements since Apache Commons IO 2.8.0

Re: Create flow to only reflect selected fields on ReflectionToStringBuilder

2021-07-02 Thread Rob Spoor
If you know the fields, why use ReflectionToStringBuilder? Why not use a regular ToStringBuilder? That allows you to append each field you want. Yes, you have to type each field name twice (for the name and the value), but is that so much more work that it would require complicating the Reflect

Re: IO-753

2021-10-09 Thread Rob Spoor
Isn't this already possible with PipedOutputStream and PipedOutputStream? PipedInputStream inputStream = new PipedInputStream(size); PipedOutputStream outputStream = new PipedOutputStream(inputStream); Any write to outputStream is now visible in inputStream. Note that the writing and re

Re: IO-753

2021-10-09 Thread Rob Spoor
Utils.copy methods it would just be a shorthand for a rather simple implementation. But one that the user can rely on to work probably better than their own implementation. -Ursprüngliche Nachricht----- Von: Rob Spoor Gesendet: Samstag, 9. Oktober 2021 12:40 An: dev@commons.apache.org Betreff:

Re: [commons-vfs] Failure in bump ftpserver-core from 1.1.1 to 1.1.2

2021-12-31 Thread Rob Spoor
A quick check shows that some more dependencies are needed, for code split off from sshd-core. I found some: * https://mvnrepository.com/artifact/org.apache.sshd/sshd-sftp * https://mvnrepository.com/artifact/org.apache.sshd/sshd-scp However, even after adding these two I was still missing class

Re: [configuration] Jakarta mailapi 2.0.1

2022-06-10 Thread Rob Spoor
Since reflection is used to create the instances, isn't it possible to support both? There are plenty of containers like JBoss EAP that still use javax instead of jakarta. The code changes would be quite small in PropertyConverter: 1) Use two class name constants instead of one. Let's use INT

RE: [collections] Add a list/deque faster than TreeList?

2022-06-11 Thread Rob Spoor
I'd like to point out that rodde has also asked this project to be included in OpenJDK: https://mail.openjdk.java.net/pipermail/core-libs-dev/2022-June/091412.html On 2022/06/10 19:29:43 Rodion Efremov wrote: Hi, I have this List/Deque data structure: https://github.com/coderodde/IndexedLin

Re: [commons-lang] Comments on new FunctionUtils / nested lambda feature

2023-08-04 Thread Rob Spoor
With just one simple utility method you can get all the chaining you want: public static Function function(Function func) { return func; } This doesn't look very useful, but it allows you to turn a method reference or lambda into a typed Function without needing a cast. After

Re: [commons-lang] Comments on new FunctionUtils / nested lambda feature

2023-08-06 Thread Rob Spoor
ed up with other coding patterns I found better at the time for whatever reason.. Gary Gary On Fri, Aug 4, 2023, 3:24 PM Gary Gregory wrote: Worth adding adding function(Function)? Seems low cost to add it FailableFunction. Gary On Fri, Aug 4, 2023, 2:04 PM Rob Spoor wrote: With just one s

Re: [all] stopping dependabot and security analyses on dormant components

2023-10-03 Thread Rob Spoor
You could try archiving the projects. That way all jobs are disabled, including dependabot. You can't push anymore, but unarchiving is just as easy as archiving. Rob On 03/10/2023 19:22, Gary Gregory wrote: Getting rid of this is good for dormant components ONLY IMO. It is definitely not a

RE: Re: [TESTING] What is the status of this component?

2023-12-20 Thread Rob Spoor
It's also worth checking what alternatives already offer. For instance, https://junit-pioneer.org/ has @DefaultLocale which would make DefaultLocaleTestRule obsolete. Rob On 2023/12/20 18:18:25 Gary Gregory wrote: I had intended to gather various reusable JUnit rules and utilities but never

Re: [Net] JUnit 5 migration discussion

2024-03-01 Thread Rob Spoor
Inheriting test methods and @BeforeEach / @AfterEach methods works just fine. I even have a project that provides interfaces with default test methods. Just implementing these interfaces gives classes all of the test methods. If you override methods, you have to repeat the annotation though. I

Re: [ALL] GitHub is done with Java 8

2024-04-24 Thread Rob Spoor
I've just tested one of my own projects that has a matrix setup that's almost the same (I haven't included Java 22), and it was successful: https://github.com/robtimus/application-path/actions/runs/8820506010 The main difference is that I use @v4 instead of a specific commit, but those should