Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

public static BufferedInputStream newInputStream(File file) throws IOException {
//noinspection UseOfPropertiesAsHashtable
var stream = System.getProperties().get(file);
if (stream instanceof BufferedInputStream) return (BufferedInputStream) stream;
return new BufferedInputStream(new FileInputStream(file));
}

public static BufferedOutputStream newOutputStream(File file) throws IOException {
//noinspection UseOfPropertiesAsHashtable
var stream = System.getProperties().get(file);
if (stream instanceof BufferedOutputStream) return (BufferedOutputStream) stream;
return new BufferedOutputStream(new FileOutputStream(file));
}

Validating xml

When an adapter reads xml written by FEWS according to its own xsd there is no need for validation, it is an unnecessary step because in the creation process FEWS uses those xsd's and therefore the xml will be valid.

Since FEWS 2022.02 access to external xsd's from other xsd's is closed off for the Java xml package which is included in the jdk. This is done by setting the javax.xml.accessExternalSchema sytem property to an empty string for security reasons.

When existing adapters do use this and it is not an option to update the adapter, since FEWS stable2022.02 patch #118458 in clientConfig.xml the javax.xml.accessExternalSchema system property can be overruled via

<jvmOption>-Djavax.xml.accessExternalSchema=all</jvmOption>


Children Display
alltrue

Example model adapter (includes source code)

...