comparison src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java @ 334:15e1961719f2

Investigate sporadic BufferUnderflowException
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 09 Nov 2011 05:22:26 +0100
parents 4c7e3ba67213
children f377f833b780
comparison
equal deleted inserted replaced
333:467fd379b653 334:15e1961719f2
413 if (debug) { 413 if (debug) {
414 byte[] xx = new byte[15]; 414 byte[] xx = new byte[15];
415 if (buffer.position() > 5) { 415 if (buffer.position() > 5) {
416 buffer.position(buffer.position() - 5); 416 buffer.position(buffer.position() - 5);
417 } 417 }
418 buffer.get(xx, 0, min(xx.length, i)); 418 buffer.get(xx, 0, min(xx.length, i-1 /*-1 for the one potentially read at buffer.get in if() */));
419 repo.getContext().getLog().debug(getClass(), "expected >>%s<< but got >>%s<<", new String(data, max(0, x - 4), min(data.length - x, 20)), new String(xx)); 419 String exp;
420 if (x < data.length) {
421 exp = new String(data, max(0, x - 4), min(data.length - x, 20));
422 } else {
423 int offset = max(0, x - 4);
424 exp = new String(data, offset, min(data.length - offset, 20));
425 }
426 repo.getContext().getLog().debug(getClass(), "expected >>%s<< but got >>%s<<", exp, new String(xx));
420 } 427 }
421 sameSoFar = false; 428 sameSoFar = false;
422 break; 429 break;
423 } 430 }
424 } 431 }