replay-framework / replay

Fork of the Play1 Framework
Other
20 stars 11 forks source link

Do not abuse the Properties class #447

Open cies opened 2 months ago

cies commented 2 months ago

From JDK17:

Because Properties inherits from Hashtable, the put and putAll methods can be applied to a Properties object. Their use is strongly discouraged as they allow the caller to insert entries whose keys or values are not Strings. The setProperty method should be used instead. If the store or save method is called on a "compromised" Properties object that contains a non-String key or value, the call will fail. Similarly, the call to the propertyNames or list method will fail if it is called on a "compromised" Properties object that contains a non-String key.

In RePlay we call it Play.configuration...

  /**
   * The app configuration (already resolved from the framework id)
   */
  public static Properties configuration = new Properties();

...and it is used by means of the "strongly discouraged" put and putAll.

So I want to stop it from using these methods.