auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void downloadFileUsingFTPSClient(Operation operation, String host, String ftpUserName, String ftpPassword, String savingLocation, String fileName, int serverPort, String fileDirectory) throws AndroidAgentException { FTPSClient ftpsClient = new FTPSClient(); FileOutputStream fileOutputStream = null; OutputStream outputStream = null; String response; try { ftpsClient.connect(host, serverPort); if (ftpsClient.login(ftpUserName, ftpPassword)) { ftpsClient.enterLocalPassiveMode(); ftpsClient.execPROT("P"); fileOutputStream = new FileOutputStream(savingLocation + File.separator + fileName); outputStream = new BufferedOutputStream(fileOutputStream); ftpsClient.changeWorkingDirectory(fileDirectory); if (ftpsClient.retrieveFile(fileName, outputStream)) { response = "File uploaded to the device successfully!"; operation.setStatus(resources.getString(R.string.operation_value_completed)); } else { response = "File uploaded to the device not completed."; operation.setStatus(resources.getString(R.string.operation_value_error)); } } else { response = "FTP login failed."; operation.setStatus(resources.getString(R.string.operation_value_error)); } operation.setOperationResponse(response); } catch (IOException e) { handleOperationError(operation, fileTransferExceptionHandler(e, fileName), e); } finally { try { if (ftpsClient.isConnected()) { ftpsClient.logout(); ftpsClient.disconnect(); } } catch (IOException ignored) { } cleanupStreams(outputStream, fileOutputStream); } }

Target:
private void downloadFileUsingFTPSClient(Operation operation, String host, String ftpUserName, String ftpPassword, String savingLocation, String fileName, int serverPort, String fileDirectory) throws AndroidAgentException { FTPSClient ftpsClient = new FTPSClient(); FileOutputStream fileOutputStream = null; OutputStream outputStream = null; String response; try { ftpsClient.connect(host, serverPort); if (ftpsClient.login(ftpUserName, ftpPassword)) { ftpsClient.enterLocalPassiveMode(); ftpsClient.execPROT("P"); fileOutputStream = new FileOutputStream(savingLocation + File.separator + fileName); outputStream = new BufferedOutputStream(fileOutputStream); ftpsClient.changeWorkingDirectory(fileDirectory); if (ftpsClient.retrieveFile(fileName, outputStream)) { response = "File uploaded to the device successfully ( " + fileName + " )."; operation.setStatus(resources.getString(R.string.operation_value_completed)); } else { response = "File uploaded to the device not completed ( " + fileName + " )."; operation.setStatus(resources.getString(R.string.operation_value_error)); } } else { response = ftpUserName + " - FTP login failed."; operation.setStatus(resources.getString(R.string.operation_value_error)); } operation.setOperationResponse(response); } catch (IOException e) { handleOperationError(operation, fileTransferExceptionCause(e, fileName), e); } finally { try { if (ftpsClient.isConnected()) { ftpsClient.logout(); ftpsClient.disconnect(); } } catch (IOException ignored) { } cleanupStreams(null, outputStream, null, fileOutputStream, null, null, null, null); } }
Source:
@Override protected ObjectPermissions getPermissions() { LOG.debug("getPermissions"); return new ObjectPermissions(mAccountId, mAccountId, mBucketMode); }

Target:
protected ObjectPermissions getPermissions() { return new ObjectPermissions(mAccountId, mAccountId, mBucketMode); }
Source:
public void testGetAllAssignments() throws Exception { TestHarnessBuilder builder = new TestHarnessBuilder(); Map<String, Lease> addedLeases = builder.withLease("1", WORKER_ID) .withLease("2", WORKER_ID) .withLease("3", WORKER_ID) .withLease("4", WORKER_ID) .withLease("5", WORKER_ID) .build(); coordinator.runLeaseTaker(); Collection<Lease> allAssignments = coordinator.getAllAssignments(); assertEquals(allAssignments.size(), addedLeases.size()); assertThat(allAssignments.containsAll(addedLeases.values()), equalTo(true)); }

Target:
public void testGetAllAssignments() throws Exception { TestHarnessBuilder builder = new TestHarnessBuilder(); Map<String, Lease> addedLeases = builder.withLease("1", WORKER_ID) .withLease("2", WORKER_ID) .withLease("3", WORKER_ID) .withLease("4", WORKER_ID) .withLease("5", WORKER_ID) .build(); coordinator.runLeaseTaker(); List<Lease> allLeases = coordinator.allLeases(); assertThat(allLeases.size(), equalTo(addedLeases.size())); assertThat(allLeases.containsAll(addedLeases.values()), equalTo(true)); }
Source:
private static KeyEvent createNewKeyEvent(KeyEvent originalEvent) { KeyEvent newEvent = null; Class c = originalEvent.getClass(); if (c.equals(KeyDownEvent.class)) { newEvent = KeyDownEvent.create(originalEvent.getKey(), originalEvent.getKeyCharacter(), originalEvent.getDelta()); } else if (c.equals(KeyRepeatEvent.class)) { newEvent = KeyRepeatEvent.create(originalEvent.getKey(), originalEvent.getKeyCharacter(), originalEvent.getDelta()); } else if (c.equals(KeyUpEvent.class)) { newEvent = KeyUpEvent.create(originalEvent.getKey(), originalEvent.getKeyCharacter(), originalEvent.getDelta()); } else { logger.error("ERROR!!! Event not Identified"); } return newEvent; }

Target:
private KeyEvent createNewKeyEvent(KeyEvent originalEvent) { KeyEvent newEvent = null; Class eventClass = originalEvent.getClass(); if (eventClass.equals(KeyDownEvent.class)) { newEvent = KeyDownEvent.create(originalEvent.getKey(), originalEvent.getKeyCharacter(), originalEvent.getDelta()); } else if (eventClass.equals(KeyRepeatEvent.class)) { newEvent = KeyRepeatEvent.create(originalEvent.getKey(), originalEvent.getKeyCharacter(), originalEvent.getDelta()); } else if (eventClass.equals(KeyUpEvent.class)) { newEvent = KeyUpEvent.create(originalEvent.getKey(), originalEvent.getKeyCharacter(), originalEvent.getDelta()); } else { logger.error("ERROR!!! Event not Identified"); } return newEvent; }
Source:
public StringDataValue repeat(StringDataValue leftOperand, NumberDataValue rightOperand, StringDataValue result) throws StandardException { if (result == null) { result = (StringDataValue) getNewNull(); } if (leftOperand == null || leftOperand.isNull() || leftOperand.getString() == null) { result.setToNull(); return result; } int repeatedTimes; if (rightOperand == null || rightOperand.isNull()) { throw StandardException.newException( SQLState.LANG_INVALID_FUNCTION_ARGUMENT, "NULL", "REPEAT"); } else { try { repeatedTimes = rightOperand.getInt(); } catch (StandardException e) { throw StandardException.newException( SQLState.LANG_INVALID_FUNCTION_ARGUMENT, rightOperand, "REPEAT"); } if (repeatedTimes < 0) { throw StandardException.newException( SQLState.LANG_INVALID_FUNCTION_ARGUMENT, rightOperand, "REPEAT"); } } String val = leftOperand.getString(); String concatenatedVal = null; for (int i=0; i<repeatedTimes; i++) { concatenatedVal = concatenatedVal == null? val : concatenatedVal + val; } result.setValue(concatenatedVal==null?"":concatenatedVal); return result; }

Target:
public StringDataValue repeat(StringDataValue leftOperand, NumberDataValue rightOperand, StringDataValue result) throws StandardException { if (result == null) { result = (StringDataValue) getNewNull(); } if (leftOperand == null || leftOperand.isNull() || leftOperand.getString() == null) { result.setToNull(); return result; } int repeatedTimes; if (rightOperand == null || rightOperand.isNull()) { throw StandardException.newException( SQLState.LANG_INVALID_FUNCTION_ARGUMENT, "NULL", "REPEAT"); } else { try { repeatedTimes = rightOperand.getInt(); } catch (StandardException e) { throw StandardException.newException( SQLState.LANG_INVALID_FUNCTION_ARGUMENT, rightOperand, "REPEAT"); } if (repeatedTimes < 0) { throw StandardException.newException( SQLState.LANG_INVALID_FUNCTION_ARGUMENT, rightOperand, "REPEAT"); } } String val = leftOperand.getString(); StringBuilder builder = new StringBuilder(); for (int i=0; i<repeatedTimes; i++) { builder.append(val); } result.setValue(builder.toString()); return result; }
Source:
public StreamSpec(String id, String physicalName, String systemName, int partitionCount, Map<String, String> config) { if (id == null) { throw new NullPointerException("Parameter 'id' must not be null"); } if (systemName == null) { throw new NullPointerException("Parameter 'systemName' must not be null"); } this.id = id; this.systemName = systemName; this.physicalName = physicalName; this.partitionCount = partitionCount; if (config != null) { this.config = Collections.unmodifiableMap(config); } else { this.config = Collections.emptyMap(); } }

Target:
public StreamSpec(String id, String physicalName, String systemName, int partitionCount, Map<String, String> config) { if (id == null) { throw new NullPointerException("Parameter 'id' must not be null"); } if (systemName == null) { throw new NullPointerException("Parameter 'systemName' must not be null"); } if (partitionCount < 1) { throw new NullPointerException("Parameter 'partitionCount' must not be greater than 0"); } this.id = id; this.systemName = systemName; this.physicalName = physicalName; this.partitionCount = partitionCount; if (config != null) { this.config = Collections.unmodifiableMap(new HashMap<>(config)); } else { this.config = Collections.emptyMap(); } }
Source:
protected boolean authenticate(ContainerRequestContext requestContext, @Nullable C credentials, String scheme) { try { if (credentials == null) { return false; } final Optional<P> principal = authenticator.authenticate(credentials); if (!principal.isPresent()) { return false; } final P prince = principal.get(); final SecurityContext securityContext = requestContext.getSecurityContext(); final boolean secure = securityContext != null && securityContext.isSecure(); requestContext.setSecurityContext(new SecurityContext() { @Override public Principal getUserPrincipal() { return prince; } @Override public boolean isUserInRole(String role) { return authorizer.authorize(prince, role, requestContext.getUriInfo()); } @Override public boolean isSecure() { return secure; } @Override public String getAuthenticationScheme() { return scheme; } }); return true; } catch (AuthenticationException e) { logger.warn("Error authenticating credentials", e); throw new InternalServerErrorException(); } }

Target:
protected boolean authenticate(ContainerRequestContext requestContext, @Nullable C credentials, String scheme) { try { if (credentials == null) { return false; } final Optional<P> principal = authenticator.authenticate(credentials); if (!principal.isPresent()) { return false; } final P prince = principal.get(); final SecurityContext securityContext = requestContext.getSecurityContext(); final boolean secure = securityContext != null && securityContext.isSecure(); requestContext.setSecurityContext(new SecurityContext() { @Override public Principal getUserPrincipal() { return prince; } @Override public boolean isUserInRole(String role) { return authorizer.authorize(prince, role, requestContext); } @Override public boolean isSecure() { return secure; } @Override public String getAuthenticationScheme() { return scheme; } }); return true; } catch (AuthenticationException e) { logger.warn("Error authenticating credentials", e); throw new InternalServerErrorException(); } }
Source:
public String prettyPrint(SkyKey key) { if (SkyFunctions.isSkyFunction(SkyFunctions.CONFIGURED_TARGET).apply(key)) { return ((ConfiguredTargetKey) key.argument()).prettyPrint(); } else if (SkyFunctions.isSkyFunction(SkyFunctions.ASPECT).apply(key)) { return ((AspectKey) key.argument()).prettyPrint(); } else if (key instanceof AspectValueKey) { return ((AspectValueKey) key).getDescription(); } else { return getLabel(key).toString(); } }

Target:
public String prettyPrint(SkyKey key) { if (key instanceof ConfiguredTargetKey) { return ((ConfiguredTargetKey) key.argument()).prettyPrint(); } else if (key instanceof AspectKey) { return ((AspectKey) key.argument()).prettyPrint(); } else if (key instanceof AspectValueKey) { return ((AspectValueKey) key).getDescription(); } else { return getLabel(key).toString(); } }
Source:
public void destroy() { executorService.shutdown(); }

Target:
public void destroy() { executorService.shutdownNow(); }
Source:
public DiningSessionListAdapter(Context ctx, List<DiningSession> sessions) { super(ctx, R.layout.listitem_restaurant_request_bot, sessions); mContext = ctx; }

Target:
public DiningSessionListAdapter(Context ctx, List<DiningSession> sessions) { super(ctx, R.layout.listitem_restaurant_request_top, sessions); mContext = ctx; }
Source:
public void testList() throws StripeException { final OrderCollection orders = Order.list(null); assertNotNull(orders); assertEquals(1, orders.getData().size()); verifyRequest( APIResource.RequestMethod.GET, "/v1/orders" ); }

Target:
public void testList() throws StripeException { final Map<String, Object> params = new HashMap<String, Object>(); params.put("limit", 1); final OrderCollection orders = Order.list(params); assertNotNull(orders); verifyRequest( APIResource.RequestMethod.GET, "/v1/orders", params ); }
Source:
private boolean canUpdateCompatibilityVersionOrCpu() { allForCluster = vdsDao.getAllForCluster(oldCluster.getId()); List<VDS> upVdss = allForCluster.stream() .filter(v -> v.getStatus() == VDSStatus.Up) .collect(Collectors.toList()); boolean valid = true; String lowerVersionHosts = ""; String lowCpuHosts = ""; String incompatibleEmulatedMachineHosts = ""; for (VDS vds : upVdss) { if (!VersionSupport.checkClusterVersionSupported( getCluster().getCompatibilityVersion(), vds)) { valid = false; lowerVersionHosts = lowerVersionHosts.concat(vds.getName() + ", "); } if (getCluster().supportsVirtService() && missingServerCpuFlags(vds) != null) { valid = false; lowCpuHosts = lowCpuHosts.concat(vds.getName() + ", "); } if (!isSupportedEmulatedMachinesMatchClusterLevel(vds)) { valid = false; incompatibleEmulatedMachineHosts = incompatibleEmulatedMachineHosts.concat(vds.getName() + ", "); } } if (!lowerVersionHosts.isEmpty()) { addValidationVarAndMessage("host", lowerVersionHosts.replaceAll(", $", ""), EngineMessage.CLUSTER_CANNOT_UPDATE_COMPATIBILITY_VERSION_WITH_LOWER_HOSTS); } if (!lowCpuHosts.isEmpty()) { addValidationVarAndMessage("host", lowCpuHosts.replaceAll(", $", ""), EngineMessage.CLUSTER_CANNOT_UPDATE_CPU_WITH_LOWER_HOSTS); } if (!incompatibleEmulatedMachineHosts.isEmpty()) { addValidationVarAndMessage("host", incompatibleEmulatedMachineHosts.replaceAll(", $", ""), EngineMessage.CLUSTER_CANNOT_UPDATE_COMPATIBILITY_VERSION_WITH_INCOMPATIBLE_EMULATED_MACHINE); } return valid; }

Target:
private boolean canUpdateCompatibilityVersionOrCpu() { allForCluster = vdsDao.getAllForCluster(oldCluster.getId()); List<VDS> upVdss = allForCluster.stream() .filter(v -> v.getStatus() == VDSStatus.Up) .collect(Collectors.toList()); boolean valid = true; List<String> lowerVersionHosts = new ArrayList<>(); List<String> lowCpuHosts = new ArrayList<>(); List<String> incompatibleEmulatedMachineHosts = new ArrayList<>(); for (VDS vds : upVdss) { if (!VersionSupport.checkClusterVersionSupported( getCluster().getCompatibilityVersion(), vds)) { valid = false; lowerVersionHosts.add(vds.getName()); } if (getCluster().supportsVirtService() && missingServerCpuFlags(vds) != null) { valid = false; lowCpuHosts.add(vds.getName()); } if (!isSupportedEmulatedMachinesMatchClusterLevel(vds)) { valid = false; incompatibleEmulatedMachineHosts.add(vds.getName()); } } if (!lowerVersionHosts.isEmpty()) { addValidationVarAndMessage("host", String.join(", ", lowerVersionHosts), EngineMessage.CLUSTER_CANNOT_UPDATE_COMPATIBILITY_VERSION_WITH_LOWER_HOSTS); } if (!lowCpuHosts.isEmpty()) { addValidationVarAndMessage("host", String.join(", ", lowCpuHosts), EngineMessage.CLUSTER_CANNOT_UPDATE_CPU_WITH_LOWER_HOSTS); } if (!incompatibleEmulatedMachineHosts.isEmpty()) { addValidationVarAndMessage("host", String.join(", ", incompatibleEmulatedMachineHosts), EngineMessage.CLUSTER_CANNOT_UPDATE_COMPATIBILITY_VERSION_WITH_INCOMPATIBLE_EMULATED_MACHINE); } return valid; }
Source:
private void verifyPreemption(int numStarvedAppContainers) throws InterruptedException { for (int i = 0; i < 1000; i++) { if (greedyApp.getLiveContainers().size() == 2 * numStarvedAppContainers) { break; } Thread.sleep(10); } assertEquals("Incorrect # of containers on the greedy app", 2 * numStarvedAppContainers, greedyApp.getLiveContainers().size()); assertEquals("Incorrect # of preempted containers in QueueMetrics", 8 - 2 * numStarvedAppContainers, greedyApp.getQueue().getMetrics().getAggregatePreemptedContainers()); for (RMNode rmNode : rmNodes) { FSSchedulerNode node = (FSSchedulerNode) scheduler.getNodeTracker().getNode(rmNode.getNodeID()); if (node.getContainersForPreemption().size() > 0) { assertTrue(node.getPreemptionList().keySet().contains(starvingApp)); } } sendEnoughNodeUpdatesToAssignFully(); assertEquals("Starved app is not assigned the right # of containers", numStarvedAppContainers, starvingApp.getLiveContainers().size()); for (RMNode rmNode : rmNodes) { FSSchedulerNode node = (FSSchedulerNode) scheduler.getNodeTracker().getNode(rmNode.getNodeID()); if (node.getContainersForPreemption().size() > 0) { assertTrue(!node.getPreemptionList().keySet().contains(starvingApp)); } } }

Target:
private void verifyPreemption(int numStarvedAppContainers) throws InterruptedException { for (int i = 0; i < 1000; i++) { if (greedyApp.getLiveContainers().size() == 2 * numStarvedAppContainers) { break; } Thread.sleep(10); } assertEquals("Incorrect # of containers on the greedy app", 2 * numStarvedAppContainers, greedyApp.getLiveContainers().size()); assertEquals("Incorrect # of preempted containers in QueueMetrics", 8 - 2 * numStarvedAppContainers, greedyApp.getQueue().getMetrics().getAggregatePreemptedContainers()); for (RMNode rmNode : rmNodes) { FSSchedulerNode node = (FSSchedulerNode) scheduler.getNodeTracker().getNode(rmNode.getNodeID()); if (node.getContainersForPreemption().size() > 0) { assertTrue("node should be reserved for the starvingApp", node.getPreemptionList().keySet().contains(starvingApp)); } } sendEnoughNodeUpdatesToAssignFully(); assertEquals("Starved app is not assigned the right # of containers", numStarvedAppContainers, starvingApp.getLiveContainers().size()); for (RMNode rmNode : rmNodes) { FSSchedulerNode node = (FSSchedulerNode) scheduler.getNodeTracker().getNode(rmNode.getNodeID()); if (node.getContainersForPreemption().size() > 0) { assertFalse(node.getPreemptionList().keySet().contains(starvingApp)); } } }
Source:
public byte[] getKey() throws Exception { final String o = String.valueOf(properties.get(propertyName)); return EncodingUtils.BASE64_DECODER.apply(o.getBytes(EncodingUtils.ENCODING)); }

Target:
public byte[] getKey() throws Exception { final Object propertyObject = properties.get(propertyName); if (propertyObject == null) { throw new IllegalArgumentException("Property '" + propertyName + "' does not exist."); } final String o = String.valueOf(propertyObject); return EncodingUtils.BASE64_DECODER.apply(o.getBytes(EncodingUtils.ENCODING)); }
Source:
private boolean shouldBulkRead(int[] docIds, int startIndex, int endIndex) { int numDocsToRead = endIndex - startIndex + 1; int docIdRange = docIds[endIndex] - docIds[startIndex] + 1; if (docIdRange > DocIdSetPlanNode.MAX_DOC_PER_CALL) { return false; } return numDocsToRead >= ((double)docIdRange * 0.7); }

Target:
private boolean shouldBulkRead(int[] docIds, int startIndex, int endIndex) { int numDocsToRead = endIndex - startIndex + 1; int docIdRange = docIds[endIndex] - docIds[startIndex] + 1; return numDocsToRead >= ((double)docIdRange * 0.5); }
Source:
private Map<String, List<KafkaMetric>> groupMetrics(Collection<KafkaMetric> metrics) { Map<String, List<KafkaMetric>> result = new HashMap<>(); for (KafkaMetric metric : metrics) { String name = getMBeanName(prefix, metric.metricName()); List<KafkaMetric> list = result.get(name); if (list == null) { list = new ArrayList<>(); result.put(name, list); } list.add(metric); } return result; }

Target:
private Map<String, List<KafkaMetric>> groupMetrics(Collection<KafkaMetric> metrics) { Map<String, List<KafkaMetric>> result = new HashMap<>(); for (KafkaMetric metric : metrics) { String name = getMBeanName(prefix, metric.metricName()); result.computeIfAbsent(name, __ -> new ArrayList<>()).add(metric); } return result; }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SelectorPredicateFactory that = (SelectorPredicateFactory) o; return Objects.equals(initLock, that.initLock); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SelectorPredicateFactory that = (SelectorPredicateFactory) o; return Objects.equals(value, that.value); }
Source:
private void visit(StateGraphNode node) { visited.add(node); if (node instanceof State) { State st = (State) node; if (RoomHelpers.hasDirectSubStructure(st)) { addStartingPoints(st.getSubgraph(), true); } else { for (ActiveTrigger trigger : xpAct.getActiveTriggers(st)) { for (TriggeredTransition trans : trigger.getTransitions()) visit(trans); } for(Transition trans : xpAct.getOutgoingTransitions(node)){ if(trans instanceof GuardedTransition) visit(trans); } } } else { if (node instanceof EntryPoint) { boolean markVisited = true; State container = (State) node.eContainer().eContainer(); StateGraph parentGraph = container.getSubgraph(); for (Transition tr : parentGraph.getTransitions()) if (tr instanceof InitialTransition) markVisited = false; if (markVisited) visited.add(container); } for (Transition trans : xpAct.getOutgoingTransitions(node)) visit(trans); } }

Target:
private void visit(StateGraphNode node) { visited.add(node); if (node instanceof State) { State st = (State) node; if (RoomHelpers.hasDirectSubStructure(st)) { addStartingPoints(st.getSubgraph(), true); } else { for (ActiveTrigger trigger : xpAct.getActiveTriggers(st)) { for (TriggeredTransition trans : trigger.getTransitions()) visit(trans); } for(Transition trans : roomExt.getOutgoingTransitionsHierarchical(xpAct, st)){ if(trans instanceof GuardedTransition) visit(trans); } } } else { if (node instanceof EntryPoint) { boolean markVisited = true; State container = (State) node.eContainer().eContainer(); StateGraph parentGraph = container.getSubgraph(); for (Transition tr : parentGraph.getTransitions()) if (tr instanceof InitialTransition) markVisited = false; if (markVisited) visited.add(container); } for (Transition trans : xpAct.getOutgoingTransitions(node)) visit(trans); } }
Source:
protected void executeCommand() { final List<LUNs> lunsFromVgInfo = (List<LUNs>) runVdsCommand(VDSCommandType.GetVGInfo, new GetVGInfoVDSCommandParameters(getVds().getId(), getStorageDomain().getStorage())).getReturnValue(); final List<LUNs> lunsFromDb = getLunDao().getAllForVolumeGroup(getStorageDomain().getStorage()); List<LUNs> lunsToUpdateInDb = getLunsToUpdateInDb(lunsFromVgInfo, lunsFromDb); if (lunsFromDb.size() != lunsFromVgInfo.size() || lunsToUpdateInDb.size() > 0) { TransactionSupport.executeInNewTransaction(() -> { updateLunsInDb(lunsToUpdateInDb); refreshLunsInfo(lunsFromVgInfo, lunsFromDb); return null; }); } setSucceeded(true); }

Target:
protected void executeCommand() { final List<LUNs> lunsFromVgInfo = (List<LUNs>) runVdsCommand(VDSCommandType.GetVGInfo, new GetVGInfoVDSCommandParameters(getVds().getId(), getStorageDomain().getStorage())).getReturnValue(); final List<LUNs> lunsFromDb = getLunDao().getAllForVolumeGroup(getStorageDomain().getStorage()); List<LUNs> lunsToUpdateInDb = getLunsToUpdateInDb(lunsFromVgInfo, lunsFromDb); if (lunsFromDb.size() != lunsFromVgInfo.size() || !lunsToUpdateInDb.isEmpty()) { TransactionSupport.executeInNewTransaction(() -> { updateLunsInDb(lunsToUpdateInDb); refreshLunsConnections(lunsFromVgInfo); cleanupLunsFromDb(lunsFromVgInfo, lunsFromDb); return null; }); } setSucceeded(true); }
Source:
boolean canStop() { while (true) { int state = getState(); if (state == START_EXITED_FAIL || state == STOPPING) { return false; } else if (state == START_EXITED_SUCCESSFUL) { if (compareAndSetState(START_EXITED_SUCCESSFUL, STOPPING)) { return true; } } else { throw new IllegalMonitorStateException("Called stop() before start()"); } } }

Target:
boolean canStop() { while (true) { int state = getState(); if (state == START_EXITED_FAIL || state == STOPPING) { return false; } else if (state == START_EXITED_SUCCESSFUL) { if (compareAndSetState(START_EXITED_SUCCESSFUL, STOPPING)) { return true; } } else { throw new IllegalMonitorStateException("Called canStop() before start()"); } } }
Source:
public void doesNotBackOffIfLegacy() throws Exception { when(shouldStopRetrying.test(anyInt())).thenAnswer(inv -> ((int) inv.getArgument(0)) > 50); when(task.run()).thenThrow(new TransactionFailedRetriableException("")); assertThatExceptionOfType(TransactionFailedRetriableException.class) .isThrownBy(() -> legacy.runWithRetry(shouldStopRetrying, task)); assertThat(blockStrategy.totalBlockedTime).isZero(); }

Target:
public void doesNotBackOffIfLegacy() throws Exception { mockRetries(50); when(task.run()).thenThrow(new TransactionFailedRetriableException("")); assertThatExceptionOfType(TransactionFailedRetriableException.class) .isThrownBy(this::runLegacy); assertThat(blockStrategy.totalBlockedTime).isZero(); }
Source:
public void testOverwriteBlobMetadata() throws Exception { String blobKey = TestUtils.createRandomBlobKey("writePayload-", ".img"); Blob blob = new BlobBuilderImpl() .name(blobKey) .payload(randomByteSource().slice(0, 1024)) .userMetadata(ImmutableMap.of("key1", "value1")) .build(); storageStrategy.putBlob(CONTAINER_NAME, blob); blob = storageStrategy.getBlob(CONTAINER_NAME, blobKey); if (!blob.getMetadata().getUserMetadata().containsKey("key1")) { throw new SkipException("Underlying filesystem does not support xattr"); } blob = new BlobBuilderImpl() .name(blobKey) .payload(randomByteSource().slice(0, 1024)) .build(); storageStrategy.putBlob(CONTAINER_NAME, blob); blob = storageStrategy.getBlob(CONTAINER_NAME, blobKey); assertFalse(blob.getMetadata().getUserMetadata().containsKey("key1")); }

Target:
public void testOverwriteBlobMetadata() throws Exception { if (!getFileStore(Paths.get(TestUtils.TARGET_BASE_DIR)).supportsFileAttributeView(UserDefinedFileAttributeView.class)) { throw new SkipException("Filesystem does not support xattr"); } String blobKey = TestUtils.createRandomBlobKey("writePayload-", ".img"); Blob blob = new BlobBuilderImpl() .name(blobKey) .payload(randomByteSource().slice(0, 1024)) .userMetadata(ImmutableMap.of("key1", "value1")) .build(); storageStrategy.putBlob(CONTAINER_NAME, blob); blob = storageStrategy.getBlob(CONTAINER_NAME, blobKey); assertEquals(blob.getMetadata().getUserMetadata().get("key1"), "value1"); blob = new BlobBuilderImpl() .name(blobKey) .payload(randomByteSource().slice(0, 1024)) .build(); storageStrategy.putBlob(CONTAINER_NAME, blob); blob = storageStrategy.getBlob(CONTAINER_NAME, blobKey); assertFalse(blob.getMetadata().getUserMetadata().containsKey("key1")); }
Source:
public static void main(String[] args) throws Exception { Topology topology = new Topology("Echo"); topology.checkpointPeriod(1, TimeUnit.MINUTES); TStream<String> echo = topology.strings(args); echo.print(); StreamsContextFactory.getStreamsContext(StreamsContext.Type.TOOLKIT).submit(topology).get(); }

Target:
public static void main(String[] args) throws Exception { Topology topology = new Topology("Echo"); TStream<String> echo = topology.strings(args); echo.print(); StreamsContextFactory.getEmbedded().submit(topology).get(); }
Source:
public static Collection<Object[]> namesParams() { return Arrays.asList(new Object[][] { { null, false, false }, { "a.a.a.a", false, false }, { "255.255.0", false, false }, { "255.255.0.0.0", false, false }, { "255.255.0.0.", false, false }, { "255.255.0.1", true, false }, { "255.0.255.0", true, false }, { "255.0.0.255", true, false }, { "224.0.255.0", true, false }, { "255.255.0.0", true, true }, { "255.255.255.255", true, true }, { "31 ", false, false }, { "33", false, false }, { "31/", false, false }, { "31*", false, false }, { " { "/31 ", false, false }, { "31", true, true }, { "/31", true, true }, { "2", true, true }, { "/2", true, true }, }); }

Target:
public static Collection<Object[]> namesParams() { return Arrays.asList(new Object[][] { { null, false, false, true }, { "", false, false, true }, { "a.a.a.a", false, false, true }, { "255.255.0", false, false, true }, { "255.255.0.0.0", false, false, true }, { "255.255.0.0.", false, false, true }, { "31 ", false, false, true }, { "33", false, false, true }, { "31/", false, false, true }, { "31*", false, false, true }, { " { "/31 ", false, false, true }, { "01", false, false, true }, { "01/", false, false, true }, { "33", false, false, true }, { "/33", false, false, true }, { "255.255.0.1", true, false, true }, { "255.0.255.0", true, false, true }, { "255.0.0.255", true, false, true }, { "224.0.255.0", true, false, true }, { "255.255.0.0", true, true, true }, { "255.255.255.255", true, true, true }, { "31", true, true, true }, { "/31", true, true, true }, { "2", true, true, true }, { "/2", true, true, true }, { "31", false, false, false }, { "/31", false, false, false }, { "2", false, false, false }, { "/2", false, false, false }, { "255.255.0.1", true, false, true }, { "255.255.0.1", true, false, false }, { "255.255.0.0", true, true, true }, { "255.255.0.0", true, true, false }, }); }
Source:
public String stemWord(String word) { if (word == null) { return word; } word = word.toLowerCase(eoLocale); if (isExceptionOrNumber(word)) { return word; } String suffix = word; int localMinStemLength = Math.max(minStemLength, firstVowelPos(suffix) + 1); int pluralDirectOffset = calcPluralDirectOffset(suffix); if (pluralDirectOffset > 0) { suffix = suffix.substring(0, suffix.length() - pluralDirectOffset); if (pluralDirectChecks.contains(suffix) || stemmerExceptions.contains(suffix)) { return suffix; } } suffix = findLongestSuffix(suffix, localMinStemLength); int stemLength = word.length() - suffix.length() - pluralDirectOffset; if (!suffix.isEmpty() && stemLength > 0 && suffix.charAt(0) == '-') { return word.substring(0, stemLength); } if (stemLength < localMinStemLength) { return word; } return word.substring(0, stemLength); }

Target:
public String stemWord(String word) { if (word == null) { return word; } if (isExceptionOrNumber(word)) { return word; } String suffix = word; int localMinStemLength = Math.max(MIN_STEM_LENGTH, firstVowelPos(suffix) + 1); int pluralDirectOffset = calcPluralDirectOffset(suffix); if (pluralDirectOffset > 0) { suffix = suffix.substring(0, suffix.length() - pluralDirectOffset); if (PLURAL_DIRECT_CHECKS.contains(suffix) || STEMMER_EXCEPTIONS.contains(suffix)) { return suffix; } } suffix = findLongestSuffix(suffix, localMinStemLength); int stemLength = word.length() - suffix.length() - pluralDirectOffset; if (!suffix.isEmpty() && stemLength > 0 && suffix.charAt(0) == '-') { return word.substring(0, stemLength); } if (stemLength < localMinStemLength) { return word; } return word.substring(0, stemLength); }
Source:
private JavaSymbolicObject expandMacro(JavaSymbolicObject node) { JavaSymbolicObject expandedNode = (JavaSymbolicObject) node.accept(this); while (!node.equals(expandedNode)) { node = expandedNode; expandedNode = (JavaSymbolicObject) node.accept(this); } return node; }

Target:
private JavaSymbolicObject expandMacro(JavaSymbolicObject node) { JavaSymbolicObject expandedNode = (JavaSymbolicObject) node.accept(this); while (node != expandedNode) { node = expandedNode; expandedNode = (JavaSymbolicObject) node.accept(this); } return node; }
Source:
public static void readInDocFromPointable(UTF8StringPointable stringp, ByteBufferInputStream bbis, DataInputStream di, ArrayBackedValueStorage abvs, XMLParser parser) throws HyracksDataException { String fName; try { fName = getStringFromPointable(stringp, bbis, di); } catch (SystemException e) { throw new HyracksDataException(e); } File file = new File(fName); if(file.exists()) { parser.parseDocument(file, abvs); } else { HDFSFunctions hdfs = new HDFSFunctions(); FileSystem fs = hdfs.getFileSystem(); if (fs != null) { Path xmlDocument = new Path(fName); try { if (fs.exists(xmlDocument)) { InputStream in = fs.open(xmlDocument).getWrappedStream(); parser.parseHDFSDocument( in, abvs); } } catch (FileNotFoundException e) { System.err.println(e); } catch (IOException e) { System.err.println(e); } } } }

Target:
public static void readInDocFromPointable(UTF8StringPointable stringp, ByteBufferInputStream bbis, DataInputStream di, ArrayBackedValueStorage abvs, XMLParser parser) throws HyracksDataException { String fName; try { fName = getStringFromPointable(stringp, bbis, di); } catch (SystemException e) { throw new HyracksDataException(e); } if (!fName.contains("hdfs:/")) { File file = new File(fName); if (file.exists()) { parser.parseDocument(file, abvs); } } else { fName = fName.replaceAll("hdfs:/", ""); HDFSFunctions hdfs = new HDFSFunctions(); FileSystem fs = hdfs.getFileSystem(); if (fs != null) { Path xmlDocument = new Path(fName); try { if (fs.exists(xmlDocument)) { InputStream in = fs.open(xmlDocument).getWrappedStream(); parser.parseHDFSDocument(in, abvs); } } catch (FileNotFoundException e) { System.err.println(e); } catch (IOException e) { System.err.println(e); } } } }
Source:
protected void optimizeJoinGroup(AST2BOpContext ctx, StaticAnalysis sa, IBindingSet[] bSets, JoinGroupNode op) { final QueryRoot root = sa.getQueryRoot(); if (root.getQueryType() == QueryType.ASK) { return; } op.getChildren(SubqueryBase.class).stream().forEach(node -> { SubqueryBase subqueryBase = (SubqueryBase)node; JoinGroupNode whereClause = (JoinGroupNode)subqueryBase.getWhereClause(); whereClause.setProperty(QueryBase.Annotations.PROJECTION, subqueryBase.getProjection()); }); LabelServiceUtils.getLabelServiceNodes(op).forEach(service -> { JoinGroupNode g = (JoinGroupNode) service.getGraphPattern(); boolean foundArg = false; for (BOp st : g.args()) { StatementPatternNode sn = (StatementPatternNode) st; if (sn.s().isConstant() && BD.SERVICE_PARAM.equals(sn.s().getValue())) { continue; } foundArg = true; break; } if (EmptyLabelServiceOptimizer.this.restoreExtracted(service)) { foundArg = true; } if (!foundArg) { EmptyLabelServiceOptimizer.this.addResolutions(ctx, g, (ProjectionNode) service.getParent().annotations().get( QueryBase.Annotations.PROJECTION ) ); } }); }

Target:
protected void optimizeJoinGroup(AST2BOpContext ctx, StaticAnalysis sa, IBindingSet[] bSets, JoinGroupNode op) { final QueryRoot root = sa.getQueryRoot(); if (root.getQueryType() == QueryType.ASK) { return; } op.getChildren(SubqueryBase.class).forEach(node -> { JoinGroupNode whereClause = (JoinGroupNode) node.getWhereClause(); whereClause.setProperty(QueryBase.Annotations.PROJECTION, node.getProjection()); }); LabelServiceUtils.getLabelServiceNodes(op).forEach(service -> { JoinGroupNode g = (JoinGroupNode) service.getGraphPattern(); boolean foundArg = false; for (BOp st : g.args()) { StatementPatternNode sn = (StatementPatternNode) st; if (sn.s().isConstant() && BD.SERVICE_PARAM.equals(sn.s().getValue())) { continue; } foundArg = true; break; } if (restoreExtracted(service)) { foundArg = true; } if (!foundArg) { addResolutions(ctx, g, getProjectionNode(service)); } }); }
Source:
private static List<Predicate<ChangeData>> filters( ChangeQueryBuilder.Arguments args, CurrentUser user, boolean checkIsVisible) { List<Predicate<ChangeData>> r = Lists.newArrayList(); ChangeQueryBuilder builder = new ChangeQueryBuilder(args, user); for (AccountProjectWatch w : user.getNotificationFilters()) { Predicate<ChangeData> f = null; if (w.getFilter() != null) { try { f = builder.parse(w.getFilter()); if (builder.find(f, IsWatchedByPredicate.class) != null) { continue; } } catch (QueryParseException e) { continue; } } Predicate<ChangeData> p; if (w.getProjectNameKey().equals(args.allProjectsName)) { p = null; } else { p = builder.project(w.getProjectNameKey().get()); } if (p != null && f != null) { r.add(and(p, f)); } else if (p != null) { r.add(p); } else if (f != null) { r.add(f); } else { r.add(builder.status_open()); } } if (r.isEmpty()) { return none(); } else if (checkIsVisible) { return ImmutableList.of(or(r), builder.is_visible()); } else { return r; } }

Target:
private static List<Predicate<ChangeData>> filters( ChangeQueryBuilder.Arguments args, CurrentUser user, boolean checkIsVisible) { List<Predicate<ChangeData>> r = Lists.newArrayList(); ChangeQueryBuilder builder = new ChangeQueryBuilder(args, user); for (AccountProjectWatch w : user.getNotificationFilters()) { Predicate<ChangeData> f = null; if (w.getFilter() != null) { try { f = builder.parse(w.getFilter()); if (builder.find(f, IsWatchedByPredicate.class) != null) { continue; } } catch (QueryParseException e) { continue; } } Predicate<ChangeData> p; if (w.getProjectNameKey().equals(args.allProjectsName)) { p = null; } else { p = builder.project(w.getProjectNameKey().get()); } if (p != null && f != null) { @SuppressWarnings("unchecked") Predicate<ChangeData> andPredicate = and(p, f); r.add(andPredicate); } else if (p != null) { r.add(p); } else if (f != null) { r.add(f); } else { r.add(builder.status_open()); } } if (r.isEmpty()) { return none(); } else if (checkIsVisible) { return ImmutableList.of(or(r), builder.is_visible()); } else { return r; } }
Source:
public SuggestionResource build() { return new SuggestionResource(this); }

Target:
public SuggestionResource build() { validate(); return new SuggestionResource(this); }
Source:
private static String toDruidLiteral(RexNode rexNode, RelDataType rowType, DruidQuery druidQuery) { final SimpleDateFormat dateFormatter = new SimpleDateFormat( TimeExtractionFunction.ISO_TIME_FORMAT, Locale.ROOT); dateFormatter.setTimeZone(DateTimeUtils.UTC_ZONE); final String val; final RexLiteral rhsLiteral = (RexLiteral) rexNode; if (SqlTypeName.NUMERIC_TYPES.contains(rhsLiteral.getTypeName())) { val = String.valueOf(RexLiteral.value(rhsLiteral)); } else if (SqlTypeName.CHAR_TYPES.contains(rhsLiteral.getTypeName())) { val = String.valueOf(RexLiteral.stringValue(rhsLiteral)); } else if (SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE == rhsLiteral.getTypeName() || SqlTypeName.TIMESTAMP == rhsLiteral.getTypeName() || SqlTypeName.DATE == rhsLiteral.getTypeName()) { Long millisSinceEpoch = DruidDateTimeUtils.literalValue(rexNode); if (millisSinceEpoch == null) { throw new AssertionError( "Cannot translate Literal" + rexNode + " of type " + rhsLiteral.getTypeName() + " to TimestampString"); } val = dateFormatter.format(millisSinceEpoch); } else { val = null; } return val; }

Target:
private static String toDruidLiteral(RexNode rexNode, RelDataType rowType, DruidQuery druidQuery) { final String val; final RexLiteral rhsLiteral = (RexLiteral) rexNode; if (SqlTypeName.NUMERIC_TYPES.contains(rhsLiteral.getTypeName())) { val = String.valueOf(RexLiteral.value(rhsLiteral)); } else if (SqlTypeName.CHAR_TYPES.contains(rhsLiteral.getTypeName())) { val = String.valueOf(RexLiteral.stringValue(rhsLiteral)); } else if (SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE == rhsLiteral.getTypeName() || SqlTypeName.TIMESTAMP == rhsLiteral.getTypeName() || SqlTypeName.DATE == rhsLiteral.getTypeName()) { Long millisSinceEpoch = DruidDateTimeUtils.literalValue(rexNode); if (millisSinceEpoch == null) { throw new AssertionError( "Cannot translate Literal" + rexNode + " of type " + rhsLiteral.getTypeName() + " to TimestampString"); } val = DATE_FORMATTER.format(millisSinceEpoch); } else { val = null; } return val; }
Source:
public void onChildOpened( @NonNull Network network, @NonNull ChildSessionConfiguration childConfig) { if (!isActiveNetwork(network)) { Log.d(TAG, "onOpened called for obsolete network " + network); return; } try { final Collection<RouteInfo> newRoutes = VpnIkev2Utils.getRoutesFromTrafficSelectors( childConfig.getOutboundTrafficSelectors()); for (final LinkAddress address : childConfig.getInternalAddresses()) { mTunnelIface.addAddress(address.getAddress(), address.getPrefixLength()); } final NetworkAgent networkAgent; final LinkProperties lp; synchronized (Vpn.this) { mInterface = mTunnelIface.getInterfaceName(); mConfig.mtu = mProfile.getMaxMtu(); mConfig.interfaze = mInterface; mConfig.addresses.clear(); mConfig.addresses.addAll(childConfig.getInternalAddresses()); mConfig.routes.clear(); mConfig.routes.addAll(newRoutes); networkAgent = mNetworkAgent; lp = makeLinkProperties(); if (networkAgent == null) { if (isSettingsVpnLocked()) { prepareStatusIntent(); } agentConnect(); return; } } networkAgent.sendLinkProperties(lp); } catch (Exception e) { Log.d(TAG, "Error in ChildOpened for network " + network, e); onSessionLost(network); } }

Target:
public void onChildOpened( @NonNull Network network, @NonNull ChildSessionConfiguration childConfig) { if (!isActiveNetwork(network)) { Log.d(TAG, "onOpened called for obsolete network " + network); return; } try { final String interfaceName = mTunnelIface.getInterfaceName(); final int maxMtu = mProfile.getMaxMtu(); final List<LinkAddresses> internalAddresses = childConfig.getInternalAddresses(); final Collection<RouteInfo> newRoutes = VpnIkev2Utils.getRoutesFromTrafficSelectors( childConfig.getOutboundTrafficSelectors()); for (final LinkAddress address : internalAddresses) { mTunnelIface.addAddress(address.getAddress(), address.getPrefixLength()); } final NetworkAgent networkAgent; final LinkProperties lp; synchronized (Vpn.this) { mInterface = interfaceName; mConfig.mtu = maxMtu; mConfig.interfaze = mInterface; mConfig.addresses.clear(); mConfig.addresses.addAll(internalAddresses); mConfig.routes.clear(); mConfig.routes.addAll(newRoutes); networkAgent = mNetworkAgent; if (networkAgent == null) { if (isSettingsVpnLocked()) { prepareStatusIntent(); } agentConnect(); return; } lp = makeLinkProperties(); } networkAgent.sendLinkProperties(lp); } catch (Exception e) { Log.d(TAG, "Error in ChildOpened for network " + network, e); onSessionLost(network); } }
Source:
private byte[] convertAvroToJson(String schema, byte[] bytes) { return new AvroToJsonConverter(new Schema.Parser().parse(schema)) .convert(avroMessageContentWrapper.unwrapContent(bytes).getContent()); }

Target:
private byte[] convertAvroToJson(String schema, byte[] bytes) { return new AvroToJsonConverter(avroMessageContentWrapper.getWrappedSchema(schema)).convert(bytes); }
Source:
public void addStock(Stock stock) throws StockMarketExpection { if (stock.getPrice() < 0.0) { throw new StockMarketExpection("Stock has a negative price (" + stock.getSymbol() + ", " + stock.getPrice() + ")"); } if (stockList.containsKey(stock.getSymbol())) { throw new StockMarketExpection( "Tried to enter a stock that is already present (" + stock.getSymbol() + ")"); } stockList.put(stock.getSymbol(), stock); marketHistory .startHistoryWithPrice(stock.getSymbol(), stock.getPrice()); }

Target:
public void addStock(Stock stock) throws StockMarketExpection { if(stock != null){ if (stock.getPrice() < 0.0) { throw new StockMarketExpection("Stock has a negative price (" + stock.getSymbol() + ", " + stock.getPrice() + ")"); } if (stockList.containsKey(stock.getSymbol())) { throw new StockMarketExpection( "Tried to enter a stock that is already present (" + stock.getSymbol() + ")"); } stockList.put(stock.getSymbol(), stock); marketHistory .startHistoryWithPrice(stock.getSymbol(), stock.getPrice()); } }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSubscriptions = new Disposable[2]; mRepository = (Repository) getArguments().getSerializable("repo"); mRef = getArguments().getString("ref"); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mRepository = (Repository) getArguments().getSerializable("repo"); mRef = getArguments().getString("ref"); }
Source:
public DruidDataSource( String name, Map<String, String> properties ) { this.name = name; this.properties = properties; this.idToSegmentMap = new HashMap<>(); this.segmentsHolder = new HashSet<>(); }

Target:
public DruidDataSource( String name, Map<String, String> properties ) { this.name = Preconditions.checkNotNull(name); this.properties = properties; this.idToSegmentMap = new ConcurrentHashMap<>(); }
Source:
public void run() { try { cloudBlockBlob.download(new NullOutputStream()); } catch (StorageException e) { throw new RuntimeException(e); } }

Target:
public void run() { try { cloudBlockBlob.download(DEV_NULL); } catch (StorageException e) { throw new RuntimeException(e); } }
Source:
protected void doGetText(HttpServletRequest req, HttpServletResponse res) throws IOException { GitilesView view = ViewFilter.getView(req); Repository repo = ServletUtils.getRepository(req); ObjectReader reader = repo.newObjectReader(); ObjectLoader loader = reader.open(view.getRevision().getId(), OBJ_COMMIT); if (loader.getType() != OBJ_COMMIT) { res.setStatus(SC_NOT_FOUND); } else { try (Writer writer = startRenderText(req, res); OutputStream out = BaseEncoding.base64().encodingStream(writer)) { loader.copyTo(out); } } }

Target:
protected void doGetText(HttpServletRequest req, HttpServletResponse res) throws IOException { GitilesView view = ViewFilter.getView(req); Repository repo = ServletUtils.getRepository(req); ObjectReader reader = repo.newObjectReader(); ObjectLoader loader = reader.open(view.getRevision().getId()); if (loader.getType() != OBJ_COMMIT) { res.setStatus(SC_NOT_FOUND); } else { try (Writer writer = startRenderText(req, res); OutputStream out = BaseEncoding.base64().encodingStream(writer)) { loader.copyTo(out); } } }
Source:
private void handleInfo(Packet packet) { Optional<XMPPContact> contact = contactsService.getContact(packet.getFrom()); if (!contact.isPresent()) return; InfoExchangeExtension versionInfo = InfoExchangeExtension.PROVIDER.getPayload(packet); if (versionInfo == null) { log.warn("contact: " + contact + ", VersionExchangeExtension packet is malformed"); return; } log.debug("received: " + versionInfo.getData()); remoteInfo.put(contact.get(), new ClientInfo(versionInfo.getData())); }

Target:
private void handleInfo(Packet packet) { Optional<XMPPContact> contact = contactsService.getContact(packet.getFrom()); if (!contact.isPresent()) return; InfoExchangeExtension info = InfoExchangeExtension.PROVIDER.getPayload(packet); if (info == null) { log.warn("contact: " + contact + ", InfoExchangeExtension packet is malformed"); return; } log.debug("received: " + info.getData()); remoteInfo.put(contact.get(), new ClientInfo(info.getData())); }
Source:
public boolean isBroadcastEnabled() { return preferences.getBoolean(context.getString(R.string.camping_enable), false); }

Target:
public boolean isBroadcastEnabled() { return preferences.getBoolean(context.getString(R.string.broadcast_enable), false); }