auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Request handleRequest(final Request req) { LOG.info("Parsing data request!"); DataRequest dataReq; try { dataReq = DataRequest.parseFrom(req.getOtherData()); final Request.Builder resultReq = Request.newBuilder(req); resultReq.clearOtherData(); final DataResult.Builder builder = DataResult.newBuilder(); try { for (ItemRequest itemReq : dataReq.getItemsList()) { if (itemReq.getQuery() == ItemQuery.EXPERIMENT) { if (!itemReq.hasAdvanceQuery()) { builder.addResults(handleSingleExperiment(itemReq)); } else { builder.addResults(getExperimentsForInstructor(itemReq)); } } } } catch (Exception e) { final Message.ProtoException protoEx = ExceptionUtilities.createProtoException(e); LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); final Request.Builder build = Request.newBuilder(); build.setRequestType(Request.MessageType.ERROR); build.setResponseText(e.getMessage()); build.setSessionInfo(req.getSessionInfo()); build.setOtherData(protoEx.toByteString()); return build.build(); } resultReq.setOtherData(builder.build().toByteString()); resultReq.setRequestType(MessageType.DATA_REQUEST); return resultReq.build(); } catch (InvalidProtocolBufferException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); final Message.ProtoException protoEx = ExceptionUtilities.createProtoException(e); final Request.Builder build = Request.newBuilder(); build.setRequestType(Request.MessageType.ERROR); build.setResponseText(e.getMessage()); build.setSessionInfo(req.getSessionInfo()); build.setOtherData(protoEx.toByteString()); return build.build(); } }

Target:
public static Request handleRequest(final Request req) { LOG.info("Parsing data request!"); DataRequest dataReq; try { dataReq = DataRequest.parseFrom(req.getOtherData()); final Request.Builder resultReq = Request.newBuilder(req); resultReq.clearOtherData(); final DataResult.Builder builder = DataResult.newBuilder(); try { for (ItemRequest itemReq : dataReq.getItemsList()) { if (itemReq.getQuery() == ItemQuery.EXPERIMENT) { if (!itemReq.hasAdvanceQuery()) { builder.addResults(handleSingleExperiment(itemReq)); } else { builder.addResults(getExperimentsForInstructor(itemReq)); } } } } catch (Exception e) { final Message.ProtoException protoEx = ExceptionUtilities.createProtoException(e); LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); return ExceptionUtilities.createExceptionRequest(protoEx, req); } resultReq.setOtherData(builder.build().toByteString()); resultReq.setRequestType(MessageType.DATA_REQUEST); return resultReq.build(); } catch (InvalidProtocolBufferException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); final Message.ProtoException protoEx = ExceptionUtilities.createProtoException(e); return ExceptionUtilities.createExceptionRequest(protoEx, req); } }
Source:
public ByteRange toResolvedByteRange(long totalSize) { switch (getType()) { case LAST_N_BYTES: if (getLastNBytes() <= totalSize) { return new ByteRange(totalSize - getLastNBytes(), totalSize - 1, ByteRangeType.OFFSET_RANGE); } break; case FROM_START_OFFSET: if (getStartOffset() < totalSize) { return new ByteRange(getStartOffset(), totalSize - 1, ByteRangeType.OFFSET_RANGE); } break; case OFFSET_RANGE: if (getEndOffset() < totalSize) { return new ByteRange(getStartOffset(), getEndOffset(), ByteRangeType.OFFSET_RANGE); } break; } return null; }

Target:
public ByteRange toResolvedByteRange(long totalSize) { switch (getType()) { case LAST_N_BYTES: if (getLastNBytes() <= totalSize) { return new ByteRange(totalSize - getLastNBytes(), totalSize - 1, ByteRangeType.OFFSET_RANGE); } break; case FROM_START_OFFSET: if (getStartOffset() < totalSize) { return new ByteRange(getStartOffset(), totalSize - 1, ByteRangeType.OFFSET_RANGE); } break; case OFFSET_RANGE: if (getEndOffset() < totalSize) { return new ByteRange(getStartOffset(), getEndOffset(), ByteRangeType.OFFSET_RANGE); } break; } throw new IllegalArgumentException("ByteRange " + this + " exceeds the total blob size " + totalSize); }
Source:
public void verifyAddAnotherPinType(){ Assert.assertEquals(sizepinTypeTitleInputs+1, pinTypeTitleInputs.size()); Assert.assertEquals(sizeuploadMarker+1, uploadMarker.size()); Assert.assertEquals(sizeparentCatElements+1, parentCatElements.size()); PageObjectLogging.log("verifyAddAnotherPinType","New line and fields was displayed after clicking Add another pin type", true); }

Target:
public void verifyAddAnotherPinType() { Assertion.assertEquals(amountPinTypeTitleInputs + 1, pinTypeTitleInputs.size()); Assertion.assertEquals(amountUploadMarker + 1, uploadMarker.size()); Assertion.assertEquals(amountParentCatElements + 1, parentCatElements.size()); }
Source:
public Vector3f getSize(Vector3f dest) { return dest.set(maxX - minX, maxY - minY, maxZ - minZ); }

Target:
public Vector3f getSize(Vector3f dest) { return dest.set(lengthX(), lengthY(), lengthZ()); }
Source:
public void notB(final Sketch skB) { if (empty_ || (skB == null) || skB.isEmpty()) { return; } checkSeedHashes(seedHash_, skB.getSeedHash()); final long thetaLongB = skB.getThetaLong(); thetaLong_ = Math.min(thetaLong_, thetaLongB); final int countB = skB.getRetainedEntries(true); CompactSketch cskB = null; UpdateSketch uskB = null; final long[] hashTableB; if (skB instanceof CompactSketch) { cskB = (CompactSketch) skB; hashTableB = convertToHashTable(cskB.getCache(), countB, thetaLong_, REBUILD_THRESHOLD); } else { uskB = (UpdateSketch) skB; hashTableB = (thetaLong_ < thetaLongB) ? convertToHashTable(uskB.getCache(), countB, thetaLong_, REBUILD_THRESHOLD) : uskB.getCache(); cskB = uskB.compact(); } final long[] tmpHashArrA = new long[curCount_]; final int lgHTBLen = simpleIntLog2(hashTableB.length); int nonMatches = 0; for (int i = 0; i < curCount_; i++) { final long hash = hashArr_[i]; if ((hash != 0) && (hash < thetaLong_)) { final int index = hashSearch(hashTableB, lgHTBLen, hash); if (index == -1) { tmpHashArrA[nonMatches] = hash; nonMatches++; } } } hashArr_ = Arrays.copyOfRange(tmpHashArrA, 0, nonMatches); curCount_ = nonMatches; empty_ = (nonMatches == 0) && (thetaLong_ == Long.MAX_VALUE); }

Target:
public void notB(final Sketch skB) { if (empty_ || (skB == null) || skB.isEmpty()) { return; } checkSeedHashes(seedHash_, skB.getSeedHash()); thetaLong_ = Math.min(thetaLong_, skB.getThetaLong()); hashArr_ = getResultHashArr(thetaLong_, curCount_, hashArr_, skB); curCount_ = hashArr_.length; empty_ = (curCount_ == 0) && (thetaLong_ == Long.MAX_VALUE); }
Source:
public static boolean isLocationServiceEnabled(@NonNull Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { int locationMode = Settings.Secure.LOCATION_MODE_OFF; try { locationMode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE); } catch (Settings.SettingNotFoundException e) { L.d("Location service setting not found.", e); } return locationMode != Settings.Secure.LOCATION_MODE_OFF; } else { String locationProviders = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); return !TextUtils.isEmpty(locationProviders); } }

Target:
public static boolean isLocationServiceEnabled(@NonNull Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { int locationMode = Settings.Secure.LOCATION_MODE_OFF; try { locationMode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE); } catch (Settings.SettingNotFoundException e) { L.d("Location service setting not found.", e); } return locationMode != Settings.Secure.LOCATION_MODE_OFF; } String locationProviders = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); return !TextUtils.isEmpty(locationProviders); }
Source:
public void populate(List<CategoryDTO> categories) { Platform.runLater(() -> { try{ String css = ""; for (CategoryDTO category : categories) { css += "." + category.getName().toLowerCase() + "Button{\n"; css += "-fx-background-image: url('" + category.getIcon() + "');\n"; css += "}\n"; } File temp = new File("tempfile.css"); temp.delete(); temp.createNewFile(); BufferedWriter bw = new BufferedWriter(new FileWriter(temp)); bw.write(css); bw.close(); final String shortName = themeManager.getCurrentTheme().getShortName(); final String url = String.format("/org/phoenicis/javafx/themes/%s/main.css", shortName); final URL style = this.getClass().getResource(url); getTabPane().getScene().getStylesheets().clear(); getTabPane().getScene().getStylesheets().addAll(temp.toURI().toString(), style.toExternalForm()); }catch(Exception e){ e.printStackTrace(); } final List<LeftToggleButton> leftButtonList = new ArrayList<>(); ToggleGroup group = new ToggleGroup(); final LeftToggleButton allCategoryButton = new LeftToggleButton("All"); allCategoryButton.setToggleGroup(group); allCategoryButton.setSelected(true); final String allCategoryButtonIcon = String.format("icons/mainwindow/apps/all.png"); allCategoryButton.setStyle("-fx-background-image: url('" + themeManager.getResourceUrl(allCategoryButtonIcon) + "');"); allCategoryButton.setOnMouseClicked(event -> selectAll(categories)); leftButtonList.add(allCategoryButton); for (CategoryDTO category : categories) { if(category.getType() == CategoryDTO.CategoryType.INSTALLERS) { final LeftToggleButton categoryButton = new LeftToggleButton(category.getName()); categoryButton.setToggleGroup(group); final String themeName = new String(category.getName().toLowerCase() + "Button"); categoryButton.getStyleClass().add(themeName); categoryButton.setOnMouseClicked(event -> selectCategory(category)); leftButtonList.add(categoryButton); } } categoryView.setNodes(leftButtonList); selectAll(categories); }); }

Target:
public void populate(List<CategoryDTO> categories) { Platform.runLater(() -> { setDefaultCategoryIcons(categories); this.categories.setAll(categories); this.filter.clearAll(); this.categoryView.selectAll(); this.showAvailableApps(); }); }
Source:
private DfsBlockCache(final DfsBlockCacheConfig cfg) { tableSize = tableSize(cfg); if (tableSize < 1) throw new IllegalArgumentException(JGitText.get().tSizeMustBeGreaterOrEqual1); table = new AtomicReferenceArray<>(tableSize); loadLocks = new ReentrantLock[cfg.getConcurrencyLevel()]; for (int i = 0; i < loadLocks.length; i++) loadLocks[i] = new ReentrantLock(true ); maxBytes = cfg.getBlockLimit(); maxStreamThroughCache = (long) (maxBytes * cfg.getStreamRatio()); blockSize = cfg.getBlockSize(); blockSizeShift = Integer.numberOfTrailingZeros(blockSize); clockLock = new ReentrantLock(true ); String none = ""; clockHand = new Ref<>( DfsStreamKey.of(new DfsRepositoryDescription(none), none), -1, 0, null); clockHand.next = clockHand; statHit = new AtomicReference<>(new AtomicLong[] { new AtomicLong() }); statMiss = new AtomicReference<>(new AtomicLong[] { new AtomicLong() }); statEvict = new AtomicReference<>( new AtomicLong[] { new AtomicLong() }); }

Target:
private DfsBlockCache(final DfsBlockCacheConfig cfg) { tableSize = tableSize(cfg); if (tableSize < 1) throw new IllegalArgumentException(JGitText.get().tSizeMustBeGreaterOrEqual1); table = new AtomicReferenceArray<>(tableSize); loadLocks = new ReentrantLock[cfg.getConcurrencyLevel()]; for (int i = 0; i < loadLocks.length; i++) loadLocks[i] = new ReentrantLock(true ); maxBytes = cfg.getBlockLimit(); maxStreamThroughCache = (long) (maxBytes * cfg.getStreamRatio()); blockSize = cfg.getBlockSize(); blockSizeShift = Integer.numberOfTrailingZeros(blockSize); clockLock = new ReentrantLock(true ); String none = ""; clockHand = new Ref<>( DfsStreamKey.of(new DfsRepositoryDescription(none), none, null), -1, 0, null); clockHand.next = clockHand; statHit = new AtomicReference<>(newCounters()); statMiss = new AtomicReference<>(newCounters()); statEvict = new AtomicReference<>(newCounters()); liveBytes = new AtomicReference<>(newCounters()); }
Source:
public void testContainer() { final List<Container> resultContainers = this.resultPod.getSpec().getContainers(); assertEquals(1, resultContainers.size()); final Container resultMainContainer = resultContainers.get(0); assertEquals( KubernetesTaskManagerParameters.TASK_MANAGER_MAIN_CONTAINER_NAME, resultMainContainer.getName()); assertEquals(CONTAINER_IMAGE, resultMainContainer.getImage()); assertEquals(CONTAINER_IMAGE_PULL_POLICY.name(), resultMainContainer.getImagePullPolicy()); assertEquals(CONTAINER_IMAGE_PULL_POLICY.name(), resultMainContainer.getImagePullPolicy()); assertEquals(4, resultMainContainer.getEnv().size()); assertTrue(resultMainContainer.getEnv() .stream() .anyMatch(envVar -> envVar.getName().equals("key1"))); assertEquals(1, resultMainContainer.getPorts().size()); assertEquals(1, resultMainContainer.getCommand().size()); assertEquals(3, resultMainContainer.getArgs().size()); assertEquals(2, resultMainContainer.getVolumeMounts().size()); }

Target:
public void testContainer() { final List<Container> resultContainers = this.resultPod.getSpec().getContainers(); assertEquals(1, resultContainers.size()); final Container resultMainContainer = resultContainers.get(0); assertEquals( KubernetesTaskManagerParameters.TASK_MANAGER_MAIN_CONTAINER_NAME, resultMainContainer.getName()); assertEquals(CONTAINER_IMAGE, resultMainContainer.getImage()); assertEquals(CONTAINER_IMAGE_PULL_POLICY.name(), resultMainContainer.getImagePullPolicy()); assertEquals(4, resultMainContainer.getEnv().size()); assertTrue(resultMainContainer.getEnv() .stream() .anyMatch(envVar -> envVar.getName().equals("key1"))); assertEquals(1, resultMainContainer.getPorts().size()); assertEquals(1, resultMainContainer.getCommand().size()); assertEquals(3, resultMainContainer.getArgs().size()); assertEquals(2, resultMainContainer.getVolumeMounts().size()); }
Source:
public AppStateClusterImpl(AppSettings appSettings) { ClusterProperties clusterProperties = new ClusterProperties(appSettings); clusterProperties.validate(); if (!clusterProperties.isEnabled()) { throw new IllegalStateException("Cluster is not enabled on this instance"); } Config hzConfig = new Config(); try { hzConfig.setInstanceName(InetAddress.getLocalHost().getHostName()); } catch (UnknownHostException e) { } hzConfig.getGroupConfig().setName(clusterProperties.getName()); NetworkConfig netConfig = hzConfig.getNetworkConfig(); netConfig.setPort(clusterProperties.getPort()); if (!clusterProperties.getInterfaces().isEmpty()) { netConfig.getInterfaces() .setEnabled(true) .setInterfaces(clusterProperties.getInterfaces()); } JoinConfig joinConfig = netConfig.getJoin(); joinConfig.getAwsConfig().setEnabled(false); joinConfig.getMulticastConfig().setEnabled(false); joinConfig.getTcpIpConfig().setEnabled(true); joinConfig.getTcpIpConfig().setMembers(clusterProperties.getMembers()); hzConfig .setProperty("hazelcast.tcp.join.port.try.count", "10") .setProperty("hazelcast.socket.bind.any", "false") .setProperty("hazelcast.phone.home.enabled", "false") .setProperty("hazelcast.logging.type", "slf4j"); hzConfig.getPartitionGroupConfig().setEnabled(false); hzInstance = Hazelcast.newHazelcastInstance(hzConfig); operationalProcesses = hzInstance.getReplicatedMap(OPERATIONAL_PROCESSES); listenerUuid = operationalProcesses.addEntryListener(new OperationalProcessListener()); }

Target:
public AppStateClusterImpl(AppSettings appSettings) { ClusterProperties clusterProperties = new ClusterProperties(appSettings); clusterProperties.validate(); if (!clusterProperties.isEnabled()) { throw new IllegalStateException("Cluster is not enabled on this instance"); } Config hzConfig = new Config(); try { hzConfig.setInstanceName(InetAddress.getLocalHost().getHostName()); } catch (UnknownHostException e) { } hzConfig.getGroupConfig().setName(clusterProperties.getName()); NetworkConfig netConfig = hzConfig.getNetworkConfig(); netConfig.setPort(clusterProperties.getPort()); if (!clusterProperties.getNetworkInterfaces().isEmpty()) { netConfig.getInterfaces() .setEnabled(true) .setInterfaces(clusterProperties.getNetworkInterfaces()); } JoinConfig joinConfig = netConfig.getJoin(); joinConfig.getAwsConfig().setEnabled(false); joinConfig.getMulticastConfig().setEnabled(false); joinConfig.getTcpIpConfig().setEnabled(true); joinConfig.getTcpIpConfig().setMembers(clusterProperties.getHosts()); hzConfig .setProperty("hazelcast.tcp.join.port.try.count", "10") .setProperty("hazelcast.socket.bind.any", "false") .setProperty("hazelcast.phone.home.enabled", "false") .setProperty("hazelcast.logging.type", "slf4j"); hzConfig.getPartitionGroupConfig().setEnabled(false); hzInstance = Hazelcast.newHazelcastInstance(hzConfig); operationalProcesses = hzInstance.getReplicatedMap(OPERATIONAL_PROCESSES); listenerUuid = operationalProcesses.addEntryListener(new OperationalProcessListener()); }
Source:
protected void endActionOnVmConfiguration() { if (getVm() != null) { if (getVm().getstatus() == VMStatus.ImageLocked) { VmHandler.unlockVm(getVm(), getCompensationContext()); } throw new RuntimeException("asd"); } else { setCommandShouldBeLogged(false); log.warn("VmCommand::EndVmCommand: Vm is null - not performing EndAction on Vm"); } }

Target:
protected void endActionOnVmConfiguration() { if (getVm() != null) { if (getVm().getstatus() == VMStatus.ImageLocked) { VmHandler.unlockVm(getVm(), getCompensationContext()); } updateVmInSpm(getVm().getstorage_pool_id(), Arrays.asList(getVm())); } else { setCommandShouldBeLogged(false); log.warn("VmCommand::EndVmCommand: Vm is null - not performing EndAction on Vm"); } }
Source:
public static Option commonOptions() throws Exception { return composite(karafContainer(), vmOptions("-Djava.net.preferIPv4Stack=true", "-Djgroups.bind_addr=127.0.0.1"), vmOptions("-Xmx1G", "-XX:-PrintGCDetails", "-XX:-PrintGCTimeStamps"), verboseKaraf(), runWithoutConsole(), junitBundles(), keepRuntimeFolder(), featurePaxUrlWrap(), bundlePaxExamSpi(), bundleTestAnnotations(), localRepoForPAXUrl()); }

Target:
public static Option commonOptions() throws Exception { return composite(karafContainer(), vmOptions("-Djava.net.preferIPv4Stack=true", "-Djgroups.bind_addr=127.0.0.1"), vmOptions("-Xmx500m", "-XX:+HeapDumpOnOutOfMemoryError", "-XX:HeapDumpPath=" + System.getProperty("user.dir")), verboseKaraf(), runWithoutConsole(), junitBundles(), keepRuntimeFolder(), featurePaxUrlWrap(), bundlePaxExamSpi(), bundleTestAnnotations(), localRepoForPAXUrl()); }
Source:
boolean matchBean(Configuration configuration) { Filter include = configuration.getInclude(); if (!include.isEmptyBeanName() && !include.getBeanNames().contains(beanName)) { return false; } for (String bean_attr : include.keySet()) { if (EXCLUDED_BEAN_PARAMS.contains(bean_attr)) { continue; } ArrayList<String> beanValues = include.getParameterValues(bean_attr); boolean matchBeanAttr = false; for (String beanVal : beanValues) { if (beanParameters.get(bean_attr) == null || !beanParameters.get(bean_attr).equals(beanVal)) { continue; } matchBeanAttr = true; break; } if (!matchBeanAttr) { return false; } } return true; }

Target:
boolean matchBean(Configuration configuration) { Filter include = configuration.getInclude(); if (!include.isEmptyBeanName() && !include.getBeanNames().contains(beanName)) { return false; } for (String bean_attr : include.keySet()) { if (EXCLUDED_BEAN_PARAMS.contains(bean_attr)) { continue; } if (beanParameters.get(bean_attr) == null) { continue; } ArrayList<String> beanValues = include.getParameterValues(bean_attr); boolean matchBeanAttr = false; for (String beanVal : beanValues) { if (!beanParameters.get(bean_attr).equals(beanVal)) { continue; } return true; } if (!matchBeanAttr) { return false; } } return true; }
Source:
public CompleteTransactionResponseMessage(CompleteTransactionMessage msg) { m_txnId = msg.getTxnId(); m_spHandle = msg.getSpHandle(); m_isRestart = msg.isRestart(); m_spiHSId = msg.getCoordinatorHSId(); m_ackRequestedFromSender = msg.isAckRequestedFromSender(); }

Target:
public CompleteTransactionResponseMessage(CompleteTransactionMessage msg) { m_txnId = msg.getTxnId(); m_spHandle = msg.getSpHandle(); m_isRestart = msg.isRestart(); m_spiHSId = msg.getCoordinatorHSId(); m_ackRequired = msg.requiresAck(); }
Source:
void startBootstrap() { isBootstrapMode = true; }

Target:
void startBootstrap() { inBootstrapMode = true; }
Source:
public Response toResponse(NotFoundException exception) { return ExceptionMapperUtils.buildResponse(exception, Response.Status.BAD_REQUEST); }

Target:
public Response toResponse(NotFoundException exception) { if (exception.getCause() instanceof NumberFormatException) { return ExceptionMapperUtils.buildResponse(exception, Response.Status.BAD_REQUEST); } else { return ExceptionMapperUtils.buildResponse(exception, Response.Status.NOT_FOUND); } }
Source:
public String getPortalIP() { String tmp = asString("spec.portalIP"); if (tmp == null || tmp.trim().length() == 0) { tmp = getClusterIP(); } return tmp; }

Target:
public String getPortalIP() { String tmp = asString("spec.portalIP"); if (StringUtils.isBlank(tmp)) { tmp = getClusterIP(); } return tmp; }
Source:
@Test public void testSimplifyCaseBranchesCollapse() { RexNode x = input(tBoolean(), 0); RexNode firstCond = isTrue(x); RexNode literal1 = literal(1); RexNode secondCond = isNotTrue(x); RexNode literal2 = literal(2); RexNode caseNode = case_(firstCond, literal1, secondCond, literal1, literal2); RexNode result = simplify.simplifyUnknownAs(caseNode, RexUnknownAs.FALSE); assertThat(result.getType().isNullable(), is(false)); assertThat(result.getType().getSqlTypeName(), is(SqlTypeName.INTEGER)); RexNode expectedResult = case_(or(x, not(x)), literal1, literal2); assertThat(result.toString(), is(expectedResult.toString())); }

Target:
@Test public void testSimplifyCaseBranchesCollapse() { checkSimplify3( case_( isTrue(vBool()), literal(1), isNotTrue(vBool()), literal(1), literal(2)), "CASE(OR(IS TRUE(?0.bool0), IS NOT TRUE(?0.bool0)), 1, 2)", "CASE(OR(IS TRUE(?0.bool0), IS NOT TRUE(?0.bool0)), 1, 2)", "CASE(OR(IS TRUE(?0.bool0), IS NOT TRUE(?0.bool0)), 1, 2)"); }
Source:
protected void doSetUserClaimValueWithID(String userID, String claimURI, String claimValue, String profileName) throws UserStoreException { try { String attributeName = getClaimAtrribute(claimURI, userID, null); Map<String, String> userStoreAttributeValueMap = new HashMap<>(); userStoreAttributeValueMap.put(attributeName, claimValue); processAttributesBeforeUpdate(userStoreAttributeValueMap); for (Map.Entry<String, String> entry : userStoreAttributeValueMap.entrySet()) { doSetUserAttributeWithID(userID, entry.getKey(), entry.getValue(), profileName); } } catch (org.wso2.carbon.user.api.UserStoreException e) { throw new UserStoreException( "Error occurred while getting the claim attribute for claimURI: " + claimURI + " of the user: " + userID); } }

Target:
protected void doSetUserClaimValueWithID(String userID, String claimURI, String claimValue, String profileName) throws UserStoreException { try { String attributeName = getClaimAtrribute(claimURI, userID, null); Map<String, String> userStoreAttributeValueMap = new HashMap<>(); userStoreAttributeValueMap.put(attributeName, claimValue); processAttributesBeforeUpdateWithID(userID, userStoreAttributeValueMap, profileName); for (Map.Entry<String, String> entry : userStoreAttributeValueMap.entrySet()) { doSetUserAttributeWithID(userID, entry.getKey(), entry.getValue(), profileName); } } catch (org.wso2.carbon.user.api.UserStoreException e) { throw new UserStoreException( "Error occurred while getting the claim attribute for claimURI: " + claimURI + " of the user: " + userID, e); } }
Source:
public void testInvertMapNull() { try { MapUtils.invertMap(null); fail("Expecting NullPointerException for null map"); } catch (final NullPointerException ex) { } }

Target:
public void testInvertMapNull() { Map<String, String> nullMap = null; Exception exception = assertThrows(NullPointerException.class, () -> { MapUtils.invertMap(nullMap); }); String actualMessage = exception.getMessage(); assertTrue(actualMessage.contains("map")); }
Source:
public String getRequestObjectListType(final String requestName) { switch(requestName) { case "get_bulk_job_spectra_s3_request": return "BULK_GET"; case "put_bulk_job_spectra_s3_request": return "BULK_PUT"; case "verify_bulk_job_spectra_s3_request": case "eject_storage_domain_spectra_s3_request": case "eject_storage_domain_blobs_spectra_s3_request": case "get_physical_placement_for_objects_spectra_s3_request": case "get_physical_placement_for_objects_with_full_details_spectra_s3_request": case "verify_physical_placement_for_objects_spectra_s3_request": case "verify_physical_placement_for_objects_with_full_details_spectra_s3_request": return "GET_PHYSICAL_PLACEMENT"; case "complete_multi_part_upload_request": return "COMPLETE_MPU"; case "put_multi_part_upload_part_request": case "put_object_request": return "DATA"; case "delete_objects_request": return "STRING_LIST"; case "get_blob_persistence_spectra_s3_request": case "replicate_put_job_spectra_s3_request": return "STRING"; default: return null; } }

Target:
public String getRequestObjectListType(final String requestName) { switch(requestName) { case "get_bulk_job_spectra_s3_request": return "BULK_GET"; case "put_bulk_job_spectra_s3_request": return "BULK_PUT"; case "verify_bulk_job_spectra_s3_request": case "eject_storage_domain_spectra_s3_request": case "eject_storage_domain_blobs_spectra_s3_request": case "get_physical_placement_for_objects_spectra_s3_request": case "get_physical_placement_for_objects_with_full_details_spectra_s3_request": case "verify_physical_placement_for_objects_spectra_s3_request": case "verify_physical_placement_for_objects_with_full_details_spectra_s3_request": return "GET_PHYSICAL_PLACEMENT"; case "complete_multi_part_upload_request": return "COMPLETE_MPU"; case "put_multi_part_upload_part_request": case "put_object_request": return "DATA"; case "delete_objects_request": return "STRING_LIST"; case "get_blob_persistence_spectra_s3_request": case "replicate_put_job_spectra_s3_request": return "STRING"; default: throw new InvalidParameterException("Unknown request:" + requestName); } }
Source:
void testDeleteBranch() { deleteBranchPort.delete( projectId, new Branch("testBranch2", "fcd9a0e7c34086fdb0aedc82497f8ddfa142e961")); Assertions.assertThat(listBranchesPort.listBranchesInProject(projectId)) .containsExactlyInAnyOrder( new Branch("testBranch1", "d3272b3793bc4b2bc36a1a3a7c8293fcf8fe27df"), new Branch("master", "e9f7ff6fdd8c0863fdb5b24c9ed35a3651e20382")); Assertions.assertThat(commitRepository.findByProjectId(projectId)).hasSize(14); Assertions.assertThat(fileRepository.findAllinProject(projectId)).hasSize(8); }

Target:
void testDeleteBranch() { deleteBranchPort.delete(projectId, testBranch2); Assertions.assertThat(listBranchesPort.listBranchesInProject(projectId)) .containsExactlyInAnyOrder(testBranch1, master); Assertions.assertThat(commitRepository.findByProjectId(projectId)).hasSize(14); Assertions.assertThat(fileRepository.findAllinProject(projectId)).hasSize(8); }
Source:
public byte[] readRound(long seq) throws IOException { lock.readLock().lock(); try { byte[] result = currentLog.readRound(seq); if (firstEntry.isDone() && Futures.getUnchecked(firstEntry) <= seq) { byte[] experimentalResult = safeReadFromExperimental(psl -> psl.readRound(seq)); if (!Arrays.equals(result, experimentalResult)) { log.error("Mismatch in reading round for sequence number between legacy and current " + "implementations. Legacy result {}, current result {}.", SafeArg.of("sequence", seq), UnsafeArg.of("legacy", hydrateIfNotNull(result)), UnsafeArg.of("current", hydrateIfNotNull(experimentalResult))); } } return result; } finally { lock.readLock().unlock(); } }

Target:
public byte[] readRound(long seq) throws IOException { lock.readLock().lock(); try { byte[] result = currentLog.readRound(seq); byte[] experimentalResult = safeReadFromExperimental(psl -> psl.readRound(seq)); OptionalLong firstWrittenSequence = firstEntry.isDone() ? OptionalLong.of(Futures.getUnchecked(firstEntry)) : OptionalLong.empty(); if (!Arrays.equals(result, experimentalResult)) { log.error("Mismatch in reading round for sequence number between legacy and current implementations." + " Legacy result {}, current result {}. First written sequence was {}.", SafeArg.of("sequence", seq), UnsafeArg.of("legacy", hydrateIfNotNull(result)), UnsafeArg.of("current", hydrateIfNotNull(experimentalResult)), SafeArg.of("firstWrittenSequence", firstWrittenSequence)); } return result; } finally { lock.readLock().unlock(); } }
Source:
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) { if (capability == CapabilityEnergy.ENERGY) { return (T) energyInterface; } if (capability != null && (capability == MJ_CONN || capability == MJ_RECV)) { return (T) mjReceiver; } return super.getCapability(capability, facing); }

Target:
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) { if (capability == CapabilityEnergy.ENERGY) { return (T) energyInterface; } if (capability == MJ_CONN || capability == MJ_RECV) { return (T) mjReceiver; } return super.getCapability(capability, facing); }
Source:
private MessageProducerNode producerNode(String name, MessageProducerSupport producer) { MessageChannel outputChannel = producer.getOutputChannel(); String outputChannelName = outputChannel == null ? "__unknown__" : outputChannel.toString(); return new MessageProducerNode(this.nodeId.incrementAndGet(), name, producer, outputChannelName); }

Target:
private MessageProducerNode producerNode(String name, MessageProducerSupport producer) { MessageChannel outputChannel = producer.getOutputChannel(); return new MessageProducerNode(this.nodeId.incrementAndGet(), name, producer, outputChannel.toString()); }
Source:
public AsyncHttpClient get() { ApacheHttpClient httpClient; try { HttpClientConfig config = injector.getInstance(Key.get(HttpClientConfig.class, annotation)); httpClient = new ApacheHttpClient(config); } catch (IOException e) { throw Throwables.propagate(e); } AsyncHttpClientConfig asyncConfig = injector.getInstance(Key.get(AsyncHttpClientConfig.class, annotation)); ExecutorService executor = newFixedThreadPool(asyncConfig.getWorkerThreads(), new ThreadFactoryBuilder().setNameFormat(name + "-http-client-%s").build()); return new AsyncHttpClient(httpClient, executor); }

Target:
public AsyncHttpClient get() { ExecutorService executorService = injector.getInstance(Key.get(ExecutorService.class, annotation)); ApacheHttpClient httpClient; try { HttpClientConfig config = injector.getInstance(Key.get(HttpClientConfig.class, annotation)); httpClient = new ApacheHttpClient(config); } catch (IOException e) { throw Throwables.propagate(e); } return new AsyncHttpClient(httpClient, executorService); }
Source:
public void vdsNonOperational(Guid vdsId, NonOperationalReason reason, boolean logCommand, Guid domainId) { StorageDomainStatic storageDomain = DbFacade.getInstance().getStorageDomainStaticDao().get(domainId); Map<String, String> customLogValues = null; if (storageDomain != null) { customLogValues = new HashMap<>(); customLogValues.put("StorageDomainNames", storageDomain.getName()); } vdsNonOperational(vdsId, reason, logCommand, domainId, customLogValues); }

Target:
public void vdsNonOperational(Guid vdsId, NonOperationalReason reason, boolean logCommand, Guid domainId) { StorageDomainStatic storageDomain = DbFacade.getInstance().getStorageDomainStaticDao().get(domainId); Map<String, String> customLogValues = null; if (storageDomain != null) { customLogValues = Collections.singletonMap("StorageDomainNames", storageDomain.getName()); } vdsNonOperational(vdsId, reason, logCommand, domainId, customLogValues); }
Source:
public static Callable<ThrottlingState> createThrottlingState( int timeBucketCapacityInSeconds, int timeBucketRefillAmountInSeconds, int timeBucketRefillPeriodInMinutes, int errorBucketCapacity, int errorBucketRefillAmount, int errorBucketRefillPeriodInMinutes) { return () -> new ThrottlingState( TokenBuckets.builder() .withCapacity(MILLISECONDS.convert(timeBucketCapacityInSeconds, TimeUnit.SECONDS)) .withFixedIntervalRefillStrategy(timeBucketRefillAmountInSeconds, timeBucketRefillPeriodInMinutes, MINUTES) .build(), TokenBuckets.builder() .withCapacity(errorBucketCapacity) .withFixedIntervalRefillStrategy(errorBucketRefillAmount, errorBucketRefillPeriodInMinutes, MINUTES) .build()); }

Target:
public static Callable<ThrottlingState> createThrottlingState( int timeBucketCapacityInSeconds, int timeBucketRefillAmountInSeconds, int timeBucketRefillPeriodInMinutes, int errorBucketCapacity, int errorBucketRefillAmount, int errorBucketRefillPeriodInMinutes) { return () -> new ThrottlingState( TokenBuckets.builder() .withCapacity( MILLISECONDS.convert(timeBucketCapacityInSeconds, TimeUnit.SECONDS)) .withFixedIntervalRefillStrategy( MILLISECONDS.convert(timeBucketRefillAmountInSeconds, TimeUnit.SECONDS), timeBucketRefillPeriodInMinutes, MINUTES) .build(), TokenBuckets.builder() .withCapacity(errorBucketCapacity) .withFixedIntervalRefillStrategy( errorBucketRefillAmount, errorBucketRefillPeriodInMinutes, MINUTES) .build()); }
Source:
public void isolation_01() { DatasetGraph dsg = create() ; ThreadAction other = ThreadTxn.threadTxnRead(dsg, ()-> { long x = Iter.count(dsg.find()) ; Assert.assertEquals(0, x) ; }) ; dsg.begin(WRITE) ; dsg.add(q1) ; dsg.commit() ; dsg.end() ; other.run() ; }

Target:
public void isolation_01() { DatasetGraph dsg = create() ; ThreadAction other = ThreadTxn.threadTxnRead(dsg, ()-> Assert.assertTrue(dsg.isEmpty()) ) ; dsg.begin(WRITE) ; dsg.add(q1) ; dsg.commit() ; dsg.end() ; other.run() ; }
Source:
private <T> void deleteEntries( final InternalDataAdapter<T> adapter, final Index index, final String... additionalAuthorizations ) throws IOException { statisticsStore.removeAllStatistics( adapter.getAdapterId(), additionalAuthorizations); baseOperations.deleteAll( index.getName(), "", adapter.getAdapterId(), additionalAuthorizations); }

Target:
private <T> void deleteEntries( final InternalDataAdapter<T> adapter, final Index index, final String... additionalAuthorizations ) throws IOException { statisticsStore.removeAllStatistics( adapter.getAdapterId(), additionalAuthorizations); baseOperations.deleteAll( index.getName(), adapter.getTypeName(), adapter.getAdapterId(), additionalAuthorizations); }
Source:
default boolean gravity() { return get(Keys.ENTITY_HAS_GRAVITY).get(); }

Target:
default Value<Boolean> gravity() { return getValue(Keys.HAS_GRAVITY).get(); }
Source:
private Set<LocalizedTitle> transformLocalizedTitles( Set<org.atlasapi.media.entity.simple.LocalizedTitle> titles ) { Set<LocalizedTitle> newTitles = titles.stream() .map(title -> makeNewTitle(title)) .collect(Collectors.toSet()); return ImmutableSet.<LocalizedTitle>copyOf(newTitles); }

Target:
private Set<LocalizedTitle> transformLocalizedTitles( Set<org.atlasapi.media.entity.simple.LocalizedTitle> titles ) { return titles.stream() .map(title -> makeNewTitle(title)) .collect(MoreCollectors.toImmutableSet()); }
Source:
public static void setRanges(Class<?> implementingClass, Configuration conf, Collection<Range> ranges) { checkArgument(ranges != null, "ranges is null"); ArrayList<String> rangeStrings = new ArrayList<>(ranges.size()); try { for (Range r : ranges) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); r.write(new DataOutputStream(baos)); rangeStrings.add(Base64.getEncoder().encodeToString(baos.toByteArray())); } conf.setStrings(enumToConfKey(implementingClass, ScanOpts.RANGES), rangeStrings.toArray(new String[0])); } catch (IOException ex) { throw new UncheckedIOException("Unable to encode ranges to Base64", ex); } }

Target:
public static void setRanges(Class<?> implementingClass, Configuration conf, Collection<Range> ranges) { checkArgument(ranges != null, "ranges is null"); ArrayList<String> rangeStrings = new ArrayList<>(ranges.size()); try { for (Range r : ranges) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); r.write(new DataOutputStream(baos)); rangeStrings.add(Base64.getEncoder().encodeToString(baos.toByteArray())); } conf.setStrings(enumToConfKey(implementingClass, ScanOpts.RANGES), rangeStrings.toArray(new String[0])); } catch (IOException ex) { throw new IllegalArgumentException("Unable to encode ranges to Base64", ex); } }
Source:
public void shouldSetValuesOnPublicSetter() throws Exception { when(resultSetMetaData.getColumnCount()).thenReturn(1); when(resultSetMetaData.getColumnLabel(1)).thenReturn("longField"); Long expected = 1L; when(resultSet.getLong(1)).thenReturn(expected); when(resultSet.wasNull()).thenReturn(false); SampleBean sampleBean = mapper.map(resultSet, ctx); assertThat(sampleBean.getLongField()).isNotNull(); }

Target:
public void shouldSetValuesOnPublicSetter() throws Exception { when(resultSetMetaData.getColumnCount()).thenReturn(1); when(resultSetMetaData.getColumnLabel(1)).thenReturn("longField"); Long expected = 1L; when(resultSet.getLong(1)).thenReturn(expected); when(resultSet.wasNull()).thenReturn(false); SampleBean sampleBean = mapper.map(resultSet, ctx); assertThat(sampleBean.getLongField()).isEqualTo(expected); }
Source:
public static long parseMemString(String strMemSize) { if (strMemSize == null) { return 0L; } long size = 0L; if (strMemSize.endsWith("g") || strMemSize.endsWith("G") || strMemSize.endsWith("m") || strMemSize.endsWith("M") || strMemSize.endsWith("k") || strMemSize.endsWith("K")) { String strSize = strMemSize.substring(0, strMemSize.length() - 1); size = Long.parseLong(strSize); } else { size = Long.parseLong(strMemSize); } long sizeInKb = 0L; if (strMemSize.endsWith("g") || strMemSize.endsWith("G")) { sizeInKb = size * 1024L * 1024L; } else if (strMemSize.endsWith("m") || strMemSize.endsWith("M")) { sizeInKb = size * 1024L; } else { sizeInKb = size / 1024L; } return sizeInKb; }

Target:
public static long parseMemString(String strMemSize) { if (strMemSize == null) { return 0L; } long size = 0L; if (strMemSize.endsWith("g") || strMemSize.endsWith("G") || strMemSize.endsWith("m") || strMemSize.endsWith("M") || strMemSize.endsWith("k") || strMemSize.endsWith("K")) { String strSize = strMemSize.substring(0, strMemSize.length() - 1); size = Long.parseLong(strSize); } else { size = Long.parseLong(strMemSize); } long sizeInKb = 0L; if (strMemSize.endsWith("g") || strMemSize.endsWith("G")) { sizeInKb = size * 1024L * 1024L; } else if (strMemSize.endsWith("m") || strMemSize.endsWith("M")) { sizeInKb = size * 1024L; } else if (strMemSize.endsWith("k") || strMemSize.endsWith("K")) { sizeInKb = size; } else { sizeInKb = size / 1024L; } return sizeInKb; }
Source:
private void scanDirectory(File entryDirectory, ImmutableList.Builder<ScanResult> results) throws IOException { File beansXmlFile = new File(entryDirectory, AbstractWeldDeployment.BEANS_XML); if (beansXmlFile.canRead()) { logger.debugv(BEANS_XML_FOUND_MESSAGE, entryDirectory); final BeansXml beansXml = parseBeansXml(beansXmlFile.toURI().toURL()); if (accept(beansXml)) { results.add(new ScanResult(beansXml, entryDirectory.getPath())); } } else { logger.debugv(BEANS_XML_NOT_FOUND_MESSAGE, entryDirectory); File extensionFile = new File(entryDirectory, EXTENSION_FILE); if (!extensionFile.canRead()) { results.add(new ScanResult(null, entryDirectory.getPath())); } } File manifestFile = new File(entryDirectory, MANIFEST_FILE); if (manifestFile.canRead()) { final Manifest manifest = new Manifest(new FileInputStream(manifestFile)); final Attributes manifestMainAttributes = manifest.getMainAttributes(); if (manifestMainAttributes.containsKey(CLASS_PATH)) { scanManifestClassPath(entryDirectory.toURI().toURL(), manifestMainAttributes.getValue(CLASS_PATH), results); } } }

Target:
private void scanDirectory(File entryDirectory, ImmutableList.Builder<ScanResult> results) throws IOException { File beansXmlFile = new File(entryDirectory, AbstractWeldDeployment.BEANS_XML); if (beansXmlFile.canRead()) { logger.debugv(BEANS_XML_FOUND_MESSAGE, entryDirectory); final BeansXml beansXml = parseBeansXml(beansXmlFile.toURI().toURL()); if (accept(beansXml)) { results.add(new ScanResult(beansXml, entryDirectory.getPath())); } } else { logger.debugv(BEANS_XML_NOT_FOUND_MESSAGE, entryDirectory); File extensionFile = new File(entryDirectory, EXTENSION_FILE); if (!extensionFile.canRead()) { results.add(new ScanResult(null, entryDirectory.getPath())); } } File manifestFile = new File(entryDirectory, MANIFEST_FILE); if (manifestFile.canRead()) { try (FileInputStream fis = new FileInputStream(manifestFile)) { final Manifest manifest = new Manifest(fis); final Attributes manifestMainAttributes = manifest.getMainAttributes(); if (manifestMainAttributes.containsKey(CLASS_PATH)) { scanManifestClassPath(entryDirectory.toURI().toURL(), manifestMainAttributes.getValue(CLASS_PATH), results); } } } }
Source:
public static String describe() { return String.format("Java : %s\n" + "JVM vendor name : %s\n" + "JVM vendor version : %s\n" + "JVM name : %s\n" + "JVM version : %s\n" + "JVM info : %s\n" + "OS name : %s\n" + "OS version : %s\n" , JAVA_VERSION, JVM_VENDOR, JVM_VENDOR_VERSION, JVM_NAME, JVM_VERSION, JVM_INFO, System.getProperty("os.name"), System.getProperty("os.version")); }

Target:
public static String describe() { return String.format("Java : %s\n" + "JVM vendor name : %s\n" + "JVM vendor version : %s\n" + "JVM name : %s\n" + "JVM version : %s\n" + "JVM info : %s\n" + "OS name : %s\n" + "OS version : %s\n", JAVA_VERSION, JVM_VENDOR, JVM_VENDOR_VERSION, JVM_NAME, JVM_VERSION, JVM_INFO, OS_NAME, OS_VERSION); }
Source:
private void testActionWithBlobKeySuccess() { ______TS("Typical case: Success scenario"); loginAsStudent(account.googleId); String[] submissionParams = new String[] { Const.ParamsNames.STUDENT_ID, studentProfileAttributes.googleId, Const.ParamsNames.BLOB_KEY, studentProfileAttributes.pictureKey, }; DeleteStudentProfilePictureAction action = getAction(submissionParams); JsonResult result = getJsonResult(action); MessageOutput messageOutput = (MessageOutput) result.getOutput(); assertEquals(HttpStatus.SC_OK, result.getStatusCode()); assertEquals(messageOutput.getMessage(), "Your profile picture has been deleted successfully"); }

Target:
private void testActionWithBlobKeySuccess() { ______TS("Typical case: success scenario"); loginAsStudent(account.googleId); String[] submissionParams = { Const.ParamsNames.STUDENT_ID, account.googleId, }; DeleteStudentProfilePictureAction action = getAction(submissionParams); JsonResult result = getJsonResult(action); MessageOutput messageOutput = (MessageOutput) result.getOutput(); String newPictureKey = logic.getStudentProfile(account.googleId).pictureKey; assertEquals(HttpStatus.SC_OK, result.getStatusCode()); assertEquals(messageOutput.getMessage(), "Your profile picture has been deleted successfully"); assertEquals("", newPictureKey); }
Source:
@Override public String toString() { return "RecordExpectation{" + "acceptedDelta=" + acceptedDelta + ", doubleExpectation=" + doubleExpectation + ", editorExpectation='" + editorExpectation + '\'' + ", expectedFieldType=" + expectedFieldType + ", fieldName='" + fieldName + '\'' + ", intExpectation=" + intExpectation + ", stringExpectation='" + stringExpectation + '\'' + ", stringExpectationInCSV=" + stringExpectationInCSV + ", editorStringExpectation=" + editorStringExpectation + '}'; }

Target:
public String toString() { return "RecordExpectation{" + "acceptedDelta=" + acceptedDelta + ", doubleExpectation=" + doubleExpectation + ", editorExpectation='" + editorExpectation + '\'' + ", expectedFieldType=" + expectedFieldType + ", fieldName='" + fieldName + '\'' + ", intExpectation=" + intExpectation + ", stringExpectation='" + stringExpectation + '\'' + ", stringExpectationInCSV=" + stringExpectationInCSV + ", editorStringExpectation=" + editorStringExpectation + '}'; }
Source:
public void receiveRequest(final Request request, final EndpointReceiver receiver) { final KeyMID idByMID = new KeyMID(request.getMID(), endpointContextMatcher.getEndpointIdentity(request.getSourceContext())); final Exchange exchange = new Exchange(request, Origin.REMOTE, executor); final Exchange previous = exchangeStore.findPrevious(idByMID, exchange); boolean duplicate = previous != null; if (duplicate) { EndpointContext sourceContext = request.getSourceContext(); Request previousRequest = previous.getRequest(); EndpointContext previousSourceContext = previousRequest.getSourceContext(); duplicate = endpointContextMatcher.isToBeSent(previousSourceContext, sourceContext); if (!duplicate) { if (!exchangeStore.replacePrevious(idByMID, previous, exchange)) { LOGGER.warn("new request could not be registered!", request); } } } if (duplicate) { LOGGER.trace("duplicate request: {}", request); request.setDuplicate(true); previous.execute(new Runnable() { @Override public void run() { try { receiver.receiveRequest(previous, request); } catch (RuntimeException ex) { LOGGER.warn("error receiving request again!", request, ex); receiver.reject(request); } } }); } else { exchange.setRemoveHandler(exchangeRemoveHandler); exchange.execute(new Runnable() { @Override public void run() { try { receiver.receiveRequest(exchange, request); } catch (RuntimeException ex) { LOGGER.warn("error receiving request {}", request, ex); receiver.reject(request); } } }); } }

Target:
public void receiveRequest(final Request request, final EndpointReceiver receiver) { final KeyMID idByMID = new KeyMID(request.getMID(), endpointContextMatcher.getEndpointIdentity(request.getSourceContext())); final Exchange exchange = new Exchange(request, Origin.REMOTE, executor); final Exchange previous = exchangeStore.findPrevious(idByMID, exchange); boolean duplicate = previous != null; if (duplicate) { EndpointContext sourceContext = request.getSourceContext(); Request previousRequest = previous.getRequest(); EndpointContext previousSourceContext = previousRequest.getSourceContext(); duplicate = endpointContextMatcher.isToBeSent(previousSourceContext, sourceContext); if (!duplicate) { if (exchangeStore.replacePrevious(idByMID, previous, exchange)) { LOGGER.debug("replaced request by new request {}!", previous.getCurrentRequest(), request); } else { LOGGER.warn("new request could not be registered! Deduplication disabled!", request); } } } if (duplicate) { LOGGER.trace("duplicate request: {}", request); request.setDuplicate(true); previous.execute(new Runnable() { @Override public void run() { try { receiver.receiveRequest(previous, request); } catch (RuntimeException ex) { LOGGER.warn("error receiving request again!", request, ex); receiver.reject(request); } } }); } else { exchange.setRemoveHandler(exchangeRemoveHandler); exchange.execute(new Runnable() { @Override public void run() { try { receiver.receiveRequest(exchange, request); } catch (RuntimeException ex) { LOGGER.warn("error receiving request {}", request, ex); receiver.reject(request); } } }); } }
Source:
public void unsync(ServoControl sc) { this.removeServoEventListener(this); sc.detach(sc); unsubscribe(sc.getName(), "publishServoEvent", getName(), "moveTo"); }

Target:
public void unsync(ServoControl sc) { this.removeServoEventListener(this); ((Servo) sc).removeServoEventListener((NameProvider) sc); unsubscribe(sc.getName(), "publishServoEvent", getName(), "moveTo"); }