@@ -59,47 +59,46 @@ public PluginDescriptor read(@Nonnull XmlReaderRequest request) throws XmlReader
59
59
if (inputStream == null && reader == null && path == null && url == null ) {
60
60
throw new IllegalArgumentException ("path, url, reader or inputStream must be non null" );
61
61
}
62
- return read (request , inputStream , reader , path , url );
62
+ return read (request . isAddDefaultEntities (), request . isStrict () , inputStream , reader , path , url );
63
63
}
64
64
65
65
private static PluginDescriptor read (
66
- XmlReaderRequest request , InputStream inputStream , Reader reader , Path path , URL url ) {
66
+ boolean addDefaultEntities , boolean strict , InputStream inputStream , Reader reader , Path path , URL url ) {
67
67
try {
68
68
PluginDescriptorStaxReader xml = new PluginDescriptorStaxReader ();
69
- xml .setAddDefaultEntities (request . isAddDefaultEntities () );
69
+ xml .setAddDefaultEntities (addDefaultEntities );
70
70
if (inputStream != null ) {
71
- return read (request , xml , inputStream );
71
+ return read (xml , inputStream , strict );
72
72
} else if (reader != null ) {
73
- return xml .read (reader , request . isStrict () );
73
+ return xml .read (reader , strict );
74
74
} else if (path != null ) {
75
75
try (InputStream is = Files .newInputStream (path )) {
76
- return read (request , xml , is );
76
+ return read (xml , is , strict );
77
77
}
78
78
}
79
79
try (InputStream is = url .openStream ()) {
80
- return read (request , xml , is );
80
+ return read (xml , is , strict );
81
81
}
82
82
} catch (IOException | XMLStreamException e ) {
83
83
throw new XmlReaderException ("Unable to read plugin: " + getMessage (e ), getLocation (e ), e );
84
84
}
85
85
}
86
86
87
- private static PluginDescriptor read (XmlReaderRequest request , PluginDescriptorStaxReader xml , InputStream is )
87
+ private static PluginDescriptor read (PluginDescriptorStaxReader xml , InputStream is , boolean strict )
88
88
throws XMLStreamException {
89
- return xml .read (is , request . isStrict () );
89
+ return xml .read (is , strict );
90
90
}
91
91
92
92
@ Override
93
93
public void write (XmlWriterRequest <PluginDescriptor > request ) throws XmlWriterException {
94
94
nonNull (request , "request" );
95
- PluginDescriptor content = nonNull (request .getContent (), "content" );
96
95
Path path = request .getPath ();
97
96
OutputStream outputStream = request .getOutputStream ();
98
97
Writer writer = request .getWriter ();
99
98
if (writer == null && outputStream == null && path == null ) {
100
99
throw new IllegalArgumentException ("writer, output stream, or path must be non null" );
101
100
}
102
- write (writer , content , outputStream , path );
101
+ write (writer , request . getContent () , outputStream , path );
103
102
}
104
103
105
104
private static void write (Writer writer , PluginDescriptor content , OutputStream outputStream , Path path ) {
0 commit comments