auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public JobResult updateWorkspace(UpdateWorkspaceParameters updateWorkspaceParameters) { if (updateWorkspaceParameters.getAddedProjectsUri().isEmpty()) { if (!findInitializedLanguageServer().isPresent()) { JobResult jobResult = new JobResult(); jobResult.setMessage( "Skipped. Language server not initialized. Workspace updating is not required."); return jobResult; } } Type type = new TypeToken<JobResult>() {}.getType(); <START> return doGetOne(Commands.UPDATE_WORKSPACE, singletonList(updateWorkspaceParameters), type, 60); <END> }</code><technical_language>some constant timeout org.eclipse.che.ide.ext.java.shared.Constants, move this number change existed. do think</technical_language>

Target:
public JobResult updateWorkspace(UpdateWorkspaceParameters updateWorkspaceParameters) { if (updateWorkspaceParameters.getAddedProjectsUri().isEmpty()) { if (!findInitializedLanguageServer().isPresent()) { return new JobResult( Severity.OK, 0, "Skipped. Language server not initialized. Workspace updating is not required."); } } Type type = new TypeToken<JobResult>() {}.getType(); return doGetOne( Commands.UPDATE_WORKSPACE, singletonList(updateWorkspaceParameters), type, REIMPORT_MAVEN_PROJECTS_REQUEST_TIMEOUT, TimeUnit.MILLISECONDS); }
Source:
<code>public T insert(SQLiteDatabase db, T entityAdapter, boolean isSyncAdapter) { <START> Log.d("Logging EntityProcessor", "before insert"); <END> T result = mDelegate.insert(db, entityAdapter, isSyncAdapter); Log.d("Logging EntityProcessor", "after insert on " + entityAdapter.id()); return result; }</code><technical_language>Move tag a constant</technical_language>

Target:
public T insert(SQLiteDatabase db, T entityAdapter, boolean isSyncAdapter) { Log.d(TAG, "before insert"); T result = mDelegate.insert(db, entityAdapter, isSyncAdapter); Log.d(TAG, "after insert on " + entityAdapter.id()); return result; }
Source:
<code>public void testCloseChannelOnSendError() throws Exception { when(transport.submit(anyObject())).thenReturn(Observable.<Void>error(new Exception("msg"))); <START> final CountDownLatch onErrorLatch = new CountDownLatch(1); <END> channel.asLifecycleObservable().subscribe(new Subscriber<Void>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { onErrorLatch.countDown(); } @Override public void onNext(Void aVoid) { } }); channel.sendOnTransport("My Message"); verify(channel, times(1)).close(); Assert.assertTrue(onErrorLatch.await(10, TimeUnit.SECONDS)); }</code><technical_language>TestSubscriber for purpose</technical_language>

Target:
public void testCloseChannelOnSendError() throws Exception { when(transport.submit(anyObject())).thenReturn(Observable.<Void>error(new Exception("msg"))); channel.asLifecycleObservable().subscribe(subscriber); channel.sendOnTransport("My Message"); verify(channel, times(1)).close(); subscriber.awaitTerminalEvent(10, TimeUnit.SECONDS); Assert.assertEquals(1, subscriber.getOnErrorEvents().size()); }
Source:
<code>public void testGetClientIp() { String clientIp = IpUtil.getClientIp( "37.228.105.17", <START> "101.209.27.230,%20101.209.27.230" END> ); assertEquals("Return IP address is not the client's IP in XFF", "101.209.27.230", clientIp); }</code><technical_language>x_forwarded_for values encoded in Hive</technical_language>

Target:
public void testGetClientIp() { String clientIp = IpUtil.getClientIp( "37.228.105.17", "127.0.0.1,10.0.0.1,192.168.27.230,169.254.27.230,%20101.209.27.230,101.209.27.230" ); assertEquals("Return IP address is not the client's IP in XFF", "101.209.27.230", clientIp); }
Source:
<code>public Map<Sha256Hash, Long> lookupStreamIdsByHash(Transaction t, final Set<Sha256Hash> hashes) { if (hashes.isEmpty()) { return ImmutableMap.of(); } UserPhotosStreamHashAidxTable idx = tables.getUserPhotosStreamHashAidxTable(t); Set<UserPhotosStreamHashAidxTable.UserPhotosStreamHashAidxRow> rows = getHashIndexRowsForHashes(hashes); Multimap<UserPhotosStreamHashAidxTable.UserPhotosStreamHashAidxRow, UserPhotosStreamHashAidxTable.UserPhotosStreamHashAidxColumnValue> m = idx.getRowsMultimap(rows); Map<Long, Sha256Hash> hashForStreams = Maps.newHashMap(); for (UserPhotosStreamHashAidxTable.UserPhotosStreamHashAidxRow r : m.keySet()) { for (UserPhotosStreamHashAidxTable.UserPhotosStreamHashAidxColumnValue v : m.get(r)) { Long streamId = v.getColumnName().getStreamId(); Sha256Hash hash = r.getHash(); if (hashForStreams.containsKey(streamId)) { <START> AssertUtils.assertAndLog(hashForStreams.get(streamId).equals(hash), "(BUG) Stream ID has 2 different hashes: " + streamId); <END> } hashForStreams.put(streamId, hash); } } Map<Long, StreamMetadata> metadata = getMetadata(t, hashForStreams.keySet()); Map<Sha256Hash, Long> ret = Maps.newHashMap(); for (Map.Entry<Long, StreamMetadata> e : metadata.entrySet()) { if (e.getValue().getStatus() != Status.STORED) { continue; } Sha256Hash hash = hashForStreams.get(e.getKey()); ret.put(hash, e.getKey()); } return ret; }</code><technical_language>I guess added this logger recently, added gen code schema renderer, add schema renderer</technical_language>

Target:
public Map<Sha256Hash, Long> lookupStreamIdsByHash(Transaction t, final Set<Sha256Hash> hashes) { if (hashes.isEmpty()) { return ImmutableMap.of(); } UserPhotosStreamHashAidxTable idx = tables.getUserPhotosStreamHashAidxTable(t); Set<UserPhotosStreamHashAidxTable.UserPhotosStreamHashAidxRow> rows = getHashIndexRowsForHashes(hashes); Multimap<UserPhotosStreamHashAidxTable.UserPhotosStreamHashAidxRow, UserPhotosStreamHashAidxTable.UserPhotosStreamHashAidxColumnValue> m = idx.getRowsMultimap(rows); Map<Long, Sha256Hash> hashForStreams = Maps.newHashMap(); for (UserPhotosStreamHashAidxTable.UserPhotosStreamHashAidxRow r : m.keySet()) { for (UserPhotosStreamHashAidxTable.UserPhotosStreamHashAidxColumnValue v : m.get(r)) { Long streamId = v.getColumnName().getStreamId(); Sha256Hash hash = r.getHash(); if (hashForStreams.containsKey(streamId)) { AssertUtils.assertAndLog(log, hashForStreams.get(streamId).equals(hash), "(BUG) Stream ID has 2 different hashes: " + streamId); } hashForStreams.put(streamId, hash); } } Map<Long, StreamMetadata> metadata = getMetadata(t, hashForStreams.keySet()); Map<Sha256Hash, Long> ret = Maps.newHashMap(); for (Map.Entry<Long, StreamMetadata> e : metadata.entrySet()) { if (e.getValue().getStatus() != Status.STORED) { continue; } Sha256Hash hash = hashForStreams.get(e.getKey()); ret.put(hash, e.getKey()); } return ret; }
Source:
<code>private static boolean hasServiceFeesToPay(final @NonNull InvoiceRow row, final CurrencyCode currencyCode) { <START> return row.getServiceFeeAmt() != null && !Amount.zero(currencyCode).equals(row.getServiceFeeAmt()); <END> }</code><technical_language>Amount.isZero instead of weird "equals" comparation...</technical_language>

Target:
private static boolean hasServiceFeesToPay(final @NonNull InvoiceRow row, final CurrencyCode currencyCode) { return row.getServiceFeeAmt() != null && !row.getServiceFeeAmt().isZero(); }
Source:
<code>private static List<LifecycleCallbackMethodReference> toLifecycleCallbackMethodRefs(Method method, List<SourceMethod> candidates, Map<SourceMethod, List<Parameter>> parameterAssignmentsForSourceMethod, MappingBuilderContext ctx, Set<String> existingVariableNames) { List<LifecycleCallbackMethodReference> result = new ArrayList<LifecycleCallbackMethodReference>(); for ( SourceMethod candidate : candidates ) { markMapperReferenceAsUsed( ctx.getMapperReferences(), candidate ); result.add( new LifecycleCallbackMethodReference( candidate, parameterAssignmentsForSourceMethod.get( candidate ), <START> method.getReturnType(), <END> existingVariableNames ) ); } return result; }</code><technical_language>This needs method.getResultType() (that's type declare result object type in generated method)</technical_language>

Target:
private static List<LifecycleCallbackMethodReference> toLifecycleCallbackMethodRefs(Method method, List<SourceMethod> candidates, Map<SourceMethod, List<Parameter>> parameterAssignmentsForSourceMethod, MappingBuilderContext ctx, Set<String> existingVariableNames) { List<LifecycleCallbackMethodReference> result = new ArrayList<LifecycleCallbackMethodReference>(); for ( SourceMethod candidate : candidates ) { markMapperReferenceAsUsed( ctx.getMapperReferences(), candidate ); result.add( new LifecycleCallbackMethodReference( candidate, parameterAssignmentsForSourceMethod.get( candidate ), method.getReturnType(), method.getResultType(), existingVariableNames ) ); } return result; }
Source:
<code>public Optional<?> getProperty(T pojo, String propertyName) { try { return ReflectionAdapterUtils.getFields(pojo.getClass()).stream() .filter(f -> Objects.equals(propertyName, f.getName())) .findFirst(); <START> } catch (IllegalAccessException e) { <END> LOG.error("Error obtaining fields from definition " + getId(pojo)); return Optional.empty(); } }</code><technical_language>SecurityException</technical_language>

Target:
public Optional<?> getProperty(T pojo, String propertyName) { try { return ReflectionAdapterUtils.getFields(pojo.getClass()).stream() .filter(f -> Objects.equals(propertyName, f.getName())) .findFirst(); } catch (SecurityException e) { LOG.error("Error obtaining fields from definition " + getId(pojo)); return Optional.empty(); } }
Source:
<code>public void visitNode(Tree tree) { ClassTree classTree = (ClassTree) tree; <START> if (hasSemantic() && classTree.symbol().metadata().isAnnotatedWith(CONFIGURATION_ANNOTATION)) { <END> AutowiredFieldVisitor autowiredFieldVisitor = new AutowiredFieldVisitor(); classTree.accept(autowiredFieldVisitor); BeanMethodVisitor beanMethodVisitor = new BeanMethodVisitor(autowiredFieldVisitor.autowiredFields.keySet()); classTree.accept(beanMethodVisitor); beanMethodVisitor.beanMethodsThatUseAutowiredFields.entrySet().stream() .filter(beanMethodsThatUseAutowiredField -> beanMethodsThatUseAutowiredField.getValue().size() == 1) .forEach(beanMethodsThatUseAutowiredField -> reportIssue( autowiredFieldVisitor.autowiredFields.get(beanMethodsThatUseAutowiredField.getKey()).simpleName(), String.format(MESSAGE_FORMAT, beanMethodsThatUseAutowiredField.getValue().get(0)))); } }</code><technical_language>semantic, metadata empty. remove "hasSemantic() && "</technical_language>

Target:
public void visitNode(Tree tree) { ClassTree classTree = (ClassTree) tree; if (classTree.symbol().metadata().isAnnotatedWith(CONFIGURATION_ANNOTATION)) { Map<Symbol, VariableTree> autowiredFields = new HashMap<>(); classTree.members().forEach(m -> collectAutowiredFields(m, autowiredFields)); Map<Symbol, List<MethodTree>> methodsThatUseAutowiredFields = new HashMap<>(); autowiredFields.keySet().forEach(f -> methodsThatUseAutowiredFields.put(f, new ArrayList<>())); classTree.members().forEach(m -> collectMethodsThatUseAutowiredFields(m, methodsThatUseAutowiredFields)); methodsThatUseAutowiredFields.entrySet().stream() .filter(methodsForField -> methodsForField.getValue().size() == 1 && methodsForField.getValue().get(0).symbol().metadata().isAnnotatedWith(BEAN_ANNOTATION)) .forEach(methodsForField -> reportIssue( autowiredFields.get(methodsForField.getKey()).simpleName(), String.format(MESSAGE_FORMAT, methodsForField.getValue().get(0).simpleName().name()))); } }
Source:
<code>public DocumentMovedEvent(DocumentReference documentReference) { <START> String move; <END> super(documentReference); this.move = move; }</code><technical_language>This build</technical_language>

Target:
public DocumentMovedEvent(DocumentReference documentReference) { this(documentReference, null); }
Source:
<code>private void handleAddBreadcrumb(Object arg) { if (arg instanceof Breadcrumb) { Breadcrumb crumb = (Breadcrumb) arg; <START> Map<String, String> metadata = new HashMap<String, String>(); <END> if (crumb.getMetadata() != null) { for (Map.Entry<String, String> entry : crumb.getMetadata().entrySet()) { if (entry.getValue() != null) { metadata.put(makeSafe(entry.getKey()), makeSafe(entry.getValue())); } } } addBreadcrumb(crumb.getName(), crumb.getType().toString(), crumb.getTimestamp(), metadata); } else { warn("Attempted to add non-breadcrumb: " + arg); } }</code><technical_language>This replaced diamond type 1.6 for conciseness: Map<String, String> metadata = new HashMap<>()</technical_language>

Target:
private void handleAddBreadcrumb(Object arg) { if (arg instanceof Breadcrumb) { Breadcrumb crumb = (Breadcrumb) arg; Map<String, String> metadata = new HashMap<>(); if (crumb.getMetadata() != null) { for (Map.Entry<String, String> entry : crumb.getMetadata().entrySet()) { if (entry.getValue() != null) { metadata.put(makeSafe(entry.getKey()), makeSafe(entry.getValue())); } } } addBreadcrumb(crumb.getName(), crumb.getType().toString(), crumb.getTimestamp(), metadata); } else { warn("Attempted to add non-breadcrumb: " + arg); } }
Source:
<code>private SpoilerManager(XMPPConnection connection) { super(connection); <START> ServiceDiscoveryManager.getInstanceFor(connection).addFeature(NAMESPACE_0); <END> }</code><technical_language>I want automatically announce support for spoiler messages. XEP is pretty clear if a spoiler message is received content displayed user's request. this not, effort, guranteed library level. I remove automatic announcement of spoiler messages instead provide a method user explicitly invoke in order announce support for spoiler messages. beneficial result, automatic manager initialization boilerplate code</technical_language>

Target:
private SpoilerManager(XMPPConnection connection) { super(connection); }
Source:
<code>protected void executeQueryCommand() { getQueryReturnValue().setReturnValue(DbFacade.getInstance().getRoleDao().get( <START> getParameters().<Guid>getParameter(UserRolesVdcParameters.RoleId, Guid.class))); <END> }</code><technical_language>have: getParameters().<Guid>getParameter(UserRolesVdsParameters.RoleId) even: getParameters().getParameter(UserRolesVdsParameters.RoleId) if function object</technical_language>

Target:
protected void executeQueryCommand() { getQueryReturnValue().setReturnValue(DbFacade.getInstance().getRoleDao().get( getParameters().<Guid>getParameter(UserRolesVdcParameters.RoleId))); }
Source:
<code><START> public void setHasResource(boolean hasResource) { <END> this.hasResource = hasResource; }</code><technical_language>This private, want resource attribute set externally</technical_language>

Target:
private void setHasResource(boolean hasResource) { this.hasResource = hasResource; }
Source:
<code>private void updateMatchedBoards() { <START> String[] prefixes = keyword.split("\\s+"); <END> matchedBoards = boards.stream() .filter(board -> { String[] parts = board.trim().toLowerCase().split("\\s+"); if (prefixes.length > parts.length) { return false; } for (String prefix : prefixes) { if (!board.matches(String.format("(?i:.*\\b%s.*)", prefix))) { return false; } } return true; }) .collect(Collectors.toList()); }</code><technical_language>multiple keywords? If case variable keywords instead of keyword</technical_language>

Target:
private void updateMatchedBoards() { String[] keywords = userInput.split("\\s+"); matchedBoards = boards.stream() .filter(board -> { String[] parts = board.trim().toLowerCase().split("\\s+"); if (keywords.length > parts.length) { return false; } for (String keyword : keywords) { if (!board.matches(String.format("(?i:.*\\b%s.*)", keyword))) { return false; } } return true; }) .collect(Collectors.toList()); }
Source:
<code>public Object execute(T input, CalculationMarketData marketData, ReportingRules reportingRules) { List<R> results = IntStream.range(0, marketData.getScenarioCount()) .mapToObj(index -> new DefaultSingleCalculationMarketData(marketData, index)) .map(data -> delegate.execute(input, data, reportingRules)) .collect(toImmutableList()); <START> return (results.size() == 1) ? <END> results.get(0) : results; }</code><technical_language>marketData.getScenarioCount() results.size() clearer</technical_language>

Target:
public Object execute(T input, CalculationMarketData marketData, ReportingRules reportingRules) { List<R> results = IntStream.range(0, marketData.getScenarioCount()) .mapToObj(index -> new DefaultSingleCalculationMarketData(marketData, index)) .map(data -> delegate.execute(input, data, reportingRules)) .collect(toImmutableList()); return (marketData.getScenarioCount() == 1) ? results.get(0) : results; }
Source:
<code>public ArrayList<LunModel> getLunsToRefresh() <START> { <END> ArrayList<LunModel> luns = new ArrayList<LunModel>(); if (!getIsGrouppedByTarget()) { List<LunModel> items = (List<LunModel>) getItems(); for (LunModel lun : items) { if (lun.getIsIncluded() && lun.isAdditionalAvailableSizeSelected() && Linq.firstOrDefault(luns, new Linq.LunPredicate(lun)) == null) { luns.add(lun); } } } return luns; }</code><technical_language>move '{' EOL</technical_language>

Target:
public ArrayList<LunModel> getLunsToRefresh() { ArrayList<LunModel> luns = new ArrayList<LunModel>(); if (!getIsGrouppedByTarget()) { List<LunModel> items = (List<LunModel>) getItems(); for (LunModel lun : items) { if (lun.getIsIncluded()) { if (lun.isAdditionalAvailableSizeSelected() && Linq.firstOrDefault(luns, new Linq.LunPredicate(lun)) == null) { luns.add(lun); } } } } return luns; }
Source:
<code>public AABB transform(Transform transform, float margin) { Vector3f localHalfExtents = new Vector3f(); localHalfExtents.sub(max, min); localHalfExtents.mul(0.5f); localHalfExtents.x += margin; localHalfExtents.y += margin; localHalfExtents.z += margin; Vector3f localCenter = new Vector3f(max); localCenter.add(min); localCenter.mul(0.5f); <START> Matrix3f absBasis = transform.getBasis(); <END> absBasis.m00 = Math.abs(absBasis.m00); absBasis.m01 = Math.abs(absBasis.m01); absBasis.m02 = Math.abs(absBasis.m02); absBasis.m10 = Math.abs(absBasis.m10); absBasis.m11 = Math.abs(absBasis.m11); absBasis.m12 = Math.abs(absBasis.m12); absBasis.m20 = Math.abs(absBasis.m20); absBasis.m21 = Math.abs(absBasis.m21); absBasis.m22 = Math.abs(absBasis.m22); Vector3f center = new Vector3f(localCenter); absBasis.transform(center); center.add(transform.origin); Vector3f extent = new Vector3f(); extent.x = absBasis.getRow(0).dot(localHalfExtents); extent.y = absBasis.getRow(1).dot(localHalfExtents); extent.z = absBasis.getRow(2).dot(localHalfExtents); Vector3f worldMin = new Vector3f(); worldMin.sub(center, extent); Vector3f worldMax = new Vector3f(center).add(extent); return AABB.createMinMax(worldMin, worldMax); }</code><technical_language>do absBasis? I feel this variable named differently. explain role in plain English? a hint renamed</technical_language>

Target:
public AABB transform(Transform transform, float margin) { Vector3f localHalfExtents = new Vector3f(); localHalfExtents.sub(max, min); localHalfExtents.mul(HALVING_FACTOR); localHalfExtents.x += margin; localHalfExtents.y += margin; localHalfExtents.z += margin; Vector3f localCenter = new Vector3f(max); localCenter.add(min); localCenter.mul(HALVING_FACTOR); Matrix3f absBasis = transform.getBasis(); absBasis.m00 = Math.abs(absBasis.m00); absBasis.m01 = Math.abs(absBasis.m01); absBasis.m02 = Math.abs(absBasis.m02); absBasis.m10 = Math.abs(absBasis.m10); absBasis.m11 = Math.abs(absBasis.m11); absBasis.m12 = Math.abs(absBasis.m12); absBasis.m20 = Math.abs(absBasis.m20); absBasis.m21 = Math.abs(absBasis.m21); absBasis.m22 = Math.abs(absBasis.m22); Vector3f center = new Vector3f(localCenter); absBasis.transform(center); center.add(transform.origin); Vector3f extent = new Vector3f(); extent.x = absBasis.getRow(0).dot(localHalfExtents); extent.y = absBasis.getRow(1).dot(localHalfExtents); extent.z = absBasis.getRow(2).dot(localHalfExtents); Vector3f worldMin = new Vector3f(); worldMin.sub(center, extent); Vector3f worldMax = new Vector3f(center).add(extent); return AABB.createMinMax(worldMin, worldMax); }
Source:
<code>public static void afterAll() { <START> System.setProperty(Framework.NUXEO_TESTING_SYSTEM_PROP, ORIGINAL_TESTING_PROPERTY_VALUE); <END> }</code><technical_language>Useless Framework</technical_language>

Target:
public static void afterAll() { System.setProperty(NUXEO_TESTING_SYSTEM_PROP, ORIGINAL_TESTING_PROPERTY_VALUE); }
Source:
<code>public LogPage log(LogRequest logRequest) throws GitException { LogCommand logCommand = getGit().log(); String sFilePath = null; try { setRevisionRange(logCommand, logRequest); setPaging(logCommand, logRequest); if (logRequest != null) { sFilePath = logRequest.getFilePath(); if (sFilePath != null && !sFilePath.isEmpty()) { logCommand.addPath(sFilePath); } } Iterator<RevCommit> revIterator = logCommand.call().iterator(); List<Revision> commits = new ArrayList<Revision>(); while (revIterator.hasNext()) { RevCommit commit = revIterator.next(); <START> Revision revision = getRevision(commit, sFilePath); <END> commits.add(revision); } return new LogPage(commits); } catch (GitAPIException | IOException e) { LOG.error("Failed to retrieve log. ", e); throw new GitException(e); } }</code><technical_language>need exception this error code for client</technical_language>

Target:
public LogPage log(LogRequest logRequest) throws GitException { LogCommand logCommand = getGit().log(); String sFilePath = null; try { setRevisionRange(logCommand, logRequest); setPaging(logCommand, logRequest); if (logRequest != null) { sFilePath = logRequest.getFilePath(); if (sFilePath != null && !sFilePath.isEmpty()) { logCommand.addPath(sFilePath); } } Iterator<RevCommit> revIterator = logCommand.call().iterator(); List<Revision> commits = new ArrayList<Revision>(); while (revIterator.hasNext()) { RevCommit commit = revIterator.next(); Revision revision = getRevision(commit, sFilePath); commits.add(revision); } return new LogPage(commits); } catch (GitAPIException | IOException exception) { String errorMessage = exception.getMessage(); LOG.error("Failed to retrieve log. ", errorMessage); if (ERROR_LOG_NO_HEAD_EXISTS.equals(errorMessage)) { throw new GitException(errorMessage, ErrorCodes.INIT_COMMIT_WAS_NOT_PERFORMED); }else{ throw new GitException(exception); } } }
Source:
<code>protected void executeCommand() { VDSReturnValue vdsReturnaValue = runVdsCommand(VDSCommandType.StopRebalanceGlusterVolume, new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName())); if (!vdsReturnaValue.getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_REBALANCE_STOP_FAILED, vdsReturnaValue.getVdsError() .getMessage()); setSucceeded(false); return; } GlusterVolumeTaskStatusEntity rebalanceStatusEntity = (GlusterVolumeTaskStatusEntity) vdsReturnaValue.getReturnValue(); JobExecutionStatus stepStatus = rebalanceStatusEntity.getStatusSummary().getStatus(); if (JobExecutionStatus.FINISHED == stepStatus || JobExecutionStatus.FAILED == stepStatus) { <START> endStepJob(stepStatus, getStepMessageMap(stepStatus), true); <END> } else { endStepJob(JobExecutionStatus.ABORTED, getStepMessageMap(JobExecutionStatus.ABORTED), false); } releaseVolumeLock(); setSucceeded(vdsReturnaValue.getSucceeded()); getReturnValue().setActionReturnValue(rebalanceStatusEntity); }</code><technical_language>passing 'true' 'exitStatus' in case of FAILED well</technical_language>

Target:
protected void executeCommand() { VDSReturnValue vdsReturnaValue = runVdsCommand(VDSCommandType.StopRebalanceGlusterVolume, new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName())); if (!vdsReturnaValue.getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_REBALANCE_STOP_FAILED, vdsReturnaValue.getVdsError() .getMessage()); setSucceeded(false); return; } GlusterVolumeTaskStatusEntity rebalanceStatusEntity = (GlusterVolumeTaskStatusEntity) vdsReturnaValue.getReturnValue(); JobExecutionStatus stepStatus = rebalanceStatusEntity.getStatusSummary().getStatus(); if (stepStatus != null) { endStepJob(stepStatus, getStepMessageMap(stepStatus), GlusterTaskUtils.getInstance().isTaskSuccess(stepStatus)); } else { endStepJob(JobExecutionStatus.ABORTED, getStepMessageMap(JobExecutionStatus.ABORTED), false); } releaseVolumeLock(); setSucceeded(vdsReturnaValue.getSucceeded()); getReturnValue().setActionReturnValue(rebalanceStatusEntity); }
Source:
<code>public boolean doesChecksumExistInDatasetVersion(DatasetVersion datasetVersion, String selectedChecksum) { if (datasetVersion == null){ throw new NullPointerException("datasetVersion cannot be null"); } String query = "SELECT df.md5 FROM datafile df, filemetadata fm" + " WHERE fm.datasetversion_id = " + datasetVersion.getId() + " AND fm.datafile_id = df.id" + " AND df.md5 = '" + selectedChecksum + "';"; Query nativeQuery = em.createNativeQuery(query); <START> List<String> checksumList = nativeQuery.getResultList(); <END> return checksumList.size() > 0; }</code><technical_language>this need a TypedQuery</technical_language>

Target:
public boolean doesChecksumExistInDatasetVersion(DatasetVersion datasetVersion, String selectedChecksum) { if (datasetVersion == null){ throw new NullPointerException("datasetVersion cannot be null"); } String query = "SELECT df.md5 FROM datafile df, filemetadata fm" + " WHERE fm.datasetversion_id = " + datasetVersion.getId() + " AND fm.datafile_id = df.id" + " AND df.md5 = '" + selectedChecksum + "';"; Query nativeQuery = em.createNativeQuery(query); List<?> checksumList = nativeQuery.getResultList(); return !checksumList.isEmpty(); }
Source:
<code>public Object fromBytes(byte[] bytes) { try { final Object object; final MessageType type = MessageType.values()[bytes[0]]; final byte[] data = Arrays.copyOfRange(bytes, 1, bytes.length); switch (type) { case USER_MESSAGE: object = userMessageSerde.fromBytes(data); break; case WATERMARK: object = watermarkSerde.fromBytes(data); break; case END_OF_STREAM: object = eosSerde.fromBytes(data); break; default: throw new UnsupportedOperationException(String.format("Message type %s is not supported", type.name())); } return object; } catch (UnsupportedOperationException ue) { throw new SamzaException(ue); } catch (Exception e) { LOGGER.error("Error deserializing with intermediate message serde. If you are upgrading from samza version older" <START> + " than 0.13.1, please upgrade to samza 1.5 first."); <END> throw e; } }</code><technical_language>If a user upgraded 0.13.1+ some time ago, theoretically run error if happened some intermediate messages 0.13.1 in topic (e.g. long retention) processed for some reason. generalize log message a bit more cover case if messages 0.13.1 in stream</technical_language>

Target:
public Object fromBytes(byte[] bytes) { try { final Object object; final MessageType type; try { type = MessageType.values()[bytes[0]]; } catch (ArrayIndexOutOfBoundsException e) { throw new SamzaException("Error reading the message type from intermediate message. This may happen if you " + "have recently upgraded from samza version older than 0.13.1 or there are still old messages in the " + "intermediate stream.", e); } final byte[] data = Arrays.copyOfRange(bytes, 1, bytes.length); switch (type) { case USER_MESSAGE: object = userMessageSerde.fromBytes(data); break; case WATERMARK: object = watermarkSerde.fromBytes(data); break; case END_OF_STREAM: object = eosSerde.fromBytes(data); break; default: throw new UnsupportedOperationException(String.format("Message type %s is not supported", type.name())); } return object; } catch (UnsupportedOperationException ue) { throw new SamzaException(ue); } catch (Exception e) { throw e; } }
Source:
<code>public VmRuntimeTicker(Ticker systemTicker, Duration loopSleep, Duration maxSafeVmPause) { this.systemTicker = requireNonNull(systemTicker, "systemTicker is null"); this.loopSleepMillis = requireNonNull(loopSleep, "loopSleep is null").toMillis(); checkArgument(loopSleepMillis > 0, "loopSleep must be at least 1 millis second"); this.maxSafeVmPauseNanos = requireNonNull(maxSafeVmPause, "maxSafeVmPause is null").roundTo(NANOSECONDS); <START> checkArgument(maxSafeVmPauseNanos > MILLISECONDS.toNanos(loopSleepMillis) * 10, "maxSafeVmPause must be at least 10 times larger than loopSleep"); <END> vmRuntimeMonitorThread = new Thread(this::updateLoop, "VM Runtime Monitor"); vmRuntimeMonitorThread.setDaemon(true); }</code><technical_language>2x is 10x. configurable</technical_language>

Target:
public VmRuntimeTicker(Ticker systemTicker, Duration loopSleep, Duration maxSafeVmPause) { this.systemTicker = requireNonNull(systemTicker, "systemTicker is null"); this.loopSleepMillis = requireNonNull(loopSleep, "loopSleep is null").toMillis(); checkArgument(loopSleepMillis > 0, "loopSleep must be at least 1 millis second"); this.maxSafeVmPauseNanos = requireNonNull(maxSafeVmPause, "maxSafeVmPause is null").roundTo(NANOSECONDS); checkArgument(maxSafeVmPauseNanos > MILLISECONDS.toNanos(loopSleepMillis) * 2, "maxSafeVmPause must be at least 2 times larger than loopSleep"); vmRuntimeMonitorThread = new Thread(this::updateLoop, "VM Runtime Monitor"); vmRuntimeMonitorThread.setDaemon(true); }
Source:
<code>public boolean isMarshallable(Object o) { if (o instanceof String || o instanceof Long || o instanceof Integer || o instanceof Double || o instanceof Float <START> || o instanceof Boolean || o instanceof byte[] || o instanceof Enum) { <END> return true; } return getSerializationContext().canMarshall(o.getClass()); }</code><technical_language>Enum handled here, left SerializationContext.canMarshall() needs check a custom marshaller defined for Enum</technical_language>

Target:
public boolean isMarshallable(Object o) { if (o instanceof String || o instanceof Long || o instanceof Integer || o instanceof Double || o instanceof Float || o instanceof Boolean || o instanceof byte[]) { return true; } return getSerializationContext().canMarshall(o.getClass()); }
Source:
<code>public void testWorkspaceIdWithoutPrefixRule() throws Throwable { this.customServerEvaluationStrategy = new CustomServerEvaluationStrategy("10.0.0.1", "192.168.1.1", "<workspaceIdWithoutPrefix>", "http", "8080"); Map<String, String> portMapping = this.customServerEvaluationStrategy.getExternalAddressesAndPorts(containerInfo, "localhost"); Assert.assertTrue(portMapping.containsKey("4401/tcp")); <START> Assert.assertEquals(portMapping.get("4401/tcp"), WORKSPACE_ID_VALUE.replaceFirst(CHE_WORKSPACE_ID_PREFIX, "")); <END> }</code><technical_language>do check ABCDEFG ? for workspaceId prefix</technical_language>

Target:
public void testWorkspaceIdWithoutPrefixRule() throws Throwable { this.customServerEvaluationStrategy = new CustomServerEvaluationStrategy("10.0.0.1", "192.168.1.1", "<workspaceIdWithoutPrefix>", "http", "8080"); Map<String, String> portMapping = this.customServerEvaluationStrategy.getExternalAddressesAndPorts(containerInfo, "localhost"); Assert.assertTrue(portMapping.containsKey("4401/tcp")); Assert.assertEquals(portMapping.get("4401/tcp"), WORKSPACE_ID_WITHOUT_PREFIX_VALUE); }
Source:
<code>protected Hardware automaticHardware(double cores, int ram, Optional<Float> diskSize) { HardwareBuilder builder = new HardwareBuilder(); if (diskSize.isPresent()) { <START> if (diskSize.get() > 0.0f) <END> builder.volume(new VolumeImpl(diskSize.get(), true, true)); } return builder .id(automaticHardwareIdSpecBuilder(cores, ram, diskSize.or(Optional.<Float>absent())).toString()) .ram(ram) .processor(new Processor(cores, 1.0)) .build(); }</code><technical_language>Do in line if (diskSize.isPresent() && diskSize.get() > 0.0f)</technical_language>

Target:
protected Hardware automaticHardware(double cores, int ram, Optional<Float> diskSize) { HardwareBuilder builder = new HardwareBuilder(); if (diskSize.isPresent() && diskSize.get() > 0.0f) { builder.volume(new VolumeImpl(diskSize.get(), true, true)); } return builder .id(automaticHardwareIdSpecBuilder(cores, ram, diskSize).toString()) .ram(ram) .processor(new Processor(cores, 1.0)) .build(); }
Source:
<code>protected static void showCountMessage(final Handler handler, final int msgId, final int count) { if (handler != null && (count <= 1 || count % 10 == 0)) { final Message msg = new Message(); msg.arg1 = msgId; <START> msg.arg2 = count; <END> handler.sendMessage(msg); } }</code><technical_language>changing message content, change java handler.sendMessage(handler.obtainMessage(0, msgId, count); obtainMessage() methods more efficient creating new messages, reuses existing messages a pool instead of creating new ones</technical_language>

Target:
protected static void showCountMessage(final Handler handler, final int msgId, final int count) { if (handler != null && (count <= 1 || count % 10 == 0)) { handler.sendMessage(handler.obtainMessage(0, msgId, count)); } }
Source:
<code>CHANNEL acquire( AdvertisedSocketAddress catchUpAddress ) throws Exception { CHANNEL channel = getIdleChannel( catchUpAddress ); <START> if ( channel != null ) <END> { if ( !channel.isActive() ) { dispose( channel ); channel = null; } } if ( channel == null ) { channel = factory.apply( catchUpAddress ); try { channel.connect(); assertActive( channel, catchUpAddress ); } catch ( Exception e ) { dispose( channel ); throw e; } } addActiveChannel( channel ); return channel; }</code><technical_language>combine if-statements due short-circuit evaluation. However, I if getIdleChannel() do this check internally loop "idle" channels return active null</technical_language>

Target:
CHANNEL acquire( AdvertisedSocketAddress catchUpAddress ) throws Exception { CHANNEL channel = getIdleChannel( catchUpAddress ); if ( channel == null ) { channel = factory.apply( catchUpAddress ); try { channel.connect(); assertActive( channel, catchUpAddress ); } catch ( Exception e ) { channel.close(); throw e; } } addActiveChannel( channel ); return channel; }
Source:
<code>private Object[] lookup(ProjectionBlock projectionBlock) { int numPkColumns = _joinKeys.size(); int numDocuments = projectionBlock.getNumDocs(); Object[][] pkColumns = new Object[numPkColumns][]; for (int i=0; i<numPkColumns; i++) { FieldSpec.DataType colType = _joinValueFieldSpecs.get(i).getDataType(); TransformFunction tf = _joinValueFunctions.get(i); switch (colType) { case STRING: pkColumns[i] = tf.transformToStringValuesSV(projectionBlock); break; case INT: pkColumns[i] = ArrayUtils.toObject(tf.transformToIntValuesSV(projectionBlock)); break; case LONG: pkColumns[i] = ArrayUtils.toObject(tf.transformToLongValuesSV(projectionBlock)); break; default: <START> throw new IllegalStateException("Unknown column type for primary key"); <END> } } Object[] resultSet = new Object[numDocuments]; for (int i=0; i<numDocuments; i++) { Object[] pkValues = new Object[numPkColumns]; for (int j=0; j<numPkColumns; j++) { pkValues[j] = pkColumns[j][i]; } GenericRow row = _dataManager.lookupRowByPrimaryKey(new PrimaryKey(pkValues)); if (row != null && row.getFieldToValueMap().containsKey(_dimColumnName)) { resultSet[i] = row.getValue(_dimColumnName); } } return resultSet; }</code><technical_language>byte</technical_language>

Target:
private Object[] lookup(ProjectionBlock projectionBlock) { int numPkColumns = _joinKeys.size(); int numDocuments = projectionBlock.getNumDocs(); Object[][] pkColumns = new Object[numPkColumns][]; for (int c = 0; c < numPkColumns; c++) { FieldSpec.DataType colType = _joinValueFieldSpecs.get(c).getDataType(); TransformFunction tf = _joinValueFunctions.get(c); switch (colType) { case INT: pkColumns[c] = ArrayUtils.toObject(tf.transformToIntValuesSV(projectionBlock)); break; case LONG: pkColumns[c] = ArrayUtils.toObject(tf.transformToLongValuesSV(projectionBlock)); break; case FLOAT: pkColumns[c] = ArrayUtils.toObject(tf.transformToFloatValuesSV(projectionBlock)); break; case DOUBLE: pkColumns[c] = ArrayUtils.toObject(tf.transformToDoubleValuesSV(projectionBlock)); break; case STRING: pkColumns[c] = tf.transformToStringValuesSV(projectionBlock); break; case BYTES: byte[][] primitiveValues = tf.transformToBytesValuesSV(projectionBlock); pkColumns[c] = new ByteArray[numDocuments]; for (int i = 0; i < numDocuments; i++) { pkColumns[c][i] = new ByteArray(primitiveValues[i]); } break; default: throw new IllegalStateException("Unknown column type for primary key"); } } Object[] resultSet = new Object[numDocuments]; Object[] pkValues = new Object[numPkColumns]; for (int i = 0; i < numDocuments; i++) { for (int c = 0; c < numPkColumns; c++) { pkValues[c] = pkColumns[c][i]; } GenericRow row = _dataManager.lookupRowByPrimaryKey(new PrimaryKey(pkValues)); if (row != null) { resultSet[i] = row.getValue(_dimColumnName); } } return resultSet; }
Source:
<code>private void afterDeploymentValidation(@Observes final AfterDeploymentValidation avd, BeanManager eventBeanManager) { BeanManager beanManager = getBeanManager(module, eventBeanManager); instance = beanManager.createInstance(); <START> addHealthChecks(HealthLiteral.INSTANCE, reporter::addHealthCheck, module, healthChecks); <END> addHealthChecks(Liveness.Literal.INSTANCE, reporter::addLivenessCheck, module, livenessChecks); addHealthChecks(Readiness.Literal.INSTANCE, reporter::addReadinessCheck, module, readinessChecks); if (readinessChecks.isEmpty()) { Config config = ConfigProvider.getConfig(module.getClassLoader()); boolean disableDefaultprocedure = config.getOptionalValue("mp.health.disable-default-procedures", Boolean.class).orElse(false); if (!disableDefaultprocedure) { defaultReadinessCheck = new DefaultReadinessHealthCheck(module.getName()); reporter.addReadinessCheck(defaultReadinessCheck, module.getClassLoader()); } } }</code><technical_language>module need passed methods. Current code is module.getClassLoader()</technical_language>

Target:
private void afterDeploymentValidation(@Observes final AfterDeploymentValidation avd, BeanManager eventBeanManager) { BeanManager beanManager = CDI.current().getBeanManager(); instance = beanManager.createInstance(); addHealthChecks(HealthLiteral.INSTANCE, reporter::addHealthCheck, healthChecks); addHealthChecks(Liveness.Literal.INSTANCE, reporter::addLivenessCheck, livenessChecks); addHealthChecks(Readiness.Literal.INSTANCE, reporter::addReadinessCheck, readinessChecks); if (readinessChecks.isEmpty()) { Config config = ConfigProvider.getConfig(parentModule.getClassLoader()); boolean disableDefaultprocedure = config.getOptionalValue("mp.health.disable-default-procedures", Boolean.class).orElse(false); if (!disableDefaultprocedure) { defaultReadinessCheck = new DefaultReadinessHealthCheck(parentModule.getName()); reporter.addReadinessCheck(defaultReadinessCheck, parentModule.getClassLoader()); } } }
Source:
<code>private QueuedTask findForcedTask() { <START> QueuedTask _ret = null; <END> QueuedTask task; List<QueuedTask> storage = new ArrayList<>(); while ((task = taskQueue.poll()) != null) { if (task.forceRun) { _ret = task; } else { storage.add(task); } } taskQueue.addAll(storage); return _ret; }</code><technical_language>@bstansberry review changes reviewed PR please rename this variable? WildFly code convention do _ prefix variables? thanks</technical_language>

Target:
private QueuedTask findForcedTask() { QueuedTask forcedTask = null; QueuedTask task; List<QueuedTask> storage = new ArrayList<>(); while (forcedTask == null && (task = taskQueue.poll()) != null) { if (task.forceRun) { forcedTask = task; } else { storage.add(task); } } taskQueue.addAll(storage); return forcedTask; }
Source:
<code>protected Document createDocument() { <START> Document doc = createDOMImplementation().createDocument("", "database", createDocumentType()); <END> doc.setXmlStandalone(true); return doc; }</code><technical_language>is argument is empty string</technical_language>

Target:
protected Document createDocument() { Document doc = createDOMImplementation().createDocument(null, "database", createDocumentType()); doc.setXmlStandalone(true); return doc; }
Source:
<code><START> public IfClosure(P predicate, C trueClosure, C falseClosure) { <END> this.predicate = predicate; this.trueClosure = trueClosure; this.falseClosure = falseClosure; }</code><technical_language>please add not-null check for constructor input</technical_language>

Target:
public IfClosure(P predicate, C trueClosure, C falseClosure) { validate(predicate, trueClosure, falseClosure); this.predicate = predicate; this.trueClosure = trueClosure; this.falseClosure = falseClosure; }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DisplayFeature that = (DisplayFeature) o; <START> if (mType != that.mType) return false; return mBounds.equals(that.mBounds); <END> }</code><technical_language>nit: return mType == that.mType && mBounds.equals(that.mBounds);</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DisplayFeature that = (DisplayFeature) o; return mType == that.mType && mBounds.equals(that.mBounds); }
Source:
<code>private void removeStoredRenditions(Map<String, List<String>> liveDocumentRefsToRenditionRefs) { <START> List<String> liveDocumentRefs = Lists.newArrayList(liveDocumentRefsToRenditionRefs.keySet()); <END> if (liveDocumentRefs.isEmpty()) { return; } int processedSourceIds = 0; while (processedSourceIds < liveDocumentRefs.size()) { int limit = processedSourceIds + BATCH_SIZE > liveDocumentRefs.size() ? liveDocumentRefs.size() : processedSourceIds + BATCH_SIZE; List<String> batchSourceIds = liveDocumentRefs.subList(processedSourceIds, limit); List<String> existingSourceIds = new ArrayList<>(); String query = NXQLQueryBuilder.getQuery("SELECT ecm:uuid FROM Document WHERE ecm:uuid IN ?", new Object[] { batchSourceIds }, true, true, null); try (IterableQueryResult result = session.queryAndFetch(query, NXQL.NXQL)) { result.forEach(res -> existingSourceIds.add(res.get(NXQL.ECM_UUID).toString())); } batchSourceIds.removeAll(existingSourceIds); List<String> renditionRefsToDelete = batchSourceIds.stream() .map(liveDocumentRefsToRenditionRefs::get) .reduce(new ArrayList<>(), (allRefs, refs) -> { allRefs.addAll(refs); return allRefs; }); if (!renditionRefsToDelete.isEmpty()) { session.removeDocuments( renditionRefsToDelete.stream().map(IdRef::new).collect(Collectors.toList()).toArray( new DocumentRef[renditionRefsToDelete.size()])); } if (TransactionHelper.isTransactionActiveOrMarkedRollback()) { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } processedSourceIds += BATCH_SIZE; } }</code><technical_language>need for guava, please new ArrayList directly</technical_language>

Target:
private void removeStoredRenditions(Map<String, List<String>> liveDocumentRefsToRenditionRefs) { List<String> liveDocumentRefs = new ArrayList<>(liveDocumentRefsToRenditionRefs.keySet()); if (liveDocumentRefs.isEmpty()) { return; } int processedSourceIds = 0; while (processedSourceIds < liveDocumentRefs.size()) { int limit = processedSourceIds + BATCH_SIZE > liveDocumentRefs.size() ? liveDocumentRefs.size() : processedSourceIds + BATCH_SIZE; List<String> batchSourceIds = liveDocumentRefs.subList(processedSourceIds, limit); List<String> existingSourceIds = new ArrayList<>(); String query = NXQLQueryBuilder.getQuery("SELECT ecm:uuid FROM Document WHERE ecm:uuid IN ?", new Object[] { batchSourceIds }, true, true, null); try (IterableQueryResult result = session.queryAndFetch(query, NXQL.NXQL)) { result.forEach(res -> existingSourceIds.add(res.get(NXQL.ECM_UUID).toString())); } batchSourceIds.removeAll(existingSourceIds); List<String> renditionRefsToDelete = batchSourceIds.stream() .map(liveDocumentRefsToRenditionRefs::get) .reduce(new ArrayList<>(), (allRefs, refs) -> { allRefs.addAll(refs); return allRefs; }); if (!renditionRefsToDelete.isEmpty()) { session.removeDocuments( renditionRefsToDelete.stream().map(IdRef::new).collect(Collectors.toList()).toArray( new DocumentRef[renditionRefsToDelete.size()])); } if (TransactionHelper.isTransactionActiveOrMarkedRollback()) { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } processedSourceIds += BATCH_SIZE; } }
Source:
<code>private static Object newInstance(Class<?> cls) { try { return cls.newInstance(); } catch (Throwable t) { try { Constructor<?>[] constructors = cls.getDeclaredConstructors(); <START> if (constructors == null && constructors.length == 0) { <END> throw new RuntimeException("Illegal constructor: " + cls.getName()); } Constructor<?> constructor = constructors[0]; if (constructor.getParameterTypes().length > 0) { for (Constructor<?> c : constructors) { if (c.getParameterTypes().length < constructor.getParameterTypes().length) { constructor = c; if (constructor.getParameterTypes().length == 0) { break; } } } } constructor.setAccessible(true); return constructor.newInstance(new Object[constructor.getParameterTypes().length]); } catch (InstantiationException e) { throw new RuntimeException(e.getMessage(), e); } catch (IllegalAccessException e) { throw new RuntimeException(e.getMessage(), e); } catch (InvocationTargetException e) { throw new RuntimeException(e.getMessage(), e); } } }</code><technical_language>&& replaced ||</technical_language>

Target:
private static Object newInstance(Class<?> cls) { try { return cls.newInstance(); } catch (Throwable t) { try { Constructor<?>[] constructors = cls.getDeclaredConstructors(); if (constructors.length == 0) { throw new RuntimeException("Illegal constructor: " + cls.getName()); } Constructor<?> constructor = constructors[0]; if (constructor.getParameterTypes().length > 0) { for (Constructor<?> c : constructors) { if (c.getParameterTypes().length < constructor.getParameterTypes().length) { constructor = c; if (constructor.getParameterTypes().length == 0) { break; } } } } constructor.setAccessible(true); return constructor.newInstance(new Object[constructor.getParameterTypes().length]); } catch (InstantiationException e) { throw new RuntimeException(e.getMessage(), e); } catch (IllegalAccessException e) { throw new RuntimeException(e.getMessage(), e); } catch (InvocationTargetException e) { throw new RuntimeException(e.getMessage(), e); } } }
Source:
<code>public void validate(Object target, Errors errors) { log.debug("{}.validate...", this.getClass().getName()); if (target == null) { return; } Person person = (Person) target; validatePersonName(errors, person); if (!person.getVoided() && person.hasZeroNotVoidedNames()) { errors.rejectValue("names", "Person.shouldHaveAtleastOneNonVoidedName"); } validatePersonAddress(errors, person); validateBirthDate(errors, person.getBirthdate()); validateDeathDate(errors, person.getDeathDate(), person.getBirthdate()); if (person.getVoided()) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "voidReason", "error.null"); } if (person.getDead()) { <START> if (person.hasBothCauseOfDeathAndNonCodedCauseOfDeath()) { <END> errors.rejectValue("causeOfDeath", "Person.dead.shouldHaveOnlyOneCauseOfDeathOrCauseOfDeathNonCodedSet"); } else if (person.isMissingCauseOfDeathAndNonCodedCauseOfDeath()) { errors.rejectValue("causeOfDeath", "Person.dead.causeOfDeathAndCauseOfDeathNonCodedNull"); } } ValidateUtil.validateFieldLengths(errors, Person.class, "gender", "personVoidReason"); }</code><technical_language>new method replacements for making sonar happy</technical_language>

Target:
public void validate(Object target, Errors errors) { log.debug("{}.validate...", this.getClass().getName()); if (target == null) { return; } Person person = (Person) target; validatePersonName(errors, person); if (!person.getVoided() && person.hasZeroNotVoidedNames()) { errors.rejectValue("names", "Person.shouldHaveAtleastOneNonVoidedName"); } validatePersonAddress(errors, person); validateBirthDate(errors, person.getBirthdate()); validateDeathDate(errors, person.getDeathDate(), person.getBirthdate()); if (person.getVoided()) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "voidReason", "error.null"); } if (person.getDead()) { if (person.getCauseOfDeath() != null && person.getCauseOfDeathNonCoded() != null) { errors.rejectValue("causeOfDeath", "Person.dead.shouldHaveOnlyOneCauseOfDeathOrCauseOfDeathNonCodedSet"); } else if (person.getCauseOfDeath() == null && person.getCauseOfDeathNonCoded() == null) { errors.rejectValue("causeOfDeath", "Person.dead.causeOfDeathAndCauseOfDeathNonCodedNull"); } } ValidateUtil.validateFieldLengths(errors, Person.class, "gender", "personVoidReason"); }