void () { LOG.debug("Seed is " + mySeed); int i = 0; try { for (; i < ITERATIONS; i++) { Document document = new DocumentImpl(generateRandomSequence(), true, true); document.addDocumentListener(new ValidatingListener()); int o1 = myRandom.nextInt(document.getTextLength() + 1); int o2 = myRandom.nextInt(document.getTextLength() + 1); CharSequence replacement = generateRandomSequence(); document.replaceString(Math.min(o1, o2), Math.max(o1, o2), replacement); } } catch (Throwable t) { String message = "Failed when run with seed=" + mySeed + " in iteration " + i; System.err.println(message); throw new RuntimeException(message, t); } }