auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
static ReceiveCommand parseCommand(String line) throws PackProtocolException { if (line.length() < 83) { String m = JGitText.get().errorInvalidProtocolWantedOldNewRef; throw new PackProtocolException(m); } String oldStr = line.substring(0, 40); String newStr = line.substring(41, 81); ObjectId oldId, newId; try { oldId = ObjectId.fromString(oldStr); newId = ObjectId.fromString(newStr); } catch (IllegalArgumentException e) { throw new PackProtocolException( JGitText.get().errorInvalidProtocolWantedOldNewRef, e); } String name = line.substring(82); if (!Repository.isValidRefName(name)) { throw new PackProtocolException( JGitText.get().errorInvalidProtocolWantedOldNewRef); } return new ReceiveCommand(oldId, newId, name); }

Target:
static ReceiveCommand parseCommand(String line) throws PackProtocolException { if (line == null || line.length() < 83) { throw new PackProtocolException( JGitText.get().errorInvalidProtocolWantedOldNewRef); } String oldStr = line.substring(0, 40); String newStr = line.substring(41, 81); ObjectId oldId, newId; try { oldId = ObjectId.fromString(oldStr); newId = ObjectId.fromString(newStr); } catch (IllegalArgumentException e) { throw new PackProtocolException( JGitText.get().errorInvalidProtocolWantedOldNewRef, e); } String name = line.substring(82); if (!Repository.isValidRefName(name)) { throw new PackProtocolException( JGitText.get().errorInvalidProtocolWantedOldNewRef); } return new ReceiveCommand(oldId, newId, name); }
Source:
private void copyUploadedFileToReferenceDataDirectory() { final File tenantHome = getWizardContext().getTenantContext().getConfiguration().getHomeFolder().toFile(); final File referenceDataDirectory = new File(tenantHome.getAbsolutePath() + File.separator + "reference-data"); final File targetFile = new File(referenceDataDirectory.getAbsolutePath() + File.separator + _filePath); if (!referenceDataDirectory.exists() && !referenceDataDirectory.mkdirs()) { throw new DCUserInputException("Could not create directory for file:\n" + targetFile.getAbsolutePath()); } if (!referenceDataDirectory.canWrite()) { throw new DCUserInputException("Cannot write data to directory of file:\n" + targetFile.getAbsolutePath()); } final File temporaryFile = (File) getWizardContext().getHttpSession().eval(_sessionKey); FileHelper.copy(temporaryFile, targetFile); _filePath = targetFile.getAbsolutePath(); }

Target:
protected void copyUploadedFileToReferenceDataDirectory() { final File tenantHome = getWizardContext().getTenantContext().getConfiguration().getHomeFolder().toFile(); final File referenceDataDirectory = new File(tenantHome.getAbsolutePath() + File.separator + "reference-data"); final File targetFile = new File(referenceDataDirectory.getAbsolutePath() + File.separator + _filePath); if (!referenceDataDirectory.exists() && !referenceDataDirectory.mkdirs()) { throw new DCUserInputException("Could not create directory for file:\n" + targetFile.getAbsolutePath()); } if (!referenceDataDirectory.canWrite()) { throw new DCUserInputException("Cannot write data to directory of file:\n" + targetFile.getAbsolutePath()); } final File temporaryFile = (File) getWizardContext().getHttpSession().eval(_sessionKey); FileHelper.copy(temporaryFile, targetFile); _filePath = targetFile.getAbsolutePath(); }
Source:
void performCustomMigration() { ProjectId id = createId(42); TestProcessManagerRepository repository = repository(); TestProcessManager pm = new TestProcessManager(id); repository.store(pm); TargetFilters targetFilters = targetFilters(Project.Column.idString(), id.toString()); Iterator<TestProcessManager> found = repository.find(targetFilters, ResponseFormat.getDefaultInstance()); assertThat(found.hasNext()).isFalse(); repository.applyMigration(id, new SetTestProcessId()); Iterator<TestProcessManager> afterMigration = repository.find(targetFilters, ResponseFormat.getDefaultInstance()); assertThat(afterMigration.hasNext()).isTrue(); TestProcessManager entityWithColumns = afterMigration.next(); assertThat(entityWithColumns.state() .getIdString()).isEqualTo(id.toString()); }

Target:
void performCustomMigration() { ProjectId id = createId(42); TestProcessManagerRepository repository = repository(); TestProcessManager pm = new TestProcessManager(id); repository.store(pm); TargetFilters targetFilters = targetFilters(Project.Column.idString(), id.toString()); Iterator<TestProcessManager> found = repository.find(targetFilters, ResponseFormat.getDefaultInstance()); assertThat(found.hasNext()).isFalse(); repository.applyMigration(id, new SetTestProcessId()); Iterator<TestProcessManager> afterMigration = repository.find(targetFilters, ResponseFormat.getDefaultInstance()); assertThat(afterMigration.hasNext()).isTrue(); TestProcessManager entityWithColumns = afterMigration.next(); Project expectedState = pm .state() .toBuilder() .setIdString(pm.getIdString()) .build(); assertThat(entityWithColumns.state()).isEqualTo(expectedState); }
Source:
public void testTransformNativeRserveMultipleExpressionInPlaceFalse() throws DDFException { Boolean inPlace = Boolean.FALSE; String[] expressions = {"newcol = deptime / arrtime","newcol2=log(arrdelay)"}; DDF newDdf3 = ddf.copy(); DDF newDdf4 = newDdf3.Transform.transformNativeRserve(expressions, inPlace); Assert.assertNotNull(newDdf3); Assert.assertNotNull(newDdf4); Assert.assertFalse("With inPlace being false, two DDF should have different UUID", newDdf3.getUUID().equals(newDdf4.getUUID())); }

Target:
public void testTransformNativeRserveMultipleExpressionInPlaceFalse() throws DDFException { Boolean inPlace = Boolean.FALSE; String[] expressions = {"newcol = deptime / arrtime","newcol2=log(arrdelay)"}; DDF newDdf3 = ddf.copy(); DDF newDdf4 = newDdf3.Transform.transformNativeRserve(expressions, inPlace); Assert.assertNotNull(newDdf3); Assert.assertNotNull(newDdf4); Assert.assertFalse("With inPlace being false, two DDF should have different UUID", newDdf3.getUUID().equals(newDdf4.getUUID())); Assert.assertEquals("transformed DDF newDdf4 should have newcol added", "newcol", newDdf4.getColumnName(8)); Assert.assertEquals("transformed DDF newDdf4 should have newcol2 added", "newcol2", newDdf4.getColumnName(9)); }
Source:
public void enqueueTask(NotificationContext changeContext) throws Exception { if (_batchModeEnabled && changeContext.getType() == NotificationContext.Type.CALLBACK) { logger.debug("Callbackhandler {}, Enqueuing callback", this._uid ); if (!isReady()) { logger.info("CallbackHandler is not ready, ignore change callback from path: {}, for " + "listener: {}", this._uid, _path, _listener); } else { synchronized (this) { if (_batchCallbackProcessor != null) { _batchCallbackProcessor.queueEvent(changeContext.getType(), changeContext); } else { throw new HelixException( "Failed to process callback in batch mode. Batch Callback Processor does not exist."); } } } } else { invoke(changeContext); } if (_monitor != null) { _monitor.increaseCallbackUnbatchedCounters(); } }

Target:
public void enqueueTask(NotificationContext changeContext) throws Exception { if (_batchModeEnabled && changeContext.getType() == NotificationContext.Type.CALLBACK) { logger.debug("Callbackhandler {}, Enqueuing callback", _uid ); if (!isReady()) { logger.info("CallbackHandler is not ready, ignore change callback from path: {}, for " + "listener: {}", _uid, _path, _listener); } else { synchronized (this) { if (_batchCallbackProcessor != null) { _batchCallbackProcessor.queueEvent(changeContext.getType(), changeContext); } else { throw new HelixException( "Failed to process callback in batch mode. Batch Callback Processor does not exist."); } } } } else { invoke(changeContext); } if (_monitor != null) { _monitor.increaseCallbackUnbatchedCounters(); } }
Source:
public void stopTask(boolean forceFinish) { if (getState() != AsyncTaskState.AttemptingEndAction && getState() != AsyncTaskState.Cleared && getState() != AsyncTaskState.ClearFailed && !getLastTaskStatus().getTaskIsInUnusualState()) { try { log.info("SPMAsyncTask::StopTask: Attempting to stop task '{}' (Parent Command '{}', Parameters" + " Type '{}').", getVdsmTaskId(), getParameters().getDbAsyncTask().getActionType(), getParameters().getClass().getName()); coco.stopTask(getStoragePoolID(), getVdsmTaskId()); } catch (RuntimeException e) { log.error("SPMAsyncTask::StopTask: Stopping task '{}' threw an exception: {}", getVdsmTaskId(), e.getMessage()); log.debug("Exception", e); } finally { if (forceFinish) { setState(AsyncTaskState.Ended); setLastTaskStatus(new AsyncTaskStatus(AsyncTaskStatusEnum.finished)); } else { setState(AsyncTaskState.Polling); } } } }

Target:
public void stopTask(boolean forceFinish) { if (getState() != AsyncTaskState.AttemptingEndAction && getState() != AsyncTaskState.Cleared && getState() != AsyncTaskState.ClearFailed && !getLastTaskStatus().getTaskIsInUnusualState()) { try { log.info("SPMAsyncTask::StopTask: Attempting to stop task '{}' (Parent Command '{}', Parameters" + " Type '{}').", getVdsmTaskId(), getParameters().getDbAsyncTask().getActionType(), getParameters().getClass().getName()); coco.stopTask(getStoragePoolID(), getVdsmTaskId()); } catch (RuntimeException e) { log.error("SPMAsyncTask::StopTask: Error during stopping task '{}': {}", getVdsmTaskId(), e.getMessage()); log.debug("Exception", e); } finally { if (forceFinish) { setState(AsyncTaskState.Ended); setLastTaskStatus(new AsyncTaskStatus(AsyncTaskStatusEnum.finished)); } else { setState(AsyncTaskState.Polling); } } } }
Source:
public synchronized void tearDown() { executorToShutdown.shutdown(); }

Target:
public void tearDown() { executorToShutdown.shutdown(); }
Source:
private void setPlacementStrategy(EcsClientConfig clientConfig, RunTaskRequest runTaskRequest) throws ConfigException { if (clientConfig.getPlacementStrategyType().isPresent()) { final PlacementStrategyType placementStrategyType; try { placementStrategyType = PlacementStrategyType.fromValue(clientConfig.getPlacementStrategyType().get()); } catch (IllegalArgumentException invalidReason) { throw new ConfigException("PlacementStrategyType is invalid", invalidReason); } final PlacementStrategy placementStrategy = new PlacementStrategy(); placementStrategy.setType(placementStrategyType); if (clientConfig.getPlacementStrategyField().isPresent()) { placementStrategy.setField(clientConfig.getPlacementStrategyField().get()); } runTaskRequest.setPlacementStrategy(Arrays.asList(placementStrategy)); } }

Target:
private void setPlacementStrategy(EcsClientConfig clientConfig, RunTaskRequest runTaskRequest) throws ConfigException { if (clientConfig.getPlacementStrategyType().isPresent()) { final PlacementStrategyType placementStrategyType; try { placementStrategyType = PlacementStrategyType.fromValue(clientConfig.getPlacementStrategyType().get()); } catch (IllegalArgumentException validationError) { throw new ConfigException("PlacementStrategyType is invalid", validationError); } final PlacementStrategy placementStrategy = new PlacementStrategy(); placementStrategy.setType(placementStrategyType); if (clientConfig.getPlacementStrategyField().isPresent()) { placementStrategy.setField(clientConfig.getPlacementStrategyField().get()); } runTaskRequest.setPlacementStrategy(Arrays.asList(placementStrategy)); } }
Source:
private static void invokeForEachKeyFactoryPair(KeyFactoryPairRunnable runnable) throws Exception { for (Provider provider1 : getKeyFactoryProviders()) { for (Provider provider2 : getKeyFactoryProviders()) { try { runnable.run(getKeyFactory(provider1), getKeyFactory(provider2)); } catch (Exception e) { throw new Exception("provider1: " + provider1.getName() + ", provider2: " + provider2.getName(), e); } } } }

Target:
private static void invokeForEachKeyFactoryPair(KeyFactoryPairRunnable runnable) throws Exception { for (Provider provider1 : getKeyFactoryProviders()) { for (Provider provider2 : getKeyFactoryProviders()) { try { runnable.run(getKeyFactory(provider1), getKeyFactory(provider2)); } catch (Throwable e) { throw new Exception("provider1: " + provider1.getName() + ", provider2: " + provider2.getName(), e); } } } }
Source:
public void internalStop() throws Exception { server.stop(); if (webContexts != null) { File tmpdir = null; for (WebAppContext context : webContexts) { tmpdir = context.getTempDirectory(); if (tmpdir != null && !context.isPersistTempDirectory()) { boolean fileDeleted = TimeUtils.waitOnBoolean(false, 5000, tmpdir::exists); if (!fileDeleted) { FileUtil.deleteDirectory(tmpdir); ActiveMQWebLogger.LOGGER.tmpFileForceDelete(tmpdir); if (tmpdir.exists()) { ActiveMQWebLogger.LOGGER.tmpFileNotDeleted(tmpdir); } } } } webContexts.clear(); } }

Target:
public void internalStop() throws Exception { server.stop(); if (webContexts != null) { File tmpdir = null; for (WebAppContext context : webContexts) { tmpdir = context.getTempDirectory(); if (tmpdir != null && !context.isPersistTempDirectory()) { boolean fileDeleted = TimeUtils.waitOnBoolean(false, 5000, tmpdir::exists); if (!fileDeleted) { FileUtil.deleteDirectory(tmpdir); logger.debug("Force to delete temporary file on shutdown: " + tmpdir.getAbsolutePath()); if (tmpdir.exists()) { ActiveMQWebLogger.LOGGER.tmpFileNotDeleted(tmpdir); } } } } webContexts.clear(); } }
Source:
public Object saveInstance(EntityRecord entityRecord, Long deleteValueFieldId) { EntityDto entity = getEntity(entityRecord.getEntitySchemaId()); validateCredentials(entity); validateNonEditableProperty(entity); List<FieldDto> entityFields = getEntityFields(entityRecord.getEntitySchemaId()); List<FieldRecord> fieldRecords = entityRecord.getFields(); for(FieldRecord field : fieldRecords) { if(field.getType().getTypeClass().equals(UUID.class.getName())) { field.setValue(UUID.randomUUID()); } } try { MotechDataService service = getServiceForEntity(entity); Class<?> entityClass = getEntityClass(entity); boolean newObject = entityRecord.getId() == null; Object instance; if (newObject) { instance = newInstanceFromEntityRecord(entityClass, entityFields, entityRecord.getFields(), service); return service.create(instance); } else { instance = service.retrieve(ID_FIELD_NAME, entityRecord.getId()); if (instance == null) { throw new ObjectNotFoundException(entity.getName(), entityRecord.getId()); } updateFields(instance, entityRecord.getFields(), service, deleteValueFieldId, true); return service.update(instance); } } catch (Exception e) { if (entityRecord.getId() == null) { throw new ObjectCreateException(entity.getName(), e); } else { throw new ObjectUpdateException(entity.getName(), entityRecord.getId(), e); } } }

Target:
public Object saveInstance(EntityRecord entityRecord, Long deleteValueFieldId) { EntityDto entity = getEntity(entityRecord.getEntitySchemaId()); validateCredentials(entity); validateNonEditableProperty(entity); List<FieldDto> entityFields = getEntityFields(entityRecord.getEntitySchemaId()); try { MotechDataService service = getServiceForEntity(entity); Class<?> entityClass = getEntityClass(entity); boolean newObject = entityRecord.getId() == null; Object instance; if (newObject) { instance = newInstanceFromEntityRecord(entityClass, entityFields, entityRecord.getFields(), service); return service.create(instance); } else { instance = service.retrieve(ID_FIELD_NAME, entityRecord.getId()); if (instance == null) { throw new ObjectNotFoundException(entity.getName(), entityRecord.getId()); } updateFields(instance, entityRecord.getFields(), service, deleteValueFieldId, true); return service.update(instance); } } catch (Exception e) { if (entityRecord.getId() == null) { throw new ObjectCreateException(entity.getName(), e); } else { throw new ObjectUpdateException(entity.getName(), entityRecord.getId(), e); } } }
Source:
public void doDecryptSucceeds() throws Exception { final Path path = ddfHome.resolve(TEST_DIRECTORY); configurationMigrationManager = spy(getConfigurationMigrationManager()); configurationMigrationManager.doExport(path); expectImportDelegationIsSuccessful(); final MigrationReport report = configurationMigrationManager.doDecrypt(path); assertThat("Decrypt was not successful", report.wasSuccessful(), is(true)); reportHasInfoMessage( report.infos(), equalTo( "Successfully decrypted file [" + path.resolve(TEST_BRANDING) + "-" + TEST_VERSION + ".dar] to [" + path.resolve(TEST_BRANDING) + "-" + TEST_VERSION + ".zip].")); verify(configurationMigrationManager) .delegateToDecryptMigrationManager( any(MigrationReportImpl.class), any(MigrationZipFile.class), any(Path.class)); }

Target:
public void doDecryptSucceeds() throws Exception { expectZipWithChecksum(true); expectDecryptDelegationIsSuccessful(); final MigrationReport report = configurationMigrationManager.doDecrypt(path); assertThat("Decrypt was not successful", report.wasSuccessful(), is(true)); reportHasInfoMessage( report.infos(), equalTo( "Successfully decrypted file [" + encryptedFileName + "] to [" + decryptedFileName + "].")); verify(configurationMigrationManager) .delegateToDecryptMigrationManager( any(MigrationReportImpl.class), any(MigrationZipFile.class), eq(Paths.get(decryptedFileName))); verifyZipEncryptedFile(); }
Source:
private void parseIncompleteRoot(CommonTree root) throws ParseException { List<CommonTree> children = root.getChildren(); if (fHasBeenParsed == false) { throw new ParseException("You need to run generate first"); } List<CommonTree> streams = new ArrayList<>(); List<CommonTree> events = new ArrayList<>(); List<CommonTree> declarations = new ArrayList<>(); List<CommonTree> environments = new ArrayList<>(); List<CommonTree> clocks = new ArrayList<>(); List<CommonTree> callsites = new ArrayList<>(); pushScope(); for (CommonTree child : children) { final int type = child.getType(); switch (type) { case CTFParser.DECLARATION: declarations.add(child); break; case CTFParser.TRACE: throw new ParseException("Trace block defined here, please use generate and not generateFragment parse this chunk"); case CTFParser.STREAM: streams.add(child); break; case CTFParser.EVENT: events.add(child); break; case CTFParser.CLOCK: clocks.add(child); break; case CTFParser.ENV: environments.add(child); break; case CTFParser.CALLSITE: callsites.add(child); break; default: childTypeError(child); } } for (CommonTree decl : declarations) { parseRootDeclaration(decl); } for (CommonTree environment : environments) { parseEnvironment(environment); } for (CommonTree clock : clocks) { parseClock(clock); } for (CommonTree callsite : callsites) { parseCallsite(callsite); } for (CommonTree stream : streams) { parseStream(stream); } for (CommonTree event : events) { parseEvent(event); } popScope(); }

Target:
private void parseIncompleteRoot(CommonTree root) throws ParseException { List<CommonTree> children = root.getChildren(); if (fHasBeenParsed == false) { throw new ParseException("You need to run generate first"); } List<CommonTree> streams = new ArrayList<>(); List<CommonTree> events = new ArrayList<>(); List<CommonTree> declarations = new ArrayList<>(); List<CommonTree> environments = new ArrayList<>(); List<CommonTree> clocks = new ArrayList<>(); List<CommonTree> callsites = new ArrayList<>(); pushScope(); for (CommonTree child : children) { final int type = child.getType(); switch (type) { case CTFParser.DECLARATION: declarations.add(child); break; case CTFParser.TRACE: throw new ParseException("Trace block defined here, please use generate and not generateFragment to parse this fragment"); case CTFParser.STREAM: streams.add(child); break; case CTFParser.EVENT: events.add(child); break; case CTFParser.CLOCK: clocks.add(child); break; case CTFParser.ENV: environments.add(child); break; case CTFParser.CALLSITE: callsites.add(child); break; default: childTypeError(child); } } for (CommonTree decl : declarations) { parseRootDeclaration(decl); } for (CommonTree environment : environments) { parseEnvironment(environment); } for (CommonTree clock : clocks) { parseClock(clock); } for (CommonTree callsite : callsites) { parseCallsite(callsite); } for (CommonTree stream : streams) { parseStream(stream); } for (CommonTree event : events) { parseEvent(event); } popScope(); }
Source:
private void writeToFile(ZonedDateTime time) { try ( FileOutputStream fos = new FileOutputStream(lastEventPollingPath.toFile()); ObjectOutputStream oos = new ObjectOutputStream(fos)) { oos.writeObject(time); } catch (Exception e) { } }

Target:
private void writeToFile(ZonedDateTime time) { try { Files.write(lastEventPollingPath, Long.toString(time.toInstant().toEpochMilli()).getBytes(Charset.defaultCharset())); } catch (IOException e) { } }
Source:
public synchronized void updateCommittedTail(long newCommittedTail) { committedTail.updateAndGet(curr -> { if (newCommittedTail <= curr) { return curr; } return newCommittedTail; }); }

Target:
public void updateCommittedTail(long newCommittedTail) { committedTail.updateAndGet(curr -> { if (newCommittedTail <= curr) { return curr; } return newCommittedTail; }); }
Source:
public void testMessageConverterConfigurer() throws Exception { final CountDownLatch latch = new CountDownLatch(1); MessageHandler messageHandler = new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { latch.countDown(); } }; testSink.input().subscribe(messageHandler); testSink.input().send(MessageBuilder.withPayload("{\"message\":\"Hi\"}").build()); assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue(); testSink.input().unsubscribe(messageHandler); }

Target:
public void testMessageConverterConfigurer() throws Exception { final CountDownLatch latch = new CountDownLatch(1); MessageHandler messageHandler = new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { assertThat(message.getPayload()).isInstanceOf(byte[].class); assertThat(message.getPayload()).isEqualTo("{\"message\":\"Hi\"}".getBytes()); latch.countDown(); } }; testSink.input().subscribe(messageHandler); testSink.input().send(MessageBuilder.withPayload("{\"message\":\"Hi\"}".getBytes()).build()); assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue(); testSink.input().unsubscribe(messageHandler); }
Source:
public void responseHeadersReceived(InspectorResponse response) { NetworkPeerManager peerManager = getPeerManagerIfEnabled(); if (peerManager != null) { Network.Response responseJSON = new Network.Response(); responseJSON.url = response.url(); responseJSON.status = response.statusCode(); responseJSON.statusText = response.reasonPhrase(); responseJSON.headers = formatHeadersAsJSON(response); String contentType = getContentType(response); responseJSON.mimeType = contentType != null ? getResourceTypeHelper().stripContentExtras(contentType) : "application/octet-stream"; responseJSON.connectionReused = response.connectionReused(); responseJSON.connectionId = response.connectionId(); responseJSON.fromDiskCache = response.fromDiskCache(); Network.ResponseReceivedParams receivedParams = new Network.ResponseReceivedParams(); receivedParams.requestId = response.requestId(); receivedParams.frameId = "1"; receivedParams.loaderId = "1"; receivedParams.timestamp = stethoNow() / 1000.0; receivedParams.type = contentType != null ? getResourceTypeHelper().determineResourceType(contentType) : Page.ResourceType.OTHER; receivedParams.response = responseJSON; AsyncPrettyPrinterRegistry registry= peerManager.getAsyncPrettyPrinterRegistry(); AsyncPrettyPrinterFactory factory = null; for (int i = 0; i < response.headerCount(); i++) { factory = registry.lookup(response.headerName(i)); if (factory != null) { AsyncPrettyPrinter asyncPrettyPrinter = factory.getInstance( response.headerName(i), response.headerValue(i)); peerManager.getResponseBodyFileManager().addAsyncPrettyPrinter( response.requestId(), asyncPrettyPrinter); break; } } peerManager.sendNotificationToPeers("Network.responseReceived", receivedParams); } }

Target:
public void responseHeadersReceived(InspectorResponse response) { NetworkPeerManager peerManager = getPeerManagerIfEnabled(); if (peerManager != null) { Network.Response responseJSON = new Network.Response(); responseJSON.url = response.url(); responseJSON.status = response.statusCode(); responseJSON.statusText = response.reasonPhrase(); responseJSON.headers = formatHeadersAsJSON(response); String contentType = getContentType(response); responseJSON.mimeType = contentType != null ? getResourceTypeHelper().stripContentExtras(contentType) : "application/octet-stream"; responseJSON.connectionReused = response.connectionReused(); responseJSON.connectionId = response.connectionId(); responseJSON.fromDiskCache = response.fromDiskCache(); Network.ResponseReceivedParams receivedParams = new Network.ResponseReceivedParams(); receivedParams.requestId = response.requestId(); receivedParams.frameId = "1"; receivedParams.loaderId = "1"; receivedParams.timestamp = stethoNow() / 1000.0; receivedParams.response = responseJSON; AsyncPrettyPrinter asyncPrettyPrinter = initAsyncPrettyPrinterForResponse(response, peerManager); receivedParams.type = determineResourceType(asyncPrettyPrinter, contentType, getResourceTypeHelper()); peerManager.sendNotificationToPeers("Network.responseReceived", receivedParams); } }
Source:
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { if (invocation.getAttachments() != null) { long start = System.currentTimeMillis(); invocation.getAttachments().put(TIMEOUT_FILTER_START_TIME, String.valueOf(start)); } return invoker.invoke(invocation); }

Target:
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { if (invocation.getAttachments() != null) { long start = System.currentTimeMillis(); invocation.getAttachments().put(TIMEOUT_FILTER_START_TIME, String.valueOf(start)); } else { if (invocation instanceof RpcInvocation) { RpcInvocation invc = (RpcInvocation) invocation; long start = System.currentTimeMillis(); invc.setAttachment(TIMEOUT_FILTER_START_TIME, String.valueOf(start)); } } return invoker.invoke(invocation); }
Source:
void walkInnerSymbols(ObjectType type, String innerNamespace) { for (String propName : type.getPropertyNames()) { JSType pType = type.getPropertyType(propName); if (pType.isEnumType() && isPrivate(type.getOwnPropertyJSDocInfo(propName))) { privateEnums.add(innerNamespace + '.' + propName); } } boolean nonEmpty = false; for (String propName : getSortedPublicPropertyNames(type)) { String qualifiedName = innerNamespace + '.' + propName; if (provides.contains(qualifiedName)) continue; JSType pType = type.getPropertyType(propName); if (pType.isEnumType()) { if (!nonEmpty) { emitNamespaceBegin(innerNamespace); nonEmpty = true; } visitEnumType(propName, (EnumType) pType); } else if (isClassLike(pType)) { if (!nonEmpty) { emitNamespaceBegin(innerNamespace); nonEmpty = true; } visitClassOrInterface(propName, (FunctionType) pType); } else if (isTypedef(pType)) { if (!nonEmpty) { emitNamespaceBegin(innerNamespace); nonEmpty = true; } JSType registryType = typeRegistry.getType(qualifiedName); visitTypeAlias(registryType, propName); } else if (type.isInterface()) { if (pType.isFunctionType()) { FunctionType ftype = (FunctionType) pType; if (isOrdinaryFunction(ftype)) { if (!nonEmpty) { emitNamespaceBegin(innerNamespace); nonEmpty = true; } visitFunctionExpression(propName, ftype); } } else if (!pType.isNoType() && !pType.isFunctionPrototypeType()) { if (!nonEmpty) { emitNamespaceBegin(innerNamespace); nonEmpty = true; } visitVarDeclaration(propName, pType); } } } if (nonEmpty) emitNamespaceEnd(); }

Target:
void walkInnerSymbols(ObjectType type, String innerNamespace) { for (String propName : type.getPropertyNames()) { JSType pType = type.getPropertyType(propName); if (pType.isEnumType() && isPrivate(type.getOwnPropertyJSDocInfo(propName))) { privateEnums.add(innerNamespace + '.' + propName); } } boolean foundNamespaceMembers = false; for (String propName : getSortedPublicPropertyNames(type)) { String qualifiedName = innerNamespace + '.' + propName; if (provides.contains(qualifiedName)) continue; JSType pType = type.getPropertyType(propName); if (pType.isEnumType()) { if (!foundNamespaceMembers) { emitNamespaceBegin(innerNamespace); foundNamespaceMembers = true; } visitEnumType(propName, (EnumType) pType); } else if (isClassLike(pType)) { if (!foundNamespaceMembers) { emitNamespaceBegin(innerNamespace); foundNamespaceMembers = true; } visitClassOrInterface(propName, (FunctionType) pType); } else if (isTypedef(pType)) { if (!foundNamespaceMembers) { emitNamespaceBegin(innerNamespace); foundNamespaceMembers = true; } JSType registryType = typeRegistry.getType(qualifiedName); visitTypeAlias(registryType, propName); } else if (type.isInterface() && isOrdinaryFunction(pType)) { if (!foundNamespaceMembers) { emitNamespaceBegin(innerNamespace); foundNamespaceMembers = true; } visitFunctionExpression(propName, (FunctionType) pType); } else if (type.isInterface() && !pType.isNoType() && !pType.isFunctionPrototypeType()) { if (!foundNamespaceMembers) { emitNamespaceBegin(innerNamespace); foundNamespaceMembers = true; } visitVarDeclaration(propName, pType); } } if (foundNamespaceMembers) emitNamespaceEnd(); }
Source:
@BeforeClass public static void beforeClass() { firefoxdriver().setup(); }

Target:
@BeforeClass public static void beforeClass() { chromedriver().setup(); }
Source:
public int getUsageWidth() { return usageWidth; }

Target:
int getUsageWidth() { return usageWidth; }
Source:
public static void updateApplicablePoolDomainsStatuses(Guid storagePoolId, Set<StorageDomainStatus> applicableStatusesForUpdate, StorageDomainStatus newStatus) { List<StoragePoolIsoMap> storagesStatusInPool = DbFacade.getInstance() .getStoragePoolIsoMapDao().getAllForStoragePool(storagePoolId); for (StoragePoolIsoMap storageStatusInPool : storagesStatusInPool) { if (storageStatusInPool.getStatus() != null && storageStatusInPool.getStatus() != newStatus && applicableStatusesForUpdate.contains(storageStatusInPool.getStatus())) { storageStatusInPool.setStatus(newStatus); DbFacade.getInstance() .getStoragePoolIsoMapDao() .updateStatus(storageStatusInPool.getId(), storageStatusInPool.getStatus()); } } }

Target:
public static void updateApplicablePoolDomainsStatuses(Guid storagePoolId, Set<StorageDomainStatus> applicableStatusesForUpdate, StorageDomainStatus newStatus) { List<StoragePoolIsoMap> storagesStatusInPool = DbFacade.getInstance() .getStoragePoolIsoMapDao().getAllForStoragePool(storagePoolId); for (StoragePoolIsoMap storageStatusInPool : storagesStatusInPool) { if (storageStatusInPool.getStatus() != null && storageStatusInPool.getStatus() != newStatus && applicableStatusesForUpdate.contains(storageStatusInPool.getStatus())) { log.infoFormat("Updating Storage Domain status from %1s to %2s", storageStatusInPool.getStatus().name(), newStatus.name()); storageStatusInPool.setStatus(newStatus); DbFacade.getInstance() .getStoragePoolIsoMapDao() .updateStatus(storageStatusInPool.getId(), storageStatusInPool.getStatus()); } } }
Source:
public static ProjectReadAccessType from( final String value ) { if ( value.equalsIgnoreCase( PUBLIC.toString() ) ) { return PUBLIC; } else if ( value.equalsIgnoreCase( PRIVATE.toString() ) ) { return PRIVATE; } else if ( value.equalsIgnoreCase( CUSTOM.toString() ) ) { return CUSTOM; } throw new IllegalArgumentException( "Cannot parse ProjectReadAccessType value: " + value ); }

Target:
public static ProjectReadAccessType from( final String value ) { if ( PUBLIC.value.equals( value ) ) { return PUBLIC; } else if ( PRIVATE.value.equals( value ) ) { return PRIVATE; } else if ( CUSTOM.value.equals( value ) ) { return CUSTOM; } throw new IllegalArgumentException( "Cannot parse ProjectReadAccessType value: " + value ); }
Source:
public ASTNode visit(Module module, Void _) { newRules = new ArrayList<ModuleItem>(); Module newModule = (Module)super.visit(module, _); Module returnModule; if (newRules.isEmpty()) { returnModule = newModule; } else { returnModule = newModule.shallowCopy(); returnModule = returnModule.setModuleItems(newRules); } return returnModule; }

Target:
public ASTNode visit(Module module, Void _) { newRules = new ArrayList<ModuleItem>(); Module newModule = (Module)super.visit(module, _); Module returnModule; if (newRules.isEmpty()) { returnModule = newModule; } else { returnModule = newModule.shallowCopy(); returnModule = returnModule.addModuleItems(newRules); } return returnModule; }
Source:
public void testExpiry() throws Exception { String jobName = "Expiry"; long expiry = 1000L; Map<String, String> commandConfig = ImmutableMap.of(MockTask.JOB_DELAY, String.valueOf(100)); JobConfig.Builder jobBuilder = JobConfig.Builder.fromMap(WorkflowGenerator.DEFAULT_JOB_CONFIG); jobBuilder.setJobCommandConfigMap(commandConfig); WorkflowConfig.Builder wfgBuilder = new WorkflowConfig.Builder().setJobPurgeInterval(-1); WorkflowConfig wfg = wfgBuilder.build(); Workflow flow = WorkflowGenerator.generateSingleJobWorkflowBuilder(jobName, jobBuilder) .setWorkflowConfig(wfg) .setExpiry(expiry).build(); _driver.start(flow); _driver.pollForWorkflowState(jobName, TaskState.IN_PROGRESS); HelixDataAccessor accessor = _manager.getHelixDataAccessor(); PropertyKey workflowCfgKey = accessor.keyBuilder().resourceConfig(jobName); String workflowPropStoreKey = Joiner.on("/").join(TaskConstants.REBALANCER_CONTEXT_ROOT, jobName); Assert.assertTrue( _manager.getHelixPropertyStore().exists(workflowPropStoreKey, AccessOption.PERSISTENT)); Assert.assertNotSame(accessor.getProperty(workflowCfgKey), null); _driver.pollForWorkflowState(jobName, TaskState.COMPLETED); long finishTime = _driver.getWorkflowContext(jobName).getFinishTime(); Assert.assertTrue(TestHelper.verify( () -> (!_manager.getHelixPropertyStore().exists(workflowPropStoreKey, AccessOption.PERSISTENT) && accessor.getProperty(workflowCfgKey) == null), TestHelper.WAIT_DURATION)); long cleanUpTime = System.currentTimeMillis(); Assert.assertTrue(cleanUpTime - finishTime >= expiry); }

Target:
public void testExpiry() throws Exception { String jobName = "Expiry"; long expiry = 1000L; Map<String, String> commandConfig = ImmutableMap.of(MockTask.JOB_DELAY, String.valueOf(100)); JobConfig.Builder jobBuilder = JobConfig.Builder.fromMap(WorkflowGenerator.DEFAULT_JOB_CONFIG); jobBuilder.setJobCommandConfigMap(commandConfig); Workflow flow = WorkflowGenerator.generateSingleJobWorkflowBuilder(jobName, jobBuilder) .setExpiry(expiry).build(); _driver.start(flow); _driver.pollForWorkflowState(jobName, TaskState.IN_PROGRESS); HelixDataAccessor accessor = _manager.getHelixDataAccessor(); PropertyKey workflowCfgKey = accessor.keyBuilder().resourceConfig(jobName); String workflowPropStoreKey = Joiner.on("/").join(TaskConstants.REBALANCER_CONTEXT_ROOT, jobName); Assert.assertTrue( _manager.getHelixPropertyStore().exists(workflowPropStoreKey, AccessOption.PERSISTENT)); Assert.assertNotSame(accessor.getProperty(workflowCfgKey), null); _driver.pollForWorkflowState(jobName, TaskState.COMPLETED); long finishTime = _driver.getWorkflowContext(jobName).getFinishTime(); Assert.assertTrue(TestHelper.verify( () -> (!_manager.getHelixPropertyStore().exists(workflowPropStoreKey, AccessOption.PERSISTENT) && accessor.getProperty(workflowCfgKey) == null), TestHelper.WAIT_DURATION)); long cleanUpTime = System.currentTimeMillis(); Assert.assertTrue(cleanUpTime - finishTime >= expiry); }
Source:
private void setNormalBackgroundColor() { if (noResults) { Color currentColor = patternField.getBackground(); patternField.setData(CCS_CLASS_KEY, null); patternField.reskin(SWT.ALL); patternField.update(); if (currentColor.equals(patternField.getBackground())) { patternField.setBackground(null); } noResults = false; } }

Target:
private void setNormalBackgroundColor() { if (noResults) { Color currentColor = patternField.getBackground(); patternField.setData(CCS_CLASS_KEY, null); patternField.reskin(SWT.ALL); if (currentColor.equals(patternField.getBackground())) { patternField.setBackground(null); } noResults = false; } }
Source:
public DialogAnonymization(Shell shell, Model model) { super(shell); this.title = Resources.getMessage("DialogAnonymization.0"); this.message = Resources.getMessage("DialogAnonymization.1"); this.configuration = model.getAnonymizationConfiguration(); this.configurationValid = true; EDDifferentialPrivacy edp = model.getInputConfig().getCriterion(EDDifferentialPrivacy.class); if (edp != null) { this.optimalSearchAvailable = false; this.heuristicSearchStepLimitAvailable = edp.isDataDependent(); this.heuristicSearchTimeLimitAvailable = false; } else { this.optimalSearchAvailable = model.getSolutionSpaceSize() <= model.getHeuristicSearchThreshold(); this.heuristicSearchStepLimitAvailable = true; this.heuristicSearchTimeLimitAvailable = true; } this.localRecodingAvailable = true; for (PrivacyCriterion c : model.getInputConfig().getCriteria()) { if (!c.isLocalRecodingSupported()) { this.localRecodingAvailable = false; break; } } }

Target:
public DialogAnonymization(Shell shell, Model model) { super(shell); this.title = Resources.getMessage("DialogAnonymization.0"); this.message = Resources.getMessage("DialogAnonymization.1"); this.configuration = model.getAnonymizationConfiguration(); this.configurationValid = true; this.localRecodingAvailable = true; this.heuristicSearchStepLimitAvailable = true; this.heuristicSearchTimeLimitAvailable = true; this.optimalSearchAvailable = model.getSolutionSpaceSize() <= model.getHeuristicSearchThreshold(); for (PrivacyCriterion c : model.getInputConfig().getCriteria()) { if (!c.isLocalRecodingSupported()) { this.localRecodingAvailable = false; } if (!c.isOptimalSearchSupported()) { this.optimalSearchAvailable = false; } if (!c.isHeuristicSearchSupported()) { this.heuristicSearchStepLimitAvailable = false; } if (!c.isHeuristicSearchWithTimeLimitSupported()) { this.heuristicSearchTimeLimitAvailable = false; } } }
Source:
void move(byte[] encodedRegionName, ServerName destServerName) throws IOException; void assign(byte[] regionName) throws IOException; void unassign(byte[] regionName, boolean force) throws IOException; void offline(byte[] regionName) throws IOException; boolean balancerSwitch(boolean onOrOff, boolean synchronous) throws IOException; boolean balance() throws IOException; boolean balance(boolean force) throws IOException; boolean isBalancerEnabled() throws IOException; CacheEvictionStats clearBlockCache(final TableName tableName) throws IOException; boolean normalize() throws IOException; boolean normalize(NormalizeTableFilterParams ntfp) throws IOException; boolean isNormalizerEnabled() throws IOException; boolean normalizerSwitch(boolean on) throws IOException; boolean catalogJanitorSwitch(boolean onOrOff) throws IOException; int runCatalogJanitor() throws IOException; boolean isCatalogJanitorEnabled() throws IOException; boolean cleanerChoreSwitch(boolean onOrOff) throws IOException; boolean runCleanerChore() throws IOException; boolean isCleanerChoreEnabled() throws IOException; @Deprecated default Future<Void> mergeRegionsAsync(byte[] nameOfRegionA, byte[] nameOfRegionB, boolean forcible) throws IOException { byte[][] nameofRegionsToMerge = new byte[2][]; nameofRegionsToMerge[0] = nameOfRegionA; nameofRegionsToMerge[1] = nameOfRegionB; return mergeRegionsAsync(nameofRegionsToMerge, forcible); }

Target:
void move(byte[] encodedRegionName, ServerName destServerName) throws IOException; void assign(byte[] regionName) throws IOException; void unassign(byte[] regionName, boolean force) throws IOException; void offline(byte[] regionName) throws IOException; boolean balancerSwitch(boolean onOrOff, boolean synchronous) throws IOException; boolean balance() throws IOException; boolean balance(boolean force) throws IOException; boolean isBalancerEnabled() throws IOException; CacheEvictionStats clearBlockCache(final TableName tableName) throws IOException; default boolean normalize() throws IOException { return normalize(new NormalizeTableFilterParams.Builder().build()); }
Source:
public static void addIconToLabel(ViewGroup parent, Brick brick, Sprite sprite, Context context) { for (int i = 0; i < parent.getChildCount(); i++) { View child = parent.getChildAt(i); if (child instanceof LinearLayout || child instanceof RelativeLayout || child instanceof BrickLayout) { addIconToLabel((ViewGroup) child, brick, sprite, context); } if (child instanceof TextView) { TextView textView = (TextView) child; CategoryBricksFactory categoryBricksFactory = new CategoryBricksFactory(); String id = context.getResources().getResourceEntryName(textView.getId()); String subString = id.subSequence(id.length() - LABEL_KEYWORD.length(), id.length()).toString(); if (subString.equals(LABEL_KEYWORD)) { addIcon(context, textView, categoryBricksFactory.getBrickCategory(brick, sprite, context)); } } } }

Target:
public static boolean addIconToLabel(ViewGroup parent, Brick brick, Sprite sprite, Context context) { for (int i = 0; i < parent.getChildCount(); i++) { View child = parent.getChildAt(i); if (child instanceof ViewGroup) { boolean labelFound = addIconToLabel((ViewGroup) child, brick, sprite, context); if (labelFound) { return true; } } else if (child instanceof BrickTextView) { TextView textView = (TextView) child; CategoryBricksFactory categoryBricksFactory = new CategoryBricksFactory(); addIcon(context, textView, categoryBricksFactory.getBrickCategory(brick, sprite, context)); return true; } } return false; }
Source:
public ImapFuture<ImapAsyncResponse> execute(@Nonnull final ImapRequest command) throws ImapAsyncClientException, IOException, SearchException { if (!requestsQueue.isEmpty()) { throw new ImapAsyncClientException(FailureType.COMMAND_NOT_ALLOWED); } final ImapFuture<ImapAsyncResponse> cmdFuture = new ImapFuture<ImapAsyncResponse>(); requestsQueue.add(new ImapCommandEntry(command, cmdFuture)); final String tag = getNextTag(); final StringBuilder sb = new StringBuilder(tag).append(ImapClientConstants.SPACE).append(command.getCommandLine()); if (isDebugEnabled()) { logger.debug(CLIENT_LOG_REC, sessionId, new StringBuilder(tag).append(ImapClientConstants.SPACE).append(command.getLogLine()).toString()); } sendRequest(sb.toString()); return cmdFuture; }

Target:
public ImapFuture<ImapAsyncResponse> execute(@Nonnull final ImapRequest command) throws ImapAsyncClientException, IOException, SearchException { if (!requestsQueue.isEmpty()) { throw new ImapAsyncClientException(FailureType.COMMAND_NOT_ALLOWED); } final ImapFuture<ImapAsyncResponse> cmdFuture = new ImapFuture<ImapAsyncResponse>(); requestsQueue.add(new ImapCommandEntry(command, cmdFuture)); final String tag = getNextTag(); final StringBuilder sb = new StringBuilder(tag).append(ImapClientConstants.SPACE).append(command.getCommandLine()); if (isDebugEnabled() && command.isCommandLineDataSensitive()) { logger.debug(CLIENT_LOG_REC, sessionId, command.getDebugData()); } sendRequest(sb.toString(), command.isCommandLineDataSensitive()); return cmdFuture; }
Source:
public synchronized MemoryOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional<ConnectorNewTableLayout> layout) { long nextId = nextTableId.getAndIncrement(); Set<Node> nodes = nodeManager.getRequiredWorkerNodes(); checkState(!nodes.isEmpty(), "No Memory nodes available"); tableIds.put(tableMetadata.getTable().getTableName(), nextId); MemoryTableHandle table = new MemoryTableHandle( connectorId, nextId, tableMetadata); tables.put(table.getTableId(), table); hostsAndRowsPerTable.put(table.getTableId(), new HashMap<>()); return new MemoryOutputTableHandle(table, ImmutableSet.copyOf(tableIds.values())); }

Target:
public synchronized MemoryOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional<ConnectorNewTableLayout> layout) { checkTableNotExists(tableMetadata.getTable()); long nextId = nextTableId.getAndIncrement(); Set<Node> nodes = nodeManager.getRequiredWorkerNodes(); checkState(!nodes.isEmpty(), "No Memory nodes available"); tableIds.put(tableMetadata.getTable(), nextId); MemoryTableHandle table = new MemoryTableHandle( connectorId, nextId, tableMetadata); tables.put(table.getTableId(), table); tableDataFragments.put(table.getTableId(), new HashMap<>()); return new MemoryOutputTableHandle(table, ImmutableSet.copyOf(tableIds.values())); }
Source:
public String toString() { return "Response{" + "method='" + method + '\'' + ", uri=" + uri + ", status=" + status + ", payload=" + Arrays.toString(payload) + ", headers=" + headers + '}'; }

Target:
public String toString() { return "Response{" + "method='" + method + '\'' + ", uri=" + uri + ", status=" + status + ", payload='" + decode(payload) + '\'' + ", headers=" + headers + '}'; }
Source:
@Override public Object call() { return null; }

Target:
public Object call() { return null; }
Source:
public NetworkException() { super("Credentials not valid"); }

Target:
public NetworkException() { super("Network not available"); }
Source:
public MongoDBQueryDescriptor(String collectionName, Operation operation, List<DBObject> pipeline) { this.collectionName = collectionName; this.operation = operation; this.criteria = null; this.projection = null; this.orderBy = null; this.options = null; this.updateOrInsert = null; this.unwinds = null; this.pipeline = pipeline == null ? Collections.<DBObject>emptyList() : pipeline; this.fieldName = ""; }

Target:
public MongoDBQueryDescriptor(String collectionName, Operation operation, List<DBObject> pipeline) { this.collectionName = collectionName; this.operation = operation; this.criteria = null; this.projection = null; this.orderBy = null; this.options = null; this.updateOrInsert = null; this.unwinds = null; this.pipeline = pipeline == null ? Collections.<DBObject>emptyList() : pipeline; this.distinctFieldName = null; this.collation = null; }
Source:
public final T executeInManualFlushMode() { Session currentSession = HibernateSessionFactory.getSessionFactory().getHibernateSessionFactory().getCurrentSession(); FlushMode previousFlushMode = currentSession.getFlushMode(); currentSession.setFlushMode(FlushMode.MANUAL); try { return task(); } finally { currentSession.setFlushMode(previousFlushMode); } }

Target:
public final T executeInManualFlushMode() { DbSession currentSession = HibernateSessionFactory.getSessionFactory().getCurrentSession(); FlushMode previousFlushMode = currentSession.getFlushMode(); currentSession.setFlushMode(FlushMode.MANUAL); try { return task(); } finally { currentSession.setFlushMode(previousFlushMode); } }
Source:
private boolean isFileEntryPackageable(ZipEntry entry) { String entryName = entry.getName(); return ApkBuilder.checkFileForPackaging(entry.getName()) && isValidMetaInfEntry(entryName); }

Target:
private boolean isFileEntryPackageable(ZipEntry entry) { return ApkBuilder.checkFileForPackaging(entry.getName()) && isValidMetaInfEntry(entry.getName()); }
Source:
public void write(final ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (!(msg instanceof HAProxyMessage)) { super.write(ctx, msg, promise); return; } ctx.writeAndFlush(msg, promise).addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { ctx.pipeline().remove(HAProxyMessageEncoder.INSTANCE); ctx.pipeline().remove(HAProxyHandler.this); } else { throw new HAProxyProtocolException("failed to write HAProxy message"); } } }); }

Target:
public void write(final ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { ChannelFuture future = ctx.write(msg, promise); if (msg instanceof HAProxyMessage) { future.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { ctx.pipeline().remove(HAProxyMessageEncoder.INSTANCE); ctx.pipeline().remove(HAProxyHandler.this); } else { ctx.close(); } } }); } }
Source:
public CompletableFuture<Integer> killJobs(Collection<UUID> toKill, @Nullable String reason) { for (KillAllListener killAllListener : killAllListeners) { for (UUID job : toKill) { try { killAllListener.killJob(job); } catch (Throwable t) { LOGGER.error("Failed to call killJob on listener={}, err={}", t, killAllListener); } } } return killTasks(toKill, reason); }

Target:
public CompletableFuture<Integer> killJobs(Collection<UUID> toKill, @Nullable String reason) { for (KillAllListener killAllListener : killAllListeners) { for (UUID job : toKill) { try { killAllListener.killJob(job); } catch (Throwable t) { LOGGER.error("Failed to call killJob on listener={}, err={}", killAllListener, t); } } } return killTasks(toKill, reason); }