auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public long writeTo(int index, WritableByteChannel channel, long relativeOffset, long maxSize) throws IOException { validateIndex(index); long written = 0; BlobReadInfo blobReadInfo = blobReadInfoList.get(index); ByteBuffer outputBuffer; try { if (blobReadInfo.isPrefetched()) { outputBuffer = blobReadInfo.getPrefetchedBuffer(); } else { <START> outputBuffer = blobReadInfo.downloadBlob(cloudDestination); <END> } } catch (CloudStorageException ex) { throw new IOException("Download of cloud blob " + blobReadInfoList.get(index).getBlobId().getID() + " failed"); } logger.trace("Downloaded bytes to the write channel from the cloud blob : {}", written, blobReadInfoList.get(index).getBlobId().getID()); outputBuffer.flip(); return channel.write(outputBuffer); }</code><technical_language>In non-prefetch case, need write outputsteam in memory buffer passed channel. streamed instead</technical_language>

Target:
public long writeTo(int index, WritableByteChannel channel, long relativeOffset, long maxSize) throws IOException { validateIndex(index); long written = 0; BlobReadInfo blobReadInfo = blobReadInfoList.get(index); try { if (blobReadInfo.isPrefetched()) { ByteBuffer outputBuffer = blobReadInfo.getPrefetchedBuffer(); outputBuffer.flip(); written = channel.write(outputBuffer); } else { blobReadInfo.downloadBlob(blobStore, Channels.newOutputStream(channel)); written = blobReadInfo.getBlobSize(); } } catch (StoreException ex) { throw new IOException("Download of cloud blob " + blobReadInfoList.get(index).getBlobId().getID() + " failed"); } logger.trace("Downloaded bytes to the write channel from the cloud blob : {}", written, blobReadInfo.getBlobId().getID()); return written; }
Source:
<code>public void testCNAMECachedWhenFullChainInResponse() throws IOException { final String firstName = "firstname.com"; final String secondName = "secondname.com"; final String ipv4Addr = "1.2.3.4"; TestDnsServer dnsServer2 = new TestDnsServer(new RecordStore() { @Override public Set<ResourceRecord> getRecords(QuestionRecord question) { if (question.getDomainName().equals(firstName)) { Set<ResourceRecord> records = new LinkedHashSet<ResourceRecord>(); ResourceRecordModifier rm = new ResourceRecordModifier(); rm.setDnsClass(RecordClass.IN); rm.setDnsName(question.getDomainName()); rm.setDnsTtl(100); rm.setDnsType(RecordType.CNAME); rm.put(DnsAttribute.DOMAIN_NAME, secondName); records.add(rm.getEntry()); rm = new ResourceRecordModifier(); rm.setDnsClass(RecordClass.IN); rm.setDnsName(question.getDomainName()); rm.setDnsTtl(100); rm.setDnsType(RecordType.A); rm.put(DnsAttribute.IP_ADDRESS, ipv4Addr); records.add(rm.getEntry()); return records; } else { return null; } } }); dnsServer2.start(); DnsNameResolver resolver = null; try { DnsNameResolverBuilder builder = newResolver() .resolveCache(NoopDnsCache.INSTANCE) .recursionDesired(true) .maxQueriesPerResolve(16) .nameServerProvider(new SingletonDnsServerAddressStreamProvider(dnsServer2.localAddress())); builder.resolvedAddressTypes(ResolvedAddressTypes.IPV4_PREFERRED); resolver = builder.build(); InetAddress resolvedAddress = resolver.resolve(firstName).syncUninterruptibly().getNow(); assertEquals(ipv4Addr, resolvedAddress.getHostAddress()); assertEquals(firstName, resolvedAddress.getHostName()); resolvedAddress = resolver.resolve(firstName).syncUninterruptibly().getNow(); <START> assertEquals(ipv4Addr, resolvedAddress.getHostAddress()); <END> assertEquals(firstName, resolvedAddress.getHostName()); } finally { dnsServer2.stop(); if (resolver != null) { resolver.close(); } } }</code><technical_language>I sorry, I try this lazy. this assert fail consistently CNAME cache enabled? If so, add a variant enables cache expect failure</technical_language>

Target:
public void testCNAMECachedWhenFullChainInResponse() throws IOException { testCNAMECachedWhenFullChainInResponse(null); }
Source:
<code>public SystemColumn[] buildColumnList() throws StandardException { return new SystemColumn[]{ SystemColumnImpl.getUUIDColumn(TABLEID, false), SystemColumnImpl.getIdentifierColumn(TABLENAME, false), SystemColumnImpl.getIndicatorColumn(TABLETYPE), SystemColumnImpl.getUUIDColumn(SCHEMAID, false), SystemColumnImpl.getIndicatorColumn(LOCKGRANULARITY), SystemColumnImpl.getIdentifierColumn(VERSION, true), SystemColumnImpl.getColumn(COLSEQUENCE, Types.INTEGER, false), SystemColumnImpl.getColumn(DELIMITED, Types.VARCHAR, true), SystemColumnImpl.getColumn(ESCAPED, Types.VARCHAR, true), SystemColumnImpl.getColumn(LINES, Types.VARCHAR, true), SystemColumnImpl.getColumn(STORED, Types.VARCHAR, true), SystemColumnImpl.getColumn(LOCATION, Types.VARCHAR, true), SystemColumnImpl.getColumn(COMPRESSION, Types.VARCHAR, true), SystemColumnImpl.getColumn(IS_PINNED, Types.BOOLEAN, false), SystemColumnImpl.getColumn(PURGE_DELETED_ROWS, Types.BOOLEAN, false), <START> SystemColumnImpl.getColumn(MIN_RETENTION_PERIOD, Types.BIGINT, false), <END> }; }</code><technical_language>need define MIN_RETENTION_PERIOD nullable, existing rows upgraded versions this field, is NULL</technical_language>

Target:
public SystemColumn[] buildColumnList() throws StandardException { return new SystemColumn[]{ SystemColumnImpl.getUUIDColumn(TABLEID, false), SystemColumnImpl.getIdentifierColumn(TABLENAME, false), SystemColumnImpl.getIndicatorColumn(TABLETYPE), SystemColumnImpl.getUUIDColumn(SCHEMAID, false), SystemColumnImpl.getIndicatorColumn(LOCKGRANULARITY), SystemColumnImpl.getIdentifierColumn(VERSION, true), SystemColumnImpl.getColumn(COLSEQUENCE, Types.INTEGER, false), SystemColumnImpl.getColumn(DELIMITED, Types.VARCHAR, true), SystemColumnImpl.getColumn(ESCAPED, Types.VARCHAR, true), SystemColumnImpl.getColumn(LINES, Types.VARCHAR, true), SystemColumnImpl.getColumn(STORED, Types.VARCHAR, true), SystemColumnImpl.getColumn(LOCATION, Types.VARCHAR, true), SystemColumnImpl.getColumn(COMPRESSION, Types.VARCHAR, true), SystemColumnImpl.getColumn(IS_PINNED, Types.BOOLEAN, false), SystemColumnImpl.getColumn(PURGE_DELETED_ROWS, Types.BOOLEAN, false), SystemColumnImpl.getColumn(MIN_RETENTION_PERIOD, Types.BIGINT, true), }; }
Source:
<code>public RawTransaction setupRunTaskWithLocksThrowOnConflict(Iterable<LockRefreshToken> lockTokens) { LockImmutableTimestampResponse immutableTsResponse = timelockService.lockImmutableTimestamp( LockImmutableTimestampRequest.create()); try { LockTokenV2 immutableTsLock = immutableTsResponse.getLock(); long immutableTs = immutableTsResponse.getImmutableTimestamp(); <START> recordImmutableTimestamp(immutableTsResponse.getImmutableTimestamp()); <END> Supplier<Long> startTimestampSupplier = getStartTimestampSupplier(); AdvisoryLockPreCommitCheck advisoryLockCheck = AdvisoryLockPreCommitCheck.forLockServiceLocks(lockTokens, getLockService()); SnapshotTransaction transaction = createTransaction(immutableTs, startTimestampSupplier, immutableTsLock, advisoryLockCheck); return new RawTransaction(transaction, immutableTsLock); } catch (Throwable e) { timelockService.unlock(ImmutableSet.of(immutableTsResponse.getLock())); throw Throwables.rewrapAndThrowUncheckedException(e); } }</code><technical_language>nit: immutableTs</technical_language>

Target:
public RawTransaction setupRunTaskWithLocksThrowOnConflict(Iterable<LockRefreshToken> lockTokens) { LockImmutableTimestampResponse immutableTsResponse = timelockService.lockImmutableTimestamp( LockImmutableTimestampRequest.create()); try { LockTokenV2 immutableTsLock = immutableTsResponse.getLock(); long immutableTs = immutableTsResponse.getImmutableTimestamp(); recordImmutableTimestamp(immutableTs); Supplier<Long> startTimestampSupplier = getStartTimestampSupplier(); AdvisoryLockPreCommitCheck advisoryLockCheck = AdvisoryLockPreCommitCheck.forLockServiceLocks(lockTokens, getLockService()); SnapshotTransaction transaction = createTransaction(immutableTs, startTimestampSupplier, immutableTsLock, advisoryLockCheck); return new RawTransaction(transaction, immutableTsLock); } catch (Throwable e) { timelockService.unlock(ImmutableSet.of(immutableTsResponse.getLock())); throw Throwables.rewrapAndThrowUncheckedException(e); } }
Source:
<code>private void exportJson(){ BulkExportServices bulkExportServices = uris -> { List<Object> list = Arrays.asList(uris.toArray()); for(Object i:list) { if(!(urisList.contains(i))) throw new InternalError("urisList does not contain "+i.toString()); urisList.remove(i); } return null; }; StructuredQueryBuilder structuredQueryBuilder = new StructuredQueryBuilder(); <START> structuredQueryBuilder.directory(1,"/example/cookbook/bulkExport/"); <END> QueryBatcher queryBatcher = moveMgr.newQueryBatcher(structuredQueryBuilder.collection("BulkExportWithDataService")) .withBatchSize(3) .withThreadCount(3) .onQueryFailure(batch -> new InternalError("An exception occured in queryBatcher")) .onUrisReady(batch -> bulkExportServices.readJsonDocs(Stream.of(batch.getItems()))); moveMgr.startJob(queryBatcher); queryBatcher.awaitCompletion(); moveMgr.stopJob(queryBatcher); }</code><technical_language>collection() query line, I need directory query, simplify removing it</technical_language>

Target:
private void exportJson(){ BulkExportServices bulkExportServices = BulkExportServices.on(dbClient); StructuredQueryBuilder structuredQueryBuilder = new StructuredQueryBuilder(); AtomicInteger docCount = new AtomicInteger(); QueryBatcher queryBatcher = moveMgr.newQueryBatcher(structuredQueryBuilder.collection("BulkExportWithDataService")) .withBatchSize(3) .withThreadCount(3) .onQueryFailure(batch -> new InternalError("An exception occured in queryBatcher")) .onUrisReady(batch -> (bulkExportServices.readJsonDocs(Stream.of(batch.getItems()))) .forEach(reader -> { try { BufferedReader br = new BufferedReader(reader); StringBuilder out = new StringBuilder(); String line; while ((line = br.readLine()) != null) { out.append(line); docCount.getAndIncrement(); } System.out.println(out.toString()); reader.close(); } catch (IOException e) { e.printStackTrace(); } })); moveMgr.startJob(queryBatcher); queryBatcher.awaitCompletion(); moveMgr.stopJob(queryBatcher); if(docCount.get()!= count) throw new InternalError("Mismatch between the number of documents written and read from the database."); }
Source:
<code>private void setupNav(InlineHyperlink link, int key, String help, FileInfo info) { if (info != null) { final String url = url(info); link.setTargetHistoryToken(url); link.setTitle(getFileName(info.path())); keys.add(new KeyCommand(0, key, help) { @Override public void onKeyPress(KeyPressEvent event) { Gerrit.display(url); } }); } else { <START> link.setVisible(false); <END> keys.add(new UpToChangeCommand2(patchSetId, 0, key)); } }</code><technical_language>visibility object occupying space in page. This means left arrows in position right arrow is hidden</technical_language>

Target:
private void setupNav(InlineHyperlink link, int key, String help, FileInfo info) { if (info != null) { final String url = url(info); link.setTargetHistoryToken(url); link.setTitle(getFileName(info.path())); keys.add(new KeyCommand(0, key, help) { @Override public void onKeyPress(KeyPressEvent event) { Gerrit.display(url); } }); } else { link.getElement().getStyle().setVisibility(Visibility.HIDDEN); keys.add(new UpToChangeCommand2(patchSetId, 0, key)); } }
Source:
<code>private String buildURL() { try { final URL parsedUrl = new URL(url); String host = parsedUrl.getHost(); final String[] pieces = host.split("\\."); if (pieces.length > 1) { final String product = pieces[0]; final String domain = joinIgnoreNull(".", pieces[pieces.length - 2], pieces[pieces.length - 1]); String targetRegion = region; String targetEdge = edge; if (pieces.length == 4) { targetRegion = targetRegion != null ? targetRegion : pieces[1]; } else if (pieces.length == 5) { targetEdge = targetEdge != null ? targetEdge : pieces[1]; targetRegion = targetRegion != null ? targetRegion : pieces[2]; } if (targetEdge != null && targetRegion == null) targetRegion = DEFAULT_REGION; host = joinIgnoreNull(".", product, targetEdge, targetRegion, domain); } String getQuery = ""; if( parsedUrl.getQuery() != null ) { getQuery = "?" + parsedUrl.getQuery(); } String getFragment = ""; if( parsedUrl.getRef() != null ) { getFragment = "#" + parsedUrl.getRef(); } String constructedURI = new URI( parsedUrl.getProtocol(), parsedUrl.getUserInfo(), host, parsedUrl.getPort(), parsedUrl.getPath(), null,null).toString() + getQuery + getFragment; <START> return new URI(constructedURI).toString(); <END> } catch (final MalformedURLException | URISyntaxException e) { throw new ApiException("Bad URL: " + url, e); } }</code><technical_language>new URI().toString() a new URI().toString()? This more overly-complicated. drop usage of URI construct URL similar do in other languages</technical_language>

Target:
private String buildURL() { try { final URL parsedUrl = new URL(url); String host = parsedUrl.getHost(); final String[] pieces = host.split("\\."); if (pieces.length > 1) { final String product = pieces[0]; final String domain = joinIgnoreNull(".", pieces[pieces.length - 2], pieces[pieces.length - 1]); String targetRegion = region; String targetEdge = edge; if (pieces.length == 4) { targetRegion = targetRegion != null ? targetRegion : pieces[1]; } else if (pieces.length == 5) { targetEdge = targetEdge != null ? targetEdge : pieces[1]; targetRegion = targetRegion != null ? targetRegion : pieces[2]; } if (targetEdge != null && targetRegion == null) targetRegion = DEFAULT_REGION; host = joinIgnoreNull(".", product, targetEdge, targetRegion, domain); } String urlPort = parsedUrl.getPort() != -1 ? ":" + parsedUrl.getPort() : null; String protocol = parsedUrl.getProtocol() + "://"; String[] pathPieces = parsedUrl.getPath().split("/"); for (int i = 0; i < pathPieces.length; i++) { pathPieces[i] = URLEncoder.encode(pathPieces[i], "UTF-8"); } String encodedPath = Joiner.on("/").join(pathPieces); String query = parsedUrl.getQuery() != null ? "?" + parsedUrl.getQuery() : null; String ref = parsedUrl.getRef() != null ? "#" + parsedUrl.getRef() : null; String credentials = parsedUrl.getUserInfo() != null ? parsedUrl.getUserInfo() + "@" : null; return joinIgnoreNull("", protocol, credentials, host, urlPort, encodedPath, query, ref); } catch (final MalformedURLException | UnsupportedEncodingException e) { throw new ApiException("Bad URL: " + url, e); } }
Source:
<code>public void testDisabledDebugLogPrinting() { Logger logger = createLogger(LogLevel.INFO); String debug = "debug"; logger.debug(debug); <START> assertLastMessageIsNull(); <END> }</code><technical_language>+1: here, ..isNull() clear checking message is null</technical_language>

Target:
public void testDisabledDebugLogPrinting() { Logger logger = createLogger(LogLevel.INFO); String message = "debug"; logger.debug(message); assertNothingIsLogged(); }
Source:
<code>void test() { <START> MethodDefinedInSupertype i = new MethodOverrideInSubtype(); <END> expectsSibling1(shouldReturnSibling1()); }</code><technical_language>is purpose of this line of test</technical_language>

Target:
void test() { expectsSibling1(shouldReturnSibling1()); }
Source:
<code>public void testProcessEapMessageResponse() throws Exception { EapCallback eapCallback = new EapCallback() { @Override public void onResponse(byte[] eapMsg) { assertArrayEquals(EAP_SIM_RESPONSE_PACKET, eapMsg); synchronized (mCallbackLock) { assertFalse("Callback has already been fired", mCallbackFired); mCallbackFired = true; <START> mCallbackLock.notifyAll(); <END> } } }; EapResponse eapResponse = new EapResponse(EAP_SIM_RESPONSE_PACKET); when(mMockEapStateMachine.process(eq(EAP_REQUEST_SIM_START_PACKET))) .thenReturn(eapResponse); getEapAuthenticatorWithCallback(eapCallback) .processEapMessage(EAP_REQUEST_SIM_START_PACKET); synchronized (mCallbackLock) { mCallbackLock.wait(TEST_TIMEOUT_MILLIS); assertTrue(mCallbackFired); } verify(mMockEapStateMachine).process(eq(EAP_REQUEST_SIM_START_PACKET)); verifyNoMoreInteractions(mMockEapStateMachine); }</code><technical_language>Hmm, of this earlier, neater do this VerificationWithTimeout mock methods. mock eapCallback, assert callback fired a timeout. I rid of locks booleans entirely, sit easier read</technical_language>

Target:
public void testProcessEapMessageResponse() { EapCallback eapCallback = new EapCallback() { @Override public void onResponse(byte[] eapMsg) { assertArrayEquals(EAP_SIM_RESPONSE_PACKET, eapMsg); assertFalse("Callback has already been fired", mCallbackFired); mCallbackFired = true; } }; EapResponse eapResponse = new EapResponse(EAP_SIM_RESPONSE_PACKET); when(mMockEapStateMachine.process(eq(EAP_REQUEST_SIM_START_PACKET))) .thenReturn(eapResponse); getEapAuthenticatorWithCallback(eapCallback) .processEapMessage(EAP_REQUEST_SIM_START_PACKET); mTestLooper.dispatchAll(); assertTrue("Callback didn't fire", mCallbackFired); verify(mMockEapStateMachine).process(eq(EAP_REQUEST_SIM_START_PACKET)); verifyNoMoreInteractions(mMockEapStateMachine); }
Source:
<code>public ReviewCard(String webUrl) throws CardBuilderException { this.cardType = CardType.REVIEW; <START> webUrl(webUrl); <END> MetaTagModel metaTagModel = MetaTagExtractor.getMetaTags(this.webUrl); review(new ReviewBuilder(metaTagModel).build()); }</code><technical_language>for super()</technical_language>

Target:
public ReviewCard(String webUrl) throws CardBuilderException { super(webUrl); this.cardType = CardType.REVIEW; review(new ReviewBuilder(this.getMetaTagModel()).build()); }
Source:
<code>private String prepareEntityNamesForMessage(List<String> entityNames) { StringBuilder domainNamesForMessage = new StringBuilder(); for (String domainName : entityNames) { domainNamesForMessage.append(domainName); domainNamesForMessage.append(","); } domainNamesForMessage.deleteCharAt(domainNamesForMessage.length() - 1); <START> return domainNamesForMessage.toString(); <END> }</code><technical_language>This entire function changed a simple StringUtils.join(entityNames, ",")</technical_language>

Target:
private String prepareEntityNamesForMessage(List<String> entityNames) { return StringUtils.join(entityNames, ","); }
Source:
<code>public CompletableFuture<Void> joinGame(Game game, String password) { if (isRunning()) { logger.debug("Game is running, ignoring join request"); return completedFuture(null); } logger.info("Joining game: '{}' ({})", game.getTitle(), game.getId()); stopSearchLadder1v1(); Map<String, Integer> featuredModVersions = game.getFeaturedModVersions(); Set<String> simModUIds = game.getSimMods().keySet(); return modService.getFeaturedMod(game.getFeaturedMod()) .thenCompose(featuredModBean -> updateGameIfNecessary(featuredModBean, null, featuredModVersions, simModUIds)) .thenAccept(aVoid -> { try { modService.enableSimMods(simModUIds); } catch (IOException e) { <START> logger.warn("SimMods were not enabled", e); <END> } }) .thenCompose(aVoid -> downloadMapIfNecessary(game.getMapFolderName())) .thenCompose(aVoid -> fafService.requestJoinGame(game.getId(), password)) .thenAccept(gameLaunchMessage -> { synchronized (currentGame) { game.setPassword(password); currentGame.set(game); } startGame(gameLaunchMessage, null, RatingMode.GLOBAL); }); }</code><technical_language>SimMods enabled</technical_language>

Target:
public CompletableFuture<Void> joinGame(Game game, String password) { if (isRunning()) { logger.debug("Game is running, ignoring join request"); return completedFuture(null); } logger.info("Joining game: '{}' ({})", game.getTitle(), game.getId()); stopSearchLadder1v1(); Map<String, Integer> featuredModVersions = game.getFeaturedModVersions(); Set<String> simModUIds = game.getSimMods().keySet(); return modService.getFeaturedMod(game.getFeaturedMod()) .thenCompose(featuredModBean -> updateGameIfNecessary(featuredModBean, null, featuredModVersions, simModUIds)) .thenAccept(aVoid -> { try { modService.enableSimMods(simModUIds); } catch (IOException e) { logger.warn("SimMods could not be enabled", e); } }) .thenCompose(aVoid -> downloadMapIfNecessary(game.getMapFolderName())) .thenCompose(aVoid -> fafService.requestJoinGame(game.getId(), password)) .thenAccept(gameLaunchMessage -> { synchronized (currentGame) { game.setPassword(password); currentGame.set(game); } startGame(gameLaunchMessage, null, RatingMode.GLOBAL); }); }
Source:
<code>public Predicate<String> provideServerStoppedPredicate(final DimensionDataCloudControlApi api, final ComputeServiceConstants.Timeouts timeouts, final ComputeServiceConstants.PollPeriod pollPeriod) { <START> return retry(new ServerStatus(api.getServerApi(), false, true), timeouts.imageAvailable, <END> pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod); }</code><technical_language>timeouts.nodeSuspended</technical_language>

Target:
public Predicate<String> provideServerStoppedPredicate(final DimensionDataCloudControlApi api, final ComputeServiceConstants.Timeouts timeouts, final ComputeServiceConstants.PollPeriod pollPeriod) { return retry(new ServerStatus(api.getServerApi(), false, true), timeouts.nodeSuspended, pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod); }
Source:
<code>public void onWebSocketConnect(final Session frontEndSession) { container = ContainerProvider.getWebSocketContainer(); container.setDefaultMaxBinaryMessageBufferSize(Integer.MAX_VALUE); <START> container.setDefaultMaxTextMessageBufferSize(Integer.MAX_VALUE); <END> final ProxyInboundClient backendSocket = new ProxyInboundClient(getMessageCallback()); try { backendSession = container.connectToServer(backendSocket, clientConfig, backend); LOG.onConnectionOpen(backend.toString()); } catch (DeploymentException e) { LOG.connectionFailed(e); throw new RuntimeException(e); } catch (IOException e) { LOG.connectionFailed(e); throw new RuntimeIOException(e); } super.onWebSocketConnect(frontEndSession); this.frontendSession = frontEndSession; }</code><technical_language>great configs for this instead of hard coding Integer.MAX_VALUE. I looked easy is access gateway config here</technical_language>

Target:
public void onWebSocketConnect(final Session frontEndSession) { container = ContainerProvider.getWebSocketContainer(); container.setDefaultMaxTextMessageBufferSize(frontEndSession.getPolicy().getMaxTextMessageBufferSize()); container.setDefaultMaxBinaryMessageBufferSize(frontEndSession.getPolicy().getMaxBinaryMessageBufferSize()); container.setAsyncSendTimeout(frontEndSession.getPolicy().getAsyncWriteTimeout()); container.setDefaultMaxSessionIdleTimeout(frontEndSession.getPolicy().getIdleTimeout()); final ProxyInboundClient backendSocket = new ProxyInboundClient(getMessageCallback()); try { backendSession = container.connectToServer(backendSocket, clientConfig, backend); LOG.onConnectionOpen(backend.toString()); } catch (DeploymentException e) { LOG.connectionFailed(e); throw new RuntimeException(e); } catch (IOException e) { LOG.connectionFailed(e); throw new RuntimeIOException(e); } super.onWebSocketConnect(frontEndSession); this.frontendSession = frontEndSession; }
Source:
<code>protected void registerConfigProvider(ConfigProvider configProvider) { try { permissionConfig = configProvider.getConfigurationObject(PermissionConfig.class); } catch (ConfigurationException e) { <START> log.error("Error occurred while fetching permission configuration.", e); <END> throw new PermissionException("Error occurred while fetching permission configuration.", e); } }</code><technical_language>exception is logged thrown? reason</technical_language>

Target:
protected void registerConfigProvider(ConfigProvider configProvider) { try { permissionConfig = configProvider.getConfigurationObject(PermissionConfig.class); } catch (ConfigurationException e) { throw new PermissionException("Error occurred while fetching permission configuration.", e); } }
Source:
<code>private void validateAndNormalizeEventRecord(DatastreamProducerRecord record) { Validate.notNull(record, "null event record."); Validate.notNull(record.getEvents(), "null event payload."); Validate.notNull(record.getCheckpoint(), "null event checkpoint."); for (Pair<byte[], byte[]> event : record.getEvents()) { Validate.notNull(event, "null event"); Validate.notNull(event.getKey(), "null key"); <START> Validate.notNull(event.getValue(), "null payload"); <END> } }</code><technical_language>Again, "value", "payload", "event".. interchangeable confusing</technical_language>

Target:
private void validateAndNormalizeEventRecord(DatastreamProducerRecord record) { Validate.notNull(record, "null event record."); Validate.notNull(record.getEvents(), "null event payload."); Validate.notNull(record.getCheckpoint(), "null event checkpoint."); for (Pair<byte[], byte[]> event : record.getEvents()) { Validate.notNull(event, "null event"); Validate.notNull(event.getKey(), "null key"); Validate.notNull(event.getValue(), "null value"); } }
Source:
<code><START> public PinotConfiguration clone() { <END> return new PinotConfiguration(ConfigurationUtils.cloneConfiguration(configuration)); }</code><technical_language>java docs please</technical_language>

Target:
public PinotConfiguration clone() { return new PinotConfiguration(configuration); }
Source:
<code>public int update(String table, String key, HashMap<String, ByteIterator> values) { try { MongoCollection<Document> collection = database.getCollection(table); Document query = new Document("_id", key); Document fieldsToSet = new Document(); for (Map.Entry<String, ByteIterator> entry : values.entrySet()) { fieldsToSet.put(entry.getKey(), entry.getValue().toArray()); } Document update = new Document("$set", fieldsToSet); UpdateResult result = collection.updateOne(query, update); if (result.wasAcknowledged() && result.getMatchedCount() == 0) { System.err.println("Nothing updated for key " + key); <START> return StatusCode.ERROR; <END> } return StatusCode.OK; } catch (Exception e) { System.err.println(e.toString()); return StatusCode.ERROR; } }</code><technical_language>ERROR->NOT_FOUND</technical_language>

Target:
public Status update(String table, String key, HashMap<String, ByteIterator> values) { try { MongoCollection<Document> collection = database.getCollection(table); Document query = new Document("_id", key); Document fieldsToSet = new Document(); for (Map.Entry<String, ByteIterator> entry : values.entrySet()) { fieldsToSet.put(entry.getKey(), entry.getValue().toArray()); } Document update = new Document("$set", fieldsToSet); UpdateResult result = collection.updateOne(query, update); if (result.wasAcknowledged() && result.getMatchedCount() == 0) { System.err.println("Nothing updated for key " + key); return Status.NOT_FOUND; } return Status.OK; } catch (Exception e) { System.err.println(e.toString()); return Status.ERROR; } }
Source:
<code>public static JSONObject jsonForPropertyChange(int propertyName, int newState) { String name; switch (propertyName) { case 0: name = "torchOn"; break; case 1: name = "switchCamera"; break; case 2: name = "recognitionMode"; break; <START> case 3: <END> name = "relativeZoom"; break; default: name = ""; break; } JSONObject json = new JSONObject(); try { json.put("name", name); json.put("newState", newState); } catch (JSONException e) { e.printStackTrace(); } return json; }</code><technical_language>constants for this switch instead of ints</technical_language>

Target:
public static JSONObject jsonForPropertyChange(int propertyName, int newState) { String name; switch (propertyName) { case PropertyChangeListener.TORCH: name = "torchOn"; break; case PropertyChangeListener.SWITCH_CAMERA: name = "switchCamera"; break; case PropertyChangeListener.RECOGNITION_MODE: name = "recognitionMode"; break; case PropertyChangeListener.RELATIVE_ZOOM: name = "relativeZoom"; break; default: name = ""; break; } JSONObject json = new JSONObject(); try { json.put("name", name); json.put("newState", newState); } catch (JSONException e) { e.printStackTrace(); } return json; }
Source:
<code><START> public void unsubscribe(String topic, TopicListener<String> topicListener) { <END> if (topic == null) { throw new IllegalArgumentException("topic cannot be null"); } if (topicListener == null) { throw new IllegalArgumentException("topicListener cannot be null"); } String topicPath = makeTopicPath(topic); HelixPropertyListener helixListener = topicListenerToHelixListenerMap.remove(topicListener); helixStore.unsubscribe(topicPath, helixListener); List<TopicListener> topicListeners = topicToListenerMap.get(topic); if (topicListeners != null) { topicListeners.remove(topicListener); } }</code><technical_language>point some docs APIs if available</technical_language>

Target:
public void unsubscribe(String topic, TopicListener<String> topicListener) { if (topic == null) { throw new IllegalArgumentException("topic cannot be null"); } if (topicListener == null) { throw new IllegalArgumentException("topicListener cannot be null"); } String topicPath = getTopicPath(topic); HelixPropertyListener helixListener = topicListenerToHelixListenerMap.remove(topicListener); helixStore.unsubscribe(topicPath, helixListener); logger.trace("TopicListener={} has been unsubscribed from topic={}", topicListener, topic); }
Source:
<code>private Constraint distanceToPreviousStandstill(ConstraintFactory constraintFactory) { return constraintFactory.from(Visit.class) .penalizeLong("Distance to previous standstill", <START> SimpleLongScore.of(1), <END> Visit::getDistanceFromPreviousStandstill); }</code><technical_language>SimpleLongScore.ONE</technical_language>

Target:
private Constraint distanceToPreviousStandstill(ConstraintFactory constraintFactory) { return constraintFactory.from(Visit.class) .penalizeLong("Distance to previous standstill", SimpleLongScore.ONE, Visit::getDistanceFromPreviousStandstill); }
Source:
<code>private ITmfTrace put(String path, String name, String typeID) throws TmfTraceException, TmfTraceImportException, InstantiationException, IllegalAccessException { List<TraceTypeHelper> traceTypes = TmfTraceType.selectTraceType(path, typeID); if (traceTypes.isEmpty()) { return null; } TraceTypeHelper helper = traceTypes.get(0); ITmfTrace trace = helper.getTraceClass().newInstance(); org.eclipse.core.runtime.Path ipath = new org.eclipse.core.runtime.Path(path); <START> IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(ipath); <END> trace.initTrace(resource, path, ITmfEvent.class, name, typeID); trace.indexTrace(false); TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, trace, null)); return trace; }</code><technical_language>resource null here. need "import" trace workspace provide a workspace relative path</technical_language>

Target:
private ITmfTrace put(String path, String name, String typeID) throws TmfTraceException, TmfTraceImportException, InstantiationException, IllegalAccessException { List<TraceTypeHelper> traceTypes = TmfTraceType.selectTraceType(path, typeID); if (traceTypes.isEmpty()) { return null; } IResource resource; try { resource = getResource(path); } catch (CoreException e) { Activator.getInstance().logError(e.getMessage(), e); return null; } TraceTypeHelper helper = traceTypes.get(0); ITmfTrace trace = helper.getTraceClass().newInstance(); trace.initTrace(resource, path, ITmfEvent.class, name, typeID); trace.indexTrace(false); TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, trace, null)); return trace; }
Source:
<code><START> private Set<TemplateParam> getRequiredParamSet(TemplateDelegateNode delTemplate) { <END> Set<TemplateParam> paramSet = new HashSet<>(); for (TemplateParam param : delTemplate.getParams()) { if (param.isRequired()) { paramSet.add(param); } } return paramSet; }</code><technical_language>static</technical_language>

Target:
private static Set<TemplateParam> getRequiredParamSet(TemplateDelegateNode delTemplate) { Set<TemplateParam> paramSet = new HashSet<>(); for (TemplateParam param : delTemplate.getParams()) { if (param.isRequired()) { paramSet.add(param); } } return paramSet; }
Source:
<code>public Launcher createLauncher(TaskListener listener) { SlaveComputer c = getComputer(); if (c == null) { listener.error("Issue with creating launcher for agent " + name + ". Computer has been disconnected"); return new Launcher.DummyLauncher(listener); } else { Slave node = c.getNode(); if (node != this) { String message = "Issue with creating launcher for agent " + name + ". Computer has been reconnected"; if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, message, new IllegalStateException("Computer has been reconnected, this Node instance cannot be used anymore")); } return new Launcher.DummyLauncher(listener); } final Channel channel = c.getChannel(); <START> final Boolean isUnix = channel != null ? c.isUnix() : null; END> if (channel == null || isUnix == null ) { String message = "Issue with creating launcher for agent " + name + ". No remoting channel to the agent OR it has not been fully initialized yet."; listener.error(message); if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, message + "Probably there is a race condition with Agent reconnection, check other log entries" , new IllegalStateException("Channel is null for the agent " + name)); } return new Launcher.DummyLauncher(listener); } return new RemoteLauncher(listener, channel, isUnix).decorateFor(this); } }</code><technical_language>channel != null && !channel.isClosingOrClosed()</technical_language>

Target:
public Launcher createLauncher(TaskListener listener) { SlaveComputer c = getComputer(); if (c == null) { listener.error("Issue with creating launcher for agent " + name + ". Computer has been disconnected"); return new Launcher.DummyLauncher(listener); } else { Slave node = c.getNode(); if (node != this) { String message = "Issue with creating launcher for agent " + name + ". Computer has been reconnected"; if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, message, new IllegalStateException("Computer has been reconnected, this Node instance cannot be used anymore")); } return new Launcher.DummyLauncher(listener); } final Channel channel = c.getChannel(); if (channel == null) { reportLauncerCreateError("The agent has not been fully initialized yet", "No remoting channel to the agent OR it has not been fully initialized yet", listener); return new Launcher.DummyLauncher(listener); } if (channel.isClosingOrClosed()) { reportLauncerCreateError("The agent is being disconnected", "Remoting channel is either in the process of closing down or has closed down", listener); return new Launcher.DummyLauncher(listener); } final Boolean isUnix = c.isUnix(); if (isUnix == null) { reportLauncerCreateError("The agent has not been fully initialized yet", "Cannot determing if the agent is a Unix one, the System status request has not completed yet. " + "It is an invalid channel state, please report a bug to Jenkins if you see it.", listener); return new Launcher.DummyLauncher(listener); } return new RemoteLauncher(listener, channel, isUnix).decorateFor(this); } }
Source:
<code>private boolean isEcho(String dsid, short sceneId) { if (structureManager.getDeviceByDSUID(dsid) != null) { dsid = structureManager.getDeviceByDSUID(dsid).getDSID().getValue(); } String echo = dsid + "-" + sceneId; <START> logger.debug(echo); <END> return isEcho(echo); }</code><technical_language>This debug output is useless if print a of a variable description represents</technical_language>

Target:
private boolean isEcho(String dsid, short sceneId) { if (structureManager.getDeviceByDSUID(dsid) != null) { dsid = structureManager.getDeviceByDSUID(dsid).getDSID().getValue(); } String echo = dsid + "-" + sceneId; logger.debug("An echo scene event was detected: {}", echo); return isEcho(echo); }
Source:
<code>CompactAllPolicy(StoreConfig storeConfig, Time time) { this.storeConfig = storeConfig; this.time = time; <START> this.messageRetentionTimeInMs = (long) storeConfig.storeDeletedMessageRetentionDays * Time.SecsPerDay * Time.MsPerSec; <END> }</code><technical_language>This is fixed in a (using preferred TimeUnit utilities) part of [this](<LINK_0> patch</technical_language>

Target:
CompactAllPolicy(StoreConfig storeConfig, Time time) { this.storeConfig = storeConfig; this.time = time; this.messageRetentionTimeInMs = storeConfig.storeDeletedMessageRetentionDays * Time.SecsPerDay * Time.MsPerSec; }
Source:
<code>public void init(String name, Class<? extends ITmfEvent> type) { super.init(name); fType = type; fDataQueue = (fQueueSize > 1) ? new LinkedBlockingQueue<ITmfEvent>(fQueueSize) : new SynchronousQueue<ITmfEvent>(); <START> if (fExecutor != null) { <END> fExecutor.stop(); } fExecutor = new TmfRequestExecutor(); fSignalDepth = 0; fLogData = TmfCoreTracer.isEventTraced(); TmfProviderManager.register(fType, this); }</code><technical_language>Do call init multiple times a trace is a safe-guard? curious</technical_language>

Target:
public void init(String name, Class<? extends ITmfEvent> type) { super.init(name); fType = type; fDataQueue = (fQueueSize > 1) ? new LinkedBlockingQueue<ITmfEvent>(fQueueSize) : new SynchronousQueue<ITmfEvent>(); fExecutor.init(); fSignalDepth = 0; fLogData = TmfCoreTracer.isEventTraced(); TmfProviderManager.register(fType, this); }
Source:
<code>Iterator<Event> iterator(EventStreamQuery query) { checkNotNull(query); final EntityFilters filters = toEntityFilters(query); final Iterator<EEntity> entities = find(filters, FieldMask.getDefaultInstance()); final Predicate<EEntity> detailedLookupFilter = createEntityFilter(query); final Iterator<EEntity> filtered = filter(entities, detailedLookupFilter); final List<EEntity> mutableList = newArrayList(filtered); sort(mutableList, comparator()); <START> final Iterator<Event> result = Iterators.transform(mutableList.iterator(), getEventFunc()); <END> return result; }</code><technical_language>standardize invoking transform(). Other parts of code static import it. this line read: java final Iterator<Event> result = transform(eventEntities, toEvent()); ... assumes renaming getEventFunc() toEvent()</technical_language>

Target:
Iterator<Event> iterator(EventStreamQuery query) { checkNotNull(query); final EntityFilters filters = toEntityFilters(query); final Iterator<EEntity> entities = find(filters, FieldMask.getDefaultInstance()); final Predicate<EEntity> detailedLookupFilter = createEntityFilter(query); final Iterator<EEntity> filtered = filter(entities, detailedLookupFilter); final List<EEntity> entityList = newArrayList(filtered); sort(entityList, comparator()); final Iterator<Event> result = transform(entityList.iterator(), getEvent()); return result; }
Source:
<code>public void setUp() throws Exception { super.setUp(); actionGroup = RandomUtils.instance().pickRandom(ActionGroup.values()); when(getQueryParameters().getActionGroup()).thenReturn(actionGroup); sessionID = RandomUtils.instance().nextString(10); when(getQueryParameters().getSessionId()).thenReturn(sessionID); DbFacade dbFacadeMock = mock(DbFacade.class); EngineSessionDAO engineSessionDAOMock = mock(EngineSessionDAO.class); when(engineSessionDAOMock.save(any(EngineSession.class))).thenReturn(RandomUtils.instance().nextLong()); when(engineSessionDAOMock.remove(any(Long.class))).thenReturn(1); <START> when(engineSessionDAOMock.remove(any(Long.class))).thenReturn(1); <END> when(dbFacadeMock.getEngineSessionDao()).thenReturn(engineSessionDAOMock); PermissionDAO permissionsDAOMock = mock(PermissionDAO.class); when(permissionsDAOMock.getAllForEntity(any(Guid.class), any(Guid.class), any(Boolean.class))).thenReturn(new ArrayList<Permissions>()); when(dbFacadeMock.getPermissionDao()).thenReturn(permissionsDAOMock); SessionDataContainer.getInstance().setDbFacade(dbFacadeMock); SessionDataContainer.getInstance().setUser(sessionID, getUser()); }</code><technical_language>this line is duplicated ??</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); actionGroup = RandomUtils.instance().pickRandom(ActionGroup.values()); when(getQueryParameters().getActionGroup()).thenReturn(actionGroup); sessionID = RandomUtils.instance().nextString(10); when(getQueryParameters().getSessionId()).thenReturn(sessionID); DbFacade dbFacadeMock = mock(DbFacade.class); EngineSessionDAO engineSessionDAOMock = mock(EngineSessionDAO.class); when(engineSessionDAOMock.save(any(EngineSession.class))).thenReturn(RandomUtils.instance().nextLong()); when(engineSessionDAOMock.remove(any(Long.class))).thenReturn(1); when(dbFacadeMock.getEngineSessionDao()).thenReturn(engineSessionDAOMock); PermissionDAO permissionsDAOMock = mock(PermissionDAO.class); when(permissionsDAOMock.getAllForEntity(any(Guid.class), any(Guid.class), any(Boolean.class))).thenReturn(new ArrayList<Permissions>()); when(dbFacadeMock.getPermissionDao()).thenReturn(permissionsDAOMock); SessionDataContainer.getInstance().setDbFacade(dbFacadeMock); SessionDataContainer.getInstance().setUser(sessionID, getUser()); }
Source:
<code>public void setUp() throws Exception { BUNDLE_DIR = new File(TEST_PLUGIN_BUNDLE_PATH); monitor = mock(DefaultPluginJarLocationMonitor.class); registry = mock(DefaultPluginRegistry.class); goPluginOSGiFramework = mock(GoPluginOSGiFramework.class); jarChangeListener = mock(DefaultPluginJarChangeListener.class); systemEnvironment = mock(SystemEnvironment.class); when(systemEnvironment.get(PLUGIN_BUNDLE_PATH)).thenReturn(TEST_PLUGIN_BUNDLE_PATH); when(systemEnvironment.get(PLUGIN_FRAMEWORK_ENABLED)).thenReturn(Boolean.TRUE); <START> applicationAccessor = mock(GoApplicationAccessor.class); <END> }</code><technical_language>a other mocks higher in this method. This moved them</technical_language>

Target:
public void setUp() throws Exception { BUNDLE_DIR = new File(TEST_PLUGIN_BUNDLE_PATH); monitor = mock(DefaultPluginJarLocationMonitor.class); registry = mock(DefaultPluginRegistry.class); goPluginOSGiFramework = mock(GoPluginOSGiFramework.class); jarChangeListener = mock(DefaultPluginJarChangeListener.class); systemEnvironment = mock(SystemEnvironment.class); applicationAccessor = mock(GoApplicationAccessor.class); when(systemEnvironment.get(PLUGIN_BUNDLE_PATH)).thenReturn(TEST_PLUGIN_BUNDLE_PATH); when(systemEnvironment.get(PLUGIN_FRAMEWORK_ENABLED)).thenReturn(Boolean.TRUE); }
Source:
<code>public Object[][] identifyContaminantTestDataProvider() { <START> final Path NA12878_fingerprint = Paths.get(TEST_DATA_DIR.getAbsolutePath(), "NA12878_chr1_fingerprint.vcf"); <END> final Path NA24385_fingerprint = Paths.get(TEST_DATA_DIR.getAbsolutePath(), "NA24385_chr1_fingerprint.vcf"); final Path NA12878_contaminated_by_NA24358 = Paths.get(TEST_DATA_DIR.getAbsolutePath(), "NA12878_contaminated_with_NA24385_at_10_pct_chr1_fingerprint_sites.bam"); final Path NA24385_contaminated_by_NA12878 = Paths.get(TEST_DATA_DIR.getAbsolutePath(), "NA24385_contaminated_with_NA12878_at_8_percent_chr1_fingerprint_sites.bam"); return new Object[][] { {NA12878_contaminated_by_NA24358, NA12878_fingerprint, NA24385_fingerprint, .1}, {NA24385_contaminated_by_NA12878, NA24385_fingerprint, NA12878_fingerprint, .08} }; }</code><technical_language>convert file path following: suggestion final Path NA12878_fingerprint = TEST_DATA_DIR.toPath().resolve("NA12878_chr1_fingerprint.vcf");</technical_language>

Target:
public Object[][] identifyContaminantTestDataProvider() { final Path NA12878_fingerprint = TEST_DATA_DIR.toPath().resolve("NA12878_chr1_fingerprint.vcf"); final Path NA24385_fingerprint = TEST_DATA_DIR.toPath().resolve("NA24385_chr1_fingerprint.vcf"); final Path NA12878_contaminated_by_NA24358 = TEST_DATA_DIR.toPath().resolve("NA12878_contaminated_with_NA24385_at_10_pct_chr1_fingerprint_sites.bam"); final Path NA24385_contaminated_by_NA12878 = TEST_DATA_DIR.toPath().resolve("NA24385_contaminated_with_NA12878_at_8_percent_chr1_fingerprint_sites.bam"); return new Object[][] { {NA12878_contaminated_by_NA24358, NA12878_fingerprint, NA24385_fingerprint, .1}, {NA24385_contaminated_by_NA12878, NA24385_fingerprint, NA12878_fingerprint, .08} }; }
Source:
<code>protected void executeCommand() { GlusterVolumeSnapshotSchedule fetchedSchedule = getGlusterVolumeSnapshotScheduleDao().getByVolumeId(volumeId); String jobId = fetchedSchedule.getJobId(); SchedulerUtil scheduler = DBSchedulerUtilQuartzImpl.getInstance(); <START> scheduler.deleteJob(jobId); <END> if (schedule.getRecurrence() != null) { String cronExpression = GlusterUtil.getInstance().getCronExpression(schedule); String newJobId = scheduler.scheduleACronJob(new GlusterSnapshotScheduleJob(), "onTimer", new Class[] { String.class, String.class, String.class, String.class, Boolean.class }, new Object[] { upServer.getId().toString(), volumeId.toString(), schedule.getSnapshotNamePrefix(), schedule.getSnapshotDescription(), force }, cronExpression); if (newJobId != null) { setSucceeded(true); schedule.setJobId(newJobId); getGlusterVolumeSnapshotScheduleDao().updateScheduleByVolumeId(volumeId, schedule); } } else { getGlusterVolumeSnapshotScheduleDao().removeByVolumeId(volumeId); setSucceeded(true); } }</code><technical_language>handling exceptions</technical_language>

Target:
protected void executeCommand() { GlusterVolumeSnapshotSchedule fetchedSchedule = getGlusterVolumeSnapshotScheduleDao().getByVolumeId(volumeId); String jobId = fetchedSchedule.getJobId(); SchedulerUtil scheduler = DBSchedulerUtilQuartzImpl.getInstance(); scheduler.deleteJob(jobId); if (schedule.getRecurrence() != null) { Time originalExecutionTime = schedule.getExecutionTime(); if (schedule.getExecutionTime() != null) { Time convertedTime = GlusterUtil.getInstance().convertTime(schedule.getExecutionTime(), schedule.getTimeZone()); schedule.setExecutionTime(convertedTime); } String cronExpression = GlusterUtil.getInstance().getCronExpression(schedule); String newJobId = scheduler.scheduleACronJob(new GlusterSnapshotScheduleJob(), "onTimer", new Class[] { String.class, String.class, String.class, String.class, Boolean.class }, new Object[] { upServer.getId().toString(), volumeId.toString(), schedule.getSnapshotNamePrefix(), schedule.getSnapshotDescription(), force }, cronExpression, schedule.getStartDate(), schedule.getEndByDate()); if (newJobId != null) { setSucceeded(true); schedule.setJobId(newJobId); schedule.setExecutionTime(originalExecutionTime); getGlusterVolumeSnapshotScheduleDao().updateScheduleByVolumeId(volumeId, schedule); } } else { getGlusterVolumeSnapshotScheduleDao().removeByVolumeId(volumeId); setSucceeded(true); } }
Source:
<code>public PrintWriter format(String format, Object ... args) { try { synchronized (lock) { ensureOpen(); if ((formatter == null) || (formatter.locale() != Locale.getDefault())) <START> formatter = new Formatter(this); <END> formatter.format(Locale.getDefault(), format, args); if (autoFlush) out.flush(); } } catch (InterruptedIOException x) { Thread.currentThread().interrupt(); } catch (IOException x) { trouble = true; } return this; }</code><technical_language>Please revert, new Formatter(this) a reference cycle WeakProxy avoids</technical_language>

Target:
public PrintWriter format(String format, Object ... args) { try { synchronized (lock) { ensureOpen(); if ((formatter == null) || (formatter.locale() != Locale.getDefault())) formatter = new Formatter(WeakProxy.forObject(this)); formatter.format(Locale.getDefault(), format, args); if (autoFlush) out.flush(); } } catch (InterruptedIOException x) { Thread.currentThread().interrupt(); } catch (IOException x) { trouble = true; } return this; }