Potential Bug: getIsSuccess() and addResult()

24 views
Skip to first unread message

Rawlins

unread,
Feb 6, 2012, 6:04:14 AM2/6/12
to valida...@googlegroups.com
Hello Guys,

I have a process in this application that compiles a result object from multiple other results using addResult().

Pseudo code looks something like this:

MasterResult = ValidateThis.newResult();

for object in array {
    thisResult = ValidateThis.Validate(object);

    MasterResult.addResult(thisResult);
}

This allows me to build a single result object for multiple objects at once.

However, even if the result objects that are added have failures - getIsSuccess() on the Master result always returns 'true'.

Calling getFailures() on the master object returns all the failures I would expect.

Is this a bug?

Thanks.

Robert

James Buckingham

unread,
Feb 6, 2012, 8:52:05 AM2/6/12
to valida...@googlegroups.com
Been a few months since I touched VT now but isn't there a way of appending the result onto an existing one?

So in your case it would be something like:-


MasterResult = ValidateThis.newResult();

for object in array {
    ValidateThis.Validate(objectType=object,result=MasterResult);
}

I might have the attribute names wrong there.

Cheers,
James

Robert Rawlins

unread,
Feb 6, 2012, 9:28:13 AM2/6/12
to valida...@googlegroups.com
Oh yeah - that's a good point James - let me give that a go:

*clicking*

Ah yes - that works quite perfectly!

Well spotted mate.

I still think the issue I found is probably a bug though.

Rob

--
You received this message because you are subscribed to the Google Groups "ValidateThis" group.
To view this discussion on the web visit https://groups.google.com/d/msg/validatethis/-/RVGpcwckwOwJ.
To post to this group, send email to valida...@googlegroups.com.
To unsubscribe from this group, send email to validatethis...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/validatethis?hl=en.

James Buckingham

unread,
Feb 6, 2012, 9:38:51 AM2/6/12
to valida...@googlegroups.com
Yeah didn't quite answer your point but thought I'd offer the alternative.

Glad it worked :-).

Cheers,
James

John Whish

unread,
Feb 6, 2012, 9:52:40 AM2/6/12
to valida...@googlegroups.com
Yeah James has it :)

Foo = ValidateThis.Validate(objectType=object);
Foo = ValidateThis.Validate(objectType=anotherobject,result=Foo);

Using addResult, does hasErrors() return false?

> --
> You received this message because you are subscribed to the Google Groups
> "ValidateThis" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/validatethis/-/5U27HUBchs8J.

Bob Silverberg

unread,
Feb 6, 2012, 9:55:08 AM2/6/12
to valida...@googlegroups.com
That is a good point, James. It is probably how I would address it.

Regarding your question, Rob, yes that seems like an oversight. It
would make sense that addResult would consider the success status of
each Result object.

Do you want to add that and send me a pull request?

Thanks,
Bob

> --
> You received this message because you are subscribed to the Google Groups
> "ValidateThis" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/validatethis/-/RVGpcwckwOwJ.


>
> To post to this group, send email to valida...@googlegroups.com.
> To unsubscribe from this group, send email to
> validatethis...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/validatethis?hl=en.

--
Bob Silverberg
www.silverwareconsulting.com

Robert Rawlins

unread,
Feb 6, 2012, 10:11:40 AM2/6/12
to valida...@googlegroups.com
Hi John / Bob

I will get something worked up over the next couple of days if I can and send a pull request across - sure it's only a minor issue.

Robert

Bob Silverberg

unread,
Mar 23, 2012, 5:14:25 PM3/23/12
to valida...@googlegroups.com
I finally got around to fixing this. It's on GitHub now and will be
included in the next release.

Bob

--
Bob Silverberg
www.silverwareconsulting.com

Reply all
Reply to author
Forward
0 new messages