auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean setBlockOnFire(GlowPlayer player, GlowBlock clicked, BlockFace face, ItemStack holding, Vector clickedLoc) { GlowBlock fireBlock = clicked.getRelative(face); if (fireBlock.getType() != Material.AIR) { return true; } <START> if (clicked.getType() != Material.LEAVES && fireBlock.getRelative(BlockFace.DOWN).getType() == Material.AIR) { <END> return false; } BlockIgniteEvent event = EventFactory.callEvent(new BlockIgniteEvent(fireBlock, BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, player, null)); if (event.isCancelled()) { player.setItemInHand(holding); return false; } ItemTable.instance().getBlock(Material.FIRE).rightClickBlock(player, clicked, face, holding.clone(), clickedLoc); return true; }</code><technical_language>this check if type is flammable? more blocks leaves allow for this</technical_language>

Target:
private boolean setBlockOnFire(GlowPlayer player, GlowBlock clicked, BlockFace face, ItemStack holding, Vector clickedLoc) { GlowBlock fireBlock = clicked.getRelative(face); if (fireBlock.getType() != Material.AIR) { return true; } if (!clicked.getType().isBurnable() && fireBlock.getRelative(BlockFace.DOWN).getType() == Material.AIR) { return false; } BlockIgniteEvent event = EventFactory.callEvent(new BlockIgniteEvent(fireBlock, BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, player, null)); if (event.isCancelled()) { player.setItemInHand(holding); return false; } ItemTable.instance().getBlock(Material.FIRE).rightClickBlock(player, clicked, face, holding.clone(), clickedLoc); return true; }
Source:
<code>public void clickWikiArticlecard() { <START> wikiArticleCard.click(); <END> }</code><technical_language>wait.forElementClickable()</technical_language>

Target:
public ArticlePageObject clickWikiArticlecard() { wait.forElementClickable(wikiArticleCard); wikiArticleCard.click(); return new ArticlePageObject(); }
Source:
<code>public void testFindLiveVersionContentlet() throws Exception{ Structure testStructure = APILocator.getStructureAPI().findByVarName("webPageContent", user); Contentlet cont=new Contentlet(); cont.setStructureInode(testStructure.getInode()); cont.setStringProperty("title", "Testing Working"); cont.setStringProperty("body", "TESTING"); cont.setStringProperty("contentHost", host.getIdentifier()); cont.setReviewInterval( "1m" ); cont.setStructureInode( testStructure.getInode() ); cont.setHost( host.getIdentifier() ); <START> cont = APILocator.getContentletAPI().checkin(cont, user, false); <END> Versionable verAPI = APILocator.getVersionableAPI().findLiveVersion(cont.getIdentifier(), user, false); }</code><technical_language>replace Contentlet contentlet = new ContentletDataGen(testStructure.getInode()).nextPersisted();</technical_language>

Target:
public void testFindLiveVersionContentlet() throws Exception{ Structure structure = new StructureDataGen().nextPersisted(); Contentlet contentlet = new ContentletDataGen(structure.getInode()).nextPersisted(); Versionable verAPI = APILocator.getVersionableAPI().findLiveVersion(contentlet.getIdentifier(), user, false); }
Source:
<code>public Set<Location> getAllowedLocations() { Set<Location> allowedLocations = new HashSet<Location>(); allowedLocations.addAll(Arrays.asList(Location.CONSTRUCTOR, Location.METHOD, Location.FIELD, Location.OVERVIEW, Location.PACKAGE, Location.TYPE)); <START> return allowedLocations; <END> }</code><technical_language>Understood. IntelliJ suggest this small change: return new HashSet<Location>( asList(Location.CONSTRUCTOR, Location.METHOD, Location.FIELD, Location.OVERVIEW, Location.PACKAGE, Location.TYPE));</technical_language>

Target:
public Set<Location> getAllowedLocations() { return new HashSet<Location>(asList(CONSTRUCTOR, METHOD, FIELD, OVERVIEW, PACKAGE, TYPE)); }
Source:
<code>public boolean equals(final Object o) { if (this == o) { return true; } <START> if (o == null || this.getClass() != o.getClass()) { <END> return false; } final GraphMLVertexStatus that = (GraphMLVertexStatus) o; return com.google.common.base.Objects.equal(this.getSeverity(), that.getSeverity()) && com.google.common.base.Objects.equal(this.getAlarmCount(), that.getAlarmCount()) && com.google.common.base.Objects.equal(this.getStyleProperties(), that.getStyleProperties()); }</code><technical_language>Is a reason getClass() is instead of instanceof. instanceof is restrictive choice</technical_language>

Target:
public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof GraphMLVertexStatus)) { return false; } final GraphMLVertexStatus that = (GraphMLVertexStatus) o; return com.google.common.base.Objects.equal(this.getSeverity(), that.getSeverity()) && com.google.common.base.Objects.equal(this.getAlarmCount(), that.getAlarmCount()) && com.google.common.base.Objects.equal(this.getStyleProperties(), that.getStyleProperties()); }
Source:
<code>public void getJetpackSettings(long siteId, Listener listener, ErrorListener errorListener) { String path = String.format(Locale.US, "jetpack-blogs/%d", siteId); Map<String, String> params = new HashMap<>(); <START> get(path, params, null, listener, errorListener); <END> }</code><technical_language>I this in other methods getGeneralSettings is another get method require params, I that. Creating extra map this feel good</technical_language>

Target:
public void getJetpackSettings(long siteId, Listener listener, ErrorListener errorListener) { String path = String.format(Locale.US, "jetpack-blogs/%d", siteId); get(path, listener, errorListener); }
Source:
<code>public boolean hasDiagnosis(Encounter encounter, Diagnosis diagnosis) { for (Diagnosis diagnosisFound : encounter.getDiagnoses()) { <START> if (diagnosis == diagnosisFound) { <END> return true; } } return false; }</code><technical_language>Do unit tests? need equals</technical_language>

Target:
public boolean hasDiagnosis(Encounter encounter, Diagnosis diagnosis) { for (Diagnosis diagnosisFound : encounter.getDiagnoses()) { if (diagnosis.equals(diagnosisFound) && !diagnosisFound.getVoided()) { return true; } } return false; }
Source:
<code><START> public void addCreatorData(Map<String, Object> comment) { <END> Map<String, Object> creator = (Map<String, Object>) comment.remove(CREATOR_KEY); String nedId = creator.get("userId").toString(); IndividualComposite individual; try { individual = userApi.requestObject("individuals/" + nedId, IndividualComposite.class); } catch (IOException e) { throw new RuntimeException(e); } Individualprofile profile = individual.getIndividualprofiles().get(0); comment.put(CREATOR_KEY, profile); }</code><technical_language>Please revert this private refactoring <LINK_0></technical_language>

Target:
private void addCreatorData(Map<String, Object> comment) { Map<String, Object> creator = (Map<String, Object>) comment.remove(CREATOR_KEY); String nedId = creator.get("userId").toString(); IndividualComposite individual; try { individual = userApi.requestObject("individuals/" + nedId, IndividualComposite.class); } catch (IOException e) { throw new RuntimeException(e); } comment.put(CREATOR_KEY, getAmbraProfile(individual)); }
Source:
<code>public void update() { Stock updatedStock = (Stock) subject.getUpdate(); if (market.getStockForSymbol(updatedStock.getSymbol()) == null) { return; } if (history.containsKey(updatedStock.getSymbol())) { List<Double> priceList = history.get(updatedStock.getSymbol()); priceList.add(updatedStock.getPrice()); history.put(updatedStock.getSymbol(), priceList); } <START> else { List<Double> priceList = new ArrayList<Double>(); priceList.add(updatedStock.getPrice()); history.put(updatedStock.getSymbol(), priceList); } <END> }</code><technical_language>put else in a new line</technical_language>

Target:
public void update() { Stock updatedStock = (Stock) priceSetterSubject.getUpdate(); if (market.getStockForSymbol(updatedStock.getSymbol()) == null) { return; } if (history.containsKey(updatedStock.getSymbol())) { List<Double> priceList = history.get(updatedStock.getSymbol()); priceList.add(updatedStock.getPrice()); history.put(updatedStock.getSymbol(), priceList); } else { List<Double> priceList = new ArrayList<Double>(); priceList.add(updatedStock.getPrice()); history.put(updatedStock.getSymbol(), priceList); } }
Source:
<code>public int getGlobalTargetTaskThreadPoolSize() { <START> ClusterConfig clusterConfig = _accessor.getProperty(_accessor.keyBuilder().clusterConfig()); <END> if (clusterConfig == null) { throw new IllegalStateException("Failed to find ClusterConfig!"); } return clusterConfig.getGlobalTargetTaskThreadPoolSize(); }</code><technical_language>here. Duplicate code</technical_language>

Target:
public int getGlobalTargetTaskThreadPoolSize() { ClusterConfig clusterConfig = getClusterConfig(); return clusterConfig.getGlobalTargetTaskThreadPoolSize(); }
Source:
<code>private void checkAgentIsAcceptingDeployments() throws InterruptedException, IOException { int tries = 0; boolean acceptingDeployments; do { TemporaryFolder folder = new TemporaryFolder(); <START> File dummyFile = folder.newFile("dummy.zip"); <END> AgentClient agentClient = new AgentClient(new SystemStreamLog(), "http://localhost:9999/"); try { log.info("Checking if agent is accepting deployments..."); agentClient.deployApplication("dummy", dummyFile); acceptingDeployments = true; } catch (Exception e) { log.info("Agent is not accepting deployments yet. Trying again..."); log.error("Cause: " + e.getLocalizedMessage()); Thread.sleep(TEN_SECONDS); acceptingDeployments = false; tries++; } if (tries == 30) { fail("Could not have agent accepting deployments"); } } while (!acceptingDeployments); log.info("Agent is accepting deployments."); }</code><technical_language>Temp folder file do need in loop do they</technical_language>

Target:
private void checkAgentIsAcceptingDeployments() throws InterruptedException, IOException { int tries = 0; boolean acceptingDeployments; TemporaryFolder folder = new TemporaryFolder(); File dummyFile = folder.newFile("dummy.zip"); AgentClient agentClient = new AgentClient(new SystemStreamLog(), "http://localhost:9999/"); do { try { log.info("Checking if agent is accepting deployments..."); agentClient.deployApplication("dummy", dummyFile); acceptingDeployments = true; } catch (Exception e) { log.info("Agent is not accepting deployments yet. Trying again..."); log.error("Cause: " + e.getLocalizedMessage()); Thread.sleep(TEN_SECONDS); acceptingDeployments = false; tries++; } if (tries == ATTEMPTS) { fail("Could not have agent accepting deployments"); } } while (!acceptingDeployments); log.info("Agent is accepting deployments."); }
Source:
<code>public int hashCode() { int hash = 7; hash = 11 * hash + (this.principal != null ? this.principal.hashCode() : 0); <START> return hash; <END> }</code><technical_language>return this.principal.hashCode()</technical_language>

Target:
public int hashCode() { return this.principal.hashCode(); }
Source:
<code>@Override protected AbstractBinder getAuthBinder() { <START> final Set<Class<? extends PrincipalImpl>> principalClassSet = new HashSet<>(); <END> principalClassSet.add(JsonPrincipal.class); principalClassSet.add(NullPrincipal.class); return new PolymorphicAuthValueFactoryProvider.Binder<PrincipalImpl>(principalClassSet); }</code><technical_language>Ditto. I ImmutableSet.of(...) is a more terse clearer</technical_language>

Target:
@Override protected AbstractBinder getAuthBinder() { return new PolymorphicAuthValueFactoryProvider.Binder<PrincipalImpl>( ImmutableSet.of(JsonPrincipal.class, NullPrincipal.class)); }
Source:
<code>private void scheduleInitialization() { EXECUTOR_SERVICE.schedule(() -> { synchronized (this) { try { tryToInitializeIfNotInitialized(); <START> log.warn("Initialized asynchronously.", <END> SafeArg.of("className", this.getClass().getName())); } catch (Throwable throwable) { cleanUpOnInitFailure(); scheduleInitialization(); } } }, sleepIntervalInMillis(), TimeUnit.MILLISECONDS); }</code><technical_language>This changed info</technical_language>

Target:
private void scheduleInitialization() { singleThreadedExecutor.schedule(() -> { if (canceledInitialization) { return; } try { tryInitializeInternal(); log.info("Initialized asynchronously.", SafeArg.of("className", getInitializingClassName())); } catch (Throwable throwable) { log.info("Failed to initialize asynchronously.", SafeArg.of("className", getInitializingClassName()), throwable); cleanUpOnInitFailure(); scheduleInitialization(); } }, sleepIntervalInMillis(), TimeUnit.MILLISECONDS); }
Source:
<code>MutableSpan doTakeSpan(boolean flushed) { MutableSpan result; try { <START> result = spans.poll(20, TimeUnit.SECONDS); <END> } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new AssertionError(e); } assertThat(result) .withFailMessage("Timeout waiting for span") .isNotNull(); assertThat(result.startTimestamp()) .withFailMessage("Expected a startTimestamp: %s", result) .isNotZero(); if (flushed) { assertThat(result.finishTimestamp()) .withFailMessage("Expected no finishTimestamp: %s", result) .isZero(); } else { assertThat(result.finishTimestamp()) .withFailMessage("Expected a finishTimestamp: %s", result) .isNotZero(); } return result; }</code><technical_language>set 10? ;)</technical_language>

Target:
MutableSpan doTakeSpan(boolean flushed) { MutableSpan result; try { result = spans.poll(10, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new AssertionError(e); } assertThat(result) .withFailMessage("Timeout waiting for span") .isNotNull(); assertThat(result.startTimestamp()) .withFailMessage("Expected a startTimestamp: %s", result) .isNotZero(); if (flushed) { assertThat(result.finishTimestamp()) .withFailMessage("Expected no finishTimestamp: %s", result) .isZero(); } else { assertThat(result.finishTimestamp()) .withFailMessage("Expected a finishTimestamp: %s", result) .isNotZero(); } return result; }
Source:
<code>public KafkaAdminClient(String kafkaInternalHost) { Properties config = new Properties(); <START> config.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaInternalHost); <END> adminClient = AdminClient.create(config); }</code><technical_language>nit: Intellij recommends setProperty() instead of put(). I guess parameter type is more strict</technical_language>

Target:
public KafkaAdminClient(String kafkaInternalHost) { Properties config = new Properties(); config.setProperty(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaInternalHost); adminClient = AdminClient.create(config); }
Source:
<code>private void rentVideo(@NonNull final Video video) { new DatePickerFragment() .setTitle("Select Rental Expiry Date") .setListener(new DatePickerFragment.Listener() { @Override public void onDateSelected(@NonNull Date expiryDate) { <START> long playDuration = video.getDuration() + 10000; <END> if (playDuration == 0) { playDuration = DEFAULT_RENTAL_PLAY_DURATION; } HttpRequestConfig.Builder httpRequestConfigBuilder = new HttpRequestConfig.Builder(); httpRequestConfigBuilder.setBrightcoveAuthorizationToken(pasToken); httpRequestConfig = httpRequestConfigBuilder.build(); catalog.requestRentalLicense(video, expiryDate, playDuration, licenseEventListener, httpRequestConfig); } }) .show(getFragmentManager(), "rentalExpiryDatePicker"); }</code><technical_language>Please change 10000 a static final constant</technical_language>

Target:
private void rentVideo(@NonNull final Video video) { new DatePickerFragment() .setTitle("Select Rental Expiry Date") .setListener(new DatePickerFragment.Listener() { @Override public void onDateSelected(@NonNull Date expiryDate) { long playDuration = video.getDuration() + PLAYDURATION_EXTENSION; if (playDuration == 0) { playDuration = DEFAULT_RENTAL_PLAY_DURATION; } HttpRequestConfig.Builder httpRequestConfigBuilder = new HttpRequestConfig.Builder(); httpRequestConfigBuilder.setBrightcoveAuthorizationToken(pasToken); httpRequestConfig = httpRequestConfigBuilder.build(); catalog.requestRentalLicense(video, expiryDate, playDuration, licenseEventListener, httpRequestConfig); } }) .show(getFragmentManager(), "rentalExpiryDatePicker"); }
Source:
<code>public static boolean isAztecEditorAvailable() { <START> return getBoolean(UndeletablePrefKey.AZTEC_EDITOR_AVAILABLE, BuildConfig.AZTEC_EDITOR_AVAILABLE); <END> }</code><technical_language>IMO, BuildConfig flag precedence Preferences flag (for instance, in case switches release beta/alpha)</technical_language>

Target:
public static boolean isAztecEditorAvailable() { return BuildConfig.AZTEC_EDITOR_AVAILABLE || getBoolean(UndeletablePrefKey.AZTEC_EDITOR_AVAILABLE, false); }
Source:
<code>private List<RepositoryChangeLog> getAllLogs() { <START> return changeLogCache.execute( c -> new ArrayList<>( c.values() ) ); <END> }</code><technical_language>This perform cache bigger bigger. need pagination for getByKey getAll. I ISPN add index values. In fact I worry performance of .stream().filter( ch -> ch.getStoreKey().equals( storeKey ) )</technical_language>

Target:
private List<RepositoryChangeLog> getAllLogs() { final ArrayList<RepositoryChangeLog> results = new ArrayList<>( RESULT_LIMITATION_FOR_TESTING ); return changeLogCache.execute( c -> { for ( RepositoryChangeLog log : c.values() ) { results.add( log ); if ( results.size() >= RESULT_LIMITATION_FOR_TESTING ) { return results; } } return results; } ); }
Source:
<code>public static void testErrorMessageInvalidValueNoncompoundAttribute(WebDriver driver, By context, String simpleName, String value) { String originalValue = FormsUtils.getValueNoncompoundAttribute(driver, context, simpleName); <START> WebElement attribuetContainer = findAttributeContainerWebElement(driver, context, simpleName, false); <END> changeValueAttribute(attribuetContainer, simpleName, value); assertTrue(FormsUtils.formHasErrors(driver, context)); FormsUtils.getValueNoncompoundAttribute(driver, context, simpleName); changeValueAttribute(attribuetContainer, simpleName, originalValue); }</code><technical_language>typo in attribuetContainer</technical_language>

Target:
public static void testErrorMessageInvalidValueNoncompoundAttribute(WebDriver driver, By context, String simpleName, String value) { String originalValue = FormsUtils.getValueNoncompoundAttribute(driver, context, simpleName); WebElement attributeContainer = findAttributeContainerWebElement(driver, context, simpleName, false); changeValueAttributeTextNumberEmailUrl(attributeContainer, simpleName, value); assertTrue(FormsUtils.formHasErrors(driver, context)); FormsUtils.getValueNoncompoundAttribute(driver, context, simpleName); changeValueAttributeTextNumberEmailUrl(attributeContainer, simpleName, originalValue); }
Source:
<code>protected Value<ParrotVariant> constructValue(ParrotVariant actualValue) { <START> return new SpongeValue<>(Keys.PARROT_VARIANT, ParrotVariants.RED, actualValue); <END> }</code><technical_language>this.key</technical_language>

Target:
protected Value<ParrotVariant> constructValue(ParrotVariant actualValue) { return new SpongeValue<>(this.key, ParrotVariants.RED, actualValue); }
Source:
<code>public void prepareListTest() { for (DataType rawType : primitiveTypes) { if (exclude(rawType)) continue; String name = "c_list_" + rawType; DataType type = DataType.list(rawType); List<Object> value = (List<Object>)getFixedValue(type); <START> ; <END> PreparedStatement ps = session.prepare(String.format("INSERT INTO %s(k, %s) VALUES ('prepared_list', ?)", ALL_LIST_TABLE, name)); BoundStatement bs = ps.bind(); session.execute(setBoundValue(bs, name, type, value)); Row row = session.execute(String.format("SELECT %s FROM %s WHERE k='prepared_list'", name, ALL_LIST_TABLE)).one(); assertEquals(getValue(row, name, type, cluster.getConfiguration().getCodecRegistry()), value, "For type " + type); } }</code><technical_language>a spurious semicolon</technical_language>

Target:
public void prepareListTest() { for (DataType rawType : primitiveTypes) { if (exclude(rawType)) continue; String name = "c_list_" + rawType; DataType type = DataType.list(rawType); List<Object> value = (List<Object>)getFixedValue(type); PreparedStatement ps = session.prepare(String.format("INSERT INTO %s(k, %s) VALUES ('prepared_list', ?)", ALL_LIST_TABLE, name)); BoundStatement bs = ps.bind(); session.execute(setBoundValue(bs, name, type, value)); Row row = session.execute(String.format("SELECT %s FROM %s WHERE k='prepared_list'", name, ALL_LIST_TABLE)).one(); assertEquals(getValue(row, name, type, cluster.getConfiguration().getCodecRegistry()), value, "For type " + type); } }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event); FeatureRebaseOperation rebaseOperation = new FeatureRebaseOperation(gfRepo); JobUtil.scheduleUserWorkspaceJob(rebaseOperation, UIText.FeatureRebaseHandler_rebasingFeature, JobFamilies.GITFLOW_FAMILY); IJobManager jobMan = Job.getJobManager(); try { jobMan.join(GITFLOW_FAMILY, null); } catch (OperationCanceledException | InterruptedException e) { return error(e.getMessage(), e); } RebaseResult operationResult = rebaseOperation.getOperationResult(); RebaseResult.Status status = operationResult.getStatus(); if (status.isSuccessful()) { return null; } openWarning(operationResult); <START> if (STOPPED.equals(status)) { <END> try { showInteractiveRebaseView(); } catch (PartInitException e) { return error(e.getMessage(), e); } } return null; }</code><technical_language>open interactive rebase view show warning user understand happened</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event); FeatureRebaseOperation rebaseOperation = new FeatureRebaseOperation(gfRepo); JobUtil.scheduleUserWorkspaceJob(rebaseOperation, UIText.FeatureRebaseHandler_rebasingFeature, JobFamilies.GITFLOW_FAMILY); IJobManager jobMan = Job.getJobManager(); try { jobMan.join(GITFLOW_FAMILY, null); } catch (OperationCanceledException | InterruptedException e) { return error(e.getMessage(), e); } RebaseResult operationResult = rebaseOperation.getOperationResult(); RebaseResult.Status status = operationResult.getStatus(); if (status.isSuccessful()) { return null; } if (STOPPED.equals(status)) { try { showInteractiveRebaseView(event); } catch (PartInitException e) { return error(e.getMessage(), e); } } openWarning(operationResult); return null; }
Source:
<code>public String valueForSQLExpression(EOSQLExpression context) { int count = count(); if (count == 0) { return null; } if ((context != null) && ((objectAtIndex(0) instanceof EORelationship))) { return context.sqlStringForAttributePath(this); } <START> StringBuffer aString = _prefix != null ? new StringBuffer(_prefix) : new StringBuffer(64); <END> int pieces; for (int i = pieces = 0; i < count; i++) { Object expression = objectAtIndex(i); String result = valueForSQLExpression(expression, context); if ((result != null) && (result.length() > 0)) { pieces++; if ((pieces > 1) && (_infix != null)) { aString.append(_infix); } aString.append(result); } } if (pieces == 0) return null; if (_suffix != null) aString.append(_suffix); return new String(aString); }</code><technical_language>StringBuilder instead here</technical_language>

Target:
public String valueForSQLExpression(EOSQLExpression context) { int count = count(); if (count == 0) { return null; } if ((context != null) && ((objectAtIndex(0) instanceof EORelationship))) { return context.sqlStringForAttributePath(this); } StringBuilder aString = _prefix != null ? new StringBuilder(_prefix) : new StringBuilder(64); int pieces; for (int i = pieces = 0; i < count; i++) { Object expression = objectAtIndex(i); String result = valueForSQLExpression(expression, context); if ((result != null) && (result.length() > 0)) { pieces++; if ((pieces > 1) && (_infix != null)) { aString.append(_infix); } aString.append(result); } } if (pieces == 0) return null; if (_suffix != null) aString.append(_suffix); return new String(aString); }
Source:
<code>public static void attemptObtain(ObtainableLock lock) throws IOException { int attempts = 0; <START> while (lock.obtain()==false) { <END> if (attempts++>MAX_LOCK_ACQUIRE_MILLISECONDS) failLockAcquire(); if (Thread.currentThread().isInterrupted()) failLockAcquire(); try { Thread.sleep(1); } catch (InterruptedException e) { Thread.currentThread().interrupt(); failLockAcquire(); } } }</code><technical_language>== false is a bit silly :)</technical_language>

Target:
public static void attemptObtain(ObtainableLock lock) throws IOException { int attempts = 0; while (!lock.obtain()) { if (attempts++ > MAX_LOCK_ACQUIRE_MILLISECONDS) failLockAcquire(); if (Thread.currentThread().isInterrupted()) failLockAcquire(); try { Thread.sleep(1); } catch (InterruptedException e) { Thread.currentThread().interrupt(); failLockAcquire(); } } }
Source:
<code>public static HandshakeMessage fromByteArray(byte[] byteArray, InetSocketAddress peerAddress) { <START> if(byteArray == null) { <END> throw new NullPointerException("byte array cannot be null"); } DatagramReader reader = new DatagramReader(byteArray); int identityLength = reader.read(IDENTITY_LENGTH_BITS); byte[] identityEncoded = reader.readBytes(identityLength); int length = reader.read(LENGTH_BITS); byte[] pointEncoded = reader.readBytes(length); return new EcdhPskClientKeyExchange(identityEncoded, pointEncoded, peerAddress); }</code><technical_language>whitespace</technical_language>

Target:
public static HandshakeMessage fromByteArray(byte[] byteArray, InetSocketAddress peerAddress) { if (byteArray == null) { throw new NullPointerException("byte array cannot be null"); } if (peerAddress == null) { throw new NullPointerException("peer address cannot be null"); } DatagramReader reader = new DatagramReader(byteArray); int identityLength = reader.read(IDENTITY_LENGTH_BITS); byte[] identityEncoded = reader.readBytes(identityLength); int length = reader.read(LENGTH_BITS); byte[] pointEncoded = reader.readBytes(length); return new EcdhPskClientKeyExchange(identityEncoded, pointEncoded, peerAddress); }
Source:
<code>private void validate() { boolean isRealmModeSet = _realmMode != null; boolean isZkAddressSet = _zkAddress != null && !_zkAddress.isEmpty(); <START> if (isRealmModeSet) { if (_realmMode == RealmAwareZkClient.RealmMode.SINGLE_REALM && !isZkAddressSet) { throw new HelixException( "ConfigAccessor: RealmMode cannot be single-realm without a valid ZkAddress set!"); } } else { _realmMode = isZkAddressSet ? RealmAwareZkClient.RealmMode.SINGLE_REALM : RealmAwareZkClient.RealmMode.MULTI_REALM; <END> } boolean isZkClientConfigSet = _realmAwareZkClientConfig != null; _realmAwareZkClientConfig = isZkClientConfigSet ? _realmAwareZkClientConfig.createHelixZkClientConfig() : new HelixZkClient.ZkClientConfig().setZkSerializer(new ZNRecordSerializer()); if (_realmAwareZkConnectionConfig == null) { _realmAwareZkConnectionConfig = new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder().build(); } }</code><technical_language>this simplified a bit easier read? if (_realmMode == RealmAwareZkClient.RealmMode.SINGLE_REALM && !isZkAddressSet) { throw new HelixException( "ConfigAccessor: RealmMode single-realm a valid ZkAddress set!"); } if (_realmMode == null) { _realmMode = isZkAddressSet ? RealmAwareZkClient.RealmMode.SINGLE_REALM : RealmAwareZkClient.RealmMode.MULTI_REALM; }</technical_language>

Target:
private void validate() { boolean isZkAddressSet = _zkAddress != null && !_zkAddress.isEmpty(); if (_realmMode == RealmAwareZkClient.RealmMode.SINGLE_REALM && !isZkAddressSet) { throw new HelixException( "ConfigAccessor: RealmMode cannot be single-realm without a valid ZkAddress set!"); } if (_realmMode == null) { _realmMode = isZkAddressSet ? RealmAwareZkClient.RealmMode.SINGLE_REALM : RealmAwareZkClient.RealmMode.MULTI_REALM; } boolean isZkClientConfigSet = _realmAwareZkClientConfig != null; _realmAwareZkClientConfig = isZkClientConfigSet ? _realmAwareZkClientConfig.createHelixZkClientConfig() : new HelixZkClient.ZkClientConfig().setZkSerializer(new ZNRecordSerializer()); if (_realmAwareZkConnectionConfig == null) { _realmAwareZkConnectionConfig = new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder().build(); } }
Source:
<code><START> public synchronized IProject get(IReferencePoint referencePoint) { <END> if (referencePointToProjectMapper.containsKey(referencePoint)) { return referencePointToProjectMapper.get(referencePoint); } return null; }</code><technical_language>check needed HashMap.get(...) returns null if mapping for key is present</technical_language>

Target:
public synchronized IProject get(IReferencePoint referencePoint) { return referencePointToProjectMapper.get(referencePoint); }
Source:
<code>public void flush() throws IOException { if (getDepth() == 0) { int maxId = lst.getMaxId(); <START> if (!flushed && (user.hasWrittenValuesSinceFinished() || isStreamCopyOptimized())) <END> symbols.writeIonVersionMarker(); if (newSymbols || (!flushed && (isStreamCopyOptimized() || lstRequired))) { symbols.addTypeAnnotationSymbol(systemSymbol(ION_SYMBOL_TABLE_SID)); symbols.stepIn(STRUCT); if (flushed) { symbols.setFieldNameSymbol(systemSymbol(IMPORTS_SID)); symbols.writeSymbolToken(systemSymbol(ION_SYMBOL_TABLE_SID)); } else { SymbolTable[] tempImports = lst.getImportedTables(); if (tempImports.length > 0) { symbols.setFieldNameSymbol(systemSymbol(IMPORTS_SID)); symbols.stepIn(LIST); for (final SymbolTable st : tempImports) { symbols.stepIn(STRUCT); symbols.setFieldNameSymbol(systemSymbol(NAME_SID)); symbols.writeString(st.getName()); symbols.setFieldNameSymbol(systemSymbol(VERSION_SID)); symbols.writeInt(st.getVersion()); symbols.setFieldNameSymbol(systemSymbol(MAX_ID_SID)); symbols.writeInt(st.getMaxId()); symbols.stepOut(); } symbols.stepOut(); } } if (lstIndex < maxId) { symbols.setFieldNameSymbol(systemSymbol(SYMBOLS_SID)); symbols.stepIn(LIST); for (int i = this.lstIndex + 1; i <= maxId; i++) { symbols.writeString(this.lst.findKnownSymbol(i)); } lstIndex = maxId; symbols.stepOut(); } symbols.stepOut(); flushed = true; newSymbols = false; } symbols.flush(); user.flush(); } }</code><technical_language>Please curly braces if statements</technical_language>

Target:
public void flush() throws IOException { if (getDepth() == 0) { int maxId = lst.getMaxId(); if (!flushed && (user.hasWrittenValuesSinceFinished() || isStreamCopyOptimized())) { symbols.writeIonVersionMarker(); } if (hasUnflushedLocalSymbols || (!flushed && (isStreamCopyOptimized() || lstRequired))) { symbols.addTypeAnnotationSymbol(systemSymbol(ION_SYMBOL_TABLE_SID)); symbols.stepIn(STRUCT); if (flushed) { symbols.setFieldNameSymbol(systemSymbol(IMPORTS_SID)); symbols.writeSymbolToken(systemSymbol(ION_SYMBOL_TABLE_SID)); } else { SymbolTable[] tempImports = lst.getImportedTables(); if (tempImports.length > 0) { symbols.setFieldNameSymbol(systemSymbol(IMPORTS_SID)); symbols.stepIn(LIST); for (final SymbolTable st : tempImports) { symbols.stepIn(STRUCT); symbols.setFieldNameSymbol(systemSymbol(NAME_SID)); symbols.writeString(st.getName()); symbols.setFieldNameSymbol(systemSymbol(VERSION_SID)); symbols.writeInt(st.getVersion()); symbols.setFieldNameSymbol(systemSymbol(MAX_ID_SID)); symbols.writeInt(st.getMaxId()); symbols.stepOut(); } symbols.stepOut(); } } if (lstIndex < maxId) { symbols.setFieldNameSymbol(systemSymbol(SYMBOLS_SID)); symbols.stepIn(LIST); for (int i = this.lstIndex + 1; i <= maxId; i++) { symbols.writeString(this.lst.findKnownSymbol(i)); } lstIndex = maxId; symbols.stepOut(); } symbols.stepOut(); flushed = true; hasUnflushedLocalSymbols = false; } symbols.flush(); user.flush(); } }
Source:
<code>public void deleteIndex() { <START> client.dropIndex(null, args.namespace, args.set, indexName); <END> }</code><technical_language>this method returns IndexTask, need call waitTillComplete for operation complete @before method is run</technical_language>

Target:
public void deleteIndex() { IndexTask task = client.dropIndex(null, args.namespace, args.set, indexName); task.waitTillComplete(); }
Source:
<code>private Observable<Token> loginFacebook(final LoginFacebookRequest loginFacebookRequest) { Timber.v("logging in facebook...."); HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); client.interceptors().add(interceptor); Retrofit retrofit = new Retrofit.Builder() .baseUrl(this.config.getCanvassUrl()) .addConverterFactory(GsonConverterFactory.create(gson)) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .client(client) .build(); TokenSpec.TokenEndpoint endpoint = retrofit.create(TokenSpec.TokenEndpoint.class); return endpoint.loginFacebook( getAuthString(), <START> "password", <END> loginFacebookRequest.username(), loginFacebookRequest.password()); }</code><technical_language>Is this hard coded string intentional</technical_language>

Target:
private Observable<Token> loginFacebook(final LoginFacebookRequest loginFacebookRequest) { Timber.v("logging in facebook...."); HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); client.interceptors().add(interceptor); Retrofit retrofit = new Retrofit.Builder() .baseUrl(this.config.getCanvassUrl()) .addConverterFactory(GsonConverterFactory.create(gson)) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .client(client) .build(); TokenSpec.TokenEndpoint endpoint = retrofit.create(TokenSpec.TokenEndpoint.class); return endpoint.loginFacebook( getAuthString(), loginFacebookRequest.getGrantType(), loginFacebookRequest.username(), loginFacebookRequest.password()); }
Source:
<code>public void export_credentials_provider_extension_credentials() throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); ConfigurationAsCode.get().export(out); <START> System.out.println(out.toString()); <END> assertThat(out.toString(), containsString("username: \"user1\"")); assertThat(out.toString(), containsString("id: \"sudo_password\"")); }</code><technical_language>this needed</technical_language>

Target:
public void export_credentials_provider_extension_credentials() throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); ConfigurationAsCode.get().export(out); assertThat(out.toString(), containsString("username: \"user1\"")); assertThat(out.toString(), containsString("id: \"sudo_password\"")); }
Source:
<code>public void accumulate(Tuple input) throws IOException { for (Tuple t : (DataBag) input.get(0)) { <START> <END> if (this.xy != null) { int cmp = t.compareTo(this.xy); if ((cmp < 0 && this.lastCmp > 0) || (cmp > 0 && this.lastCmp < 0)) { throw new ExecException("Out of order! previous tuple: " + this.xy + ", present tuple: " + t + ", comparsion: " + cmp + ", previous comparsion: " + this.lastCmp); } if (cmp != 0) { this.combEstimator.accumulate(this.cxy); this.cxy = 0; this.lastCmp = cmp; Object prevObj = this.xy.get(0); byte prevObjType = DataType.findType(prevObj); Object presentObj = t.get(0); byte presentObjType = DataType.findType(presentObj); if(prevObjType == DataType.ERROR || presentObjType == DataType.ERROR || prevObjType != presentObjType) { throw new ExecException("Inconsistent data type of the 1st field!" + " previous object type: " + DataType.findTypeName(prevObjType) + ", present object type: " + DataType.findTypeName(presentObjType)); } if(DataType.compare(prevObj, presentObj, prevObjType, presentObjType) != 0) { this.condXEstimator.accumulate(this.cx); this.cx = 0; } } } this.xy = t; this.cx++; this.cxy++; } }</code><technical_language>worth validating tuple in fact size 2</technical_language>

Target:
public void accumulate(Tuple input) throws IOException { for (Tuple t : (DataBag) input.get(0)) { if (this.xy != null) { int cmp = t.compareTo(this.xy); if ((cmp < 0 && this.lastCmp > 0) || (cmp > 0 && this.lastCmp < 0)) { throw new ExecException("Out of order! previous tuple: " + this.xy + ", present tuple: " + t + ", comparsion: " + cmp + ", previous comparsion: " + this.lastCmp); } if (cmp != 0) { this.combEstimator.accumulate(this.cxy); this.cxy = 0; this.lastCmp = cmp; if(DataType.compare(this.xy.get(0), t.get(0)) != 0) { this.condXEstimator.accumulate(this.cx); this.cx = 0; } } } this.xy = t; this.cx++; this.cxy++; } }
Source:
<code>private ServerSocket openServerSocket() { ServerSocket serverSocket = null; for (int i = 40000; i < 40100; i++) { try { <START> serverSocket = new ServerSocket(i); <END> } catch (IOException e) { } } assertNotNull(serverSocket, "No ports available in range!"); return serverSocket; }</code><technical_language>Move assertNotNull return early. create 100 ServerSockets time</technical_language>

Target:
private ServerSocket openServerSocket() { int lowerBound = 40000; int upperBound = 40100; for (int i = lowerBound; i < upperBound; i++) { try { return new ServerSocket(i); } catch (IOException e) { } } throw new IllegalStateException("No ports available in range "+lowerBound+" to "+upperBound); }
Source:
<code>public String format(String value) { String decodedLink = value; String toDecode = value; Matcher matcher = PATTERN_URL.matcher(value); if (matcher.find()) { toDecode = matcher.group(1); } try { decodedLink = URLDecoder.decode(toDecode, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { LOGGER.warn("Used unsupported character encoding", e); } <START> String result = new RemoveLatexCommandsFormatter().format(decodedLink); <END> return result; }</code><technical_language>of edge case, this lead problems valid url jabref.org/test%5Ctest (which I guess reduced jabref.org/test instead of expected jabref.org/test\test</technical_language>

Target:
public String format(String value) { String decodedLink = value; String toDecode = value; Matcher matcher = PATTERN_URL.matcher(value); if (matcher.find()) { toDecode = matcher.group(1); } try { decodedLink = URLDecoder.decode(toDecode, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { LOGGER.warn("Used unsupported character encoding", e); } return decodedLink; }
Source:
<code>public Fake(final Request req, final String... params) { super(req); if (params.length % 2 != 0) { throw new IllegalArgumentException( "Wrong number of parameters" ); } this.map = new ConcurrentHashMap<String, List<String>>(0); for (int idx = 0; idx < params.length; idx += 2) { final String key = params[idx]; final String value = params[idx + 1]; if (this.map.containsKey(key)) { this.map.get(key).add(value); } else { final List<String> values = new ArrayList<String>(1); <START> values.add(value); <END> this.map.put(key, values); } } }</code><technical_language>@mbarbieri simply this.map.put(key, Arrays.asList(value))</technical_language>

Target:
public Fake(final Request req, final String... params) throws IOException { if (params.length % 2 != 0) { throw new IllegalArgumentException( "Wrong number of parameters" ); } final StringBuilder builder = new StringBuilder(); for (int idx = 0; idx < params.length; idx += 2) { final String key = RqForm.Fake.encode(params[idx]); final String value = RqForm.Fake.encode(params[idx + 1]); builder.append(key) .append(RqForm.KV_SEPARATOR) .append(value) .append(RqForm.PARAM_SEPARATOR); } this.fake = new RqForm.Base( new RqWithBody(req, builder.toString()) ); }
Source:
<code>public static void setupFolder() { workingDirString = currentDirString + "/../temp/TestHadoopSpark"; workingDirFile = new File(workingDirString); libFolderFile = new File(workingDirFile, "lib"); <START> libFolderFile = new File(workingDirFile, "lib"); <END> executionJarFile = new File(libFolderFile, "hadoop-spark-job-test-execution-x.y.z-a.b.c" + ".jar"); libraryJarFile = new File(libFolderFile, "library.jar"); }</code><technical_language>duplicate</technical_language>

Target:
public static void setupFolder() { workingDirString = currentDirString + "/../temp/TestHadoopSpark"; workingDirFile = new File(workingDirString); libFolderFile = new File(workingDirFile, "lib"); executionJarFile = new File(libFolderFile, "hadoop-spark-job-test-execution-x.y.z-a.b.c" + ".jar"); libraryJarFile = new File(libFolderFile, "library.jar"); }
Source:
<code><START> public static void init() { <END> bai = new DiskBasedBAMFileIndex(new File("src/test/resources/htsjdk/samtools/BAMFileIndexTest/index_test.bam.bai"), null); csi = new CSIIndex(new File("src/test/resources/htsjdk/samtools/BAMFileIndexTest/index_test.bam.csi"), false, null); mcsi = new CSIIndex(new File("src/test/resources/htsjdk/samtools/BAMFileIndexTest/index_test.bam.csi"), true, null); try { ucsi = new CSIIndex(Paths.get("src/test/resources/htsjdk/samtools/BAMFileIndexTest/uncompressed_index.bam.csi"), null); } catch (IOException e) { e.printStackTrace(); } ubai = new DiskBasedBAMFileIndex(new File("src/test/resources/htsjdk/samtools/BAMFileIndexTest/uncompressed_index.bam.bai"),null); }</code><technical_language>confused, is benefit of BeforeClass here, BeforeTest for IntervalTreeTest</technical_language>

Target:
public void init() { bai = new DiskBasedBAMFileIndex(new File(TEST_DATA_DIR, "index_test.bam.bai"), null); csi = new CSIIndex(new File(TEST_DATA_DIR, "index_test.bam.csi"), false, null); mcsi = new CSIIndex(new File(TEST_DATA_DIR, "index_test.bam.csi"), true, null); try { ucsi = new CSIIndex(Paths.get(TEST_DATA_DIR, "uncompressed_index.bam.csi"), null); } catch (IOException e) { e.printStackTrace(); } ubai = new DiskBasedBAMFileIndex(new File(TEST_DATA_DIR, "uncompressed_index.bam.bai"), null); }
Source:
<code>public static org.schabi.newpipe.extractor.localization.Localization getPreferredLocalization(final Context context) { final String contentLanguage = PreferenceManager .getDefaultSharedPreferences(context) .getString(context.getString(R.string.content_language_key), context.getString(R.string.default_language_value)); <START> if (contentLanguage.equals("system")) { <END> return org.schabi.newpipe.extractor.localization.Localization.fromLocale(Locale.getDefault()); } return org.schabi.newpipe.extractor.localization.Localization.fromLocalizationCode(contentLanguage); }</code><technical_language>This constant in a key</technical_language>

Target:
public static org.schabi.newpipe.extractor.localization.Localization getPreferredLocalization(final Context context) { final String contentLanguage = PreferenceManager .getDefaultSharedPreferences(context) .getString(context.getString(R.string.content_language_key), context.getString(R.string.default_localization_key)); if (contentLanguage.equals(context.getString(R.string.default_localization_key))) { return org.schabi.newpipe.extractor.localization.Localization.fromLocale(Locale.getDefault()); } return org.schabi.newpipe.extractor.localization.Localization.fromLocalizationCode(contentLanguage); }
Source:
<code>public boolean isStoreByValue() { CopierConfiguration copierConfig = findSingletonAmongst(CopierConfiguration.class, cacheConfiguration.getServiceConfigurations()); <START> return copierConfig == null; <END> }</code><technical_language>Condition is inverted here: is copierConfig is storeByRef if is is storeByValue</technical_language>

Target:
public boolean isStoreByValue() { CopierConfiguration copierConfig = findSingletonAmongst(CopierConfiguration.class, cacheConfiguration.getServiceConfigurations()); return copierConfig != null; }
Source:
<code>public static List<WindowsSoundCard> getSoundCards() { List<WindowsSoundCard> cards = new ArrayList<>(); <START> if (AUDIO_CARD_QUERY_RESULT.getResultCount() == 0) { <END> LOG.warn("No Sound Cards Found..."); } else { for (int i = 0; i < AUDIO_CARD_QUERY_RESULT.getResultCount(); i++) { cards.add(new WindowsSoundCard(getAudioCardKernelVersion(i), getAudioCardCompleteName(i), getAudioCardName(i))); } } return cards; }</code><technical_language>need check this is zero. for loop iterate. (I for a Log warning, I a warning, user simply detect empty array.)</technical_language>

Target:
public static List<WindowsSoundCard> getSoundCards() { WbemcliUtil.WmiQuery<SoundCardKernel> cardKernelQuery = new WbemcliUtil.WmiQuery<>(driverQueryClause, SoundCardKernel.class); WbemcliUtil.WmiResult<SoundCardKernel> cardKernelQueryResult = WmiUtil.queryWMI(cardKernelQuery); List<WindowsSoundCard> soundCards = new ArrayList<>(); for (int i = 0; i < cardKernelQueryResult.getResultCount(); i++) { if (NAME_MAP.containsKey(WmiUtil.getString(cardKernelQueryResult, SoundCardKernel.DEVICENAME, i))) { soundCards.add(new WindowsSoundCard(getAudioCardKernelVersion(i, cardKernelQueryResult), WmiUtil.getString(cardKernelQueryResult, SoundCardKernel.DRIVERPROVIDERNAME, i) + " " + WmiUtil.getString(cardKernelQueryResult, SoundCardKernel.DEVICENAME, i), (WmiUtil.getString(cardKernelQueryResult, SoundCardKernel.DEVICENAME, i)))); } } return soundCards; }
Source:
<code>public void findUserByNameShouldReturnUserDtoWhenUserWasFound() { given(userRepository.findByUserName(USER_NAME)).willReturn(userEntity); UserDTO result = userService.findUserByName(USER_NAME); <START> assertThat(result, is(detailedUserDTO)); <END> }</code><technical_language>userRepository modelMapper invocations verified</technical_language>

Target:
public void findUserByNameShouldReturnUserDtoWhenUserWasFound() { given(userRepository.findByUserName(USER_NAME)).willReturn(userEntity); UserDTO result = userService.findUserByName(USER_NAME); then(modelMapper).should().map(userEntity, UserDTO.class); then(userRepository).should().findByUserName(USER_NAME); assertThat(result, is(detailedUserDTO)); }
Source:
<code>public void canGetMetadataForAll() { Map<TableReference, byte[]> metadataMap = getTestKvs().getMetadataForTables(); assertThat(getTestKvs().getMetadataForTables().get(TEST_TABLE)) .isEqualTo(AtlasDbConstants.GENERIC_TABLE_METADATA); <START> assertThat(metadataMap.get(TEST_TABLE)).isEqualTo(AtlasDbConstants.GENERIC_TABLE_METADATA); <END> }</code><technical_language>confused - is a reason talk KVS twice, if so, is a reason assert call first</technical_language>

Target:
public void canGetMetadataForAll() { assertThat(getTestKvs().getMetadataForTables().get(TEST_TABLE)) .isEqualTo(AtlasDbConstants.GENERIC_TABLE_METADATA); }
Source:
<code>@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { actionMode = mode; <START> mode.setTag(getTag()); <END> mode.getMenuInflater().inflate(R.menu.menu_action_mode_reading_list, menu); return true; }</code><technical_language>I this a bit cleaner calling super.onCreateActionMode(), exposing getTag(), proceed inflate menu. (and remove default inflating of menu in super()). yet, create abstract method asks for resource-id of menu inflate</technical_language>

Target:
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { super.onCreateActionMode(mode, menu); mode.getMenuInflater().inflate(R.menu.menu_action_mode_reading_list, menu); actionMode = mode; return true; }
Source:
<code>public void testBaseDeliveryIgnoresEndpoint() { Delivery delivery = new Delivery() { @Override public void deliver(Serializer serializer, Object object, Map<String, String> headers) { } @Override public void close() { } }; config.delivery = delivery; config.sessionDelivery = delivery; <START> config.setEndpoints("<LINK_0>", "<LINK_1>"); <END> }</code><technical_language>do need assertion here</technical_language>

Target:
public void testBaseDeliveryIgnoresEndpoint() { Delivery delivery = new Delivery() { @Override public void deliver(Serializer serializer, Object object, Map<String, String> headers) { } @Override public void close() { } }; config.delivery = delivery; config.sessionDelivery = delivery; ByteArrayOutputStream baos = new ByteArrayOutputStream(); System.setErr(new PrintStream(baos)); config.setEndpoints("<LINK_0>", "<LINK_1>"); String logMsg = new String(baos.toByteArray()); assertTrue(logMsg.contains("Delivery is not instance of " + "HttpDelivery, cannot set notify endpoint")); assertTrue(logMsg.contains("Delivery is not instance of " + "HttpDelivery, cannot set sessions endpoint")); }