Mercurial > hg4j
comparison test/org/tmatesoft/hg/test/TestStatus.java @ 399:fdc1db8f7f61 smartgit3
Issue 25: Underflow in InflaterDataAccess; test and fix for hang up when reading past end of compressed data (or zero-length data)
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Sat, 25 Feb 2012 19:31:57 +0100 |
parents | 5e95b0da26f2 |
children | 528b6780a8bd |
comparison
equal
deleted
inserted
replaced
397:5e95b0da26f2 | 399:fdc1db8f7f61 |
---|---|
535 * a) for compressedLen == 0, a byte was read and FilterDataAccess (of length 0, but it didn't help too much) was created - first byte happen to be 0. | 535 * a) for compressedLen == 0, a byte was read and FilterDataAccess (of length 0, but it didn't help too much) was created - first byte happen to be 0. |
536 * Patch was not applied (userDataAccess.isEmpty() check thanks to Issue 22) | 536 * Patch was not applied (userDataAccess.isEmpty() check thanks to Issue 22) |
537 * b) That FilterDataAccess (with 0 size represents patch more or less relevantly, but didn't represent actual revision) get successfully | 537 * b) That FilterDataAccess (with 0 size represents patch more or less relevantly, but didn't represent actual revision) get successfully |
538 * reassigned as lastUserData for the next iteration. And at the next step attempt to apply patch recorded in the next revision failed | 538 * reassigned as lastUserData for the next iteration. And at the next step attempt to apply patch recorded in the next revision failed |
539 * because baseRevisionData is 0 length FilterDataAccess | 539 * because baseRevisionData is 0 length FilterDataAccess |
540 * | |
541 * Same applies for | |
542 * Issue 25: IOException: Underflow. Rewind past end of the slice in InflaterDataAccess | |
543 * with the difference in separate .i and .d (thus not 0 but 'x' first byte was read) | |
540 * | 544 * |
541 * Sample: | 545 * Sample: |
542 * status-5/file1 has 3 revisions, second is zero-length patch: | 546 * status-5/file1 has 3 revisions, second is zero-length patch: |
543 * Index Offset Packed Actual Base Rev | 547 * Index Offset Packed Actual Base Rev |
544 * 0: 0 8 7 0 | 548 * 0: 0 8 7 0 |
549 * PATCH | 553 * PATCH |
550 */ | 554 */ |
551 @Test | 555 @Test |
552 public void testZeroLengthPatchAgainstNonEmptyBaseRev() throws Exception{ | 556 public void testZeroLengthPatchAgainstNonEmptyBaseRev() throws Exception{ |
553 repo = Configuration.get().find("status-5"); | 557 repo = Configuration.get().find("status-5"); |
554 // pretend we modified file in the working copy | 558 // pretend we modified files in the working copy |
555 // for HgWorkingCopyStatusCollector to go and retrieve its content from repository | 559 // for HgWorkingCopyStatusCollector to go and retrieve its content from repository |
556 File f1 = new File(repo.getWorkingDir(), "file1"); | 560 File f1 = new File(repo.getWorkingDir(), "file1"); |
557 f1.setLastModified(System.currentTimeMillis()); | 561 f1.setLastModified(System.currentTimeMillis()); |
562 File f3 = new File(repo.getWorkingDir(), "file3"); | |
563 f3.setLastModified(System.currentTimeMillis()); | |
558 // | 564 // |
559 HgStatusCommand cmd = new HgStatusCommand(repo); | 565 HgStatusCommand cmd = new HgStatusCommand(repo); |
560 cmd.all(); | 566 cmd.all(); |
561 StatusCollector sc = new StatusCollector(); | 567 StatusCollector sc = new StatusCollector(); |
562 cmd.execute(sc); | 568 cmd.execute(sc); |