Skip to content

Commit 2b764cd

Browse files
mrserbRealCLanger
authored andcommitted
8298676: Enhanced Look and Feel
Reviewed-by: mbalao Backport-of: 932ee4043e4a4a262a4c0b747f1367858f55198e
1 parent 019084b commit 2b764cd

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,18 @@ public void load(InputStream input, Class<?> resourceBase) throws
615615
* <code>new URL(synthFile, path)</code>. Refer to
616616
* <a href="doc-files/synthFileFormat.html">Synth File Format</a> for more
617617
* information.
618+
* <p>
619+
* Whilst this API may be safe for loading local resources that are
620+
* delivered with a {@code LookAndFeel} or application, and so have an
621+
* equal level of trust with application code, using it to load from
622+
* remote resources, particularly any which may have a lower level of
623+
* trust, is strongly discouraged.
624+
* The alternative mechanisms to load styles from an {@code InputStream}
625+
* {@linkplain #load(InputStream, Class)}
626+
* using resources co-located with the application or by providing a
627+
* {@code SynthStyleFactory} to
628+
* {@linkplain #setStyleFactory setStyleFactory(SynthStyleFactory)}
629+
* are preferred.
618630
*
619631
* @param url the <code>URL</code> to load the set of
620632
* <code>SynthStyle</code> from

src/java.desktop/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ <h1><a id="file">File Format</a></h1>
7070
<p>
7171
This example loads the look and feel from an input stream, using
7272
the specified class as the resource base to resolve paths.
73+
</p>
74+
<p>
7375
It is also possible to load a look and feel from an arbitrary URL
7476
as in the following example.
7577
</p>
@@ -94,6 +96,11 @@ <h1><a id="file">File Format</a></h1>
9496
<li>Remote JAR file, e.g.
9597
<code>jar:http://host/synth-laf.jar!/laf.xml</code></li>
9698
</ul>
99+
<p>Note: Synth's file format allows for the definition of code to be executed.
100+
Loading any code from a remote location should be used only
101+
with extreme caution from a trusted source over a secure connection.
102+
It is strongly discouraged for an application or a LookAndFeel to do so.
103+
</p>
97104
<p>
98105
While the DTD for synth is specified, the parser is not validating.
99106
Parsing will fail only if a necessary attribute is not

0 commit comments

Comments
 (0)