auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void authorise3DSSource(ChargeEntity charge, String notificationEventType) { <START> try { <END> final StripeNotificationType type = StripeNotificationType.byType(notificationEventType); if (AUTHORISATION_3DS_REQUIRED.equals(ChargeStatus.fromString(charge.getStatus()))) { updateChargeStatus(charge, AUTHORISATION_3DS_READY); } Auth3dsDetails auth3dsDetails = new Auth3dsDetails(); auth3dsDetails.setAuth3dsResult(getMappedAuth3dsResult(type)); card3dsResponseAuthService.process3DSecureAuthorisationWithoutLocking(charge.getExternalId(), auth3dsDetails); } catch (OperationAlreadyInProgressRuntimeException e) { } }</code><technical_language>is this locking charge? a method for in charge service</technical_language>

Target:
private void authorise3DSSource(ChargeEntity charge, String notificationEventType) { try { final StripeNotificationType type = StripeNotificationType.byType(notificationEventType); if (AUTHORISATION_3DS_REQUIRED.equals(ChargeStatus.fromString(charge.getStatus()))) { logger.info("Updating charge for notification - " + "charge_external_id={}, status={}, status_to={}, transaction_id={}, " + "account_id={}, provider={}, provider_type={}", charge.getExternalId(), charge.getStatus(), charge.getStatus(), charge.getGatewayTransactionId(), charge.getGatewayAccount().getId(), charge.getGatewayAccount().getGatewayName(), charge.getGatewayAccount().getType()); chargeService.lockChargeForProcessing(charge.getExternalId(), AUTHORISATION_3DS); } Auth3dsDetails auth3dsDetails = new Auth3dsDetails(); auth3dsDetails.setAuth3dsResult(getMappedAuth3dsResult(type)); card3dsResponseAuthService.process3DSecureAuthorisationWithoutLocking(charge.getExternalId(), auth3dsDetails); } catch (OperationAlreadyInProgressRuntimeException e) { } }
Source:
<code>private int bagSizePower() throws IOException { int avgObjectSize = (int) (valuesOut.getCount() / numWritten); File f = ioPeon.getFile(makeFilename("headerLong")); Preconditions.checkNotNull(f, "header file missing."); try (RandomAccessFile headerFile = new RandomAccessFile(f, "r")) { for (int i = 31; i >= 0; --i) { if ((1L << i) * avgObjectSize <= fileSizeLimit) { if (actuallyFits(i, headerFile)) { return i; } } } } <START> throw new ISE( <END> "no value split found with fileSizeLimit [%d], avgObjectSize [%d] while serializing [%s]", fileSizeLimit, avgObjectSize, filenameBase ); }</code><technical_language>a druid user this error batch/realtime ingestion , continue happen retries ... resolution</technical_language>

Target:
private int bagSizePower() throws IOException { long avgObjectSize = (valuesOut.getCount() + numWritten - 1) / numWritten; File f = ioPeon.getFile(makeFilename("headerLong")); Preconditions.checkNotNull(f, "header file missing."); try (RandomAccessFile headerFile = new RandomAccessFile(f, "r")) { for (int i = 31; i >= 0; --i) { if ((1L << i) * avgObjectSize <= fileSizeLimit) { if (actuallyFits(i, headerFile)) { return i; } } } } throw new ISE( "no value split found with fileSizeLimit [%d], avgObjectSize [%d] while serializing [%s]", fileSizeLimit, avgObjectSize, filenameBase ); }
Source:
<code><START> public void testSetscopedInstance_rootWithTargetChild() throws InterruptedException { <END> AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); app.getTomcat().getComponent().installerName( Constants.TARGET_INSTALLER ); Assert.assertNull( processor.scopedInstance ); processor.processMessage( new MsgCmdSetScopedInstance( app.getTomcatVm())); Assert.assertEquals( app.getTomcatVm(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, processor.scopedInstance.getStatus()); Assert.assertEquals( "Expected a message for the Tomcat VM (children were removed).", 0, this.client.messagesForAgents.size()); Assert.assertEquals( 1, InstanceHelpers.buildHierarchicalList( app.getTomcatVm()).size()); }</code><technical_language>No, this method throw interrupted exceptions</technical_language>

Target:
public void testSetscopedInstance_rootWithTargetChild() { AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); app.getTomcat().getComponent().installerName( Constants.TARGET_INSTALLER ); Assert.assertNull( processor.scopedInstance ); processor.processMessage( new MsgCmdSetScopedInstance( app.getTomcatVm())); Assert.assertEquals( app.getTomcatVm(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, processor.scopedInstance.getStatus()); Assert.assertEquals( "Expected a message for the Tomcat VM (children were removed).", 0, this.client.messagesForAgents.size()); Assert.assertEquals( 1, InstanceHelpers.buildHierarchicalList( app.getTomcatVm()).size()); }
Source:
<code>public ResponseEntity updateSampleListFolderName(@PathVariable final String crop, @RequestParam final String newFolderName, @PathVariable final Integer folderId) { <START> Map<String, Object> map; <END> try { map = this.sampleListService.updateSampleListFolderName(folderId, newFolderName); } catch (final MiddlewareException e) { final ErrorResponse response = new ErrorResponse(); response.addError("Something went wrong, please try again"); return new ResponseEntity<>(response, HttpStatus.CONFLICT); } return new ResponseEntity<>(map, HttpStatus.OK); }</code><technical_language>add final</technical_language>

Target:
public ResponseEntity updateSampleListFolderName(@PathVariable final String crop, @RequestParam final String newFolderName, @PathVariable final Integer folderId) { final Map<String, Object> map; try { map = this.sampleListService.updateSampleListFolderName(folderId, newFolderName); } catch (final MiddlewareException e) { final ErrorResponse response = new ErrorResponse(); response.addError("Something went wrong, please try again"); return new ResponseEntity<>(response, HttpStatus.CONFLICT); } return new ResponseEntity<>(map, HttpStatus.OK); }
Source:
<code>public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (courseData == null || !isCoursewareAccessible) return; final String headerImageUrl = courseData.getCourse().getCourse_image(environment.getConfig()); Glide.with(CourseDashboardFragment.this) .load(headerImageUrl) .placeholder(R.drawable.edx_map_login) .transform(new TopAnchorFillWidthTransformation(getActivity())) .into(headerImageView); courseTextName.setText(courseData.getCourse().getName()); CourseEntry course = courseData.getCourse(); courseTextDetails.setText(course.getDescription(getActivity(), true)); <START> shareButton.setBackgroundResource(R.drawable.android_share); <END> shareButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openShareMenu(); } }); }</code><technical_language>need drawable src _and_ background</technical_language>

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (courseData == null || !isCoursewareAccessible) return; final String headerImageUrl = courseData.getCourse().getCourse_image(environment.getConfig()); Glide.with(CourseDashboardFragment.this) .load(headerImageUrl) .placeholder(R.drawable.edx_map_login) .transform(new TopAnchorFillWidthTransformation(getActivity())) .into(headerImageView); courseTextName.setText(courseData.getCourse().getName()); CourseEntry course = courseData.getCourse(); courseTextDetails.setText(course.getDescription(getActivity(), true)); if (environment.getConfig().isShareCourseEnabled()) { shareButton.setVisibility(headerImageView.VISIBLE); shareButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openShareMenu(); } }); } }
Source:
<code>public void preConnect( HttpURLConnection connection, @Nullable SimpleRequestEntity requestEntity) { <START> mConnection = connection; <END> if (isStethoEnabled()) { mInspectorRequest = new URLConnectionInspectorRequest( getStethoRequestId(), mFriendlyName, connection, requestEntity); mStethoHook.requestWillBeSent(mInspectorRequest); } }</code><technical_language>throw if is connection later, want throw if is a connection</technical_language>

Target:
public void preConnect( HttpURLConnection connection, @Nullable SimpleRequestEntity requestEntity) { throwIfConnection(); mConnection = connection; if (isStethoEnabled()) { mInspectorRequest = new URLConnectionInspectorRequest( getStethoRequestId(), mFriendlyName, connection, requestEntity); mStethoHook.requestWillBeSent(mInspectorRequest); } }
Source:
<code>public void enableErasureCodingPolicy(String ecPolicyName) throws IOException { if (this.vfs == null) { super.enableErasureCodingPolicy(ecPolicyName); return; } <START> defaultDFS.enableErasureCodingPolicy(ecPolicyName); <END> }</code><technical_language>I doubt this. enable/disable/add/remove EC Policy underlying child DFS defaultDFS</technical_language>

Target:
public void enableErasureCodingPolicy(String ecPolicyName) throws IOException { if (this.vfs == null) { super.enableErasureCodingPolicy(ecPolicyName); return; } List<IOException> failedExceptions = new ArrayList<>(); boolean isDFSExistsInChilds = false; for (FileSystem fs : getChildFileSystems()) { if (!(fs instanceof DistributedFileSystem)) { continue; } isDFSExistsInChilds = true; DistributedFileSystem dfs = (DistributedFileSystem) fs; try { dfs.enableErasureCodingPolicy(ecPolicyName); } catch (IOException ioe) { failedExceptions.add(ioe); } } if (!isDFSExistsInChilds) { throw new UnsupportedOperationException( "No DFS available in child file systems."); } if (failedExceptions.size() > 0) { throw MultipleIOException.createIOException(failedExceptions); } }
Source:
<code><START> private void loadProject(ResultSet rs, ProjectConfig config) throws SQLException, OrmException { <END> config.getProject().setDescription(rs.getString("description")); config.getProject().setUseContributorAgreements( "Y".equals(rs.getString("use_contributor_agreements"))); final char submitType = rs.getString("submit_type").charAt(0); boolean removeSubmitType = false; final String name = rs.getString("name"); if (!name.equals("-- All Projects --") && submitType == 'M') { removeSubmitType = true; } if (!removeSubmitType) { final MergeStrategySection section = config.getMergeStrategySection("refs/*", true); switch (submitType) { case 'F': section .setSubmitType(MergeStrategySection.SubmitType.FAST_FORWARD_ONLY); break; case 'M': section .setSubmitType(MergeStrategySection.SubmitType.MERGE_IF_NECESSARY); break; case 'A': section.setSubmitType(MergeStrategySection.SubmitType.MERGE_ALWAYS); break; case 'C': section.setSubmitType(MergeStrategySection.SubmitType.CHERRY_PICK); break; default: throw new OrmException("Unsupported submit_type=" + rs.getString("submit_type") + " on project " + config.getProject().getName()); } } config.getProject().setUseSignedOffBy("Y".equals(rs.getString("use_signed_off_by"))); config.getProject().setRequireChangeID("Y".equals(rs.getString("require_change_id"))); config.getProject().setUseContentMerge("Y".equals(rs.getString("use_content_merge"))); config.getProject().setParentName(rs.getString("parent_name")); }</code><technical_language>Suggestion: do a Project project = config.project() changes this function some of lines stay shorter</technical_language>

Target:
private void loadProject(ResultSet rs, ProjectConfig config) throws SQLException, OrmException { final Project project = config.getProject(); project.setDescription(rs.getString("description")); project.setUseContributorAgreements("Y".equals(rs .getString("use_contributor_agreements"))); final char submitType = rs.getString("submit_type").charAt(0); final String name = rs.getString("name"); if (!(!name.equals("-- All Projects --") && submitType == 'M')) { final MergeStrategySection section = config.getMergeStrategySection("refs/*", true); switch (submitType) { case 'F': section .setSubmitType(MergeStrategySection.SubmitType.FAST_FORWARD_ONLY); break; case 'M': section .setSubmitType(MergeStrategySection.SubmitType.MERGE_IF_NECESSARY); break; case 'A': section.setSubmitType(MergeStrategySection.SubmitType.MERGE_ALWAYS); break; case 'C': section.setSubmitType(MergeStrategySection.SubmitType.CHERRY_PICK); break; default: throw new OrmException("Unsupported submit_type=" + rs.getString("submit_type") + " on project " + project.getName()); } section.setUseContentMerge("Y".equals(rs.getString("use_content_merge"))); } project.setUseSignedOffBy("Y".equals(rs.getString("use_signed_off_by"))); project.setRequireChangeID("Y".equals(rs.getString("require_change_id"))); project.setParentName(rs.getString("parent_name")); }
Source:
<code>public void signal(SignalPayload signalPayload) { runtimeService.signalEventReceived(signalPayload.getName(), signalPayload.getVariables()); <START> eventPublisher.publishEvent(signalPayload); <END> }</code><technical_language>@daisuke-yoshimoto signal() business method ProcessRuntimeImpl is transactional boundary, basically want fully succeed fully fail partially succeed is invoked client facade, i.e. Rest controller. So, sense define @Transactional annotation ProcessRuntime service layer remove @Transactional annotation sendSignal() method in ProcessInstanceControllerImpl class in order SignalPayload event published boundaries of a Spring managed transaction handled @TransactionalEventListener sendSignal() in SignalSender component. Otherwise, event discarded is existing managed transaction</technical_language>

Target:
public void signal(SignalPayload signalPayload) { eventPublisher.publishEvent(signalPayload); }
Source:
<code>private void cancelNameNodeToken(final Token<? extends TokenIdentifier> t, String userToProxy) throws HadoopSecurityManagerException { try { getProxiedUser(userToProxy).doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { cancelToken(t); return null; } private void cancelToken(Token<?> nt) throws IOException, InterruptedException { nt.cancel(conf); } }); } catch (Exception e) { e.printStackTrace(); <START> throw new HadoopSecurityManagerException("Failed to cancel Token. " <END> + e.getMessage() + e.getCause()); } }</code><technical_language>good pass exception a parameter HadoopSecurityManagerException constructor</technical_language>

Target:
private void cancelNameNodeToken(final Token<? extends TokenIdentifier> t, String userToProxy) throws HadoopSecurityManagerException { try { getProxiedUser(userToProxy).doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { cancelToken(t); return null; } private void cancelToken(Token<?> nt) throws IOException, InterruptedException { nt.cancel(conf); } }); } catch (Exception e) { throw new HadoopSecurityManagerException("Failed to cancel token. " + e.getMessage() + e.getCause(), e); } }
Source:
<code>public static Map<String, Integer> getScreenSizeMap(Context context) { DisplayMetrics metrics = context.getResources().getDisplayMetrics(); int orientation = context.getResources().getConfiguration().orientation; HashMap<String, Integer> screenMap = new HashMap<>(); switch (orientation) { case 1: screenMap.put("height", metrics.heightPixels); screenMap.put("width", metrics.widthPixels); break; case 2: screenMap.put("height", metrics.widthPixels); <START> screenMap.put("width", metrics.heightPixels); <END> } return screenMap; }</code><technical_language>add a break here</technical_language>

Target:
public static Map<String, Integer> getScreenSizeMap(Context context) { DisplayMetrics metrics = context.getResources().getDisplayMetrics(); int orientation = context.getResources().getConfiguration().orientation; HashMap<String, Integer> screenMap = new HashMap<>(); switch (orientation) { case Configuration.ORIENTATION_PORTRAIT: screenMap.put("height", metrics.heightPixels); screenMap.put("width", metrics.widthPixels); break; case Configuration.ORIENTATION_LANDSCAPE: screenMap.put("height", metrics.widthPixels); screenMap.put("width", metrics.heightPixels); break; } return screenMap; }
Source:
<code>public void testSingleToken() throws Exception { Grammar.NonTerminalId ntistart = new Grammar.NonTerminalId("StartNT"); Grammar.StateId stistart = new Grammar.StateId("StartState"); Grammar.StateId stiend = new Grammar.StateId("EndState"); Grammar.NonTerminal nt1 = new Grammar.NonTerminal(ntistart, stistart, new Grammar.State.OrderingInfo(0), stiend, new Grammar.State.OrderingInfo(100)); <START> Grammar.RegExState res = new Grammar.RegExState(new Grammar.StateId("RegExStid"), nt1, new Grammar.State.OrderingInfo(1), Pattern.compile("[a-zA-Z0-9]+"), null); <END> nt1.entryState.next.add(res); res.next.add(nt1.exitState); ParseState ps = new ParseState("asdfAAA1"); Parser parser = new Parser(ps); Term result = parser.parse(nt1, 0); Term expected = amb(klist(amb(klist(Token.kAppOf("K", "asdfAAA1"))))); assertEquals("Single Token check: ", expected, result); }</code><technical_language>this</technical_language>

Target:
public void testSingleToken() throws Exception { Grammar.NonTerminalId ntistart = new Grammar.NonTerminalId("StartNT"); Grammar.StateId stistart = new Grammar.StateId("StartState"); Grammar.StateId stiend = new Grammar.StateId("EndState"); Grammar.NonTerminal nt1 = new Grammar.NonTerminal(ntistart, stistart, new Grammar.State.OrderingInfo(0), stiend, new Grammar.State.OrderingInfo(100)); Grammar.RegExState res = new Grammar.RegExState(new Grammar.StateId("RegExStid"), nt1, new Grammar.State.OrderingInfo(1), Pattern.compile("[a-zA-Z0-9]+"), null); nt1.entryState.next.add(res); res.next.add(nt1.exitState); ParseState ps = new ParseState("asdfAAA1"); Parser parser = new Parser(ps); Term result = parser.parse(nt1, 0); Term expected = amb(klist(amb(klist(Token.kAppOf(KSorts.K, "asdfAAA1"))))); Assert.assertEquals("Single Token check: ", expected, result); Assert.assertEquals("Expected Nullable NTs", 2, NullabilityCheck.getReachableNullableStates(nt1).size()); }
Source:
<code>public KieServerConnectionInfo verifiedConnectionInfo(RemoteDataSetDef def) { String name = def.getName(); String serverTemplateId = def.getServerTemplateId(); String missingConfigError = String.format(CONFIGURATION_NOT_FOUND_MESSAGE, name, serverTemplateId); String missingUrlError = String.format(MISSING_URL_MESSAGE, name, serverTemplateId); String missingAuthError = String.format(MISSING_AUTH_MESSAGE, name, serverTemplateId); KieServerConnectionInfo connectionInfo = get(name, serverTemplateId).orElseThrow(() -> new RuntimeException(missingConfigError)); if (!connectionInfo.getLocation().isPresent()) { throw new RuntimeException(missingUrlError); } <START> if ((!connectionInfo.getUser().isPresent()) && (!connectionInfo.getToken().isPresent())) { throw new RuntimeException(missingAuthError); <END> } return connectionInfo; }</code><technical_language>suggestion if (!connectionInfo.getUser().isPresent() && !connectionInfo.getToken().isPresent()) {</technical_language>

Target:
public KieServerConnectionInfo verifiedConnectionInfo(RemoteDataSetDef def) { String name = def.getName(); String serverTemplateId = def.getServerTemplateId(); String missingConfigError = String.format(CONFIGURATION_NOT_FOUND_MESSAGE, name, serverTemplateId); String missingUrlError = String.format(MISSING_URL_MESSAGE, name, serverTemplateId); String missingAuthError = String.format(MISSING_AUTH_MESSAGE, name, serverTemplateId); KieServerConnectionInfo connectionInfo = get(name, serverTemplateId).orElseThrow(() -> new RuntimeException(missingConfigError)); if (!connectionInfo.getLocation().isPresent()) { throw new RuntimeException(missingUrlError); } if (!connectionInfo.getUser().isPresent() && !connectionInfo.getToken().isPresent()) { throw new RuntimeException(missingAuthError); } return connectionInfo; }
Source:
<code><START> PRED_current_user_1(Term a1, Operation n) { <END> arg1 = a1; cont = n; }</code><technical_language>public</technical_language>

Target:
public PRED_current_user_1(Term a1, Operation n) { arg1 = a1; cont = n; }
Source:
<code>private void setPluginConfigValues(ProjectConfig projectConfig, Map<String, Map<String, String>> pluginConfigValues) throws BadRequestException { for (Entry<String, Map<String, String>> e : pluginConfigValues.entrySet()) { String pluginName = e.getKey(); PluginConfig cfg = projectConfig.getPluginConfig(pluginName); for (Entry<String, String> v : e.getValue().entrySet()) { ProjectConfigEntry projectConfigEntry = pluginConfigEntries.get(pluginName, v.getKey()); if (projectConfigEntry != null) { if (!isValidParameterName(v.getKey())) { log.warn(String.format( "Parameter name '%s' must match '^[a-zA-Z0-9]+[a-zA-Z0-9-]*$'", v.getKey())); continue; } <START> if (v.getValue() == null) { <END> cfg.unset(v.getKey()); } else { cfg.setString(v.getKey(), v.getValue()); } } else { throw new BadRequestException(String.format( "The config parameter '%s' of plugin '%s' does not exist.", v.getKey(), pluginName)); } } } }</code><technical_language>I prefer write != null condition ind swap if branches, line 186</technical_language>

Target:
private void setPluginConfigValues(ProjectConfig projectConfig, Map<String, Map<String, String>> pluginConfigValues) throws BadRequestException { for (Entry<String, Map<String, String>> e : pluginConfigValues.entrySet()) { String pluginName = e.getKey(); PluginConfig cfg = projectConfig.getPluginConfig(pluginName); for (Entry<String, String> v : e.getValue().entrySet()) { ProjectConfigEntry projectConfigEntry = pluginConfigEntries.get(pluginName, v.getKey()); if (projectConfigEntry != null) { if (!isValidParameterName(v.getKey())) { log.warn(String.format( "Parameter name '%s' must match '^[a-zA-Z0-9]+[a-zA-Z0-9-]*$'", v.getKey())); continue; } if (v.getValue() != null) { cfg.setString(v.getKey(), v.getValue()); } else { cfg.unset(v.getKey()); } } else { throw new BadRequestException(String.format( "The config parameter '%s' of plugin '%s' does not exist.", v.getKey(), pluginName)); } } } }
Source:
<code>public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { FilterCreaturePermanent filter = StaticFilters.FILTER_PERMANENT_CREATURE.copy(); filter.add(new ControllerIdPredicate(source.getControllerId())); <START> game.addPowerInsteadOfToughnessForDamageLethalityFilter(source.getSourceId(), filter); <END> return true; }</code><technical_language>adds time, new filter for source next time (see putIfAbsent usage in addPowerInsteadOfToughnessForDamageLethalityFilter). potentially bugged I recommends change simple put</technical_language>

Target:
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { FilterCreaturePermanent filter = StaticFilters.FILTER_PERMANENT_CREATURE.copy(); filter.add(new ControllerIdPredicate(source.getControllerId())); game.getState().addPowerInsteadOfToughnessForDamageLethalityFilter(source.getSourceId(), filter); return true; }
Source:
<code>public String toString() { <START> return "DiscoverSpringRestnnotatedClasses"; <END> }</code><technical_language>Typo in return - I assume matter for class's correct operation noting in case</technical_language>

Target:
public String toString() { return "DiscoverSpringRestServicesRuleProvider"; }
Source:
<code>public void run() { final QueuedRequest firstRequest = messageStore.retrieveFirst(endpoint); if (firstRequest != null) { try { final DownlinkRequest<LwM2mResponse> downlinkRequest = firstRequest.getDownlinkRequest(); LOG.debug("Sending request: {}", downlinkRequest); final Client client = clientRegistry.get(firstRequest.getEndpoint()); if (client == null) { <START> LOG.debug("Client not registered anymore: {}", firstRequest.getEndpoint(), downlinkRequest); <END> } else { requestSender.send(client, downlinkRequest, new ResponseCallback<LwM2mResponse>() { @Override public void onResponse(LwM2mResponse response) { LOG.debug("request sent successfully: {}", downlinkRequest); processResponse(firstRequest, response); } }, new ErrorCallback() { @Override public void onError(Exception e) { LOG.debug("exception on sending the request: {}", downlinkRequest, e); if (e instanceof TimeoutException) { timeout(client); } else { processException(firstRequest, e); } } }); } } catch (RuntimeException e) { processException(firstRequest, e); } } else { LOG.debug("No more requests to send to client {}", endpoint); clientStatusTracker.stopClientReceiving(endpoint); } }</code><technical_language>isDebugEnabled</technical_language>

Target:
public void run() { try { executeAction(); } catch (Exception e) { LOG.info("error while executing runnable", e); throw new RuntimeException(e); } }
Source:
<code>public R get() { R entry = queue.poll(); if (entry == null) { if (completed.get()) { if (exception != null) { throw exception; } else if ((entry = queue.poll()) != null) { if (consumer != null) { consumer.accept(entry); } return entry; } return null; } nextLock.lock(); try { boolean interrupted = false; <START> while ((entry = queue.poll()) == null && !completed.get() && (entry = queue.poll()) == null) { <END> try { nextCondition.await(100, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { interrupted = true; } } if (entry == null) { if (exception != null) { throw exception; } return null; } else if (interrupted) { Thread.currentThread().interrupt(); } } finally { nextLock.unlock(); } } if (consumer != null && entry != null) { consumer.accept(entry); } return entry; }</code><technical_language>poll in a row</technical_language>

Target:
public R get() { R entry = queue.poll(); if (entry == null) { if (completed.get()) { if (exception != null) { throw exception; } else if ((entry = queue.poll()) != null) { if (consumer != null) { consumer.accept(entry); } return entry; } return null; } nextLock.lock(); try { boolean interrupted = false; while (!completed.get()) { if ((entry = queue.poll()) != null) { break; } try { nextCondition.await(100, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { interrupted = true; } } if (entry == null) { entry = queue.poll(); if (entry == null) { if (exception != null) { throw exception; } return null; } } else if (interrupted) { Thread.currentThread().interrupt(); } } finally { nextLock.unlock(); } } if (consumer != null && entry != null) { consumer.accept(entry); } return entry; }
Source:
<code>public void preGetOp(ObserverContext<RegionCoprocessorEnvironment> e, Get get, List<Cell> results) throws IOException { Transaction tx = getFromOperation(get); if (tx != null) { projectFamilyDeletes(get); get.setMaxVersions(); <START> get.setTimeRange(0, TxUtils.getMaxVisibleTimestamp(tx)); <END> Filter newFilter = Filters.combine(getTransactionFilter(tx, ScanType.USER_SCAN), get.getFilter()); get.setFilter(newFilter); } }</code><technical_language>I wonder, this a performance penalty. a bound, scan able optimize more, for example, prune store files need scanned (if a file timestamps bounds). pruning happen a (post) filter while scanning file. I prove a difference, I a feeling might</technical_language>

Target:
public void preGetOp(ObserverContext<RegionCoprocessorEnvironment> e, Get get, List<Cell> results) throws IOException { Transaction tx = getFromOperation(get); if (tx != null) { projectFamilyDeletes(get); get.setMaxVersions(); get.setTimeRange(TxUtils.getOldestVisibleTimestamp(ttlByFamily, tx, readNonTxnData), TxUtils.getMaxVisibleTimestamp(tx)); Filter newFilter = Filters.combine(getTransactionFilter(tx, ScanType.USER_SCAN), get.getFilter()); get.setFilter(newFilter); } }
Source:
<code>private ClassLoader loadBundlesJars(OSGiBundleConfig bundleConfig) { String bundlesJarsPath = bundleConfig.getBundlesJarsPath(); <START> if (bundlesJarsPath == null) <END> { return getClassLoader(); } JarClassLoader jcl = new JarClassLoader(); jcl.add(bundlesJarsPath + "/"); return new OSGiClassLoader(jcl, getClassLoader()); }</code><technical_language>@sidorovis do need this? I testing running component java 11 this change class loader returned getPlatformClassLoader breaks them</technical_language>

Target:
private ClassLoader loadBundlesJars(OSGiBundleConfig bundleConfig) { String bundlesJarsPath = bundleConfig.getBundlesJarsPath(); if (bundlesJarsPath == null) { return getPlatformClassLoader(); } JarClassLoader jcl = new JarClassLoader(); jcl.add(bundlesJarsPath + "/"); return new OSGiClassLoader(jcl, getPlatformClassLoader()); }
Source:
<code>public ChargeEntityFixture withWalletType(WalletType walletType) { <START> WalletType walletType1 = walletType; <END> return this; }</code><technical_language>this method is useless currently stands</technical_language>

Target:
public ChargeEntityFixture withWalletType(WalletType walletType) { this.walletType = walletType; return this; }
Source:
<code>public Rules rules() { try { return new RestRules( URI.create( <START> new JdkRequest(UriBuilder.fromUri(this.home).build()) <END> .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .assertXPath("/page/links/link[@rel='rules']") .xml() .xpath("/page/links/link[@rel='rules']/@href") .get(0) ), this.token ); } catch (IOException ex) { throw new IllegalStateException(ex); } }</code><technical_language>need UriBuilder</technical_language>

Target:
public Rules rules() { try { return new RestRules( URI.create( new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .assertXPath("/page/links/link[@rel='rules']") .xml() .xpath("/page/links/link[@rel='rules']/@href") .get(0) ), this.token ); } catch (IOException ex) { throw new IllegalStateException(ex); } }
Source:
<code>public HandleResolver() { handleResolvers.put(REMOTE_CONNECTOR_ID.toString(), new MaterializedHandleResolver(new RemoteHandleResolver())); handleResolvers.put("$system", new MaterializedHandleResolver(new SystemHandleResolver())); handleResolvers.put("$info_schema", new MaterializedHandleResolver(new InformationSchemaHandleResolver())); handleResolvers.put("$empty", new MaterializedHandleResolver(new EmptySplitHandleResolver())); <START> functionHandleResolvers.put("static", new MaterializedFunctionHandleResolver(new StaticFunctionNamespaceHandleResolver())); <END> }</code><technical_language>Do wanna mangle this in case a connector called static</technical_language>

Target:
public HandleResolver() { handleResolvers.put(REMOTE_CONNECTOR_ID.toString(), new MaterializedHandleResolver(new RemoteHandleResolver())); handleResolvers.put("$system", new MaterializedHandleResolver(new SystemHandleResolver())); handleResolvers.put("$info_schema", new MaterializedHandleResolver(new InformationSchemaHandleResolver())); handleResolvers.put("$empty", new MaterializedHandleResolver(new EmptySplitHandleResolver())); functionHandleResolvers.put("$static", new MaterializedFunctionHandleResolver(new StaticFunctionNamespaceHandleResolver())); }
Source:
<code>public String getNoTargetLabelContent(){ SelectionTarget target = this.model.getSelectionTarget(); switch(target){ <START> case TASK_TARGET: <END> return "No task selected"; case JOB_TARGET: return "No job selected"; default: return ""; } }</code><technical_language>label part of a field defined in SelectionTarget enum. This way, expected retrieved a call this.model.getSelectionTarget().getNoTargetLabelContent(), avoiding _switch_</technical_language>

Target:
public String getNoTargetLabelContent(){ SelectionTarget target = this.model.getSelectionTarget(); return target.noSelectionLabel; }
Source:
<code>public void testWhenAnyFirstError() { final Exception error = new RuntimeException("This task failed."); runTaskTest(new Callable<Task<?>>() { @Override public Task<?> call() throws Exception { final ArrayList<Task<Void>> tasks = new ArrayList<Task<Void>>(); final Task<Void> firstToCompleteError = Task.callInBackground(new Callable<Void>() { @Override public Void call() throws Exception { Thread.sleep(50); throw error; } }); tasks.addAll(launchTasksWithRandomCompletions(10)); tasks.add(firstToCompleteError); return Task.whenAny(tasks).continueWith(new Continuation<Task<?>, Object>() { @Override public Object then(Task<Task<?>> task) throws Exception { assertTrue(task.isCompleted()); assertFalse(task.isFaulted()); assertFalse(task.isCancelled()); assertEquals(task.getResult(), firstToCompleteError); assertTrue(task.getResult().isCompleted()); assertFalse(task.getResult().isCancelled()); <START> assertTrue(task.getResult().isFaulted()); <END> return null; } }); } }); }</code><technical_language>verify error</technical_language>

Target:
public void testWhenAnyFirstError() { final Exception error = new RuntimeException("This task failed."); runTaskTest(new Callable<Task<?>>() { @Override public Task<?> call() throws Exception { final ArrayList<Task<?>> tasks = new ArrayList<>(); final Task<String> firstToCompleteError = Task.callInBackground(new Callable<String>() { @Override public String call() throws Exception { Thread.sleep(50); throw error; } }); tasks.addAll(launchTasksWithRandomCompletions(5)); tasks.add(firstToCompleteError); tasks.addAll(launchTasksWithRandomCompletions(5)); return Task.whenAny(tasks).continueWith(new Continuation<Task<?>, Object>() { @Override public Object then(Task<Task<?>> task) throws Exception { assertTrue(task.isCompleted()); assertFalse(task.isFaulted()); assertFalse(task.isCancelled()); assertEquals(firstToCompleteError, task.getResult()); assertTrue(task.getResult().isCompleted()); assertFalse(task.getResult().isCancelled()); assertTrue(task.getResult().isFaulted()); assertEquals(error, task.getResult().getError()); return null; } }); } }); }
Source:
<code>public boolean tryLock(long timeValue, TimeUnit timeUnit, Object owner) { <START> synchronized (this.lock) { <END> if (owner.equals(this.owner)) { lockCount++; return true; } else if (this.owner == null) { this.owner = owner; lockCount ++; return true; } else { long endTime = System.currentTimeMillis() + timeUnit.toMillis(timeValue); while (this.owner != null && System.currentTimeMillis() < endTime) { try { waiters++; try { lock.wait(endTime - System.currentTimeMillis()); } finally { waiters--; } } catch (InterruptedException e) { throw new RuntimeException(e); } } if(this.owner == null) { this.owner = owner; lockCount++; return true; } else { return false; } } } }</code><technical_language>Add not-null assertion for owner, for lock(...)</technical_language>

Target:
public boolean tryLock(long timeValue, TimeUnit timeUnit, Object owner) { Assert.checkNotNullParam("owner", owner); synchronized (this.lock) { if (Objects.equals(owner, this.owner)) { lockCount++; return true; } else if (this.owner == null) { this.owner = owner; lockCount ++; return true; } else { long endTime = System.currentTimeMillis() + timeUnit.toMillis(timeValue); while (this.owner != null && System.currentTimeMillis() < endTime) { try { waiters++; try { lock.wait(endTime - System.currentTimeMillis()); } finally { waiters--; } } catch (InterruptedException e) { throw new RuntimeException(e); } } if(this.owner == null) { this.owner = owner; lockCount++; return true; } else { return false; } } } }
Source:
<code>public void testUsingIteratorButPartitionOccursAfterRetrievingRemoteValues() throws InterruptedException, TimeoutException, ExecutionException { Cache<MagicKey, String> cache0 = cache(0); cache0.put(new MagicKey(cache(1), cache(2)), "not-local"); cache0.put(new MagicKey(cache(0), cache(1)), "local"); CheckPoint iteratorCP = new CheckPoint(); iteratorCP.triggerForever(Mocks.BEFORE_RELEASE); iteratorCP.triggerForever(Mocks.AFTER_RELEASE); <START> blockUntilPublisherComplete(iteratorCP, cache0); <END> try (CloseableIterator<?> iterator = Closeables.iterator(cache0.entrySet().stream())) { assertTrue(iterator.hasNext()); iteratorCP.awaitStrict(Mocks.AFTER_INVOCATION, 10, TimeUnit.SECONDS); CheckPoint partitionCP = new CheckPoint(); blockNotifierPartitionStatusChanged(partitionCP, cache0); splitCluster(new int[]{0, 1}, new int[]{2, 3}); partitionCP.triggerForever(Mocks.BEFORE_RELEASE); partitionCP.triggerForever(Mocks.AFTER_RELEASE); while (iterator.hasNext()) { iterator.next(); } } }</code><technical_language>method name suggests waiting for event here, implementation publisher is block unblock it? blockUntilRemoteNodesRespond() problem of appearing block current thread call site blocking else</technical_language>

Target:
public void testUsingIteratorButPartitionOccursAfterRetrievingRemoteValues() throws InterruptedException, TimeoutException, ExecutionException { Cache<MagicKey, String> cache0 = cache(0); cache0.put(new MagicKey(cache(1), cache(2)), "not-local"); cache0.put(new MagicKey(cache(0), cache(1)), "local"); CheckPoint iteratorCP = new CheckPoint(); registerBlockingPublisher(iteratorCP, cache0); iteratorCP.triggerForever(Mocks.BEFORE_RELEASE); iteratorCP.triggerForever(Mocks.AFTER_RELEASE); try (CloseableIterator<?> iterator = Closeables.iterator(cache0.entrySet().stream())) { assertTrue(iterator.hasNext()); iteratorCP.awaitStrict(Mocks.AFTER_INVOCATION, 10, TimeUnit.SECONDS); CheckPoint partitionCP = new CheckPoint(); registerBlockingCacheNotifierOnDegradedMode(partitionCP, cache0); splitCluster(new int[]{0, 1}, new int[]{2, 3}); partitionCP.triggerForever(Mocks.BEFORE_RELEASE); partitionCP.triggerForever(Mocks.AFTER_RELEASE); while (iterator.hasNext()) { iterator.next(); } } }
Source:
<code>public static StoragePool map(DataCenter model, StoragePool template) { StoragePool entity = template != null ? template : new StoragePool(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setName(model.getName()); } if (model.isSetDescription()) { entity.setdescription(model.getDescription()); } if (model.isSetComment()) { entity.setComment(model.getComment()); } if (model.isSetLocal()) { entity.setIsLocal(model.isLocal()); } if (model.isSetStorageFormat()) { entity.setStoragePoolFormatType(StorageFormatMapper.map(model.getStorageFormat(), null)); } if (model.isSetVersion() && model.getVersion().getMajor() != null && model.getVersion().getMinor() != null) { entity.setCompatibilityVersion(VersionMapper.map(model.getVersion())); } if (model.isSetMacPool()) { MacPool macPool = model.getMacPool(); if (macPool.isSetId()) { entity.setMacPoolId(GuidUtils.asGuid(macPool.getId())); <START> } else if (macPool.isSetName()) { entity.setMacPoolId(null); <END> } } if (model.isSetQuotaMode()) { entity.setQuotaEnforcementType(map(model.getQuotaMode())); } return entity; }</code><technical_language>want copy name model BE</technical_language>

Target:
public static StoragePool map(DataCenter model, StoragePool template) { StoragePool entity = template != null ? template : new StoragePool(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setName(model.getName()); } if (model.isSetDescription()) { entity.setdescription(model.getDescription()); } if (model.isSetComment()) { entity.setComment(model.getComment()); } if (model.isSetLocal()) { entity.setIsLocal(model.isLocal()); } if (model.isSetStorageFormat()) { entity.setStoragePoolFormatType(StorageFormatMapper.map(model.getStorageFormat(), null)); } if (model.isSetVersion() && model.getVersion().getMajor() != null && model.getVersion().getMinor() != null) { entity.setCompatibilityVersion(VersionMapper.map(model.getVersion())); } if (model.isSetMacPool() && model.getMacPool().isSetId()) { entity.setMacPoolId(GuidUtils.asGuid(model.getMacPool().getId())); } if (model.isSetQuotaMode()) { entity.setQuotaEnforcementType(map(model.getQuotaMode())); } return entity; }
Source:
<code>protected int parseInt(String fieldName) { JsonNode field = getJson().findValue(fieldName); <START> if (field == null || field.isNull()) { <END> return 0; } return field.asInt(); }</code><technical_language>findValue(x) searches x recursively in node, children. Is this want here? I get(x)</technical_language>

Target:
protected int parseInt(String fieldName) { JsonNode field = getJson().get(fieldName); if (field == null || field.isNull()) { return 0; } return field.asInt(); }
Source:
<code>private DemoAdapter() { for (int i = 0; i < <START> 80; i++) <END> { mItems.add(getItemText(i)); } }</code><technical_language>Pull this a static final variable</technical_language>

Target:
private DemoAdapter() { for (int i = 0; i < sSize; i++) { mItems.add("Item " + i); } }
Source:
<code><START> WorkerErrantRecordReporter workerErrantRecordReporter() { <END> return workerErrantRecordReporter; }</code><technical_language>add protected symmetric other fields accessed context scope</technical_language>

Target:
protected WorkerErrantRecordReporter workerErrantRecordReporter() { return workerErrantRecordReporter; }
Source:
<code>public String[] getLocations() throws IOException { <START> <END> }</code><technical_language>This compile return locations</technical_language>

Target:
public String[] getLocations() throws IOException { return locations; }
Source:
<code>public DataTypeListItem getItem() { <START> return this.item; <END> }</code><technical_language>for consistency, do need keyword this here, getter of isEditModeEnabled</technical_language>

Target:
public DataTypeListItem getItem() { return item; }
Source:
<code><START> private void updateActionAvailability() { <END> if (getSelectedItems() == null || getSelectedItems().size() == 0) { getEnableHookCommand().setIsExecutionAllowed(false); getDisableHookCommand().setIsExecutionAllowed(false); return; } getEnableHookCommand().setIsExecutionAllowed(true); getDisableHookCommand().setIsExecutionAllowed(true); for (Object item : getSelectedItems()) { GlusterHookEntity hook = (GlusterHookEntity) item; if (hook.getStatus() == GlusterHookStatus.ENABLED) { getEnableHookCommand().setIsExecutionAllowed(false); } else if (hook.getStatus() == GlusterHookStatus.DISABLED) { getDisableHookCommand().setIsExecutionAllowed(false); } if (!getEnableHookCommand().getIsExecutionAllowed() && !getDisableHookCommand().getIsExecutionAllowed()) { break; } } }</code><technical_language>calls 'setIsExecutionAllowed(' in this method, do say</technical_language>

Target:
private void updateActionAvailability() { boolean allowEnable = true; boolean allowDisable = true; if (getSelectedItems() == null || getSelectedItems().size() == 0) { allowEnable = false; allowDisable = false; } else { for (Object item : getSelectedItems()) { GlusterHookEntity hook = (GlusterHookEntity) item; if (hook.getStatus() == GlusterHookStatus.ENABLED) { allowEnable = false; } else if (hook.getStatus() == GlusterHookStatus.DISABLED) { allowDisable = false; } if (!allowEnable && !allowDisable) { break; } } } getEnableHookCommand().setIsExecutionAllowed(allowEnable); getDisableHookCommand().setIsExecutionAllowed(allowDisable); }
Source:
<code>private static void doAppendEscapedLiteral(Appendable sbuf, String value, boolean standardConformingStrings) throws SQLException { try { if (standardConformingStrings) { <START> for (char ch : value.toCharArray()) { <END> if (ch == '\0') { throw new PSQLException(GT.tr("Zero bytes may not occur in string parameters."), PSQLState.INVALID_PARAMETER_VALUE); } if (ch == '\'') { sbuf.append('\''); } sbuf.append(ch); } } else { for (char ch : value.toCharArray()) { if (ch == '\0') { throw new PSQLException(GT.tr("Zero bytes may not occur in string parameters."), PSQLState.INVALID_PARAMETER_VALUE); } if (ch == '\\' || ch == '\'') { sbuf.append(ch); } sbuf.append(ch); } } } catch (IOException e) { throw new PSQLException(GT.tr("No IOException expected from StringBuffer or StringBuilder"), PSQLState.UNEXPECTED_ERROR, e); } }</code><technical_language>I if this change result array allocation extra cpu/memory consumption issues</technical_language>

Target:
private static void doAppendEscapedLiteral(Appendable sbuf, String value, boolean standardConformingStrings) throws SQLException { try { if (standardConformingStrings) { for (int i = 0; i < value.length(); ++i) { char ch = value.charAt(i); if (ch == '\0') { throw new PSQLException(GT.tr("Zero bytes may not occur in string parameters."), PSQLState.INVALID_PARAMETER_VALUE); } if (ch == '\'') { sbuf.append('\''); } sbuf.append(ch); } } else { for (int i = 0; i < value.length(); ++i) { char ch = value.charAt(i); if (ch == '\0') { throw new PSQLException(GT.tr("Zero bytes may not occur in string parameters."), PSQLState.INVALID_PARAMETER_VALUE); } if (ch == '\\' || ch == '\'') { sbuf.append(ch); } sbuf.append(ch); } } } catch (IOException e) { throw new PSQLException(GT.tr("No IOException expected from StringBuffer or StringBuilder"), PSQLState.UNEXPECTED_ERROR, e); } }
Source:
<code>public synchronized void manage(ManagedBean mBean, String name) { <START> if (mBeanServer != null) { <END> ManagementUtils.register(mBeanServer, mBean, mBean.getType(), name); } mbeans.put(new Key(mBean, name), mBean); }</code><technical_language>[curiosity] Is expected beans registered mBeanServer is set yet</technical_language>

Target:
public synchronized void manage(ManagedBean mBean, String name) { if (mBeanServer.isPresent()) { ManagementUtils.register(mBeanServer.get(), mBean, mBean.getType(), name); } mbeans.put(new Key(mBean, name), mBean); }
Source:
<code>public void handleError(Throwable throwable, CarbonMessage carbonMessage, CarbonCallback carbonCallback) { <START> if (carbonCallback != null) { <END> carbonMessage .setProperty(JMSConstants.JMS_MESSAGE_DELIVERY_STATUS, JMSConstants.JMS_MESSAGE_DELIVERY_ERROR); carbonCallback.done(carbonMessage); } else { if (throwable instanceof RuntimeException) { handleError((RuntimeException) throwable); } } }</code><technical_language>is a good practice flip null check</technical_language>

Target:
public void handleError(Throwable throwable, CarbonMessage carbonMessage, CarbonCallback carbonCallback) { if (carbonCallback != null) { carbonMessage .setProperty(JMSConstants.JMS_MESSAGE_DELIVERY_STATUS, JMSConstants.JMS_MESSAGE_DELIVERY_ERROR); carbonCallback.done(carbonMessage); } else { throw (RuntimeException) throwable; } }