auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void initChannel(Channel ch) throws Exception { if (isSsl) { ch.pipeline().addFirst("SSL Handler", this.buildClientSslContext().newHandler(ch.alloc())); } final Http2FrameCodec http2FrameCodec = Http2FrameCodecBuilder.forClient() .initialSettings(Http2Settings.defaultSettings()) .build(); ch.pipeline().addLast("HTTP2 Frame Codec", http2FrameCodec); ch.pipeline().addLast("HTTP2 Multiplex Handler", new Http2MultiplexHandler(new SimpleChannelInboundHandler() { @Override protected void channelRead0(ChannelHandlerContext ctx, Object msg) { } })); }

Target:
protected void initChannel(Channel ch) throws Exception { if (sslCtx != null) { ch.pipeline().addFirst(sslCtx.newHandler(ch.alloc())); } final Http2FrameCodec http2FrameCodec = Http2FrameCodecBuilder.forClient() .initialSettings(Http2Settings.defaultSettings()) .build(); ch.pipeline().addLast(http2FrameCodec); ch.pipeline().addLast(new Http2MultiplexHandler(new SimpleChannelInboundHandler() { @Override protected void channelRead0(ChannelHandlerContext ctx, Object msg) { } })); }
Source:
private void setActiveTransferState(boolean active) { setTxtOriginEnabled(!active); if (active) { listOriginDataSource.setEnabled(false); btnOriginAction.setEnabled(false); btnSelectOrClearAllForms.setEnabled(false); btnTransfer.setEnabled(false); btnCancel.setEnabled(true); lblDownloading.setText(DOWNLOADING_DOT_ETC); lblDownloading.setForeground(lblOrigin.getForeground()); terminationFuture.reset(); } else { listOriginDataSource.setEnabled(true); btnOriginAction.setEnabled(true); btnSelectOrClearAllForms.setEnabled(true); btnTransfer.setEnabled(formTransferTable.getSelectedForms().size() != 0); btnCancel.setEnabled(false); lblDownloading.setText(DOWNLOADING_DOT_ETC); lblDownloading.setForeground(lblDownloading.getBackground()); } transferStateActive = active; }

Target:
private void setActiveTransferState(boolean active) { setTxtOriginEnabled(!active); if (active) { listOriginDataSource.setEnabled(false); btnOriginAction.setEnabled(false); btnSelectOrClearAllForms.setEnabled(false); btnTransfer.setEnabled(false); btnCancel.setEnabled(true); lblDownloading.setText(DOWNLOADING_DOT_ETC); lblDownloading.setForeground(lblOrigin.getForeground()); terminationFuture.reset(); } else { listOriginDataSource.setEnabled(true); btnOriginAction.setEnabled(true); btnSelectOrClearAllForms.setEnabled(true); btnTransfer.setEnabled(!formTransferTable.getSelectedForms().isEmpty()); btnCancel.setEnabled(false); lblDownloading.setText(DOWNLOADING_DOT_ETC); lblDownloading.setForeground(lblDownloading.getBackground()); } transferStateActive = active; }
Source:
*/ public void serdeTest() { DiagnosticsStreamMessage diagnosticsStreamMessage = getDiagnosticsStreamMessage(); Collection<DiagnosticsExceptionEvent> exceptionEventList = getExceptionList(); diagnosticsStreamMessage.addDiagnosticsExceptionEvents(exceptionEventList); diagnosticsStreamMessage.addProcessorStopEvents(getProcessorStopEventList()); diagnosticsStreamMessage.addContainerModels(getSampleContainerModels()); byte[] serializedBytes = new MetricsSnapshotSerdeV2().toBytes(diagnosticsStreamMessage.convertToMetricsSnapshot()); MetricsSnapshot metricsSnapshot = new MetricsSnapshotSerdeV2().fromBytes(serializedBytes); DiagnosticsStreamMessage deserializedDiagnosticsStreamMessage = DiagnosticsStreamMessage.convertToDiagnosticsStreamMessage(metricsSnapshot); Assert.assertEquals(diagnosticsStreamMessage, deserializedDiagnosticsStreamMessage); }

Target:
public void serdeTest() { DiagnosticsStreamMessage diagnosticsStreamMessage = getDiagnosticsStreamMessage(); Collection<DiagnosticsExceptionEvent> exceptionEventList = getExceptionList(); diagnosticsStreamMessage.addDiagnosticsExceptionEvents(exceptionEventList); diagnosticsStreamMessage.addProcessorStopEvents(getProcessorStopEventList()); diagnosticsStreamMessage.addContainerModels(getSampleContainerModels()); MetricsSnapshot metricsSnapshot = diagnosticsStreamMessage.convertToMetricsSnapshot(); Assert.assertEquals(metricsSnapshot.getHeader().getJobName(), jobName); Assert.assertEquals(metricsSnapshot.getHeader().getJobId(), jobId); Assert.assertEquals(metricsSnapshot.getHeader().getExecEnvironmentContainerId(), executionEnvContainerId); Assert.assertEquals(metricsSnapshot.getHeader().getVersion(), taskClassVersion); Assert.assertEquals(metricsSnapshot.getHeader().getSamzaVersion(), samzaVersion); Assert.assertEquals(metricsSnapshot.getHeader().getHost(), hostname); Assert.assertEquals(metricsSnapshot.getHeader().getSource(), DiagnosticsManager.class.getName()); Map<String, Map<String, Object>> metricsMap = metricsSnapshot.getMetrics().getAsMap(); Assert.assertTrue(metricsMap.get("org.apache.samza.container.SamzaContainerMetrics").containsKey("exceptions")); Assert.assertTrue(metricsMap.get(DiagnosticsManager.class.getName()).containsKey("containerModels")); Assert.assertTrue(metricsMap.get(DiagnosticsManager.class.getName()).containsKey("numStoresWithChangelog")); Assert.assertTrue(metricsMap.get(DiagnosticsManager.class.getName()).containsKey("containerNumCores")); Assert.assertTrue(metricsMap.get(DiagnosticsManager.class.getName()).containsKey("containerMemoryMb")); Assert.assertTrue(metricsMap.get(DiagnosticsManager.class.getName()).containsKey("stopEvents")); DiagnosticsStreamMessage convertedDiagnosticsStreamMessage = DiagnosticsStreamMessage.convertToDiagnosticsStreamMessage(metricsSnapshot); Assert.assertTrue(convertedDiagnosticsStreamMessage.equals(diagnosticsStreamMessage)); }
Source:
public void shouldMergeTemplateIntoString() throws Exception { when(settingsFacade.getRawConfig(CORRECT_TEMPLATE)).thenReturn(loadFile(CORRECT_TEMPLATE)); String result = parser.mergeTemplateIntoString(CORRECT_TEMPLATE, params); verify(settingsFacade, times(1)).getRawConfig(CORRECT_TEMPLATE); verifyResult(result); }

Target:
public void shouldMergeTemplateIntoString() throws Exception { try (FileInputStream template = loadFile(CORRECT_TEMPLATE)) { when(settingsFacade.getRawConfig(CORRECT_TEMPLATE)).thenReturn(template); String result = parser.mergeTemplateIntoString(CORRECT_TEMPLATE, params); verify(settingsFacade).getRawConfig(CORRECT_TEMPLATE); verifyResult(result); } }
Source:
public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); if (android.os.Build.VERSION.SDK_INT != android.os.Build.VERSION_CODES.KITKAT){ if (!isCurrentlyLoading) { return; } } isCurrentlyLoading = false; LOG.d(TAG, "onPageFinished(" + url + ")"); if (this.doClearHistory) { view.clearHistory(); this.doClearHistory = false; } this.appView.loadUrlTimeout++; this.appView.postMessage("onPageFinished", url); if (this.appView.getVisibility() == View.INVISIBLE) { Thread t = new Thread(new Runnable() { public void run() { try { Thread.sleep(2000); cordova.getActivity().runOnUiThread(new Runnable() { public void run() { appView.postMessage("spinner", "stop"); } }); } catch (InterruptedException e) { } } }); t.start(); } if (url.equals("about:blank")) { appView.postMessage("exit", null); } }

Target:
public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); if (!isCurrentlyLoading && !url.startsWith("about:")) { return; } isCurrentlyLoading = false; LOG.d(TAG, "onPageFinished(" + url + ")"); if (this.doClearHistory) { view.clearHistory(); this.doClearHistory = false; } this.appView.loadUrlTimeout++; this.appView.postMessage("onPageFinished", url); if (this.appView.getVisibility() == View.INVISIBLE) { Thread t = new Thread(new Runnable() { public void run() { try { Thread.sleep(2000); cordova.getActivity().runOnUiThread(new Runnable() { public void run() { appView.postMessage("spinner", "stop"); } }); } catch (InterruptedException e) { } } }); t.start(); } if (url.equals("about:blank")) { appView.postMessage("exit", null); } }
Source:
private void validateUnitsAreAmongAllowedConcepts(Errors errors, DrugOrder order) { OrderService orderService = Context.getOrderService(); if (order.getDoseUnits() != null) { List<Concept> drugDosingUnits = orderService.getDrugDosingUnits(); if (!drugDosingUnits.contains(order.getDoseUnits())) { errors.rejectValue("doseUnits", "DrugOrder.error.notAmongAllowedConcepts"); } } if (order.getQuantityUnits() != null) { List<Concept> drugDispensingUnits = orderService.getDrugDispensingUnits(); if (!drugDispensingUnits.contains(order.getQuantityUnits())) { errors.rejectValue("quantityUnits", "DrugOrder.error.notAmongAllowedConcepts"); } } if (order.getDurationUnits() != null) { List<Concept> drugDurationUnits = orderService.getDurationUnits(); if (!drugDurationUnits.contains(order.getDurationUnits())) { errors.rejectValue("durationUnits", "DrugOrder.error.notAmongAllowedConcepts"); } if (Duration.getCode(order.getDurationUnits()) == null) { errors.rejectValue("durationUnits", "DrugOrder.error.durationUnitsNotMappedToSNOMED_CTDurationCode"); } } if (order.getRoute() != null) { List<Concept> routes = orderService.getDrugRoutes(); if (!routes.contains(order.getRoute())) { errors.rejectValue("route", "DrugOrder.error.routeNotAmongAllowedConcepts"); } } }

Target:
private void validateUnitsAreAmongAllowedConcepts(Errors errors, DrugOrder order) { OrderService orderService = Context.getOrderService(); if (order.getDoseUnits() != null) { List<Concept> drugDosingUnits = orderService.getDrugDosingUnits(); if (!drugDosingUnits.contains(order.getDoseUnits())) { errors.rejectValue("doseUnits", "DrugOrder.error.notAmongAllowedConcepts"); } } if (order.getQuantityUnits() != null) { List<Concept> drugDispensingUnits = orderService.getDrugDispensingUnits(); if (!drugDispensingUnits.contains(order.getQuantityUnits())) { errors.rejectValue("quantityUnits", "DrugOrder.error.notAmongAllowedConcepts"); } } if (order.getDurationUnits() != null) { List<Concept> drugDurationUnits = orderService.getDurationUnits(); if (!drugDurationUnits.contains(order.getDurationUnits())) { errors.rejectValue("durationUnits", "DrugOrder.error.notAmongAllowedConcepts"); } if (Duration.getCode(order.getDurationUnits()) == null) { errors.rejectValue("durationUnits", "DrugOrder.error.durationUnitsNotMappedToSnomedCtDurationCode"); } } if (order.getRoute() != null) { List<Concept> routes = orderService.getDrugRoutes(); if (!routes.contains(order.getRoute())) { errors.rejectValue("route", "DrugOrder.error.routeNotAmongAllowedConcepts"); } } }
Source:
protected User authenticateUser(String requestBody) { PutMethod put = new PutMethod(Joiner.on("/").join(zeppelinhubUrl, USER_LOGIN_API_ENDPOINT)); String responseBody = StringUtils.EMPTY; String userSession = StringUtils.EMPTY; try { put.setRequestEntity(new StringRequestEntity(requestBody, JSON_CONTENT_TYPE, UTF_8_ENCODING)); int statusCode = httpClient.executeMethod(put); if (statusCode != HttpStatus.SC_OK) { LOG.error("Cannot login user, HTTP status code is instead on 200 (OK)", statusCode); put.releaseConnection(); throw new AuthenticationException("Couldnt login to ZeppelinHub. " + "Login or password incorrect"); } responseBody = put.getResponseBodyAsString(); userSession = put.getResponseHeader(USER_SESSION_HEADER).getValue(); put.releaseConnection(); } catch (IOException e) { LOG.error("Cannot login user", e); throw new AuthenticationException(e.getMessage()); } User account = null; try { account = gson.fromJson(responseBody, User.class); } catch (JsonParseException e) { LOG.error("Cannot deserialize ZeppelinHub response to User instance", e); throw new AuthenticationException("Cannot login to ZeppelinHub"); } HashSet<String> userAndRoles = new HashSet<String>(); userAndRoles.add(account.login); ZeppelinServer.notebookWsServer.broadcastReloadedNoteList( new org.apache.zeppelin.user.AuthenticationInfo(account.login), userAndRoles); UserSessionContainer.instance.setSession(account.login, userSession); return account; }

Target:
protected User authenticateUser(String requestBody) { PutMethod put = new PutMethod(Joiner.on("/").join(zeppelinhubUrl, USER_LOGIN_API_ENDPOINT)); String responseBody = StringUtils.EMPTY; String userSession = StringUtils.EMPTY; try { put.setRequestEntity(new StringRequestEntity(requestBody, JSON_CONTENT_TYPE, UTF_8_ENCODING)); int statusCode = httpClient.executeMethod(put); if (statusCode != HttpStatus.SC_OK) { LOG.error("Cannot login user, HTTP status code is instead on 200 (OK)", statusCode); put.releaseConnection(); throw new AuthenticationException("Couldnt login to ZeppelinHub. " + "Login or password incorrect"); } responseBody = put.getResponseBodyAsString(); userSession = put.getResponseHeader(USER_SESSION_HEADER).getValue(); put.releaseConnection(); } catch (IOException e) { LOG.error("Cannot login user", e); throw new AuthenticationException(e.getMessage()); } User account = null; try { account = gson.fromJson(responseBody, User.class); } catch (JsonParseException e) { LOG.error("Cannot deserialize ZeppelinHub response to User instance", e); throw new AuthenticationException("Cannot login to ZeppelinHub"); } UserSessionContainer.instance.setSession(account.login, userSession); HashSet<String> userAndRoles = new HashSet<String>(); userAndRoles.add(account.login); ZeppelinServer.notebookWsServer.broadcastReloadedNoteList( new org.apache.zeppelin.user.AuthenticationInfo(account.login), userAndRoles); return account; }
Source:
public void onMapReady(@NonNull MapboxMap mapboxMap) { mapboxMap.setStyle(new Style.Builder().fromUri(Style.SATELLITE_STREETS) .withSource(new GeoJsonSource(CIRCLE_GEOJSON_SOURCE_ID)) .withSource(new GeoJsonSource(LINE_GEOJSON_SOURCE_ID)), new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { MultipleGeometriesDirectionsRouteActivity.this.mapboxMap = mapboxMap; initDirectionsRouteLineLayer(style); initDirectionStepsCircleLayer(style); initDirectionStepsBackgroundCircleLayer(style); getRoute(origin, destination); } }); }

Target:
public void onMapReady(@NonNull MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; mapboxMap.setStyle(new Style.Builder().fromUri(Style.SATELLITE_STREETS) .withSource(new GeoJsonSource(CIRCLE_GEOJSON_SOURCE_ID)) .withSource(new GeoJsonSource(LINE_GEOJSON_SOURCE_ID)), new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { initLineLayerForDirectionsRoute(style); initStepManeuverCircleLayer(style); initStepManeuverBackgroundCircleLayer(style); getRoute(origin, destination); mapboxMap.addOnMapClickListener(MultipleGeometriesDirectionsRouteActivity.this); Toast.makeText(MultipleGeometriesDirectionsRouteActivity.this, getString(R.string.tap_on_map_to_change_destination), Toast.LENGTH_SHORT).show(); } }); }
Source:
public SubPlan createSubPlans(Session session, Metadata metadata, NodePartitioningManager nodePartitioningManager, Plan plan, boolean forceSingleNode) { Fragmenter fragmenter = new Fragmenter(session, metadata, plan.getTypes()); FragmentProperties properties = new FragmentProperties(new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), plan.getRoot().getOutputSymbols())); if (forceSingleNode || isForceSingleNodeOutput(session)) { properties = properties.setSingleNodeDistribution(); } PlanNode root = SimplePlanRewriter.rewriteWith(fragmenter, plan.getRoot(), properties); SubPlan subPlan = fragmenter.buildRootFragment(root, properties); subPlan = analyzeGroupedExecution(session, metadata, nodePartitioningManager, subPlan); checkState(!isForceSingleNodeOutput(session) || subPlan.getFragment().getPartitioning().isSingleNode(), "Root of PlanFragment is not single node"); sanityCheckFragmentedPlan(subPlan, SystemSessionProperties.getQueryMaxStageCount(session)); return subPlan; }

Target:
public SubPlan createSubPlans(Session session, Metadata metadata, NodePartitioningManager nodePartitioningManager, Plan plan, boolean forceSingleNode) { Fragmenter fragmenter = new Fragmenter(session, metadata, plan.getTypes()); FragmentProperties properties = new FragmentProperties(new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), plan.getRoot().getOutputSymbols())); if (forceSingleNode || isForceSingleNodeOutput(session)) { properties = properties.setSingleNodeDistribution(); } PlanNode root = SimplePlanRewriter.rewriteWith(fragmenter, plan.getRoot(), properties); SubPlan subPlan = fragmenter.buildRootFragment(root, properties); subPlan = analyzeGroupedExecution(session, metadata, nodePartitioningManager, subPlan); checkState(!isForceSingleNodeOutput(session) || subPlan.getFragment().getPartitioning().isSingleNode(), "Root of PlanFragment is not single node"); sanityCheckFragmentedPlan(subPlan, getQueryMaxStageCount(session)); return subPlan; }
Source:
public static Uri compatUriFromFile(@NonNull final ReactContext context, @NonNull final File file) { compileAuthorities(context); String existingAuthority = Uri.fromFile(file).getAuthority(); if (!TextUtils.isEmpty(existingAuthority) && authorities.contains(existingAuthority)) { return Uri.fromFile(file); } if (file.getAbsolutePath().startsWith("content://")) { return Uri.fromFile(file); } Uri result = null; for (int i = 0; i < authorities.size(); i++) { try { String authority = authorities.get(i); result = FileProvider.getUriForFile(context, authority, file); if (result != null) { break; } } catch (Exception e) { System.out.println("ERROR " + e.getMessage()); } } return result; }

Target:
public static Uri compatUriFromFile(@NonNull final ReactContext context, @NonNull final File file) { compileAuthorities(context); String existingAuthority = Uri.fromFile(file).getAuthority(); if (!TextUtils.isEmpty(existingAuthority) && authorities.contains(existingAuthority)) { return Uri.fromFile(file); } if (file.getAbsolutePath().startsWith("content://")) { return Uri.fromFile(file); } Uri result = null; for (int i = 0; i < authorities.size(); i++) { try { String authority = authorities.get(i); result = FileProvider.getUriForFile(context, authority, file); if (result != null) { break; } } catch (Exception e) { System.out.println("RNSharePathUtil::compatUriFromFile ERROR " + e.getMessage()); } } return result; }
Source:
public ExtMap queryUsers(ExtMap input, ExtMap output, long pageSize) { LdapQueryData queryData = new LdapQueryDataImpl(); queryData.setLdapQueryType(LdapQueryType.searchUsers); queryData.setDomain(getDirectoryName()); queryData.setFilterParameters(new Object[] { generateQueryString(input) }); LdapReturnValueBase ldapResult = broker.runAdAction( AdActionType.SearchUserByQuery, new LdapSearchByQueryParameters(configuration, null, getDirectoryName(), queryData, input.<Integer> get(Authz.InvokeKeys.QUERY_FLAGS, Authz.QueryFlags.RESOLVE_GROUPS_NONE) != Authz.QueryFlags.RESOLVE_GROUPS_NONE ) ); List<LdapUser> ldapUsers = (List<LdapUser>) ldapResult.getReturnValue(); List<ExtMap> results = new ArrayList<>(); int addedUsers = 0; for (LdapUser ldapUser : ldapUsers) { if (addedUsers++ < pageSize) { results.add(mapLdapUser(ldapUser)); } } return output.mput(Authz.InvokeKeys.QUERY_RESULT, results); }

Target:
public ExtMap queryUsers(ExtMap input, ExtMap output, long pageSize) { LdapQueryData queryData = new LdapQueryDataImpl(); queryData.setLdapQueryType(LdapQueryType.searchUsers); queryData.setDomain(getDirectoryName()); queryData.setFilterParameters(new Object[] { generateQueryString(input) }); LdapReturnValueBase ldapResult = broker.runAdAction( AdActionType.SearchUserByQuery, new LdapSearchByQueryParameters(configuration, null, getDirectoryName(), queryData, (input.<Integer> get(Authz.InvokeKeys.QUERY_FLAGS, Authz.QueryFlags.RESOLVE_GROUPS_NONE) & Authz.QueryFlags.RESOLVE_GROUPS) !=0 ) ); List<LdapUser> ldapUsers = (List<LdapUser>) ldapResult.getReturnValue(); List<ExtMap> results = new ArrayList<>(); int addedUsers = 0; for (LdapUser ldapUser : ldapUsers) { if (addedUsers++ < pageSize) { results.add(mapLdapUser(ldapUser)); } } return output.mput(Authz.InvokeKeys.QUERY_RESULT, results); }
Source:
public NewCpdTokens newCpdTokens() { if (analysisMode.isIssues() || branchConfiguration.isShortLivingBranch() || branchConfiguration.isPullRequest()) { return NO_OP_NEW_CPD_TOKENS; } return new DefaultCpdTokens(config, sensorStorage); }

Target:
public NewCpdTokens newCpdTokens() { if (analysisMode.isIssues() || branchConfiguration.isShortOrPullRequest()) { return NO_OP_NEW_CPD_TOKENS; } return new DefaultCpdTokens(config, sensorStorage); }
Source:
public BaseDto<BasePaginationDataDto<UserItemDataDto>> findAllUser(String loginName, String email, String mobile, Date beginTime, Date endTime, Source source, RoleStage roleStage, String referrerMobile, String channel, UserOperation userOperation, Integer index, Integer pageSize) { BaseDto<BasePaginationDataDto<UserItemDataDto>> baseDto = new BaseDto<>(); List<UserView> userViews = userMapperConsole.findAllUser(loginName, email, mobile, beginTime, endTime, source, roleStage, referrerMobile, channel, userOperation, (index - 1) * pageSize, pageSize); List<UserItemDataDto> userItems = Lists.newArrayList(); for (UserView userView : userViews) { UserItemDataDto userItemDataDto = new UserItemDataDto(userView); List<UserRoleModel> userRoleModels = userRoleMapper.findByLoginName(userView.getLoginName()); userRoleModels = userRoleModels.stream().filter(userRoleModel -> { return userRoleModel.getRole() != Role.INVESTOR && userRoleModel.getRole() != Role.LOANER; }).collect(Collectors.toList()); userItemDataDto.setUserRoles(userRoleModels); String taskId = OperationType.USER + "-" + userView.getLoginName(); userItemDataDto.setModify(redisWrapperClient.hexistsSeri(TaskConstant.TASK_KEY + Role.OPERATOR_ADMIN, taskId)); userItems.add(userItemDataDto); } int count = userMapperConsole.findAllUserCount(loginName, email, mobile, beginTime, endTime, source, roleStage, referrerMobile, channel, userOperation); BasePaginationDataDto<UserItemDataDto> basePaginationDataDto = new BasePaginationDataDto<>(index, pageSize, count, userItems); basePaginationDataDto.setStatus(true); baseDto.setData(basePaginationDataDto); return baseDto; }

Target:
public BaseDto<BasePaginationDataDto<UserItemDataDto>> findAllUser(String loginName, String email, String mobile, Date beginTime, Date endTime, Source source, RoleStage roleStage, String referrerMobile, String channel, UserOperation userOperation, Integer index, Integer pageSize) { BaseDto<BasePaginationDataDto<UserItemDataDto>> baseDto = new BaseDto<>(); List<UserView> userViews = userMapperConsole.findAllUser(loginName, email, mobile, beginTime, endTime, source, roleStage, referrerMobile, channel, userOperation, (index - 1) * pageSize, pageSize); List<UserItemDataDto> userItems = Lists.newArrayList(); for (UserView userView : userViews) { UserItemDataDto userItemDataDto = new UserItemDataDto(userView); List<UserRoleModel> userRoleModels = userRoleMapper.findByLoginName(userView.getLoginName()); userItemDataDto.setUserRoles(userRoleModels); String taskId = OperationType.USER + "-" + userView.getLoginName(); userItemDataDto.setModify(redisWrapperClient.hexistsSeri(TaskConstant.TASK_KEY + Role.OPERATOR_ADMIN, taskId)); userItems.add(userItemDataDto); } int count = userMapperConsole.findAllUserCount(loginName, email, mobile, beginTime, endTime, source, roleStage, referrerMobile, channel, userOperation); BasePaginationDataDto<UserItemDataDto> basePaginationDataDto = new BasePaginationDataDto<>(index, pageSize, count, userItems); basePaginationDataDto.setStatus(true); baseDto.setData(basePaginationDataDto); return baseDto; }
Source:
public static FilterExpression replaceMilestoneAliases(IModel model, FilterExpression expr) { List<String> repoIds = getMetaQualifierContent(expr, QualifierType.REPO).stream() .map(String::toLowerCase) .collect(Collectors.toList()); if (repoIds.isEmpty()) { repoIds.add(model.getDefaultRepo().toLowerCase()); } List<TurboMilestone> allMilestones = model.getMilestones().stream() .filter(ms -> ms.getDueDate().isPresent()) .filter(ms -> repoIds.contains(ms.getRepoId().toLowerCase())) .sorted((a, b) -> getMilestoneDueDateComparator().compare(a, b)) .collect(Collectors.toList()); List<TurboMilestone> openMilestones = model.getMilestones().stream() .filter(ms -> ms.isOpen()) .collect(Collectors.toList()); if (openMilestones.size() == 1 && !openMilestones.get(0).getDueDate().isPresent()) { allMilestones.addAll(openMilestones); } Optional<Integer> currentMilestoneIndex = getCurrentMilestoneIndex(allMilestones); if (!currentMilestoneIndex.isPresent()) { return expr; } return expr.map(q -> { if (Qualifier.isMilestoneQualifier(q)) { return q.convertMilestoneAliasQualifier(allMilestones, currentMilestoneIndex.get()); } else { return q; } }); }

Target:
public static FilterExpression replaceMilestoneAliases(IModel model, FilterExpression expr) { List<String> repoIds = getMetaQualifierContent(expr, QualifierType.REPO).stream() .map(String::toLowerCase) .collect(Collectors.toList()); if (repoIds.isEmpty()) { repoIds.add(model.getDefaultRepo().toLowerCase()); } List<TurboMilestone> milestonesOfReposInPanel = TurboMilestone.filterMilestonesOfRepos( model.getMilestones(), repoIds); List<TurboMilestone> aliasableMilestones = getAliasableMilestones(milestonesOfReposInPanel); Map<Integer, TurboMilestone> milestoneAliasIndex = getMilestoneAliasIndex(aliasableMilestones); if (milestoneAliasIndex.isEmpty()) { return expr; } return expr.map(q -> { if (Qualifier.isMilestoneQualifier(q)) { return q.convertMilestoneAliasQualifier(milestoneAliasIndex); } else { return q; } }); }
Source:
public static String[] tokenizeClassName(final String className) { String[] result = new String[0]; if (className != null) { result = JAVA_SEPERATOR_PATTERN.split(className); } return result; }

Target:
public static String[] tokenizeClassName(final String className) { return JAVA_SEPARATOR_PATTERN.split(notNull(className)); }
Source:
public void testSimpleInsertion() { final SAMRecordSetBuilder builder = getRecordBuilder(); final int startPosition = 165; for(int i = 0; i < coverage; i++) { builder.addFrag("record"+i, 0, startPosition, true, false, "30M3I3M", null, 10); } final int insStart = 194; for (final boolean incIndels : new boolean[]{false, true}){ final SamLocusIterator sli = createSamLocusIterator(builder); sli.setIncludeIndels(incIndels); int pos = startPosition; for (final SamLocusIterator.LocusInfo li : sli) { Assert.assertEquals(li.getPosition(), pos++); Assert.assertEquals(li.getRecordAndPositions().size(), coverage); Assert.assertEquals(li.getDeletedInRecord().size(), 0); if(incIndels && li.getPosition() == insStart) { Assert.assertEquals(li.getInsertedInRecord().size(), coverage, "Tracking indels: "+incIndels+". At "+li.toString()); } else { Assert.assertEquals(li.getInsertedInRecord().size(), 0, "Tracking indels: "+incIndels+". At "+li.toString()); } } } }

Target:
public void testSimpleInsertion() { final SAMRecordSetBuilder builder = getRecordBuilder(); final int startPosition = 165; for (int i = 0; i < coverage; i++) { builder.addFrag("record" + i, 0, startPosition, true, false, "30M3I3M", null, 10); } final int insStart = 194; for (final boolean incIndels : new boolean[] {false, true}) { final SamLocusIterator sli = createSamLocusIterator(builder); sli.setIncludeIndels(incIndels); int pos = startPosition; for (final SamLocusIterator.LocusInfo li : sli) { Assert.assertEquals(li.getPosition(), pos++); Assert.assertEquals(li.getRecordAndPositions().size(), coverage); Assert.assertEquals(li.getDeletedInRecord().size(), 0); if (incIndels && li.getPosition() == insStart) { Assert.assertEquals(li.getInsertedInRecord().size(), coverage); } else { Assert.assertEquals(li.getInsertedInRecord().size(), 0); } } } }
Source:
private Object extractContent(MimeMessage message, Map<String, Object> headers) { Object content; try { content = message.getContent(); if (content instanceof String) { String mailContentType = (String) headers.get(MailHeaders.CONTENT_TYPE); if (mailContentType != null && mailContentType.startsWith("text")) { headers.put(MessageHeaders.CONTENT_TYPE, mailContentType); } else { headers.put(MessageHeaders.CONTENT_TYPE, "text/plain"); } } else if (content instanceof InputStream) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); FileCopyUtils.copy((InputStream) content, baos); content = byteArrayToContent(headers, baos); } else if (content instanceof Multipart && this.embeddedPartsAsBytes) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ((Multipart) content).writeTo(baos); content = byteArrayToContent(headers, baos); } else if (content instanceof Part && this.embeddedPartsAsBytes) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ((Part) content).writeTo(baos); content = byteArrayToContent(headers, baos); } return content; } catch (Exception e) { throw new org.springframework.messaging.MessagingException("Failed to extract content from " + message, e); } }

Target:
private Object extractContent(MimeMessage message, Map<String, Object> headers) { Object content; try { content = message.getContent(); if (content instanceof String) { String mailContentType = (String) headers.get(MailHeaders.CONTENT_TYPE); if (mailContentType != null && mailContentType.toLowerCase().startsWith("text")) { headers.put(MessageHeaders.CONTENT_TYPE, mailContentType); } else { headers.put(MessageHeaders.CONTENT_TYPE, "text/plain"); } } else if (content instanceof InputStream) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); FileCopyUtils.copy((InputStream) content, baos); content = byteArrayToContent(headers, baos); } else if (content instanceof Multipart && this.embeddedPartsAsBytes) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ((Multipart) content).writeTo(baos); content = byteArrayToContent(headers, baos); } else if (content instanceof Part && this.embeddedPartsAsBytes) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ((Part) content).writeTo(baos); content = byteArrayToContent(headers, baos); } return content; } catch (Exception e) { throw new org.springframework.messaging.MessagingException("Failed to extract content from " + message, e); } }
Source:
public void configure(ReadableConfig configuration, ClassLoader classLoader) { configuration.getOptional(StreamPipelineOptions.TIME_CHARACTERISTIC) .ifPresent(this::setStreamTimeCharacteristic); Optional.ofNullable(loadStateBackend(configuration, classLoader)) .ifPresent(this::setStateBackend); configuration.getOptional(PipelineOptions.OPERATOR_CHAINING) .ifPresent(c -> this.isChainingEnabled = c); configuration.getOptional(ExecutionOptions.BUFFER_TIMEOUT) .ifPresent(t -> this.setBufferTimeout(t.toMillis())); configuration.getOptional(PipelineOptions.CACHED_FILES) .ifPresent(f -> { this.cacheFile.clear(); this.cacheFile.addAll(DistributedCache.parseCachedFilesFromString(f)); }); config.configure(configuration, classLoader); checkpointCfg.configure(configuration); configuration.getOptional(ExecutionOptions.JOB_LISTENERS) .ifPresent(l -> { for (String listener : l) { try { Class<? extends JobListener> clazz = Class.forName(listener, true, classLoader) .asSubclass(JobListener.class); jobListeners.add(clazz.newInstance()); } catch (Throwable t) { throw new RuntimeException("Could not load JobListener : " + listener, t); } } }); }

Target:
public void configure(ReadableConfig configuration, ClassLoader classLoader) { configuration.getOptional(StreamPipelineOptions.TIME_CHARACTERISTIC) .ifPresent(this::setStreamTimeCharacteristic); Optional.ofNullable(loadStateBackend(configuration, classLoader)) .ifPresent(this::setStateBackend); configuration.getOptional(PipelineOptions.OPERATOR_CHAINING) .ifPresent(c -> this.isChainingEnabled = c); configuration.getOptional(ExecutionOptions.BUFFER_TIMEOUT) .ifPresent(t -> this.setBufferTimeout(t.toMillis())); configuration.getOptional(PipelineOptions.CACHED_FILES) .ifPresent(f -> { this.cacheFile.clear(); this.cacheFile.addAll(DistributedCache.parseCachedFilesFromString(f)); }); config.configure(configuration, classLoader); checkpointCfg.configure(configuration); configuration.getOptional(DeploymentOptions.JOB_LISTENERS) .ifPresent(l -> { for (String listener : l) { JobListener jobListener; try { jobListener = InstantiationUtil.instantiate( listener, JobListener.class, classLoader); jobListeners.add(jobListener); } catch (FlinkException e) { throw new RuntimeException("Could not load JobListener : " + listener, e); } } }); }
Source:
private static void serializePrimitive(Type type, BlockBuilder builder, Object object) { requireNonNull(builder, "builder is null"); if (object == null) { builder.appendNull(); return; } if (type.equals(BOOLEAN)) { type.writeBoolean(builder, (Boolean) object); } else if (type.equals(BIGINT)) { type.writeLong(builder, (Long) object); } else if (type.equals(DOUBLE)) { type.writeDouble(builder, (Double) object); } else if (type.equals(INTEGER)) { type.writeLong(builder, (Integer) object); } else if (type.equals(VARCHAR) || type.equals(VARBINARY)) { type.writeSlice(builder, utf8Slice(object.toString())); } else { throw new IllegalArgumentException("Unknown primitive type: " + type.getDisplayName()); } return; }

Target:
private static void serializePrimitive(Type type, BlockBuilder builder, Object object) { requireNonNull(builder, "builder is null"); if (object == null) { builder.appendNull(); return; } if (type.equals(BOOLEAN)) { type.writeBoolean(builder, (Boolean) object); } else if (type.equals(BIGINT)) { type.writeLong(builder, (Long) object); } else if (type.equals(DOUBLE)) { type.writeDouble(builder, (Double) object); } else if (type.equals(INTEGER)) { type.writeLong(builder, (Integer) object); } else if (type.equals(VARCHAR) || type.equals(VARBINARY)) { type.writeSlice(builder, utf8Slice(object.toString())); } else { throw new IllegalArgumentException("Unknown primitive type: " + type.getDisplayName()); } }
Source:
public ScsiController build() { disks(disks() != null ? ImmutableList.copyOf(disks()) : new ArrayList<ScsiDisk>()); return autoBuild(); }

Target:
public ScsiController build() { disks(disks() != null ? ImmutableList.copyOf(disks()) : null); return autoBuild(); }
Source:
public List<BasicEntityRecord> getEntityRecordsFromLookup(Long entityId, String lookupName, Map<String, Object> lookupMap, QueryParams queryParams) { EntityDto entity = getEntity(entityId); validateCredentialsForReading(entity); LookupDto lookup = getLookupByName(entityId, lookupName); List<FieldDto> fields = entityService.getEntityFieldsForUI(entityId); Map<String, FieldDto> fieldMap = entityService.getLookupFieldsMapping(entityId, lookupName); MotechDataService service = getServiceForEntity(entity); String lookupExceptionMessageKey = "mds.error.lookupExecError"; try { LookupExecutor lookupExecutor = new LookupExecutor(service, lookup, fieldMap); Object result = lookupExecutor.execute(lookupMap, queryParams); if (lookup.isSingleObjectReturn()) { BasicEntityRecord record = instanceToBasicRecord(result, entity, fields, service, EntityType.STANDARD, getRelatedEntitiesFields(fields)); return (record == null) ? new ArrayList<BasicEntityRecord>() : Collections.singletonList(record); } else { List instances = (List) result; return instancesToBasicRecords(instances, entity, fields, service, EntityType.STANDARD); } } catch (LookupExecutorException e) { if (e.getMessageKey() != null) { throw new LookupExecutionException(e, e.getMessageKey()); } else { throw new LookupExecutionException(e, lookupExceptionMessageKey); } } catch (RuntimeException e) { throw new LookupExecutionException(e, lookupExceptionMessageKey); } }

Target:
public List<BasicEntityRecord> getEntityRecordsFromLookup(Long entityId, String lookupName, Map<String, Object> lookupMap, QueryParams queryParams) { EntityDto entity = getEntity(entityId); validateCredentialsForReading(entity); LookupDto lookup = getLookupByName(entityId, lookupName); List<FieldDto> fields = entityService.getEntityFieldsForUI(entityId); Map<String, FieldDto> fieldMap = entityService.getLookupFieldsMapping(entityId, lookupName); MotechDataService service = getServiceForEntity(entity); try { LookupExecutor lookupExecutor = new LookupExecutor(service, lookup, fieldMap); Object result = lookupExecutor.execute(lookupMap, queryParams); if (lookup.isSingleObjectReturn()) { BasicEntityRecord record = instanceToBasicRecord(result, entity, fields, service, EntityType.STANDARD, getRelatedEntitiesFields(fields)); return (record == null) ? new ArrayList<BasicEntityRecord>() : Collections.singletonList(record); } else { List instances = (List) result; return instancesToBasicRecords(instances, entity, fields, service, EntityType.STANDARD); } } catch (LookupExecutorException e) { if (e.getMessageKey() != null) { throw new LookupExecutionException(e, e.getMessageKey()); } else { throw new LookupExecutionException(e, LOOKUP_EXCEPTION_MESSAGE_KEY); } } catch (RuntimeException e) { throw new LookupExecutionException(e, LOOKUP_EXCEPTION_MESSAGE_KEY); } }
Source:
private void setup() { setPrefColumnCount(30); validationSupport.registerValidator(this, (c, newValue) -> { boolean isValidFilter = true; try { Parser.parse(getText()); setStyleForValidFilter(); } catch (ParseException e) { isValidFilter = false; setStyleForInvalidFilter(); } return ValidationResult.fromErrorIf(this, "Parse error", !isValidFilter); }); setOnKeyTyped(e -> { boolean isModifierKeyPress = e.isAltDown() || e.isMetaDown() || e.isControlDown(); String key = e.getCharacter(); if (key == null || key.isEmpty() || isModifierKeyPress) { return; } char typed = e.getCharacter().charAt(0); if (typed == '\t') { e.consume(); if (!getSelectedText().isEmpty()) { confirmCompletion(); } } else if (Character.isAlphabetic(typed) && shouldStartCompletion()) { startCompletion(e); } }); setOnKeyPressed(e -> { if (e.getCode() == KeyCode.TAB) { e.consume(); } }); setOnKeyReleased(e -> { e.consume(); if (e.getCode() == KeyCode.ENTER) { confirmEdit(); } else if (e.getCode() == KeyCode.ESCAPE) { if (getText().equals(previousText)) { cancel.run(); } else { revertEdit(); } } }); }

Target:
private void setup() { setPrefColumnCount(30); validationSupport.registerValidator(this, (c, newValue) -> { boolean wasError = false; try { Parser.parse(getText()); setStyleForValidFilter(); } catch (ParseException e) { wasError = true; setStyleForInvalidFilter(); } return ValidationResult.fromErrorIf(this, "Parse error", wasError); }); setOnKeyTyped(e -> { boolean isModifierKeyPress = e.isAltDown() || e.isMetaDown() || e.isControlDown(); String key = e.getCharacter(); if (key == null || key.isEmpty() || isModifierKeyPress) { return; } char typed = e.getCharacter().charAt(0); if (typed == '\t') { e.consume(); if (!getSelectedText().isEmpty()) { confirmCompletion(); } } else if (Character.isAlphabetic(typed) && shouldStartCompletion()) { startCompletion(e); } }); setOnKeyPressed(e -> { if (e.getCode() == KeyCode.TAB) { e.consume(); } }); setOnKeyReleased(e -> { e.consume(); if (e.getCode() == KeyCode.ENTER) { confirmEdit(); } else if (e.getCode() == KeyCode.ESCAPE) { if (getText().equals(previousText)) { cancel.run(); } else { revertEdit(); } } }); }
Source:
public static TemporaryBuffer cleanLfsBlob(Repository db, InputStream originalContent) throws IOException { LocalFile buffer = new TemporaryBuffer.LocalFile(null); CleanFilter f = new CleanFilter(db, originalContent, buffer); try { while (f.run() != -1) { } } catch (IOException e) { buffer.close(); throw e; } return buffer; }

Target:
public static TemporaryBuffer cleanLfsBlob(Repository db, InputStream originalContent) throws IOException { LocalFile buffer = new TemporaryBuffer.LocalFile(null); CleanFilter f = new CleanFilter(db, originalContent, buffer); try { while (f.run() != -1) { } } catch (IOException e) { buffer.destroy(); throw e; } return buffer; }
Source:
public Builder uploadIdMarker(String uploadIdMarker) { operations.add(args -> args.uploadIdMarker = uploadIdMarker); return this; }

Target:
public Builder uploadIdMarker(String uploadIdMarker) { validateNullOrNotEmptyString(uploadIdMarker, "uploadIdMarker"); operations.add(args -> args.uploadIdMarker = uploadIdMarker); return this; }
Source:
private static Optional<CompositeColumnFilter> typeFilter(EventStreamQuery query) { final CompositeColumnFilter.Builder typeFilter = CompositeColumnFilter.newBuilder() .setOperator(EITHER); for (EventFilter eventFilter : query.getFilterList()) { final String type = eventFilter.getEventType() .trim(); if (!type.isEmpty()) { final ColumnFilter filter = eq(TYPE_COLUMN, type); typeFilter.addFilter(filter); } } return buildFilter(typeFilter); }

Target:
private static Optional<CompositeColumnFilter> typeFilter(EventStreamQuery query) { final CompositeColumnFilter.Builder typeFilter = CompositeColumnFilter.newBuilder() .setOperator(EITHER); for (EventFilter eventFilter : query.getFilterList()) { final String type = eventFilter.getEventType(); if (!type.trim() .isEmpty()) { final ColumnFilter filter = eq(TYPE_COLUMN, type); typeFilter.addFilter(filter); } } return buildFilter(typeFilter); }
Source:
public Optional<BaseExpressionGrid> getExpressionGrid(final String nodeUUID) { return cache.containsKey(nodeUUID) ? cache.get(nodeUUID) : Optional.empty(); }

Target:
public Optional<BaseExpressionGrid> getExpressionGrid(final String nodeUUID) { return cache.getOrDefault(nodeUUID, Optional.empty()); }
Source:
protected <T> void notifyTransactionObservers(List<ObserverMethod<? super T>> observers, T event, EventMetadata metadata) { if (observers.isEmpty()) { return; } if (transactionServices == null || !transactionServices.isTransactionActive()) { notifySyncObservers(observers, event, metadata); } else { try { for (ObserverMethod<? super T> observer : observers) { deferNotification(event, metadata, observer); } } catch (Exception e) { if (e.getCause() instanceof RollbackException || e.getCause() instanceof IllegalStateException) { List<ObserverMethod<? super T>> filteredObservers = new ArrayList<>(observers); for (Iterator<ObserverMethod<? super T>> it = filteredObservers.iterator(); it.hasNext(); ) { ObserverMethod<? super T> observerMethod = it.next(); if (observerMethod.getTransactionPhase().equals(TransactionPhase.AFTER_SUCCESS)) { it.remove(); } } Collections.sort(filteredObservers, new Comparator<ObserverMethod<? super T>>() { @Override public int compare(ObserverMethod<? super T> o1, ObserverMethod<? super T> o2) { return o2.getTransactionPhase().toString().compareTo(o1.getTransactionPhase().toString()); } }); notifySyncObservers(filteredObservers, event, metadata); } else { throw e; } } } }

Target:
protected <T> void notifyTransactionObservers(List<ObserverMethod<? super T>> observers, T event, EventMetadata metadata) { if (observers.isEmpty()) { return; } if (transactionServices == null || !transactionServices.isTransactionActive()) { notifySyncObservers(observers, event, metadata); } else { List<ObserverMethod<? super T>> failedObservers = new ArrayList<>(observers); try { for (ObserverMethod<? super T> observer : observers) { deferNotification(event, metadata, observer); failedObservers.remove(observer); } } catch (Exception e) { if (e.getCause() instanceof RollbackException || e.getCause() instanceof IllegalStateException) { List<ObserverMethod<? super T>> filteredObservers = new ArrayList<>(failedObservers); for (Iterator<ObserverMethod<? super T>> it = filteredObservers.iterator(); it.hasNext(); ) { ObserverMethod<? super T> observerMethod = it.next(); if (observerMethod.getTransactionPhase().equals(TransactionPhase.AFTER_SUCCESS)) { it.remove(); } } Collections.sort(filteredObservers, new Comparator<ObserverMethod<? super T>>() { @Override public int compare(ObserverMethod<? super T> o1, ObserverMethod<? super T> o2) { return o2.getTransactionPhase().toString().compareTo(o1.getTransactionPhase().toString()); } }); notifySyncObservers(filteredObservers, event, metadata); } else { throw e; } } } }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } TransactionEdit that = (TransactionEdit) o; return Objects.equal(this.writePointer, that.writePointer) && Objects.equal(this.visibilityUpperBound, that.visibilityUpperBound) && Objects.equal(this.commitPointer, that.commitPointer) && Objects.equal(this.expirationDate, that.expirationDate) && Objects.equal(this.state, that.state) && Objects.equal(this.changes, that.changes) && Objects.equal(this.canCommit, that.canCommit) && Objects.equal(this.type, that.type); }

Target:
public final boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof TransactionEdit)) { return false; } TransactionEdit that = (TransactionEdit) o; return Objects.equal(this.writePointer, that.writePointer) && Objects.equal(this.visibilityUpperBound, that.visibilityUpperBound) && Objects.equal(this.commitPointer, that.commitPointer) && Objects.equal(this.expirationDate, that.expirationDate) && Objects.equal(this.state, that.state) && Objects.equal(this.changes, that.changes) && Objects.equal(this.canCommit, that.canCommit) && Objects.equal(this.type, that.type); }
Source:
private void messageRead(HttpServerExchange exchange, byte[] messageContent, AttachmentContent attachment) { try { contentLengthChecker.check(exchange, messageContent.length, attachment); attachment.getCachedTopic().reportMessageContentSize(messageContent.length); throughputLimiter.check( attachment.getCachedTopic().getTopicName(), attachment.getCachedTopic().getThroughput()); attachment.setMessageContent(messageContent); endWithoutDefaultResponse(exchange); if (exchange.isInIoThread()) { dispatchToWorker(exchange, attachment); } else { next.handleRequest(exchange); } } catch (ContentLengthChecker.InvalidContentLengthException | ContentLengthChecker.ContentTooLargeException e) { attachment.removeTimeout(); messageErrorProcessor.sendAndLog(exchange, attachment.getTopic(), attachment.getMessageId(), error(e.getMessage(), VALIDATION_ERROR)); } catch (FixedThroughputLimiter.QuotaViolationException e) { respondWithQuotaViolation(exchange, attachment, e); } catch (Exception e) { attachment.removeTimeout(); messageErrorProcessor.sendAndLog(exchange, attachment.getTopic(), attachment.getMessageId(), e); } }

Target:
private void messageRead(HttpServerExchange exchange, byte[] messageContent, AttachmentContent attachment) { try { contentLengthChecker.check(exchange, messageContent.length, attachment); attachment.getCachedTopic().reportMessageContentSize(messageContent.length); ThroughputLimiter.QuotaInsight quotaCheck = throughputLimiter.checkQuota( attachment.getCachedTopic().getTopicName(), attachment.getCachedTopic().getThroughput()); if (quotaCheck.hasQuota()) { finalizeMessageRead(exchange, messageContent, attachment); } else { respondWithQuotaViolation(exchange, attachment, quotaCheck.getReason()); } } catch (ContentLengthChecker.InvalidContentLengthException | ContentLengthChecker.ContentTooLargeException e) { attachment.removeTimeout(); messageErrorProcessor.sendAndLog(exchange, attachment.getTopic(), attachment.getMessageId(), error(e.getMessage(), VALIDATION_ERROR)); } catch (Exception e) { attachment.removeTimeout(); messageErrorProcessor.sendAndLog(exchange, attachment.getTopic(), attachment.getMessageId(), e); } }
Source:
public boolean processNextEvent() { synchronized(this) { if (queue.isEmpty() || status.get() == Status.RUNNING) { return false; } if (status.compareAndSet(Status.READY, Status.RUNNING)) { if (queue.isEmpty()) { status.set(Status.READY); return false; } final Tuple<MistEvent, Direction> event; event = queue.poll(); process(event); status.set(Status.READY); if (operatorChainManager != null && !queue.isEmpty()) { operatorChainManager.insert(this); } return true; } else { return false; } } }

Target:
public boolean processNextEvent() { if (queue.isEmpty() || status.get() == Status.RUNNING) { return false; } if (status.compareAndSet(Status.READY, Status.RUNNING)) { if (queue.isEmpty()) { status.set(Status.READY); return false; } final Tuple<MistEvent, Direction> event; synchronized (this) { event = queue.poll(); } process(event); status.set(Status.READY); if (operatorChainManager != null && !queue.isEmpty()) { operatorChainManager.insert(this); } return true; } else { return false; } }