auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ViewHolder(View itemView) { super(itemView); SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(itemView.getContext()); selectedListLayout = Integer.parseInt(mPrefs.getString(SettingsActivity.SP_FEED_LIST_LAYOUT, "0")); bodyForegroundColor = new ForegroundColorSpan(ContextCompat.getColor(itemView.getContext(), android.R.color.secondary_text_dark)); if(favIconHandler == null) { favIconHandler = new FavIconHandler(itemView.getContext()); } ButterKnife.bind(this, itemView); int[] attribute = new int[]{ R.attr.starredColor, R.attr.unstarredColor }; TypedArray array = starImageView.getContext().getTheme().obtainStyledAttributes(attribute); starColor = array.getColor(0, Color.TRANSPARENT); inactiveStarColor = array.getColor(1, Color.LTGRAY); array.recycle(); <START> if(textViewSummary != null) { <END> textSizeSummary = Math.round(textViewSummary.getTextSize()); } if(textViewTitle != null) { textSizeTitle = Math.round(textViewTitle.getTextSize()); } if(textViewBody != null) { textSizeBody = Math.round(textViewBody.getTextSize()); } if(textViewItemDate != null) { textSizeItemDate = Math.round(textViewItemDate.getTextSize()); } itemView.setOnClickListener(this); itemView.setOnLongClickListener(this); displayImageOptionsThumbnail = new DisplayImageOptions.Builder() .displayer(new SquareRoundedBitmapDisplayer(30)) .showImageOnLoading(R.drawable.feed_icon) .showImageForEmptyUri(R.drawable.feed_icon) .showImageOnFail(R.drawable.feed_icon) .cacheOnDisk(true) .cacheInMemory(true) .build(); }</code><technical_language>I get rid of check (as summary is mandatory) suggestion</technical_language>

Target:
public ViewHolder(View itemView) { super(itemView); SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(itemView.getContext()); selectedListLayout = Integer.parseInt(mPrefs.getString(SettingsActivity.SP_FEED_LIST_LAYOUT, "0")); bodyForegroundColor = new ForegroundColorSpan(ContextCompat.getColor(itemView.getContext(), android.R.color.secondary_text_dark)); if(favIconHandler == null) { favIconHandler = new FavIconHandler(itemView.getContext()); } ButterKnife.bind(this, itemView); int[] attribute = new int[]{ R.attr.starredColor, R.attr.unstarredColor }; TypedArray array = starImageView.getContext().getTheme().obtainStyledAttributes(attribute); starColor = array.getColor(0, Color.TRANSPARENT); inactiveStarColor = array.getColor(1, Color.LTGRAY); array.recycle(); textSizeSummary = Math.round(textViewSummary.getTextSize()); textSizeTitle = Math.round(textViewTitle.getTextSize()); if(textViewBody != null) { textSizeBody = Math.round(textViewBody.getTextSize()); } textSizeItemDate = Math.round(textViewItemDate.getTextSize()); itemView.setOnClickListener(this); itemView.setOnLongClickListener(this); displayImageOptionsThumbnail = new DisplayImageOptions.Builder() .displayer(new SquareRoundedBitmapDisplayer(30)) .showImageOnLoading(R.drawable.feed_icon) .showImageForEmptyUri(R.drawable.feed_icon) .showImageOnFail(R.drawable.feed_icon) .cacheOnDisk(true) .cacheInMemory(true) .build(); }
Source:
<code>public static boolean hasErrorPartitions(HelixDataAccessor dataAccessor, String clusterId, String instanceName) { PropertyKey.Builder propertyKeyBuilder = new PropertyKey.Builder(clusterId); PropertyKey liveInstanceKey = propertyKeyBuilder.liveInstance(instanceName); LiveInstance liveInstance = dataAccessor.getProperty(liveInstanceKey); if (liveInstance != null) { String sessionId = liveInstance.getEphemeralOwner(); <START> for (PropertyKey key : getAllCurrentStateKeys(dataAccessor, instanceName, sessionId)) { <END> CurrentState currentState = dataAccessor.getProperty(key); if (currentState != null && currentState.getPartitionStateMap().containsValue(HelixDefinedState.ERROR.name())) { _logger.warn(String.format("The instance %s has error partitions on it.", instanceName)); return true; } } } return false; }</code><technical_language>This is necessary instance validation util. this management API is for check real data resource. split filter out TASK current state</technical_language>

Target:
public static boolean hasErrorPartitions(HelixDataAccessor dataAccessor, String clusterId, String instanceName) { PropertyKey.Builder propertyKeyBuilder = new PropertyKey.Builder(clusterId); PropertyKey liveInstanceKey = propertyKeyBuilder.liveInstance(instanceName); LiveInstance liveInstance = dataAccessor.getProperty(liveInstanceKey); if (liveInstance != null) { String sessionId = liveInstance.getEphemeralOwner(); PropertyKey currentStatesKey = propertyKeyBuilder.currentStates(instanceName, sessionId); List<String> resourceNames = dataAccessor.getChildNames(currentStatesKey); for (String resourceName : resourceNames) { PropertyKey key = propertyKeyBuilder.currentState(instanceName, sessionId, resourceName); CurrentState currentState = dataAccessor.getProperty(key); if (currentState != null && currentState.getPartitionStateMap().containsValue(HelixDefinedState.ERROR.name())) { _logger.warn(String.format("The instance %s has error partitions on it.", instanceName)); return true; } } } return false; }
Source:
<code>public static void getDummyResult(byte[] rowKey, List<Cell> result) { <START> result.clear(); <END> KeyValue keyValue = KeyValueUtil.newKeyValue(rowKey, 0, rowKey.length, EMPTY_BYTE_ARRAY, EMPTY_BYTE_ARRAY, 0, EMPTY_BYTE_ARRAY, 0, EMPTY_BYTE_ARRAY.length); result.add(keyValue); }</code><technical_language>I understand this part. result empty reaches this point? if isn't, overwriting read data</technical_language>

Target:
public static void getDummyResult(byte[] rowKey, List<Cell> result) { KeyValue keyValue = KeyValueUtil.newKeyValue(rowKey, 0, rowKey.length, EMPTY_BYTE_ARRAY, EMPTY_BYTE_ARRAY, 0, EMPTY_BYTE_ARRAY, 0, EMPTY_BYTE_ARRAY.length); result.add(keyValue); }
Source:
<code>private void fixFeedbackResponsesOfFeedbackSession(FeedbackSession session) throws InvalidParametersException, EntityDoesNotExistException { <START> List<FeedbackResponseAttributes> feedbackResponseList = feedbackResponsesDb.getFeedbackResponsesForSession(session.getFeedbackSessionName(), <END> session.getCourseId()); for (FeedbackResponseAttributes response : feedbackResponseList) { response.feedbackSessionName = StringHelper.removeExtraSpace(response.feedbackSessionName); feedbackResponsesDb.updateFeedbackResponse(response); } }</code><technical_language>error occurred in issue, this fail get responses of session? Edit: I get it, matter</technical_language>

Target:
private void fixFeedbackResponsesOfFeedbackSession(FeedbackSession session) throws InvalidParametersException, EntityDoesNotExistException { Query q = getPm().newQuery(FeedbackResponse.class); q.declareParameters("String feedbackSessionNameParam, String courseIdParam"); q.setFilter("feedbackSessionName == feedbackSessionNameParam && " + "courseId == courseIdParam"); @SuppressWarnings("unchecked") List<FeedbackResponse> responses = (List<FeedbackResponse>) q.execute(session.getFeedbackSessionName(), session.getCourseId()); for (FeedbackResponse response : responses) { response.setFeedbackSessionName( StringHelper.removeExtraSpace(response.getFeedbackSessionName())); } getPm().close(); }
Source:
<code>public void validateExistingManagedExternalId() { ExternalIdentifier externalIdentifier = new DynamoExternalIdentifier(); when(externalIdService.getExternalId(study.getStudyIdentifier(), "foo")).thenReturn(externalIdentifier); StudyParticipant participant = new StudyParticipant.Builder().withEmail("email@email.com") .withExternalId("foo").withId("id").withPassword("pAssword1@").build(); validator = new StudyParticipantValidator(externalIdService, study, false); study.setExternalIdValidationEnabled(true); Validate.entityThrowingException(validator, participant); <START> } <END></code><technical_language>cases? * External ID validation required, specified? * External ID specified, validation required</technical_language>

Target:
public void validateExistingManagedExternalId() { when(externalIdService.getExternalId(study.getStudyIdentifier(), "foo")).thenReturn(EXT_ID); StudyParticipant participant = new StudyParticipant.Builder().withEmail("email@email.com") .withExternalId("foo").withId("id").withPassword("pAssword1@").build(); validator = new StudyParticipantValidator(externalIdService, study, false); study.setExternalIdValidationEnabled(true); Validate.entityThrowingException(validator, participant); }
Source:
<code>void unloadedUnitsAreTransferredToOnlyOneOfTheNewUnits() { final Unit oldUnit = transport.create(1, player).get(0); final List<Unit> newUnits = transport.create(2, player); final List<Unit> unloadedInfantry = infantry.create(1, player); oldUnit.setUnloaded(unloadedInfantry); final Change changes = UnitUtils.translateAttributesToOtherUnits(oldUnit, newUnits, seaZone); gameData.performChange(changes); assertThat(newUnits.get(0).getUnloaded(), is(unloadedInfantry)); assertThat( <START> "Only the first new unit should get the unloaded infantry", <END> newUnits.get(1).getUnloaded(), is(empty())); }</code><technical_language>is this case? A more specific description key, is special new unit this assertion case</technical_language>

Target:
void unloadedUnitsAreTransferredToOnlyOneOfTheNewUnits() { final Unit oldTransport = transport.create(1, player).get(0); final Unit newTransport1 = transport.create(1, player).get(0); final Unit newTransport2 = transport.create(1, player).get(0); final List<Unit> unloadedInfantry = infantry.create(2, player); oldTransport.setUnloaded(unloadedInfantry); final Change changes = UnitUtils.translateAttributesToOtherUnits( oldTransport, List.of(newTransport1, newTransport2), seaZone); gameData.performChange(changes); assertThat( "Units can only be unloaded by one unit at a time. So the unloaded unit " + "should be transferred to one of the new units. Since the new units is a list, the " + "first one will be selected and the first one is 'newTransport1'", newTransport1.getUnloaded(), is(unloadedInfantry)); assertThat( "newTransport2 should have no unloaded units because all of the units were assigned to " + "newTransport1", newTransport2.getUnloaded(), is(empty())); }
Source:
<code>public boolean isToExclude(String property) { <START> JsonElement jsonElement = getInstance().getConfigurationProperties().getAsJsonObject().get(property); <END> if (jsonElement != null) { return Boolean.valueOf(jsonElement.getAsString()); } return false; }</code><technical_language>this is instance method, getInstance() is it</technical_language>

Target:
public boolean isToExclude(String property) { if (getConfigurationProperties().has(property)) { return getConfigurationProperties().get(property).getAsBoolean(); } return false; }
Source:
<code>private void writeAttribute(final DlmsConnectionHolder conn, final SetParameter parameter, final String attributeName) throws ProtocolAdapterException { try { final AccessResultCode result = conn.getConnection().set(parameter); if (!result.equals(AccessResultCode.SUCCESS)) { <START> throw new ProtocolAdapterException(String <END> .format("Attribute '%s' of the clock configuration was not set successfully.", attributeName)); } } catch (final IOException e) { throw new ConnectionException(e); } }</code><technical_language>some AccessResultCodes beside SUCCESS. If result is included exception this provide useful information wrong</technical_language>

Target:
private void writeAttribute(final DlmsConnectionHolder conn, final SetParameter parameter, final String attributeName) throws ProtocolAdapterException { try { final AccessResultCode result = conn.getConnection().set(parameter); if (!result.equals(AccessResultCode.SUCCESS)) { throw new ProtocolAdapterException(String.format( "Attribute '%s' of the clock configuration was not set successfully. ResultCode: %s", attributeName, result.name())); } } catch (final IOException e) { throw new ConnectionException(e); } }
Source:
<code>private RestfulAction getXmlPartial(String groupName, String oldMd5, GoConfigService.XmlPartialSaver xmlPartialSaver) { if (!isTemplate(groupName) && !isCurrentUserAdminOfGroup(groupName)) { return XmlAction.xmlUnAuthorized(errorMessageForGroup(groupName)); } <START> if (isTemplate(groupName) && !isCurrentUserAdmin()) { <END> return XmlAction.xmlUnAuthorized(errorMessageForTemplates()); } String xml = null; try { xml = xmlPartialSaver.asXml(); } catch (Exception e) { return XmlAction.xmlNotFound(e.getMessage()); } String newMd5 = xmlPartialSaver.getMd5(); if (oldMd5 != null && !oldMd5.equals(newMd5)) { return XmlAction.xmlMd5Conflict(ConfigFileHasChangedException.CONFIG_CHANGED_PLEASE_REFRESH, newMd5); } return XmlAction.xmlFound(xml, newMd5); }</code><technical_language>check if methods GoConfigService used? buildSaver stageSaver likes</technical_language>

Target:
private RestfulAction getXmlPartial(String groupName, String oldMd5, GoConfigService.XmlPartialSaver xmlPartialSaver) { if (!isTemplate(groupName) && !isCurrentUserAdminOfGroup(groupName)) { return XmlAction.xmlUnAuthorized(errorMessageForGroup(groupName)); } if (isTemplate(groupName) && !isCurrentUserAdmin()) { return XmlAction.xmlUnAuthorized(errorMessageForTemplates()); } String xml; try { xml = xmlPartialSaver.asXml(); } catch (Exception e) { return XmlAction.xmlNotFound(e.getMessage()); } String newMd5 = xmlPartialSaver.getMd5(); if (oldMd5 != null && !oldMd5.equals(newMd5)) { return XmlAction.xmlMd5Conflict(ConfigFileHasChangedException.CONFIG_CHANGED_PLEASE_REFRESH, newMd5); } return XmlAction.xmlFound(xml, newMd5); }
Source:
<code>private String webDownloadArtifactToString(BlackboardArtifact artifact) throws TskCoreException { <START> StringBuilder sb = new StringBuilder(1024); <END> Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributesMap = getAttributesMap(artifact); if (BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() == artifact.getArtifactTypeID() || BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID() == artifact.getArtifactTypeID()) { appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL, attributesMap, "URL"); appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED, attributesMap, "On"); } return sb.toString(); }</code><technical_language>I put "magic number" a static var</technical_language>

Target:
private String webDownloadArtifactToString(BlackboardArtifact artifact) throws TskCoreException { StringBuilder sb = new StringBuilder(ARTIFACT_STR_MAX_LEN); Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributesMap = getAttributesMap(artifact); if (BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() == artifact.getArtifactTypeID() || BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID() == artifact.getArtifactTypeID()) { appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL, attributesMap, Bundle.ContextViewer_downloadURL()); appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED, attributesMap, Bundle.ContextViewer_downloadedOn()); } return sb.toString(); }
Source:
<code>public URI uploadPackage() throws UploaderException { if (s3Client.doesObjectExist(bucket, remoteFilePath)) { s3Client.copyObject(bucket, remoteFilePath, bucket, previousVersionFilePath); } try { s3Client.putObject(bucket, remoteFilePath, packageFileHandler); } catch (AmazonClientException e) { <START> throw new UploaderException( <END> String.format("Error writing topology package to %s %s", bucket, remoteFilePath)); } final String resourceUrl = s3Client.getResourceUrl(bucket, remoteFilePath); LOG.log(Level.INFO, "Package URL: {0}", resourceUrl); if (resourceUrl == null) { throw new UploaderException( String.format("Resource not found for bucket %s and path %s", bucket, remoteFilePath)); } try { return new URI(resourceUrl); } catch (URISyntaxException e) { throw new UploaderException(e.getMessage()); } }</code><technical_language>include AmazonClientException in UploaderException</technical_language>

Target:
public URI uploadPackage() throws UploaderException { if (s3Client.doesObjectExist(bucket, remoteFilePath)) { s3Client.copyObject(bucket, remoteFilePath, bucket, previousVersionFilePath); } try { s3Client.putObject(bucket, remoteFilePath, packageFileHandler); } catch (SdkClientException e) { throw new UploaderException( String.format("Error writing topology package to %s %s", bucket, remoteFilePath), e); } final URL resourceUrl = s3Client.getUrl(bucket, remoteFilePath); LOG.log(Level.INFO, "Package URL: {0}", resourceUrl); if (resourceUrl == null) { throw new UploaderException( String.format("Resource not found for bucket %s and path %s", bucket, remoteFilePath)); } try { return resourceUrl.toURI(); } catch (URISyntaxException e) { throw new UploaderException( String.format("Could not convert URL %s to URI", resourceUrl, e)); } }
Source:
<code>public int getRefPos() { <START> return 0; <END> }</code><technical_language>zero error code? -1 avoid confusing zero-based indexing</technical_language>

Target:
public int getRefPos() { return -1; }
Source:
<code>public HttpResponse doChangePassword( @QueryParameter String password, @QueryParameter String newPassword1, @QueryParameter String newPassword2 ) throws Exception { try { parent.connect(dn,password).close(); } catch (javax.naming.AuthenticationException e) { throw new UserError("Wrong current password"); } if (!newPassword1.equals(newPassword2)) <START> throw new UserError("New Password mismatch"); <END> Attributes attrs = new BasicAttributes(); attrs.put("userPassword", PasswordUtil.hashPassword(newPassword1)); LdapContext context = parent.connect(); try { context.modifyAttributes(dn,DirContext.REPLACE_ATTRIBUTE,attrs); } finally { context.close(); } LOGGER.info("User "+userId+" changed the password"); return new HttpRedirect("done"); }</code><technical_language>a clearer error message, unclear this is about</technical_language>

Target:
public HttpResponse doChangePassword( @QueryParameter String password, @QueryParameter String newPassword1, @QueryParameter String newPassword2 ) throws Exception { try { parent.connect(dn,password).close(); } catch (javax.naming.AuthenticationException e) { throw new UserError("Wrong current password"); } if (!newPassword1.equals(newPassword2)) throw new UserError("Password does not match the confirm password"); Attributes attrs = new BasicAttributes(); attrs.put("userPassword", PasswordUtil.hashPassword(newPassword1)); LdapContext context = parent.connect(); try { context.modifyAttributes(dn,DirContext.REPLACE_ATTRIBUTE,attrs); } finally { context.close(); } LOGGER.info("User "+userId+" changed the password"); return new HttpRedirect("done"); }
Source:
<code>public SubPlan createSubPlans(Session session, Metadata metadata, NodePartitioningManager nodePartitioningManager, Plan plan, boolean forceSingleNode) { Fragmenter fragmenter = new Fragmenter(session, metadata, plan.getTypes(), plan.getStats(), plan.getCosts()); FragmentProperties properties = new FragmentProperties(new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), plan.getRoot().getOutputSymbols())); if (forceSingleNode || isForceSingleNodeOutput(session)) { properties = properties.setSingleNodeDistribution(); } PlanNode root = SimplePlanRewriter.rewriteWith(fragmenter, plan.getRoot(), properties); <START> SubPlan subPlan = fragmenter.buildRootFragment(root, properties, plan.getStats(), plan.getCosts()); <END> subPlan = analyzeGroupedExecution(session, metadata, nodePartitioningManager, subPlan); checkState(!isForceSingleNodeOutput(session) || subPlan.getFragment().getPartitioning().isSingleNode(), "Root of PlanFragment is not single node"); sanityCheckFragmentedPlan(subPlan, getQueryMaxStageCount(session)); return subPlan; }</code><technical_language>do need pass parameters if full maps Fragmenter fields</technical_language>

Target:
public SubPlan createSubPlans(Session session, Metadata metadata, NodePartitioningManager nodePartitioningManager, Plan plan, boolean forceSingleNode) { Fragmenter fragmenter = new Fragmenter(session, metadata, plan.getTypes(), plan.getStatsAndCosts()); FragmentProperties properties = new FragmentProperties(new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), plan.getRoot().getOutputSymbols())); if (forceSingleNode || isForceSingleNodeOutput(session)) { properties = properties.setSingleNodeDistribution(); } PlanNode root = SimplePlanRewriter.rewriteWith(fragmenter, plan.getRoot(), properties); SubPlan subPlan = fragmenter.buildRootFragment(root, properties); subPlan = analyzeGroupedExecution(session, metadata, nodePartitioningManager, subPlan); checkState(!isForceSingleNodeOutput(session) || subPlan.getFragment().getPartitioning().isSingleNode(), "Root of PlanFragment is not single node"); sanityCheckFragmentedPlan(subPlan, getQueryMaxStageCount(session)); return subPlan; }
Source:
<code>public static CipherSource blowfish() throws Exception { <START> int ivLength = 8; <END> return new CipherSource() { private Cipher get(KeySource source, int mode, byte[] iv) throws Exception { final Cipher c = Cipher.getInstance("Blowfish/CBC/PKCS5Padding"); final byte[] sourceKey = source.getKey(); final Key key = new SecretKeySpec(sourceKey, "Blowfish"); AlgorithmParameterSpec spec = new IvParameterSpec(iv); c.init(mode, key, spec); return c; } @Override public String encrypt(KeySource source, String data) throws Exception { final byte[] dataBytes = data.getBytes(ENCODING); final byte[] iv = KeySources.random(ivLength).getKey(); final Cipher cipher = get(source, Cipher.ENCRYPT_MODE, iv); final byte[] encryptedData = cipher.doFinal(dataBytes); final byte[] encryptedBytes = new byte[encryptedData.length + ivLength]; System.arraycopy(iv, 0, encryptedBytes, 0, ivLength); System.arraycopy(encryptedData, 0, encryptedBytes, ivLength, encryptedData.length); return BASE64_ENCODER.apply(encryptedBytes); } @Override public String decrypt(KeySource source, String data) throws Exception { final byte[] encryptedBytes = BASE64_DECODER.apply(data.getBytes(ENCODING)); final byte[] iv = new byte[ivLength]; System.arraycopy(encryptedBytes, 0, iv, 0, ivLength); final Cipher cipher = get(source, Cipher.DECRYPT_MODE, iv); return new String(cipher.doFinal(encryptedBytes, ivLength, encryptedBytes.length - ivLength), ENCODING); } }; }</code><technical_language>for aesGcm IV length configurable: 2 methods a blowfish(int) a blowfish() calls blowfish(8)</technical_language>

Target:
public static CipherSource blowfish() throws Exception { int ivLength = 8; return new SymmetricKeyCipherSource(ivLength) { @Override protected Cipher get(KeySource source, int encryptMode, byte[] iv) throws Exception { final Cipher c = Cipher.getInstance("Blowfish/CBC/PKCS5Padding"); final byte[] sourceKey = source.getKey(); final Key key = new SecretKeySpec(sourceKey, "Blowfish"); AlgorithmParameterSpec spec = new IvParameterSpec(iv); c.init(encryptMode, key, spec); return c; } }; }
Source:
<code>public ChartData(IDataChartProvider<?> provider, List<ChartSeries> series) { fProvider = provider; <START> fSeries = checkNotNull(ImmutableList.copyOf(series)); <END> }</code><technical_language>need checkNotNull</technical_language>

Target:
public ChartData(IDataChartProvider<?> provider, List<ChartSeries> series) { fProvider = provider; fSeries = ImmutableList.copyOf(series); }
Source:
<code>private void handleCVSException(CVSException ex) { IStatus status = ex.getStatus(); List toShow = new ArrayList(); IStatus children[] = status.getChildren(); boolean may = true; for (int i = 0; i < children.length; i++) { if (children[i].getCode() == CVSStatus.BINARY_FILES_DIFFER || children[i].getCode() == CVSStatus.PROTOCOL_ERROR || children[i].getCode() == CVSStatus.ERROR_LINE) { toShow.add(children[i]); if (children[i].getCode() == CVSStatus.BINARY_FILES_DIFFER) may = false; } } if (toShow.size() > 0) { String msg = may ? CVSUIMessages.DiffOperation_ThePatchMayNotContainAllTheChanges : CVSUIMessages.DiffOperation_ThePatchDoesNotContainAllTheChanges; if (!patchHasNewFiles && !patchHasContents) { toShow.add(new Status(IStatus.ERROR, CVSProviderPlugin.ID, CVSUIMessages.GenerateCVSDiff_noDiffsFoundMsg)); <START> emptyDiffReported = true; <END> } status = new MultiStatus(CVSProviderPlugin.ID, CVSStatus.SERVER_ERROR, (IStatus[]) toShow.toArray(new IStatus[0]), CVSUIMessages.DiffOperation_ErrorsOccurredWhileCreatingThePatch, null); CVSUIPlugin.openError(getShell(), this.getTaskName(), msg, status, CVSUIPlugin.PERFORM_SYNC_EXEC | CVSUIPlugin.LOG_OTHER_EXCEPTIONS); } }</code><technical_language>Do set emptyDiffReported true here, enough set in #reportEmptyDiff? checked a redundancy</technical_language>

Target:
private void handleCVSException(CVSException ex) { IStatus status = ex.getStatus(); List toShow = new ArrayList(); IStatus children[] = status.getChildren(); boolean may = true; for (int i = 0; i < children.length; i++) { if (children[i].getCode() == CVSStatus.BINARY_FILES_DIFFER || children[i].getCode() == CVSStatus.PROTOCOL_ERROR || children[i].getCode() == CVSStatus.ERROR_LINE) { toShow.add(children[i]); if (children[i].getCode() == CVSStatus.BINARY_FILES_DIFFER) may = false; } } if (toShow.size() > 0) { String msg = may ? CVSUIMessages.DiffOperation_ThePatchMayNotContainAllTheChanges : CVSUIMessages.DiffOperation_ThePatchDoesNotContainAllTheChanges; status = new MultiStatus(CVSProviderPlugin.ID, CVSStatus.SERVER_ERROR, (IStatus[]) toShow.toArray(new IStatus[0]), CVSUIMessages.DiffOperation_ErrorsOccurredWhileCreatingThePatch, null); CVSUIPlugin.openError(getShell(), this.getTaskName(), msg, status, CVSUIPlugin.PERFORM_SYNC_EXEC | CVSUIPlugin.LOG_OTHER_EXCEPTIONS); errorReported = true; } }
Source:
<code>private void assertCodeMakes(String method, Multimap<String, String> headers, URI uri, int statusCode, String message, String contentType, String content, Class<? extends Exception> expected) { GlanceErrorHandler function = new GlanceErrorHandler(); HttpCommand command = createMock(HttpCommand.class); HttpRequest request = HttpRequest.builder().method(method).headers(headers).endpoint(uri).build(); HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build(); response.getPayload().getContentMetadata().setContentType(contentType); expect(command.getCurrentRequest()).andReturn(request).atLeastOnce(); if (expected != null) <START> command.setException(classEq(expected)); <END> replay(command); function.handleError(command, response); verify(command); }</code><technical_language>[minor] if (...) { ... }</technical_language>

Target:
private void assertCodeMakes(String method, Multimap<String, String> headers, URI uri, int statusCode, String message, String contentType, String content, Class<? extends Exception> expected) { GlanceErrorHandler function = new GlanceErrorHandler(); HttpCommand command = createMock(HttpCommand.class); HttpRequest request = HttpRequest.builder().method(method).headers(headers).endpoint(uri).build(); HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build(); response.getPayload().getContentMetadata().setContentType(contentType); expect(command.getCurrentRequest()).andReturn(request).atLeastOnce(); if (expected != null) { command.setException(classEq(expected)); } replay(command); function.handleError(command, response); verify(command); }
Source:
<code>public void testIntermediateWriteFailures() { ChannelHandler encoder = new MessageToMessageEncoder<Object>() { @Override protected void encode(ChannelHandlerContext ctx, Object msg, List<Object> out) { out.add(new Object()); out.add(msg); } }; final Exception firstWriteException = new Exception(); ChannelHandler writeThrower = new ChannelOutboundHandlerAdapter() { private boolean firstWritten; @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) { if (firstWritten) { ctx.write(msg, promise); } else { firstWritten = true; promise.setFailure(firstWriteException); } } }; EmbeddedChannel channel = new EmbeddedChannel(writeThrower, encoder); Object msg = new Object(); ChannelFuture write = channel.writeAndFlush(msg); <START> assertEquals(firstWriteException, write.cause()); <END> assertEquals(msg, channel.readOutbound()); }</code><technical_language>Call channel.finish() asset return</technical_language>

Target:
public void testIntermediateWriteFailures() { ChannelHandler encoder = new MessageToMessageEncoder<Object>() { @Override protected void encode(ChannelHandlerContext ctx, Object msg, List<Object> out) { out.add(new Object()); out.add(msg); } }; final Exception firstWriteException = new Exception(); ChannelHandler writeThrower = new ChannelOutboundHandlerAdapter() { private boolean firstWritten; @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) { if (firstWritten) { ctx.write(msg, promise); } else { firstWritten = true; promise.setFailure(firstWriteException); } } }; EmbeddedChannel channel = new EmbeddedChannel(writeThrower, encoder); Object msg = new Object(); ChannelFuture write = channel.writeAndFlush(msg); assertSame(firstWriteException, write.cause()); assertSame(msg, channel.readOutbound()); assertFalse(channel.finish()); }
Source:
<code>public StreamingEntropy(String type, String base) { <START> this.x = null; <END> this.cx = 0; this.lastCmp = 0; this.estimator = EntropyEstimator.createEstimator(type, base); if(this.estimator == null) { throw new IllegalArgumentException("input entropy estimator type is not supported. " + "Please refer to StreamingEntropy's javadoc for the supported estimator types"); } }</code><technical_language>call cleanup() instead, move code need there. is code in places currently hard maintain</technical_language>

Target:
public StreamingEntropy(String type, String base) throws ExecException { try { this.estimator = EntropyEstimator.createEstimator(type, base); } catch (IllegalArgumentException ex) { throw new ExecException( String.format("Fail to initialize StreamingEntropy with entropy estimator of type (%s), base: (%s), exception: (%s)", type, base, ex) ); } cleanup(); }
Source:
<code>public boolean isList() { <START> if (isProperty) <END> return prop.isList(); else return false; }</code><technical_language>Personally for simple things, I simple a ternary operation for code simplicity. in mind code size</technical_language>

Target:
public boolean isList() { return isProperty && prop.isList(); }
Source:
<code>public void testAddwithExistingTarget() throws DogException { AdderUsageObserver.setUsed( false ); Source source = new Source(); <START> source.setPets( Arrays.asList( new String[]{ "mouse" } ) ); <END> Target target = new Target(); target.setPets( new ArrayList<Long>( Arrays.asList( new Long[]{ 1L } ) ) ); SourceTargetMapper.INSTANCE.toExistingTarget( source, target ); assertThat( target ).isNotNull(); assertThat( target.getPets().size() ).isEqualTo( 2 ); assertThat( target.getPets().get( 0 ) ).isEqualTo( 1L ); assertThat( target.getPets().get( 1 ) ).isEqualTo( 2L ); assertTrue( AdderUsageObserver.isUsed() ); }</code><technical_language>source.setPets( Arrays.asList( "mouse" } );. do prefer pattern for a specific reason</technical_language>

Target:
public void testAddwithExistingTarget() throws DogException { AdderUsageObserver.setUsed( false ); Source source = new Source(); source.setPets( Arrays.asList( "mouse" ) ); Target target = new Target(); target.setPets( new ArrayList<Long>( Arrays.asList( 1L ) ) ); SourceTargetMapper.INSTANCE.toExistingTarget( source, target ); assertThat( target ).isNotNull(); assertThat( target.getPets().size() ).isEqualTo( 2 ); assertThat( target.getPets().get( 0 ) ).isEqualTo( 1L ); assertThat( target.getPets().get( 1 ) ).isEqualTo( 2L ); assertTrue( AdderUsageObserver.isUsed() ); }
Source:
<code>UnwrappedMessageContent unwrapContent(byte[] data, Schema schema) { try { Map<Utf8, Utf8> metadata = (Map<Utf8, Utf8>) bytesToRecord(data, schema).get(METADATA_MARKER); <START> long timestamp = getTimestamp(metadata); <END> String messageId = getMessageId(metadata, timestamp); Map<String, String> externalMetadata = extractMetadata(metadata); return new UnwrappedMessageContent(new MessageMetadata(timestamp, messageId, externalMetadata), data); } catch (Exception exception) { throw new UnwrappingException("Could not read avro message", exception); } }</code><technical_language>I check if metadata exists instead of checking in field is read here</technical_language>

Target:
UnwrappedMessageContent unwrapContent(byte[] data, Schema schema) { try { Map<Utf8, Utf8> metadata = (Map<Utf8, Utf8>) bytesToRecord(data, schema).get(METADATA_MARKER); MessageMetadata messageMetadata = getMetadata(metadata); return new UnwrappedMessageContent(messageMetadata, data); } catch (Exception exception) { throw new UnwrappingException("Could not read avro message", exception); } }
Source:
<code>public Collection<GrantedAuthority> convert(Jwt source) { <START> Collection<GrantedAuthority> result = new ArrayList<>(); <END> for (Converter<Jwt, Collection<GrantedAuthority>> converter: converters) { Collection<GrantedAuthority> authorities = converter.convert(source); if (authorities != null) { result.addAll(authorities); } } return result; }</code><technical_language>multiple converters resolve duplicate instances of SimpleGrantedAuthority, please change RHS LinkedHashSet</technical_language>

Target:
public Collection<GrantedAuthority> convert(Jwt source) { Collection<GrantedAuthority> result = new LinkedHashSet<>(); for (Converter<Jwt, Collection<GrantedAuthority>> converter: this.converters) { Collection<GrantedAuthority> authorities = converter.convert(source); if (authorities != null) { result.addAll(authorities); } } return result; }
Source:
<code>private void displayNonLeadSection(int index) { activity.updateProgressBar(true, false, PageActivity.PROGRESS_BAR_MAX_VALUE / model.getPage() .getSections().size() * index); try { final Page page = model.getPage(); JSONObject wrapper = new JSONObject(); wrapper.put("sequence", pageSequenceNum); if (index < page.getSections().size()) { wrapper.put("section", page.getSections().get(index).toJSON()); wrapper.put("index", index); if (sectionTargetFromIntent > 0 && sectionTargetFromIntent < page.getSections().size()) { wrapper.put("fragment", page.getSections().get(sectionTargetFromIntent).getAnchor()); } else if (sectionTargetFromTitle != null) { wrapper.put("fragment", sectionTargetFromTitle); } <START> Log.d(TAG, "Added request for section " + page.getSections().get(index).toJSON().getString("line")); <END> } else { wrapper.put("noMore", true); } wrapper.put("scrollY", (int) (stagedScrollY / activity.getResources().getDisplayMetrics().density)); bridge.sendMessage("displaySection", wrapper); } catch (JSONException e) { ACRA.getErrorReporter().handleException(e); } }</code><technical_language>minor: nice a local for page.getSections().get(index).toJSON() is referenced line 571</technical_language>

Target:
private void displayNonLeadSection(int index) { activity.updateProgressBar(true, false, PageActivity.PROGRESS_BAR_MAX_VALUE / model.getPage() .getSections().size() * index); try { final Page page = model.getPage(); JSONObject wrapper = new JSONObject(); wrapper.put("sequence", pageSequenceNum); if (index < page.getSections().size()) { JSONObject section = page.getSections().get(index).toJSON(); wrapper.put("section", section); wrapper.put("index", index); if (sectionTargetFromIntent > 0 && sectionTargetFromIntent < page.getSections().size()) { wrapper.put("fragment", page.getSections().get(sectionTargetFromIntent).getAnchor()); } else if (sectionTargetFromTitle != null) { wrapper.put("fragment", sectionTargetFromTitle); } Log.d(TAG, "Added request for section " + section.getString("line")); } else { wrapper.put("noMore", true); } wrapper.put("scrollY", (int) (stagedScrollY / activity.getResources().getDisplayMetrics().density)); bridge.sendMessage("displaySection", wrapper); } catch (JSONException e) { ACRA.getErrorReporter().handleException(e); } }
Source:
<code>public static byte[] hash(byte[] data) throws NoSuchAlgorithmException { MessageDigest crypt; crypt = MessageDigest.getInstance("SHA-1"); crypt.reset(); crypt.update(data); <START> return crypt.digest(); <END> }</code><technical_language>call other version of hash() instead? java public static byte[] hash(byte[] data) throws NoSuchAlgorithmException { return hash(data, 0, data.length); }</technical_language>

Target:
public static byte[] hash(byte[] data) throws NoSuchAlgorithmException { return hash(data, 0, data.length); }
Source:
<code>public void shouldShutdownInternalExecutorService() throws Exception { this.initiator.start(); <START> this.initiator.destroy(); <END> ExecutorService executorService = (ExecutorService) TestUtils.getPropertyValue(this.initiator, "executorService"); assertTrue(executorService.isShutdown()); }</code><technical_language>I is guarantee in method execution order in test class. So, this destroy() shared variable is dangerous this test method called other. sense you</technical_language>

Target:
public void shouldShutdownInternalExecutorService() throws Exception { this.initiator.start(); this.initiator.destroy(); ExecutorService executorService = TestUtils.getPropertyValue(this.initiator, "executorService", ExecutorService.class); assertTrue(executorService.isShutdown()); }
Source:
<code>protected void verify(Step model, Step transform) { assertNotNull(transform); assertEquals(model.getId(), transform.getId()); <START> assertEquals(model.getDescription(), transform.getDescription()); <END> }</code><technical_language>test some more fields</technical_language>

Target:
protected void verify(Step model, Step transform) { assertNotNull(transform); assertEquals(model.getId(), transform.getId()); assertEquals(model.getDescription(), transform.getDescription()); assertEquals(model.getJob(), transform.getJob()); if (model.getParentStep() != null) { assertEquals(model.getParentStep(), transform.getParentStep()); } }
Source:
<code>public SpatialIndexBuilderOperator createOperator(DriverContext driverContext) { checkState(!closed, "Factory is already closed"); OperatorContext operatorContext = driverContext.addOperatorContext(operatorId, planNodeId, HashBuilderOperator.class.getSimpleName()); <START> SpatialIndexBuilderOperator operator = new SpatialIndexBuilderOperator( <END> operatorContext, pagesSpatialIndexFactory, outputChannels, indexChannel, filterFunctionFactory, expectedPositions, pagesIndexFactory); return operator; }</code><technical_language>nit: return assigning</technical_language>

Target:
public SpatialIndexBuilderOperator createOperator(DriverContext driverContext) { checkState(!closed, "Factory is already closed"); OperatorContext operatorContext = driverContext.addOperatorContext(operatorId, planNodeId, SpatialIndexBuilderOperator.class.getSimpleName()); return new SpatialIndexBuilderOperator( operatorContext, pagesSpatialIndexFactory, outputChannels, indexChannel, spatialRelationshipTest, filterFunctionFactory, expectedPositions, pagesIndexFactory); }
Source:
<code>public void static_member_usages() { ClassSymbolImpl classSymbol = ((ClassSymbolImpl) lastClassSymbol( "class A:", " foo = 42", " def __init__(self): ", " A.foo", " A.bar" )); <START> Map<String, Symbol> members = classSymbol.declaredMembers().stream().collect(Collectors.toMap(Symbol::name, Function.identity())); <END> Symbol foo = members.get("foo"); assertThat(foo.usages()).extracting(Usage::kind).containsExactly(Usage.Kind.ASSIGNMENT_LHS, Usage.Kind.OTHER); assertThat(members.get("bar")).isNull(); classSymbol = ((ClassSymbolImpl) lastClassSymbol( "class A:", " foo1 = 42", " def __init__(self, x): ", " getClass().foo2", " x.foo3", " unknown.foo4" )); assertThat(classSymbol.declaredMembers()) .filteredOn("kind", Symbol.Kind.OTHER) .extracting(Symbol::name).containsOnly("foo1"); }</code><technical_language>resolveMember</technical_language>

Target:
public void static_member_usages() { ClassSymbol classSymbol = lastClassSymbol( "class A:", " foo = 42", " def __init__(self): ", " A.foo", " A.foo = 0", " A.bar" ); Symbol foo = classSymbol.resolveMember("foo").get(); assertThat(foo.usages()).extracting(Usage::kind).containsExactly(Usage.Kind.ASSIGNMENT_LHS, Usage.Kind.OTHER, Usage.Kind.ASSIGNMENT_LHS); assertThat(classSymbol.resolveMember("bar")).isEmpty(); }
Source:
<code>public TransactionImple recoverTransaction(Uid actId) throws XAException { if (actId == null) throw new IllegalArgumentException(); TransactionImple recovered = new TransactionImple(actId); if (recovered.baseXid() == null) throw new IllegalArgumentException(); <START> <END> return addImportedTransaction(recovered); }</code><technical_language>superfluous formatting change</technical_language>

Target:
public TransactionImple recoverTransaction(Uid actId) throws XAException { if (actId == null) throw new IllegalArgumentException(); TransactionImple recovered = new TransactionImple(actId); if (recovered.baseXid() == null) throw new IllegalArgumentException(); return addImportedTransaction(recovered, recovered.baseXid(), null, 0); }
Source:
<code>private boolean isCreateSnapshotAvailable(List<GlusterVolumeEntity> list) { <START> boolean bricksUpFlag = true; <END> if (list.size() == 1) { List<GlusterBrickEntity> bricks = list.get(0).getBricks(); for (GlusterBrickEntity brick : bricks) { if (brick.getStatus() != GlusterStatus.UP) { bricksUpFlag = false; break; } } return (list.get(0).getStatus() == GlusterStatus.UP && bricksUpFlag); } else { return false; } }</code><technical_language>is this required</technical_language>

Target:
private boolean isCreateSnapshotAvailable(List<GlusterVolumeEntity> list) { if (list.size() == 1) { List<GlusterBrickEntity> bricks = list.get(0).getBricks(); for (GlusterBrickEntity brick : bricks) { if (brick.getStatus() != GlusterStatus.UP) { return false; } } return (list.get(0).getStatus() == GlusterStatus.UP); } else { return false; } }
Source:
<code>public void VEMediaTests_005_resizeVideoWithHandle() { <START> int numOfVideo = 1; <END> VisualEditorPageObject ve = base.launchVisualEditorWithMainEdit(articleName, wikiURL); VisualEditorAddMediaDialog mediaDialog = (VisualEditorAddMediaDialog) ve.openDialogFromMenu(InsertDialog.MEDIA); mediaDialog = mediaDialog.searchMedia("h"); ve = mediaDialog.addExistingMedia(numOfVideo); ve.verifyVideos(numOfVideo); Dimension source = ve.getVideoDimension(); ve.randomResizeOnMedia(); ve.verifyVideoResized(source); VisualEditorSaveChangesDialog save = ve.clickPublishButton(); ArticlePageObject article = save.savePage(); article.verifyVEPublishComplete(); article.logOut(wikiURL); }</code><technical_language>move top of class more once? :)</technical_language>

Target:
public void VEMediaTests_005_resizeVideoWithHandle() { VisualEditorPageObject ve = base.launchVisualEditorWithMainEdit(articleName, wikiURL); VisualEditorAddMediaDialog mediaDialog = (VisualEditorAddMediaDialog) ve.openDialogFromMenu(InsertDialog.MEDIA); mediaDialog = mediaDialog.searchMedia("h"); ve = mediaDialog.addExistingMedia(numOfVideo); ve.verifyVideos(numOfVideo); Dimension source = ve.getVideoDimension(); ve.randomResizeOnMedia(); ve.verifyVideoResized(source); VisualEditorSaveChangesDialog save = ve.clickPublishButton(); ArticlePageObject article = save.savePage(); article.verifyVEPublishComplete(); article.logOut(wikiURL); }
Source:
<code>public void testMaxExecuteWorkerTime() throws Exception { String poolName = TestUtils.randomAlphaString(10); long maxWorkerExecuteTime = NANOSECONDS.convert(3, SECONDS); DeploymentOptions deploymentOptions = new DeploymentOptions() .setWorkerPoolName(poolName) .setMaxWorkerExecuteTime(maxWorkerExecuteTime); vertx.deployVerticle(new AbstractVerticle() { @Override public void start(Future<Void> startFuture) throws Exception { vertx.executeBlocking(fut -> { try { SECONDS.sleep(5); fut.complete(); } catch (InterruptedException e) { fut.fail(e); } }, startFuture); } }, deploymentOptions, onSuccess(did -> { testComplete(); })); await(); String timeLimitMsg = "time limit is " + MILLISECONDS.convert(maxWorkerExecuteTime, NANOSECONDS); assertTrue(Files.lines(Paths.get(System.getProperty("java.io.tmpdir"), "vertx.log")) .anyMatch(line -> { <START> if (line.contains("has been blocked for") <END> && line.contains(timeLimitMsg) && line.contains(poolName)) { return true; } return false; })); }</code><technical_language>return expression instead of if (expression) return true else return false</technical_language>

Target:
public void testMaxExecuteWorkerTime() throws Exception { String poolName = TestUtils.randomAlphaString(10); long maxWorkerExecuteTime = NANOSECONDS.convert(3, SECONDS); DeploymentOptions deploymentOptions = new DeploymentOptions() .setWorkerPoolName(poolName) .setMaxWorkerExecuteTime(maxWorkerExecuteTime); vertx.deployVerticle(new AbstractVerticle() { @Override public void start(Future<Void> startFuture) throws Exception { vertx.executeBlocking(fut -> { try { SECONDS.sleep(5); fut.complete(); } catch (InterruptedException e) { fut.fail(e); } }, startFuture); } }, deploymentOptions, onSuccess(did -> { testComplete(); })); await(); blockedThreadWarning.expectMessage(poolName, maxWorkerExecuteTime); }
Source:
<code>public Map<String, String> getJobMessageProperties() { if (jobProperties == null) { jobProperties = super.getJobMessageProperties(); jobProperties.put(VdcObjectType.VmTemplate.name().toLowerCase(), (getVmTemplateName() == null) ? "" : getVmTemplateName()); <START> jobProperties.put("domainname", getStorageDomainName()); <END> } return jobProperties; }</code><technical_language>modify ovirt-engine/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties: job.ImportVmTemplate=Importing VM Template ${VmTemplate} Storage Domain ${DomainName} job.ImportVmTemplate=Importing VM Template ${VmTemplate} Storage Domain ${Storage} (same for job.ImportVm=Importing VM ${VM} Data Domain ${DomainName}) jobProperties.put(VdcObjectType.StoragePool.name().toLowerCase(), getStorageDomainName());</technical_language>

Target:
public Map<String, String> getJobMessageProperties() { if (jobProperties == null) { jobProperties = super.getJobMessageProperties(); jobProperties.put(VdcObjectType.VmTemplate.name().toLowerCase(), (getVmTemplateName() == null) ? "" : getVmTemplateName()); jobProperties.put(VdcObjectType.Storage.name().toLowerCase(), getStorageDomainName()); } return jobProperties; }
Source:
<code>public Subscriber<? super T> call(final Subscriber<? super T> child) { return new Subscriber<T>() { private volatile boolean isEmpty = true; @Override public void onCompleted() { if (isEmpty) <START> action.call(); <END> child.onCompleted(); } @Override public void onError(Throwable e) { child.onError(e); } @Override public void onNext(T t) { isEmpty = false; try { child.onNext(t); } catch (Exception e) { Exceptions.throwOrReport(e, this, t); } } }; }</code><technical_language>this call get a try catch Exceptions.throwOrReport called? If so, put in a PR for OperatorDoAfterTerminate well</technical_language>

Target:
public Subscriber<? super T> call(final Subscriber<? super T> child) { return new Subscriber<T>(child) { private boolean isEmpty = true; private boolean done = false; @Override public void onCompleted() { if (done) { return; } if (isEmpty) { try { onEmpty.call(); } catch (Throwable e) { Exceptions.throwOrReport(e,this); return; } if (!isUnsubscribed()) { child.onCompleted(); } } else { child.onCompleted(); } done = true; } @Override public void onError(Throwable e) { if (done) { return; } child.onError(e); } @Override public void onNext(T t) { if (done) { return; } isEmpty = false; child.onNext(t); } }; }
Source:
<code><START> public UpdateUserCommand(User user) { <END> this.user = user; setId(user.getId()); if (user.getName() != null) { setFirstName(user.getName().getGivenName()); setLastName(user.getName().getFamilyName()); } Email primaryEmail = getPrimaryEMail(user); if (primaryEmail != null) { setEmail(primaryEmail.getValue()); } }</code><technical_language>thought builder pattern follow code line in other projects</technical_language>

Target:
public UpdateUserCommand(User user) { this.user = user; setId(user.getId()); if (user.getName() != null) { setFirstName(user.getName().getGivenName()); setLastName(user.getName().getFamilyName()); } Optional<Email> primaryEmail = SCIMHelper.getPrimaryOrFirstEmail(user); if (primaryEmail.isPresent()) { setEmail(primaryEmail.get().getValue()); } }