Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF queries using SubStringValue can't handle empty Strings
EMF queries using SubStringValue can't handle empty Strings [message #414969] Tue, 27 November 2007 09:14 Go to next message
Jasper is currently offline JasperFriend
Messages: 84
Registered: July 2009
Member
All:

SubStringValue#isSatisfied calls StringSearch#new, which throws
IllegalArgumentException if the second parameter is a String of zero
length. But isn't it pretty normal for a search to encounter empty
Strings in a model? Yet with the current implementation, any query using
SubStringValue will choke on the first empty String it encounters.

Simplest solution would be to have a guard as the first line of in
SubStringValue#isSatisfied:

if (str == null || str.length() == 0)
return false;

Regards,
Jasper.
Re: EMF queries using SubStringValue can't handle empty Strings [message #414972 is a reply to message #414969] Tue, 27 November 2007 12:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Jasper,

Yes, this sounds like a bug. Please raise one:

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMF& version=1.1&component=Query

Cheers,

Christian


Jasper wrote:

> All:
>
> SubStringValue#isSatisfied calls StringSearch#new, which throws
> IllegalArgumentException if the second parameter is a String of zero
> length. But isn't it pretty normal for a search to encounter empty
> Strings in a model? Yet with the current implementation, any query using
> SubStringValue will choke on the first empty String it encounters.
>
> Simplest solution would be to have a guard as the first line of in
> SubStringValue#isSatisfied:
>
> if (str == null || str.length() == 0)
> return false;
>
> Regards,
> Jasper.
Re: EMF queries using SubStringValue can't handle empty Strings [message #414973 is a reply to message #414969] Tue, 27 November 2007 12:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33216
Registered: July 2009
Senior Member
Jasper,

Seems reasonable to me. I'd suggest opening a bugzilla. Personally I
think seems odd that StringSearch itself throws an exception for an
empty string, but it's apparently deliberate...


Jasper wrote:
> All:
>
> SubStringValue#isSatisfied calls StringSearch#new, which throws
> IllegalArgumentException if the second parameter is a String of zero
> length. But isn't it pretty normal for a search to encounter empty
> Strings in a model? Yet with the current implementation, any query
> using SubStringValue will choke on the first empty String it encounters.
>
> Simplest solution would be to have a guard as the first line of in
> SubStringValue#isSatisfied:
>
> if (str == null || str.length() == 0)
> return false;
>
> Regards,
> Jasper.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF queries using SubStringValue can't handle empty Strings [message #414975 is a reply to message #414972] Tue, 27 November 2007 12:52 Go to previous message
Jasper is currently offline JasperFriend
Messages: 84
Registered: July 2009
Member
Bugzilla #211055

Thanks,
Jasper.


Christian W. Damus wrote:
> Hi, Jasper,
>
> Yes, this sounds like a bug. Please raise one:
>
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMF& version=1.1&component=Query
>
> Cheers,
>
> Christian
>
>
> Jasper wrote:
>
>> All:
>>
>> SubStringValue#isSatisfied calls StringSearch#new, which throws
>> IllegalArgumentException if the second parameter is a String of zero
>> length. But isn't it pretty normal for a search to encounter empty
>> Strings in a model? Yet with the current implementation, any query using
>> SubStringValue will choke on the first empty String it encounters.
>>
>> Simplest solution would be to have a guard as the first line of in
>> SubStringValue#isSatisfied:
>>
>> if (str == null || str.length() == 0)
>> return false;
>>
>> Regards,
>> Jasper.
>
Previous Topic:Chaging the current object in a property sheet
Next Topic:error with eKeys() if three plugins are involved.
Goto Forum:
  


Current Time: Sat Sep 21 22:49:05 GMT 2024

Powered by FUDForum. Page generated in 0.04072 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top