auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void verifyDeleteFailure(MockId idToDelete, StoreErrorCodes expectedErrorCode) throws StoreException { MessageInfo info = new MessageInfo(idToDelete, DELETE_RECORD_SIZE, idToDelete.getAccountId(), idToDelete.getContainerId(), System.currentTimeMillis()); MessageWriteSet writeSet = new MockMessageWriteSet(Collections.singletonList(info), Collections.singletonList(ByteBuffer.allocate(1))); if (store.getStoreConfig().storeDeleteAuthorizationCheck == true) { try { store.delete(writeSet); fail("Store DELETE should have failed"); } catch (StoreException e) { assertEquals("Unexpected StoreErrorCode", expectedErrorCode, e.getErrorCode()); } } }

Target:
private void verifyDeleteFailure(MockId idToDelete, StoreErrorCodes expectedErrorCode) { MessageInfo info = new MessageInfo(idToDelete, DELETE_RECORD_SIZE, idToDelete.getAccountId(), idToDelete.getContainerId(), System.currentTimeMillis()); MessageWriteSet writeSet = new MockMessageWriteSet(Collections.singletonList(info), Collections.singletonList(ByteBuffer.allocate(1))); try { store.delete(writeSet); fail("Store DELETE should have failed"); } catch (StoreException e) { assertEquals("Unexpected StoreErrorCode", expectedErrorCode, e.getErrorCode()); } }
Source:
public void check(final IProgressMonitor monitor) { if (null != monitor) { monitor.subTask("Validate 'plugin.xml' file for profile '" + elementTypesFile.getName() + "'."); } boolean foundExtension = false; final Iterator<IPluginExtension> extensions = ProjectManagementService.getPluginExtensions(project).iterator(); while (extensions.hasNext() && !foundExtension) { final IPluginExtension extension = extensions.next(); if (extension.getPoint().equals(ElementTypesPluginValidationConstants.ELEMENTTYPES_EXTENSION_POINT_IDENTIFIER)) { for (final IPluginObject pluginObject : extension.getChildren()) { if (pluginObject instanceof IPluginElement && pluginObject.getName().equals("elementTypeSet")) { for (final IPluginAttribute pluginAtttribute : ((IPluginElement) pluginObject).getAttributes()) { if (pluginAtttribute.getName().equals("path")) { final String locationValue = pluginAtttribute.getValue(); foundExtension = locationValue.endsWith(elementTypesFile.getName()); } } } } } } if (!foundExtension) { final IFile pluginXMLFile = ProjectManagementService.getPluginXMLFile(project); MarkersService.createMarker( pluginXMLFile, ElementTypesPluginValidationConstants.ELEMENTTYPES_PLUGIN_VALIDATION_TYPE, "The extension point '" + ElementTypesPluginValidationConstants.ELEMENTTYPES_EXTENSION_POINT_IDENTIFIER + "' should be created for profile '" + elementTypesFile.getName() + "'", IMarker.SEVERITY_ERROR); } if (null != monitor) { monitor.worked(1); } }

Target:
public void check(final IProgressMonitor monitor) { if (null != monitor) { monitor.subTask("Validate 'plugin.xml' file for profile '" + elementTypesFile.getName() + "'."); } boolean foundExtension = false; final Iterator<IPluginExtension> extensions = ProjectManagementService.getPluginExtensions(project).iterator(); while (extensions.hasNext() && !foundExtension) { final IPluginExtension extension = extensions.next(); if (ElementTypesPluginValidationConstants.ELEMENTTYPES_EXTENSION_POINT_IDENTIFIER.equals(extension.getPoint())) { for (final IPluginObject pluginObject : extension.getChildren()) { if (pluginObject instanceof IPluginElement && "elementTypeSet".equals(pluginObject.getName())) { for (final IPluginAttribute pluginAtttribute : ((IPluginElement) pluginObject).getAttributes()) { if ("path".equals(pluginAtttribute.getName())) { final String locationValue = pluginAtttribute.getValue(); foundExtension = locationValue.endsWith(elementTypesFile.getName()); } } } } } } if (!foundExtension) { final IFile pluginXMLFile = ProjectManagementService.getPluginXMLFile(project); MarkersService.createMarker( pluginXMLFile, ElementTypesPluginValidationConstants.ELEMENTTYPES_PLUGIN_VALIDATION_TYPE, "The extension point '" + ElementTypesPluginValidationConstants.ELEMENTTYPES_EXTENSION_POINT_IDENTIFIER + "' should be created for profile '" + elementTypesFile.getName() + "'", IMarker.SEVERITY_ERROR); } if (null != monitor) { monitor.worked(1); } }
Source:
public HashMap<ItemStack, ItemStack> getDustingList() { return dustingList; }

Target:
public HashMap<ItemStack, ItemStack> getDustingList() { return (HashMap<ItemStack, ItemStack>) dustingList.clone(); }
Source:
public void testDeleteFeedbackResponseCommentById() throws Exception { FeedbackResponseCommentAttributes frComment = restoreFrCommentFromDataBundle("comment1FromT1C1ToR1Q1S1C1"); frComment.setId(1L); frComment.feedbackQuestionId = getQuestionIdInDataBundle("qn2InSession1InCourse1"); frComment.feedbackResponseId = getResponseIdInDataBundle("response2ForQ2S1C1", "qn2InSession1InCourse1"); frcLogic.createFeedbackResponseComment(frComment); ______TS("silent fail nothing to delete"); frComment.feedbackResponseId = "invalid responseId"; frcLogic.deleteFeedbackResponseCommentById(frComment.getId()); FeedbackResponseCommentAttributes actualFrComment = frcLogic.getFeedbackResponseCommentForSession( frComment.courseId, frComment.feedbackSessionName).get(1); verifyPresentInDatastore(actualFrComment); ______TS("typical success case"); frcLogic.deleteFeedbackResponseCommentById(actualFrComment.getId()); verifyAbsentInDatastore(actualFrComment); ______TS("typical success case for response"); FeedbackResponseCommentAttributes anotherFrComment = restoreFrCommentFromDataBundle("comment1FromT1C1ToR1Q3S1C1"); verifyPresentInDatastore(anotherFrComment); frcLogic.deleteFeedbackResponseCommentsForResponse(anotherFrComment.feedbackResponseId); verifyAbsentInDatastore(anotherFrComment); }

Target:
public void testDeleteFeedbackResponseCommentById() throws Exception { ______TS("silent fail nothing to delete"); assertNull(frcLogic.getFeedbackResponseComment(1234567L)); frcLogic.deleteFeedbackResponseCommentById(1234567L); ______TS("typical success case"); FeedbackResponseCommentAttributes frComment = restoreFrCommentFromDataBundle("comment1FromT1C1ToR1Q1S1C1"); FeedbackResponseCommentAttributes actualFrComment = frcLogic.getFeedbackResponseCommentForSession( frComment.courseId, frComment.feedbackSessionName).get(1); frcLogic.deleteFeedbackResponseCommentById(actualFrComment.getId()); verifyAbsentInDatastore(actualFrComment); }
Source:
public boolean canOnlyUseSelf() { return fastEquip; }

Target:
public boolean canOnlyUseSelf() { return false; }
Source:
private static boolean failureCategoryMatches(String category, List<String> slackFailureCauseCategories) { for (int i = 0; i < slackFailureCauseCategories.size(); i++) { if (category.trim().equalsIgnoreCase(slackFailureCauseCategories.get(i).trim())) { return true; } } return false; }

Target:
private static boolean failureCategoryMatches(String category, List<String> slackFailureCauseCategories) { for (String slackCategory : slackFailureCauseCategories) { if (category.trim().equalsIgnoreCase(slackCategory.trim())) { return true; } } return false; }
Source:
public boolean isEmpty() { int e = isEmpty; if (e == 0) { int s = size; boolean any = s != 0 ? s > 1 : validIndices().findAny().isPresent(); e = any ? 1 : -1; this.isEmpty = e; } return e < 0; }

Target:
public boolean isEmpty() { int e = isEmpty; if (e == 0) { e = calculateIsEmpty(); } return e < 0; }
Source:
public static String jsonExtract(JsonValueContext input, String... pathSpecs) { try { DocumentContext ctx = JsonPath.parse(input.obj, Configuration .builder() .options(Option.SUPPRESS_EXCEPTIONS) .jsonProvider(JSON_PATH_JSON_PROVIDER) .mappingProvider(JSON_PATH_MAPPING_PROVIDER) .build()); List<Object> arrayList = new ArrayList<Object>(); Object value; for (String pathSpec : pathSpecs) { value = ctx.read(pathSpec); if ((pathSpec != null) && (value != null)) { arrayList.add(value); } } return arrayList.size() > 0 ? pathSpecs.length == 1 ? jsonize(arrayList.get(0)) : jsonize(arrayList) : null; } catch (Exception ex) { throw RESOURCE.invalidInputForJsonExtract( input.toString(), Arrays.toString(pathSpecs)).ex(); } }

Target:
public static String jsonExtract(JsonValueContext input, String... pathSpecs) { try { DocumentContext ctx = JsonPath.parse(input.obj, Configuration .builder() .options(Option.SUPPRESS_EXCEPTIONS) .jsonProvider(JSON_PATH_JSON_PROVIDER) .mappingProvider(JSON_PATH_MAPPING_PROVIDER) .build()); List<Object> arrayList = new ArrayList<Object>(); Object value; for (String pathSpec : pathSpecs) { value = ctx.read(pathSpec); if (pathSpec != null && value != null) { arrayList.add(value); } } return arrayList.size() > 0 ? pathSpecs.length == 1 ? jsonize(arrayList.get(0)) : jsonize(arrayList) : null; } catch (Exception ex) { throw RESOURCE.invalidInputForJsonExtract( input.toString(), Arrays.toString(pathSpecs)).ex(); } }
Source:
public double getValue(Object entity) { switch (op) { case "+": return left.getValue(entity) + right.getValue(entity); case "-": return left.getValue(entity) - right.getValue(entity); case "*": return left.getValue(entity) * right.getValue(entity); case "/": return left.getValue(entity) / right.getValue(entity); case "%": return left.getValue(entity) % right.getValue(entity); case "=": return asDouble(left.getValue(entity) == right.getValue(entity)); case ">": return asDouble(left.getValue(entity) > right.getValue(entity)); case "<": return asDouble(left.getValue(entity) < right.getValue(entity)); case "<=": return asDouble(left.getValue(entity) <= right.getValue(entity)); case ">=": return asDouble(left.getValue(entity) >= right.getValue(entity)); case "!=": return asDouble(left.getValue(entity) != right.getValue(entity)); default: throw new IllegalArgumentException("Unknown operator: " + op); } }

Target:
public double getValue(Object entity) { switch (op) { case "and": return asDouble(isTrue(left.getValue(entity)) && isTrue(right.getValue(entity))); case "or": return asDouble(isTrue(left.getValue(entity)) || isTrue(right.getValue(entity))); case "+": return left.getValue(entity) + right.getValue(entity); case "-": return left.getValue(entity) - right.getValue(entity); case "*": return left.getValue(entity) * right.getValue(entity); case "/": return left.getValue(entity) / right.getValue(entity); case "%": return left.getValue(entity) % right.getValue(entity); case "=": return asDouble(left.getValue(entity) == right.getValue(entity)); case ">": return asDouble(left.getValue(entity) > right.getValue(entity)); case "<": return asDouble(left.getValue(entity) < right.getValue(entity)); case "<=": return asDouble(left.getValue(entity) <= right.getValue(entity)); case ">=": return asDouble(left.getValue(entity) >= right.getValue(entity)); case "!=": return asDouble(left.getValue(entity) != right.getValue(entity)); case "&": return (long) left.getValue(entity) & (long) right.getValue(entity); case "|": return (long) left.getValue(entity) | (long) right.getValue(entity); case "^": return (long) left.getValue(entity) ^ (long) right.getValue(entity); case ">>": return (long) left.getValue(entity) >> (long) right.getValue(entity); case ">>>": return (long) left.getValue(entity) >>> (long) right.getValue(entity); case "<<": case "<<<": return (long) left.getValue(entity) << (long) right.getValue(entity); default: throw new IllegalArgumentException("Unknown operator: " + op); } }
Source:
private Flux<Instant> renewMessageLock(UUID[] renewLockList) { return isAuthorized(PEEK_OPERATION_VALUE).thenMany(createRequestResponse.flatMap(channel -> { UUID[] lockTokens = Arrays.stream(renewLockList) .toArray(UUID[]::new); Message requestMessage = createManagementMessage(REQUEST_RESPONSE_RENEWLOCK_OPERATION, channel.getReceiveLinkName()); requestMessage.setBody(new AmqpValue(Collections.singletonMap(REQUEST_RESPONSE_LOCKTOKENS, lockTokens))); return channel.sendWithAck(requestMessage); }).flatMapMany(responseMessage -> { int statusCode = RequestResponseUtils.getResponseStatusCode(responseMessage); List<Instant> expirationsForLocks = new ArrayList<>(); if (statusCode == REQUEST_RESPONSE_OK_STATUS_CODE) { @SuppressWarnings("unchecked") Map<String, Object> responseBody = (Map<String, Object>) ((AmqpValue) responseMessage .getBody()).getValue(); Object expirationListObj = responseBody.get(REQUEST_RESPONSE_EXPIRATIONS); if (expirationListObj instanceof Date[]) { Date[] expirations = (Date[]) expirationListObj; expirationsForLocks = Arrays.stream(expirations) .map(Date::toInstant) .collect(Collectors.toList()); } } return Flux.fromIterable(expirationsForLocks); })); }

Target:
private Flux<Instant> renewMessageLock(UUID[] renewLockList) { return isAuthorized(PEEK_OPERATION_VALUE).thenMany(createRequestResponse.flatMap(channel -> { Message requestMessage = createManagementMessage(RENEW_LOCK_OPERATION, channel.getReceiveLinkName()); requestMessage.setBody(new AmqpValue(Collections.singletonMap(LOCK_TOKENS, renewLockList))); return channel.sendWithAck(requestMessage); }).flatMapMany(responseMessage -> { int statusCode = RequestResponseUtils.getResponseStatusCode(responseMessage); if (statusCode != AmqpResponseCode.OK.getValue()) { return Mono.error(ExceptionUtil.amqpResponseCodeToException(statusCode, "Could not renew the lock.", getErrorContext())); } return Flux.fromIterable(messageSerializer.deserializeList(responseMessage, Instant.class)); })); }
Source:
public void setUnits(String xunit, String yunit) { xunits = xunit; yunits = yunit; plotPreferences.setXlabel(xunit); plotPreferences.setYlabel(yunit); refresh(); }

Target:
public void setUnits(String xunit, String yunit) { xunits = xunit; yunits = yunit; plotPreferences.setXlabel(xunit); plotPreferences.setYlabel(yunit); for (SegmentLayer seg : segmentPreferences.values()) { try { seg.setXUnits(xunits); seg.setYUnits(yunits); } catch (UnitsException ex) { Logger.getLogger(SedPreferences.class.getName()) .log(Level.SEVERE, null, ex); } } flipYifMag(yunit); }
Source:
public static org.kframework.definition.Definition from(String definitionText) throws IOException { Pattern pattern = Pattern.compile("module ([A-Z_]*)"); Matcher m = pattern.matcher(definitionText); if(!m.find()) { throw new RuntimeException("Could not find any module in the definition"); } String nameOfLastModule = m.group(m.groupCount()); return from(definitionText, nameOfLastModule, Source.apply("generated")); }

Target:
public static org.kframework.definition.Definition from(String definitionText) { Pattern pattern = Pattern.compile("(?:^|\\s)module ([A-Z][A-Z\\-]*)"); Matcher m = pattern.matcher(definitionText); if(!m.find()) { throw new RuntimeException("Could not find any module in the definition"); } String nameOfLastModule = m.group(m.groupCount()); return from(definitionText, nameOfLastModule, Source.apply("generated")); }
Source:
public boolean hasNext() { return replicaIterator.hasNext() && (inflightCount < parallelism || ( inflightCount < routerConfig.routerAdaptiveTrackerMaxInflightRequests && isOldestRequestPastDue())); }

Target:
public boolean hasNext() { if (replicaIterator.hasNext()) { if (inflightCount < parallelism) { return true; } if (inflightCount < routerConfig.routerOperationTrackerMaxInflightRequests && isOldestRequestPastDue()) { return true; } } return false; }
Source:
public CallStatus run() { RequestMetrics.Context metricCtx = metrics.startBulkRequest(); LOGGER.debug("bulk request"); Error.reset(); Error.push("rest"); Error.push(getClass().getSimpleName()); try { BulkRequest req; try { req = getJsonTranslator().parse(BulkRequest.class, JsonUtils.json(request)); } catch (Exception e) { metricCtx.markRequestException(e, e.getMessage()); LOGGER.error("bulk:parse failure: {}", e); return new CallStatus(Error.get(RestCrudConstants.ERR_REST_ERROR, "Error parsing request")); } try { for (Request r : req.getEntries()) { validateReq(r, r.getEntityVersion().getEntity(), r.getEntityVersion().getVersion()); addCallerId(r); } } catch (Exception e) { metricCtx.markRequestException(e, e.getMessage()); LOGGER.error("bulk:validate failure: {}", e); return new CallStatus(Error.get(RestCrudConstants.ERR_REST_ERROR, "Request is not valid")); } BulkResponse r = getMediator().bulkRequest(req, metrics); return new CallStatus(r); } catch (Error e) { metricCtx.markRequestException(e, e.getErrorCode()); LOGGER.error("bulk:generic_error failure: {}", e); return new CallStatus(e); } catch (Exception e) { metricCtx.markRequestException(e, e.getMessage()); LOGGER.error("bulk:generic_exception failure: {}", e); return new CallStatus(Error.get(RestCrudConstants.ERR_REST_ERROR, e.toString())); } finally { metricCtx.endRequestMonitoring(); } }

Target:
public CallStatus run() { RequestMetrics.Context metricCtx = metrics.startBulkRequest(); LOGGER.debug("bulk request"); Error.reset(); Error.push("rest"); Error.push(getClass().getSimpleName()); try { BulkRequest req; try { req = getJsonTranslator().parse(BulkRequest.class, JsonUtils.json(request)); } catch (Exception e) { Error error = Error.get(RestCrudConstants.ERR_REST_ERROR, "Error parsing request"); metricCtx.markRequestException(error); LOGGER.error("bulk:parse failure: {}", e); return new CallStatus(error); } try { for (Request r : req.getEntries()) { validateReq(r, r.getEntityVersion().getEntity(), r.getEntityVersion().getVersion()); addCallerId(r); } } catch (Exception e) { Error error = Error.get(RestCrudConstants.ERR_REST_ERROR, "Request is not valid"); metricCtx.markRequestException(error); LOGGER.error("bulk:validate failure: {}", e); return new CallStatus(error); } BulkResponse r = getMediator().bulkRequest(req, metrics); return new CallStatus(r); } catch (Error e) { metricCtx.markRequestException(e); LOGGER.error("bulk:generic_error failure: {}", e); return new CallStatus(e); } catch (Exception e) { Error error = Error.get(RestCrudConstants.ERR_REST_ERROR, e.toString()); metricCtx.markRequestException(error); LOGGER.error("bulk:generic_exception failure: {}", e); return new CallStatus(error); } finally { metricCtx.endRequestMonitoring(); } }
Source:
public void testConvertMultInstanceSubprocessNode_SlaDueDate() { final String SLA_DUE_DATE = "12/25/1983"; SubProcess subProcess = bpmn2.createSubProcess(); MultiInstanceLoopCharacteristics loopCharacteristics = bpmn2.createMultiInstanceLoopCharacteristics(); subProcess.setLoopCharacteristics(loopCharacteristics); subProcess.setId(UUID.randomUUID().toString()); CustomElement.slaDueDate.setValue(subProcess, SLA_DUE_DATE); Result<BpmnNode> result = tested.convertSubProcess(subProcess); BpmnNode node = result.value(); MultipleInstanceSubprocess miSubProcces = (MultipleInstanceSubprocess) node.value().getContent().getDefinition(); assertNotNull(miSubProcces); assertNotNull(miSubProcces.getExecutionSet()); MultipleInstanceSubprocessTaskExecutionSet executionSet = miSubProcces.getExecutionSet(); SLADueDate slaDueDate = executionSet.getSlaDueDate(); assertNotNull(slaDueDate); assertTrue(slaDueDate.getValue().contains(SLA_DUE_DATE)); }

Target:
public void testConvertMultInstanceSubprocessNode_SlaDueDate() { SubProcess subProcess = bpmn2.createSubProcess(); subProcess.setLoopCharacteristics(bpmn2.createMultiInstanceLoopCharacteristics()); CustomElement.slaDueDate.setValue(subProcess, SLA_DUE_DATE); Result<BpmnNode> result = tested.convertSubProcess(subProcess); BpmnNode node = result.value(); MultipleInstanceSubprocess miSubProcess = (MultipleInstanceSubprocess) node.value().getContent().getDefinition(); assertNotNull(miSubProcess); assertBaseSubprocessExecutionSet(miSubProcess.getExecutionSet()); }
Source:
public void contextChange(MetricsContext metricsContext) { Objects.requireNonNull(metricsContext.metadata().get(MetricsContext.NAMESPACE)); synchronized (LOCK) { if (!mbeans.isEmpty()) { throw new IllegalStateException("JMX MetricsContext can only be updated before JMX metrics are created"); } prefix = metricsContext.metadata().get(MetricsContext.NAMESPACE); } }

Target:
public void contextChange(MetricsContext metricsContext) { String namespace = metricsContext.contextLabels().get(MetricsContext.NAMESPACE); Objects.requireNonNull(namespace); synchronized (LOCK) { if (!mbeans.isEmpty()) { throw new IllegalStateException("JMX MetricsContext can only be updated before JMX metrics are created"); } prefix = namespace; } }
Source:
private boolean ensureDestinationImageMap() { if (diskInfoDestinationMap.isEmpty()) { if (getParameters().getStorageDomainId() != null && !Guid.Empty.equals(getParameters().getStorageDomainId())) { Guid storageId = getParameters().getStorageDomainId(); for (DiskImage image : getVmTemplate().getDiskMap().values()) { diskInfoDestinationMap.put(image.getId(), ImagesHandler.getDiskImageWithStorageId(storageId, image.getQuotaId())); } } else { ImagesHandler.fillImagesMapBasedOnTemplate(getVmTemplate(), diskInfoDestinationMap, destStorages); } } if (getVmTemplate().getDiskMap().values().size() != diskInfoDestinationMap.size()) { log.errorFormat("Can not found any default active domain for one of the disks of template with id : {0}", getVmTemplate().getId()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_MISSED_STORAGES_FOR_SOME_DISKS); return false; } return true; }

Target:
private boolean ensureDestinationImageMap() { if (diskInfoDestinationMap.isEmpty()) { if (getParameters().getStorageDomainId() != null && !Guid.Empty.equals(getParameters().getStorageDomainId())) { Guid storageId = getParameters().getStorageDomainId(); ArrayList<Guid> storageIds = new ArrayList<Guid>(); storageIds.add(storageId); for (DiskImage image : getVmTemplate().getDiskMap().values()) { image.setstorage_ids(storageIds); diskInfoDestinationMap.put(image.getId(), image); } } else { ImagesHandler.fillImagesMapBasedOnTemplate(getVmTemplate(), diskInfoDestinationMap, destStorages); } } if (getVmTemplate().getDiskMap().values().size() != diskInfoDestinationMap.size()) { log.errorFormat("Can not found any default active domain for one of the disks of template with id : {0}", getVmTemplate().getId()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_MISSED_STORAGES_FOR_SOME_DISKS); return false; } return true; }
Source:
private void checkStatements(VariableDeclarationTree variableDeclaration, StatementTree lastStatement) { SeparatedList<BindingElementTree> variables = variableDeclaration.variables(); if (variables.size() == 1 && variables.get(0).is(Kind.INITIALIZED_BINDING_ELEMENT)) { InitializedBindingElementTree initializedBindingElementTree = (InitializedBindingElementTree) variables.get(0); if (initializedBindingElementTree.left().is(Kind.BINDING_IDENTIFIER)) { String name = ((IdentifierTree) initializedBindingElementTree.left()).name(); if (lastStatementReturnsVariable(lastStatement, name)) { addIssue(initializedBindingElementTree.right(), String.format(MESSAGE, "return", name)); } else if (lastStatementThrowsVariable(lastStatement, name)) { addIssue(initializedBindingElementTree.right(), String.format(MESSAGE, "throw", name)); } } } }

Target:
private void checkStatements(VariableDeclarationTree variableDeclaration, StatementTree lastStatement) { SeparatedList<BindingElementTree> variables = variableDeclaration.variables(); if (variables.size() == 1 && variables.get(0).is(Kind.INITIALIZED_BINDING_ELEMENT)) { InitializedBindingElementTree initializedBindingElementTree = (InitializedBindingElementTree) variables.get(0); if (initializedBindingElementTree.left().is(Kind.BINDING_IDENTIFIER)) { String name = ((IdentifierTree) initializedBindingElementTree.left()).name(); if (returnsVariableInLastStatement(lastStatement, name)) { addIssue(initializedBindingElementTree.right(), String.format(MESSAGE, "return", name)); } else if (throwsVariableInLastStatement(lastStatement, name)) { addIssue(initializedBindingElementTree.right(), String.format(MESSAGE, "throw", name)); } } } }
Source:
protected IStatus run(IProgressMonitor monitor) { Set<IProject> toProcessNow = new HashSet<IProject>(); while (!monitor.isCanceled()) { synchronized (this.toProcess) { if (this.toProcess.isEmpty()) { CumulativeMappingDiscoveryJob.getInstance().schedule(); return Status.OK_STATUS; } else { for (IProject project : this.toProcess) { toProcessNow.add(project); } this.toProcess.removeAll(toProcessNow); } } if (!toProcessNow.isEmpty()) { CumulativeMappingDiscoveryJob.getInstance().addProjects(toProcessNow); ProjectConfigurationManager configurationManager = (ProjectConfigurationManager) MavenPlugin .getProjectConfigurationManager(); MavenUpdateRequest request = new MavenUpdateRequest( toProcessNow.toArray(new IProject[toProcessNow.size()]), false, false); Map<String, IStatus> updateStatus = configurationManager.updateProjectConfiguration(request, true, false, false, monitor); } } return new Status(IStatus.CANCEL, Activator.getDefault().getBundle().getSymbolicName(), "Cancelled by user"); }

Target:
protected IStatus run(IProgressMonitor monitor) { Set<IProject> toProcessNow = new HashSet<IProject>(); while (!monitor.isCanceled()) { synchronized (this.toProcess) { if (this.toProcess.isEmpty()) { CumulativeMappingDiscoveryJob.getInstance().schedule(); return Status.OK_STATUS; } else { toProcessNow.addAll(this.toProcess); this.toProcess.removeAll(toProcessNow); } } if (!toProcessNow.isEmpty()) { CumulativeMappingDiscoveryJob.getInstance().addProjects(toProcessNow); ProjectConfigurationManager configurationManager = (ProjectConfigurationManager) MavenPlugin .getProjectConfigurationManager(); MavenUpdateRequest request = new MavenUpdateRequest( toProcessNow.toArray(new IProject[toProcessNow.size()]), false, false); Map<String, IStatus> updateStatus = configurationManager.updateProjectConfiguration(request, true, false, false, monitor); } } return new Status(IStatus.CANCEL, Activator.getDefault().getBundle().getSymbolicName(), "Cancelled by user"); }
Source:
private void initNetworkList(Guid dataCenterId) { if ((getNetwork().getItems() == null && getNetwork().getSelectedItem() == null) || getNetwork().getIsChangable()) { startProgress(); IdQueryParameters queryParams = new IdQueryParameters(dataCenterId); Frontend.getInstance().runQuery(QueryType.GetAllNetworks, queryParams, new AsyncQuery<QueryReturnValue>(returnValue -> { Collection<Network> networks = returnValue.getReturnValue(); getNetwork().setItems(networks); updateNetworks(networks); stopProgress(); })); } }

Target:
private void initNetworkList(Guid dataCenterId) { startProgress(); IdQueryParameters queryParams = new IdQueryParameters(dataCenterId); Frontend.getInstance().runQuery(QueryType.GetAllNetworks, queryParams, new AsyncQuery<QueryReturnValue>(returnValue -> { Collection<Network> networks = returnValue.getReturnValue(); getNetwork().setItems(networks); updateNetworks(networks); stopProgress(); })); }
Source:
public Collection<Object> handleMessage(IncomingMessageEnvelope ime, MessageCollector collector, TaskCoordinator coordinator) { Object tmpMessage, message = null; InputTransformer transformer = inputOpSpec.getTransformer(); if (transformer != null) { tmpMessage = transformer.apply(ime); if (tmpMessage instanceof KV && ime.getTimestamp() > 0L) { Object kvValue = ((KV) tmpMessage).getValue(); if (kvValue != null && kvValue instanceof IndexedRecord) { IndexedRecord retRec = checkAndAddField((IndexedRecord) kvValue, "eventTime", Instant.ofEpochMilli(ime.getTimestamp()).toString()); retRec = checkAndAddField(retRec, "arrivalTime", Instant.now().toString()); message = new KV<>(((KV) tmpMessage).getKey(), retRec); } } else { message = tmpMessage; } } else { message = this.inputOpSpec.isKeyed() ? KV.of(ime.getKey(), ime.getMessage()) : ime.getMessage(); } if (message != null) { return Collections.singletonList(message); } return Collections.emptyList(); }

Target:
public Collection<Object> handleMessage(IncomingMessageEnvelope ime, MessageCollector collector, TaskCoordinator coordinator) { Object message; InputTransformer transformer = inputOpSpec.getTransformer(); if (transformer != null) { message = transformer.apply(ime); } else { message = this.inputOpSpec.isKeyed() ? KV.of(ime.getKey(), ime.getMessage()) : ime.getMessage(); } if (message != null) { return Collections.singletonList(message); } return Collections.emptyList(); }
Source:
private void sendWithdrawEmail(Study study, String externalId, Account account, Withdrawal withdrawal, long withdrewOn) { if (account.getEmail() == null) { return; } Boolean consentNotificationEmailVerified = study.isConsentNotificationEmailVerified(); if (consentNotificationEmailVerified != null && !consentNotificationEmailVerified) { return; } MimeTypeEmailProvider consentEmail = new WithdrawConsentEmailProvider(study, externalId, account, withdrawal, withdrewOn); sendMailService.sendEmail(consentEmail); }

Target:
private void sendWithdrawEmail(Study study, String externalId, Account account, Withdrawal withdrawal, long withdrewOn) { if (account.getEmail() == null) { return; } if (study.isConsentNotificationEmailVerified() == Boolean.FALSE) { return; } MimeTypeEmailProvider consentEmail = new WithdrawConsentEmailProvider(study, externalId, account, withdrawal, withdrewOn); sendMailService.sendEmail(consentEmail); }
Source:
public String tIpv6address() { int startIdx = ptr; try { while (hasMoreChars()) { char nextChar = lookAhead(0); if ( isIPV6addressChar(nextChar) ) { consume(1); } else { break; } } return String.valueOf(buffer, startIdx, ptr - startIdx); } catch (ParseException ex) { return null; } }

Target:
public String tIpv6address() { try { String hostName = String.valueOf(buffer, ptr, buffer.length - ptr ); HostNameParser hnp = new HostNameParser(hostName); HostPort hp = hnp.hostPort(true); int length = hp.getHost().hostname.length(); consume(length); return hp.getHost().hostname; } catch (ParseException ex) { return null; } }
Source:
private boolean restoreInitialState() { Guid statelessVmSnapshotId = getVmSnapshotIdForType(SnapshotType.STATELESS); if (statelessVmSnapshotId == null) { return true; } List<DiskImage> statelessDiskSnapshots = getDiskSnapshotsForVmSnapshot(statelessVmSnapshotId); Guid activeVmSnapshotId = getVmSnapshotIdForType(SnapshotType.ACTIVE); List<DiskImage> activeDiskSnapshots = getDiskSnapshotsForVmSnapshot(activeVmSnapshotId); Set<Guid> disksWithStatelessSnapshot = new HashSet<>(); for (DiskImage statelessDiskSnapshot : statelessDiskSnapshots) { disksWithStatelessSnapshot.add(statelessDiskSnapshot.getId()); } for (DiskImage activeDiskSnapshot : activeDiskSnapshots) { if (!disksWithStatelessSnapshot.contains(activeDiskSnapshot.getId())) { VdcReturnValueBase returnValue = runInternalAction ( VdcActionType.DetachDiskFromVm, new AttachDetachVmDiskParameters( getVmId(), activeDiskSnapshot.getId(), false, false)); if (!returnValue.getSucceeded()) { return false; } } } if (!statelessDiskSnapshots.isEmpty()) { return runInternalActionWithTasksContext(VdcActionType.RestoreAllSnapshots, buildRestoreAllSnapshotsParameters(statelessDiskSnapshots), getLock()).getSucceeded(); } return true; }

Target:
private boolean restoreInitialState() { Guid statelessVmSnapshotId = getVmSnapshotIdForType(SnapshotType.STATELESS); if (statelessVmSnapshotId == null) { return true; } List<DiskImage> statelessDiskSnapshots = getDiskSnapshotsForVmSnapshot(statelessVmSnapshotId); Guid activeVmSnapshotId = getVmSnapshotIdForType(SnapshotType.ACTIVE); List<DiskImage> activeDiskSnapshots = getDiskSnapshotsForVmSnapshot(activeVmSnapshotId); List<Guid> disksWithStatelessSnapshot = Entities.getIds(statelessDiskSnapshots); for (DiskImage activeDiskSnapshot : activeDiskSnapshots) { if (!disksWithStatelessSnapshot.contains(activeDiskSnapshot.getId())) { VdcReturnValueBase returnValue = runInternalAction ( VdcActionType.DetachDiskFromVm, new AttachDetachVmDiskParameters( getVmId(), activeDiskSnapshot.getId(), false, false)); if (!returnValue.getSucceeded()) { log.error("Could not restore stateless VM due to a failure to detach Disk {}", getVmId(), activeDiskSnapshot.getId()); return false; } } } if (!statelessDiskSnapshots.isEmpty()) { return runInternalActionWithTasksContext(VdcActionType.RestoreAllSnapshots, buildRestoreAllSnapshotsParameters(statelessDiskSnapshots), getLock()).getSucceeded(); } return true; }
Source:
public void testGetAllForStorageDomainWithPermissionsForUnpriviligedUser() { List<VmTemplate> result = dao.getAllForStorageDomain(STORAGE_DOMAIN_ID, UNPRIVILEGED_USER_ID, true); assertNotNull(result); assertTrue(result.size() == 0); }

Target:
public void testGetAllForStorageDomainWithPermissionsForUnpriviligedUser() { List<VmTemplate> result = dao.getAllForStorageDomain(STORAGE_DOMAIN_ID, UNPRIVILEGED_USER_ID, true); assertNotNull(result); assertTrue(result.isEmpty()); }
Source:
SetQuotaCommand(String[] args, int pos, Configuration conf) { super(conf); CommandFormat c = new CommandFormat(2, Integer.MAX_VALUE); List<String> parameters = c.parse(args, pos); String str = parameters.get(0).trim(); try { this.quota = StringUtils.TraditionalBinaryPrefix .string2long(parameters.remove(0)); } catch(NumberFormatException e){ throw new IllegalArgumentException("\"" + str + "\" is not a valid value for a quota."); } if (HdfsConstants.QUOTA_DONT_SET == this.quota) { System.out.print("WARN: \"" + this.quota + "\" means QUOTA_DONT_SET, quota will not be set, " + "it keep the old values. \n"); } this.args = parameters.toArray(new String[parameters.size()]); }

Target:
SetQuotaCommand(String[] args, int pos, Configuration conf) { super(conf); CommandFormat c = new CommandFormat(2, Integer.MAX_VALUE); List<String> parameters = c.parse(args, pos); String str = parameters.get(0).trim(); try { this.quota = StringUtils.TraditionalBinaryPrefix .string2long(parameters.remove(0)); } catch(NumberFormatException e){ throw new IllegalArgumentException("\"" + str + "\" is not a valid value for a quota."); } if (HdfsConstants.QUOTA_DONT_SET == this.quota) { throw new IllegalArgumentException("WARN: \"" + this.quota + "\" means QUOTA_DONT_SET, quota will not be set, " + "it keep the old values."); } this.args = parameters.toArray(new String[parameters.size()]); }
Source:
public void shouldCapture() throws Exception { when(response.getStatus()).thenReturn(HttpStatus.SC_OK); Either<GatewayError, GatewayClient.Response> stupidEitherThing = right(new TestResponse(response)); when(client.postRequestFor(anyString(), any(GatewayAccountEntity.class), any(GatewayOrder.class))).thenReturn(stupidEitherThing); Either<GatewayError, EpdqCaptureResponse> stupidEitherThing2 = right(XMLUnmarshaller.unmarshall(load(EPDQ_CAPTURE_SUCCESS_RESPONSE), EpdqCaptureResponse.class)); when(client.unmarshallResponse(any(TestResponse.class), any(Class.class))).thenReturn(stupidEitherThing2); GatewayResponse<BaseCaptureResponse> response = epdqCaptureHandler.capture(buildTestCaptureRequest()); assertTrue(response.isSuccessful()); assertThat(response.getBaseResponse().get().getTransactionId(), is("3014644340")); }

Target:
public void shouldCapture() throws Exception { when(response.getStatus()).thenReturn(HttpStatus.SC_OK); Either<GatewayError, GatewayClient.Response> response = right(new TestResponse(this.response)); when(client.postRequestFor(anyString(), any(GatewayAccountEntity.class), any(GatewayOrder.class))).thenReturn(response); Either<GatewayError, EpdqCaptureResponse> unmarshalledResponse = right(XMLUnmarshaller.unmarshall(load(EPDQ_CAPTURE_SUCCESS_RESPONSE), EpdqCaptureResponse.class)); when(client.unmarshallResponse(any(TestResponse.class), any(Class.class))).thenReturn(unmarshalledResponse); GatewayResponse<BaseCaptureResponse> gatewayResponse = epdqCaptureHandler.capture(buildTestCaptureRequest()); assertTrue(gatewayResponse.isSuccessful()); assertThat(gatewayResponse.getBaseResponse().get().getTransactionId(), is("3014644340")); }
Source:
public static void run(Runnable runnable) { try { MessagingFactory.INTERNAL_THREAD_POOL.submit(runnable); } catch (RejectedExecutionException | NullPointerException e) { e.printStackTrace(); } }

Target:
public static void run(Runnable runnable) { MessagingFactory.INTERNAL_THREAD_POOL.submit(runnable); }
Source:
public void onReceive(Context context, final Intent intent) { ContextManager.setContext(context); DependencyInjectionService.getInstance().inject(this); if (intent.getAction().equals("com.google.android.c2dm.intent.REGISTRATION")) { handleRegistration(intent); } else if (intent.getAction().equals("com.google.android.c2dm.intent.RECEIVE")) { new Thread(new Runnable() { @Override public void run() { if(intent.hasExtra("web_update")) if (DateUtilities.now() - actFmPreferenceService.getLastSyncDate() > FULL_SYNC_TIME_INTERVAL) new ActFmSyncProvider().synchronize(ContextManager.getContext()); else handleWebUpdate(intent); else handleMessage(intent); } }).start(); } }

Target:
public void onReceive(Context context, final Intent intent) { ContextManager.setContext(context); DependencyInjectionService.getInstance().inject(this); if (intent.getAction().equals("com.google.android.c2dm.intent.REGISTRATION")) { handleRegistration(intent); } else if (intent.getAction().equals("com.google.android.c2dm.intent.RECEIVE")) { new Thread(new Runnable() { @Override public void run() { if(intent.hasExtra("web_update")) if (DateUtilities.now() - actFmPreferenceService.getLastSyncDate() > MIN_MILLIS_BETWEEN_FULL_SYNCS) new ActFmSyncProvider().synchronize(ContextManager.getContext()); else handleWebUpdate(intent); else handleMessage(intent); } }).start(); } }
Source:
private void startServer(DataNodeId dataNodeId, String sslEnabledDatacenters) throws IOException, InstantiationException { Properties props = new Properties(); props.setProperty("host.name", dataNodeId.getHostname()); props.setProperty("port", Integer.toString(dataNodeId.getPort())); props.setProperty("store.data.flush.interval.seconds", "1"); props.setProperty("store.deleted.message.retention.days", "0"); props.setProperty("store.enable.hard.delete", "true"); props.setProperty("replication.token.flush.interval.seconds", "5"); props.setProperty("replication.wait.time.between.replicas.ms", "50"); props.setProperty("replication.validate.message.stream", "true"); props.setProperty("replication.ssl.enabled.datacenters", sslEnabledDatacenters == null ? "" : sslEnabledDatacenters); VerifiableProperties propverify = new VerifiableProperties(props); AmbryServer server = new AmbryServer(propverify, clusterMap, notificationSystem); try { server.startup(); } catch (InstantiationException e) { server.shutdown(); throw e; } serverList.add(server); }

Target:
private void startServer(DataNodeId dataNodeId, String sslEnabledDatacenters) throws IOException, InstantiationException { Properties props = new Properties(); props.setProperty("host.name", dataNodeId.getHostname()); props.setProperty("port", Integer.toString(dataNodeId.getPort())); props.setProperty("store.data.flush.interval.seconds", "1"); props.setProperty("store.deleted.message.retention.days", "0"); props.setProperty("store.enable.hard.delete", "true"); props.setProperty("replication.token.flush.interval.seconds", "5"); props.setProperty("replication.wait.time.between.replicas.ms", "50"); props.setProperty("replication.validate.message.stream", "true"); props.setProperty("replication.ssl.enabled.datacenters", sslEnabledDatacenters); VerifiableProperties propverify = new VerifiableProperties(props); AmbryServer server = new AmbryServer(propverify, clusterMap, notificationSystem); serverList.add(server); server.startup(); }
Source:
public static ExportEvent progress(FormDefinition form, double percentage) { int base100Percentage = new Double(percentage * 100).intValue(); String statusLine = String.format("Exported %s%% of the submissions", base100Percentage); return new ExportEvent(form.getFormId(), statusLine); }

Target:
public static ExportEvent progress(FormDefinition form, double percentage) { int base100Percentage = new Double(percentage * 100).intValue(); String statusLine = String.format("Exported %s%% of the submissions", base100Percentage); return new ExportEvent(form.getFormId(), statusLine, false); }
Source:
public static void main(String[] args) throws Exception { CommandLineTools.runUpgradeCheck(args); if (args.length == 0) { process("<stdin>", new BufferedReader( new InputStreamReader(System.in, Constants.ENCODING))); } else { validate(args); } }

Target:
public static void main(String[] args) throws Exception { CommandLineTools.runUpgradeCheck(args); boolean result = true; if (args.length == 0) { result = validate(new BufferedReader( new InputStreamReader(System.in, Constants.ENCODING)), "<stdin>"); } else { boolean[] results = validate(args); int count = 0; for (int i = 0; i < results.length; i++) { if (results[i]) { count++; } } result = (count == results.length); } if (result) { System.exit(0); } else { System.exit(1); } }
Source:
public void dispose() { nodeMap.clear(); edgeMap.clear(); }

Target:
public void dispose() { nodeMap.clear(); edgeMap.clear(); reverseEdgeMap.clear(); }
Source:
public void setArgsType(String argsType) { try { setArgsType(ArgsTypeOption.valueOf(argsType.toUpperCase(Locale.ROOT))); } catch (IllegalArgumentException e) { LOG.error('"' + argsType + "\" is not a valid Arguments Specification Type."); throw e; } }

Target:
public void setArgsType(String argsType) throws ApiException { try { setArgsType(ArgsTypeOption.valueOf(argsType.toUpperCase(Locale.ROOT))); } catch (IllegalArgumentException e) { LOG.debug('"' + argsType + "\" is not a valid Arguments Specification Type."); throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER, e.getMessage()); } }
Source:
public Optional<OTAHistory> insertOTAEvent(final OTAHistory historyEntry) { final Map<String, AttributeValue> item = new HashMap<>(); item.put(DEVICE_ID_ATTRIBUTE_NAME, new AttributeValue().withS(historyEntry.device_id)); item.put(EVENT_TIME_ATTRIBUTE_NAME, new AttributeValue().withS(historyEntry.event_time)); item.put(CURRENT_FW_VERSION_ATTRIBUTE_NAME, new AttributeValue().withN(historyEntry.current_fw_version.toString())); item.put(NEW_FW_VERSION_ATTRIBUTE_NAME, new AttributeValue().withN(historyEntry.new_fw_version.toString())); item.put(FILE_LIST_ATTRIBUTE_NAME, new AttributeValue().withSS(historyEntry.file_list)); final PutItemRequest putItemRequest = new PutItemRequest(this.tableName, item); try { final PutItemResult result = this.dynamoDBClient.putItem(putItemRequest); return Optional.of(historyEntry); }catch (AmazonServiceException awsEx){ LOGGER.error("OTA Event insert failed. AWS service error {}", awsEx.getMessage()); }catch (AmazonClientException awcEx){ LOGGER.error("OTA Event insert failed. Client error.", awcEx.getMessage()); } return Optional.absent(); }

Target:
public Optional<OTAHistory> insertOTAEvent(final OTAHistory historyEntry) { final Map<String, AttributeValue> item = new HashMap<>(); item.put(DEVICE_ID_ATTRIBUTE_NAME, new AttributeValue().withS(historyEntry.deviceId)); item.put(EVENT_TIME_ATTRIBUTE_NAME, new AttributeValue().withS(dateTimeToString(historyEntry.eventTime))); item.put(CURRENT_FW_VERSION_ATTRIBUTE_NAME, new AttributeValue().withN(historyEntry.currentFWVersion.toString())); item.put(NEW_FW_VERSION_ATTRIBUTE_NAME, new AttributeValue().withN(historyEntry.newFWVersion.toString())); item.put(FILE_LIST_ATTRIBUTE_NAME, new AttributeValue().withSS(historyEntry.fileList)); final PutItemRequest putItemRequest = new PutItemRequest(this.tableName, item); try { final PutItemResult result = this.dynamoDBClient.putItem(putItemRequest); return Optional.of(historyEntry); }catch (AmazonServiceException awsEx){ LOGGER.error("OTA Event insert failed. AWS service error {}", awsEx.getMessage()); }catch (AmazonClientException awcEx){ LOGGER.error("OTA Event insert failed. Client error.", awcEx.getMessage()); } return Optional.absent(); }
Source:
private static LeaderTimeGetter getLeaderTimeGetter( String timelockNamespace, Optional<TimeLockRequestBatcherProviders> timelockRequestBatcherProviders, AtlasDbDialogueServiceProvider serviceProvider, LeaderElectionReportingTimelockService namespacedConjureTimelockService) { return timelockRequestBatcherProviders .map(TimeLockRequestBatcherProviders::leaderTimeBatcherProvider) .map(provider -> provider.getBatcher(getMultiClientTimelockServiceSupplier(serviceProvider))) .<LeaderTimeGetter>map(batcher -> new NamespacedCoalescingLeaderTimeGetter(timelockNamespace, batcher)) .orElseGet(() -> new LegacyLeaderTimeGetter(namespacedConjureTimelockService)); }

Target:
private static LeaderTimeGetter getLeaderTimeGetter( String timelockNamespace, Optional<TimeLockRequestBatcherProviders> timelockRequestBatcherProviders, AtlasDbDialogueServiceProvider serviceProvider, LeaderElectionReportingTimelockService namespacedConjureTimelockService) { if (!timelockRequestBatcherProviders.isPresent()) { return new LegacyLeaderTimeGetter(namespacedConjureTimelockService); } LeaderTimeCoalescingBatcher batcher = timelockRequestBatcherProviders .get() .leaderTimeBatcherProvider() .getBatcher(getMultiClientTimelockServiceSupplier(serviceProvider)); return new NamespacedCoalescingLeaderTimeGetter(timelockNamespace, batcher); }
Source:
protected void setDns(Instance instance, Map<String, Object> labels, Map<Object, Object> data) { if (instance.getSystemContainer() != null) { return; } if (InstanceConstants.KIND_CONTAINER.equals(instance.getKind())) { boolean addDns = true; if (labels.containsKey(SystemLabels.LABEL_USE_RANCHER_DNS) && !Boolean.valueOf(labels.get(SystemLabels.LABEL_USE_RANCHER_DNS).toString())) { addDns = false; } if (addDns) { String networkMode = DataAccessor.fields(instance).withKey(DockerInstanceConstants.FIELD_NETWORK_MODE) .as(String.class); if (DockerNetworkConstants.NETWORK_MODE_MANAGED.equals(networkMode)) { List<String> dns = DataAccessor.fieldStringList(instance, DockerInstanceConstants.FIELD_DNS); dns.add(NetworkConstants.INTERNAL_DNS_IP); data.put(DockerInstanceConstants.FIELD_DNS, dns); data.put(InstanceConstants.FIELD_DNS_INTERNAL, Joiner.on(",").join(dns)); } List<String> dnsSearch = DataAccessor.fieldStringList(instance, DockerInstanceConstants.FIELD_DNS_SEARCH); dnsSearch.add(NetworkConstants.INTERNAL_DNS_SEARCH_DOMAIN); data.put(DockerInstanceConstants.FIELD_DNS_SEARCH, dnsSearch); data.put(InstanceConstants.FIELD_DNS_SEARCH_INTERNAL, Joiner.on(",").join(dnsSearch)); } } }

Target:
protected void setDns(Instance instance, Map<String, Object> labels, Map<Object, Object> data) { if (instance.getSystemContainer() != null) { return; } if (InstanceConstants.KIND_CONTAINER.equals(instance.getKind())) { boolean addDns = true; Object lblValue = labels.get(SystemLabels.LABEL_USE_RANCHER_DNS); if (lblValue != null && !Boolean.valueOf(lblValue.toString())) { addDns = false; } if (addDns) { String networkMode = DataAccessor.fields(instance).withKey(DockerInstanceConstants.FIELD_NETWORK_MODE) .as(String.class); if (DockerNetworkConstants.NETWORK_MODE_MANAGED.equals(networkMode)) { List<String> dns = DataAccessor.fieldStringList(instance, DockerInstanceConstants.FIELD_DNS); dns.add(NetworkConstants.INTERNAL_DNS_IP); data.put(DockerInstanceConstants.FIELD_DNS, dns); data.put(InstanceConstants.FIELD_DNS_INTERNAL, Joiner.on(",").join(dns)); } List<String> dnsSearch = DataAccessor.fieldStringList(instance, DockerInstanceConstants.FIELD_DNS_SEARCH); dnsSearch.add(NetworkConstants.INTERNAL_DNS_SEARCH_DOMAIN); data.put(DockerInstanceConstants.FIELD_DNS_SEARCH, dnsSearch); data.put(InstanceConstants.FIELD_DNS_SEARCH_INTERNAL, Joiner.on(",").join(dnsSearch)); } } }
Source:
protected String computeMetricName(Message<?> message) { return fvcSinkProperties.getComputedNameExpression().getValue(evaluationContext, message, CharSequence.class).toString(); }

Target:
protected String computeMetricName(Message<?> message) { return fvcSinkProperties.getComputedNameExpression().getValue(message, CharSequence.class).toString(); }
Source:
private static boolean isTinymceStyleDiv(Node attribute) { if (!"style".equalsIgnoreCase(attribute.getNodeName())) { return false; } String value = attribute.getNodeValue(); return value.contains("position: static") && value.contains("height: 0px") && value.contains("width: 0px;") && value.contains("padding: 0px;") && value.contains("margin: 0px;"); }

Target:
private static boolean isTinymceStyleDiv(Node attribute) { if (!"style".equalsIgnoreCase(attribute.getNodeName())) { return false; } String value = attribute.getNodeValue(); return value.contains("position: static") && value.contains("height: 0px") && value.contains("width: 0px") && value.contains("padding: 0px") && value.contains("margin: 0px"); }