Re: T5: ValidationException from validate event leads to ERROR level logger statement
I tried to use: @Environmental private ValidationTracker tracker; inside a custom validator class: public class MyPasswordValidator extends AbstractValidatorVoid, String unfortunately it is null. Did I miss something? I'm using cracklib inside my validator and there are quite a few validation steps and errormessages. I don't want to just throw the first validation error message, which is password must be at least 8 characters but instead record all validation errors (uppercase,lowercase,digit,dictionary word, etc.) and show them all to the user, so he can correct these all at once and doesn't have to iterate through them and get frustrated. -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-ValidationException-from-validate-event-leads-to-ERROR-level-logger-statement-tp4860047p5669953.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: ValidationException from validate event leads to ERROR level logger statement
1. Validators are designed to cause a single failure each. If you want to validate multiple things, add multiple validators to a field. http://tapestry.apache.org/forms-and-validation.html 2. Validators must throw a ValidationException in order to fail, the issue you are responding to is discussing a validate method on a component 3. @Environmental only works inside components... it's a convenience wrapper around Environment.peek() Cheers, Lance.
Re: T5: ValidationException from validate event leads to ERROR level logger statement
Thanks, Thiago. Yes, the wiki page should explain other ways of recording errors instead of this one that, as you said, it is known as bad idea. By the way, I have I doubt about this: one thing useful of this onValidateFromComponentId methods that throw Exceptions is that you can validate specific fields and record errors on them without the need to inject the component just to pass it to Form#recordError… is there another way to record an error on a Field without the need to inject the Field just for this? (just like you can return return a link to a page with just returning the page class or page name as String, without injecting the page on the component). Thanks. -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-ValidationException-from-validate-event-leads-to-ERROR-level-logger-statement-tp4860047p5654429.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: ValidationException from validate event leads to ERROR level logger statement
I know there are alternatives to throwing ValidationExceptions, but I was wondering what use does this has then? Is there really a case where you could want to log with error level all the user input validation errors? I ask because this method, throwing ValidationExceptions, appears on the wiki page as you should do it this way (http://tapestry.apache.org/forms-and-validation.html) but this behavior, imho, makes it useless at least in most cases. Regards, Raul. -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-ValidationException-from-validate-event-leads-to-ERROR-level-logger-statement-tp4860047p5647776.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: ValidationException from validate event leads to ERROR level logger statement
On Tue, 17 Apr 2012 19:31:54 -0300, raulmt rau...@gmail.com wrote: I know there are alternatives to throwing ValidationExceptions, but I was wondering what use does this has then? Is there really a case where you could want to log with error level all the user input validation errors? I ask because this method, throwing ValidationExceptions, appears on the wiki page as you should do it this way (http://tapestry.apache.org/forms-and-validation.html) but this behavior, imho, makes it useless at least in most cases. Registering validation errors by throwing exceptions is something that was carried from Tapestry 4 to 5 and that's something Howard already said it was a bad idea. We probably need to fix that wiki page. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: ValidationException from validate event leads to ERROR level logger statement
Lenny and Steve, thank you for your responses. I updated testwise to 5.2.6, but the behaviour does not change here. @Lenny: Can't do component.recordError(), since i need the form component to do so. The form component is defined a few component layers above and i would have to pass it down as a parameter through all nested components. I would like to find a better solution. Is there a way to access the sourrounding Form or some validation tracker to record a message for a specific form field? I have searched some services (FormSupport etc.) but could not find a entry point for a solution. any hint apreciated :) thx felix On 03.10.2011 06:06, Steve Eynon wrote: Hi Felix, I remember seeing the same behaviour you mention in the past - ValidationExceptions being handled correctly but also being logged as an error. But I've not seen it happen in a while now and after a quick test I'm not able to replicate it either. We're using T5.2.6, you may want to try updating to see if the problem still exists. Steve. On 2 October 2011 01:31, Lenny Primak lpri...@hope.nyc.ny.us wrote: I think you can do component.recordError() to do the same thing without throwing the exception. Since no one is handling the exception in your case it just flows to the standard error handler and sends you the email. On Oct 1, 2011, at 12:15 PM, Felix Gonschorek fe...@netzgut.net wrote: Hi all, i encountered a undesired behaviour in our apps: When using an validate component event handler that validates a single field and this handler throws an org.apache.tapestry5.ValidationException, this exception is logged with level ERROR: snip [ERROR] ioc.Registry org.apache.tapestry5.ValidationException: ERROR [ERROR] ioc.Registry Operations trace: [ERROR] ioc.Registry [ 1] Triggering event 'action' on Test:form [ERROR] ioc.Registry [ 2] Triggering event 'validate' on Test:textfield /snap this is the event handler: snip @OnEvent(value = EventConstants.VALIDATE, component = textfield) void onValidateFromTextfield(String value) throws ValidationException { throw new ValidationException(ERROR); } /snap Is this a desired behaviour? I think something like a full disk, a disconnected database or not enough RAM is an error, but not a failing user validation. - The page renders fine - The validation exception message is displayed to the user - so everything is okay, but the superfluous ERROR log - level statement. This happens with tapestry 5.2.5 - is something wrong with my code? I could ignore this, but i have configured our logging system to send alert-mails in case of an ERROR level log entry, an now i am getting mails evey time a user enters a invalid data Oo. I will file a bug report if i am not completely off the track, so if someone can get me short feedback i would be greatful. thanks felix - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: ValidationException from validate event leads to ERROR level logger statement
Thanks to Thiago i found a clean solution: @Environmental private ValidationTracker tracker; Using this envirnmental service one can record validation messages without throwing exceptions and without having the surrounding form component at hand. thanks thiago felix On 04.10.2011 12:38, Felix Gonschorek wrote: Lenny and Steve, thank you for your responses. I updated testwise to 5.2.6, but the behaviour does not change here. @Lenny: Can't do component.recordError(), since i need the form component to do so. The form component is defined a few component layers above and i would have to pass it down as a parameter through all nested components. I would like to find a better solution. Is there a way to access the sourrounding Form or some validation tracker to record a message for a specific form field? I have searched some services (FormSupport etc.) but could not find a entry point for a solution. any hint apreciated :) thx felix On 03.10.2011 06:06, Steve Eynon wrote: Hi Felix, I remember seeing the same behaviour you mention in the past - ValidationExceptions being handled correctly but also being logged as an error. But I've not seen it happen in a while now and after a quick test I'm not able to replicate it either. We're using T5.2.6, you may want to try updating to see if the problem still exists. Steve. On 2 October 2011 01:31, Lenny Primak lpri...@hope.nyc.ny.us wrote: I think you can do component.recordError() to do the same thing without throwing the exception. Since no one is handling the exception in your case it just flows to the standard error handler and sends you the email. On Oct 1, 2011, at 12:15 PM, Felix Gonschorek fe...@netzgut.net wrote: Hi all, i encountered a undesired behaviour in our apps: When using an validate component event handler that validates a single field and this handler throws an org.apache.tapestry5.ValidationException, this exception is logged with level ERROR: snip [ERROR] ioc.Registry org.apache.tapestry5.ValidationException: ERROR [ERROR] ioc.Registry Operations trace: [ERROR] ioc.Registry [ 1] Triggering event 'action' on Test:form [ERROR] ioc.Registry [ 2] Triggering event 'validate' on Test:textfield /snap this is the event handler: snip @OnEvent(value = EventConstants.VALIDATE, component = textfield) void onValidateFromTextfield(String value) throws ValidationException { throw new ValidationException(ERROR); } /snap Is this a desired behaviour? I think something like a full disk, a disconnected database or not enough RAM is an error, but not a failing user validation. - The page renders fine - The validation exception message is displayed to the user - so everything is okay, but the superfluous ERROR log - level statement. This happens with tapestry 5.2.5 - is something wrong with my code? I could ignore this, but i have configured our logging system to send alert-mails in case of an ERROR level log entry, an now i am getting mails evey time a user enters a invalid data Oo. I will file a bug report if i am not completely off the track, so if someone can get me short feedback i would be greatful. thanks felix - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: ValidationException from validate event leads to ERROR level logger statement
Hi Felix, I remember seeing the same behaviour you mention in the past - ValidationExceptions being handled correctly but also being logged as an error. But I've not seen it happen in a while now and after a quick test I'm not able to replicate it either. We're using T5.2.6, you may want to try updating to see if the problem still exists. Steve. On 2 October 2011 01:31, Lenny Primak lpri...@hope.nyc.ny.us wrote: I think you can do component.recordError() to do the same thing without throwing the exception. Since no one is handling the exception in your case it just flows to the standard error handler and sends you the email. On Oct 1, 2011, at 12:15 PM, Felix Gonschorek fe...@netzgut.net wrote: Hi all, i encountered a undesired behaviour in our apps: When using an validate component event handler that validates a single field and this handler throws an org.apache.tapestry5.ValidationException, this exception is logged with level ERROR: snip [ERROR] ioc.Registry org.apache.tapestry5.ValidationException: ERROR [ERROR] ioc.Registry Operations trace: [ERROR] ioc.Registry [ 1] Triggering event 'action' on Test:form [ERROR] ioc.Registry [ 2] Triggering event 'validate' on Test:textfield /snap this is the event handler: snip @OnEvent(value = EventConstants.VALIDATE, component = textfield) void onValidateFromTextfield(String value) throws ValidationException { throw new ValidationException(ERROR); } /snap Is this a desired behaviour? I think something like a full disk, a disconnected database or not enough RAM is an error, but not a failing user validation. - The page renders fine - The validation exception message is displayed to the user - so everything is okay, but the superfluous ERROR log - level statement. This happens with tapestry 5.2.5 - is something wrong with my code? I could ignore this, but i have configured our logging system to send alert-mails in case of an ERROR level log entry, an now i am getting mails evey time a user enters a invalid data Oo. I will file a bug report if i am not completely off the track, so if someone can get me short feedback i would be greatful. thanks felix - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
T5: ValidationException from validate event leads to ERROR level logger statement
Hi all, i encountered a undesired behaviour in our apps: When using an validate component event handler that validates a single field and this handler throws an org.apache.tapestry5.ValidationException, this exception is logged with level ERROR: snip [ERROR] ioc.Registry org.apache.tapestry5.ValidationException: ERROR [ERROR] ioc.Registry Operations trace: [ERROR] ioc.Registry [ 1] Triggering event 'action' on Test:form [ERROR] ioc.Registry [ 2] Triggering event 'validate' on Test:textfield /snap this is the event handler: snip @OnEvent(value = EventConstants.VALIDATE, component = textfield) void onValidateFromTextfield(String value) throws ValidationException { throw new ValidationException(ERROR); } /snap Is this a desired behaviour? I think something like a full disk, a disconnected database or not enough RAM is an error, but not a failing user validation. - The page renders fine - The validation exception message is displayed to the user - so everything is okay, but the superfluous ERROR log - level statement. This happens with tapestry 5.2.5 - is something wrong with my code? I could ignore this, but i have configured our logging system to send alert-mails in case of an ERROR level log entry, an now i am getting mails evey time a user enters a invalid data Oo. I will file a bug report if i am not completely off the track, so if someone can get me short feedback i would be greatful. thanks felix - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: ValidationException from validate event leads to ERROR level logger statement
I think you can do component.recordError() to do the same thing without throwing the exception. Since no one is handling the exception in your case it just flows to the standard error handler and sends you the email. On Oct 1, 2011, at 12:15 PM, Felix Gonschorek fe...@netzgut.net wrote: Hi all, i encountered a undesired behaviour in our apps: When using an validate component event handler that validates a single field and this handler throws an org.apache.tapestry5.ValidationException, this exception is logged with level ERROR: snip [ERROR] ioc.Registry org.apache.tapestry5.ValidationException: ERROR [ERROR] ioc.Registry Operations trace: [ERROR] ioc.Registry [ 1] Triggering event 'action' on Test:form [ERROR] ioc.Registry [ 2] Triggering event 'validate' on Test:textfield /snap this is the event handler: snip @OnEvent(value = EventConstants.VALIDATE, component = textfield) void onValidateFromTextfield(String value) throws ValidationException { throw new ValidationException(ERROR); } /snap Is this a desired behaviour? I think something like a full disk, a disconnected database or not enough RAM is an error, but not a failing user validation. - The page renders fine - The validation exception message is displayed to the user - so everything is okay, but the superfluous ERROR log - level statement. This happens with tapestry 5.2.5 - is something wrong with my code? I could ignore this, but i have configured our logging system to send alert-mails in case of an ERROR level log entry, an now i am getting mails evey time a user enters a invalid data Oo. I will file a bug report if i am not completely off the track, so if someone can get me short feedback i would be greatful. thanks felix - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org