auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void checkVdsSwapThreshold(VdsStatistics stat) { final double THRESHOLD = 0.98; Integer minAvailableThreshold = Config.getValue(ConfigValues.LogPhysicalMemoryThresholdInMB); Integer maxUsedPercentageThreshold = Config.getValue(ConfigValues.LogMaxPhysicalMemoryUsedThresholdInPercentage); if (stat.getswap_total() == null || stat.getswap_free() == null || stat.getswap_total() == 0) { return; } Long swapUsedPercent = (stat.getswap_total() - stat.getswap_free()) / stat.getswap_total(); Long allowedMinAvailableThreshold = Math.round(minAvailableThreshold.doubleValue() * THRESHOLD); AuditLogType valueToLog = stat.getswap_free() < allowedMinAvailableThreshold ? AuditLogType.VDS_LOW_SWAP : AuditLogType.VDS_HIGH_SWAP_USE; if (stat.getswap_free() < allowedMinAvailableThreshold || swapUsedPercent > maxUsedPercentageThreshold) { AuditLogableBase logable = new AuditLogableBase(stat.getId()); logable.addCustomValue("HostName", _vds.getName()); logable.addCustomValue("UsedSwap", swapUsedPercent.toString()); logable.addCustomValue("AvailableSwapMemory", stat.getswap_free().toString()); logable.addCustomValue("Threshold", stat.getswap_free() < allowedMinAvailableThreshold ? <START> allowedMinAvailableThreshold.toString() : maxUsedPercentageThreshold.toString()); <END> auditLog(logable, valueToLog); } }</code><technical_language>in user message show configured threshold, 2% decrease</technical_language>

Target:
private void checkVdsSwapThreshold(VdsStatistics stat) { final double THRESHOLD = 0.98; Integer minAvailableThreshold = Config.getValue(ConfigValues.LogPhysicalMemoryThresholdInMB); Integer maxUsedPercentageThreshold = Config.getValue(ConfigValues.LogMaxPhysicalMemoryUsedThresholdInPercentage); if (stat.getswap_total() == null || stat.getswap_free() == null || stat.getswap_total() == 0) { return; } Long swapUsedPercent = (stat.getswap_total() - stat.getswap_free()) / stat.getswap_total(); Long allowedMinAvailableThreshold = Math.round(minAvailableThreshold.doubleValue() * THRESHOLD); AuditLogType valueToLog = stat.getswap_free() < allowedMinAvailableThreshold ? AuditLogType.VDS_LOW_SWAP : AuditLogType.VDS_HIGH_SWAP_USE; if (stat.getswap_free() < allowedMinAvailableThreshold || swapUsedPercent > maxUsedPercentageThreshold) { AuditLogableBase logable = new AuditLogableBase(stat.getId()); logable.addCustomValue("HostName", _vds.getName()); logable.addCustomValue("UsedSwap", swapUsedPercent.toString()); logable.addCustomValue("AvailableSwapMemory", stat.getswap_free().toString()); logable.addCustomValue("Threshold", stat.getswap_free() < allowedMinAvailableThreshold ? minAvailableThreshold.toString() : maxUsedPercentageThreshold.toString()); auditLog(logable, valueToLog); } }
Source:
<code>protected void processTuple(Object tuple) { GenericRecord record = null; try { record = getGenericRecord(tuple); } catch (Exception e) { <START> LOG.error("Exception in parsing record"); <END> errorCnt++; } if (record != null) { output.emit(record); recordCnt++; } else { errorCnt++; } }</code><technical_language>Please hide exception callstack.. Please log it</technical_language>

Target:
protected void processTuple(Object tuple) { GenericRecord record = null; try { record = getGenericRecord(tuple); } catch (Exception e) { LOG.error("Exception in parsing record"); errorCount++; } if (record != null) { output.emit(record); recordCount++; } else if (errorPort.isConnected()) { errorPort.emit(tuple); errorCount++; } }
Source:
<code>static Object standardize(String column, @Nullable Object value, boolean isSingleValue) { if (value == null) { return null; } if (value instanceof Collection) { return standardizeCollection(column, (Collection) value, isSingleValue); } if (value instanceof Map) { return standardizeCollection(column, ((Map) value).values(), isSingleValue); } if (value instanceof Object[]) { Object[] values = (Object[]) value; int numValues = values.length; if (numValues == 0) { return null; } if (numValues == 1) { return standardize(column, values[0], isSingleValue); } List<Object> standardizedValues = new ArrayList<>(numValues); for (Object singleValue : values) { Object standardizedValue = standardize(column, singleValue, true); if (standardizedValue != null) { standardizedValues.add(standardizedValue); } } int numStandardizedValues = standardizedValues.size(); if (numStandardizedValues == 0) { return null; } <START> if (numStandardizedValues == 1 || isSingleValue) { <END> return standardizedValues.get(0); } return standardizedValues.toArray(); } return value; }</code><technical_language>Is this needed in this PR</technical_language>

Target:
static Object standardize(String column, @Nullable Object value, boolean isSingleValue) { if (value == null) { return null; } if (value instanceof Collection) { return standardizeCollection(column, (Collection) value, isSingleValue); } if (value instanceof Map) { return standardizeCollection(column, ((Map) value).values(), isSingleValue); } if (value instanceof Object[]) { Object[] values = (Object[]) value; int numValues = values.length; if (numValues == 0) { return null; } if (numValues == 1) { return standardize(column, values[0], isSingleValue); } List<Object> standardizedValues = new ArrayList<>(numValues); for (Object singleValue : values) { Object standardizedValue = standardize(column, singleValue, true); if (standardizedValue != null) { standardizedValues.add(standardizedValue); } } int numStandardizedValues = standardizedValues.size(); if (numStandardizedValues == 0) { return null; } if (numStandardizedValues == 1) { return standardizedValues.get(0); } Preconditions.checkState(!isSingleValue, "Cannot read single-value from Object[]: %s for column: %s", Arrays.toString(values), column); return standardizedValues.toArray(); } return value; }
Source:
<code>public String doSomething(String message) { <START> message = prefix + ": " + message; <END> Level level = Level.INFO; if ("DEBUG".equals(outputMode)) { log.debug(message); level = Level.DEBUG; } else if ("INFO".equals(outputMode)) { log.info(message); level = Level.INFO; } else if ("WARN".equals(outputMode)) { log.warn(message); level = Level.WARN; } else if ("ERROR".equals(outputMode)) { log.error(message); level = Level.ERROR; } raiseEvent(message, level); return "LogServiceCalled with: " + message; }</code><technical_language>separate bug; please create issue for this commit this in commit</technical_language>

Target:
public String doSomething(String message) { message = prefix + ": " + message; Level level = Level.INFO; if ("DEBUG".equals(outputMode)) { LOGGER.debug(message); level = Level.DEBUG; } else if ("INFO".equals(outputMode)) { LOGGER.info(message); level = Level.INFO; } else if ("WARN".equals(outputMode)) { LOGGER.warn(message); level = Level.WARN; } else if ("ERROR".equals(outputMode)) { LOGGER.error(message); level = Level.ERROR; } raiseEvent(message, level); return "LogServiceCalled with: " + message; }
Source:
<code>protected TupleBatch fetchNextReady() throws DbException { if (child.eos()) { return resultBuffer.popAny(); <START> } <END> if (tb == null) { tb = child.nextReady(); row = 0; } while (tb != null) { while (row < tb.numTuples()) { if (curGroupKey == null) { curGroupKey = new Tuple(groupSchema); for (int gKey = 0; gKey < gFields.length; ++gKey) { TupleUtils.copyValue(tb, gFields[gKey], row, curGroupKey, gKey); } } else if (!TupleUtils.tupleEquals(tb, gFields, row, curGroupKey, gRange, 0)) { addToResult(); for (int gKey = 0; gKey < gFields.length; ++gKey) { TupleUtils.copyValue(tb, gFields[gKey], row, curGroupKey, gKey); } aggregatorStates = AggUtils.allocateAggStates(aggregators); if (resultBuffer.hasFilledTB()) { return resultBuffer.popFilled(); } } for (int agg = 0; agg < aggregators.length; ++agg) { aggregators[agg].addRow(tb, row, aggregatorStates[agg]); } row++; } tb = child.nextReady(); row = 0; } if (child.eos()) { addToResult(); return resultBuffer.popAny(); } return null; }</code><technical_language>Yes, return null. misleading do otherwise</technical_language>

Target:
protected TupleBatch fetchNextReady() throws DbException { if (child.eos()) { return null; } if (tb == null) { tb = child.nextReady(); row = 0; } while (tb != null) { while (row < tb.numTuples()) { if (curGroupKey == null) { curGroupKey = new Tuple(groupSchema); for (int gKey = 0; gKey < gFields.length; ++gKey) { TupleUtils.copyValue(tb, gFields[gKey], row, curGroupKey, gKey); } } else if (!TupleUtils.tupleEquals(tb, gFields, row, curGroupKey, gRange, 0)) { addToResult(); for (int gKey = 0; gKey < gFields.length; ++gKey) { TupleUtils.copyValue(tb, gFields[gKey], row, curGroupKey, gKey); } aggregatorStates = AggUtils.allocateAggStates(aggregators); if (resultBuffer.hasFilledTB()) { return resultBuffer.popFilled(); } } for (int agg = 0; agg < aggregators.length; ++agg) { aggregators[agg].addRow(tb, row, aggregatorStates[agg]); } row++; } tb = child.nextReady(); row = 0; } if (child.eos()) { addToResult(); return resultBuffer.popAny(); } return null; }
Source:
<code>public Entity getWikibaseItemById(final String id) throws IOException, WikibaseException { if (null == id || 0 == id.trim().length()) return null; StringBuilder actualId = new StringBuilder(id.trim()); if ('q' != Character.toLowerCase(actualId.charAt(0))) { if (Pattern.matches("\\d+", actualId)) { actualId.insert(0, 'Q'); } else { throw new WikibaseException(id + " is not a valid Wikibase id"); } } final StringBuilder url = new StringBuilder(query); url.append("action=wbgetentities"); url.append("&ids=").append(actualId); url.append("&format=xml"); final String text = fetch(url.toString(), "getWikibaseItem"); <START> System.out.println(text); <END> return WikibaseEntityFactory.getWikibaseItem(text); }</code><technical_language>Debug statement left in. Add a log statement instead</technical_language>

Target:
public Entity getWikibaseItemById(final String id) throws IOException, WikibaseException { if (null == id || 0 == id.trim().length()) return null; StringBuilder actualId = new StringBuilder(id.trim()); if ('q' != Character.toLowerCase(actualId.charAt(0))) { if (Pattern.matches("\\d+", actualId)) { actualId.insert(0, 'Q'); } else { throw new WikibaseException(id + " is not a valid Wikibase id"); } } final StringBuilder url = new StringBuilder(query); url.append("action=wbgetentities"); url.append("&ids=").append(actualId); url.append("&format=xml"); final String text = fetch(url.toString(), "getWikibaseItem"); return WikibaseEntityFactory.getWikibaseItem(text); }
Source:
<code>public List<SMREntry> previous() { ILogData data = streamView.previous(); while (Address.isAddress(streamView.getCurrentGlobalPosition()) && data != null) { if (data.getType() == DataType.DATA && data.getPayload(runtime) instanceof ISMRConsumable) { return ((ISMRConsumable) data.getPayload(runtime)) .getSMRUpdates(streamView.getId()); } data = streamView.previous(); } <START> return new ArrayList<>(); <END> }</code><technical_language>Collections.emptyList() instead</technical_language>

Target:
public List<SMREntry> previous() { ILogData data = streamView.previous(); while (Address.isAddress(streamView.getCurrentGlobalPosition()) && data != null) { if (data.getType() == DataType.DATA && data.getPayload(runtime) instanceof ISMRConsumable) { return ((ISMRConsumable) data.getPayload(runtime)) .getSMRUpdates(streamView.getId()); } data = streamView.previous(); } return Collections.emptyList(); }
Source:
<code>public void shouldNotContinueWithConfigSaveIfRequestIsNotFresh() { when(goConfigService.isUserAdmin(currentUser)).thenReturn(true); when(goConfigService.isGroupAdministrator(currentUser.getUsername())).thenReturn(false); SCM updatedScm = new SCM("id", new PluginConfiguration("plugin-id", "1"), new Configuration(new ConfigurationProperty(new ConfigurationKey("key1"),new ConfigurationValue("value1")))); updatedScm.setName("material"); when(entityHashingService.md5ForEntity(cruiseConfig.getSCMs().find("id"), "material")).thenReturn("another-md5"); UpdateSCMConfigCommand command = new UpdateSCMConfigCommand(updatedScm, pluggableScmService, goConfigService, currentUser, result, "md5", entityHashingService); <START> assertThat(command.canContinue(cruiseConfig), is(false)); <END> }</code><technical_language>assert result object -- assertFalse(result.isSuccessful()) assertThat(result.toString(), containsString("STALE_RESOURCE_CONFIG")); assertThat(result.toString(), containsString(scm_material_config_name)));</technical_language>

Target:
public void shouldNotContinueWithConfigSaveIfRequestIsNotFresh() { when(goConfigService.isUserAdmin(currentUser)).thenReturn(true); when(goConfigService.isGroupAdministrator(currentUser.getUsername())).thenReturn(false); SCM updatedScm = new SCM("id", new PluginConfiguration("plugin-id", "1"), new Configuration(new ConfigurationProperty(new ConfigurationKey("key1"),new ConfigurationValue("value1")))); updatedScm.setName("material"); when(entityHashingService.md5ForEntity(cruiseConfig.getSCMs().find("id"), "material")).thenReturn("another-md5"); UpdateSCMConfigCommand command = new UpdateSCMConfigCommand(updatedScm, pluggableScmService, goConfigService, currentUser, result, "md5", entityHashingService); assertThat(command.canContinue(cruiseConfig), is(false)); assertThat(result.toString(), containsString("STALE_RESOURCE_CONFIG")); assertThat(result.toString(), containsString(updatedScm.getName())); }
Source:
<code>public File run() throws IOException { Properties props = loadBaseProperties(); setAdditionalProperties(props); <START> log.debug("Sonar configuration: {}", props.toString()); <END> sonarEnbeddedRunner.addProperties(props); sonarEnbeddedRunner.execute(); return new File(OUTPUT_DIR, OUTPUT_FILE); }</code><technical_language>useful change level info. hard debug this configuration running CI server</technical_language>

Target:
public File run() throws IOException { Properties props = loadBaseProperties(); setAdditionalProperties(props); log.info("Sonar configuration: {}", props.toString()); sonarEnbeddedRunner.addProperties(props); sonarEnbeddedRunner.execute(); return new File(OUTPUT_DIR, OUTPUT_FILE); }
Source:
<code>public void registerAttributes(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerReadWriteAttribute(MAP_GROUPS_TO_ROLES, null, new ReloadRequiredWriteAttributeHandler(MAP_GROUPS_TO_ROLES){ @Override protected boolean requiresRuntime(OperationContext context) { <START> return context.getRunningMode() == RunningMode.NORMAL && !context.isBooting(); <END> } }); }</code><technical_language>need execute RunningMode.ADMIN_ONLY. security realm services part of in ADMIN_ONLY, management interfaces secured</technical_language>

Target:
public void registerAttributes(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerReadWriteAttribute(MAP_GROUPS_TO_ROLES, null, new ReloadRequiredWriteAttributeHandler(MAP_GROUPS_TO_ROLES){ @Override protected boolean requiresRuntime(OperationContext context) { return context.getRunningMode() == RunningMode.ADMIN_ONLY && !context.isBooting(); } }); }
Source:
<code>public void whenOverridingCookie_thenItIsUpdated() { driver.navigate().to(navUrl); Cookie lpCookie = driver.manage().getCookieNamed("lp_120073"); driver.manage().deleteCookie(lpCookie); <START> lpCookie = new Cookie("lp_120073", "foo"); driver.manage().addCookie(lpCookie); <END> assertThat(lpCookie.getValue(), equalTo("foo")); }</code><technical_language>a new variable re-adding cookie</technical_language>

Target:
public void whenOverridingCookie_thenItIsUpdated() { driver.navigate().to(navUrl); Cookie lpCookie = driver.manage().getCookieNamed("lp_120073"); driver.manage().deleteCookie(lpCookie); Cookie newLpCookie = new Cookie("lp_120073", "foo"); driver.manage().addCookie(newLpCookie); Cookie overriddenCookie = driver.manage().getCookieNamed("lp_120073"); assertThat(overriddenCookie.getValue(), equalTo("foo")); }
Source:
<code>public Optional<? extends Blob> findByPath(String tenantId, String path) { if (Strings.isEmpty(path)) { return Optional.empty(); } <START> String cacheKey = tenantId + "-" + ensureRelativePath(path); <END> return Optional.ofNullable(blobByPathCache.get(cacheKey, ignored -> fetchByPath(tenantId, path))); }</code><technical_language>bucket name in somewhere</technical_language>

Target:
public Optional<? extends Blob> findByPath(String tenantId, String path) { if (Strings.isEmpty(path)) { return Optional.empty(); } return Optional.ofNullable(blobByPathCache.get(determinePathCacheKey(tenantId, path), ignored -> fetchByPath(tenantId, path))); }
Source:
<code><START> public void deleteAsync() { <END> ListenableFuture<Void> future = executor.submit(new Callable<Void>() { @Override public Void call() throws IOException { try { deleteNow(); return null; } catch (Throwable t) { if (executor.isShutdown()) { LOG.debug("Error deleting "+file+" (but executor shutdown)", t); return null; } else { LOG.error("Error deleting "+file, t); throw Exceptions.propagate(t); } } }}); addPostExecListener(future); }</code><technical_language>I want do this! meant do is rename this deleteAsyncImpl(), rename delete() deleteAsync(). External classes call this method - bypasses important done in delete()! applies for writeAsync() - public</technical_language>

Target:
private void deleteAsync() { ListenableFuture<Void> future = executor.submit(new Callable<Void>() { @Override public Void call() throws IOException { try { deleteNow(); return null; } catch (Throwable t) { if (executor.isShutdown()) { LOG.debug("Error deleting "+file+" (but executor shutdown)", t); return null; } else { LOG.error("Error deleting "+file, t); throw Exceptions.propagate(t); } } }}); addPostExecListener(future); }
Source:
<code>private Constraint serviceConflict(ConstraintFactory factory) { return factory.fromUniquePair(MrProcessAssignment.class, equal(MrProcessAssignment::getMachine), equal(MrProcessAssignment::getService) ).penalize(MrConstraints.SERVICE_CONFLICT, <START> HardSoftLongScore.ofHard(1L)); <END> }</code><technical_language>FYI instances of HardSoftLongScore.ofHard(1L) replaced HardSoftLongScore.ONE_HARD,</technical_language>

Target:
private Constraint serviceConflict(ConstraintFactory factory) { return factory.fromUniquePair(MrProcessAssignment.class, equal(MrProcessAssignment::getMachine), equal(MrProcessAssignment::getService) ).penalize(MrConstraints.SERVICE_CONFLICT, HardSoftLongScore.ONE_HARD); }
Source:
<code>public void findLowestCommonAncestor() { assertNull(PathUtils.findLowestCommonAncestor(null)); assertNull(PathUtils.findLowestCommonAncestor(Collections.EMPTY_LIST)); ArrayList<AlluxioURI> paths = new ArrayList<>(); paths.add(new AlluxioURI("/")); <START> assertTrue("/".equals(PathUtils.findLowestCommonAncestor(paths).getPath())); <END> paths.clear(); paths.add(new AlluxioURI("/a")); assertTrue("/a".equals(PathUtils.findLowestCommonAncestor(paths).getPath())); paths.add(new AlluxioURI("/a/b")); assertTrue("/a".equals(PathUtils.findLowestCommonAncestor(paths).getPath())); paths.clear(); paths.add(new AlluxioURI("/a/c")); paths.add(new AlluxioURI("/a/d/")); assertTrue("/a".equals(PathUtils.findLowestCommonAncestor(paths).getPath())); paths.add(new AlluxioURI("/b/a/")); assertTrue("/".equals(PathUtils.findLowestCommonAncestor(paths).getPath())); paths.clear(); paths.add(new AlluxioURI("/a/b/c")); paths.add(new AlluxioURI("/a/b/d")); paths.add(new AlluxioURI("/a/b/e")); assertTrue("/a/b".equals(PathUtils.findLowestCommonAncestor(paths).getPath())); paths.clear(); String prefix = "/a/b/c"; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { paths.add(new AlluxioURI(String.format("%s/%d/%d/%d", prefix, i, j, k))); } } } assertTrue(prefix.equals(PathUtils.findLowestCommonAncestor(paths).getPath())); }</code><technical_language>assertEquals this test</technical_language>

Target:
public void findLowestCommonAncestor() { assertNull(PathUtils.findLowestCommonAncestor(null)); assertNull(PathUtils.findLowestCommonAncestor(Collections.EMPTY_LIST)); ArrayList<AlluxioURI> paths = new ArrayList<>(); paths.add(new AlluxioURI("/")); assertEquals("/", PathUtils.findLowestCommonAncestor(paths).getPath()); paths.clear(); paths.add(new AlluxioURI("/a")); assertEquals("/a", PathUtils.findLowestCommonAncestor(paths).getPath()); paths.add(new AlluxioURI("/a/b")); assertEquals("/a", PathUtils.findLowestCommonAncestor(paths).getPath()); paths.clear(); paths.add(new AlluxioURI("/a/c")); paths.add(new AlluxioURI("/a/d/")); assertEquals("/a", PathUtils.findLowestCommonAncestor(paths).getPath()); paths.add(new AlluxioURI("/b/a/")); assertEquals("/", PathUtils.findLowestCommonAncestor(paths).getPath()); paths.clear(); paths.add(new AlluxioURI("/a/b/c")); paths.add(new AlluxioURI("/a/b/d")); paths.add(new AlluxioURI("/a/b/e")); assertEquals("/a/b", PathUtils.findLowestCommonAncestor(paths).getPath()); paths.clear(); String prefix = "/a/b/c"; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { paths.add(new AlluxioURI(String.format("%s/%d/%d/%d", prefix, i, j, k))); } } } assertEquals(prefix, PathUtils.findLowestCommonAncestor(paths).getPath()); }
Source:
<code>public void start() { synchronized (_lock) { if (_state != State.NOT_YET_STARTED) { throw new IllegalStateException(_poolName + " is " + _state); } _state = State.RUNNING; long timeOut = Math.min(_idleTimeout, _waitTimeout); if (timeOut > 0) { <START> long freq = Math.min(timeOut / 10, 1000); <END> _objectTimeoutFuture = _timeoutExecutor.scheduleAtFixedRate(new Runnable() { @Override public void run() { timeoutWaiters(); timeoutObjects(); } }, freq, freq, TimeUnit.MILLISECONDS); } } for(int i = 0; i < _minSize; i++) { if(shouldCreate()) { create(); } } }</code><technical_language>waittimeout low, add a min of 20-50 ms</technical_language>

Target:
public void start() { synchronized (_lock) { if (_state != State.NOT_YET_STARTED) { throw new IllegalStateException(_poolName + " is " + _state); } _state = State.RUNNING; if (_idleTimeout > 0) { long freq = Math.min(_idleTimeout / 10, 1000); _objectTimeoutFuture = _timeoutExecutor.scheduleAtFixedRate(new Runnable() { @Override public void run() { timeoutObjects(); } }, freq, freq, TimeUnit.MILLISECONDS); } } for(int i = 0; i < _minSize; i++) { if(shouldCreate()) { create(); } } }
Source:
<code>public void onDeleteAccountsFromGroup(Account.Id me, Collection<AccountGroupMember> removed) { List<AccountGroupMemberAudit> auditInserts = Lists.newLinkedList(); List<AccountGroupMemberAudit> auditUpdates = Lists.newLinkedList(); ReviewDb reviewDB = db.get(); try { for (AccountGroupMember m : removed) { AccountGroupMemberAudit audit = null; for (AccountGroupMemberAudit a : reviewDB.accountGroupMembersAudit() .byGroupAccount(m.getAccountGroupId(), m.getAccountId())) { if (a.isActive()) { audit = a; break; } } if (audit != null) { audit.removed(me, TimeUtil.nowTs()); auditUpdates.add(audit); } else { audit = new AccountGroupMemberAudit(m, me, TimeUtil.nowTs()); audit.removedLegacy(); auditInserts.add(audit); } } reviewDB.accountGroupMembersAudit().update(auditUpdates); reviewDB.accountGroupMembersAudit().insert(auditInserts); } catch (OrmException e) { <START> String header = "Cannot log delete accounts from group event performed by user "; <END> logOrmExceptionForAccounts(me, removed, e, header); } }</code><technical_language>inline</technical_language>

Target:
public void onDeleteAccountsFromGroup(Account.Id me, Collection<AccountGroupMember> removed) { List<AccountGroupMemberAudit> auditInserts = Lists.newLinkedList(); List<AccountGroupMemberAudit> auditUpdates = Lists.newLinkedList(); ReviewDb reviewDB = db.get(); try { for (AccountGroupMember m : removed) { AccountGroupMemberAudit audit = null; for (AccountGroupMemberAudit a : reviewDB.accountGroupMembersAudit() .byGroupAccount(m.getAccountGroupId(), m.getAccountId())) { if (a.isActive()) { audit = a; break; } } if (audit != null) { audit.removed(me, TimeUtil.nowTs()); auditUpdates.add(audit); } else { audit = new AccountGroupMemberAudit(m, me, TimeUtil.nowTs()); audit.removedLegacy(); auditInserts.add(audit); } } reviewDB.accountGroupMembersAudit().update(auditUpdates); reviewDB.accountGroupMembersAudit().insert(auditInserts); } catch (OrmException e) { logOrmExceptionForAccounts( "Cannot log delete accounts from group event performed by user", me, removed, e); } }
Source:
<code>public void write(Collection<SinkRecord> records) { for (SinkRecord record: records) { String topic = record.topic(); int partition = record.kafkaPartition(); TopicPartition tp = new TopicPartition(topic, partition); topicPartitionWriters.get(tp).buffer(record); } if (hiveIntegration) { <START> Iterator<Future> iterator = futures.iterator(); <END> while (iterator.hasNext()) { try { Future future = iterator.next(); if (future.isDone()) { future.get(); iterator.remove(); } else { break; } } catch (ExecutionException e) { throw new RuntimeException(e); } catch (InterruptedException e) { } } } for (TopicPartition tp: assignment) { topicPartitionWriters.get(tp).write(); } }</code><technical_language>sense do this in a callback tied future (e.g. FutureCallback in Kafka Connect's utility library, implements a callback a future)? big a deal work is, basically polling write call event-driven removing future immediately completion. said, current approach is simpler avoids additional locking? I assume future is completed in executorService thread</technical_language>

Target:
public void write(Collection<SinkRecord> records) { for (SinkRecord record: records) { String topic = record.topic(); int partition = record.kafkaPartition(); TopicPartition tp = new TopicPartition(topic, partition); topicPartitionWriters.get(tp).buffer(record); } if (hiveIntegration) { Iterator<Future> iterator = hiveUpdateFutures.iterator(); while (iterator.hasNext()) { try { Future future = iterator.next(); if (future.isDone()) { future.get(); iterator.remove(); } else { break; } } catch (ExecutionException e) { throw new RuntimeException(e); } catch (InterruptedException e) { } } } for (TopicPartition tp: assignment) { topicPartitionWriters.get(tp).write(); } }
Source:
<code>public ErrorResponse(long id, ErrorType errorType, Throwable throwable) { <START> this.id = id; <END> this.errorType = errorType; this.message = throwable.getMessage(); this.type = FrameType.Error; this.throwable = throwable; }</code><technical_language>a private base constructor, call parameters</technical_language>

Target:
public ErrorResponse(long id, ErrorType errorType, Throwable throwable) { this(id, errorType, throwable.getMessage()); this.throwable = throwable; }
Source:
<code>public static SWTBotTreeItem appFactoryTree() { SWTBotView appList = Util.bot.viewByTitle(AppFactoryConstants.APPLICATIONS_LIST); try { <START> appList.bot().tree().getTreeItem("TestApplicationOne").select(); <END> appList.bot().tree().getTreeItem("TestApplicationOne").contextMenu("Open ").click(); while (!appList.bot().tree().getTreeItem("TestApplicationOne (Opened)").isVisible()) { Util.bot.sleep(1000); } } catch (WidgetNotFoundException | TimeoutException e) { try { appList.bot().tree().getTreeItem("TestApplicationOne (Opened)").isVisible(); } catch (WidgetNotFoundException | TimeoutException erro) { Util.log.error("Application list loading failiure"); fail(); } } SWTBotTreeItem opened = appList.bot().tree().getTreeItem("TestApplicationOne (Opened)"); return opened; }</code><technical_language>values Constants</technical_language>

Target:
public static SWTBotTreeItem appFactoryTree() { SWTBotView appList = WorkbenchElementsValidator.bot .viewByTitle(AppFactoryConstants.APPLICATIONS_LIST); try { appList.bot().tree() .getTreeItem(AppFactoryConstants.TEST_APPLICATION_ONE) .select(); appList.bot().tree() .getTreeItem(AppFactoryConstants.TEST_APPLICATION_ONE) .contextMenu(AppFactoryConstants.OPEN).click(); while (!appList .bot() .tree() .getTreeItem( AppFactoryConstants.TEST_APPLICATION_ONE_OPENED) .isVisible()) { WorkbenchElementsValidator.bot.sleep(1000); } } catch (WidgetNotFoundException | TimeoutException e) { try { appList.bot() .tree() .getTreeItem( AppFactoryConstants.TEST_APPLICATION_ONE_OPENED) .isVisible(); } catch (WidgetNotFoundException | TimeoutException erro) { WorkbenchElementsValidator.log.error( "Application list loading failiure", e); fail(); } } SWTBotTreeItem opened = appList.bot().tree() .getTreeItem(AppFactoryConstants.TEST_APPLICATION_ONE_OPENED); return opened; }
Source:
<code>public void testSingleDynamicFormTextInput() throws Exception { if (!endToEndTestEnabled()) { return; } try { createNewNote(); setTextOfParagraph(1, "%spark println(\"Hello \"+z.input(\"name\", \"world\")) "); runParagraph(1); waitForParagraph(1, "FINISHED"); collector.checkThat("Output text is equal to value specified initially", driver.findElement(By.xpath(getParagraphXPath(1) + " CoreMatchers.equalTo("Hello world")); driver.findElement(By.xpath(getParagraphXPath(1) + " driver.findElement(By.xpath(getParagraphXPath(1) + " <START> collector.checkThat("After new data in text input form, output should not change", <END> driver.findElement(By.xpath(getParagraphXPath(1) + " CoreMatchers.equalTo("Hello world")); runParagraph(1); waitForParagraph(1, "FINISHED"); collector.checkThat("Only after paragraph run we should see the new updated output", driver.findElement(By.xpath(getParagraphXPath(1) + " CoreMatchers.equalTo("Hello Zeppelin")); deleteTestNotebook(driver); } catch (Exception e) { handleException("Exception in ParagraphActionsIT while testSingleDynamicFormTextInput ", e); } }</code><technical_language>A minor grammar error is in description: output change -> output changed</technical_language>

Target:
public void testSingleDynamicFormTextInput() throws Exception { if (!endToEndTestEnabled()) { return; } try { createNewNote(); setTextOfParagraph(1, "%spark println(\"Hello \"+z.input(\"name\", \"world\")) "); runParagraph(1); waitForParagraph(1, "FINISHED"); collector.checkThat("Output text is equal to value specified initially", driver.findElement(By.xpath(getParagraphXPath(1) + " CoreMatchers.equalTo("Hello world")); driver.findElement(By.xpath(getParagraphXPath(1) + " driver.findElement(By.xpath(getParagraphXPath(1) + " collector.checkThat("After new data in text input form, output should not be changed", driver.findElement(By.xpath(getParagraphXPath(1) + " CoreMatchers.equalTo("Hello world")); runParagraph(1); waitForParagraph(1, "FINISHED"); collector.checkThat("Only after running the paragraph, we can see the newly updated output", driver.findElement(By.xpath(getParagraphXPath(1) + " CoreMatchers.equalTo("Hello Zeppelin")); deleteTestNotebook(driver); } catch (Exception e) { handleException("Exception in ParagraphActionsIT while testSingleDynamicFormTextInput ", e); } }
Source:
<code>public ArbitraryGranularitySpec( @JsonProperty("queryGranularity") QueryGranularity queryGranularity, @JsonProperty("intervals") List<Interval> inputIntervals ) { <START> this.queryGranularity = queryGranularity == null ? DEFAULT_QUERY_GRANULARITY : queryGranularity; <END> this.intervals = Sets.newTreeSet(Comparators.intervalsByStartThenEnd()); if (inputIntervals == null) { inputIntervals = Lists.newArrayList(); } for (final Interval inputInterval : inputIntervals) { intervals.add(inputInterval); } final PeekingIterator<Interval> intervalIterator = Iterators.peekingIterator(intervals.iterator()); while (intervalIterator.hasNext()) { final Interval currentInterval = intervalIterator.next(); if (intervalIterator.hasNext()) { final Interval nextInterval = intervalIterator.peek(); if (currentInterval.overlaps(nextInterval)) { throw new IllegalArgumentException( String.format( "Overlapping intervals: %s, %s", currentInterval, nextInterval ) ); } } } }</code><technical_language>is this change required</technical_language>

Target:
public ArbitraryGranularitySpec( @JsonProperty("queryGranularity") QueryGranularity queryGranularity, @JsonProperty("intervals") List<Interval> inputIntervals ) { this.queryGranularity = queryGranularity; this.intervals = Sets.newTreeSet(Comparators.intervalsByStartThenEnd()); if (inputIntervals == null) { inputIntervals = Lists.newArrayList(); } for (final Interval inputInterval : inputIntervals) { intervals.add(inputInterval); } final PeekingIterator<Interval> intervalIterator = Iterators.peekingIterator(intervals.iterator()); while (intervalIterator.hasNext()) { final Interval currentInterval = intervalIterator.next(); if (intervalIterator.hasNext()) { final Interval nextInterval = intervalIterator.peek(); if (currentInterval.overlaps(nextInterval)) { throw new IllegalArgumentException( String.format( "Overlapping intervals: %s, %s", currentInterval, nextInterval ) ); } } } }
Source:
<code>public void postCollectionDefaultBitstreamReadGroupCreateDefaultBitstreamReadGroupForbidden() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(eperson.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/bitstreamReadGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isForbidden()); <START> <END> }</code><technical_language>double check group created default anonymous permission</technical_language>

Target:
public void postCollectionDefaultBitstreamReadGroupCreateDefaultBitstreamReadGroupForbidden() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(eperson.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/bitstreamReadGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isForbidden()); token = getAuthToken(admin.getEmail(), password); Group anon = groupService.findByName(context, Group.ANONYMOUS); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/bitstreamReadGroup")) .andExpect(status().isOk()) .andExpect( jsonPath("$", GroupMatcher.matchGroupEntry(anon.getID(), anon.getName()))); }
Source:
<code>public RegionServerReportResponse replicationServerReport(RpcController controller, RegionServerReportRequest request) throws ServiceException { try { master.checkServiceStarted(); int versionNumber = 0; String version = "0.0.0"; VersionInfo versionInfo = VersionInfoUtil.getCurrentClientVersionInfo(); if (versionInfo != null) { version = versionInfo.getVersion(); versionNumber = VersionInfoUtil.getVersionNumber(versionInfo); } ClusterStatusProtos.ServerLoad sl = request.getLoad(); ServerName serverName = ProtobufUtil.toServerName(request.getServer()); <START> ServerMetrics oldLoad = master.getReplicationServerManager().getLoad(serverName); <END> ServerMetrics newLoad = ServerMetricsBuilder.toServerMetrics(serverName, versionNumber, version, sl); master.getReplicationServerManager().serverReport(serverName, newLoad); if (sl != null && master.metricsMaster != null) { master.metricsMaster.incrementRequests( sl.getTotalNumberOfRequests() - (oldLoad != null ? oldLoad.getRequestCount() : 0)); } } catch (IOException ioe) { throw new ServiceException(ioe); } return RegionServerReportResponse.newBuilder().build(); }</code><technical_language>oldLoad => oldMetrics getLoad => getServerMetrics</technical_language>

Target:
public RegionServerReportResponse replicationServerReport(RpcController controller, RegionServerReportRequest request) throws ServiceException { try { master.checkServiceStarted(); int versionNumber = 0; String version = "0.0.0"; VersionInfo versionInfo = VersionInfoUtil.getCurrentClientVersionInfo(); if (versionInfo != null) { version = versionInfo.getVersion(); versionNumber = VersionInfoUtil.getVersionNumber(versionInfo); } ClusterStatusProtos.ServerLoad sl = request.getLoad(); ServerName serverName = ProtobufUtil.toServerName(request.getServer()); ServerMetrics oldMetrics = master.getReplicationServerManager().getServerMetrics(serverName); ServerMetrics newMetrics = ServerMetricsBuilder.toServerMetrics(serverName, versionNumber, version, sl); master.getReplicationServerManager().serverReport(serverName, newMetrics); if (sl != null && master.metricsMaster != null) { master.metricsMaster.incrementRequests(sl.getTotalNumberOfRequests() - (oldMetrics != null ? oldMetrics.getRequestCount() : 0)); } } catch (IOException ioe) { throw new ServiceException(ioe); } return RegionServerReportResponse.newBuilder().build(); }
Source:
<code>@Override public FormPage open() { <START> return null; <END> }</code><technical_language>null? a supported method</technical_language>

Target:
@Override public FormPage open() { driver.get(urlBuilder.getUrlForWiki() + URLsContent.USER_FORGOT_PASSWORD); return this; }
Source:
<code>public void retriesOnExceptionTillSuccess() throws Exception { <START> final int count = 3; <END> final int delay = 1000; final String data = "data"; final Take take = Mockito.mock(Take.class); Mockito.when(take.act(Mockito.any(Request.class))).thenThrow( new IOException() ).thenReturn(new RsText(data)); final long startTime = System.currentTimeMillis(); final RsPrint response = new RsPrint( new TkRetry(count, delay, take).act(new RqFake(RqMethod.GET)) ); MatcherAssert.assertThat( new Long(delay), Matchers.lessThanOrEqualTo(System.currentTimeMillis() - startTime) ); MatcherAssert.assertThat( response.print(), Matchers.containsString(data) ); }</code><technical_language>@HDouss Tv.THREE</technical_language>

Target:
public void retriesOnExceptionTillSuccess() throws Exception { final int count = Tv.THREE; final int delay = Tv.THOUSAND; final String data = "data"; final Take take = Mockito.mock(Take.class); Mockito .when(take.act(Mockito.any(Request.class))) .thenThrow(new IOException()) .thenReturn(new RsText(data)); final long startTime = System.nanoTime(); final RsPrint response = new RsPrint( new TkRetry(count, delay, take).act(new RqFake(RqMethod.GET)) ); final long spent = System.nanoTime() - startTime; MatcherAssert.assertThat( new Long(delay - Tv.HUNDRED) * Tv.MILLION, Matchers.lessThanOrEqualTo(spent) ); MatcherAssert.assertThat( response.print(), Matchers.containsString(data) ); }
Source:
<code>private Field findHostField(final Structure structure) { <START> final List<Field> fields = FieldsCache.getFieldsByStructureInode(structure.getInode()); <END> for (final Field field : fields) { if (field.getFieldType() .equals(Field.FieldType.HOST_OR_FOLDER.toString())) { return field; } } return null; }</code><technical_language>return fields.stream().filter(field -> field.getFieldType() .equals(Field.FieldType.HOST_OR_FOLDER.toString()).findFirst().orElse(null);</technical_language>

Target:
private Field findHostField(final Structure structure) { return FieldsCache.getFieldsByStructureInode(structure.getInode()).stream() .filter(field -> field.getFieldType().equals(Field.FieldType.HOST_OR_FOLDER.toString())) .findFirst() .orElse(null); }
Source:
<code>private Collection<BigdataURI> prepareCheckTempStore( AbstractTripleStore database, BigdataValue normalized, BigdataValue entityTimestamp ) throws IOException, <START> RDFParseException, RDFHandlerException { <END> final Collection<BigdataURI> toInsertEntities = new HashSet<>(); BigdataValueFactory vf = database.getValueFactory(); if (entityIds != null) { List<BigdataValue> termsToResolve = new ArrayList<>(); try (InputStream is = this.entityIds.getInputStream(); InputStreamReader isr = new InputStreamReader(decompressStream(is), StandardCharsets.UTF_8); BufferedReader r = new BufferedReader(isr)) { String entityId; while ((entityId = r.readLine()) != null) { toInsertEntities.add(vf.asValue(new URIImpl(uris.entityIdToURI(entityId)))); } } termsToResolve.add(entityTimestamp); termsToResolve.add(normalized); long termsAdded = database.getLexiconRelation().addTerms(termsToResolve.toArray( new BigdataValue[0]), termsToResolve.size(), true); Map<BigdataValue, IV> resolvedTerms = new HashMap<>(); for (BigdataValue term: termsToResolve) { if (term.getIV() != null) { resolvedTerms.put(term, term.getIV()); EntityDataUtil.assignValue(term.getIV(), term); } } int assigned = 0; for (BigdataValue term: termsToResolve) { if (term.getIV() == null) { term.setIV(resolvedTerms.get(term)); assigned++; } } log.debug("Terms added resolved {}, assigned {}", termsAdded, resolvedTerms.size(), assigned); } return toInsertEntities; }</code><technical_language>exceptions thrown</technical_language>

Target:
private Collection<BigdataURI> prepareCheckTempStore( AbstractTripleStore database, BigdataValue normalized, BigdataValue entityTimestamp ) throws IOException { final Collection<BigdataURI> toInsertEntities = new HashSet<>(); BigdataValueFactory vf = database.getValueFactory(); if (entityIds != null) { List<BigdataValue> termsToResolve = new ArrayList<>(); try (InputStream is = this.entityIds.getInputStream(); InputStreamReader isr = new InputStreamReader(decompressStream(is), StandardCharsets.UTF_8); BufferedReader r = new BufferedReader(isr)) { String entityId; while ((entityId = r.readLine()) != null) { toInsertEntities.add(vf.asValue(new URIImpl(uris.entityIdToURI(entityId)))); } } termsToResolve.add(entityTimestamp); termsToResolve.add(normalized); long termsAdded = database.getLexiconRelation().addTerms(termsToResolve.toArray( new BigdataValue[0]), termsToResolve.size(), true); Map<BigdataValue, IV> resolvedTerms = new HashMap<>(); for (BigdataValue term: termsToResolve) { if (term.getIV() != null) { resolvedTerms.put(term, term.getIV()); EntityDataUtil.assignValue(term.getIV(), term); } } int assigned = 0; for (BigdataValue term: termsToResolve) { if (term.getIV() == null) { term.setIV(resolvedTerms.get(term)); assigned++; } } log.debug("Terms added resolved {}, assigned {}", termsAdded, resolvedTerms.size(), assigned); } return toInsertEntities; }
Source:
<code>protected <E extends SQLEntity> void extendBatchQuery(SmartQuery<E> query) { if (!Traced.class.isAssignableFrom(query.getDescriptor().getType())) { <START> throw new IllegalArgumentException("Entitis for which 'ChangeChecks' are created must implement 'Traced'."); <END> } query.where(OMA.FILTERS.gt(Traced.TRACE.inner(TraceData.CHANGED_AT), LocalDateTime.now().minusDays(1))); }</code><technical_language>suggestion throw new IllegalArgumentException("Entities for 'ChangeChecks' created implement 'Traced'.");</technical_language>

Target:
protected <E extends SQLEntity> void extendBatchQuery(SmartQuery<E> query) { if (!Traced.class.isAssignableFrom(query.getDescriptor().getType())) { throw new IllegalArgumentException("Entities for which 'ChangeChecks' are created must implement 'Traced'."); } query.where(OMA.FILTERS.gt(Traced.TRACE.inner(TraceData.CHANGED_AT), LocalDateTime.now().minusDays(1))); }
Source:
<code>public String[] extractPartitions(Message message) { JSONObject jsonObject = (JSONObject) JSONValue.parse(message.getPayload()); String result[] = { defaultDate }; if (jsonObject != null) { String messageTimestampName = mConfig.getMessageTimestampName(); String messageTimestampSeparator = mConfig.getMessageTimestampNameSeparator(); Object fieldValue = null; if (messageTimestampSeparator != null) { <START> String[] fields = messageTimestampName.split(messageTimestampSeparator); <END> Object finalValue = null; for (int i=0; i < fields.length; i++) { if (!jsonObject.containsKey(fields[i])) { break; } if (i < (fields.length -1)) { jsonObject = (JSONObject) jsonObject.get(fields[i]); } else { finalValue = jsonObject.get(fields[i]); } } fieldValue = finalValue; } else { fieldValue = jsonObject.get(messageTimestampName); } Object inputPattern = mConfig.getMessageTimestampInputPattern(); if (fieldValue != null && inputPattern != null) { try { SimpleDateFormat inputFormatter = new SimpleDateFormat(inputPattern.toString()); SimpleDateFormat outputFormatter = new SimpleDateFormat(defaultFormatter); Date dateFormat = inputFormatter.parse(fieldValue.toString()); result[0] = "dt=" + outputFormatter.format(dateFormat); return result; } catch (Exception e) { LOG.warn("Impossible to convert date = for the input pattern = . Using date default = {}", fieldValue.toString(), inputPattern.toString(), result[0]); } } } return result; }</code><technical_language>space for indentation (not tabs in here)</technical_language>

Target:
public String[] extractPartitions(Message message) { JSONObject jsonObject = (JSONObject) JSONValue.parse(message.getPayload()); String result[] = { defaultDate }; if (jsonObject != null) { Object fieldValue = getJsonFieldValue(jsonObject); Object inputPattern = mConfig.getMessageTimestampInputPattern(); if (fieldValue != null && inputPattern != null) { try { SimpleDateFormat inputFormatter = new SimpleDateFormat(inputPattern.toString()); SimpleDateFormat outputFormatter = new SimpleDateFormat(defaultFormatter); Date dateFormat = inputFormatter.parse(fieldValue.toString()); result[0] = "dt=" + outputFormatter.format(dateFormat); return result; } catch (Exception e) { LOG.warn("Impossible to convert date = for the input pattern = . Using date default = {}", fieldValue.toString(), inputPattern.toString(), result[0]); } } } return result; }
Source:
<code>private void checkTimeout() throws TimeoutException { String message = getReturnStatus().message; if <START> ("Internal timeout occured".equals(message)) <END> { throw new TimeoutException(message); } }</code><technical_language>a string stored a constant defined side returns this message prevent breaking this assumption - doable</technical_language>

Target:
private void checkTimeout() throws TimeoutException { String message = getReturnStatus().message; if (TIMEOUT_MESSAGE.equals(message)) { throw new TimeoutException(message); } }
Source:
<code>public String getTimeZoneId() { <START> return "Europe/Paris"; <END> }</code><technical_language>This needs modifiable. Please create a ticket for this. start in NL, "Europe/Amsterdam" initial fixed value</technical_language>

Target:
public String getTimeZoneId() { return "Europe/Amsterdam"; }
Source:
<code>public void checkWontEquivalateToBrands() { Item item = new Item(); item.setPublisher(Publisher.ARQIVA); item.setCanonicalUri("target"); <START> Brand candidate1 = brandWithBroadcast("2500", "6500"); <END> candidate1.setPublisher(Publisher.PA); candidate1.setCanonicalUri("candidate1"); Item candidate2 = itemWithBroadcast("4500", "5500"); candidate2.setPublisher(Publisher.PA); candidate2.setCanonicalUri("candidate2"); List<ScoredCandidates<Identified>> equivalents = ImmutableList.of( DefaultScoredCandidates.<Identified>fromSource("A Source") .addEquivalent(candidate1, Score.valueOf(5.0)) .addEquivalent(candidate2, Score.valueOf(4.8)) .build() ); EquivalenceResult equivalenceResult = resultBuilder.resultFor( item, equivalents, new DefaultDescription() ); assertTrue(equivalenceResult.strongEquivalences().values().size() == 1); }</code><technical_language>broadcast times candidates fail match if code checks if brands is working. broadcasts identical checking brand aspect of it</technical_language>

Target:
public void checkWontEquivalateToBrands() { Item item = new Item(); item.setPublisher(Publisher.ARQIVA); item.setCanonicalUri("target"); Brand candidate1 = brandWithBroadcast( new DateTime().withHourOfDay(2), new DateTime().withHourOfDay(6) ); candidate1.setPublisher(Publisher.PA); candidate1.setCanonicalUri("candidate1"); Item candidate2 = itemWithBroadcast( new DateTime().withHourOfDay(4), new DateTime().withHourOfDay(5) ); candidate2.setPublisher(Publisher.PA); candidate2.setCanonicalUri("candidate2"); List<ScoredCandidates<Identified>> equivalents = ImmutableList.of( DefaultScoredCandidates.<Identified>fromSource("A Source") .addEquivalent(candidate1, Score.valueOf(5.0)) .addEquivalent(candidate2, Score.valueOf(4.8)) .build() ); EquivalenceResult equivalenceResult = resultBuilder.resultFor( item, equivalents, new DefaultDescription() ); assertTrue(equivalenceResult.strongEquivalences().values().size() == 1); }