auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static CommandStorageRecord toStorageRecord(Command command) { final CommandContext context = command.getContext(); final CommandId commandId = checkValid(context.getCommandId()); final String commandIdString = commandId.getUuid(); final Any messageAny = command.getMessage(); final Message commandMessage = Commands.getMessage(command); final String commandType = TypeName.of(commandMessage).nameOnly(); final Object targetId = tryToGetTargetId(commandMessage); final String targetIdString; final String targetIdType; <START> if (targetId != null) { <END> targetIdString = idToString(targetId); targetIdType = targetId.getClass().getName(); } else { targetIdString = ""; targetIdType = ""; } final CommandStorageRecord.Builder builder = CommandStorageRecord.newBuilder() .setMessage(messageAny) .setTimestamp(context.getTimestamp()) .setCommandType(commandType) .setCommandId(commandIdString) .setStatus(CommandStatus.RECEIVED) .setTargetIdType(targetIdType) .setTargetId(targetIdString) .setContext(context); return builder.build(); }</code><technical_language>Please test for null of targetId</technical_language>

Target:
static CommandStorageRecord toStorageRecord(Command command) { final CommandContext context = command.getContext(); final CommandId commandId = context.getCommandId(); final String commandIdString = commandId.getUuid(); final Any messageAny = command.getMessage(); final Message commandMessage = Commands.getMessage(command); final String commandType = TypeName.of(commandMessage).nameOnly(); final Object targetId = tryToGetTargetId(commandMessage); final String targetIdString; final String targetIdType; if (targetId != null) { targetIdString = idToString(targetId); targetIdType = targetId.getClass().getName(); } else { targetIdString = ""; targetIdType = ""; } final CommandStorageRecord.Builder builder = CommandStorageRecord.newBuilder() .setMessage(messageAny) .setTimestamp(context.getTimestamp()) .setCommandType(commandType) .setCommandId(commandIdString) .setStatus(CommandStatus.RECEIVED) .setTargetIdType(targetIdType) .setTargetId(targetIdString) .setContext(context); return builder.build(); }
Source:
<code>public void partActivated(IWorkbenchPartReference partRef) { if (isThisPart(partRef)) { <START> fActive = true; <END> } }</code><technical_language>need call activateParticipants()</technical_language>

Target:
public void partActivated(IWorkbenchPartReference partRef) { if (isThisPart(partRef)) { fActive = true; activateParticipants(fActiveConsole); } }
Source:
<code>public void setup() { event = GitHubEvent.builder() <START> .repo(new GitHubEvent.RepoIdentifier() { <END> @Nullable @Override public Long id() { return null; } @Nullable @Override public String url() { return null; } @Nullable @Override public String repoWithUserName() { return REPO_NAME; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel parcel, int i) { } }) .build(); }</code><technical_language>This need fixed, get today. GitHubEvent.RepoIdentifier a builder. a new release today</technical_language>

Target:
public void setup() { repo = GitHubEvent.RepoIdentifier.builder() .repoWithUserName(REPO_NAME) .build(); event = GitHubEvent.builder() .repo(repo) .build(); }
Source:
<code>public void createDiskWithTagsAndSku() throws InterruptedException { server.enqueue(jsonResponse("/creatediskwithtagsandskuresponse.json").setResponseCode(200)); final DiskApi diskApi = api.getDiskApi(resourcegroup); DiskProperties properties = DiskProperties.builder().diskSizeGB(2).creationData(CreationData.create(CreationData.CreateOptions.EMPTY)).build(); <START> DiskSku sku = DiskSku.builder().name("Premium_LRS").build(); <END> Disk dataDisk = diskApi.createOrUpdate(diskName, "westus", ImmutableMap.of("exampleTag", "jclouds-test-tag"), properties, sku); String path = String.format("/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Compute/disks/%s?%s", subscriptionid, resourcegroup, diskName, apiVersion); String json = "{\"location\":\"westus\",\"tags\":{\"exampleTag\":\"jclouds-test-tag\"},\"properties\":{\"diskSizeGB\":2,\"creationData\":{\"createOption\":\"Empty\"}},\"sku\":{\"name\":\"Premium_LRS\"}}"; assertSent(server, "PUT", path, json); assertEquals(dataDisk.properties().provisioningState(), "Updating"); assertTrue(dataDisk.properties().diskSizeGB() == 2); assertTrue(dataDisk.tags().containsValue("jclouds-test-tag")); }</code><technical_language>Is enum of existing valid Disk types</technical_language>

Target:
public void createDiskWithTagsAndSku() throws InterruptedException { server.enqueue(jsonResponse("/creatediskwithtagsandskuresponse.json").setResponseCode(200)); final DiskApi diskApi = api.getDiskApi(resourcegroup); DiskProperties properties = DiskProperties.builder().diskSizeGB(2).creationData(CreationData.create(CreationData.CreateOptions.EMPTY)).build(); DiskSku sku = DiskSku.builder().name(PREMIUM_LRS).build(); Disk dataDisk = diskApi.createOrUpdate(diskName, "westus", ImmutableMap.of("exampleTag", "jclouds-test-tag"), properties, sku); String path = String.format("/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Compute/disks/%s?%s", subscriptionid, resourcegroup, diskName, apiVersion); String json = "{\"location\":\"westus\",\"tags\":{\"exampleTag\":\"jclouds-test-tag\"},\"properties\":{\"diskSizeGB\":2,\"creationData\":{\"createOption\":\"Empty\"}},\"sku\":{\"name\":\"Premium_LRS\"}}"; assertSent(server, "PUT", path, json); assertEquals(dataDisk.properties().provisioningState(), "Updating"); assertTrue(dataDisk.properties().diskSizeGB() == 2); assertTrue(dataDisk.tags().containsValue("jclouds-test-tag")); }
Source:
<code>ImmutableMultimap<TypeName, TypeName> build() { for (Properties properties : propertiesSet) { put(properties); } <START> final ImmutableMultimap<TypeName, TypeName> result = builder.build(); <END> return result; }</code><technical_language>return builder.build(). opportunity debug/inspect already</technical_language>

Target:
ImmutableMultimap<TypeName, TypeName> build() { for (Properties props : this.properties) { put(props); } return builder.build(); }
Source:
<code>public void test_getDisplayThreadNegated() { final Display display = new Display(); try { final AtomicBoolean threadFinished = new AtomicBoolean (false); final AtomicBoolean isDisplayThread = new AtomicBoolean (true); Thread nonDisplayThread = new Thread () { @Override public void run () { isDisplayThread.set (display.isCurrentThread ()); threadFinished.set (true); } }; nonDisplayThread.start (); synchronized (this) { while <START> (!threadFinished.get <END> ()) { try { wait (1); } catch (InterruptedException e) { e.printStackTrace (); } } } assertFalse (isDisplayThread.get ()); } finally { display.dispose (); } }</code><technical_language>a for() loop iterates a number of iterations waits e.g. 10ms loop total time bounded this test is say, 1s? way, if passes hang for ever. for(int i=0;i++;i<100 && !threadFinished.get()) { Thread.sleep(10); }</technical_language>

Target:
public void test_getDisplayThreadNegated() { final Display display = new Display(); try { final AtomicBoolean threadFinished = new AtomicBoolean (false); final AtomicBoolean isDisplayThread = new AtomicBoolean (true); Thread nonDisplayThread = new Thread () { @Override public void run () { isDisplayThread.set (display.isDisplayThread ()); threadFinished.set (true); } }; nonDisplayThread.start (); for (int i = 0; i < 1000 && !threadFinished.get (); i++) { try { Thread.sleep (1); } catch (InterruptedException e1) { e1.printStackTrace (); } } assertFalse (isDisplayThread.get ()); } finally { display.dispose (); } }
Source:
<code><START> public static boolean isDummyList(RangesAtEndpoint ranges) <END> { return all(ranges, Replica::isLocal) || all(ranges, range -> range.endpoint().getHostAddress(true).equals("0.0.0.0:0")); }</code><technical_language>replicas local a dummy list? 2nd of this predicate is dummy list related</technical_language>

Target:
public static boolean isDummyList(RangesAtEndpoint ranges) { return all(ranges, range -> range.endpoint().getHostAddress(true).equals("0.0.0.0:0")); }
Source:
<code>public boolean isLarge() { <START> return this.getSize() > 65536; <END> }</code><technical_language>Define a constant if once</technical_language>

Target:
public boolean isLarge() { return this.getSize() > largeSizeBytes; }
Source:
<code>public Path getDMNModelPath(final Metadata metadata, final String modelNamespace, final String modelName) { final WorkspaceProject workspaceProject = getProject(metadata); for (final Path dmnModelPath : pathsHelper.getDMNModelsPaths(workspaceProject)) { final Optional<Definitions> definitions = getDefinitionsByPath(dmnModelPath); if (definitions.map(d -> Objects.equals(d.getNamespace(), modelNamespace) && Objects.equals(d.getName(), modelName)).orElse(false)) { return dmnModelPath; } } <START> throw new UnsupportedOperationException("No DMN model could be found for the following namespace: " + modelNamespace); <END> }</code><technical_language>method name, error message more like: "No path of modelName modelNamespace found" is more illegal argument illegal state unsupported operation</technical_language>

Target:
public Path getDMNModelPath(final Metadata metadata, final String modelNamespace, final String modelName) { final WorkspaceProject workspaceProject = getProject(metadata); for (final Path dmnModelPath : pathsHelper.getDMNModelsPaths(workspaceProject)) { final Optional<Definitions> definitions = getDefinitionsByPath(dmnModelPath); if (definitions.map(d -> Objects.equals(d.getNamespace(), modelNamespace) && Objects.equals(d.getName(), modelName)).orElse(false)) { return dmnModelPath; } } throw new IllegalStateException("A path for the DMN model with namespace [" + modelNamespace + "] could not be found."); }
Source:
<code>public void literals() throws Exception { assertThat(symbolicValue("42").isAlwaysNullOrUndefined()).isFalse(); <START> assertThat(symbolicValue("'str'").isAlwaysNullOrUndefined()).isFalse(); <END> }</code><technical_language>@pynicolas is test for truthiness</technical_language>

Target:
public void literals() throws Exception { assertThat(symbolicValue("42").isDefinitelyNullOrUndefined()).isFalse(); assertThat(symbolicValue("'str'").isDefinitelyNullOrUndefined()).isFalse(); assertThat(symbolicValue("0").isDefinitelyNullOrUndefined()).isFalse(); assertThat(symbolicValue("'ab'").truthiness()).isEqualTo(TRUTHY); assertThat(symbolicValue("true").truthiness()).isEqualTo(TRUTHY); assertThat(symbolicValue("42").truthiness()).isEqualTo(TRUTHY); assertThat(symbolicValue("42.").truthiness()).isEqualTo(TRUTHY); assertThat(symbolicValue("42e2").truthiness()).isEqualTo(TRUTHY); assertThat(symbolicValue("0b01").truthiness()).isEqualTo(TRUTHY); assertThat(symbolicValue("0x42").truthiness()).isEqualTo(TRUTHY); assertThat(symbolicValue("0o42").truthiness()).isEqualTo(TRUTHY); assertThat(symbolicValue("0O42").truthiness()).isEqualTo(TRUTHY); assertThat(symbolicValue("042").truthiness()).isEqualTo(TRUTHY); assertThat(symbolicValue("''").truthiness()).isEqualTo(FALSY); assertThat(symbolicValue("\"\"").truthiness()).isEqualTo(FALSY); assertThat(symbolicValue("false").truthiness()).isEqualTo(FALSY); assertThat(symbolicValue("0").truthiness()).isEqualTo(FALSY); assertThat(symbolicValue("0.0").truthiness()).isEqualTo(FALSY); assertThat(symbolicValue("0.e2").truthiness()).isEqualTo(FALSY); assertThat(symbolicValue("0b0").truthiness()).isEqualTo(FALSY); assertThat(symbolicValue("0x0").truthiness()).isEqualTo(FALSY); assertThat(symbolicValue("0o0").truthiness()).isEqualTo(FALSY); assertThat(symbolicValue("0O0").truthiness()).isEqualTo(FALSY); assertThat(symbolicValue("00").truthiness()).isEqualTo(FALSY); }
Source:
<code>public String getIcon() { if(getChannel() == null) return "computer-x.png"; else if (isTemporarilyOffline()) <START> return "computer-u.png"; <END> else return "computer.png"; }</code><technical_language>off-topic, longer self-describing file names helpful</technical_language>

Target:
public String getIcon() { if (isTemporarilyOffline() && getOfflineCause() instanceof OfflineCause.UserCause) return "computer-user-offline.png"; if (isOffline() || !isAcceptingTasks()) return "computer-x.png"; return "computer.png"; }
Source:
<code>private void queueData(MediaFeed userFeed, String userId) { if (userFeed == null) { LOGGER.error("User id, {}, returned a NULL media feed from instagram.", userId); } else { for (MediaFeedData data : userFeed.getData()) { <START> this.dataQueue.offer(data); <END> } } }</code><technical_language>Offer fail. ComponentUtils.offerUntilSuccess locking removed in method <LINK_0></technical_language>

Target:
private void queueData(MediaFeed userFeed, String userId) { if (userFeed == null) { LOGGER.warn("User id, {}, returned a NULL media feed from instagram.", userId); } else { for (MediaFeedData data : userFeed.getData()) { ComponentUtils.offerUntilSuccess(data, this.dataQueue); } } }
Source:
<code>protected ValidatorError processCommandSetters(PersistOperation operation, DynaActionForm form, HttpServletRequest request) { BaseTreeEditOperation bte = (BaseTreeEditOperation) operation; String label = form.getString(LABEL); if (!label.equals(bte.getTree().getLabel())) { KickstartableTree tree = KickstartFactory.lookupKickstartTreeByLabel( label, bte.getUser().getOrg()); if (tree != null) { return new ValidatorError("distribution.tree.exists", tree.getLabel()); } } bte.setBasePath(form.getString(BASE_PATH)); Long channelId = (Long) form.get(CHANNEL_ID); Channel c = ChannelFactory.lookupByIdAndUser(channelId, operation.getUser()); bte.setChannel(c); bte.setLabel(form.getString(LABEL)); KickstartInstallType type = KickstartFactory. lookupKickstartInstallTypeByLabel(form.getString(INSTALL_TYPE)); bte.setInstallType(type); if (type.isSUSE()) { String kopts = form.getString(POST_KERNEL_OPTS); if (kopts.contains("install=")) { kopts = kopts + " install=http://" + request.getLocalName() + "/ks/dist/" + form.getString(LABEL); } if (!kopts.contains("self_update=")) { <START> kopts = kopts + " self_update=0 pt.options=self_update"; <END> } bte.setKernelOptions(kopts); } else { bte.setKernelOptions(form.getString(KERNEL_OPTS)); } bte.setPostKernelOptions(form.getString(POST_KERNEL_OPTS)); return null; }</code><technical_language>@hustodemon : please update. is '+' sign missing. Correct be: kopts = kopts + " self_update=0 pt.options=+self_update";</technical_language>

Target:
protected ValidatorError processCommandSetters(PersistOperation operation, DynaActionForm form, HttpServletRequest request) { BaseTreeEditOperation bte = (BaseTreeEditOperation) operation; String label = form.getString(LABEL); if (!label.equals(bte.getTree().getLabel())) { KickstartableTree tree = KickstartFactory.lookupKickstartTreeByLabel( label, bte.getUser().getOrg()); if (tree != null) { return new ValidatorError("distribution.tree.exists", tree.getLabel()); } } bte.setBasePath(form.getString(BASE_PATH)); Long channelId = (Long) form.get(CHANNEL_ID); Channel c = ChannelFactory.lookupByIdAndUser(channelId, operation.getUser()); bte.setChannel(c); bte.setLabel(form.getString(LABEL)); KickstartInstallType type = KickstartFactory. lookupKickstartInstallTypeByLabel(form.getString(INSTALL_TYPE)); bte.setInstallType(type); if (type.isSUSE()) { String kopts = form.getString(POST_KERNEL_OPTS); if (kopts.contains("install=")) { kopts = kopts + " install=http://" + request.getLocalName() + "/ks/dist/" + form.getString(LABEL); } if (!kopts.contains("self_update=")) { kopts = kopts + " self_update=0 pt.options=+self_update"; } bte.setKernelOptions(kopts); } else { bte.setKernelOptions(form.getString(KERNEL_OPTS)); } bte.setPostKernelOptions(form.getString(POST_KERNEL_OPTS)); return null; }
Source:
<code>public static HiveStorageFormat getHiveStorageFormat(ConnectorSession session) { <START> return HiveStorageFormat.valueOf(requireNonNull(session.getProperty(HIVE_STORAGE_FORMAT, String.class), String.format("%s is null", HIVE_STORAGE_FORMAT))); <END> }</code><technical_language>I do HiveTableProperties: HiveStorageFormat.valueOf(((String) value).toUpperCase(ENGLISH)</technical_language>

Target:
public static HiveStorageFormat getHiveStorageFormat(ConnectorSession session) { return HiveStorageFormat.valueOf(session.getProperty(HIVE_STORAGE_FORMAT, String.class).toUpperCase(ENGLISH)); }
Source:
<code>public void run() { for (Map.Entry<String, AtomicLong> hostAndRequestCount : hostToRequestCount.entrySet()) { String hostname = hostAndRequestCount.getKey(); AtomicLong requestCount = hostAndRequestCount.getValue(); Long hostSleepTime = hostToSleepTime.get(hostname); logger.info("For host {}, request count per sec is {}, current sleep time is ms", hostname, requestCount.get(), hostSleepTime); if (targetQPS > 0 && requestCount.get() > 0) { long val = requestCount.get() * 100 * hostSleepTime / targetQPS; <START> hostSleepTime = val / 100 + (val > 100 && (val % 100 >= 50 || hostSleepTime == 1) ? 1 : 0); <END> requestCount.set(0); logger.info("Updated sleep time is ms for host {}", hostSleepTime, hostname); } hostToSleepTime.put(hostname, hostSleepTime); } }</code><technical_language>I understand calculation here, elaborate? BTW, I some simple function long rtt = 1000 / request.get() - hostSleepTime; hostSleepTime -= rrt do</technical_language>

Target:
public void run() { for (Map.Entry<String, AtomicLong> hostAndRequestCount : hostToRequestCount.entrySet()) { String hostname = hostAndRequestCount.getKey(); AtomicLong requestCount = hostAndRequestCount.getValue(); Long hostSleepTime = hostToSleepTime.get(hostname); long currentQPS = requestCount.get(); logger.info("For host {}, request count per sec is {}, current sleep time is ms", hostname, currentQPS, hostSleepTime); if (targetQPS > 0 && currentQPS > 0) { long newSleepTime = currentQPS * hostSleepTime / targetQPS; newSleepTime = newSleepTime + ((currentQPS > targetQPS && newSleepTime == hostSleepTime) ? 1 : 0); hostSleepTime = newSleepTime; requestCount.set(0); logger.info("Updated sleep time is ms for host {}", hostSleepTime, hostname); } hostToSleepTime.put(hostname, hostSleepTime); } }
Source:
<code>public ProcessInputStream startProcess() throws IOException{ File javaHome = getJavaHome(); ArrayList<String> proxyProperties = getProxyProperties(); String java = javaHome == null ? "java" : String.format("%s/bin/java",javaHome.getAbsolutePath()); <START> CommandBuilder cb = new CommandBuilder(java).add("-DJENKINS_HOME=" + getJenkinsHome()); <END> for (String proxyProp: proxyProperties) { cb.add(proxyProp); } cb.add("-Duser.language=en", "-jar", war, "--ajp13Port=-1", "--httpPort=" + httpPort); cb.env.putAll(commonLaunchEnv()); System.out.println("Starting Jenkins: " + cb.toString()); return cb.popen(); }</code><technical_language>getJenkinsHome() return a valid jenkinsHome here? asking, does; best</technical_language>

Target:
public ProcessInputStream startProcess() throws IOException{ File javaHome = getJavaHome(); ArrayList<String> proxyProperties = getProxyProperties(); String java = javaHome == null ? "java" : String.format("%s/bin/java",javaHome.getAbsolutePath()); CommandBuilder cb = new CommandBuilder(java).add("-DJENKINS_HOME=" + getJenkinsHome()); for (String proxyProp: proxyProperties) { cb.add(proxyProp); } cb.add("-Duser.language=en"); cb.add("-jar", war); cb.add("--ajp13Port=-1"); cb.add("--httpPort=" + httpPort); cb.env.putAll(commonLaunchEnv()); System.out.println("Starting Jenkins: " + cb.toString()); return cb.popen(); }
Source:
<code>private RemoteWebElement newElement(final String elementId) { final RemoteWebElement element = new RemoteWebElement(); element.setParent(driver); element.setId(elementId); element.setFileDetector(driver.getFileDetector()); <START> return element; <END> }</code><technical_language>This method instead return class MobileElement. return new MobileElement(element, driver); elements returned complexFind easily cast MobileElement. Additionally, methods in this class return MobileElement WebElement. driver instance of AppiumDriver, return MobileElements</technical_language>

Target:
private MobileElement newElement(final String elementId) { final MobileElement element = new MobileElement(new RemoteWebElement(), driver); element.setParent(driver); element.setId(elementId); element.setFileDetector(driver.getFileDetector()); return element; }
Source:
<code>public DlmsConnection connect(final DlmsDevice device, final DlmsMessageListener dlmsMessageListener) throws TechnicalException { this.checkDevice(device); this.checkIpAddress(device); try { return this.createConnection(device, dlmsMessageListener); } catch (final UnknownHostException e) { LOGGER.warn("The IP address is not found: {}", device.getIpAddress(), e); throw new TechnicalException(ComponentType.PROTOCOL_DLMS, "The IP address is not found: " + device.getIpAddress()); } catch (final IOException e) { throw new ConnectionException(e); } catch (final EncrypterException e) { <START> LOGGER.error("decryption on security keys went wrong for device: {}", device.getDeviceIdentification(), e); <END> throw new TechnicalException(ComponentType.PROTOCOL_DLMS, "decryption on security keys went wrong for device: " + device.getDeviceIdentification()); } }</code><technical_language>"decryption OF security keys..."</technical_language>

Target:
public DlmsConnection connect(final DlmsDevice device, final DlmsMessageListener dlmsMessageListener) throws TechnicalException { this.checkDevice(device); this.checkIpAddress(device); try { return this.createConnection(device, dlmsMessageListener); } catch (final UnknownHostException e) { LOGGER.warn("The IP address is not found: {}", device.getIpAddress(), e); throw new TechnicalException(ComponentType.PROTOCOL_DLMS, "The IP address is not found: " + device.getIpAddress()); } catch (final IOException e) { throw new ConnectionException(e); } catch (final EncrypterException e) { LOGGER.error("decryption of security keys failed for device: {}", device.getDeviceIdentification(), e); throw new TechnicalException(ComponentType.PROTOCOL_DLMS, "decryption of security keys failed for device: " + device.getDeviceIdentification()); } }
Source:
<code>public void run() { try { Thread.sleep(timeout); this.timedout.setIsSatisfied(true); } catch (InterruptedException e) { <START> byte a = 0; <END> } }</code><technical_language>Hmmm if is a do this</technical_language>

Target:
public void run() { try { Thread.sleep(timeout); this.timedout.setIsSatisfied(true); } catch (InterruptedException e) { } }
Source:
<code>public int getStateTableIndex(ITimeEvent event) { if (event instanceof TimeEvent) { TimeEvent timeEvent = (TimeEvent) event; Object value = timeEvent.getLabel(); if (value != null) { return Math.floorMod(value.hashCode(), NUM_COLORS); } ITimeGraphEntry entry = event.getEntry(); <START> ITimeGraphEntryModel model = ((TimeGraphEntry) entry).getModel(); <END> if(model instanceof StateSystemEntryModel || model instanceof ModuleEntryModel) { return INVISIBLE; } return NUM_COLORS; } return INVISIBLE; }</code><technical_language>deprecated, this ITmfTreeDataModel model = ((TimeGraphEntry) entry).getEntryModel();</technical_language>

Target:
public int getStateTableIndex(ITimeEvent event) { if (event instanceof TimeEvent) { TimeEvent timeEvent = (TimeEvent) event; Object value = timeEvent.getLabel(); if (value != null) { return Math.floorMod(value.hashCode(), NUM_COLORS); } ITimeGraphEntry entry = event.getEntry(); ITmfTreeDataModel model = ((TimeGraphEntry) entry).getEntryModel(); if(model instanceof StateSystemEntryModel || model instanceof ModuleEntryModel) { return INVISIBLE; } return NUM_COLORS; } return INVISIBLE; }
Source:
<code>private void updateHosts(StoragePool datacenter) { AsyncDataProvider.getInstance().getHostListByDataCenter(new AsyncQuery<>(hosts -> { ArrayList<VDS> filteredHosts = new ArrayList<>(); for (VDS host : hosts) { if (isHostAvailable(host)) { filteredHosts.add(host); } } Collections.sort(filteredHosts, new NameableComparator()); getHost().setItems(filteredHosts); <START> getSanStorageModelBase().clearSanStorageModel(); <END> }), datacenter.getId()); }</code><technical_language>need verify 'getSanStorageModelBase' is null, set for block domains</technical_language>

Target:
private void updateHosts(StoragePool datacenter) { AsyncDataProvider.getInstance().getHostListByDataCenter(new AsyncQuery<>(hosts -> { ArrayList<VDS> filteredHosts = new ArrayList<>(); for (VDS host : hosts) { if (isHostAvailable(host)) { filteredHosts.add(host); } } Collections.sort(filteredHosts, new NameableComparator()); getHost().setItems(filteredHosts); if (getSanStorageModelBase() != null) { getSanStorageModelBase().clearSanStorageModel(); } }), datacenter.getId()); }
Source:
<code>private Function<PollingContext<OperationResult>, Mono<OperationResult>> analyzeFormStreamActivationOperation( Flux<ByteBuffer> data, String modelId, long length, FormContentType formContentType, boolean includeTextDetails) { Objects.requireNonNull(data, "'data' is required and cannot be null."); Objects.requireNonNull(modelId, "'modelId' is required and cannot be null."); final long[] bufferedDataSize = {0}; final List<ByteBuffer> cachedBuffers = new LinkedList<>(); final AtomicBoolean[] isGuessed = {new AtomicBoolean(true)}; final ContentType[] contentType = new ContentType[1]; <START> return pollingContext -> data.filter(ByteBuffer::hasRemaining) <END> .windowUntil(buffer -> { if (bufferedDataSize[0] >= length) { return false; } bufferedDataSize[0] += buffer.remaining(); if (formContentType == null && isGuessed[0].get() && bufferedDataSize[0] >= 4) { byte[] bytes = buffer.array(); contentType[0] = getContentType(ByteBuffer.wrap(bytes)); isGuessed[0].compareAndSet(true, false); } ByteBuffer cachedBuffer = ByteBuffer.allocate(buffer.remaining()).put(buffer); cachedBuffer.flip(); cachedBuffers.add(cachedBuffer); if (bufferedDataSize[0] >= length) { return true; } return false; }, true, Integer.MAX_VALUE) .next() .flatMap(newData -> { final ContentType contentTypeFinal = formContentType == null ? contentType[0] : ContentType.fromString(formContentType.toString()); return service.analyzeWithCustomModelWithResponseAsync(UUID.fromString(modelId), contentTypeFinal, Flux.fromIterable(cachedBuffers), length, includeTextDetails) .map(response -> new OperationResult(parseModelId(response.getDeserializedHeaders().getOperationLocation()))); }); }</code><technical_language>This logic appears duplicated times, chance this abstracted? Possibly a method takes Flux<ByteBuffer> returns Mono<Tuple2<ContentType, Flux<ByteBuffer>></technical_language>

Target:
private Function<PollingContext<OperationResult>, Mono<OperationResult>> analyzeFormStreamActivationOperation( Flux<ByteBuffer> data, String modelId, long length, FormContentType formContentType, boolean includeTextDetails) { Objects.requireNonNull(data, "'data' is required and cannot be null."); Objects.requireNonNull(modelId, "'modelId' is required and cannot be null."); return pollingContext -> { if (formContentType != null) { try { return service.analyzeWithCustomModelWithResponseAsync(UUID.fromString(modelId), ContentType.fromString(formContentType.toString()), data, length, includeTextDetails) .map(response -> new OperationResult(parseModelId( response.getDeserializedHeaders().getOperationLocation()))); } catch (RuntimeException ex) { return monoError(logger, ex); } } else { return detectContentType(data) .flatMap(contentType -> service.analyzeWithCustomModelWithResponseAsync(UUID.fromString(modelId), contentType, data, length, includeTextDetails) .map(response -> new OperationResult( parseModelId(response.getDeserializedHeaders().getOperationLocation())))); } }; }
Source:
<code>public DataTransactionResult remove(DataHolder dataHolder) { if (supports(dataHolder)) { <START> if (((net.minecraft.entity.Entity) dataHolder).isRiding()) { <END> ((net.minecraft.entity.Entity) dataHolder).ridingEntity = null; return DataTransactionBuilder.builder().result(DataTransactionResult.Type.SUCCESS).build(); } else { return DataTransactionBuilder.builder().result(DataTransactionResult.Type.FAILURE).build(); } } else { return DataTransactionBuilder.builder().result(DataTransactionResult.Type.FAILURE).build(); } }</code><technical_language>is riding</technical_language>

Target:
public DataTransactionResult remove(DataHolder dataHolder) { return DataTransactionBuilder.failNoData(); }
Source:
<code>public GatewayAPIDTO getAPIArtifact(String apiId, String gatewayLabel) { <START> <END> GatewayAPIDTO gatewayAPIDTO = null; if (gatewayArtifactSynchronizerProperties.getGatewayLabels().contains(gatewayLabel)) { if (artifactRetriever != null) { try { String gatewayRuntimeArtifact = artifactRetriever.retrieveArtifact(apiId, gatewayLabel, APIConstants.GatewayArtifactSynchronizer.GATEWAY_INSTRUCTION_PUBLISH); gatewayAPIDTO = new Gson().fromJson(gatewayRuntimeArtifact, GatewayAPIDTO.class); } catch (ArtifactSynchronizerException e) { log.error("Error retrieving artifacts of " + apiId + " from storage", e); } } else { log.error("Artifact retriever not found"); } } return gatewayAPIDTO; }</code><technical_language>For undeploy, Do need retrieve info</technical_language>

Target:
public GatewayAPIDTO getAPIArtifact(String apiId, String gatewayLabel) { GatewayAPIDTO gatewayAPIDTO = null; if (gatewayArtifactSynchronizerProperties.getGatewayLabels().contains(gatewayLabel)) { if (artifactRetriever != null) { try { String gatewayRuntimeArtifact = artifactRetriever.retrieveArtifact(apiId, gatewayLabel, APIConstants.GatewayArtifactSynchronizer.GATEWAY_INSTRUCTION_PUBLISH); if (gatewayRuntimeArtifact != null) { gatewayAPIDTO = new Gson().fromJson(gatewayRuntimeArtifact, GatewayAPIDTO.class); } else { log.error("Error retrieving artifacts for API " + apiId + ". Storage returned null"); } } catch (ArtifactSynchronizerException e) { log.error("Error retrieving artifacts of " + apiId + " from storage", e); } } else { log.error("Artifact retriever not found"); } } return gatewayAPIDTO; }
Source:
<code>private static void insertFromJson(CqlSession session) { User alice = new User("alice", 30); User bob = new User("bob", 35); ObjectNode aliceScores = JsonNodeFactory.instance.objectNode().put("call_of_duty", 4.8).put("pokemon_go", 9.7); ObjectNode bobScores = JsonNodeFactory.instance.objectNode().put("zelda", 8.3).put("pokemon_go", 12.4); Statement stmt = insertInto("examples", "json_jackson_function") .value("id", literal(1)) <START> .value("user", function(CqlIdentifier.fromCql("fromJson"), literal(alice, USER_CODEC))) <END> .value( "scores", function(CqlIdentifier.fromCql("fromJson"), literal(aliceScores, JSON_NODE_CODEC))) .build(); System.out.println(((SimpleStatement) stmt).getQuery()); session.execute(stmt); System.out.println("after"); PreparedStatement pst = session.prepare( insertInto("examples", "json_jackson_function") .value("id", bindMarker("id")) .value("user", function(CqlIdentifier.fromCql("fromJson"), bindMarker("user"))) .value("scores", function(CqlIdentifier.fromCql("fromJson"), bindMarker("scores"))) .build()); System.out.println(pst.getQuery()); session.execute( pst.bind() .setInt("id", 2) .set("user", bob, User.class) .set("scores", bobScores, JsonNode.class)); }</code><technical_language>string variant of function for simplicity: suggestion .value("user", function("fromJson", literal(alice, USER_CODEC))) examples do for else (table name, bind marker, etc)</technical_language>

Target:
private static void insertFromJson(CqlSession session) { User alice = new User("alice", 30); User bob = new User("bob", 35); ObjectNode aliceScores = JsonNodeFactory.instance.objectNode().put("call_of_duty", 4.8).put("pokemon_go", 9.7); ObjectNode bobScores = JsonNodeFactory.instance.objectNode().put("zelda", 8.3).put("pokemon_go", 12.4); Statement stmt = insertInto("examples", "json_jackson_function") .value("id", literal(1)) .value( "user", function("fromJson", literal(alice, session.getContext().getCodecRegistry()))) .value( "scores", function("fromJson", literal(aliceScores, session.getContext().getCodecRegistry()))) .build(); System.out.println(((SimpleStatement) stmt).getQuery()); session.execute(stmt); System.out.println("after"); PreparedStatement pst = session.prepare( insertInto("examples", "json_jackson_function") .value("id", bindMarker("id")) .value("user", function("fromJson", bindMarker("user"))) .value("scores", function("fromJson", bindMarker("scores"))) .build()); System.out.println(pst.getQuery()); session.execute( pst.bind() .setInt("id", 2) .set("user", bob, User.class) .set("scores", bobScores, JsonNode.class)); }
Source:
<code>private boolean canLogAtLevel(int logLevel, int environmentLoggingLevel) { <START> if (logLevel < environmentLoggingLevel || logger == null) { <END> return false; } switch (logLevel) { case VERBOSE_LEVEL: return logger.isDebugEnabled(); case INFORMATIONAL_LEVEL: return logger.isInfoEnabled(); case WARNING_LEVEL: return logger.isWarnEnabled(); case ERROR_LEVEL: return logger.isErrorEnabled(); default: return false; } }</code><technical_language>logger null. need null check here</technical_language>

Target:
private boolean canLogAtLevel(int logLevel, int environmentLoggingLevel) { if (logLevel < environmentLoggingLevel) { return false; } switch (logLevel) { case VERBOSE_LEVEL: return logger.isDebugEnabled(); case INFORMATIONAL_LEVEL: return logger.isInfoEnabled(); case WARNING_LEVEL: return logger.isWarnEnabled(); case ERROR_LEVEL: return logger.isErrorEnabled(); default: return false; } }
Source:
<code>public void write(DataOutput dataOutput) throws IOException { try { dataOutput.writeLong(this.getLength()); for (int i = 0; i < this.getLength(); i++) { AbstractFileMetadata fileMetaData = fileMetaDataList.get(i); dataOutput.writeUTF(fileMetaData.getFileName()); dataOutput.writeUTF(fileMetaData.getFullPath()); dataOutput.writeLong(fileMetaData.getTimeStamp()); dataOutput.writeUTF(fileMetaData.getOwner()); dataOutput.writeLong(fileMetaData.getFileSize()); dataOutput.writeBoolean(fileMetaData.getIsFolder()); dataOutput.writeUTF(fileMetaData.getBasePath()); dataOutput.writeShort(fileMetaData.getPermission()); writeCredentials(dataOutput, fileMetaData.getCredentials()); } <START> } catch (Exception e) { <END> LOG.error("serialization failed"); } }</code><technical_language>log skip. exception propagate, handled mapreduce</technical_language>

Target:
public void write(DataOutput dataOutput) throws IOException { try { dataOutput.writeLong(this.getTotalBytes()); dataOutput.writeLong(this.getLength()); for (AbstractFileMetadata fileMetaData : fileMetaDataList) { fileMetaData.write(dataOutput); } } catch (InterruptedException interruptedException) { throw new IOException("Failed to get length for InputSplit"); } }
Source:
<code>public void setup() { String url = baseUrl + "/api/v1/sections/" + SECTION_ID + "/assignments/" + ASSIGNEMNET_ID + "/submissions/update_grades"; <START> LOG.info(url); <END> fakeRestClient.addSuccessResponse(url, "SampleJson/Progress.json"); submissionWriter = new SubmissionImpl(baseUrl, apiVersion, SOME_OAUTH_TOKEN, fakeRestClient, SOME_CONNECT_TIMEOUT, SOME_READ_TIMEOUT, DEFAULT_PAGINATION_PAGE_SIZE); }</code><technical_language>this log statement a message, changed DEBUG level, removed</technical_language>

Target:
public void setup() { String url = baseUrl + "/api/v1/sections/" + SECTION_ID + "/assignments/" + ASSIGNEMNET_ID + "/submissions/update_grades"; fakeRestClient.addSuccessResponse(url, "SampleJson/Progress.json"); submissionWriter = new SubmissionImpl(baseUrl, apiVersion, SOME_OAUTH_TOKEN, fakeRestClient, SOME_CONNECT_TIMEOUT, SOME_READ_TIMEOUT, DEFAULT_PAGINATION_PAGE_SIZE); }
Source:
<code>private void doRead() throws Exception { if (this.rawBuffer == null) { this.rawBuffer = allocate(maxMessageSize); } this.writingToPipe = true; try { if (this.taskExecutor == null) { ExecutorService executor = Executors.newCachedThreadPool(); this.taskExecutor = new CompositeExecutor(executor, executor); } if (checkForAssembler()) { if (logger.isTraceEnabled()) { logger.trace("Before read:" + this.rawBuffer.position() + "/" + this.rawBuffer.limit()); } int len = this.socketChannel.read(this.rawBuffer); if (len < 0) { this.writingToPipe = false; this.closeConnection(true); } if (logger.isTraceEnabled()) { logger.trace("After read:" + this.rawBuffer.position() + "/" + this.rawBuffer.limit()); } this.rawBuffer.flip(); if (logger.isTraceEnabled()) { logger.trace("After flip:" + this.rawBuffer.position() + "/" + this.rawBuffer.limit()); } if (logger.isDebugEnabled()) { logger.debug("Read " + rawBuffer.limit() + " into raw buffer"); } <START> this.sendToPipe(rawBuffer); <END> } } catch (Exception e) { this.publishConnectionExceptionEvent(e); throw e; } finally { this.writingToPipe = false; } }</code><technical_language>I I agree do shift this.sendToPipe(rawBuffer); new Thread, block current Thread latch.await(this.pipeTimeout , TimeUnit.MILLISECONDS) submition anyway</technical_language>

Target:
private void doRead() throws Exception { if (this.rawBuffer == null) { this.rawBuffer = allocate(maxMessageSize); } this.writingToPipe = true; try { if (this.taskExecutor == null) { ExecutorService executor = Executors.newCachedThreadPool(); this.taskExecutor = new CompositeExecutor(executor, executor); } if (checkForAssembler()) { if (logger.isTraceEnabled()) { logger.trace("Before read:" + this.rawBuffer.position() + "/" + this.rawBuffer.limit()); } int len = this.socketChannel.read(this.rawBuffer); if (len < 0) { this.writingToPipe = false; this.closeConnection(true); } if (logger.isTraceEnabled()) { logger.trace("After read:" + this.rawBuffer.position() + "/" + this.rawBuffer.limit()); } this.rawBuffer.flip(); if (logger.isTraceEnabled()) { logger.trace("After flip:" + this.rawBuffer.position() + "/" + this.rawBuffer.limit()); } if (logger.isDebugEnabled()) { logger.debug("Read " + rawBuffer.limit() + " into raw buffer"); } this.sendToPipe(rawBuffer); } } catch (RejectedExecutionException e) { throw e; } catch (Exception e) { this.publishConnectionExceptionEvent(e); throw e; } finally { this.writingToPipe = false; } }
Source:
<code>public boolean hasNext() { <START> return readBytes < readLength && input.isReadable(); <END> }</code><technical_language>Instead of keeping track of readBytes ByteStreams#limit</technical_language>

Target:
public boolean hasNext() { return input.position() < readLength && input.isReadable(); }
Source:
<code><START> public void readWriteTiles() throws FormatException, DependencyException, ServiceException, IOException { <END> ServiceFactory factory = new ServiceFactory(); OMEXMLService service = factory.getInstance(OMEXMLService.class); IMetadata omexml = service.createOMEXMLMetadata(); reader = new ImageReader(); reader.setMetadataStore(omexml); reader.setId(inputFile); writer = new OMETiffWriter(); writer.setMetadataRetrieve(omexml); writer.setInterleaved(reader.isInterleaved()); writer.setTileSizeX(tileSizeX); writer.setTileSizeY(tileSizeY); writer.setId(outputFile); byte[] buf = new byte[FormatTools.getPlaneSize(reader)]; for (int series=0; series<reader.getSeriesCount(); series++) { reader.setSeries(series); writer.setSeries(series); for (int image=0; image<reader.getImageCount(); image++) { buf = reader.openBytes(image); writer.saveBytes(image, buf); } } }</code><technical_language>above, explanation for some exception useful</technical_language>

Target:
public void readWriteTiles() throws FormatException, DependencyException, ServiceException, IOException { byte[] buf = new byte[FormatTools.getPlaneSize(reader)]; for (int series=0; series<reader.getSeriesCount(); series++) { reader.setSeries(series); writer.setSeries(series); for (int image=0; image<reader.getImageCount(); image++) { buf = reader.openBytes(image); writer.saveBytes(image, buf); } } }
Source:
<code>public void initializeQuery(String query) { this.query = query; this.queryList.clear(); <START> offset=0; END> view.setIsLastPage(false); view.clearAdapter(); }</code><technical_language>spacing</technical_language>

Target:
public void initializeQuery(String query) { this.query = query; this.queryList.clear(); offset = 0; compositeDisposable.clear(); view.setIsLastPage(false); view.clearAdapter(); }
Source:
<code>public void testSessionTokenIdentifierRoundTripNoRenewer() throws Throwable { SessionTokenIdentifier id = new SessionTokenIdentifier( SESSION_TOKEN_KIND, new Text(), null, landsatUri, new MarshalledCredentials("a", "b", "c"), new EncryptionSecrets(), ""); SessionTokenIdentifier result = S3ATestUtils.roundTrip(id, null); String ids = id.toString(); assertEquals("URI in " + ids, id.getUri(), result.getUri()); assertEquals("credentials in " + ids, id.getMarshalledCredentials(), result.getMarshalledCredentials()); <START> assertEquals(new Text(), id.getRenewer()); <END> }</code><technical_language>add message "renewer in " + ids</technical_language>

Target:
public void testSessionTokenIdentifierRoundTripNoRenewer() throws Throwable { SessionTokenIdentifier id = new SessionTokenIdentifier( SESSION_TOKEN_KIND, new Text(), null, landsatUri, new MarshalledCredentials("a", "b", "c"), new EncryptionSecrets(), ""); SessionTokenIdentifier result = S3ATestUtils.roundTrip(id, null); String ids = id.toString(); assertEquals("URI in " + ids, id.getUri(), result.getUri()); assertEquals("credentials in " + ids, id.getMarshalledCredentials(), result.getMarshalledCredentials()); assertEquals("renewer in " + ids, new Text(), id.getRenewer()); }
Source:
<code>public LicensedVideoSwapHistoryPageObject navigateToHistoryPage() { <START> this.waitForElementByElement(lvsHistoryBtn); <END> lvsHistoryBtn.click(); this.waitForElementByElement(backLink); PageObjectLogging.log("navigateToHistoryPage", "lvs history button navigates to right page", true); return new LicensedVideoSwapHistoryPageObject(driver); }</code><technical_language>need 'this' in waitForElementByElement method. please remove consistency repo if is specific reason for adding this</technical_language>

Target:
public LicensedVideoSwapHistoryPageObject navigateToHistoryPage() { waitForElementByElement(lvsHistoryBtn); lvsHistoryBtn.click(); waitForElementByElement(backLink); PageObjectLogging.log("navigateToHistoryPage", "lvs history button navigates to right page", true); return new LicensedVideoSwapHistoryPageObject(driver); }
Source:
<code><START> public final void unSetClockBit() { <END> long val = state.get(); while (State.isClockBitSet(val) && !state.compareAndSet(val, State.unSetClockBit(val))) { val = state.get(); } }</code><technical_language>a need for unSet check clockBit (observed) reset clock bit</technical_language>

Target:
public final boolean unSetClockBit() { long val = state.get(); if (!State.isClockBitSet(val)) return false; while (State.isClockBitSet(val)) { if (state.compareAndSet(val, State.unSetClockBit(val))) return true; val = state.get(); } return false; }
Source:
<code>public void notDistortContent() throws IOException { final int length = 1000000; final File tempfile = this.temp.newFile("notDistortContent.tmp"); final BufferedWriter bwr = new BufferedWriter(new FileWriter(tempfile)); final String head = Joiner.on(RqMultipartTest.CRLF).join( "--zzz1", "Content-Disposition: form-data; name=\"test1\"", "", "" ); bwr.write(head); final int byt = 0x7f; for (int idx = 0; idx < length; ++idx) { bwr.write(idx % byt); } final String foot = Joiner.on(RqMultipartTest.CRLF).join( "", "--zzz1--", "" ); bwr.write(foot); bwr.close(); final Request req = new RqFake( Arrays.asList( "POST /post?u=3 HTTP/1.1", "Host: exampl.com", contentLengthHeader( head.getBytes().length + length + foot.getBytes().length ), "Content-Type: multipart/form-data; boundary=zzz1" ), new TempInputStream(new FileInputStream(tempfile), tempfile) ); final InputStream stream = new RqMultipart.Smart( new RqMultipart.Base(req) ).single("test1").body(); try { MatcherAssert.assertThat( stream.available(), Matchers.equalTo(length) ); for (int idx = 0; idx < length; ++idx) { MatcherAssert.assertThat( String.format("byte %d not matched", idx), stream.read(), <START> Matchers.equalTo(idx % byt) <END> ); } } finally { req.body().close(); stream.close(); } }</code><technical_language>@raphaelln minor: Matchers.is</technical_language>

Target:
public void notDistortContent() throws IOException { final int length = 1000000; final String part = "test1"; final File file = this.temp.newFile("notDistortContent.tmp"); final BufferedWriter bwr = new BufferedWriter(new FileWriter(file)); final String head = Joiner.on(RqMultipartTest.CRLF).join( "--zzz1", String.format(RqMultipartTest.CONTENT, part), "", "" ); bwr.write(head); final int byt = 0x7f; for (int idx = 0; idx < length; ++idx) { bwr.write(idx % byt); } final String foot = Joiner.on(RqMultipartTest.CRLF).join( "", "--zzz1--", "" ); bwr.write(foot); bwr.close(); final Request req = new RqFake( Arrays.asList( "POST /post?u=3 HTTP/1.1", "Host: exampl.com", contentLengthHeader( head.getBytes().length + length + foot.getBytes().length ), "Content-Type: multipart/form-data; boundary=zzz1" ), new TempInputStream(new FileInputStream(file), file) ); final InputStream stream = new RqMultipart.Smart( new RqMultipart.Base(req) ).single(part).body(); try { MatcherAssert.assertThat( stream.available(), Matchers.equalTo(length) ); for (int idx = 0; idx < length; ++idx) { MatcherAssert.assertThat( String.format("byte %d not matched", idx), stream.read(), Matchers.equalTo(idx % byt) ); } } finally { req.body().close(); stream.close(); } }
Source:
<code><START> public void createGeoExitAlert() throws Exception { <END> Boolean result = geoLocationProviderServiceImpl. createGeoAlert(getTestAlert(), getDeviceIdentifier(), DeviceManagementConstants.GeoServices.ALERT_TYPE_EXIT); Assert.assertEquals(result, Boolean.TRUE); verifyPrivate(geoLocationProviderServiceImpl).invoke("getEventProcessorAdminServiceStub"); }</code><technical_language>throwing generic exceptions, throw relevant exceptions</technical_language>

Target:
public void createGeoExitAlert() throws GeoLocationBasedServiceException { Boolean result = geoLocationProviderServiceImpl. createGeoAlert(getExitAlert(), getDeviceIdentifier(), DeviceManagementConstants.GeoServices.ALERT_TYPE_EXIT); Assert.assertEquals(result, Boolean.TRUE); }
Source:
<code>public long getTimestamp() { try { return locateBlobObjectStamp(); } catch (CoreException e) { <START> e.printStackTrace(); <END> return -1; } }</code><technical_language>errors properly logged, printed system error</technical_language>

Target:
public long getTimestamp() { try { return locateBlobObjectStamp(); } catch (CoreException e) { Activator.logError(e.getMessage(), e); return -1; } }
Source:
<code>public void sendResponse(final Exchange exchange, final Response response) { try { if (exchange.getRequest().getOptions().hasObserve()) { exchange.retransmitResponse(); <START> } <END> top.sendResponse(exchange, response); } catch (Exception ex) { response.setSendError(ex); } }</code><technical_language>This is totally out of topic move this if block CoapEndpoint BaseCoapStack I get point of it</technical_language>

Target:
public void sendResponse(final Exchange exchange, final Response response) { try { if (exchange.getRequest().getOptions().hasObserve()) { exchange.retransmitResponse(); } top.sendResponse(exchange, response); } catch (RuntimeException ex) { response.setSendError(ex); } }