Post a reply

Write your message and submit

Options

Click in the dark area of the image to send your post.

Go back

Topic review (newest first)

Diane2
2009-08-13 16:26:09

emaxt6 wrote:

You can design your custom parse routine so that it returns value null when the string can't be correctly parsed; then in tmap you can put a filter condition to an additional flow where rows with "null" in the date field go; so you can fully log all the rejected rows ( in file or database ).

bye

Sounds a good idea ^^. I'll do it this way, but this would be really great if one could fully use javaExceptions to cope with unusual but still possible errors.

emaxt6
2009-08-13 15:15:40

You can design your custom parse routine so that it returns value null when the string can't be correctly parsed; then in tmap you can put a filter condition to an additional flow where rows with "null" in the date field go; so you can fully log all the rejected rows ( in file or database ).

bye

Diane2
2009-08-12 09:55:36

@emaxt6 that's just what I want to  do: not allow garbage in. Sadly I can't get my tFileOutput to reject some strings that are to be parsed in a custom way (say a 14 character string with a meaning for the 11 first characters and another for the last three). That's why I tried to throw an exception in order to stop treatment on a wrong line and catch it in a tCatcher.

emaxt6
2009-08-10 19:09:21

I would design the thing differently... I wouldn't allow garbage in... if you can't parse a field supposed date you should crash the job or log the row in a reject flow....


Anyway, I haven't tried, but what happens when you throw a unchecked exception like derived from RuntimeException ( encapsulate your exception in RuntimeException )? ie.   "throw new RuntimeException(myexception)" ??

Diane2
2009-08-10 17:39:02

Does nobody know how to do the trick: let me explain further:

My function is used in a tMap and if I use a "throws" it is logged properly in my "ontrol" base but the tMap dies, which is not the behavior I want.  If I use a try/catch, the job does not die but the tCatcher is not reached, which is not my aim either.

How could I do it?

Diane2
2009-08-07 15:10:10

Morbo wrote:

Hello,
This would do the trick :

Code:

public static Date ParseDateFromStringNoThrow(String s) {
try{
return ParseDateFromString(s);
}
catch(ParseException e)
{
//DO SOMETHING USEFULL TO LOG IT
return null;
}
}

Ok, I would like to use something like that, but then, how could I log it using tLogCatcher? I would like to proceed this way because I log errors in a 2nd dataBase and I use all the tLogCatcher outputs to create the database logs. I suspect that using a try/catch/finally block wouldn't allow me to redirect a message to the catcher?

Morbo
2009-08-07 14:34:58

Hello,
This would do the trick :

Code:

public static Date ParseDateFromStringNoThrow(String s) {
try{
return ParseDateFromString(s);
}
catch(ParseException e)
{
//DO SOMETHING USEFULL TO LOG IT
return null;
}
}
Diane2
2009-08-07 14:29:01

Hi!

    I would like to how how to fully deal with java errors. As an exemple I got a function (ParseDateFromString) in routines (let say static class is MyRoutines). The function definition is the following:

public static Date ParseDateFromString(String) throws ParseException {
...
}

I know that using a tLogCatcher I can catch those errors, but whatever I can't manage not to print the stacktrace on console which I doesn't wish. How could I change this behavior. I appreciate a lot the SQL errors systems which are logged on console except when you create a reject link.

Thanks,

Diane

Board footer

Powered by FluxBB