mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-27 09:58:14 +00:00
fix: The field connection with type URLConnection is not Serializable. (#2034)
An allegedly Serializable object with non-transient, non-serializable data members could cause program crashes. Method toURL() of URL class is depreceted.
This commit is contained in:
parent
3235dc2fec
commit
eedf0ac1af
@ -15,7 +15,7 @@ import org.rythmengine.resource.TemplateResourceBase;
|
||||
*/
|
||||
public class StreamTemplateResource extends TemplateResourceBase {
|
||||
private final String path;
|
||||
private URLConnection connection = null;
|
||||
private transient URLConnection connection = null;
|
||||
|
||||
public StreamTemplateResource(String path, StreamResourceLoader loader) {
|
||||
super(loader);
|
||||
@ -32,7 +32,7 @@ public class StreamTemplateResource extends TemplateResourceBase {
|
||||
try {
|
||||
final File rythm = new File(path);
|
||||
if (rythm.exists()) {
|
||||
connection = rythm.toURL().openConnection();
|
||||
connection = rythm.toURI().toURL().openConnection();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
throw new RuntimeException("Get template resource failed", ex);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user