Re: [FileUpload] 2.0.0-M1 soon [Was] Re: Re: Release Commons Fileupload 1.4.1?
Hi Gary, what's blocking the 2.0.0-M1 release? Can I help implementing it? Best, Dennis - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org
Re: [Pool] Toward version 2.12.0 and 3.0
+1 Phil On Mon, Jul 3, 2023 at 9:41 AM Gary Gregory wrote: > Hi all, > > This is a switch from the 2.12.0 vote mail thread in order to discuss 3.0 > and 2.x releases. > > I propose we switch master to 3.0 and create a branch called 2.x based and > an old commit and release 2.12.0 from there. > > Gary >
[Pool] Toward version 2.12.0 and 3.0
Hi all, This is a switch from the 2.12.0 vote mail thread in order to discuss 3.0 and 2.x releases. I propose we switch master to 3.0 and create a branch called 2.x based and an old commit and release 2.12.0 from there. Gary
Re: [VOTE] Release Apache Commons Pool 2.12.0 based on RC1
Hi Phil, Starting a new mailing thread is a good idea at this point. I'll just mention: I really do not want to roll back code changes in master. If you want to pick a commit in the past and create a branch 2.x from that, it's fine with me, or tell me, and I'll be happy to create the branch. Then I can switch master to 3.0. Gary On Mon, Jul 3, 2023, 11:31 Phil Steitz wrote: > On Mon, Jul 3, 2023 at 6:41 AM Gary Gregory > wrote: > > > On Thu, Jun 29, 2023 at 5:08 PM Phil Steitz > wrote: > > > > > > On Thu, Jun 29, 2023 at 11:39 AM Gary Gregory > > > wrote: > > > > > > > Great presentation in the video Elliotte. Thanks for sharing the > link. > > > > > > > > > > +1 many thanks. > > > > > > Now back to our hero. Let me pretend to be one of the people in the > > > audience of the video. > > > > > > We have this library that is used by all kinds of "programs" [1] and we > > are > > > not sure how best to a) type our own exceptions (the ones we generate) > > and > > > b) propagate the ones generated by user-supplied object factories. > > Broadly > > > speaking, we have four kinds of exceptions to deal with: > > > > > > 0) User-supplied object factories that the pool uses to perform pooled > > > object lifecycle operations may throw checked or unchecked exceptions. > > > Many of these will be the classic variety you mention in the video - > > > database is dead, etc when the factory is trying to open a physical > > > connection. The smelly "throws Exception" in place now lets us just > pass > > > these all up the stack, but essentially untyped. > > > 1) Pool clients want to do something, but the pool can't do it without > > > violating one of its invariants (most common is a client wants to > borrow > > an > > > object and, after waiting the configured interval, there is no capacity > > to > > > serve). We are inconsistent here. In the out of capacity case, we > throw > > > NoSuchElementException (probably bogus according to your taxonomy), but > > in > > > some cases - e.g. addObject - we silently no-op. > > > 2) An API is abused (e.g. return an object that did not come from the > > pool > > > or try to start borrowing objects before providing a factory) > > > 3) Something happens that should not be possible (indicating some kind > of > > > concurrency bug in [pool] itself or unanticipated craziness from a > > factory > > > or client code) > > > > > > There is a lot of complexity in the 0)-1) cases because some failures > are > > > more important to both the pool and clients than others (for example, > > > factory exceptions thrown in object validation or destruction are > > different > > > from those thrown in object creation). > > > > > > If I understand your advice, it would be: > > > 0) checked if that is what comes from the factory; just propagate > > otherwise > > > 1) checked? Maybe actually no exception - handle via return values or > > > somesuch? By far the most common here is NoSuchElementException. I > > guess > > > it's OK to see pool exhaustion as "environmental" [2], so probably > > checked > > > is actually right > > > 2) unchecked > > > 3) unchecked > > > > > > Assuming I got 0) right at least, the follow-up is how do we get the > > right > > > exceptions passed up the stack? What Gary is proposing is adding a > type > > > parameter at the pool level. Could be that is the best solution, but > > that > > > adds to complexity of the API and I keep wanting it to be defined at > the > > > factory level somehow and ideally have it default to something so users > > who > > > don't want to think about it (maybe because their factories only throw > > > unchecked exceptions) don't have to think about it. > > > > > > I would be remiss not to add a closing (at this point probably > annoying) > > > comment to the effect that this should be a 3.0 discussion :) > > > > I am OK with all of this being for 3.0, which can be as soon as we want. > > > > Thanks, Gary. We should probably end this thread then and start a new one > on 3.0 planning. As a side note, I discovered that the failures reported > to the console but not causing test failure that I saw were real, due to > problems in GKOP reuseCapacity. The OP test case for POOL-391 is > demanding, but we should be able to handle it. It was not causing the test > to fail because the runner does not see failures in spawned threads. My > bad not knowing that. Once I set it up so the failures would fail the > test, they did consistently. I have been working on and off on this over > the last week and I think I am close to a fix. Once I have this, I think > it would be good to roll a 2.12 without the compat break because there are > quite a few bug fixes in the RC. Would you be OK either rolling back the > added type parameter change or moving it to a new 3.0 branch? Or I guess > alternatively, creating a 2.x branch without that change? I can help with > either of these. > > Phil > > > > > Gary > > > > > > > > Phil > > > > > > [1] It
Re: [VOTE] Release Apache Commons Pool 2.12.0 based on RC1
On Mon, Jul 3, 2023 at 6:41 AM Gary Gregory wrote: > On Thu, Jun 29, 2023 at 5:08 PM Phil Steitz wrote: > > > > On Thu, Jun 29, 2023 at 11:39 AM Gary Gregory > > wrote: > > > > > Great presentation in the video Elliotte. Thanks for sharing the link. > > > > > > > +1 many thanks. > > > > Now back to our hero. Let me pretend to be one of the people in the > > audience of the video. > > > > We have this library that is used by all kinds of "programs" [1] and we > are > > not sure how best to a) type our own exceptions (the ones we generate) > and > > b) propagate the ones generated by user-supplied object factories. > Broadly > > speaking, we have four kinds of exceptions to deal with: > > > > 0) User-supplied object factories that the pool uses to perform pooled > > object lifecycle operations may throw checked or unchecked exceptions. > > Many of these will be the classic variety you mention in the video - > > database is dead, etc when the factory is trying to open a physical > > connection. The smelly "throws Exception" in place now lets us just pass > > these all up the stack, but essentially untyped. > > 1) Pool clients want to do something, but the pool can't do it without > > violating one of its invariants (most common is a client wants to borrow > an > > object and, after waiting the configured interval, there is no capacity > to > > serve). We are inconsistent here. In the out of capacity case, we throw > > NoSuchElementException (probably bogus according to your taxonomy), but > in > > some cases - e.g. addObject - we silently no-op. > > 2) An API is abused (e.g. return an object that did not come from the > pool > > or try to start borrowing objects before providing a factory) > > 3) Something happens that should not be possible (indicating some kind of > > concurrency bug in [pool] itself or unanticipated craziness from a > factory > > or client code) > > > > There is a lot of complexity in the 0)-1) cases because some failures are > > more important to both the pool and clients than others (for example, > > factory exceptions thrown in object validation or destruction are > different > > from those thrown in object creation). > > > > If I understand your advice, it would be: > > 0) checked if that is what comes from the factory; just propagate > otherwise > > 1) checked? Maybe actually no exception - handle via return values or > > somesuch? By far the most common here is NoSuchElementException. I > guess > > it's OK to see pool exhaustion as "environmental" [2], so probably > checked > > is actually right > > 2) unchecked > > 3) unchecked > > > > Assuming I got 0) right at least, the follow-up is how do we get the > right > > exceptions passed up the stack? What Gary is proposing is adding a type > > parameter at the pool level. Could be that is the best solution, but > that > > adds to complexity of the API and I keep wanting it to be defined at the > > factory level somehow and ideally have it default to something so users > who > > don't want to think about it (maybe because their factories only throw > > unchecked exceptions) don't have to think about it. > > > > I would be remiss not to add a closing (at this point probably annoying) > > comment to the effect that this should be a 3.0 discussion :) > > I am OK with all of this being for 3.0, which can be as soon as we want. > Thanks, Gary. We should probably end this thread then and start a new one on 3.0 planning. As a side note, I discovered that the failures reported to the console but not causing test failure that I saw were real, due to problems in GKOP reuseCapacity. The OP test case for POOL-391 is demanding, but we should be able to handle it. It was not causing the test to fail because the runner does not see failures in spawned threads. My bad not knowing that. Once I set it up so the failures would fail the test, they did consistently. I have been working on and off on this over the last week and I think I am close to a fix. Once I have this, I think it would be good to roll a 2.12 without the compat break because there are quite a few bug fixes in the RC. Would you be OK either rolling back the added type parameter change or moving it to a new 3.0 branch? Or I guess alternatively, creating a 2.x branch without that change? I can help with either of these. Phil > > Gary > > > > > Phil > > > > [1] It is hard for us to understand what is and is not in "our program" > as > > library developers. Our code is always running inside someone else's > > program, often using yet another third party's code. So for example, in > a > > common use case, [pool] is used by [dbcp] which is used by tomcat, with > > factories specified in a user webapp running in tomcat, wrapped into > [dbcp] > > and managed by [pool]. > > [2] Though many/most actual cases of this in production code end up being > > the result of self-DOS due to programming errors. > > > > > > > > Gary > > > > > > On Thu, Jun 29, 2023, 10:33 Elliotte
Re: [VOTE] Release Apache Commons Pool 2.12.0 based on RC1
On Thu, Jun 29, 2023 at 5:08 PM Phil Steitz wrote: > > On Thu, Jun 29, 2023 at 11:39 AM Gary Gregory > wrote: > > > Great presentation in the video Elliotte. Thanks for sharing the link. > > > > +1 many thanks. > > Now back to our hero. Let me pretend to be one of the people in the > audience of the video. > > We have this library that is used by all kinds of "programs" [1] and we are > not sure how best to a) type our own exceptions (the ones we generate) and > b) propagate the ones generated by user-supplied object factories. Broadly > speaking, we have four kinds of exceptions to deal with: > > 0) User-supplied object factories that the pool uses to perform pooled > object lifecycle operations may throw checked or unchecked exceptions. > Many of these will be the classic variety you mention in the video - > database is dead, etc when the factory is trying to open a physical > connection. The smelly "throws Exception" in place now lets us just pass > these all up the stack, but essentially untyped. > 1) Pool clients want to do something, but the pool can't do it without > violating one of its invariants (most common is a client wants to borrow an > object and, after waiting the configured interval, there is no capacity to > serve). We are inconsistent here. In the out of capacity case, we throw > NoSuchElementException (probably bogus according to your taxonomy), but in > some cases - e.g. addObject - we silently no-op. > 2) An API is abused (e.g. return an object that did not come from the pool > or try to start borrowing objects before providing a factory) > 3) Something happens that should not be possible (indicating some kind of > concurrency bug in [pool] itself or unanticipated craziness from a factory > or client code) > > There is a lot of complexity in the 0)-1) cases because some failures are > more important to both the pool and clients than others (for example, > factory exceptions thrown in object validation or destruction are different > from those thrown in object creation). > > If I understand your advice, it would be: > 0) checked if that is what comes from the factory; just propagate otherwise > 1) checked? Maybe actually no exception - handle via return values or > somesuch? By far the most common here is NoSuchElementException. I guess > it's OK to see pool exhaustion as "environmental" [2], so probably checked > is actually right > 2) unchecked > 3) unchecked > > Assuming I got 0) right at least, the follow-up is how do we get the right > exceptions passed up the stack? What Gary is proposing is adding a type > parameter at the pool level. Could be that is the best solution, but that > adds to complexity of the API and I keep wanting it to be defined at the > factory level somehow and ideally have it default to something so users who > don't want to think about it (maybe because their factories only throw > unchecked exceptions) don't have to think about it. > > I would be remiss not to add a closing (at this point probably annoying) > comment to the effect that this should be a 3.0 discussion :) I am OK with all of this being for 3.0, which can be as soon as we want. Gary > > Phil > > [1] It is hard for us to understand what is and is not in "our program" as > library developers. Our code is always running inside someone else's > program, often using yet another third party's code. So for example, in a > common use case, [pool] is used by [dbcp] which is used by tomcat, with > factories specified in a user webapp running in tomcat, wrapped into [dbcp] > and managed by [pool]. > [2] Though many/most actual cases of this in production code end up being > the result of self-DOS due to programming errors. > > > > > Gary > > > > On Thu, Jun 29, 2023, 10:33 Elliotte Rusty Harold > > wrote: > > > > > On Thu, Jun 29, 2023 at 10:10 AM Gilles Sadowski > > > wrote: > > > > > > > > Le jeu. 29 juin 2023 à 15:22, Elliotte Rusty Harold > > > > a écrit : > > > > > > > > > > On Thu, Jun 29, 2023 at 9:07 AM Gilles Sadowski < > > gillese...@gmail.com> > > > wrote: > > > > > > > > > > > > Hello. > > > > > > > > > > > > Le jeu. 29 juin 2023 à 14:44, Gary Gregory > > > > > a écrit : > > > > > > > > > > > I agree with the second part assuming the *current* Java > > > > > > best practices, not because of old APIs that are here to stay > > > > > > only because of infinite backwards compatibility, and not > > > > > > because they are deemed perfect. > > > > > > > > > > > > > > > Best practices on this haven't changed since Java 1.0 (Possibly Java > > > > > 1.0 alpha 3 if I recall versions correctly). > > > > > > > > > > Checked exceptions: all errors arising from external input to the > > > program. > > > > > Runtime exceptions: program bugs > > > > > > > > A pile of arguments (tally is largely against *any* use of checked > > > exceptions): > > > > > > > > > https://ohadshai.medium.com/its-almost-2020-and-yet-checked-exceptions-are-still-a-thing-bfaa24c8997e > > > > > > tldr; he's
Re: [commons-lang] branch master updated: --corrected the isUnchecked method to check for null (#1079)
Hi. IIUC, the discussion sparked by that new code is currently converging towards deletion: https://markmail.org/message/nlqtk6na6nvwtelo In any case, several arguments (confusing, unnecessary, useless) were mentioned so that this commit be reverted. A new thread should be started on the "dev" list, by someone who still thinks that these utilities should be added. Regards, Gilles Le lun. 3 juil. 2023 à 12:58, a écrit : > > This is an automated email from the ASF dual-hosted git repository. > > ggregory pushed a commit to branch master > in repository https://gitbox.apache.org/repos/asf/commons-lang.git > > > The following commit(s) were added to refs/heads/master by this push: > new f68a643ef --corrected the isUnchecked method to check for null > (#1079) > f68a643ef is described below > > commit f68a643ef99189d10a6753167367dcc8f943d634 > Author: Dimitrios Efthymiou > AuthorDate: Mon Jul 3 11:58:45 2023 +0100 > > --corrected the isUnchecked method to check for null (#1079) > > --created test for null case > --- > src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java | 2 +- > .../java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java | 5 > + > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git > a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java > b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java > index c98b5ed36..d1460b81f 100644 > --- a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java > +++ b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java > @@ -641,7 +641,7 @@ public class ExceptionUtils { > * @since 3.13.0 > */ > public static boolean isUnchecked(final Throwable throwable) { > -return !isChecked(throwable); > +return throwable != null && (throwable instanceof Error || throwable > instanceof RuntimeException); > } > > /** > diff --git > a/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java > b/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java > index 956a72390..c103345ff 100644 > --- a/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java > +++ b/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java > @@ -635,6 +635,11 @@ public class ExceptionUtilsTest extends AbstractLangTest > { > assertTrue(ExceptionUtils.isChecked(new TestThrowable())); > } > > +@Test > +public void testIsUnchecked_null() { > +assertFalse(ExceptionUtils.isUnchecked(null)); > +} > + > @Test > public void testIsUnchecked_checked() { > assertFalse(ExceptionUtils.isUnchecked(new IOException())); > - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org
Re: [commons-lang] branch master updated: [LANG-1647] Add and ExceptionUtils.isChecked() and isUnchecked() #1069
yes. You are right. Closed On Mon, 3 Jul 2023 at 10:12, Gilles Sadowski wrote: > Le lun. 3 juil. 2023 à 09:41, Alex Herbert a > écrit : > > > > On Mon, 3 Jul 2023 at 08:29, sebb wrote: > > > > > > Is null checked or unchecked? > > > > > > I think neither, so isUnchecked also needs to check for null. > > > > > > I wonder whether it might be better to throw NPE in both cases for > null. > > > > > > It may be confusing for users if not checked != unchecked. > > > e.g. it is tempting to code: > > > > > > if (isChecked(t)) { > > > } else { // must be unChecked > > > } > > > > > > If we don’t throw NPE, then it needs to be made very clear that > > > isChecked and isUnchecked are not opposites, there is a 3rd case. > > > > > > In any case, there needs to be a unit-test specifically for null. > > > > > > Sebb > > > > +1 > > > > I reiterate what I originally said, this is missing: > > > > @Test > > public void testIsUnchecked_null() { > > assertFalse(ExceptionUtils.isUnchecked(null)); > > } > > > > The method implementation details are secondary to the fact that the > > code is not clear on how it handles null; the relationship between > > isChecked and isUnchecked; and the intended usage. > > > > Note that one possible usage of type determination is to decide if you > > can cast it to a certain type. Currently this method does not provide > > this functionality as isUnchecked does not ensure that a cast to > > RuntimeException is allowed (since it passes for Error). So my use > > case is satisfied by instanceof. This leaves me wondering what are the > > use cases for isChecked or isUnchecked. I presume you are in an > > exception block with a Throwable of unknown type. So why do you care > > if the exception is not checked if not for a recast? > > > > Without a use case not satisfied by instanceof then this is code bloat. > > > > Reading through the discussion, I was wondering the same (What is > the use case?) and was tempted to reach the same conclusion. > After all, isn't "try/catch" the standard way to tailor behaviour according > to the exception type? > > Regards, > Gilles > > - > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > >
Re: [commons-lang] branch master updated: [LANG-1647] Add and ExceptionUtils.isChecked() and isUnchecked() #1069
Le lun. 3 juil. 2023 à 09:41, Alex Herbert a écrit : > > On Mon, 3 Jul 2023 at 08:29, sebb wrote: > > > > Is null checked or unchecked? > > > > I think neither, so isUnchecked also needs to check for null. > > > > I wonder whether it might be better to throw NPE in both cases for null. > > > > It may be confusing for users if not checked != unchecked. > > e.g. it is tempting to code: > > > > if (isChecked(t)) { > > } else { // must be unChecked > > } > > > > If we don’t throw NPE, then it needs to be made very clear that > > isChecked and isUnchecked are not opposites, there is a 3rd case. > > > > In any case, there needs to be a unit-test specifically for null. > > > > Sebb > > +1 > > I reiterate what I originally said, this is missing: > > @Test > public void testIsUnchecked_null() { > assertFalse(ExceptionUtils.isUnchecked(null)); > } > > The method implementation details are secondary to the fact that the > code is not clear on how it handles null; the relationship between > isChecked and isUnchecked; and the intended usage. > > Note that one possible usage of type determination is to decide if you > can cast it to a certain type. Currently this method does not provide > this functionality as isUnchecked does not ensure that a cast to > RuntimeException is allowed (since it passes for Error). So my use > case is satisfied by instanceof. This leaves me wondering what are the > use cases for isChecked or isUnchecked. I presume you are in an > exception block with a Throwable of unknown type. So why do you care > if the exception is not checked if not for a recast? > > Without a use case not satisfied by instanceof then this is code bloat. > Reading through the discussion, I was wondering the same (What is the use case?) and was tempted to reach the same conclusion. After all, isn't "try/catch" the standard way to tailor behaviour according to the exception type? Regards, Gilles - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org
Re: [commons-lang] branch master updated: [LANG-1647] Add and ExceptionUtils.isChecked() and isUnchecked() #1069
On Mon, 3 Jul 2023 at 08:29, sebb wrote: > > Is null checked or unchecked? > > I think neither, so isUnchecked also needs to check for null. > > I wonder whether it might be better to throw NPE in both cases for null. > > It may be confusing for users if not checked != unchecked. > e.g. it is tempting to code: > > if (isChecked(t)) { > } else { // must be unChecked > } > > If we don’t throw NPE, then it needs to be made very clear that > isChecked and isUnchecked are not opposites, there is a 3rd case. > > In any case, there needs to be a unit-test specifically for null. > > Sebb +1 I reiterate what I originally said, this is missing: @Test public void testIsUnchecked_null() { assertFalse(ExceptionUtils.isUnchecked(null)); } The method implementation details are secondary to the fact that the code is not clear on how it handles null; the relationship between isChecked and isUnchecked; and the intended usage. Note that one possible usage of type determination is to decide if you can cast it to a certain type. Currently this method does not provide this functionality as isUnchecked does not ensure that a cast to RuntimeException is allowed (since it passes for Error). So my use case is satisfied by instanceof. This leaves me wondering what are the use cases for isChecked or isUnchecked. I presume you are in an exception block with a Throwable of unknown type. So why do you care if the exception is not checked if not for a recast? Without a use case not satisfied by instanceof then this is code bloat. - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org
Re: [commons-lang] branch master updated: [LANG-1647] Add and ExceptionUtils.isChecked() and isUnchecked() #1069
Is null checked or unchecked? I think neither, so isUnchecked also needs to check for null. I wonder whether it might be better to throw NPE in both cases for null. It may be confusing for users if not checked != unchecked. e.g. it is tempting to code: if (isChecked(t)) { } else { // must be unChecked } If we don’t throw NPE, then it needs to be made very clear that isChecked and isUnchecked are not opposites, there is a 3rd case. In any case, there needs to be a unit-test specifically for null. Sebb On Mon, 3 Jul 2023 at 01:29, Elliotte Rusty Harold wrote: > > On Mon, Jul 3, 2023 at 12:20 AM Gary Gregory wrote: > > > > Hi Elliotte: > > > > Might you be looking at some old code in the PR? > > > > Just looking at what was posted in the email thread. It's a weird > corner case not everyone thinks of. > > > The current code is: > > > > /** > > * Checks if a throwable represents a checked exception > > * > > * @param throwable > > *The throwable to check. > > * @return True if the given Throwable is a checked exception. > > * @since 3.13.0 > > */ > > public static boolean isChecked(final Throwable throwable) { > > return throwable != null && !(throwable instanceof Error) && > > !(throwable instanceof RuntimeException); > > } > > This also looks wrong. This might work: > > public static boolean isChecked(final Throwable throwable) { > return throwable != null && throwable instanceof Exception && > !(throwable instanceof RuntimeException); > } > > > > -- > Elliotte Rusty Harold > elh...@ibiblio.org > > - > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org