Application.Properties does not work for a minority of users

One of my apps gets ERA reports for "Unhandled Exception" and "Invalid Value" in lines of code related to properties.

In this specific case:

1) I get "Unhandled Exception" in cases like:

var a = Application.Properties.getValue("property1");

The documentation says that getValue() can throw UnexpectedTypeException and InvalidKeyException, which both are not the case because I always use Strings as keys and the key does always exist because defined in the properties.xml file.

2) I get "Invalid Value" in cases like:

var a = Application.Properties.getValue("property1");
if(a == 1) {
    // do stuff
}

Differently from before, it looks like the getValue() function retrieves something, because no exception is thrown, but the type is different from what supposed to be.

This is really strange because these issues happen to a very small portion of the users, and in fact I haven't been able to replicate this problem on both of my devices with daily usage of my app.

Thank you very much!

  • 1. It's just a refactor for efficiency, it's not intended to be a comprehensive rewrite

    2. My only point is that the current design forces defaults to be duplicated. In an ideal world, there would be an api call to get the default value for a property. I like to adhere to the Don't Repeat Yourself principle whenever possible, because doing otherwise often leads to bugs. I also dislike repeated logic and data as a matter of principle, even when it's known to not (currently) cause any problems.

  • Yes I agree, not the best design. But I understand why it's the way it is.... (hehe I start to sound like Jim :)

  • Sure, understanding why is one thing. Agreeing with the design is another.

    I mean we have the benefit of unlimited 20/20 hindsight so obviously it's easy for us to criticize. But then again, we can also see the same kinds of problems cropping up over and over again....