Bug 59607 - JMeter crashes when reading large test plan (greater than 2g)

Bugzilla Id: 59607

git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1746175 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Philippe Mouawad 2016-05-30 19:42:27 +00:00
parent 4f63628784
commit 53ff0e8e5a
2 changed files with 11 additions and 12 deletions

View File

@ -480,14 +480,14 @@ public class SaveService {
* @deprecated use {@link SaveService}{@link #loadTree(File)}
*/
@Deprecated
public static HashTree loadTree(InputStream reader) throws IOException {
public static HashTree loadTree(InputStream inputStream) throws IOException {
try {
return readTree(reader, null);
return readTree(inputStream, null);
} catch(IllegalArgumentException e) {
log.error("Problem loading XML, message:"+e.getMessage(), e);
return null;
} finally {
JOrphanUtils.closeQuietly(reader);
JOrphanUtils.closeQuietly(inputStream);
}
}
@ -499,8 +499,10 @@ public class SaveService {
*/
public static HashTree loadTree(File file) throws IOException {
log.info("Loading file: " + file);
try (InputStream reader = new FileInputStream(file)){
return readTree(reader, file);
try (InputStream inputStream = new FileInputStream(file);
BufferedInputStream bufferedInputStream =
new BufferedInputStream(inputStream)){
return readTree(bufferedInputStream, file);
}
}
@ -511,16 +513,12 @@ public class SaveService {
* @return the loaded tree
* @throws IOException if there is a problem reading the file or processing it
*/
private static HashTree readTree(InputStream reader, File file)
private static HashTree readTree(InputStream inputStream, File file)
throws IOException {
if (!reader.markSupported()) {
reader = new BufferedInputStream(reader);
}
reader.mark(Integer.MAX_VALUE);
ScriptWrapper wrapper = null;
try {
// Get the InputReader to use
InputStreamReader inputStreamReader = getInputStreamReader(reader);
InputStreamReader inputStreamReader = getInputStreamReader(inputStream);
wrapper = (ScriptWrapper) JMXSAVER.fromXML(inputStreamReader);
inputStreamReader.close();
if (wrapper == null){

View File

@ -149,6 +149,7 @@ Summary
<h3>General</h3>
<ul>
<li><bug>59607</bug>JMeter crashes when reading large test plan (greater than 2g). Based on fix by Felix Draxler (felix.draxler at sap.com)</li>
</ul>
<!-- =================== Thanks =================== -->
@ -157,7 +158,7 @@ Summary
<p>We thank all contributors mentioned in bug and improvement sections above:
</p>
<ul>
<li>John Doe (john.doe at sample.com)</li>
<li>Felix Draxler (felix.draxler at sap.com)</li>
</ul>
<p>We also thank bug reporters who helped us improve JMeter. <br/>
For this release we want to give special thanks to the following reporters for the clear reports and tests made after our fixes:</p>