Throw in Juce_OSCAddress


#1

Hi
On line 304 of Juce_OSCAddress, it throws an exception if there are invalid characters in the address string.
Isn’t that a bit harsh ?

        for (String* token = oscSymbols.begin(); token != oscSymbols.end(); ++token)
            if (! containsOnlyAllowedPrintableASCIIChars (*token))
                throw OSCFormatError ("OSC format error: encountered characters not allowed in address string.");
        return oscSymbols;

Yes we could catch this in the calling code, but if we don’t then the app will crash hard if the end user sends OSC with some strange values.
I feel a jassert and simply ignoring the message would be more appropriate.
Or ?
For me the issue is when comparing messages like this:

IncommingMessage.getAddressPattern().matches(MyThingy->getAddressPattern())


#2

The idea here is that you shouldn’t be able to construct an OSCAddress instance if you pass an invalid string to its constructor. How would you prevent the object to be constructed if not by throwing an exception out of the constructor?

The OSC module uses exceptions quite a lot more than the rest of JUCE, so yeah this is something you should be aware about and catch in the app code.