auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> @Test public void testErrorMessage_ShouldReturnWrongSecondPassword() throws Exception { <END> userManager.createUser("user1"); tester.startPage(UserListPage.class); tester.assertRenderedPage(UserListPage.class); tester.clickLink("lazy:userList:listContainer:form:list:0:item.update"); tester.executeAjaxEvent("lazy:userList:listContainer:form:list:0:item.update", "onclick"); FormTester formTester = tester.newFormTester("userDialogue:userEditorContainer:userForm"); formTester.setValue("username", "user1"); formTester.setValue("password", "password"); formTester.setValue("passwordVerification", "password2"); formTester.submit(); tester.assertErrorMessages(new String[]{ localization(UserListPage.class, "passwordError")}); }</code><technical_language>Pls put annotations method/class/etc</technical_language>

Target:
public void testErrorMessage_ShouldReturnWrongSecondPassword() throws Exception { userManager.createUser("user1"); tester.startPage(UserListPage.class); tester.assertRenderedPage(UserListPage.class); tester.clickLink("lazy:userList:listContainer:form:list:0:item.update"); tester.executeAjaxEvent("lazy:userList:listContainer:form:list:0:item.update", "onclick"); FormTester formTester = tester.newFormTester("userDialogue:userEditorContainer:userForm"); formTester.setValue("username", "user1"); formTester.setValue("password", "password"); formTester.setValue("passwordVerification", "password2"); formTester.submit(); tester.assertErrorMessages(new String[]{ localization(UserListPage.class, "passwordError")}); }
Source:
<code>public void run(@NotNull ProgressIndicator indicator) { SonarApplication sonarlint = ApplicationManager.getApplication().getComponent(SonarApplication.class); indicator.setText("Creating token with " + host + "..."); indicator.setIndeterminate(true); try { ServerConfiguration.Builder serverConfigBuilder = ServerConfiguration.builder() .userAgent("SonarLint IntelliJ " + sonarlint.getVersion()) <START> .connectTimeoutMilliseconds(SonarLintUtils.CONNETION_TIMEOUT_MS) <END> .readTimeoutMilliseconds(SonarLintUtils.CONNETION_TIMEOUT_MS) .url(host) .credentials(login, password); ServerConfiguration serverConfig = serverConfigBuilder.build(); WsHelper wsHelper = new WsHelperImpl(); String tokenName = TOKEN_NAME + name; token = wsHelper.generateAuthenticationToken(serverConfig, tokenName, true); } catch (Exception e) { LOGGER.info("Creation of token failed", e); exception = e; } }</code><technical_language>Typo s/CONNETION_TIMEOUT_MS/CONNECTION_TIMEOUT_MS</technical_language>

Target:
public void run(@NotNull ProgressIndicator indicator) { SonarApplication sonarlint = ApplicationManager.getApplication().getComponent(SonarApplication.class); indicator.setText("Creating token with " + host + "..."); indicator.setIndeterminate(true); try { ServerConfiguration.Builder serverConfigBuilder = ServerConfiguration.builder() .userAgent("SonarLint IntelliJ " + sonarlint.getVersion()) .connectTimeoutMilliseconds(SonarLintUtils.CONNECTION_TIMEOUT_MS) .readTimeoutMilliseconds(SonarLintUtils.CONNECTION_TIMEOUT_MS) .url(host) .credentials(login, password); ServerConfiguration serverConfig = serverConfigBuilder.build(); WsHelper wsHelper = new WsHelperImpl(); String tokenName = TOKEN_NAME + name; token = wsHelper.generateAuthenticationToken(serverConfig, tokenName, true); } catch (Exception e) { LOGGER.info("Creation of token failed", e); exception = e; } }
Source:
<code>public void validate() throws JobConfigValidationException { super.validate(); try { final JobArguments arguments = this.getJobArguments(); final String ownerKey = arguments.getAsString(OWNER_KEY); final String consumerUuid = arguments.getAsString(CONSUMER_UUID_KEY); final PoolIdAndQuantity[] poolQuantities = arguments .getAs(POOL_QUANTITIES_KEY, PoolIdAndQuantity[].class); if (ownerKey == null || ownerKey.isEmpty()) { <START> final String errmsg = "Owner has not been set!"; <END> throw new JobConfigValidationException(errmsg); } if (consumerUuid == null || consumerUuid.isEmpty()) { final String errmsg = "Consumer UUID has not been set!"; throw new JobConfigValidationException(errmsg); } if (poolQuantities == null || poolQuantities.length == 0) { final String errmsg = "Pool quantities has not been set!"; throw new JobConfigValidationException(errmsg); } } catch (ArgumentConversionException e) { final String errmsg = "One or more required arguments are of the wrong type"; throw new JobConfigValidationException(errmsg, e); } }</code><technical_language>owner_key a job argument, metadata, need validate is set, is optional, this check removed (only consumer uuid, pool id, pool quantity required for this job)</technical_language>

Target:
public void validate() throws JobConfigValidationException { super.validate(); try { final JobArguments arguments = this.getJobArguments(); final String consumerUuid = arguments.getAsString(CONSUMER_UUID_KEY); final String poolId = arguments.getAsString(POOL_ID_KEY); final Integer poolQuantity = arguments.getAsInteger(POOL_QUANTITY_KEY); if (consumerUuid == null || consumerUuid.isEmpty()) { final String errmsg = "Consumer UUID has not been set!"; throw new JobConfigValidationException(errmsg); } if (poolId == null || poolId.isEmpty()) { final String errmsg = "Pool id has not been set!"; throw new JobConfigValidationException(errmsg); } if (poolQuantity == null || poolQuantity < 0) { final String errmsg = "Pool quantity has not been set!"; throw new JobConfigValidationException(errmsg); } } catch (ArgumentConversionException e) { final String errmsg = "One or more required arguments are of the wrong type"; throw new JobConfigValidationException(errmsg, e); } }
Source:
<code>private void loadInitialState(ITmfStateProvider provider) { final ITmfTrace trace = getTrace(); if (trace == null) { throw new IllegalStateException("Trace is null. It should be impossible to load states. "); <START> } <END> File path = new File(trace.getPath()); path = path.isDirectory() ? path : path.getParentFile(); if (path == null) { return; } for (ITmfStateSystem ss : getStateSystems()) { if (ss instanceof ITmfStateSystemBuilder) { ITmfStateSystemBuilder ssb = (ITmfStateSystemBuilder) ss; StateSnapshot snapshot = StateSnapshot.read(path.toPath(), ss.getSSID()); if (snapshot == null || provider.getVersion() != snapshot.getVersion()) { continue; } for (Entry<List<String>, ITmfStateInterval> attributeSnapshot : snapshot.getStates().entrySet()) { List<String> attributePath = Objects.requireNonNull(attributeSnapshot.getKey()); int quark = ssb.getQuarkAbsoluteAndAdd(attributePath.toArray(new String[attributePath.size()])); ITmfStateInterval interval = Objects.requireNonNull(attributeSnapshot.getValue()); Object initialState = interval.getValue(); ssb.modifyAttribute(Math.max(interval.getStartTime(), ssb.getStartTime()), initialState, quark); } } } }</code><technical_language>If build(), caller of this method, trace provider, check (is @NonNull in provider?)</technical_language>

Target:
private void loadInitialState(ITmfStateProvider provider) { final ITmfTrace trace = provider.getTrace(); File path = new File(trace.getPath()); path = path.isDirectory() ? path : path.getParentFile(); if (path == null) { return; } for (ITmfStateSystem ss : getStateSystems()) { if (ss instanceof ITmfStateSystemBuilder) { ITmfStateSystemBuilder ssb = (ITmfStateSystemBuilder) ss; StateSnapshot snapshot = StateSnapshot.read(path.toPath(), ss.getSSID()); if (snapshot == null || provider.getVersion() != snapshot.getVersion()) { continue; } for (Entry<List<String>, ITmfStateInterval> attributeSnapshot : snapshot.getStates().entrySet()) { List<String> attributePath = Objects.requireNonNull(attributeSnapshot.getKey()); int quark = ssb.getQuarkAbsoluteAndAdd(attributePath.toArray(new String[attributePath.size()])); ITmfStateInterval interval = Objects.requireNonNull(attributeSnapshot.getValue()); Object initialState = interval.getValue(); ssb.modifyAttribute(Math.max(interval.getStartTime(), ssb.getStartTime()), initialState, quark); } } } }
Source:
<code>public int compareTo(final ITmfTimestamp ts) { long value = getValue(); int scale = getScale(); <START> if (ts == null) { <END> return 1; } if (this == ts || (value == ts.getValue() && scale == ts.getScale())) { return 0; } if ((value == BIG_BANG.getValue() && scale == BIG_BANG.getScale()) || (ts.getValue() == BIG_CRUNCH.getValue() && ts.getScale() == BIG_CRUNCH.getScale())) { return -1; } if ((value == BIG_CRUNCH.getValue() && scale == BIG_CRUNCH.getScale()) || (ts.getValue() == BIG_BANG.getValue() && ts.getScale() == BIG_BANG.getScale())) { return 1; } if (getScale() == ts.getScale()) { final long delta = saturatedAdd(getValue(), -ts.getValue()); return (delta == 0) ? 0 : (delta > 0) ? 1 : -1; } final ITmfTimestamp nts = ts.normalize(0, scale); if (hasSaturated(ts, nts)) { final long otherValue = ts.getValue(); if (value == 0 && otherValue == 0) { return 0; } if (value < 0 && otherValue >= 0) { return -1; } if (value >= 0 && otherValue < 0) { return 1; } final int otherScale = ts.getScale(); return (scale > otherScale) ? (otherValue >= 0) ? 1 : -1 : (otherValue >= 0) ? -1 : 1; } final long delta = value - nts.getValue(); return Long.compare(delta, 0); }</code><technical_language>Other implementations of Comparable in Java check for null, do to</technical_language>

Target:
public int compareTo(final ITmfTimestamp ts) { long value = getValue(); int scale = getScale(); if (BIG_BANG.equals(ts)) { return 1; } if (BIG_CRUNCH.equals(ts)) { return -1; } if (this == ts || (value == ts.getValue() && scale == ts.getScale())) { return 0; } if (getScale() == ts.getScale()) { final long delta = saturatedAdd(getValue(), -ts.getValue()); return (delta == 0) ? 0 : (delta > 0) ? 1 : -1; } final ITmfTimestamp nts = ts.normalize(0, scale); if (hasSaturated(ts, nts)) { final long otherValue = ts.getValue(); if (value == 0 && otherValue == 0) { return 0; } if (value < 0 && otherValue >= 0) { return -1; } if (value >= 0 && otherValue < 0) { return 1; } final int otherScale = ts.getScale(); return (scale > otherScale) ? (otherValue >= 0) ? 1 : -1 : (otherValue >= 0) ? -1 : 1; } final long delta = value - nts.getValue(); return Long.compare(delta, 0); }
Source:
<code>public AudioAnalysisSection createModelObject(JsonObject jsonObject) { if (jsonObject == null || jsonObject.isJsonNull()) { return null; } return new AudioAnalysisSection.Builder() .setKey( hasAndNotNull(jsonObject, "key") ? jsonObject.get("key").getAsInt() : null) .setKeyConfidence( hasAndNotNull(jsonObject, "key_confidence") ? jsonObject.get("key_confidence").getAsFloat() : null) .setLoudness( hasAndNotNull(jsonObject, "loudness") ? jsonObject.get("loudness").getAsFloat() : null) .setMeasure( (hasAndNotNull(jsonObject, "start") && hasAndNotNull(jsonObject, "duration") <START> && hasAndNotNull(jsonObject, "confidence")) <END> ? new AudioAnalysisMeasure.JsonUtil().createModelObject(jsonObject) : null) .setMode( hasAndNotNull(jsonObject, "type") ? Modality.keyOf( jsonObject.get("mode").getAsInt()) : null) .setModeConfidence( hasAndNotNull(jsonObject, "mode_confidence") ? jsonObject.get("mode_confidence").getAsFloat() : null) .setTempo( hasAndNotNull(jsonObject, "tempo") ? jsonObject.get("tempo").getAsFloat() : null) .setTempoConfidence( hasAndNotNull(jsonObject, "tempo_confidence") ? jsonObject.get("tempo_confidence").getAsFloat() : null) .setTimeSignature( hasAndNotNull(jsonObject, "time_signature") ? jsonObject.get("time_signature").getAsInt() : null) .setTimeSignatureConfidence( hasAndNotNull(jsonObject, "time_signature_confidence") ? jsonObject.get("time_signature_confidence").getAsFloat() : null) .build(); }</code><technical_language>checks needed, they? part of measure builder</technical_language>

Target:
public AudioAnalysisSection createModelObject(JsonObject jsonObject) { if (jsonObject == null || jsonObject.isJsonNull()) { return null; } return new AudioAnalysisSection.Builder() .setKey( hasAndNotNull(jsonObject, "key") ? jsonObject.get("key").getAsInt() : null) .setKeyConfidence( hasAndNotNull(jsonObject, "key_confidence") ? jsonObject.get("key_confidence").getAsFloat() : null) .setLoudness( hasAndNotNull(jsonObject, "loudness") ? jsonObject.get("loudness").getAsFloat() : null) .setMeasure( new AudioAnalysisMeasure.JsonUtil().createModelObject(jsonObject)) .setMode( hasAndNotNull(jsonObject, "type") ? Modality.keyOf( jsonObject.get("mode").getAsInt()) : null) .setModeConfidence( hasAndNotNull(jsonObject, "mode_confidence") ? jsonObject.get("mode_confidence").getAsFloat() : null) .setTempo( hasAndNotNull(jsonObject, "tempo") ? jsonObject.get("tempo").getAsFloat() : null) .setTempoConfidence( hasAndNotNull(jsonObject, "tempo_confidence") ? jsonObject.get("tempo_confidence").getAsFloat() : null) .setTimeSignature( hasAndNotNull(jsonObject, "time_signature") ? jsonObject.get("time_signature").getAsInt() : null) .setTimeSignatureConfidence( hasAndNotNull(jsonObject, "time_signature_confidence") ? jsonObject.get("time_signature_confidence").getAsFloat() : null) .build(); }
Source:
<code>public void onUpdate(TrapdConfiguration config) { this.m_snmpTrapAddress = config.getSnmpTrapAddress(); this.m_snmpTrapPort =config.getSnmpTrapPort(); <START> this.m_snmpV3Users=new ArrayList<SnmpV3User>(TrapReceiverImpl.addToSnmpV3Users(config).values()); <END> }</code><technical_language>Part of reusability added Synchronized block TrapReceiverImpl.addToSnmpV3Users calling here.I hope this serves If synchronized is needed for this block i update it.Please if necessary wrap well</technical_language>

Target:
public void onUpdate(TrapdConfiguration config) { this.m_snmpTrapAddress = config.getSnmpTrapAddress(); this.m_snmpTrapPort = config.getSnmpTrapPort(); synchronized (m_snmpV3Users) { m_snmpV3Users.clear(); if (config.getSnmpv3UserCollection() != null) { m_snmpV3Users.addAll(config.getSnmpv3UserCollection().stream().map(TrapReceiverImpl::toSnmpV3User).collect(Collectors.toList())); } } }
Source:
<code>public void clear() { head = null; <START> free = null; <END> }</code><technical_language>add a inQueue = 0; here</technical_language>

Target:
public void clear() { head = null; free = null; inQueue = 0; }
Source:
<code>public PrettyPrinterConfiguration setIndent(String indent) { <START> throw new NotImplementedException(); <END> }</code><technical_language>instead following? - warn deprecation if do deprecation warnings - if argument is spaces only, set indentSize length - if argument contains else, throw exception (probably users couple of spaces tabs, added pending PR if accept it, else is OK if is supported anymore) exisiting code simply continue work besides a deprecation warning</technical_language>

Target:
public PrettyPrinterConfiguration setIndent(String indent) { System.err.println("PrettyPrinterConfiguration.setIndent is deprecated, please review the changes."); indentSize = indent.length(); return this; }
Source:
<code>public void rollback(Xid xid) throws XAException { if (LOGGER.isLoggable(Level.FINEST)) { debug("rolling back xid = " + xid); } try { if (currentXid != null && xid.equals(currentXid)) { state = State.IDLE; currentXid = null; conn.rollback(); conn.setAutoCommit(localAutoCommitMode); } else { String s = RecoveredXid.xidToString(xid); conn.setAutoCommit(true); Statement stmt = conn.createStatement(); try { stmt.executeUpdate("ROLLBACK PREPARED '" + s + "'"); } finally { stmt.close(); } } committedOrRolledBack = true; } catch (SQLException ex) { int errorCode = XAException.XAER_RMERR; if (PSQLState.UNDEFINED_OBJECT.getState().equals(ex.getSQLState())) { if (committedOrRolledBack || !xid.equals(preparedXid)) { errorCode = XAException.XAER_NOTA; } } if (PSQLState.isConnectionError(ex.getSQLState())) { errorCode = XAException.XAER_RMFAIL; } <START> throw new PGXAException(GT.tr("Error rolling back prepared transaction"), ex, errorCode); <END> } }</code><technical_language>@ochaloup , I a bit late party, do of printing xid, preparedXid, committedOrRolledBack in error message? sure, crucial information if receives ""Error rolling prepared transaction"</technical_language>

Target:
public void rollback(Xid xid) throws XAException { if (LOGGER.isLoggable(Level.FINEST)) { debug("rolling back xid = " + xid); } try { if (currentXid != null && currentXid.equals(xid)) { state = State.IDLE; currentXid = null; conn.rollback(); conn.setAutoCommit(localAutoCommitMode); } else { String s = RecoveredXid.xidToString(xid); conn.setAutoCommit(true); Statement stmt = conn.createStatement(); try { stmt.executeUpdate("ROLLBACK PREPARED '" + s + "'"); } finally { stmt.close(); } } committedOrRolledBack = true; } catch (SQLException ex) { int errorCode = XAException.XAER_RMERR; if (PSQLState.UNDEFINED_OBJECT.getState().equals(ex.getSQLState())) { if (committedOrRolledBack || !xid.equals(preparedXid)) { if (LOGGER.isLoggable(Level.FINEST)) { debug("rolling back xid " + xid + " while the connection prepared xid is " + preparedXid + (committedOrRolledBack ? ", but the connection was already committed/rolled-back" : "")); } errorCode = XAException.XAER_NOTA; } } if (PSQLState.isConnectionError(ex.getSQLState())) { if (LOGGER.isLoggable(Level.FINEST)) { debug("rollback connection failure (sql error code " + ex.getSQLState() + "), reconnection could be expected"); } errorCode = XAException.XAER_RMFAIL; } throw new PGXAException(GT.tr("Error rolling back prepared transaction. rollback xid={0}, preparedXid={1}, currentXid={2}", xid, preparedXid), ex, errorCode); } }
Source:
<code>public void shutdown() { <START> LOGGER.debug("Closing connection to Solr client."); <END> final SolrClient c = client; try { c.close(); } catch (IOException e) { LOGGER.info("Unable to close Solr client", e); } LOGGER.debug("Finished closing connection to Solr client."); }</code><technical_language>question: do need do line 187 (final SolrClient c = client;)</technical_language>

Target:
public void shutdown() { provider.shutdown(); }
Source:
<code>private void checkIsOnTarget() { if (!checkErrorThreshold && !checkDerivativeThreshold && !checkOnTargetForDuration) { onTarget = false; return; } onTarget = true; if (checkErrorThreshold) { onTarget &= errorIsSmall; } if (checkDerivativeThreshold) { onTarget &= derivativeIsSmall; } if (checkOnTargetForDuration) { if(onTarget){ if(waitingToStabilize == false){ waitingToStabilize = true; startTime = Timer.getFPGATimestamp(); onTarget = false; } else { <START> onTarget = Timer.getFPGATimestamp() - startTime > onTargetThreshold; <END> } } else { waitingToStabilize = false; onTarget = false; } } }</code><technical_language>is fpgatimestamp in seconds? For some reason I thought ms</technical_language>

Target:
private void checkIsOnTarget() { if (!checkErrorThreshold && !checkDerivativeThreshold && !checkTimeThreshold) { onTargetStartTime = false; return; } onTargetStartTime = true; if (checkErrorThreshold) { onTargetStartTime &= errorIsSmall; } if (checkDerivativeThreshold) { onTargetStartTime &= derivativeIsSmall; } if (checkTimeThreshold) { if(onTargetStartTime){ if(waitingToStabilize == false){ waitingToStabilize = true; startTime = Timer.getFPGATimestamp(); onTargetStartTime = false; } else { onTargetStartTime = Timer.getFPGATimestamp() - startTime > timeToleranceInSeconds; } } else { waitingToStabilize = false; onTargetStartTime = false; } } }
Source:
<code>public String getColumnText(Object element, int columnIndex) { if (element instanceof ECTransition) { switch (columnIndex) { <START> case 0: return Integer.toString(getType().getOutTransitions().indexOf(element) + 1); case 1: if (null != ((ECTransition) element).getDestination()) { return ((ECTransition) element).getDestination().getName(); } break; case 2: if (null != ((ECTransition) element).getConditionEvent()) { return ((ECTransition) element).getConditionEvent().getName(); } break; case 3: if (null != ((ECTransition) element).getConditionExpression()) { return ((ECTransition) element).getConditionExpression(); } break; case 4: if (null != ((ECTransition) element).getComment()) { return ((ECTransition) element).getComment(); } break; <END> default: break; } } return ECCContentAndLabelProvider.EMPTY_FIELD; }</code><technical_language>cases magic numbers</technical_language>

Target:
public String getColumnText(Object element, int columnIndex) { if (element instanceof ECTransition) { switch (columnIndex) { case TRANSITION_COLUMN_PRIORITY: return Integer.toString(getType().getOutTransitions().indexOf(element) + 1); case TRANSITION_COLUMN_DESTINATION: if (null != ((ECTransition) element).getDestination()) { return ((ECTransition) element).getDestination().getName(); } break; case TRANSITION_COLUMN_EVENT: if (null != ((ECTransition) element).getConditionEvent()) { return ((ECTransition) element).getConditionEvent().getName(); } break; case TRANSITION_COLUMN_CONDITION: if (null != ((ECTransition) element).getConditionExpression()) { return ((ECTransition) element).getConditionExpression(); } break; case TRANSITION_COLUMN_COMMENT: if (null != ((ECTransition) element).getComment()) { return ((ECTransition) element).getComment(); } break; default: break; } } return ECCContentAndLabelProvider.EMPTY_FIELD; }
Source:
<code>public void deleteWorkflowTask(WorkflowTask task) throws DotDataException { final DotConnect db = new DotConnect(); HibernateUtil.evict(task); Contentlet c = new Contentlet(); c.setIdentifier(task.getWebasset()); c.setLanguageId(task.getLanguageId()); boolean localTransaction = false; try { localTransaction = HibernateUtil.startLocalTransactionIfNeeded(); db.setSQL("delete from workflow_comment where workflowtask_id = ?"); db.addParam(task.getId()); db.loadResult(); db.setSQL("delete from workflow_history where workflowtask_id = ?"); db.addParam(task.getId()); db.loadResult(); db.setSQL("delete from workflowtask_files where workflowtask_id = ?"); db.addParam(task.getId()); db.loadResult(); db.setSQL("delete from workflow_task where id = ?"); db.addParam(task.getId()); db.loadResult(); if(localTransaction){ HibernateUtil.closeAndCommitTransaction(); } } catch (final Exception e) { if(localTransaction){ HibernateUtil.rollbackTransaction(); } Logger.error(this, "deleteWorkflowTask failed:" + e, e); <START> throw new DotDataException(e.toString()); <END> } finally { cache.remove(task); } }</code><technical_language>I suggest send exception in DotDataException constructor instead of e.toString(). Some details missed stack trace if e.toString() is</technical_language>

Target:
public void deleteWorkflowTask(WorkflowTask task) throws DotDataException { final DotConnect db = new DotConnect(); HibernateUtil.evict(task); Contentlet c = new Contentlet(); c.setIdentifier(task.getWebasset()); c.setLanguageId(task.getLanguageId()); boolean localTransaction = false; try { localTransaction = HibernateUtil.startLocalTransactionIfNeeded(); db.setSQL("delete from workflow_comment where workflowtask_id = ?"); db.addParam(task.getId()); db.loadResult(); db.setSQL("delete from workflow_history where workflowtask_id = ?"); db.addParam(task.getId()); db.loadResult(); db.setSQL("delete from workflowtask_files where workflowtask_id = ?"); db.addParam(task.getId()); db.loadResult(); db.setSQL("delete from workflow_task where id = ?"); db.addParam(task.getId()); db.loadResult(); if(localTransaction){ HibernateUtil.closeAndCommitTransaction(); } } catch (final Exception e) { if(localTransaction){ HibernateUtil.rollbackTransaction(); } Logger.error(this, "deleteWorkflowTask failed:" + e, e); throw new DotDataException(e); } finally { cache.remove(task); } }
Source:
<code><START> private VariantEvaluationContext composeTruthOverlappingVariantContext(final VariantContext truth, final List<VariantContext> calls, <END> final TargetCollection<Target> targets) { final VariantEvaluationContextBuilder builder = new VariantEvaluationContextBuilder(); builder.loc(truth.getContig(), truth.getStart(), truth.getEnd()); builder.attribute(VCFConstants.END_KEY, truth.getEnd()); builder.id(truth.getID()); builder.alleles(CopyNumberTriStateAllele.PLAIN_ALL_ALLELES); builder.genotypes(samples.stream() .map(s -> buildAndAnnotateTruthOverlappingGenotype(s, truth, calls, targets)) .collect(Collectors.toList())); builder.attribute(GenotypeCopyNumberTriStateSegments.NUMBER_OF_TARGETS_KEY, targets.targetCount(truth)); builder.evidence(truth, calls); return builder.make(); }</code><technical_language>Is reduce code duplication truth-overlapping non-truth-overlapping methods</technical_language>

Target:
private VariantEvaluationContext composeTruthOverlappingVariantContext(final VariantContext truth, final List<VariantContext> calls, final TargetCollection<Target> targets) { return composeEvaluationVariantContext(truth, CopyNumberTriStateAllele.PLAIN_ALL_ALLELES, s -> buildAndAnnotateTruthOverlappingGenotype(s, truth, calls, targets), targets, truth, calls); }
Source:
<code>public void cannotDropTable() { assertThrowsAtlasDbDependencyExceptionAndDoesNotChangeCassandraSchema(() -> <START> getTestKvs().truncateTable(TABLE_TO_DROP)); <END> }</code><technical_language>this dropTable</technical_language>

Target:
public void cannotDropTable() { assertThrowsAtlasDbDependencyExceptionAndDoesNotChangeCassandraSchema(() -> getTestKvs().dropTable(TABLE_TO_DROP)); }
Source:
<code>private void createTreeViewer(FormToolkit toolkit, Composite activityComposite) { <START> TreeViewer viewer = new TreeViewer(toolkit.createTree(activityComposite, SWT.MULTI | SWT.H_SCROLL <END> | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER)); GridDataFactory.fillDefaults().hint(500, 100).grab(true, true).applyTo(viewer.getControl()); viewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); viewer.setContentProvider(new ActivityRecordContentProvider()); viewer.setLabelProvider(new DecoratingStyledCellLabelProvider(new ActivityRecordLabelProvider(), null, null)); IActivityStream stream = new ActivityManager().getStream(new TaskActivityScope(getModel().getTask())); viewer.setInput(stream); }</code><technical_language>SWT.BORDER flag removed avoid a double border border is painted form toolkit</technical_language>

Target:
private void createTreeViewer(FormToolkit toolkit, Composite activityComposite) { TreeViewer viewer = new TreeViewer(toolkit.createTree(activityComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION)); GridDataFactory.fillDefaults().hint(SWT.DEFAULT, SWT.DEFAULT).grab(true, true).applyTo(viewer.getControl()); viewer.setContentProvider(new ActivityRecordContentProvider()); viewer.setLabelProvider(new DecoratingStyledCellLabelProvider(new ActivityRecordLabelProvider(), null, null)); IActivityStream stream = new ActivityManager().getStream(new TaskActivityScope(getModel().getTask())); viewer.setInput(stream); }
Source:
<code>public void updateColumn1(String component1, Function<Long, Long> processor) { Optional<Long> result = getColumn1(component1); if (result.isPresent()) { Long newValue = processor.apply(result.get()); <START> if (newValue != result.get()) { <END> putColumn1(component1, processor.apply(result.get())); } } }</code><technical_language>reference comparison work if is string blob type? want Objects.equals(new, old)</technical_language>

Target:
public void updateColumn1(String component1, Function<Long, Long> processor) { Optional<Long> result = getColumn1(component1); if (result.isPresent()) { Long newValue = processor.apply(result.get()); if (Objects.equals(newValue, result.get()) == false) { putColumn1(component1, processor.apply(result.get())); } } }
Source:
<code>private static long now() { final long sinceepoch = new Date().getTime(); <START> return sinceepoch - (sinceepoch % Tv.THOUSAND); <END> }</code><technical_language>@cvrebert integer division instead of subtracting remainder</technical_language>

Target:
private static long now() { final long sinceepoch = System.currentTimeMillis(); return sinceepoch - (sinceepoch % Tv.THOUSAND); }
Source:
<code>public void testModeShapeInMemory() throws Exception { Map<String, URL> parameters = new HashMap<String, URL>(); parameters.put(JcrRepositoryFactory.URL, getClass().getClassLoader().getResource("configRepository.xml")); RunnerConfiguration runnerConfig = new RunnerConfiguration().addTestsToExclude( ConcurrentReadTestSuite.class.getSimpleName(), ConcurrentReadWriteTestSuite.class.getSimpleName(), BigFileReadTestSuite.class.getSimpleName(), <START> SmallFileReadTestSuite.class.getSimpleName()); END> new PerformanceTestSuiteRunner(runnerConfig).runPerformanceTests(parameters, null); }</code><technical_language>wait MODE-1308 is fixed, change tests create Binary instances Session.getValueFactory().createBinary(InputStream); method</technical_language>

Target:
public void testModeShapeInMemory() throws Exception { Map<String, URL> parameters = new HashMap<String, URL>(); parameters.put(JcrRepositoryFactory.URL, getClass().getClassLoader().getResource("configRepository.xml")); performanceTestSuiteRunner.runPerformanceTests(parameters, null); }
Source:
<code>public void testRemoveFromCourseAction(){ ______TS("action: remove instructor from course"); String googleId = "AAMgtUiT.instr2"; String courseId = "AAMgtUiT.CS2104"; detailsPage.clickRemoveInstructorFromCourse(courseId) .verifyStatus(Const.StatusMessages.INSTRUCTOR_REMOVED_FROM_COURSE); detailsPage.verifyHtml("/adminAccountDetailsRemoveInstructor.html"); assertNull(BackDoor.getInstructorByGoogleId(googleId, courseId)); ______TS("action: remove student from course"); courseId = "AAMgtUiT.CS1101"; detailsPage.clickRemoveStudentFromCourse(courseId) .verifyStatus(Const.StatusMessages.INSTRUCTOR_REMOVED_FROM_COURSE); assertNull(BackDoor.getStudent(courseId, "AAMgtUiT.instr2@gmail.com")); <START> detailsPage.verifyHtml("/adminAccountDetailsRemoveStudent.html"); <END> }</code><technical_language>change this verifyHtmlMainContent. I verifyHtml is enough for Ui test</technical_language>

Target:
public void testRemoveFromCourseAction(){ ______TS("action: remove instructor from course"); String googleId = "AAMgtUiT.instr2"; String courseId = "AAMgtUiT.CS2104"; detailsPage.clickRemoveInstructorFromCourse(courseId) .verifyStatus(Const.StatusMessages.INSTRUCTOR_REMOVED_FROM_COURSE); assertNull(BackDoor.getInstructorByGoogleId(googleId, courseId)); ______TS("action: remove student from course"); courseId = "AAMgtUiT.CS1101"; detailsPage.clickRemoveStudentFromCourse(courseId) .verifyStatus(Const.StatusMessages.INSTRUCTOR_REMOVED_FROM_COURSE); assertNull(BackDoor.getStudent(courseId, "AAMgtUiT.instr2@gmail.com")); detailsPage.verifyHtmlMainContent("/adminAccountDetailsRemoveStudent.html"); }
Source:
<code>public void testPreformattedBlockParsedToHtml() { StringWriter out = new StringWriter(); DocumentBuilder builder = new CreoleDocumentBuilder(out); builder.beginDocument(); <START> builder.beginDocument(); <END> builder.beginBlock(BlockType.PREFORMATTED, new Attributes()); builder.characters("line 1"); builder.lineBreak(); builder.characters("line 2"); builder.lineBreak(); builder.lineBreak(); builder.characters("line 3"); builder.endBlock(); builder.lineBreak(); builder.characters("line 4"); builder.endDocument(); assertParsedHtmlMatchesRoundTrip("<pre>line 1\\\\line 2\\\\\\\\line 3</pre><p><br/>line 4</p>", out.toString()); }</code><technical_language>redundant</technical_language>

Target:
public void testPreformattedBlockParsedToHtml() { StringWriter out = new StringWriter(); DocumentBuilder builder = new CreoleDocumentBuilder(out); builder.beginDocument(); builder.beginBlock(BlockType.PREFORMATTED, new Attributes()); builder.characters("line 1"); builder.lineBreak(); builder.characters("line 2"); builder.lineBreak(); builder.lineBreak(); builder.characters("line 3"); builder.endBlock(); builder.lineBreak(); builder.characters("line 4"); builder.endDocument(); assertParsedHtmlMatchesRoundTrip("<pre>line 1\\\\line 2\\\\\\\\line 3</pre><p><br/>line 4</p>", out.toString()); }
Source:
<code>public static byte[] createThumbnailFromUri(Context context, Uri imageUri, int maxWidth, String fileExtension, int orientation) { if (context == null || imageUri == null || maxWidth <= 0) return null; ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { boolean res = resizeImageAndWriteToStream(context, imageUri, fileExtension, maxWidth, orientation, 90, stream); if (!res) { <START> AppLog.w(AppLog.T.POSTS, "Failed to compress the resized image. Use the full picture instead."); <END> return null; } } catch (IOException e) { AppLog.e(AppLog.T.POSTS, "Failed to create resized image. Use the full picture instead."); return null; } catch (OutOfMemoryError e) { AppLog.e(AppLog.T.POSTS, "Can't resize the picture due to low memory. Use the full picture instead."); return null; } return stream.toByteArray(); }</code><technical_language>AppLog.T.POSTS</technical_language>

Target:
public static byte[] createThumbnailFromUri(Context context, Uri imageUri, int maxWidth, String fileExtension, int orientation) { if (context == null || imageUri == null || maxWidth <= 0) return null; ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { boolean res = resizeImageAndWriteToStream(context, imageUri, fileExtension, maxWidth, orientation, 90, stream); if (!res) { AppLog.w(AppLog.T.MEDIA, "Failed to compress the resized image. Use the full picture instead."); return null; } } catch (IOException e) { AppLog.e(AppLog.T.MEDIA, "Failed to create resized image. Use the full picture instead."); return null; } catch (OutOfMemoryError e) { AppLog.e(AppLog.T.MEDIA, "Can't resize the picture due to low memory. Use the full picture instead."); return null; } return stream.toByteArray(); }
Source:
<code>WebAppMsiHandler withoutExternalManagedServiceIdentity(String identityId) { <START> this.userAssignedIdentities.remove(identityId); <END> return this; }</code><technical_language>update for tracking purpose: This is design behavior server need verify null in map understand requests remove identityId</technical_language>

Target:
WebAppMsiHandler withoutExternalManagedServiceIdentity(String identityId) { this.userAssignedIdentities.put(identityId, null); return this; }
Source:
<code>public void testRuleIsNotLoaded() { SonarLintGlobalSettings settings = new SonarLintGlobalSettings(); <START> assertThat(settings.getRuleParam(RULE, PARAM)).isEqualTo(null); <END> }</code><technical_language>s/isEqualTo(null)/isNull()</technical_language>

Target:
public void testRuleIsNotLoaded() { SonarLintGlobalSettings settings = new SonarLintGlobalSettings(); assertThat(settings.getRuleParamValue(RULE, PARAM).isPresent()).isFalse(); }
Source:
<code>public boolean addOrUpdate(String itemName, String autocompleteSection) throws ConstructorException { <START> return add(itemName, autocompleteSection, null); <END> }</code><technical_language>This addOrUpdate, right</technical_language>

Target:
public boolean addOrUpdate(String itemName, String autocompleteSection) throws ConstructorException { return addOrUpdate(itemName, autocompleteSection, null); }
Source:
<code>public void testNormalJoinGroupLeader() { final String consumerId = "leader"; final Set<String> subscription = singleton(topic1); final List<TopicPartition> owned = Collections.emptyList(); final List<TopicPartition> assigned = Arrays.asList(t1p); subscriptions.subscribe(singleton(topic1), rebalanceListener); client.updateMetadata(metadataResponse); client.prepareResponse(groupCoordinatorResponse(node, Errors.NONE)); coordinator.ensureCoordinatorReady(time.timer(Long.MAX_VALUE)); Map<String, List<String>> memberSubscriptions = singletonMap(consumerId, singletonList(topic1)); partitionAssignor.prepare(singletonMap(consumerId, assigned)); client.prepareResponse(joinGroupLeaderResponse(1, consumerId, memberSubscriptions, Errors.NONE)); client.prepareResponse(new MockClient.RequestMatcher() { @Override public boolean matches(AbstractRequest body) { SyncGroupRequest sync = (SyncGroupRequest) body; return sync.data.memberId().equals(consumerId) && sync.data.generationId() == 1 && sync.groupAssignments().containsKey(consumerId); } }, syncGroupResponse(assigned, Errors.NONE)); coordinator.poll(time.timer(Long.MAX_VALUE)); assertFalse(coordinator.rejoinNeededOrPending()); assertEquals(toSet(assigned), subscriptions.assignedPartitions()); assertEquals(subscription, subscriptions.groupSubscription()); assertEquals(0, rebalanceListener.revokedCount); <START> assertNull(rebalanceListener.revoked); <END> assertEquals(1, rebalanceListener.assignedCount); assertEquals(getAdded(owned, assigned), rebalanceListener.assigned); }</code><technical_language>checking... this is revoking reassigning, right</technical_language>

Target:
public void testNormalJoinGroupLeader() { final String consumerId = "leader"; final Set<String> subscription = singleton(topic1); final List<TopicPartition> owned = Collections.emptyList(); final List<TopicPartition> assigned = Arrays.asList(t1p); subscriptions.subscribe(singleton(topic1), rebalanceListener); client.updateMetadata(metadataResponse); client.prepareResponse(groupCoordinatorResponse(node, Errors.NONE)); coordinator.ensureCoordinatorReady(time.timer(Long.MAX_VALUE)); Map<String, List<String>> memberSubscriptions = singletonMap(consumerId, singletonList(topic1)); partitionAssignor.prepare(singletonMap(consumerId, assigned)); client.prepareResponse(joinGroupLeaderResponse(1, consumerId, memberSubscriptions, Errors.NONE)); client.prepareResponse(body -> { SyncGroupRequest sync = (SyncGroupRequest) body; return sync.data.memberId().equals(consumerId) && sync.data.generationId() == 1 && sync.groupAssignments().containsKey(consumerId); }, syncGroupResponse(assigned, Errors.NONE)); coordinator.poll(time.timer(Long.MAX_VALUE)); assertFalse(coordinator.rejoinNeededOrPending()); assertEquals(toSet(assigned), subscriptions.assignedPartitions()); assertEquals(subscription, subscriptions.groupSubscription()); assertEquals(0, rebalanceListener.revokedCount); assertNull(rebalanceListener.revoked); assertEquals(1, rebalanceListener.assignedCount); assertEquals(getAdded(owned, assigned), rebalanceListener.assigned); }
Source:
<code>public void start() throws IOException { Preconditions.checkState(conf != null, "Configuration must be set before starting mini HBase cluster"); Preconditions.checkState(zookeeperClientPort != null, "The zookeeper client port must be configured"); try { hbaseCluster = new MiniHBaseCluster(conf, 0, 0, null, null); } catch (InterruptedException e) { <START> throw new IOException(e); <END> } conf = configureHBaseCluster(hbaseCluster.getConf(), zookeeperClientPort, FileSystem.get(conf), forceBindIP); hbaseCluster.startMaster(); hbaseCluster.startRegionServer(); waitForHBaseToComeOnline(hbaseCluster); createManagedSchemasTable(conf); logger.info("HBase Minicluster Service Started."); }</code><technical_language>This call Thread.currentThread().interrupt() propagate InterruptedException calling code interrupt. I wrapping exception in IOException is appropriate, create a RuntimeException class for this</technical_language>

Target:
public void start() throws IOException, InterruptedException { Preconditions.checkState(hadoopConf != null, "Hadoop Configuration must be set before starting mini HBase cluster"); Preconditions.checkState(zookeeperClientPort != 0, "The zookeeper client port must be configured to a non zero value"); hbaseCluster = new MiniHBaseCluster(hadoopConf, 0, 0, null, null); hadoopConf = configureHBaseCluster(hbaseCluster.getConf(), zookeeperClientPort, FileSystem.get(hadoopConf), bindIP, masterPort, regionserverPort); hbaseCluster.startMaster(); hbaseCluster.startRegionServer(); waitForHBaseToComeOnline(hbaseCluster); logger.info("HBase Minicluster Service Started."); }
Source:
<code>public RegistrationFieldType getFieldType() { <START> if (fieldType != null) { <END> return fieldType; } else { return RegistrationFieldType.UNKNOWN; } }</code><technical_language>lines optimized return fieldType != null ? fieldType : RegistrationFieldType.UNKNOWN;</technical_language>

Target:
public RegistrationFieldType getFieldType() { return fieldType != null ? fieldType : RegistrationFieldType.UNKNOWN; }
Source:
<code>public void onMediaItemSelected(View sourceView, int localMediaId) { MediaModel media = mMediaStore.getMediaWithLocalId(localMediaId); if (media == null) { AppLog.w(AppLog.T.MEDIA, "Media browser > unable to load localMediaId = " + localMediaId); ToastUtils.showToast(this, R.string.error_media_load); return; } boolean isLocalFile = MediaUtils.isLocalFile(media.getUploadState()); if (mBrowserType.isPicker()) { if (isLocalFile) { <START> return; <END> } Intent intent = new Intent(); ArrayList<Long> remoteMediaIds = new ArrayList<>(); remoteMediaIds.add(media.getMediaId()); intent.putExtra(RESULT_IDS, ListUtils.toLongArray(remoteMediaIds)); setResult(RESULT_OK, intent); finish(); } else { String mimeType = StringUtils.notNullStr(media.getMimeType()).toLowerCase(); if (mimeType.startsWith("image") || mimeType.startsWith("video")) { if (isLocalFile) { MediaPreviewActivity.showPreview(this, sourceView, media.getFilePath(), mimeType.startsWith("video")); } else { MediaPreviewActivity.showPreview(this, sourceView, mSite, localMediaId); } } } }</code><technical_language>I if a Toast user understand options this point. moment, I thought happen in background, I tapped uploading image set featured happened. a "Please wait for upload finish" toast something</technical_language>

Target:
public void onMediaItemSelected(View sourceView, int localMediaId) { MediaModel media = mMediaStore.getMediaWithLocalId(localMediaId); if (media == null) { AppLog.w(AppLog.T.MEDIA, "Media browser > unable to load localMediaId = " + localMediaId); ToastUtils.showToast(this, R.string.error_media_load); return; } boolean isLocalFile = MediaUtils.isLocalFile(media.getUploadState()); if (mBrowserType.isPicker()) { if (isLocalFile) { ToastUtils.showToast(this, R.string.error_media_still_uploading); return; } Intent intent = new Intent(); ArrayList<Long> remoteMediaIds = new ArrayList<>(); remoteMediaIds.add(media.getMediaId()); intent.putExtra(RESULT_IDS, ListUtils.toLongArray(remoteMediaIds)); setResult(RESULT_OK, intent); finish(); } else { showMediaSettings(media); } }
Source:
<code>private void translateVolumeType(GlusterVolumeEntity volumeEntity) { EnumTranslator translator = EnumTranslator.getInstance(); if (translator.containsKey(volumeEntity.getVolumeType())) { String volumeType = translator.translate(volumeEntity.getVolumeType()); if (volumeEntity.getIsArbiter()) { <START> volumeType += " " + ConstantsManager.getInstance().getConstants().arbiter(); END> } getDetailModel().setVolumeTypeSilently(volumeType); } }</code><technical_language>( )</technical_language>

Target:
private void translateVolumeType(GlusterVolumeEntity volumeEntity) { EnumTranslator translator = EnumTranslator.getInstance(); if (translator.containsKey(volumeEntity.getVolumeType())) { String volumeType = translator.translate(volumeEntity.getVolumeType()); if (volumeEntity.getIsArbiter()) { volumeType += " (" + ConstantsManager.getInstance().getConstants().arbiter() + ")"; } getDetailModel().setVolumeTypeSilently(volumeType); } }
Source:
<code>public void evaluate_shouldReturnPatientsAmpathIdentifierFromAListOfIdentifiers() throws Exception { MohIdentifierRule mohIdentifierRule = new MohIdentifierRule(); PatientService patientService = Context.getPatientService(); Patient patient1 = patientService.getPatient(6); AdministrationService ams = Context.getAdministrationService(); PatientIdentifierType cccnotype = new PatientIdentifierType(); cccnotype.setName("CCC Number"); cccnotype.setDescription("A unique number generated by clinics"); patientService.savePatientIdentifierType(cccnotype); GlobalProperty globalProperty = new GlobalProperty(); <START> globalProperty.setProperty("mflgenerator.mfl"); <END> globalProperty.setDescription("A unique patient Number generated by Clinics"); globalProperty.setPropertyValue("CCC Number"); ams.saveGlobalProperty(globalProperty); PatientIdentifierType pit = MohCacheUtils.getPatientIdentifierType(ams.getGlobalProperty("mflgenerator.mfl")); Location location = Context.getLocationService().getLocation(1); PatientIdentifier pi = new PatientIdentifier("11740-00001", pit, location); patient1.addIdentifier(pi); patientService.savePatient(patient1); Context.flushSession(); Result result1 = mohIdentifierRule.evaluate(null, patient1.getId(), null); Result expectedResult1 = new Result("12345K"); Assert.assertEquals("The two identifiers are not equal",expectedResult1.toString(),result1.toString()); }</code><technical_language>I CCC Number Module calls this cccgenerator.CCC ... is right? double check latest code I I committed changes matched CCC module</technical_language>

Target:
public void evaluate_shouldReturnPatientsAmpathIdentifierFromAListOfIdentifiers() throws Exception { MohIdentifierRule mohIdentifierRule = new MohIdentifierRule(); PatientService patientService = Context.getPatientService(); Patient patient1 = patientService.getPatient(6); AdministrationService ams = Context.getAdministrationService(); PatientIdentifierType cccnotype = new PatientIdentifierType(); cccnotype.setName("CCC Number"); cccnotype.setDescription("A unique number generated by clinics"); patientService.savePatientIdentifierType(cccnotype); GlobalProperty globalProperty = new GlobalProperty(); globalProperty.setProperty("cccgenerator.CCC"); globalProperty.setDescription("A unique patient Number generated by Clinics"); globalProperty.setPropertyValue("CCC Number"); ams.saveGlobalProperty(globalProperty); PatientIdentifierType pit = MohCacheUtils.getPatientIdentifierType(ams.getGlobalProperty("cccgenerator.CCC")); Location location = Context.getLocationService().getLocation(1); PatientIdentifier pi = new PatientIdentifier("11740-00001", pit, location); patient1.addIdentifier(pi); patientService.savePatient(patient1); Context.flushSession(); Result result1 = mohIdentifierRule.evaluate(null, patient1.getId(), null); Result expectedResult1 = new Result("12345K"); Assert.assertEquals("The two identifiers are not equal",expectedResult1.toString(),result1.toString()); }
Source:
<code>public boolean isEmpty() { <START> return totalCount() > 0; <END> }</code><technical_language>Hmm obvious error</technical_language>

Target:
public boolean isEmpty() { return chunkCount() == 0; }
Source:
<code>public EnvironmentDTO populate(ModelTranslator translator, Environment source, EnvironmentDTO dest) { dest = super.populate(translator, source, dest); dest.setId(source.getId()); dest.setName(source.getName()); dest.setDescription(source.getDescription()); if (translator != null) { dest.setOwner(translator.translate(source.getOwner(), OwnerDTO.class)); Set<EnvironmentContent> envContents = source.getEnvironmentContent(); if (envContents != null) { Collection<EnvironmentContent> envContent = source.getEnvironmentContent(); dest.setEnvironmentContent(Collections.<EnvironmentContentDTO>emptyList()); if (envContent != null) { ObjectTranslator<Content, ContentDTO> contentTranslator = translator .findTranslatorByClass(Content.class, ContentDTO.class); for (EnvironmentContent ec : envContent) { if (ec != null) { ContentDTO dto = contentTranslator.translate(translator, ec.getContent()); if (dto != null) { log.debug("VRITANT {}", dest); log.debug("VRITANT {}", dto); log.debug("VRITANT {}", ec.getEnabled()); <START> dest.addContent(dto, ec.getEnabled().booleanValue()); <END> } } } } } } else { dest.setOwner(null); dest.setEnvironmentContent(null); } return dest; }</code><technical_language>Looked this a bit more thought: ec.getEnabled is returning null, is causing problem. For environment content, need accept null a value, EnvironmentContentDTO is updated accordingly, drop .booleanValue this good</technical_language>

Target:
public EnvironmentDTO populate(ModelTranslator translator, Environment source, EnvironmentDTO dest) { dest = super.populate(translator, source, dest); dest.setId(source.getId()); dest.setName(source.getName()); dest.setDescription(source.getDescription()); if (translator != null) { dest.setOwner(translator.translate(source.getOwner(), OwnerDTO.class)); Set<EnvironmentContent> envContents = source.getEnvironmentContent(); if (envContents != null) { Collection<EnvironmentContent> envContent = source.getEnvironmentContent(); dest.setEnvironmentContent(Collections.<EnvironmentContentDTO>emptyList()); if (envContent != null) { ObjectTranslator<Content, ContentDTO> contentTranslator = translator .findTranslatorByClass(Content.class, ContentDTO.class); for (EnvironmentContent ec : envContent) { if (ec != null) { ContentDTO dto = contentTranslator.translate(translator, ec.getContent()); if (dto != null) { dest.addContent(dto, ec.getEnabled()); } } } } } } else { dest.setOwner(null); dest.setEnvironmentContent(null); } return dest; }