auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void loadListeners(ServiceLoader<LifecycleListener> loader) { Iterator<LifecycleListener> iterator = loader.iterator(); <START> while (checkHasNextSafely(iterator)) { <END> try { LifecycleListener listener = iterator.next(); listeners.add(listener); } catch (ServiceConfigurationError e) { logger.error("iterator.next() failed", e); } } }</code><technical_language>word "check" is overkill</technical_language>

Target:
protected void loadListeners(ServiceLoader<LifecycleListener> loader) { Iterator<LifecycleListener> iterator = loader.iterator(); while (hasNextSafely(iterator)) { try { LifecycleListener listener = iterator.next(); listeners.add(listener); logger.info(String.format("Found %s: %s", LifecycleListener.class, listener.getClass())); } catch (ServiceConfigurationError e) { logger.error("iterator.next() failed", e); } } }
Source:
<code>protected Transaction startTransaction() { ImmutableMap<TableReference, ConflictHandler> tablesToWriteWrite = ImmutableMap.of( TEST_TABLE, ConflictHandler.SERIALIZABLE, TransactionConstants.TRANSACTION_TABLE, ConflictHandler.IGNORE_ALL); return new SerializableTransaction( MetricsManagers.createForTests(), keyValueService, new LegacyTimelockService(timestampService, lockService, lockClient), transactionService, NoOpCleaner.INSTANCE, Suppliers.ofInstance(timestampService.getFreshTimestamp()), TestConflictDetectionManagers.createWithStaticConflictDetection(tablesToWriteWrite), SweepStrategyManagers.createDefault(keyValueService), 0L, Optional.empty(), PreCommitConditions.NO_OP, AtlasDbConstraintCheckingMode.NO_CONSTRAINT_CHECKING, null, TransactionReadSentinelBehavior.THROW_EXCEPTION, true, timestampCache, AtlasDbConstants.DEFAULT_TRANSACTION_LOCK_ACQUIRE_TIMEOUT_MS, AbstractTransactionTest.GET_RANGES_EXECUTOR, AbstractTransactionTest.DEFAULT_GET_RANGES_CONCURRENCY, getSweepQueueWriterInitialized(), MoreExecutors.newDirectExecutorService(), <START> () -> false) { <END> @Override protected Map<Cell, byte[]> transformGetsForTesting(Map<Cell, byte[]> map) { return Maps.transformValues(map, input -> input.clone()); } }; }</code><technical_language>passing () -> false in, pass in CommitLogProcessor.neverProfile()</technical_language>

Target:
protected Transaction startTransaction() { ImmutableMap<TableReference, ConflictHandler> tablesToWriteWrite = ImmutableMap.of( TEST_TABLE, ConflictHandler.SERIALIZABLE, TransactionConstants.TRANSACTION_TABLE, ConflictHandler.IGNORE_ALL); return new SerializableTransaction( MetricsManagers.createForTests(), keyValueService, new LegacyTimelockService(timestampService, lockService, lockClient), transactionService, NoOpCleaner.INSTANCE, Suppliers.ofInstance(timestampService.getFreshTimestamp()), TestConflictDetectionManagers.createWithStaticConflictDetection(tablesToWriteWrite), SweepStrategyManagers.createDefault(keyValueService), 0L, Optional.empty(), PreCommitConditions.NO_OP, AtlasDbConstraintCheckingMode.NO_CONSTRAINT_CHECKING, null, TransactionReadSentinelBehavior.THROW_EXCEPTION, true, timestampCache, AtlasDbConstants.DEFAULT_TRANSACTION_LOCK_ACQUIRE_TIMEOUT_MS, AbstractTransactionTest.GET_RANGES_EXECUTOR, AbstractTransactionTest.DEFAULT_GET_RANGES_CONCURRENCY, getSweepQueueWriterInitialized(), MoreExecutors.newDirectExecutorService(), CommitProfileProcessor.createNonLogging(metricsManager)) { @Override protected Map<Cell, byte[]> transformGetsForTesting(Map<Cell, byte[]> map) { return Maps.transformValues(map, input -> input.clone()); } }; }
Source:
<code>protected void createMainControl(Composite parent, IEEFFormContainer formContainer) { EEFWidgetFactory widgetFactory = formContainer.getWidgetFactory(); this.comboViewer = new ComboViewer(parent, SWT.READ_ONLY); this.combo = comboViewer.getCombo(); this.comboViewer.setContentProvider(ArrayContentProvider.getInstance()); this.comboViewer.setLabelProvider(new EEFSelectLabelProvider()); this.comboViewer.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); widgetFactory.paintBordersFor(parent); FormData comboFormData = new FormData(); comboFormData.left = new FormAttachment(0, LABEL_WIDTH); comboFormData.right = new FormAttachment(100, 0); this.combo.setLayoutData(comboFormData); <START> if (!isEnabled()) { this.combo.setEnabled(false); } <END> this.controller = new EEFControllersFactory().createSelectController(this.description, this.variableManager, this.interpreter, this.editingDomain); }</code><technical_language>this need done in refresh instead of creation of controls</technical_language>

Target:
protected void createMainControl(Composite parent, IEEFFormContainer formContainer) { EEFWidgetFactory widgetFactory = formContainer.getWidgetFactory(); this.comboViewer = new ComboViewer(parent, SWT.READ_ONLY); this.combo = comboViewer.getCombo(); this.comboViewer.setContentProvider(ArrayContentProvider.getInstance()); this.comboViewer.setLabelProvider(new EEFSelectLabelProvider()); this.comboViewer.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); widgetFactory.paintBordersFor(parent); FormData comboFormData = new FormData(); comboFormData.left = new FormAttachment(0, LABEL_WIDTH); comboFormData.right = new FormAttachment(100, 0); this.combo.setLayoutData(comboFormData); this.controller = new EEFControllersFactory().createSelectController(this.description, this.variableManager, this.interpreter, this.editingDomain); }
Source:
<code>protected Segment resolvePrevious(@Nullable Id id, Publisher source, Set<Alias> aliases) { Segment previous = null; if (id != null) { previous = Iterables.getOnlyElement(resolveSegments(ImmutableList.of(id)), null); if (previous != null) { return previous; } } <START> try { <END> Set<Long> aliasIds = aliasIndex.readAliases(source, aliases); Long aliasId = Iterables.getFirst(aliasIds, null); if (aliasId != null) { return Iterables.getOnlyElement(resolveSegments(ImmutableList.of(Id.valueOf(aliasId))), null); } } catch (ConnectionException e) { throw Throwables.propagate(e); } return null; }</code><technical_language>this bit extracted in a method</technical_language>

Target:
protected Optional<Segment> resolvePrevious(@Nullable Id id, Publisher source, Set<Alias> aliases) { Segment previous = null; if (id != null) { previous = Iterables.getOnlyElement(resolveSegments(ImmutableList.of(id)), null); if (previous != null) { return Optional.of(previous); } } return Optional.fromNullable(resolveByAlias(source, aliases)); }
Source:
<code>public void onClick(View v) { <START> if (v.getId() == R.id.sign_in_button) { <END> onSignInClicked(); } }</code><technical_language>check for id equality if listener is defined sign_in_button</technical_language>

Target:
public void onClick(View v) { onSignInClicked(); }
Source:
<code>public static Block createMap(MapType mapType, MethodHandle keyEqual, MethodHandle keyHashCode, State state, Block keyBlock, Block valueBlock) { checkCondition(keyBlock.getPositionCount() == valueBlock.getPositionCount(), INVALID_FUNCTION_ARGUMENT, "Key and value arrays must be the same length"); PageBuilder pageBuilder = state.getPageBuilder(); if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder mapBlockBuilder = pageBuilder.getBlockBuilder(0); BlockBuilder blockBuilder = mapBlockBuilder.beginBlockEntry(); for (int i = 0; i < keyBlock.getPositionCount(); i++) { if (keyBlock.isNull(i)) { <START> pageBuilder.resetBlockBuilder(0); <END> throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "map key cannot be null"); } mapType.getKeyType().appendTo(keyBlock, i, blockBuilder); mapType.getValueType().appendTo(valueBlock, i, blockBuilder); } mapBlockBuilder.closeEntry(); pageBuilder.declarePosition(); return mapType.getObject(mapBlockBuilder, mapBlockBuilder.getPositionCount() - 1); }</code><technical_language>calling closeEntry instead? work out</technical_language>

Target:
public static Block createMap(MapType mapType, MethodHandle keyEqual, MethodHandle keyHashCode, State state, Block keyBlock, Block valueBlock) { checkCondition(keyBlock.getPositionCount() == valueBlock.getPositionCount(), INVALID_FUNCTION_ARGUMENT, "Key and value arrays must be the same length"); PageBuilder pageBuilder = state.getPageBuilder(); if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder mapBlockBuilder = pageBuilder.getBlockBuilder(0); BlockBuilder blockBuilder = mapBlockBuilder.beginBlockEntry(); for (int i = 0; i < keyBlock.getPositionCount(); i++) { if (keyBlock.isNull(i)) { mapBlockBuilder.closeEntry(); throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "map key cannot be null"); } mapType.getKeyType().appendTo(keyBlock, i, blockBuilder); mapType.getValueType().appendTo(valueBlock, i, blockBuilder); } mapBlockBuilder.closeEntry(); pageBuilder.declarePosition(); return mapType.getObject(mapBlockBuilder, mapBlockBuilder.getPositionCount() - 1); }
Source:
<code>public String getEventDescription() { List<User> users = _accountService.getAccountUsers(_accountService.getAccount(getId())); <START> User user = users.isEmpty() ? null : users.get(0); <END> return (user != null ? ("deleting User " + user.getUsername() + " (id: " + user.getId() + ") and accountId = " + user.getAccountId()) : "user delete, but this user does not exist in the system"); }</code><technical_language>event description is wrong, account is deleted mention users simply removing users account</technical_language>

Target:
public String getEventDescription() { Account account = _accountService.getAccount(getId()); return (account != null ? "Deleting user account " + account.getAccountName() + " (ID: " + account.getUuid() + ") and all corresponding users" : "Account delete, but this account does not exist in the system"); }
Source:
<code>public void scanFile(JavaFileScannerContext context) { this.context = context; scan(context.getTree()); shifts.clear(); <START> byteSecuring.clear(); <END> }</code><technical_language>byteContainments? Especially "s" is missing</technical_language>

Target:
public void scanFile(JavaFileScannerContext context) { this.context = context; scan(context.getTree()); shifts.clear(); byteContainments.clear(); }
Source:
<code>private void waitIfRequired(ReplicaMetadataResponseInfo replicaMetadataResponseInfo, DataNodeId remoteNode, RemoteReplicaInfo remoteReplicaInfo) throws InterruptedException { long remoteReplicaLag = replicaMetadataResponseInfo.getRemoteReplicaLagInBytes(); long startTime = SystemTime.getInstance().milliseconds(); if (!replicatingFromRemoteColo) { <START> needToWaitForReplicaLag = false; <END> } if (remoteReplicaLag < replicationConfig.replicationMaxLagForWaitTimeInBytes && needToWaitForReplicaLag) { logger.trace("Remote node: Thread name: Remote replica: Remote replica lag: " + "ReplicationMaxLagForWaitTimeInBytes: Waiting for ms", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), replicaMetadataResponseInfo.getRemoteReplicaLagInBytes(), replicationConfig.replicationMaxLagForWaitTimeInBytes, replicationConfig.replicaWaitTimeBetweenReplicasMs); Thread.sleep(replicationConfig.replicaWaitTimeBetweenReplicasMs); needToWaitForReplicaLag = false; } if (replicatingFromRemoteColo) { replicationMetrics.interColoReplicationWaitTime.get(datacenterName) .update(SystemTime.getInstance().milliseconds() - startTime); } else { replicationMetrics.intraColoReplicationWaitTime.update(SystemTime.getInstance().milliseconds() - startTime); } }</code><technical_language>I this more intuitive if name this variable waitEnabled something, do this method is called: java boolean waitEnabled = !remoteColo; for (...) { ... if (waitEnabled) { waitIfRequired(); } }</technical_language>

Target:
private void waitIfRequired(ReplicaMetadataResponseInfo replicaMetadataResponseInfo, DataNodeId remoteNode, RemoteReplicaInfo remoteReplicaInfo) throws InterruptedException { long remoteReplicaLag = replicaMetadataResponseInfo.getRemoteReplicaLagInBytes(); long startTime = SystemTime.getInstance().milliseconds(); if (remoteReplicaLag < replicationConfig.replicationMaxLagForWaitTimeInBytes) { logger.trace("Remote node: Thread name: Remote replica: Remote replica lag: " + "ReplicationMaxLagForWaitTimeInBytes: Waiting for ms", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), replicaMetadataResponseInfo.getRemoteReplicaLagInBytes(), replicationConfig.replicationMaxLagForWaitTimeInBytes, replicationConfig.replicaWaitTimeBetweenReplicasMs); Thread.sleep(replicationConfig.replicaWaitTimeBetweenReplicasMs); waitEnabled = false; } replicationMetrics.intraColoReplicationWaitTime.update(SystemTime.getInstance().milliseconds() - startTime); }
Source:
<code>public Optional<FieldSortExpectations<ZonedDateTime>> getFieldSortExpectations() { return Optional.of( new FieldSortExpectations<>( <START> LocalDateTime.of( 2018, 2, 1, 0, 0 ).atZone( ZoneId.of( "America/Chicago" ) ), <END> LocalDateTime.of( 2018, 3, 1, 0, 0 ).atZone( ZoneId.of( "America/Chicago" ) ), LocalDateTime.of( 2018, 4, 1, 0, 0 ).atZone( ZoneId.of( "America/Chicago" ) ), LocalDateTime.of( 2018, 1, 1, 0, 0 ).atZone( ZoneId.of( "America/Chicago" ) ), LocalDateTime.of( 2018, 2, 15, 0, 0 ).atZone( ZoneId.of( "America/Chicago" ) ), LocalDateTime.of( 2018, 3, 15, 0, 0 ).atZone( ZoneId.of( "America/Chicago" ) ), LocalDateTime.of( 2018, 5, 1, 0, 0 ).atZone( ZoneId.of( "America/Chicago" ) ) ) ); }</code><technical_language>above, I mix timezones</technical_language>

Target:
public Optional<FieldSortExpectations<ZonedDateTime>> getFieldSortExpectations() { return Optional.of( new FieldSortExpectations<>( LocalDateTime.of( 2018, 2, 1, 0, 0 ).atZone( ZoneId.of( "America/Chicago" ) ), LocalDateTime.of( 2018, 3, 1, 0, 0 ).atZone( ZoneId.of( "America/Chicago" ) ), LocalDateTime.of( 2018, 4, 1, 0, 0 ).atZone( ZoneId.of( "America/Chicago" ) ), LocalDateTime.of( 2018, 1, 1, 0, 0 ).atZone( ZoneId.of( "America/Chicago" ) ), LocalDateTime.of( 2018, 2, 15, 0, 0 ).atZone( ZoneId.of( "America/Chicago" ) ), LocalDateTime.of( 2018, 3, 1, 0, 0 ).atZone( ZoneId.of( "US/Alaska" ) ), LocalDateTime.of( 2018, 5, 1, 0, 0 ).atZone( ZoneId.of( "America/Chicago" ) ) ) ); }
Source:
<code>public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { log.info("Starting coordination. Getting available segments."); final TreeSet<DataSegment> availableSegments = DruidCoordinatorRuntimeParams.createAvailableSegmentsSet(); for (DataSegment segment : coordinator.iterateAvailableDataSegments()) { if (segment.getSize() < 0) { <START> log.makeAlert("No size on a segment") <END> .addData("segment", segment) .emit(); } availableSegments.add(segment); } if (log.isDebugEnabled()) { log.debug("Available DataSegments"); for (DataSegment dataSegment : availableSegments) { log.debug(" %s", dataSegment); } } log.info("Found [%,d] available segments.", availableSegments.size()); return params.buildFromExisting() .setAvailableSegments(availableSegments) .build(); }</code><technical_language>I this introduced here, is useful? This check initial OSS commit, in form attempted do if size 0. this happen, do other alert if happen, qualify alert? main reason I ask is 3 places calling DruidCoordinatorRuntimeParams.createAvailableSegmentsSet() immediately fill afterwards, Iterable<DataSegment> instead produce populated TreeSet if need this alert</technical_language>

Target:
public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { log.info("Starting coordination. Getting available segments."); Iterable<DataSegment> availableSegmentsWithSizeChecking = Iterables.transform( coordinator.iterateAvailableDataSegments(), segment -> { if (segment.getSize() < 0) { log.makeAlert("No size on a segment") .addData("segment", segment) .emit(); } return segment; } ); final TreeSet<DataSegment> availableSegments = DruidCoordinatorRuntimeParams.createAvailableSegmentsSet(availableSegmentsWithSizeChecking); if (log.isDebugEnabled()) { log.debug("Available DataSegments"); for (DataSegment dataSegment : availableSegments) { log.debug(" %s", dataSegment); } } log.info("Found [%,d] available segments.", availableSegments.size()); return params.buildFromExisting() .setAvailableSegments(availableSegments) .build(); }
Source:
<code>public boolean isInputElementValid(WebElement inputElement) { <START> Preconditions.checkArgument(inputElement.getAttribute("nodeName").equals("INPUT")); <END> return (boolean) executeScript("return arguments[0].checkValidity();", inputElement); }</code><technical_language>I a static import for common preconditions checks reasonable I believe</technical_language>

Target:
public boolean isInputElementValid(WebElement inputElement) { checkArgument(inputElement.getAttribute("nodeName").equals("INPUT")); return (boolean) executeScript("return arguments[0].willValidate && arguments[0].checkValidity();", inputElement); }
Source:
<code>protected Constraint roomPenalty(ConstraintFactory constraintFactory) { return constraintFactory.from(Exam.class) <START> .ifExists(Room.class, equal(Exam::getRoom, Function.identity()), filtering((exam, room) -> room.getPenalty() != 0)) <END> .penalize("Room penalty", HardSoftScore.ONE_SOFT, exam -> exam.getRoom().getPenalty()); }</code><technical_language>Ditto. appears a Room reference Exam directly</technical_language>

Target:
protected Constraint roomPenalty(ConstraintFactory constraintFactory) { return constraintFactory.from(Exam.class) .filter(exam -> exam.getRoom().getPenalty() != 0) .penalizeConfigurable("roomPenalty", exam -> exam.getRoom().getPenalty()); }
Source:
<code><START> public IosRSAKey() { <END> }</code><technical_language>Please remove "public" (our mistake, other constructors in this class package-private, too)</technical_language>

Target:
private IosRSAKey() { }
Source:
<code>public void shouldThrowExceptionWhenNoKeysInUsersPreferences() throws Exception { sshKeyStore = spy(new UserProfileSshKeyStore(API_ENDPOINT)); doReturn(null).when(sshKeyStore).getSshKeys(); <START> thrown.expect(SshKeyStoreException.class); <END> thrown.expectMessage(new StringContains("Impossible get keys")); sshKeyStore.getAll(); }</code><technical_language>I separate _expectation_ section _given_ _action_ sections, this test case is obvious</technical_language>

Target:
public void shouldThrowExceptionWhenNoKeysInUsersPreferences() throws Exception { sshKeyStore = spy(new UserProfileSshKeyStore(API_ENDPOINT)); doThrow(IOException.class).when(sshKeyStore).getSshKeys(); thrown.expect(SshKeyStoreException.class); thrown.expectMessage(new StringContains("Failed to get keys ")); sshKeyStore.getAll(); }
Source:
<code>public HueBridgeNupnpDiscovery() { <START> super(SUPPORTED_THING_TYPES, DISCOVERY_TIMEOUT); <END> }</code><technical_language>call super false a parameter</technical_language>

Target:
public HueBridgeNupnpDiscovery() { super(SUPPORTED_THING_TYPES, DISCOVERY_TIMEOUT, false); }
Source:
<code>public void executesUploadCmd() throws Exception { final File dir = Files.createTempDir(); FileUtils.write(new File(dir, "s3cmd"), "echo $@"); final S3CmdPut cmd = new S3CmdPut( "a1", "./*", "bkt1", "", "AAAAAAAAAAAAAAAAAAAA", "30KFuodpOPX07QIaO4+QoLdTR5/MW/FN5qUDqxs=" ); cmd.exec( <START> new Provisioned.ProvisionedShell( <END> "PATH=.:$PATH && chmod +x s3cmd", new ShellMocker.Bash(dir) ) ); }</code><technical_language>This is wrong design, touch classes ever. Instead, new Provisioned(..).acquire()</technical_language>

Target:
public void executesUploadCmd() throws Exception { final File dir = Files.createTempDir(); FileUtils.write(new File(dir, "s3cmd"), "echo $@"); final S3CmdPut cmd = new S3CmdPut( "a1", "./*", "bkt1", "", "AAAAAAAAAAAAAAAAAAAA", "30KFuodpOPX07QIaO4+QoLdTR5/MW/FN5qUDqxs=" ); final Shells shells = Mockito.mock(Shells.class); Mockito.when(shells.acquire()).thenReturn(new ShellMocker.Bash(dir)); cmd.exec( new Provisioned("PATH=.:$PATH && chmod +x s3cmd", shells).acquire() ); }
Source:
<code>private boolean isNotNull(int index) { if (idForNull == UNKNOWN) { String value = selector.lookupName(index); if (value == null) { idForNull = index; return false; <START> } <END> } return index != idForNull; }</code><technical_language>I clearer add else { return true; }</technical_language>

Target:
private boolean isNotNull(int index) { if (idForNull == UNKNOWN) { String value = selector.lookupName(index); if (value == null) { idForNull = index; return false; } else { return true; } } return index != idForNull; }
Source:
<code>public boolean matches(final Object o) { if (!super.matches(o)) { return false; } final InvoiceItemCatalogBase that = (InvoiceItemCatalogBase) o; <START> if (catalogEffectiveDate != null && that.catalogEffectiveDate != null ? catalogEffectiveDate.compareTo(that.catalogEffectiveDate) != 0 : that.catalogEffectiveDate != null) { <END> return false; } if (phaseName != null ? !phaseName.equals(that.phaseName) : that.phaseName != null) { return false; } if (planName != null ? !planName.equals(that.planName) : that.planName != null) { return false; } return true; }</code><technical_language>this is correct: * catalogEffectiveDate = now() * that.catalogEffectiveDate = null * => catalogEffectiveDate != null && that.catalogEffectiveDate is false that.catalogEffectiveDate != null if false * => if is false equal</technical_language>

Target:
public boolean matches(final Object o) { if (!super.matches(o)) { return false; } final InvoiceItemCatalogBase that = (InvoiceItemCatalogBase) o; if (catalogEffectiveDate != null && that.catalogEffectiveDate != null && catalogEffectiveDate.compareTo(that.catalogEffectiveDate) != 0) { return false; } else if ((catalogEffectiveDate != null && that.catalogEffectiveDate == null) || (catalogEffectiveDate == null && that.catalogEffectiveDate != null)) { return false; } if (phaseName != null ? !phaseName.equals(that.phaseName) : that.phaseName != null) { return false; } if (planName != null ? !planName.equals(that.planName) : that.planName != null) { return false; } return true; }
Source:
<code>private void processTagsToResource( final Map<String, String> tags, final Map<String, String> resource ) { if (tagsToResource.isEmpty()) { return; } <START> tagsToResource.forEach((fromTag, asResource) -> { <END> if (tags.containsKey(fromTag) && !resource.containsKey(asResource)) { resource.put(asResource, tags.get(fromTag)); } tags.remove(fromTag); }); }</code><technical_language>This simpler fact remove returns null if mapping exist, putIfAbsent disposal. java final String tag = tags.remove(fromTag); if (tag != null) { resource.putIfAbsent(toResource, tag); }</technical_language>

Target:
private void processTagsToResource( final Map<String, String> tags, final Map<String, String> resource ) { if (tagsToResource.isEmpty()) { return; } tagsToResource.forEach((fromTag, toResource) -> { final String tag = tags.remove(fromTag); if (tag != null) { resource.putIfAbsent(toResource, tag); } }); }
Source:
<code>public synchronized void saveTags(Long sessionData_id, List<TagDto> tags) { Set<TagEntity> tagEntities = new HashSet<TagEntity>(); SessionData sessionData; for (TagDto tagDto : tags) { tagEntities.add(new TagEntity(tagDto.getName(), tagDto.getDescription())); } try { entityManager.getTransaction().begin(); <START> sessionData = (SessionData) entityManager.createQuery("select sd from SessionData as sd where sd.id = (:sessionData_id)") <END> .setParameter("sessionData_id", sessionData_id) .getSingleResult(); if (sessionData != null) { sessionData.setTags(tagEntities); entityManager.merge(sessionData); entityManager.flush(); } } finally { entityManager.getTransaction().commit(); } }</code><technical_language>entityManager.find(SessionData.class, sessionData_id)</technical_language>

Target:
public synchronized void saveTags(Long sessionData_id, List<TagDto> tags) { Set<TagEntity> tagEntities = new HashSet<TagEntity>(); SessionData sessionData; for (TagDto tagDto : tags) { tagEntities.add(new TagEntity(tagDto.getName(), tagDto.getDescription())); } try { entityManager.getTransaction().begin(); sessionData = entityManager.find(SessionData.class,sessionData_id); if (sessionData != null) { sessionData.setTags(tagEntities); entityManager.merge(sessionData); entityManager.flush(); } } finally { entityManager.getTransaction().commit(); } }
Source:
<code>private void parseResources(String resourceUri, Predicate<String> predicate) throws Exception { final List<URL> list = new ArrayList<>(); final Iterable it = ObjectHelper.createIterable(resourceUri); StreamSupport.stream(it.spliterator(), false) .filter(predicate) .forEach(path -> { try { final URL url = ResourceHelper.resolveMandatoryResourceAsUrl(getCamelContext().getClassResolver(), path.toString()); list.add(url); } catch (Exception e) { <START> <END> } }); if (list.size() > 0) { final URL[] urls = list.toArray(new URL[list.size()]); elSql = ElSql.parse(elSqlConfig, urls); } }</code><technical_language>This is wrong ignore thrown exception - I suggest streaming API TERRIBLE in this example overly complex causing do try .. catch ignore exceptions</technical_language>

Target:
private void parseResources(String resourceUri, Predicate<String> predicate) throws Exception { final List<URL> list = new ArrayList<>(); final Iterable<String> it = ObjectHelper.createIterable(resourceUri); for (final String path : it) { if (predicate.test(path)) { final URL url = ResourceHelper.resolveMandatoryResourceAsUrl(getCamelContext().getClassResolver(), path); list.add(url); } } if (list.size() > 0) { final URL[] urls = list.toArray(new URL[list.size()]); elSql = ElSql.parse(elSqlConfig, urls); } }
Source:
<code>public String editResolver(Principal principal, @Validated @ModelAttribute("resolver") ProjectHandleResolver resolver, BindingResult results, Model model) { if (results.hasErrors()) { model.addAttribute("resolver", resolver); return "auth/resolvers/edit"; } <START> resolver.setUsername(principal.getName()); <END> resolverManager.saveProjectHandleResolver(resolver, principal.getName()); return "redirect:/auth/resolvers"; }</code><technical_language>do set username here</technical_language>

Target:
public String editResolver(Principal principal, @Validated @ModelAttribute("resolver") ProjectHandleResolver resolver, BindingResult results, Model model) { if (results.hasErrors()) { model.addAttribute("resolver", resolver); return "auth/resolvers/edit"; } resolverManager.saveProjectHandleResolver(resolver, principal.getName()); return "redirect:/auth/resolvers"; }
Source:
<code>private static boolean hasUnicodeChar(String literal) { <START> final Pattern escapedBackslashPattern = Pattern.compile("\\\\\\\\"); <END> final String literalWithoutEscapedBackslashes = escapedBackslashPattern.matcher(literal).replaceAll(""); return UNICODE_REGEXP.matcher(literalWithoutEscapedBackslashes).find(); }</code><technical_language>please do compile save in final field of class, improve performance a bit</technical_language>

Target:
private static boolean hasUnicodeChar(String literal) { final String literalWithoutEscapedBackslashes = ESCAPED_BACKSLASH.matcher(literal).replaceAll(""); return UNICODE_REGEXP.matcher(literalWithoutEscapedBackslashes).find(); }
Source:
<code>static <R> Function0<Option<R>> lift(CheckedFunction0<? extends R> partialFunction) { <START> return () -> Try.of(of(partialFunction)::apply).getOption(); <END> }</code><technical_language>replace method call of(partialFunction) providing a type hint <R>: java return () -> Try.<R> of(partialFunction::apply).getOption();</technical_language>

Target:
static <R> Function0<Option<R>> lift(CheckedFunction0<? extends R> partialFunction) { return () -> Try.<R>of(partialFunction::apply).getOption(); }
Source:
<code>public static UnlockWalletDialogFragment show(final FragmentManager fm) { UnlockWalletDialogFragment unlockWalletDialogFragment = new UnlockWalletDialogFragment(); unlockWalletDialogFragment.show(fm, FRAGMENT_TAG); <START> return unlockWalletDialogFragment; <END> }</code><technical_language>Based work done in Pay/Receive PR's, CheckPinDialog replacing UnlockWalletDialogFragment</technical_language>

Target:
public static void show(final FragmentManager fm) { new UnlockWalletDialogFragment().show(fm, FRAGMENT_TAG); }
Source:
<code>public static String convertToEqualShareFormat(int i) { if (i > 100) { return "Equal share + " + (i - 100) + "%"; } else if (i == 100) { return "Equal share"; } else if (i > 0) { return "Equal share - " + (100 - i) + "%"; } else if (i == 0) { return "0%"; } else if (i == Const.POINTS_NOT_SURE) { return "Not Sure"; } else if (i == Const.POINTS_NOT_SUBMITTED) { return ""; } else { return ""; <START> } <END> }</code><technical_language>i == Const.POINTS_NOT_SUBMITTED necessary return is else clause</technical_language>

Target:
public static String convertToEqualShareFormat(int i) { if (i > 100) { return "Equal share + " + (i - 100) + "%"; } else if (i == 100) { return "Equal share"; } else if (i > 0) { return "Equal share - " + (100 - i) + "%"; } else if (i == 0) { return "0%"; } else if (i == Const.POINTS_NOT_SURE) { return "Not Sure"; } else { return ""; } }
Source:
<code><START> protected synchronized void closeLedgerManagerFactory() { <END> LedgerManagerFactory lmToClose; synchronized (this) { lmToClose = lmFactory; lmFactory = null; } if (null != lmToClose) { try { lmToClose.close(); } catch (IOException e) { log.warn("Failed to close zookeeper based ledger manager", e); } } }</code><technical_language>synchronized line 261, do need this</technical_language>

Target:
protected void closeLedgerManagerFactory() { LedgerManagerFactory lmToClose; synchronized (this) { lmToClose = lmFactory; lmFactory = null; } if (null != lmToClose) { try { lmToClose.close(); } catch (IOException e) { log.warn("Failed to close zookeeper based ledger manager", e); } } }
Source:
<code>public ByteSource readImage( final ReadImageParams readImageParams ) throws IOException { final String format = doGetFormatByMimeType( readImageParams.getMimeType() ); <START> if ( renderAsASource( format ) ) <END> { return contentService.getBinary( readImageParams.getContentId(), readImageParams.getBinaryReference() ); } final Path cachedImagePath = getCachedImagePath( readImageParams, format ); return ImmutableFilesHelper.computeIfAbsent( cachedImagePath, () -> createImage( readImageParams, format ) ); }</code><technical_language>I A needs here, I renderAsSource</technical_language>

Target:
public ByteSource readImage( final ReadImageParams readImageParams ) throws IOException { if ( renderAsSource( readImageParams ) ) { return contentService.getBinary( readImageParams.getContentId(), readImageParams.getBinaryReference() ); } final Path cachedImagePath = getCachedImagePath( readImageParams ); return ImmutableFilesHelper.computeIfAbsent( cachedImagePath, () -> createImage( readImageParams ) ); }
Source:
<code>public synchronized void setBrightnessInUserInterfaceDimensionUnit(float percent) { if (percent < 0f) { percent = 0f; } else if (percent > 200f) { percent = 200f; } brightness = percent / 100f; <START> changeShader = true; <END> refreshTextures(); }</code><technical_language>Please, change discussed</technical_language>

Target:
public synchronized void setBrightnessInUserInterfaceDimensionUnit(float percent) { if (percent < 0f) { percent = 0f; } else if (percent > 200f) { percent = 200f; } brightness = percent / 100f; refreshTextures(true); }
Source:
<code>private static long countDistinctDescriptors(Stream<IDataChartDescriptor<?, ?>> descriptors) { <START> return descriptors.map(desc -> desc.hashCode()).distinct().count(); <END> }</code><technical_language>mentioned previous patch, is guarantee 2 objects hash code identical. unlucky a typically small number of descriptors identical hash codes objects, impossible</technical_language>

Target:
private static long countDistinctDescriptors(Stream<IDataChartDescriptor<?, ?>> descriptors) { return descriptors.distinct().count(); }
Source:
<code>private boolean allNodesAreAvailable(Map<String, Node> nodes, ResourceManager rm) { if (rm == null) { throw new NotConnectedException("No connection to RM"); } Set<String> unknownNodeUrls = PAFuture.getFutureValue( rm.setNodeAvailable(ImmutableSet.copyOf(nodes.keySet())), NODE_AVAILABILITY_REPORT_TIMEOUT_DELAY); <START> for (String unknownNodeUrl : unknownNodeUrls) { <END> Node node = nodes.get(unknownNodeUrl); if (node == null) { logger.warn("The RM has sent back an URL that was not published by the Node: " + unknownNodeUrl); } else { String nodeName = node.getNodeInformation().getName(); try { node.getProActiveRuntime().killNode(nodeName); } catch (Exception e) { logger.warn("Killing the local node has failed: " + nodeName, e); } finally { nodes.remove(unknownNodeUrl); logger.info("Node " + unknownNodeUrl + " has been removed "); } } } int nodeCount = nodes.size(); if (logger.isDebugEnabled()) { logger.debug("Node count is equal to " + nodeCount); } return true; }</code><technical_language>put this a private method so. clear this is doing</technical_language>

Target:
private boolean allNodesAreAvailable(Map<String, Node> nodes, ResourceManager rm) { if (rm == null) { throw new NotConnectedException("No connection to RM"); } Set<String> unknownNodeUrls = PAFuture.getFutureValue( rm.setNodesAvailable(ImmutableSet.copyOf(nodes.keySet())), nodeAvailabilityReportTimeoutDelay); for (String unknownNodeUrl : unknownNodeUrls) { killWorkerNodeIfRemovedByUser(nodes, unknownNodeUrl); } int nodeCount = nodes.size(); if (logger.isDebugEnabled()) { logger.debug("Node count is equal to " + nodeCount); } return true; }
Source:
<code>public void stop(String workspaceId, Map<String, String> options) throws NotFoundException, InfrastructureException, ConflictException { RuntimeState state = runtimes.get(workspaceId); if (state == null) { throw new NotFoundException("Workspace with id '" + workspaceId + "' is not running."); } if (!state.status.equals(RUNNING) && !state.status.equals(STARTING)) { throw new ConflictException( format("Could not stop workspace '%s' because its state is '%s'", workspaceId, state.status)); } if (!runtimes.replace(workspaceId, state, new RuntimeState(state.runtime, STOPPING))) { RuntimeState newState = runtimes.get(workspaceId); WorkspaceStatus status = newState != null ? newState.status : STOPPED; throw new ConflictException( format("Could not stop workspace '%s' because its state is '%s'", workspaceId, status)); } eventService.publish(DtoFactory.newDto(WorkspaceStatusEvent.class) .withWorkspaceId(workspaceId) .withPrevStatus(state.status) .withStatus(STOPPING)); try { state.runtime.stop(options); runtimes.remove(workspaceId); publishWorkspaceStoppedEvent(workspaceId, STOPPING, null); } catch (InfrastructureException e) { runtimes.remove(workspaceId); if (!(e instanceof RuntimeStartInterruptedException)) { publishWorkspaceStoppedEvent(workspaceId, STOPPING, "Error occurs on workspace runtime stop. Error: " + e.getMessage()); } else { <START> publishWorkspaceStoppedEvent(workspaceId, STOPPING, null); <END> } } }</code><technical_language>elaborate in cases stop throw RuntimeStartInterruptedException</technical_language>

Target:
public void stop(String workspaceId, Map<String, String> options) throws NotFoundException, ConflictException { RuntimeState state = runtimes.get(workspaceId); if (state == null) { throw new NotFoundException("Workspace with id '" + workspaceId + "' is not running."); } if (state.status != RUNNING && state.status != STARTING) { throw new ConflictException( format("Could not stop workspace '%s' because its state is '%s'", workspaceId, state.status)); } if (!runtimes.replace(workspaceId, state, new RuntimeState(state.runtime, STOPPING))) { RuntimeState newState = runtimes.get(workspaceId); WorkspaceStatus status = newState != null ? newState.status : STOPPED; throw new ConflictException( format("Could not stop workspace '%s' because its state is '%s'", workspaceId, status)); } eventService.publish(DtoFactory.newDto(WorkspaceStatusEvent.class) .withWorkspaceId(workspaceId) .withPrevStatus(state.status) .withStatus(STOPPING)); try { state.runtime.stop(options); runtimes.remove(workspaceId); publishWorkspaceStoppedEvent(workspaceId, STOPPING, null); } catch (InfrastructureException e) { runtimes.remove(workspaceId); publishWorkspaceStoppedEvent(workspaceId, STOPPING, "Error occurs on workspace runtime stop. Error: " + e.getMessage()); } }
Source:
<code><START> public AtomicInteger getNumberOfConnections() { <END> return this.numberOfConnections; }</code><technical_language>return AtomicInteger</technical_language>

Target:
public int getNumberOfConnections() { return this.numberOfConnections.intValue(); }
Source:
<code><START> private static boolean isPortFreeToUse(int port) { <END> if (port < MIN_PORT_NUMBER || port > MAX_PORT_NUMBER) { throw new IllegalArgumentException("Invalid start port: " + port); } try (ServerSocket ss = new ServerSocket(port); DatagramSocket ds = new DatagramSocket(port)) { ss.setReuseAddress(true); ds.setReuseAddress(true); return true; } catch (IOException e) { } return false; }</code><technical_language>this split methods, for TCP UDP, usages, this method in context want check TCP ones</technical_language>

Target:
private static boolean isPortFreeToUse(int port) { return isUDPPortFreeToUse(port) && isTCPPortFreeToUse(port); }
Source:
<code>private void initialize() { Thread.currentThread().setPriority(Thread.MAX_PRIORITY); Stopwatch totalInitTime = Stopwatch.createStarted(); try { logger.info("Initializing Terasology..."); logEnvironmentInfo(); GameThread.setToCurrentThread(); preInitSubsystems(); initManagers(); initSubsystems(); changeStatus(TerasologyEngineStatus.INITIALIZING_ASSET_MANAGEMENT); initAssets(); EnvironmentSwitchHandler environmentSwitcher = new EnvironmentSwitchHandler(); rootContext.put(EnvironmentSwitchHandler.class, environmentSwitcher); environmentSwitcher.handleSwitchToGameEnvironment(rootContext); <START> rootContext.put(TranslationSystem.class, new TranslationSystemImpl(rootContext)); <END> postInitSubsystems(); verifyInitialisation(); CoreRegistry.setContext(null); } catch (RuntimeException e) { logger.error("Failed to initialise Terasology", e); cleanup(); throw e; } double seconds = 0.001 * totalInitTime.elapsed(TimeUnit.MILLISECONDS); logger.info("Initialization completed in {}sec.", String.format("%.2f", seconds)); }</code><technical_language>Please put this in a subsystem</technical_language>

Target:
private void initialize() { Thread.currentThread().setPriority(Thread.MAX_PRIORITY); Stopwatch totalInitTime = Stopwatch.createStarted(); try { logger.info("Initializing Terasology..."); logEnvironmentInfo(); GameThread.setToCurrentThread(); preInitSubsystems(); initManagers(); initSubsystems(); changeStatus(TerasologyEngineStatus.INITIALIZING_ASSET_MANAGEMENT); initAssets(); EnvironmentSwitchHandler environmentSwitcher = new EnvironmentSwitchHandler(); rootContext.put(EnvironmentSwitchHandler.class, environmentSwitcher); environmentSwitcher.handleSwitchToGameEnvironment(rootContext); postInitSubsystems(); verifyInitialisation(); CoreRegistry.setContext(null); } catch (RuntimeException e) { logger.error("Failed to initialise Terasology", e); cleanup(); throw e; } double seconds = 0.001 * totalInitTime.elapsed(TimeUnit.MILLISECONDS); logger.info("Initialization completed in {}sec.", String.format("%.2f", seconds)); }
Source:
<code>private boolean tryLockVmForUpdate(Pair<VM, VmInternalData> pair) { Guid vmId = getVmId(pair); if (vmId != null) { VmManager vmManager = getResourceManager().getVmManager(vmId); if (vmManager.trylock()) { if (fetchTime - vmManager.getVmDataChangedTime() < 0) { log.warn("skipping VM '{}' from this monitoring cycle" + " - the VM data has changed since fetching the data", vmId); vmManager.unlock(); } else { vmManagers.put(vmId, vmManager); return true; } <START> } else { <END> log.debug("skipping VM '{}' from this monitoring cycle" + " - the VM is locked by its VmManager ", getVmId(pair)); } } return false; }</code><technical_language>Partially patch solves issue trylock. receive event lock is loose data. Do code handle events here</technical_language>

Target:
private boolean tryLockVmForUpdate(Pair<VM, VmInternalData> pair) { Guid vmId = getVmId(pair); if (vmId != null) { VmManager vmManager = getResourceManager().getVmManager(vmId); if (vmManager.trylock()) { if (fetchTime - vmManager.getVmDataChangedTime() <= 0) { log.warn("skipping VM '{}' from this monitoring cycle" + " - the VM data has changed since fetching the data", vmId); vmManager.unlock(); } else { vmManagers.put(vmId, vmManager); return true; } } else { log.debug("skipping VM '{}' from this monitoring cycle" + " - the VM is locked by its VmManager ", getVmId(pair)); } } return false; }
Source:
<code>public String getDeathDateAsString(Campaign campaign) { <START> if(getDateOfDeath() == null) { <END> return ""; } else { return getDateOfDeath().format(DateTimeFormatter.ofPattern( campaign.getCampaignOptions().getDisplayDateFormat())); } }</code><technical_language>suggestion if (getDateOfDeath() == null) {</technical_language>

Target:
public String getDeathDateAsString(Campaign campaign) { if (getDateOfDeath() == null) { return ""; } else { return campaign.getCampaignOptions().getDisplayFormattedDate(getDateOfDeath()); } }
Source:
<code>public long getEstimatedSizeBytes(PipelineOptions options) { if (isRemoteFileFromLaunchSite) { return 0; } long size = 0; try { Job job = Job.getInstance(getDeserializerConfiguration()); for (FileStatus st : listStatus(createFormat(job), job)) { size += st.getLen(); } return size; } catch (IOException | NoSuchMethodException | InvocationTargetException | IllegalAccessException | InstantiationException e) { <START> SOURCE_LOG.warn("Got exception", e); <END> return 0; } }</code><technical_language>this error()</technical_language>

Target:
public long getEstimatedSizeBytes(PipelineOptions options) { if (isRemoteFileFromLaunchSite) { return 0; } long size = 0; try { Job job = Job.getInstance(getDeserializerConfiguration()); for (FileStatus st : listStatus(createFormat(job), job)) { size += st.getLen(); } return size; } catch (IOException | NoSuchMethodException | InvocationTargetException | IllegalAccessException | InstantiationException e) { SOURCE_LOG.error("Got exception while trying to getEstimatedSizeBytes().", e); return 0; } }
Source:
<code>protected AuditMessageType.ActiveParticipant getActiveParticipantDestination(NhinTargetSystemType target, boolean isRequesting, Properties webContextProprties, String serviceName) { String strUrl = null; String strHost = null; boolean setDefaultValue = true; AuditMessageType.ActiveParticipant participant = new AuditMessageType.ActiveParticipant(); strUrl = isRequesting ? getWebServiceUrlFromRemoteObject(target, serviceName) : getWebServiceRequestURL(webContextProprties); if (strUrl != null) { try { URL url = new URL(strUrl); participant.setUserID(strUrl); strHost = url.getHost(); participant.setNetworkAccessPointID(strHost); participant.setNetworkAccessPointTypeCode(getNetworkAccessPointTypeCode(strHost)); setDefaultValue = false; } catch (MalformedURLException ex) { LOG.error(ex); setDefaultValue = true; } } <START> if (setDefaultValue) { <END> participant.setUserID(AuditTransformConstants.ACTIVE_PARTICPANT_USER_ID_SOURCE); participant.setNetworkAccessPointTypeCode(AuditTransformConstants.NETWORK_ACCESSOR_PT_TYPE_CODE_NAME); participant.setNetworkAccessPointID(AuditTransformConstants.ACTIVE_PARTICPANT_UNKNOWN_IP_ADDRESS); } participant.setUserIsRequestor(Boolean.FALSE); participant.getRoleIDCode().add(AuditDataTransformHelper.createCodeValueType(AuditTransformConstants.ACTIVE_PARTICIPANT_ROLE_CODE_DEST, null, AuditTransformConstants.ACTIVE_PARTICIPANT_CODE_SYSTEM_NAME, AuditTransformConstants.ACTIVE_PARTICPANT_ROLE_CODE_DESTINATION_DISPLAY_NAME)); return participant; }</code><technical_language>this logic added in catch, this eliminating need for this "if" statement "setDefaultValue" variable</technical_language>

Target:
protected AuditMessageType.ActiveParticipant getActiveParticipantDestination(NhinTargetSystemType target, boolean isRequesting, Properties webContextProprties, String serviceName) { String strUrl = null; String strHost = null; boolean setDefaultValue = true; AuditMessageType.ActiveParticipant participant = new AuditMessageType.ActiveParticipant(); strUrl = isRequesting ? getWebServiceUrlFromRemoteObject(target, serviceName) : getWebServiceRequestURL(webContextProprties); if (strUrl != null) { try { URL url = new URL(strUrl); participant.setUserID(strUrl); strHost = url.getHost(); participant.setNetworkAccessPointID(strHost); participant.setNetworkAccessPointTypeCode(getNetworkAccessPointTypeCode(strHost)); setDefaultValue = false; } catch (MalformedURLException ex) { LOG.error(ex); participant.setUserID(AuditTransformConstants.ACTIVE_PARTICIPANT_USER_ID_SOURCE); participant.setNetworkAccessPointTypeCode(AuditTransformConstants.NETWORK_ACCESSOR_PT_TYPE_CODE_NAME); participant.setNetworkAccessPointID(AuditTransformConstants.ACTIVE_PARTICIPANT_UNKNOWN_IP_ADDRESS); } } participant.setUserIsRequestor(Boolean.FALSE); participant.getRoleIDCode().add(AuditDataTransformHelper.createCodeValueType(AuditTransformConstants.ACTIVE_PARTICIPANT_ROLE_CODE_DEST, null, AuditTransformConstants.ACTIVE_PARTICIPANT_CODE_SYSTEM_NAME, AuditTransformConstants.ACTIVE_PARTICIPANT_ROLE_CODE_DESTINATION_DISPLAY_NAME)); return participant; }
Source:
<code>private final void fireCommandChanged(final CommandEvent commandEvent) { if (commandEvent == null) { throw new NullPointerException("Cannot fire a null event"); } final Object[] listeners = getListeners(); for (Object <START> listener2 : <END> listeners) { final ICommandListener listener = (ICommandListener) listener2; SafeRunner.run(new ISafeRunnable() { @Override public void handleException(Throwable exception) { } @Override public void run() throws Exception { listener.commandChanged(commandEvent); } }); } }</code><technical_language>rename</technical_language>

Target:
private final void fireCommandChanged(final CommandEvent commandEvent) { if (commandEvent == null) { throw new NullPointerException("Cannot fire a null event"); } final Object[] listeners = getListeners(); for (Object listener : listeners) { final ICommandListener commandListener = (ICommandListener) listener; SafeRunner.run(new ISafeRunnable() { @Override public void handleException(Throwable exception) { } @Override public void run() throws Exception { commandListener.commandChanged(commandEvent); } }); } }
Source:
<code>private static void addExtensionLink(LinkMenuBar m, TopMenuItem item) { <START> String url = item.getUrl(); if (myConfig.getContextPath() != null && !myConfig.getContextPath().isEmpty()) { url = myConfig.getContextPath(); if (item.getUrl().indexOf('/') != 0) { url += '/'; } url += item.getUrl(); } <END> Anchor atag = anchor(item.getName(), url); atag.setTarget(item.getTarget()); if (item.getId() != null) { atag.getElement().setAttribute("id", item.getId()); } m.add(atag); }</code><technical_language>String url = selfRedirect(item.getUrl());</technical_language>

Target:
private static void addExtensionLink(LinkMenuBar m, TopMenuItem item) { Anchor atag = anchor(item.getName(), selfRedirect(item.getUrl())); atag.setTarget(item.getTarget()); if (item.getId() != null) { atag.getElement().setAttribute("id", item.getId()); } m.add(atag); }
Source:
<code>public Collection<Address> getLinkedAddresses() { <START> return linkedAddresses == null ? Collections.emptySet() : linkedAddresses; <END> }</code><technical_language>a bunch of places getLinkedAddresses iterated over, collection is thread safe. need double check covered external sync get concurrent mod exceptions</technical_language>

Target:
public Collection<Address> getLinkedAddresses() { final Collection<Address> linkedAddresses = this.linkedAddresses; if (linkedAddresses == null) { return Collections.emptySet(); } return linkedAddresses; }