You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Java version/vendor
openjdk version "17.0.4.1" 2022-08-12 LTS
OpenJDK Runtime Environment (build 17.0.4.1+1-LTS)
OpenJDK 64-Bit Server VM (build 17.0.4.1+1-LTS, mixed mode, sharing)
OS type/version
KUbuntu 22.04
Linux
5.15.0-83-generic
x86_64
Description
My app started, but some resources didn't load in browser.
Mostly PNG images.
Debug showed a problem:
in org.eclipse.jetty.http.content.ResourceHttpContent#getLastModified we created HttpField with value as string representation of lastModified date (example: "Tue, 19 Sep 2023 08:59:00 GMT"),
but later, in org.eclipse.jetty.ee8.nested.Response.putHeaders we try to get this value as Long.
Exception as a result:
09-19;16:02:51.987 WARN [ qtp244185498-30][ o.e.j.e.n.ResourceService][]: Failed to serve resource: /images/icons/32/id_card.png
java.lang.NumberFormatException: For input string: "Tue, 19 Sep 2023 08:59:00 GMT"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
at java.base/java.lang.Long.parseLong(Long.java:711)
at java.base/java.lang.Long.parseLong(Long.java:836)
at org.eclipse.jetty.http.HttpField.getLongValue(HttpField.java:355)
at org.eclipse.jetty.ee8.nested.Response.putHeaders(Response.java:1198)
at org.eclipse.jetty.ee8.nested.ResourceService.putHeaders(ResourceService.java:717)
at org.eclipse.jetty.ee8.nested.ResourceService.sendData(ResourceService.java:564)
at org.eclipse.jetty.ee8.nested.ResourceService.doGet(ResourceService.java:279)
at org.eclipse.jetty.ee8.servlet.DefaultServlet.doGet(DefaultServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:503)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
But other images and other resources successfully loaded.
How to reproduce?
Just run jetty-12 with ee8 env, try to load image from your app class path.
How to fix
Just change org.eclipse.jetty.http.content.ResourceHttpContent#getLastModified:
public HttpField getLastModified()
{
Instant lm = _resource.lastModified();
return new HttpField.LongValueHttpField(HttpHeader.LAST_MODIFIED, DateGenerator.formatDate(lm), lm.toEpochMilli());
}
The text was updated successfully, but these errors were encountered:
Jetty version(s)
12.0.0+
Jetty Environment
ee8
Java version/vendor
openjdk version "17.0.4.1" 2022-08-12 LTS
OpenJDK Runtime Environment (build 17.0.4.1+1-LTS)
OpenJDK 64-Bit Server VM (build 17.0.4.1+1-LTS, mixed mode, sharing)
OS type/version
KUbuntu 22.04
Linux
5.15.0-83-generic
x86_64
Description
My app started, but some resources didn't load in browser.
Mostly PNG images.
Debug showed a problem:
in
org.eclipse.jetty.http.content.ResourceHttpContent#getLastModified
we created HttpField with value as string representation of lastModified date (example: "Tue, 19 Sep 2023 08:59:00 GMT"),but later, in org.eclipse.jetty.ee8.nested.Response.putHeaders we try to get this value as Long.
Exception as a result:
But other images and other resources successfully loaded.
How to reproduce?
Just run jetty-12 with ee8 env, try to load image from your app class path.
How to fix
Just change
org.eclipse.jetty.http.content.ResourceHttpContent#getLastModified
:The text was updated successfully, but these errors were encountered: