auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public int compareTo(StoreKey o) { BlobId other = (BlobId) o; int result = version.compareTo(other.version); if (result == 0) { result = flag.compareTo(other.flag); if (result == 0) { result = datacenterId.compareTo(other.datacenterId); if (result == 0) { result = accountId.compareTo(other.accountId); if (result == 0) { <START> result = containerId.compareTo(other.containerId); <END> if (result == 0) { result = partitionId.compareTo(other.partitionId); if (result == 0) { result = uuid.compareTo(other.uuid); } } } } } } return result; }</code><technical_language>do multiple if loops. if (result == 0) { result = flag.compareTo(other.flag); } if (result == 0) { result = datacenterId.compareTo(other.datacenterId); } if (result == 0) { result = accountId.compareTo(other.accountId); } if (result == 0) { result = containerId.compareTo(other.containerId); } if (result == 0) { result = partitionId.compareTo(other.partitionId); } if (result == 0) { result = uuid.compareTo(other.uuid); }</technical_language>

Target:
public int compareTo(StoreKey o) { BlobId other = (BlobId) o; int result = version.compareTo(other.version); if (result == 0) { switch (version) { case BLOB_ID_V1: result = partitionId.compareTo(other.partitionId); if (result == 0) { result = uuid.compareTo(other.uuid); } break; case BLOB_ID_V2: result = flag.compareTo(other.flag); if (result == 0) { result = datacenterId.compareTo(other.datacenterId); if (result == 0) { result = accountId.compareTo(other.accountId); if (result == 0) { result = containerId.compareTo(other.containerId); if (result == 0) { result = partitionId.compareTo(other.partitionId); if (result == 0) { result = uuid.compareTo(other.uuid); } } } } } break; default: throw new IllegalArgumentException("Unrecognized blobId version " + version); } } return result; }
Source:
<code>public void jobSucceeded(final UUID reportId, final Organization organization, final Instant scheduled, final Report.Result result) { assertIsOpen(); <START> if (!(result instanceof DefaultReportResult)) { <END> throw new UnsupportedOperationException("Unsupported result type"); } final DefaultReportResult resultImpl = (DefaultReportResult) result; updateExecutionState( reportId, organization, scheduled, ReportExecution.State.SUCCESS, execution -> { execution.setCompletedAt(Instant.now()); execution.setResult(resultImpl); } ); }</code><technical_language>do need cast this? internal interface model expose details necessary for serialization</technical_language>

Target:
public void jobSucceeded(final UUID reportId, final Organization organization, final Instant scheduled, final Report.Result result) { assertIsOpen(); updateExecutionState( reportId, organization, scheduled, ReportExecution.State.SUCCESS, result, null ); }
Source:
<code>public static IPackageFragment[] getPackageAndSubpackages(IPackageFragment pack) throws JavaModelException { if (pack.isDefaultPackage()) return new IPackageFragment[] { pack }; IPackageFragmentRoot root= (IPackageFragmentRoot) pack.getParent(); ArrayList<IPackageFragment> subpackages= new ArrayList<>(); subpackages.add(pack); String prefix= pack.getElementName() + '.'; <START> for (IJavaElement allPackage : root.getChildren()) { <END> IPackageFragment currentPackage = (IPackageFragment) allPackage; if (currentPackage.getElementName().startsWith(prefix)) subpackages.add(currentPackage); } return subpackages.toArray(new IPackageFragment[subpackages.size()]); }</code><technical_language>change package</technical_language>

Target:
public static IPackageFragment[] getPackageAndSubpackages(IPackageFragment pack) throws JavaModelException { if (pack.isDefaultPackage()) return new IPackageFragment[] { pack }; IPackageFragmentRoot root= (IPackageFragmentRoot) pack.getParent(); ArrayList<IPackageFragment> subpackages= new ArrayList<>(); subpackages.add(pack); String prefix= pack.getElementName() + '.'; for (IJavaElement packageFragment : root.getChildren()) { IPackageFragment currentPackage = (IPackageFragment) packageFragment; if (currentPackage.getElementName().startsWith(prefix)) subpackages.add(currentPackage); } return subpackages.toArray(new IPackageFragment[subpackages.size()]); }
Source:
<code>protected String createPayload(Volume.Request.CreatePayload payload) { dataCenterId = payload.dataCenterId(); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("size", payload.size()); if (payload.name() != null) properties.put("name", payload.name()); if (payload.bus() != null) properties.put("bus", payload.bus()); if (payload.type() != null) properties.put("type", payload.type()); if (payload.imagePassword() != null) properties.put("imagePassword", payload.imagePassword()); if (payload.image() != null) properties.put("image", payload.image()); else if (payload.licenceType() != null) properties.put("licenceType", payload.licenceType()); requestBuilder.put("properties", properties); <START> return (new Gson()).toJson(requestBuilder); <END> }</code><technical_language>Json object, [here](<LINK_0></technical_language>

Target:
protected String createPayload(Volume.Request.CreatePayload payload) { checkNotNull(payload.dataCenterId(), "dataCenterId"); dataCenterId = payload.dataCenterId(); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("size", payload.size()); if (payload.name() != null) properties.put("name", payload.name()); if (payload.bus() != null) properties.put("bus", payload.bus()); if (payload.type() != null) properties.put("type", payload.type()); if (payload.imagePassword() != null) properties.put("imagePassword", payload.imagePassword()); if (payload.image() != null) properties.put("image", payload.image()); else if (payload.licenceType() != null) properties.put("licenceType", payload.licenceType()); requestBuilder.put("properties", properties); return jsonBinder.toJson(requestBuilder); }
Source:
<code>private static List<HostAddress> getHostAddresses(BlockLocation blockLocation) { ImmutableList.Builder<HostAddress> builder = ImmutableList.builder(); String[] hosts; try { hosts = blockLocation.getHosts(); } catch (IOException e) { throw new UncheckedIOException(e); } <START> for (String host : hosts) { <END> builder.add(HostAddress.fromString(host)); } return builder.build(); }</code><technical_language>java return Arrays.stream(hosts) .map(HostAddress::fromString) .collect(toImmutableList());</technical_language>

Target:
private static List<HostAddress> getHostAddresses(BlockLocation blockLocation) { String[] hosts; try { hosts = blockLocation.getHosts(); } catch (IOException e) { throw new UncheckedIOException(e); } return Arrays.stream(hosts) .map(HostAddress::fromString) .collect(toImmutableList()); }
Source:
<code>public void publish(String topic, Integer qos, byte[] payload) throws MqttPersistenceException, MqttException { MqttMessage message = null; if (client == null || !client.isConnected()) { connect(url); } message = new MqttMessage(payload); message.setQos(qos); String time = new Timestamp(System.currentTimeMillis()).toString(); log.info("Publishing at: " + time + " to topic \"" + topic + "\" qos " + qos); <START> client.publish(topic, message, "Pub sample context", this); <END> }</code><technical_language>"Pub sample context" a weird hardcoded value</technical_language>

Target:
public void publish(String topic, Integer qos, byte[] payload) throws MqttPersistenceException, MqttException { MqttMessage message = null; if (client == null || !client.isConnected()) { connect(url); } message = new MqttMessage(payload); message.setQos(qos); String time = new Timestamp(System.currentTimeMillis()).toString(); log.info("Publishing at: " + time + " to topic \"" + topic + "\" qos " + qos); client.publish(topic, message, userContext, this); }
Source:
<code>public PrestoThriftService anyHostClient() { <START> return new RetryingService(() -> (DefaultPrestoThriftService) original.anyHostClient(), retry); <END> }</code><technical_language>This code violates abstractions creates tight coupling components. In this case working interface, instead depend another service giving object need. Try approach. Extend PrestoThriftService interface add getLocation() method it. wrappers, hidden Default Retrying providers work interfaces</technical_language>

Target:
public PrestoThriftService anyHostClient() { return new RetryingService(original::anyHostClient, retry, stats); }
Source:
<code>public ExecutePlanningResult executePlanning(PlanningItemList planningItemList, String userId) { if (config.isRest()) { final String uri = TASK_ASSIGNING_RUNTIME_URI + "/" + TASK_ASSIGNING_EXECUTE_PLANNING_URI + "?user=" + userId; return makeHttpPostRequestAndCreateCustomResponse(RestURI.build(loadBalancer.getUrl(), uri, Collections.emptyMap()), planningItemList, ExecutePlanningResult.class); } else { <START> throw new KieServicesException("JMS protocol is not implemented for this service."); <END> } }</code><technical_language>get this? Is normal some KIE server components implement JMS, REST</technical_language>

Target:
public PlanningExecutionResult executePlanning(PlanningItemList planningItemList, String userId) { if (config.isRest()) { final String uri = TASK_ASSIGNING_RUNTIME_URI + "/" + TASK_ASSIGNING_EXECUTE_PLANNING_URI + "?user=" + userId; return makeHttpPostRequestAndCreateCustomResponse(RestURI.build(loadBalancer.getUrl(), uri, Collections.emptyMap()), planningItemList, PlanningExecutionResult.class); } else { throw new KieServicesException("JMS protocol is not implemented for this service."); } }
Source:
<code>protected String getServerAddress(final Server server) { final String ipAddress = (UtilMethods.isSet(server.getHost()) && !server.getHost().equals("localhost")) ? server.getHost() : server.getIpAddress(); final String port = Integer.toString(server.getEsTransportTcpPort()); <START> return ipAddress + ":" + port; <END> }</code><technical_language>replaced StringPool.COLON</technical_language>

Target:
protected String getServerAddress(final Server server) { final String ipAddress = (UtilMethods.isSet(server.getHost()) && !server.getHost().equals("localhost")) ? server.getHost() : server.getIpAddress(); final String port = Integer.toString(server.getEsTransportTcpPort()); return ipAddress + StringPool.COLON + port; }
Source:
<code>ParseObject getParent() { if(parent == null){ return null; } if(parent.get() == null){ <START> return ParseDecoder.get().decodePointer(parentClassName, parentObjectId); <END> } return parent.get(); }</code><technical_language>ParseObject.createWithoutData(String, String) instead more concise</technical_language>

Target:
ParseObject getParent() { if(parent == null){ return null; } if(parent.get() == null){ return ParseObject.createWithoutData(parentClassName, parentObjectId); } return parent.get(); }
Source:
<code>public void showFailure() { <START> setCenter(failurePanel); <END> }</code><technical_language>I call closeDetailsView too</technical_language>

Target:
public void showFailure() { closeDetailsView(); setCenter(failurePanel); }
Source:
<code>public void init() { Map<String, Class<? extends Check>> checks = new HashMap<>(); checks.put("allow all", com.yahoo.elide.security.checks.prefab.Role.ALL.class); <START> checks.put("allow all", com.yahoo.elide.security.checks.prefab.Role.ALL.class); <END> dictionary = new EntityDictionary(checks); dictionary.bindEntity(Book.class); dictionary.bindEntity(Author.class); dictionary.bindEntity(Publisher.class); dictionary.bindEntity(Pseudonym.class); dictionary.bindEntity(Address.class); }</code><technical_language>remove of lines</technical_language>

Target:
public void init() { Map<String, Class<? extends Check>> checks = new HashMap<>(); checks.put("allow all", com.yahoo.elide.security.checks.prefab.Role.ALL.class); dictionary = new EntityDictionary(checks); dictionary.bindEntity(Book.class); dictionary.bindEntity(Author.class); dictionary.bindEntity(Publisher.class); dictionary.bindEntity(Pseudonym.class); dictionary.bindEntity(Address.class); }
Source:
<code>CompletionStage<Void> forget(Xid externalXid) { Xid xid = convertXid(externalXid); if (trace) log.tracef("forget called for xid %s", xid); if (isRecoveryEnabled()) { return recoveryManager.removeRecoveryInformation(null, xid, null, false) .exceptionally(t -> { log.warnExceptionRemovingRecovery(t); XAException xe = new XAException(XAException.XAER_RMERR); xe.initCause(t); <START> throw CompletableFutures.asCompletionException(xe); <END> }); } else { if (trace) log.trace("Recovery not enabled"); } return CompletableFutures.completedNull(); }</code><technical_language>100% xe is a CompletionException, I find throw new CompletionException(xe) clearer</technical_language>

Target:
CompletionStage<Void> forget(Xid externalXid) { Xid xid = convertXid(externalXid); if (trace) log.tracef("forget called for xid %s", xid); if (isRecoveryEnabled()) { return recoveryManager.removeRecoveryInformation(null, xid, null, false) .exceptionally(t -> { log.warnExceptionRemovingRecovery(t); XAException xe = new XAException(XAException.XAER_RMERR); xe.initCause(t); throw new CompletionException(xe); }); } else { if (trace) log.trace("Recovery not enabled"); } return CompletableFutures.completedNull(); }
Source:
<code>public CompileToJarStepFactory configure( @Nullable JvmLibraryArg args, JavacOptions javacOptions, BuildRuleResolver buildRuleResolver, ToolchainProvider toolchainProvider) { CoreArg kotlinArgs = Objects.requireNonNull((CoreArg) args); return new KotlincToJarStepFactory( kotlinBuckConfig.getKotlinc(), kotlinBuckConfig.getKotlinHomeLibraries(), kotlinArgs.getExtraKotlincArguments(), kotlinArgs.getAnnotationProcessingTool().orElse(AnnotationProcessingTool.KAPT), kotlinArgs.getKaptApOptions(), <START> extraClasspathProviderSupplier.apply(toolchainProvider), <END> getJavac(buildRuleResolver, args), javacOptions); }</code><technical_language>good support macros in kaptApOptions (eg macro usage in vm_args - <LINK_0></technical_language>

Target:
public CompileToJarStepFactory configure( @Nullable JvmLibraryArg args, JavacOptions javacOptions, BuildRuleResolver buildRuleResolver, ToolchainProvider toolchainProvider) { CoreArg kotlinArgs = Objects.requireNonNull((CoreArg) args); return new KotlincToJarStepFactory( kotlinBuckConfig.getKotlinc(), kotlinBuckConfig.getKotlinHomeLibraries(), kotlinArgs.getExtraKotlincArguments(), kotlinArgs.getFriendPaths(), kotlinArgs.getAnnotationProcessingTool().orElse(AnnotationProcessingTool.KAPT), kotlinArgs.getKaptApOptions(), extraClasspathProviderSupplier.apply(toolchainProvider), getJavac(buildRuleResolver, args), javacOptions); }
Source:
<code>private static String urlDecode(String str) { try { <START> return (str == null)? null : URLDecoder.decode(str, UTF_8); <END> } catch(UnsupportedEncodingException e) { throw new RuntimeException("UTF-8 is not supported on this system", e); } }</code><technical_language>OCD: missing space )</technical_language>

Target:
private static String urlDecode(String str) { try { return str == null ? null : URLDecoder.decode(str, UTF_8); } catch (UnsupportedEncodingException e) { throw new RuntimeException("UTF-8 is not supported on this system", e); } }
Source:
<code>private <T extends HttpResponse> Promise<T> intercept(Promise<T> promise, Action<? super HttpResponse> action, Action<? super Throwable> errorAction) { <START> return promise.onError(Exception.class, t -> { <END> errorAction.execute(t); throw t; }) .next(r -> ExecController.require() .fork() .eventLoop(Execution.current().getEventLoop()) .start(e -> action.execute(r) ) ); }</code><technical_language>Promise.wireTap(Action<Result>) in order register error action is inline promise chain execution. This allow handle re-throw Throwable. execute errorAction in a forked execution do response interceptor. add blocking code impacting main program flow</technical_language>

Target:
private <T extends HttpResponse> Promise<T> intercept(Promise<T> promise, Action<? super HttpResponse> action, Action<? super Throwable> errorAction) { return promise.wiretap(r -> { if (r.isError()) { ExecController.require() .fork() .eventLoop(Execution.current().getEventLoop()) .start(e -> errorAction.execute(r.getThrowable()) ); } }) .next(r -> ExecController.require() .fork() .eventLoop(Execution.current().getEventLoop()) .start(e -> action.execute(r) ) ); }
Source:
<code>private static InfinispanModel getModelVersion(ModelTestControllerVersion controllerVersion) { switch (controllerVersion) { case EAP_6_4_0: case EAP_6_4_7: return InfinispanModel.VERSION_1_6_0; case EAP_7_0_0: return InfinispanModel.VERSION_4_0_0; case EAP_7_1_0: return InfinispanModel.VERSION_5_0_0; case EAP_7_2_0_TEMP: <START> return InfinispanModel.VERSION_8_0_0; <END> default: throw new IllegalArgumentException(); } }</code><technical_language>@pferraro core upgrade merged this changed EAP_7_2_0</technical_language>

Target:
private static InfinispanModel getModelVersion(ModelTestControllerVersion controllerVersion) { switch (controllerVersion) { case EAP_6_4_0: case EAP_6_4_7: return InfinispanModel.VERSION_1_6_0; case EAP_7_0_0: return InfinispanModel.VERSION_4_0_0; case EAP_7_1_0: return InfinispanModel.VERSION_5_0_0; case EAP_7_2_0: return InfinispanModel.VERSION_8_0_0; default: throw new IllegalArgumentException(); } }
Source:
<code>private JavacEnvironment createEnvironment(String path, String source) throws IOException { List<JavaFileObject> inputFiles = new ArrayList<>(); inputFiles.add(MemoryFileObject.createJavaFile(path, source)); <START> return createEnvironment(Collections.emptyList(), inputFiles, false, null); <END> }</code><technical_language>Revert</technical_language>

Target:
private JavacEnvironment createEnvironment(String path, String source) throws IOException { List<JavaFileObject> inputFiles = new ArrayList<>(); inputFiles.add(MemoryFileObject.createJavaFile(path, source)); return createEnvironment(Collections.emptyList(), inputFiles, false); }
Source:
<code>public void setSelectableItems(List<FilterDropdownRecordWidget<ListType>> resultDisplayItems) { hasResults = !(resultDisplayItems.size() == 0); this.resultDisplayItems = resultDisplayItems; if (hasResults) { mainPanel.clear(); int count = 0; for (final FilterDropdownRecordWidget<ListType> displayItem : this.resultDisplayItems) { if (count > 0) { SimplePanel recordsSplitter = new SimplePanel(); <START> recordsSplitter.setHeight("1px"); <END> recordsSplitter.setStyleName("itemSplitter"); mainPanel.add(recordsSplitter); } mainPanel.add(displayItem); displayItem.addMouseOverHandler(new MouseOverHandler() { @Override public void onMouseOver(MouseOverEvent event) { displayItem.setSelectedState(true); } }); displayItem.addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent event) { displayItem.setSelectedState(false); } }); count++; } } else { addInfoMessages(); } }</code><technical_language>this style added</technical_language>

Target:
public void setSelectableItems(List<FilterDropdownRecordWidget<ListType>> resultDisplayItems) { hasResults = !(resultDisplayItems.size() == 0); this.resultDisplayItems = resultDisplayItems; if (hasResults) { mainPanel.clear(); int count = 0; for (final FilterDropdownRecordWidget<ListType> displayItem : this.resultDisplayItems) { if (count > 0) { SimplePanel recordsSplitter = new SimplePanel(); recordsSplitter.setStyleName("itemSplitter"); mainPanel.add(recordsSplitter); } mainPanel.add(displayItem); displayItem.addMouseOverHandler(new MouseOverHandler() { @Override public void onMouseOver(MouseOverEvent event) { displayItem.setSelectedState(true); } }); displayItem.addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent event) { displayItem.setSelectedState(false); } }); count++; } } else { addInfoMessages(); } }
Source:
<code>public DiskWriteModel getDisk(int deviceId) { return fDisks.computeIfAbsent(deviceId, <START> dev -> <END> new DiskWriteModel(dev, checkNotNull(getStateSystemBuilder()))); }</code><technical_language>if this is a name</technical_language>

Target:
public DiskWriteModel getDisk(int deviceId) { return fDisks.computeIfAbsent(deviceId, diskId -> new DiskWriteModel(diskId, checkNotNull(getStateSystemBuilder()))); }
Source:
<code>public String getStateTypeName() { <START> return checkNotNull(Messages.FlameGraph_Depth); <END> }</code><technical_language>Objects.requireNonNull</technical_language>

Target:
public String getStateTypeName() { return Objects.requireNonNull(Messages.FlameGraph_Depth); }
Source:
<code>public SystemOption get() { try { ConfigValues config = ConfigValues.valueOf(id); GetSystemOptionParameters parameters = new GetSystemOptionParameters(config); String version = ParametersHelper.getParameter(httpHeaders, uriInfo, <START> "version"); <END> if (version != null && !version.isEmpty()) { parameters.setOptionVersion(version); } QueryReturnValue result = runQuery(QueryType.GetSystemOption, parameters); if (result.getReturnValue() == null) { return handleError(new EntityNotFoundException(id), true); } return LinkHelper.addLinks(SystemOptionsMapper.map(result.getReturnValue(), id)); } catch (IllegalArgumentException ex) { return handleError(new EntityNotFoundException(id), true); } }</code><technical_language>constant here</technical_language>

Target:
public SystemOption get() { ConfigValues config; try { config = ConfigValues.valueOf(id); } catch (IllegalArgumentException ex) { throw new WebApplicationException(Response.Status.NOT_FOUND); } GetSystemOptionParameters parameters = new GetSystemOptionParameters(config); String version = ParametersHelper.getParameter(httpHeaders, uriInfo, VERSION); if (version != null && !version.isEmpty()) { parameters.setOptionVersion(version); } QueryReturnValue result = runQuery(QueryType.GetSystemOption, parameters); if (result.getReturnValue() == null) { throw new WebApplicationException(Response.Status.NOT_FOUND); } return LinkHelper.addLinks(SystemOptionsMapper.map(result.getReturnValue(), id)); }
Source:
<code>public void contextInitialized(final ServletContextEvent event) { try { Manifests.append(event.getServletContext()); } catch (final IOException ex) { throw new IllegalStateException(ex); } final Base base; <START> if (StringUtils.startsWith( <END> Manifests.read("Thindeck-DynamoKey"), "${" )) { base = new MnBase(); } else { base = new DyBase(this.dynamo()); } event.getServletContext().setAttribute(Base.class.getName(), base); this.daemons.add(new RoutineTxns(base)); }</code><technical_language>StringUtils, while String.startWith()? Manifests.read() returns null</technical_language>

Target:
public void contextInitialized(final ServletContextEvent event) { try { Manifests.append(event.getServletContext()); } catch (final IOException ex) { throw new IllegalStateException(ex); } final Base base; if (Manifests.read("Thindeck-DynamoKey").startsWith("${")) { base = new MnBase(); } else { base = new DyBase(this.dynamo()); } event.getServletContext().setAttribute(Base.class.getName(), base); this.daemons.add(new RoutineTxns(base)); }
Source:
<code>private void populateFilters() { this.testingCheck = new LeftCheckBox(tr("Testing")); this.testingCheck.selectedProperty().bindBidirectional(filter.containTestingApplicationsProperty()); this.requiresPatchCheck = new LeftCheckBox(tr("Requires patch")); this.requiresPatchCheck.selectedProperty().bindBidirectional(filter.containRequiresPatchApplicationsProperty()); this.commercialCheck = new LeftCheckBox(tr("Commercial")); this.commercialCheck.selectedProperty().bindBidirectional(filter.containCommercialApplicationsProperty()); this.commercialCheck.setSelected(true); <START> this.operatingSystemCheck = new LeftCheckBox(tr("Show all Operating Systems")); <END> this.operatingSystemCheck.selectedProperty().bindBidirectional(filter.containAllOSCompatibleApplications()); this.operatingSystemCheck.setSelected(false); this.filterGroup = new LeftGroup("Filters", testingCheck, requiresPatchCheck, commercialCheck, operatingSystemCheck); }</code><technical_language>this text a bit long? pot/po update for this missing</technical_language>

Target:
private void populateFilters() { this.testingCheck = new LeftCheckBox(tr("Testing")); this.testingCheck.selectedProperty().bindBidirectional(filter.containTestingApplicationsProperty()); this.requiresPatchCheck = new LeftCheckBox(tr("Requires patch")); this.requiresPatchCheck.selectedProperty().bindBidirectional(filter.containRequiresPatchApplicationsProperty()); this.commercialCheck = new LeftCheckBox(tr("Commercial")); this.commercialCheck.selectedProperty().bindBidirectional(filter.containCommercialApplicationsProperty()); this.commercialCheck.setSelected(true); this.operatingSystemCheck = new LeftCheckBox(tr("All Operating Systems")); this.operatingSystemCheck.selectedProperty().bindBidirectional(filter.containAllOSCompatibleApplications()); this.operatingSystemCheck.setSelected(false); this.filterGroup = new LeftGroup("Filters", testingCheck, requiresPatchCheck, commercialCheck, operatingSystemCheck); }
Source:
<code>public void extractLowBitsTo(HLLRegister dest) { for (Entry<Integer, Byte> entry : getSparseMap().entrySet()) { int idx = entry.getKey(); byte lr = entry.getValue(); if (lr != 0) { <START> dest.add((1 << (p + lr - 1)) | idx); <END> } } }</code><technical_language>nit: noticing this. safe wrt overflow 1L << (p + lr - 1)</technical_language>

Target:
public void extractLowBitsTo(HLLRegister dest) { for (Entry<Integer, Byte> entry : getSparseMap().entrySet()) { int idx = entry.getKey(); byte lr = entry.getValue(); if (lr != 0) { dest.add((1L << (p + lr - 1)) | idx); } } }
Source:
<code>private void completeAllExceptionally(Throwable t) { List<Data> completed; synchronized (futures) { <START> completed = new ArrayList<>(futures.size()); <END> completed.addAll(futures.values()); } for (Data data : completed) { data.cancelFuture.cancel(false); data.completeExceptionally(t); } }</code><technical_language>new ArrayList<>(futures.values());</technical_language>

Target:
private void completeAllExceptionally(Throwable t) { List<Data> completed; synchronized (futures) { completed = new ArrayList<>(futures.values()); } for (Data data : completed) { data.cancelFuture.cancel(false); data.completeExceptionally(t); } }
Source:
<code>public Response doImport(Action action) { validateParameters(action, "storageDomain.id|name"); ImportRepoImageParameters importParameters = new ImportRepoImageParameters(); importParameters.setSourceRepoImageId(id); importParameters.setSourceStorageDomainId(getStorageDomainId()); importParameters.setStoragePoolId(getDataCenterId(getStorageDomainId(action))); importParameters.setStorageDomainId(getStorageDomainId(action)); if (action.isSetImportAsTemplate()) { if (action.isImportAsTemplate()) { validateParameters(action, "cluster.id|name"); importParameters.setClusterId(getClusterId(action)); if (action.isSetTemplate() && action.getTemplate().isSetName()) { importParameters.setTemplateName(action.getTemplate().getName()); } } importParameters.setImportAsTemplate(action.isImportAsTemplate()); } if (action.isSetName()) { importParameters.setDiskAlias(action.getName()); <START> } <END> return doAction(VdcActionType.ImportRepoImage, importParameters, action); }</code><technical_language>setting is disk name I is add a "disk" element "ActionParameterGroup" group, "name" element: <action> <disk> <name>imported-disk</name> </disk> </action> This room for adding other potential attributes of disk</technical_language>

Target:
public Response doImport(Action action) { validateParameters(action, "storageDomain.id|name"); ImportRepoImageParameters importParameters = new ImportRepoImageParameters(); importParameters.setSourceRepoImageId(id); importParameters.setSourceStorageDomainId(getStorageDomainId()); importParameters.setStoragePoolId(getDataCenterId(getStorageDomainId(action))); importParameters.setStorageDomainId(getStorageDomainId(action)); if (action.isSetImportAsTemplate()) { if (action.isImportAsTemplate()) { validateParameters(action, "cluster.id|name"); importParameters.setClusterId(getClusterId(action)); if (action.isSetTemplate() && action.getTemplate().isSetName()) { importParameters.setTemplateName(action.getTemplate().getName()); } } importParameters.setImportAsTemplate(action.isImportAsTemplate()); } if (action.isSetDisk() && action.getDisk().isSetAlias()) { importParameters.setDiskAlias(action.getDisk().getAlias()); } return doAction(VdcActionType.ImportRepoImage, importParameters, action); }
Source:
<code><START> public void testDestroy() throws Exception { <END> final ManagedInstance managedInstance = mock(ManagedInstance.class); final Object control = mock(Object.class); final Consumer<Object> consumer = mock(Consumer.class); InstanceUtils.destroy(managedInstance, control, consumer); verify(consumer, times(1)).accept(eq(control)); verify(managedInstance, times(1)).destroy(eq(control)); }</code><technical_language>Exception is thrown</technical_language>

Target:
public void testDestroy() { final ManagedInstance managedInstance = mock(ManagedInstance.class); final Object control = mock(Object.class); final Consumer<Object> consumer = mock(Consumer.class); InstanceUtils.destroy(managedInstance, control, consumer); verify(consumer, times(1)).accept(eq(control)); verify(managedInstance, times(1)).destroy(eq(control)); }
Source:
<code>public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 1) { return false; } final Player player = getPlayer(args[0]); if (player == null) { playerMsg(TFM_Command.PLAYER_NOT_FOUND); return true; } else if (args.length > 1) { final String reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); smite(sender, player, reason); return true; } else { <START> sender.sendMessage(ChatColor.RED + "You must supply a reason in order to smite someone."); <END> return true; } }</code><technical_language>@JeromSar wants reason optional</technical_language>

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 1) { return false; } final Player player = getPlayer(args[0]); if (player == null) { playerMsg(TFM_Command.PLAYER_NOT_FOUND); return true; } else if (args.length > 1) { final String reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); smite(sender, player, reason); return true; } else { sender.sendMessage(ChatColor.GREEN + "You must supply a reason in order to smite someone."); return true; } }
Source:
<code>private void loadFile(File file) throws ConfigurationException { Configuration config = null; try { config = Configuration.loadFile(file); } catch (IOException exception) { throw new ConfigurationException( "Can't load object configuration file \"" + file.getAbsolutePath() + "\".", exception); <START> } <END> String name = config.getString(ExtensionManagerKeys.name.getKeyName()); Boolean enabled = config.getBoolean(ExtensionManagerKeys.enabled.getKeyName(), false); if (!enabled.booleanValue()) { log.debug("The extension \"{}\" is disabled", name); return; } if (configurationNames.contains(name)) { log.error("An extension with the name \"{}\" is already loaded", name); return; } configurationNames.add(name); String position = config.getString(ExtensionManagerKeys.position.getKeyName()); if (position != null) { if (position.equalsIgnoreCase("first")) { if (!firstDetected) { orderedConfigurationNames.add(0, name); orderedConfigurations.add(0, config); firstDetected = true; } else { log.error("There is already an extension that is marked as the first. \"{}\" cannot be set as first", name); } } else if (position.equals("last")) { if (!lastDetected) { orderedConfigurationNames.add(name); orderedConfigurations.add(config); lastDetected = true; } else { log.error("There is already an extension that is marked as the last. \"{}\" cannot be set as last", name); } } } }</code><technical_language>please wrap entire function in try/catch, is ugly re-route exceptions this why, is actual meaning do so... for example, need re-route bad states exceptions. in this case IOException this function is a failure of reading file point in time</technical_language>

Target:
private void loadFile(File file) throws ConfigurationException { Configuration config = null; try { config = Configuration.loadFile(file); String name = config.getString(NAME); ExtensionEntry alreadyLoded = loadedEntries.get(name); if (alreadyLoded != null) { throw new ConfigurationException("Could not load the configuration file \"" + file.getAbsolutePath() + "\". The configuration file + \"" + alreadyLoded.file.getAbsolutePath() + "\" already has the name " + name); } ExtensionEntry entry = new ExtensionEntry(file, config.getBoolean(ENABLED, true), name, config.getString(SERVICE), config); loadedEntries.put(entry.name, entry); } catch (IOException exception) { throw new ConfigurationException( "Can't load object configuration file \"" + file.getAbsolutePath() + "\".", exception); } }
Source:
<code>public boolean canDeleteTask(TaskRepository repository, ITask task) { <START> return true; <END> }</code><technical_language>invoke hasRichEditor(TaskRepository repository) TracWebClient implement delete API</technical_language>

Target:
public boolean canDeleteTask(TaskRepository repository, ITask task) { return hasRichEditor(repository); }
Source:
<code>public void getAttributesByIdsAndHolders() throws Exception { System.out.println(CLASS_NAME + "getAttributesByIdsAndHolders"); Attribute groupAttr = setUpGroupAttribute(); Attribute memberGroupAttr = setUpMemberGroupAttribute(); AttributeDefinition memberGroupAttrDef = setUpMemberGroupAttributeDefinition(); AttributeDefinition groupResourceAttrDef = setUpGroupResourceAttributeDefinition(); cacheManager.setAttribute(groupAttr, groupHolder, null); cacheManager.setAttribute(memberGroupAttr, memberHolder, groupHolder); List<Integer> attributeIds = new ArrayList<>(); attributeIds.add(groupAttr.getId()); attributeIds.add(memberGroupAttr.getId()); attributeIds.add(memberGroupAttrDef.getId()); attributeIds.add(groupResourceAttrDef.getId()); List<Attribute> attrs = cacheManager.getAttributesByIds(attributeIds, memberHolder, groupHolder); assertTrue("result should contain member-group attribute", attrs.contains(memberGroupAttr)); <START> assertTrue("result should contain member-group attribute definition", attrs.contains(new Attribute(memberGroupAttrDef))); <END> assertTrue("it should return 2 attributes", attrs.size() == 2); }</code><technical_language>above</technical_language>

Target:
public void getAttributesByIdsAndHolders() throws Exception { System.out.println(CLASS_NAME + "getAttributesByIdsAndHolders"); Attribute groupAttr = setUpGroupAttribute(); Attribute memberGroupAttr = setUpMemberGroupAttribute(); AttributeDefinition memberGroupAttrDef = setUpMemberGroupAttributeDefinition(); AttributeDefinition groupResourceAttrDef = setUpGroupResourceAttributeDefinition(); cacheManager.setAttribute(groupAttr, groupHolder, null); cacheManager.setAttribute(memberGroupAttr, memberHolder, groupHolder); List<Integer> attributeIds = new ArrayList<>(); attributeIds.add(groupAttr.getId()); attributeIds.add(memberGroupAttr.getId()); attributeIds.add(memberGroupAttrDef.getId()); attributeIds.add(groupResourceAttrDef.getId()); List<Attribute> attrs = cacheManager.getAttributesByIds(attributeIds, memberHolder, groupHolder); assertTrue("result should contain member-group attribute", attrs.contains(memberGroupAttr)); assertTrue("result should contain member-group attribute definition", attrs.contains(memberGroupAttrDef)); assertTrue("it should return 2 attributes", attrs.size() == 2); }
Source:
<code>private RoutesBean getRoutesWithRouteNameQuery(SearchQueryBean query) throws ServiceException { SearchResult<AgencyAndId> result = searchForRoutes(query); List<RouteBean> routeBeans = new ArrayList<RouteBean>(); CoordinateBounds bounds = query.getBounds(); for (AgencyAndId id : result.getResults()) { <START> STRtree tree = getStopsTreeForRouteId(id); <END> if (tree == null) { _log.warn("stop tree not found for routeId=" + id); continue; } Envelope env = new Envelope(bounds.getMinLon(), bounds.getMaxLon(), bounds.getMinLat(), bounds.getMaxLat()); HasItemsVisitor v = new HasItemsVisitor(); tree.query(env, v); if (v.hasItems()) { RouteBean routeBean = _routeBeanService.getRouteForId(id); routeBeans.add(routeBean); } } boolean limitExceeded = BeanServiceSupport.checkLimitExceeded(routeBeans, query.getMaxCount()); return constructResult(routeBeans, limitExceeded); }</code><technical_language>I cacheing works expect here. @Cacheable annotation is implemented a Proxy-based interceptor, means callers working injected RouteBeanService interface instance caching applied. call getStopTreeForRoute(...) implementation class, I calls method caching interceptor</technical_language>

Target:
private RoutesBean getRoutesWithRouteNameQuery(SearchQueryBean query) throws ServiceException { SearchResult<AgencyAndId> result = searchForRoutes(query); List<RouteBean> routeBeans = new ArrayList<RouteBean>(); CoordinateBounds bounds = query.getBounds(); for (AgencyAndId id : result.getResults()) { STRtree tree = _stopTreesByRouteId.get(id); if (tree == null) { _log.warn("stop tree not found for routeId=" + id); continue; } Envelope env = new Envelope(bounds.getMinLon(), bounds.getMaxLon(), bounds.getMinLat(), bounds.getMaxLat()); HasItemsVisitor v = new HasItemsVisitor(); tree.query(env, v); if (v.hasItems()) { RouteBean routeBean = _routeBeanService.getRouteForId(id); routeBeans.add(routeBean); } } boolean limitExceeded = BeanServiceSupport.checkLimitExceeded(routeBeans, query.getMaxCount()); return constructResult(routeBeans, limitExceeded); }
Source:
<code>public UsageStatisticsReporting get() { synchronized (mutexForReportingUsageData) { UsageStatisticsReporting loaded = getUsageStatisticsReportingInfo(); if (loaded.canReport()) { <START> reportingStartedTime = new DateTime(); <END> } return loaded; } }</code><technical_language>GET call change state of system. Also, this delay reporting 30min everytime invokes this API. Split this - regular GET, another call mark beginning of update</technical_language>

Target:
public UsageStatisticsReporting get() { UsageStatisticsReporting loaded = usageStatisticsReportingSqlMapDao.load(); loaded.setDataSharingServerUrl(systemEnvironment.getGoDataSharingServerUrl()); boolean canReport = !isDevelopmentServer() && dataSharingSettingsService.get().allowSharing() && !isToday(loaded.lastReportedAt()) && !isReportingInProgress(); loaded.canReport(canReport); return loaded; }
Source:
<code>public void logout(final IProgressMonitor monitor) throws XmlRpcException { userID = -1; token = null; (new BugzillaXmlRpcOperation<Integer>(this) { @SuppressWarnings("serial") @Override public Integer execute() throws XmlRpcException { try { <START> bugzillaClient.authenticate(monitor); <END> } catch (CoreException e) { e.printStackTrace(); } Object response = call(monitor, XML_USER_LOGOUT, null); return -1; } }).execute(); return; }</code><technical_language>do call authenticate log out? If authenticated, do need log out</technical_language>

Target:
public void logout(final IProgressMonitor monitor) throws XmlRpcException { (new BugzillaXmlRpcOperation<Integer>(this) { @SuppressWarnings("serial") @Override public Integer execute() throws XmlRpcException { Object response = call(monitor, XML_USER_LOGOUT, null); return -1; } }).execute(); userID = -1; token = null; return; }
Source:
<code>public String metrics() { if (!this.delegate.isEnabled()) { <START> return getDisabledResponse().toString(); <END> } ResponseEntity<String> result = this.delegate.invoke(); return result.getBody(); }</code><technical_language>Change return Object remove toString (otherwise lose 404 status code)</technical_language>

Target:
public ResponseEntity<String> metrics() { if (!this.delegate.isEnabled()) { return (ResponseEntity<String>) getDisabledResponse(); } ResponseEntity<String> result = this.delegate.invoke(); return result; }
Source:
<code><START> void reloadAccountabilityConfiguration(InputStream defaultConfigInputStream) { <END> File tempFile = new File(configDirectory + "/wineryAccountability.yml"); if (!configFile.exists()) { copyDefaultConfigFile(); } else { try { FileUtils.copyInputStreamToFile(defaultConfigInputStream, tempFile); } catch (IOException e) { LOGGER.debug("Error copying default file.", e); } YAMLConfiguration defaultAccountabilityConfiguration; try (FileReader reader = new FileReader(tempFile)) { String accountabilityPrefix = "accountability"; defaultAccountabilityConfiguration = new YAMLConfiguration(); defaultAccountabilityConfiguration.read(reader); YAMLConfiguration currentConfiguration = this.getConfiguration(); Iterator<String> accountabilityAttributes = defaultAccountabilityConfiguration.getKeys(accountabilityPrefix); accountabilityAttributes.forEachRemaining(key -> { currentConfiguration.setProperty(key, defaultAccountabilityConfiguration.getString(key)); }); this.save(); defaultConfigInputStream.close(); } catch (ConfigurationException | IOException ex) { LOGGER.debug("Error while reading configuration file.", ex); } tempFile.delete(); } }</code><technical_language>ensure input stream is eventually closed, in code execution paths</technical_language>

Target:
void reloadAccountabilityConfiguration(InputStream defaultConfigInputStream) { File tempFile = new File(configDirectory + "/wineryAccountability.yml"); if (!configFile.exists()) { copyDefaultConfigFile(); } else { try { FileUtils.copyInputStreamToFile(defaultConfigInputStream, tempFile); } catch (IOException e) { LOGGER.debug("Error copying default file.", e); } YAMLConfiguration defaultAccountabilityConfiguration; try (FileReader reader = new FileReader(tempFile)) { String accountabilityPrefix = "accountability"; defaultAccountabilityConfiguration = new YAMLConfiguration(); defaultAccountabilityConfiguration.read(reader); YAMLConfiguration currentConfiguration = this.getConfiguration(); Iterator<String> accountabilityAttributes = defaultAccountabilityConfiguration.getKeys(accountabilityPrefix); accountabilityAttributes.forEachRemaining(key -> { currentConfiguration.setProperty(key, defaultAccountabilityConfiguration.getString(key)); }); this.save(); } catch (ConfigurationException | IOException ex) { LOGGER.debug("Error while reading configuration file.", ex); } tempFile.delete(); } }
Source:
<code>public void onRestart() <START> { <END> super.onRestart(); Restart=true; initializeView(); }</code><technical_language>follow proper parenthesis pattern. been: public void onRestart() {</technical_language>

Target:
public void onRestart() { super.onRestart(); restart=true; initializeView(); }
Source:
<code>public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getLabel() == null) ? 0 : getLabel().hashCode()); return result; <START> } <END></code><technical_language>Feels this complicated. return ((getLabel() == null) ? 0 : getLabel().hashCode()); figuring Favorites labels equal do labels String's hashCode() implementation is fine as-is</technical_language>

Target:
public int hashCode() { return LABEL.hashCode(); }
Source:
<code>private void runEventLoopUntilEmpty() { Display display = Display.getCurrent(); while (display.readAndDispatch()) { } <START> display.sleep(); <END> return; }</code><technical_language>deadlock: remove this call sleep(). events arrive</technical_language>

Target:
private void runEventLoopUntilEmpty() { Display display = Display.getCurrent(); while (display.readAndDispatch()) { } return; }
Source:
<code>@Test public void testToastMSGIsDisplayed() throws InterruptedException { WebDriverWait wait = new WebDriverWait(driver, 10); driver.startActivity("io.appium.android.apis", ".view.PopupMenu1"); MobileElement popUpElement = driver.findElement(MobileBy.AccessibilityId("Make a Popup!")); popUpElement.click(); <START> driver.findElement(By.xpath(". END> wait.until(ExpectedConditions .presenceOfElementLocated(By.xpath(" popUpElement.click(); driver.findElement(By.xpath(". wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(" popUpElement.click(); driver.findElement(By.xpath(". wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(" driver.findElement(By.xpath(". wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(" }</code><technical_language>do that. please fix codacy issues</technical_language>

Target:
@Test public void testToastMSGIsDisplayed() throws InterruptedException { final WebDriverWait wait = new WebDriverWait(driver, 10); driver.startActivity("io.appium.android.apis", ".view.PopupMenu1"); MobileElement popUpElement = driver.findElement(MobileBy.AccessibilityId("Make a Popup!")); popUpElement.click(); driver.findElement(By.xpath(". assertNotNull(wait.until(ExpectedConditions.presenceOfElementLocated( By.xpath(" popUpElement.click(); driver.findElement(By.xpath(". assertNotNull(wait.until(ExpectedConditions .presenceOfElementLocated(By.xpath(" popUpElement.click(); driver.findElement(By.xpath(". assertNotNull(wait.until(ExpectedConditions .presenceOfElementLocated(By.xpath(" driver.findElement(By.xpath(". assertNotNull(wait.until(ExpectedConditions .presenceOfElementLocated(By.xpath(" }
Source:
<code>private String taskSensorPrefix(final String threadId, final String taskId) { <START> return threadSensorPrefix(threadId) + SENSOR_PREFIX_DELIMITER + "task" + SENSOR_PREFIX_DELIMITER + taskId; <END> }</code><technical_language>super nit: string task a public final variable</technical_language>

Target:
private String taskSensorPrefix(final String threadId, final String taskId) { return threadSensorPrefix(threadId) + SENSOR_PREFIX_DELIMITER + SENSOR_TASK_LABEL + SENSOR_PREFIX_DELIMITER + taskId; }
Source:
<code>public Builder(String portletUrl) { super(); this.portletUrl = portletUrl; <START> localJs = new ArrayList<>(); <END> localCss = new ArrayList<>(); remoteJs = new ArrayList<>(); remoteCss = new ArrayList<>(); localRawJs = new ArrayList<>(); localRawCss = new ArrayList<>(); this.isThemeEnabled = true; this.isCordovaEnabled = false; this.webType = WebType.LIFERAY_AUTHENTICATED; }</code><technical_language>initialized</technical_language>

Target:
public Builder(String portletUrl) { super(); }
Source:
<code>private String createQuery(FileTypesByExtension.SearchFilterInterface filter) { if (filter.getFilter().isEmpty()) { return ""; } String query = "(dir_type = " + TskData.TSK_FS_NAME_TYPE_ENUM.REG.getValue() + ")" + (UserPreferences.hideKnownFilesInViewsTree() ? " AND (known IS NULL OR known != " + TskData.FileKnown.KNOWN.getFileKnownValue() + ")" : " ") + " AND (NULL "; if (skCase.getDatabaseType().equals(TskData.DbType.POSTGRESQL)) { query += "OR LOWER(name) ~ '(\\"; <START> query += StringUtils.join(filter.getFilter(), "|\\"); <END> query += ")$'"; } else { for (String s : filter.getFilter()) { query += "OR LOWER(name) LIKE '%" + s.toLowerCase() + "'"; } } query += ')'; return query; }</code><technical_language>do need toLowerCase do in SQLite version</technical_language>

Target:
private String createQuery(FileTypesByExtension.SearchFilterInterface filter) { if (filter.getFilter().isEmpty()) { throw new IllegalArgumentException("Empty filter list passed to createQuery()"); } String query = "(dir_type = " + TskData.TSK_FS_NAME_TYPE_ENUM.REG.getValue() + ")" + (UserPreferences.hideKnownFilesInViewsTree() ? " AND (known IS NULL OR known != " + TskData.FileKnown.KNOWN.getFileKnownValue() + ")" : " ") + " AND (NULL "; if (skCase.getDatabaseType().equals(TskData.DbType.POSTGRESQL)) { query += "OR LOWER(name) ~ '(\\"; query += StringUtils.join(filter.getFilter().stream() .map(String::toLowerCase).collect(Collectors.toList()), "|\\"); query += ")$'"; } else { for (String s : filter.getFilter()) { query += "OR LOWER(name) LIKE '%" + s.toLowerCase() + "'"; } } query += ')'; return query; }
Source:
<code><START> public List<Container> search(Collection<? extends HasMetadata> list) { <END> return list.stream() .filter(this::matchMeta) .flatMap(this::findContainers) .filter(this::matchContainer) .collect(toList()); }</code><technical_language>Wow. This method is more elegant :tada:</technical_language>

Target:
public List<Container> search(Collection<? extends HasMetadata> list) { return list.stream() .filter(this::matchMetadata) .flatMap(this::findContainers) .filter(this::matchContainer) .collect(toList()); }