On 01/02/2013 15:12, Andrei Shakirin wrote:
Hi Francesco,
You're right about [1] and [2] - only, I have just realized now, working on
SYNCOPE-136, that ignoring this exception can be very dangerous during the
propagation process. And having it checked helps definitely in this sense.
Let's put it the other way round: why have it unchecked?
Accordingly Java Best Practices checked exceptions should be used only for
conditions from which the caller can reasonably be expected to recover.
Runtime exceptions should be used for preconditions violation and for
programming errors.
If user have real possibility to improve the situation, exception should be
checked.
Not sure about IncompatiblePolicyException: is it related to passwords format
only? In this case I tend to change exception back to checked, because user can
react on exception and try again with improved password.
IncompatiblePolicyException is thrown by PasswordGenerator when the set
of password policies that are taken into account during random password
generation led to some incompatible constraints: for example policy A
says "length > 10 chars" and policy B says "length <= 8 chars".
In our case, the caller can somehow try to recover from this kind of
exception: take a look at ConnObjectUtil.getAttributableTO()
try {
password = pwdGen.generatePasswordFromPwdSpec(ppSpecs);
} catch (IncompatiblePolicyException e) {
LOG.error("Could not generate policy-compliant random
password for {}", subjectTO, e);
password = RandomStringUtils.randomAlphanumeric(16);
}
Regards.
-----Original Message-----
From: Francesco Chicchiriccò [mailto:ilgro...@apache.org]
Sent: Freitag, 1. Februar 2013 14:37
To: dev@syncope.apache.org
Subject: Re: IncompatiblePolicyException was made unchecked
On 01/02/2013 14:33, Andrei Shakirin wrote:
Hi Francesco,
I thought it was agreed in [1]. Have seen no objections in [2].
You're right about [1] and [2] - only, I have just realized now, working on
SYNCOPE-136, that ignoring this exception can be very dangerous during the
propagation process. And having it checked helps definitely in this sense.
Do you have reasons to keep this exception checked?
Let's put it the other way round: why have it unchecked?
Regards.
[1]
https://cwiki.apache.org/confluence/display/SYNCOPE/Remote+Exceptions
[2]
http://syncope-dev.1063484.n5.nabble.com/Exception-propagation-in-
Rest
-interface-HTTP-header-vs-body-for-details-td5711482.html
-----Original Message-----
From: Francesco Chicchiriccò [mailto:ilgro...@apache.org]
Sent: Freitag, 1. Februar 2013 14:12
To: dev@syncope.apache.org
Subject: IncompatiblePolicyException was made unchecked
Hi all,
I've just noticed that IncompatiblePolicyException, created checked
[1] is now unchecked: any reason for this?
[1]
http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/ja
va
/org/apache/syncope/core/util/IncompatiblePolicyException.java?view=m
ar
kup&pathrev=1401200
--
Francesco Chicchiriccò
ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
http://people.apache.org/~ilgrosso/
--
Francesco Chicchiriccò
ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
http://people.apache.org/~ilgrosso/