Open WolfgangFahl opened 7 years ago
Since the resource is part of the medusa library, it'll always be available. This code should always work to get the referenced style sheet in Gauge
@Override
public String getUserAgentStylesheet() {
return Gauge.class.getResource("gauge.css").toExternalForm();
}
there will be a NullPointerException when a gaug is subclassed e.g. with SuperGauge extends Gauge end then new SuperGauge();
WARNUNG: Stacktrace: java.lang.NullPointerException at eu.hansolo.medusa.Gauge.getUserAgentStylesheet(Gauge.java:5219)
This is due to the assumption that the gauge.css style sheet is always available in the resources. I think it would be better to throw an Exception stating this or be lenient and only issue a warning via the logs. Since the css doesn't contain anything interesting at this time the following code works for me:
@Override public String getUserAgentStylesheet() { URL u = getClass().getResource("gauge.css"); if (u!=null) return u.toExternalForm(); else return null; }