Skip to content

Commit 6c55f73

Browse files
committed
simplify the fix
1 parent 341a72f commit 6c55f73

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/org/codehaus/plexus/util/xml/pull/MXParser.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,11 @@ protected void ensureEntityCapacity()
401401
protected int bufLoadFactor = 95; // 99%
402402
// protected int bufHardLimit; // only matters when expanding
403403

404+
protected float bufferLoadFactor = bufLoadFactor / 100f;
405+
404406
protected char buf[] = new char[Runtime.getRuntime().freeMemory() > 1000000L ? READ_CHUNK_SIZE : 256];
405407

406-
protected int bufSoftLimit = ( bufLoadFactor * buf.length ) / 100; // desirable size of buffer
408+
protected int bufSoftLimit = (int) (bufferLoadFactor * buf.length); // desirable size of buffer
407409

408410
protected boolean preventBufferCompaction;
409411

@@ -3657,7 +3659,7 @@ else if ( expand )
36573659
if ( bufLoadFactor > 0 )
36583660
{
36593661
// Include fix for https://web.archive.org/web/20070831191548/http://www.extreme.indiana.edu/bugzilla/show_bug.cgi?id=228
3660-
bufSoftLimit = (int) ((((long) bufLoadFactor) * buf.length) / 100);
3662+
bufSoftLimit = (int) (bufferLoadFactor * buf.length);
36613663
}
36623664

36633665
}

0 commit comments

Comments
 (0)