auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void unwindCraftPreview(InventoryPacketContext context) { final EntityPlayerMP player = context.getPacketPlayer(); ((ContainerBridge) player.openContainer).bridge$setFirePreview(true); Inventory craftInv = ((Inventory) player.openContainer).query(QueryOperationTypes.INVENTORY_TYPE.of(CraftingInventory.class)); if (craftInv instanceof CraftingInventory) { <START> SlotTransaction previewTransaction = ((ContainerBridge) player.openContainer).bridge$getPreviewTransaction(); <END> if (previewTransaction != null) { CraftingRecipe recipe = SpongeCraftingRecipeRegistry .getInstance().findMatchingRecipe(((CraftingInventory) craftInv).getCraftingGrid(), ((World) player.world)).orElse(null); SpongeCommonEventFactory.callCraftEventPre(player, ((CraftingInventory) craftInv), previewTransaction, recipe, player.openContainer, ImmutableList.of(previewTransaction)); ((ContainerBridge) player.openContainer).bridge$setPreviewTransaction(null); } } }</code><technical_language>(nitpick) final this please</technical_language>

Target:
public static void unwindCraftPreview(InventoryPacketContext context) { final EntityPlayerMP player = context.getPacketPlayer(); ((ContainerBridge) player.openContainer).bridge$setFirePreview(true); Inventory craftInv = ((Inventory) player.openContainer).query(QueryOperationTypes.INVENTORY_TYPE.of(CraftingInventory.class)); if (craftInv instanceof CraftingInventory) { final SlotTransaction previewTransaction = ((ContainerBridge) player.openContainer).bridge$getPreviewTransaction(); if (previewTransaction != null) { CraftingRecipe recipe = SpongeCraftingRecipeRegistry .getInstance().findMatchingRecipe(((CraftingInventory) craftInv).getCraftingGrid(), ((World) player.world)).orElse(null); SpongeCommonEventFactory.callCraftEventPre(player, ((CraftingInventory) craftInv), previewTransaction, recipe, player.openContainer, ImmutableList.of(previewTransaction)); ((ContainerBridge) player.openContainer).bridge$setPreviewTransaction(null); } } }
Source:
<code>public void excludeAll() { Set<Class<?>> types = new HashSet<Class<?>>(); <START> if (isCollection(getRootClass())) <END> types.addAll(getElementTypes()); else types.add(getRootClass()); for (Class<?> type : types) for (Field field : new Mirror().on(type).reflectAll().fields()) getExcludes().putAll(field.getName(), getParentTypes(field.getName(), type)); }</code><technical_language>please {}</technical_language>

Target:
public void excludeAll() { Set<Class<?>> types = new HashSet<>(); if (isCollection(getRootClass())) { types.addAll(getElementTypes()); } else { types.add(getRootClass()); } for (Class<?> type : types) { for (Field field : new Mirror().on(type).reflectAll().fields()) { getExcludes().putAll(field.getName(), getParentTypes(field.getName(), type)); } } }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } DateTimeType other = (DateTimeType) obj; if (calendar == null) { if (other.calendar != null) { return false; } <START> } else if (!calendar.equals(other.calendar)) { <END> return false; } return true; }</code><technical_language>Calendar.equals() requires exact match, doc: <LINK_0> > result is true if if argument is a Calendar object of calendar system represents time (millisecond offset Epoch) Calendar parameters this object. > Calendar parameters values represented isLenient, getFirstDayOfWeek, getMinimalDaysInFirstWeek getTimeZone methods. If is difference in parameters Calendars, this method returns false. > > compareTo method compare time values. This is a problem DateTimeType is immutable, getCalender() returns mutable calendar member instead of a clone</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } DateTimeType other = (DateTimeType) obj; if (calendar == null) { if (other.calendar != null) { return false; } } else if (calendar.compareTo(other.calendar) != 0) { return false; } return true; }
Source:
<code>private void updateOptionPointsMapping( Map<String, List<Integer>> optionPoints, String optionReceivingPoints, int pointsReceived) { List<Integer> points = optionPoints.computeIfAbsent(optionReceivingPoints, key -> new ArrayList<>()); <START> points.add(pointsReceived); <END> }</code><technical_language>combine previous, i.e. points variable is longer needed</technical_language>

Target:
private void updateOptionPointsMapping( Map<String, List<Integer>> optionPoints, String optionReceivingPoints, int pointsReceived) { optionPoints.computeIfAbsent(optionReceivingPoints, key -> new ArrayList<>()).add(pointsReceived); }
Source:
<code>public void setMessageSender_shouldSetMessageSender() throws MessageException { MessageSender messageSender = new MailMessageSender(); <START> MessageService messageService = Context.getMessageService(); <END> messageService.setMessageSender(messageSender); assertEquals(messageSender, messageService.getMessageSender()); }</code><technical_language>mock this? <LINK_0> . is a overkill load context for a test</technical_language>

Target:
public void setMessageSender_shouldSetMessageSender() throws MessageException { MessageSender messageSender = new MailMessageSender(); ms.setMessageSender(messageSender); assertEquals(messageSender, ms.getMessageSender()); }
Source:
<code>public void testCreateShouldIgnoreNonShareableMetacards() throws Exception { <START> ShareableMetacardPreIngestPlugin wpip = makePlugin(ImmutableMap.of()); <END> Metacard metacard = new MetacardImpl(); wpip.process(new CreateRequestImpl(metacard)); assertThat(metacard.getAttribute(Core.METACARD_OWNER), nullValue()); }</code><technical_language>variable name needs update in some of methods</technical_language>

Target:
public void testCreateShouldIgnoreNonShareableMetacards() throws Exception { ShareableMetacardPreIngestPlugin plugin = makePlugin(); Metacard metacard = new MetacardImpl(); plugin.process(new CreateRequestImpl(metacard)); assertThat(metacard.getAttribute(Core.METACARD_OWNER), nullValue()); }
Source:
<code>public void done(IJobChangeEvent event) { Map<Repository, Object> res = new HashMap<Repository, Object>( this.results); for (Repository repo : res.keySet()) { Object result = res.get(repo); if (result instanceof PullResult) { PullResult pullResult = (PullResult) result; if (pullResult.getRebaseResult() != null && RebaseResult.Status.UNCOMMITTED_CHANGES == pullResult .getRebaseResult().getStatus()) { <START> handleUncommittedChanges(repo, pullResult <END> .getRebaseResult().getUncommittedChanges()); this.results.remove(repo); } } } if (this.results.isEmpty()) return; PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); showResults(shell); } }); }</code><technical_language>in commit message this open multiple dialogs. I change repositories: uncommited changes pull cleanly abort due other reasons. starting pull, CleanupUncomittedChangesDialog a pull result dialog for other repositories popped up. result dialog appeared in foreground, clicking OK button close it. closing CleanupUncomittedChangesDialog (which result dialog) I click OK result dialog</technical_language>

Target:
public void done(IJobChangeEvent event) { final Map<Repository, Object> res = new HashMap<Repository, Object>( PullOperationUI.this.results); PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); for (Entry<Repository, Object> entry : res.entrySet()) { Object result = entry.getValue(); if (result instanceof PullResult) { PullResult pullResult = (PullResult) result; if (pullResult.getRebaseResult() != null && RebaseResult.Status.UNCOMMITTED_CHANGES == pullResult .getRebaseResult().getStatus()) { boolean handledSeparately = handleUncommittedChanges( entry.getKey(), pullResult .getRebaseResult() .getUncommittedChanges(), shell); if (handledSeparately) tasksToWaitFor.incrementAndGet(); } } } if (tasksToWaitFor.decrementAndGet() == 0 && !results.isEmpty()) showResults(shell); } }); }
Source:
<code>public void testInvalidIndex() { BeanIdentifierIndex index = new BeanIdentifierIndex(); index.build(Collections.<Bean<?>>emptySet()); try { index.getIdentifier(-10); fail(); } catch (IllegalStateException e) { <START> e.printStackTrace(); <END> } try { index.getIdentifier(0); fail(); } catch (IllegalStateException e) { } try { index.getIdentifier(10); fail(); } catch (IllegalStateException e) { } }</code><technical_language>If this is expected, do need print stack trace</technical_language>

Target:
public void testInvalidIndex() { BeanIdentifierIndex index = new BeanIdentifierIndex(); index.build(Collections.<Bean<?>>emptySet()); try { index.getIdentifier(-10); fail(); } catch (IllegalStateException e) { } try { index.getIdentifier(0); fail(); } catch (IllegalStateException e) { } try { index.getIdentifier(10); fail(); } catch (IllegalStateException e) { } }
Source:
<code>private int getOrientation(InputStream is) { if (hasImaging == null) { hasImaging = isImagingOnClasspath(); } if (!hasImaging) { return 0; } try { IImageMetadata metadata = Imaging.getMetadata(is, null); TiffImageMetadata tiffMetaData; if (metadata instanceof JpegImageMetadata) { JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata; tiffMetaData = jpegMetadata.getExif(); } else if (metadata instanceof TiffImageMetadata) { tiffMetaData = (TiffImageMetadata) metadata; } else { return 0; } TiffField orientationField = tiffMetaData.findField(TiffTagConstants.TIFF_TAG_ORIENTATION); if (orientationField != null) { int orientationValue = orientationField.getIntValue(); switch (orientationValue) { case 3: return 180; case 6: return 90; <START> case 8: <END> return -90; } } } catch (IOException ignored) { } catch (ImageReadException ignored) { } return 0; }</code><technical_language>constants</technical_language>

Target:
private int getOrientation(InputStream is) { if (!hasImaging) { return 0; } try { IImageMetadata metadata = Sanselan.getMetadata(is, null); TiffImageMetadata tiffMetaData; if (metadata instanceof JpegImageMetadata) { JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata; tiffMetaData = jpegMetadata.getExif(); } else if (metadata instanceof TiffImageMetadata) { tiffMetaData = (TiffImageMetadata) metadata; } else { return 0; } TiffField orientationField = tiffMetaData.findField(TiffTagConstants.TIFF_TAG_ORIENTATION); if (orientationField != null) { int orientationValue = orientationField.getIntValue(); switch (orientationValue) { case ORIENTATION_VALUE_ROTATE_180: return 180; case ORIENTATION_VALUE_ROTATE_90_CW: return 90; case ORIENTATION_VALUE_ROTATE_270_CW: return 270; default: return 0; } } } catch (IOException ignored) { } catch (ImageReadException ignored) { } return 0; }
Source:
<code>public void shutdown() { LOG.info("Shutting down"); stopping = true; submittedRequests.add(Request.requestOfDeath); try { this.join(ZooKeeperServer.getShutdownTimeout()); } catch (InterruptedException e) { LOG.warn("Interrupted while waiting for to finish", this); } killed = true; try { this.join(); } catch (InterruptedException e) { LOG.warn("Interrupted while waiting for to finish", this); <START> System.exit(1); <END> } }</code><technical_language>nit: org.apache.zookeeper.server.ExitCode</technical_language>

Target:
public void shutdown() { LOG.info("Shutting down"); stopping = true; submittedRequests.add(Request.requestOfDeath); try { this.join(shutdownTimeout); } catch (InterruptedException e) { LOG.warn("Interrupted while waiting for to finish", this); } killed = true; try { this.join(); } catch (InterruptedException e) { LOG.warn("Interrupted while waiting for to finish", this); System.exit(ExitCode.UNEXPECTED_ERROR.getValue()); } }
Source:
<code>public void setConf(Configuration configuration) { conf = configuration; Dataset<E> dataset = loadDataset(configuration); String partitionDir = conf.get(KITE_PARTITION_DIR); if (dataset.getDescriptor().isPartitioned() && partitionDir != null) { PartitionKey key = Accessor.getDefault().fromDirectoryName(dataset, new Path(partitionDir)); if (key != null) { dataset = dataset.getPartition(key, true); } } if (dataset instanceof AbstractDataset) { delegate = ((AbstractDataset<E>) dataset).getDelegateInputFormat(); } else { <START> throw new UnsupportedOperationException("No input format for dataset " + dataset); <END> } }</code><technical_language>This is odd exception for users: DatasetKeyInputFormat is input format for dataset. update this more "Incompatible Dataset: implementation provide InputFormat support" user implementation define underlying support</technical_language>

Target:
public void setConf(Configuration configuration) { conf = configuration; Dataset<E> dataset = loadDataset(configuration); String partitionDir = conf.get(KITE_PARTITION_DIR); if (dataset.getDescriptor().isPartitioned() && partitionDir != null) { PartitionKey key = Accessor.getDefault().fromDirectoryName(dataset, new Path(partitionDir)); if (key != null) { dataset = dataset.getPartition(key, true); } } if (dataset instanceof AbstractDataset) { delegate = ((AbstractDataset<E>) dataset).getDelegateInputFormat(); } else { throw new UnsupportedOperationException("Incompatible Dataset: implementation " + "does not provide InputFormat support. Dataset: " + dataset); } }
Source:
<code>protected void deleteExpiredVMSnapshots() { String displayTime = DateUtil.displayDateInTimezone(DateUtil.GMT_TIMEZONE, _currentTimestamp); Date now = new Date(); List<VMSnapshotVO> vmSnapshots = _vmSnapshotDao.listAll(); for (VMSnapshotVO vmSnapshot : vmSnapshots) { long accountId = vmSnapshot.getAccountId(); int expiration_interval_hours = VMSnapshotManager.VMSnapshotExpireInterval.valueIn(accountId); if (expiration_interval_hours < 0 ) { continue; } Date creationTime = vmSnapshot.getCreated(); long diffInHours = TimeUnit.MILLISECONDS.toHours(now.getTime() - creationTime.getTime()); <START> if (diffInHours > expiration_interval_hours) { <END> _vmSnaphostManager.deleteVMSnapshot(vmSnapshot.getId()); } } }</code><technical_language>this (diffInHours >= expiration_interval_hours) ? if expiration is 4hrs if diff is 4 hours greater triggered..</technical_language>

Target:
protected void deleteExpiredVMSnapshots() { Date now = new Date(); List<VMSnapshotVO> vmSnapshots = _vmSnapshotDao.listAll(); for (VMSnapshotVO vmSnapshot : vmSnapshots) { long accountId = vmSnapshot.getAccountId(); int expiration_interval_hours = VMSnapshotManager.VMSnapshotExpireInterval.valueIn(accountId); if (expiration_interval_hours < 0 ) { continue; } Date creationTime = vmSnapshot.getCreated(); long diffInHours = TimeUnit.MILLISECONDS.toHours(now.getTime() - creationTime.getTime()); if (diffInHours >= expiration_interval_hours) { if (s_logger.isDebugEnabled()){ s_logger.debug("Deleting expired VM snapshot id: " + vmSnapshot.getId()); } _vmSnaphostManager.deleteVMSnapshot(vmSnapshot.getId()); } } }
Source:
<code>public Neo4jItemReader<T> build() { if (this.saveState) { Assert.hasText(this.name, "A name is required when saveState is set to true"); } Assert.notNull(this.sessionFactory, "sessionFactory is required."); Assert.notNull(this.targetType, "targetType is required."); Assert.hasText(this.startStatement, "startStatement is required."); Assert.hasText(this.returnStatement, "returnStatement is required."); Assert.hasText(this.orderByStatement, "orderByStatement is required."); Neo4jItemReader<T> reader = new Neo4jItemReader<>(); reader.setMatchStatement(this.matchStatement); reader.setOrderByStatement(this.orderByStatement); reader.setPageSize(this.pageSize); reader.setParameterValues(this.parameterValues); reader.setSessionFactory(this.sessionFactory); <START> reader.setTargetType(this.targetType); <END> reader.setStartStatement(this.startStatement); reader.setReturnStatement(this.returnStatement); reader.setWhereStatement(this.whereStatement); reader.setName(this.name); reader.setSaveState(this.saveState); reader.setCurrentItemCount(this.currentItemCount); reader.setMaxItemCount(this.maxItemCount); return reader; }</code><technical_language>I realize do assert in reader (we update that), I requiring pageSize greater zero sense</technical_language>

Target:
public Neo4jItemReader<T> build() { if (this.saveState) { Assert.hasText(this.name, "A name is required when saveState is set to true"); } Assert.notNull(this.sessionFactory, "sessionFactory is required."); Assert.notNull(this.targetType, "targetType is required."); Assert.hasText(this.startStatement, "startStatement is required."); Assert.hasText(this.returnStatement, "returnStatement is required."); Assert.hasText(this.orderByStatement, "orderByStatement is required."); Assert.isTrue(this.pageSize > 0, "pageSize must be greater than zero"); Assert.isTrue(this.maxItemCount > 0, "maxItemCount must be greater than zero"); Assert.isTrue(this.maxItemCount > this.currentItemCount , "maxItemCount must be greater than currentItemCount"); Neo4jItemReader<T> reader = new Neo4jItemReader<>(); reader.setMatchStatement(this.matchStatement); reader.setOrderByStatement(this.orderByStatement); reader.setPageSize(this.pageSize); reader.setParameterValues(this.parameterValues); reader.setSessionFactory(this.sessionFactory); reader.setTargetType(this.targetType); reader.setStartStatement(this.startStatement); reader.setReturnStatement(this.returnStatement); reader.setWhereStatement(this.whereStatement); reader.setName(this.name); reader.setSaveState(this.saveState); reader.setCurrentItemCount(this.currentItemCount); reader.setMaxItemCount(this.maxItemCount); return reader; }
Source:
<code><START> private List<ReferenceCountExchangeClient> getSharedClient(URL url, int connectNum) { <END> String key = url.getAddress(); List<ReferenceCountExchangeClient> clients = referenceClientMap.get(key); boolean firstBuild = false; if (clients == null) { List<ReferenceCountExchangeClient> referenceCountExchangeClients = buildReferenceCountExchangeClientList(url, key, connectNum); referenceClientMap.put(key, referenceCountExchangeClients); clients = referenceCountExchangeClients; firstBuild = true; } for (int i = 0; i < clients.size(); i++) { ReferenceCountExchangeClient client = clients.get(i); if (client.isClosed()) { client = buildReferenceCountExchangeClient(url, key); clients.set(i, client); } else if (!firstBuild) { client.incrementAndGetCount(); } } return clients; }</code><technical_language>This method potential contention issue, especially getClients() called URL moment (is possible?)</technical_language>

Target:
private List<ReferenceCountExchangeClient> getSharedClient(URL url, int connectNum) { String key = url.getAddress(); List<ReferenceCountExchangeClient> clients = referenceClientMap.get(key); if (checkClientCanUse(clients)) { batchClientRefIncr(clients); return clients; } locks.putIfAbsent(key, new Object()); synchronized (locks.get(key)) { clients = referenceClientMap.get(key); if (checkClientCanUse(clients)) { batchClientRefIncr(clients); return clients; } connectNum = Math.max(connectNum, 1); if (CollectionUtils.isEmpty(clients)) { clients = buildReferenceCountExchangeClientList(url, connectNum); referenceClientMap.put(key, clients); } else { for (int i = 0; i < clients.size(); i++) { ReferenceCountExchangeClient referenceCountExchangeClient = clients.get(i); if (referenceCountExchangeClient == null || referenceCountExchangeClient.isClosed()) { clients.set(i, buildReferenceCountExchangeClient(url)); continue; } referenceCountExchangeClient.incrementAndGetCount(); } } locks.remove(key); return clients; } }
Source:
<code>public void getCallSetWithInvalidIDShouldFail() throws AvroRemoteException { final String nonexistentCallSetId = Utils.randomId(); final GAWrapperException t = Utils.catchGAWrapperException(() -> client.variants.getCallSet(nonexistentCallSetId)); <START> assertThat(t.getHttpStatusCode()).isEqualTo(HttpURLConnection.HTTP_NOT_FOUND); <END> }</code><technical_language>Please handle case t is null</technical_language>

Target:
public void getCallSetWithInvalidIDShouldFail() throws AvroRemoteException { final String nonexistentCallSetId = Utils.randomId(); final GAWrapperException gae = Utils.catchGAWrapperException(() -> client.variants.getCallSet(nonexistentCallSetId)); assertThat(gae.getHttpStatusCode()).isEqualTo(HttpURLConnection.HTTP_NOT_FOUND); }
Source:
<code>public Jdbi installPlugin(JdbiPlugin plugin) { <START> Unchecked.runnable(() -> plugin.customizeJdbi(this)).run(); <END> plugins.add(plugin); return this; }</code><technical_language>Unchecked.consumer(plugin::customizeJdbi).accept(this); is right mantra :)</technical_language>

Target:
public Jdbi installPlugin(JdbiPlugin plugin) { Unchecked.consumer(plugin::customizeJdbi).accept(this); plugins.add(plugin); return this; }
Source:
<code>public void touch() { <START> log.debug("Stateful bean instance has been touched"); <END> }</code><technical_language>log.trace</technical_language>

Target:
public void touch() { log.trace("Stateful bean instance has been touched"); }
Source:
<code>public String sanitize(String key, String value) { <START> if (value != null && StringUtils.hasText(value)) { <END> for (Pattern pattern : this.keysToSanitize) { if (pattern.matcher(key).matches()) { value = REDACTION_STRING; break; } } } return value; }</code><technical_language>! = null removed StringUtils.hasText(value) null check well</technical_language>

Target:
public String sanitize(String key, String value) { if (StringUtils.hasText(value)) { for (Pattern pattern : this.keysToSanitize) { if (pattern.matcher(key).matches()) { value = REDACTION_STRING; break; } } } return value; }
Source:
<code>public void evaluate() throws Throwable { try ( CompatibilityOverride <START> co = <END> new CompatibilityOverride(config); PlatformCompatOverride pco = new PlatformCompatOverride(config); ) { co.init(); pco.init(testType); testStatement.evaluate(); } }</code><technical_language>full variable names</technical_language>

Target:
public void evaluate() throws Throwable { Compatibility.setOverrides(config); try { setPlatformCompatOverrides(); try { testStatement.evaluate(); } finally { cleanupPlatformCompatOverrides(); } } catch (RemoteException e) { throw new RuntimeException("Could not call IPlatformCompat binder method!", e); } finally { Compatibility.clearOverrides(); } }
Source:
<code>public List<WebElement> getColumnByIndex(int index) { return getWrappedElement().findElements( <START> By.cssSelector("tr > td:nth-of-type(" + index + ")")); <END> }</code><technical_language>please String.format concatenate strings</technical_language>

Target:
public List<WebElement> getColumnByIndex(int index) { return getWrappedElement().findElements( By.cssSelector(String.format("tr > td:nth-of-type(%d)", index))); }
Source:
<code>public Object createVerticesWithException() { createVertexWithCommit(); <START> createVertexWithNesteedCommit(); <END> throw new RuntimeException(); }</code><technical_language>Typo: suggestion createVertexWithNestedCommit();</technical_language>

Target:
public Object createVerticesWithException() { createVertexWithCommit(); createVertexWithNestedCommit(); throw new RuntimeException(); }
Source:
<code><START> public static ExecutorService getExecutorService() { <END> ensureInitialized(); return sExecutorService; }</code><technical_language>@Nullable</technical_language>

Target:
public static ExecutorService getExecutorService() { return sExecutorService; }
Source:
<code>public void reloadItems() { <START> logger.debug("Size of providers : {}", providers.size()); <END> for (Ipx800BindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { try { createItem(itemName, provider); } catch (Ipx800UnknownDeviceException e) { logger.error("Item " + itemName + " will be ignored"); e.printStackTrace(); } } } }</code><technical_language>remove ot decrease TRACE level</technical_language>

Target:
public void reloadItems() { logger.trace("Size of providers : {}", providers.size()); for (Ipx800BindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { try { createInternalItem(itemName, provider); } catch (Ipx800UnknownDeviceException e) { logger.error("Item will be ignored", itemName); } } } }
Source:
<code>Collection<EntityColumn> readColumns() { BeanInfo entityDescriptor; try { entityDescriptor = Introspector.getBeanInfo(entityClass); } catch (IntrospectionException e) { throw new IllegalStateException(e); } Collection<EntityColumn> entityColumns = newLinkedList(); PropertyDescriptor[] propertyDescriptors = entityDescriptor.getPropertyDescriptors(); Arrays.stream(propertyDescriptors) .filter(ColumnReader::hasAccessor) .filter(ColumnReader::accessorIsAnnotated) .map(PropertyDescriptor::getReadMethod) <START> .forEach(readMethod -> entityColumns.add(EntityColumn.from(readMethod))); <END> checkRepeatedColumnNames(entityColumns); return entityColumns; }</code><technical_language>Please a combination of map collect instead. forEach stateless. In practice, in order honest functional style coding, forEach is applicable</technical_language>

Target:
Collection<EntityColumn> readColumns() { BeanInfo entityDescriptor; try { entityDescriptor = Introspector.getBeanInfo(entityClass); } catch (IntrospectionException e) { throw new IllegalStateException(e); } PropertyDescriptor[] propertyDescriptors = entityDescriptor.getPropertyDescriptors(); ImmutableSet<EntityColumn> columns = Arrays .stream(propertyDescriptors) .map(PropertyDescriptor::getReadMethod) .filter(Objects::nonNull) .filter(ColumnReader::isAnnotated) .map(EntityColumn::from) .collect(toImmutableSet()); checkRepeatedColumnNames(columns); return columns; }
Source:
<code>private List<BridgeJsonParameters> getBridgeList() { try { Gson gson = new Gson(); String json = HttpUtil.executeUrl("GET", url, timeout); return gson.fromJson(json, new TypeToken<List<BridgeJsonParameters>>() { }.getType()); } catch (IOException e) { <START> logger.error("Error accessing the Philips Hue NUPnP service.", e); <END> } return null; }</code><technical_language>is perfectly valid, if is Internet access available. this result in errors logged</technical_language>

Target:
private List<BridgeJsonParameters> getBridgeList() { try { Gson gson = new Gson(); String json = doGetRequest(DISCOVERY_URL); return gson.fromJson(json, new TypeToken<List<BridgeJsonParameters>>() { }.getType()); } catch (IOException e) { logger.debug("Philips Hue NUPnP service not reachable. Can't discover bridges"); } catch (JsonParseException je) { logger.debug("Invalid json respone from Hue NUPnP service. Can't discover bridges"); } return new ArrayList<BridgeJsonParameters>(); }
Source:
<code>public boolean retryRequest(final IOException exception, final int executionCount, final HttpContext context) { final Object disableRetry = context.getAttribute(CONTEXT_ATTRIBUTE_MANTA_RETRY_DISABLE); if (disableRetry instanceof Boolean && (Boolean) disableRetry) { return false; } if (logger.isDebugEnabled()) { if (NON_RETRIABLE.contains(exception)) { logger.debug("Request failed, unable to retry.", exception); } else if (executionCount <= getRetryCount()) { String msg = String.format("Request failed, %d/%d retry.", executionCount, getRetryCount()); logger.debug(msg, exception); } } <START> return super.retryRequest(exception, executionCount, context); <END> }</code><technical_language>stash of super call in a variable determine log? factor in NON_RETRIABLE other HttpClient behavior lead this method cancelling retry</technical_language>

Target:
public boolean retryRequest(final IOException exception, final int executionCount, final HttpContext context) { final Object disableRetry = context.getAttribute(CONTEXT_ATTRIBUTE_MANTA_RETRY_DISABLE); if (disableRetry instanceof Boolean && (Boolean) disableRetry) { return false; } final boolean toBeRetried = super.retryRequest(exception, executionCount, context); if (logger.isDebugEnabled()) { if (toBeRetried) { String msg = String.format("Request failed, %d/%d retry.", executionCount, getRetryCount()); logger.debug(msg, exception); } else { logger.debug("Request failed, unable to retry.", exception); } } return toBeRetried; }
Source:
<code>public void testDropMultipleGetPmCommands() { GetPresentationModelCommand cmd1 = new GetPresentationModelCommand(); cmd1.setPmId("1"); GetPresentationModelCommand cmd2 = new GetPresentationModelCommand(); cmd2.setPmId("1"); OnFinishedHandler sameHandler = new OnFinishedHandler() { @Override public void onFinished() { } }; List<CommandAndHandler> list = new ArrayList<CommandAndHandler>(); ((ArrayList<CommandAndHandler>) list).add(new CommandAndHandler(cmd1, sameHandler)); ((ArrayList<CommandAndHandler>) list).add(new CommandAndHandler(cmd2, sameHandler)); <START> ((ArrayList<CommandAndHandler>) list).add(new CommandAndHandler(cmd2)); <END> for (CommandAndHandler commandAndHandler : list) { batcher.batch(commandAndHandler); } try { List<CommandAndHandler> nextBatch = batcher.getWaitingBatches().getVal(); Assert.assertEquals(1, nextBatch.size()); Assert.assertEquals(GetPresentationModelCommand.class, nextBatch.get(0).getCommand().getClass()); Assert.assertTrue(batcher.isEmpty()); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }</code><technical_language>Typecasting is required</technical_language>

Target:
public void testDropMultipleGetPmCommands() { GetPresentationModelCommand cmd1 = new GetPresentationModelCommand(); cmd1.setPmId("1"); GetPresentationModelCommand cmd2 = new GetPresentationModelCommand(); cmd2.setPmId("1"); OnFinishedHandler sameHandler = new OnFinishedHandler() { @Override public void onFinished() { } }; List<CommandAndHandler> list = new ArrayList<CommandAndHandler>(); list.add(new CommandAndHandler(cmd1, sameHandler)); list.add(new CommandAndHandler(cmd2, sameHandler)); list.add(new CommandAndHandler(cmd2)); for (CommandAndHandler commandAndHandler : list) { batcher.batch(commandAndHandler); } try { List<CommandAndHandler> nextBatch = batcher.getWaitingBatches().getVal(); Assert.assertEquals(1, nextBatch.size()); Assert.assertEquals(GetPresentationModelCommand.class, nextBatch.get(0).getCommand().getClass()); Assert.assertTrue(batcher.isEmpty()); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
Source:
<code><START> public void setCredentialsFactoryConfig(CredentialsFactoryConfig credentialsFactoryConfig) { <END> this.credentialsFactoryConfig = credentialsFactoryConfig; }</code><technical_language>return ClientSecurityConfig for chaining</technical_language>

Target:
public ClientSecurityConfig setCredentialsFactoryConfig(CredentialsFactoryConfig credentialsFactoryConfig) { this.credentialsFactoryConfig = credentialsFactoryConfig; return this; }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.liger_main); AppConfig mAppConfig = AppConfig.getAppConfig(this); LigerFragmentFactory.mContext = this; mRootPageFragment = LigerFragmentFactory.openPage(mAppConfig.getRootPageName(), mAppConfig.getRootPageTitle(), mAppConfig.getRootPageArgs(), mAppConfig.getRootPageOptions()); <START> if(mRootPageFragment != null) { <END> FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); mRootPageFragment.addFragments(ft, R.id.content_frame); ft.commit(); } if (savedInstanceState != null) { lastChildArgs = savedInstanceState.getString(SAVE_CHILD_ARGS); } Config.init(this); if(mAppConfig.getNotificationsEnabled()) { GcmRegistrationHelper gcmHelper = new GcmRegistrationHelper(this, this); gcmHelper.registerGcm(); } }</code><technical_language>curious of this code does</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.liger_main); AppConfig mAppConfig = AppConfig.getAppConfig(this); LigerFragmentFactory.mContext = this; mRootPageFragment = LigerFragmentFactory.openPage(mAppConfig.getRootPageName(), mAppConfig.getRootPageTitle(), mAppConfig.getRootPageArgs(), mAppConfig.getRootPageOptions()); if(mRootPageFragment != null) { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); mRootPageFragment.addFragments(ft, R.id.content_frame); mRootPageFragment.setRootPageListener(this); ft.commit(); } if (savedInstanceState != null) { lastChildArgs = savedInstanceState.getString(SAVE_CHILD_ARGS); } Config.init(this); if(mAppConfig.getNotificationsEnabled()) { GcmRegistrationHelper gcmHelper = new GcmRegistrationHelper(this, this); gcmHelper.registerGcm(); } }
Source:
<code>private ProgramState checkConstraint(CheckerContext context, Tree syntaxNode, SymbolicValue currentVal) { ProgramState programState = context.getState(); Constraint constraint = programState.getConstraint(currentVal); if (constraint != null && constraint.isNull()) { String message = "NullPointerException might be thrown as '" + SyntaxTreeNameFinder.getName(syntaxNode) + "' is nullable here"; Set<List<JavaFileScannerContext.Location>> flows = new HashSet<>(); <START> flows.add(flow(context.getNode(), currentVal)); <END> context.reportIssue(syntaxNode, this, message, flows); return null; } constraint = programState.getConstraint(currentVal); if (constraint == null) { return programState.addConstraint(currentVal, ObjectConstraint.NOT_NULL); } return programState; }</code><technical_language>#flow is static, called in static (i.e. SECheck.flow )</technical_language>

Target:
private ProgramState checkConstraint(CheckerContext context, Tree syntaxNode, SymbolicValue currentVal) { ProgramState programState = context.getState(); Constraint constraint = programState.getConstraint(currentVal); if (constraint != null && constraint.isNull()) { String message = "NullPointerException might be thrown as '" + SyntaxTreeNameFinder.getName(syntaxNode) + "' is nullable here"; Set<List<JavaFileScannerContext.Location>> flows = new HashSet<>(); flows.add(SECheck.flow(context.getNode(), currentVal)); context.reportIssue(syntaxNode, this, message, flows); return null; } constraint = programState.getConstraint(currentVal); if (constraint == null) { return programState.addConstraint(currentVal, ObjectConstraint.NOT_NULL); } return programState; }
Source:
<code>public void multipleDrillDownTest() { Search srch = db.search("views101/animals"); SearchResult<Animal> rslt = srch.includeDocs(true) .counts(new String[]{"class", "diet"}) .ranges("{ \"min_length\": {\"small\": \"[0 TO 1.0]\"," + "\"medium\": \"[1.1 TO 3.0]\", \"large\": \"[3.1 TO 9999999]\"} }") .drillDown("class", "bird") .drillDown("diet", "omnivore") .querySearchResult("class:bird", Animal.class); assertNotNull(rslt); assertNotNull(rslt.getRanges()); <START> assertEquals(rslt.getRanges().entrySet().size(), 1); <END> assertEquals(rslt.getRanges().get("min_length").entrySet().size(), 3); assertEquals(rslt.getRanges().get("min_length").get("small"), new Long(1)); assertEquals(rslt.getRanges().get("min_length").get("medium"), new Long(0)); assertEquals(rslt.getRanges().get("min_length").get("large"), new Long(0)); }</code><technical_language>Thanks, PR #179 for other incorrect assertEquals ordering</technical_language>

Target:
public void multipleDrillDownTest() { Search srch = db.search("views101/animals"); SearchResult<Animal> rslt = srch.includeDocs(true) .counts(new String[]{"class", "diet"}) .ranges("{ \"min_length\": {\"small\": \"[0 TO 1.0]\"," + "\"medium\": \"[1.1 TO 3.0]\", \"large\": \"[3.1 TO 9999999]\"} }") .drillDown("class", "bird") .drillDown("diet", "omnivore") .querySearchResult("class:bird", Animal.class); assertNotNull(rslt); assertNotNull(rslt.getRanges()); assertEquals(1, rslt.getRanges().entrySet().size()); assertEquals(3, rslt.getRanges().get("min_length").entrySet().size()); assertEquals(new Long(1), rslt.getRanges().get("min_length").get("small")); assertEquals(new Long(0), rslt.getRanges().get("min_length").get("medium")); assertEquals(new Long(0), rslt.getRanges().get("min_length").get("large")); }
Source:
<code>public static Iterable<Object[]> data() { Collection<Object[]> ids = new ArrayList<Object[]>(); <START> String[] delimeters = {"", "_", "3", "*", " "}; <END> for (String colPrefix : delimeters) { for (String colSuffix : delimeters) { for (String columnName : new String[]{"returning", "returningreturning"}) { for (String prefix : delimeters) { for (String suffix : delimeters) { for (String returning : new String[]{"returning", "returningreturning"}) { ids.add(new Object[]{columnName, colPrefix, colSuffix, returning, prefix, suffix}); } } } } } } return ids; }</code><technical_language>a huge deal delimeter is spelled delimiter</technical_language>

Target:
public static Iterable<Object[]> data() { Collection<Object[]> ids = new ArrayList<Object[]>(); String[] delimiters = {"", "_", "3", "*", " "}; for (String columnName : new String[]{"returning", "returningreturning"}) { for (String prefix : delimiters) { for (String suffix : delimiters) { for (String returning : new String[]{"returning", "returningreturning"}) { ids.add(new Object[]{columnName, returning, prefix, suffix}); } } } } return ids; }
Source:
<code>public URL map(ResultSet r, int columnNumber, StatementContext ctx) throws SQLException { URL url = null; try { url = URI.create(r.getString(columnNumber)).toURL(); } catch (MalformedURLException e) { <START> e.printStackTrace(); <END> } return url; }</code><technical_language>of minds this exception. hand more correct approach is raise exception swallow it. other hand, means if a malformed URL database, read row out exception--lame. rate, this logged SLF4J printed STDOUT</technical_language>

Target:
public URL map(ResultSet r, int columnNumber, StatementContext ctx) throws SQLException { try { return new URL(r.getString(columnNumber)); } catch (MalformedURLException e) { throw new SQLException(e); } }
Source:
<code>public void addName(IASTName name) { if (!name.isActive()) return; if (name instanceof ICPPASTQualifiedName) { IBinding b= getClassType(); final ICPPASTQualifiedName qname = (ICPPASTQualifiedName) name; final ICPPASTNameSpecifier[] qualifier = qname.getQualifier(); for (int i = qualifier.length; --i >= 0;) { if (b == null) return; char[] segmentName; <START> if (qualifier[i] instanceof IASTName) <END> segmentName = ((IASTName) qualifier[i]).getLookupKey(); else { IBinding segmentBinding = qualifier[i].resolveBinding(); if (segmentBinding == null) return; segmentName = segmentBinding.getNameCharArray(); } if (!CharArrayUtils.equals(segmentName, b.getNameCharArray())) return; b= b.getOwner(); } if (qname.isFullyQualified() && b != null) return; } IASTNode parent = name.getParent(); if (parent instanceof IASTDeclarator) { if (CPPVisitor.isConstructor(this, (IASTDeclarator) parent)) { addConstructor(name); return; } } super.addName(name); }</code><technical_language>Please curly braces in 'if' statements 'else' clause</technical_language>

Target:
public void addName(IASTName name) { if (!name.isActive()) return; if (name instanceof ICPPASTQualifiedName) { IBinding b= getClassType(); final ICPPASTQualifiedName qname = (ICPPASTQualifiedName) name; final ICPPASTNameSpecifier[] qualifier = qname.getQualifier(); for (int i = qualifier.length; --i >= 0;) { if (b == null) return; char[] segmentName; if (qualifier[i] instanceof IASTName) { segmentName = ((IASTName) qualifier[i]).getLookupKey(); } else { IBinding segmentBinding = qualifier[i].resolveBinding(); if (segmentBinding == null) return; segmentName = segmentBinding.getNameCharArray(); } if (!CharArrayUtils.equals(segmentName, b.getNameCharArray())) return; b= b.getOwner(); } if (qname.isFullyQualified() && b != null) return; } IASTNode parent = name.getParent(); if (parent instanceof IASTDeclarator) { if (CPPVisitor.isConstructor(this, (IASTDeclarator) parent)) { addConstructor(name); return; } } super.addName(name); }
Source:
<code><START> static AsteroidConfig load(String moduleName){ <END> JSONObject asteroidConfigs; try{ asteroidConfigs = Assets.getJson(moduleName + ":asteroidsConfig").getJsonValue(); }catch (RuntimeException e){ asteroidConfigs = Assets.getJson("engine:asteroidsConfig").getJsonValue(); } float MIN_SPLIT_SZ = asteroidConfigs.getFloat("MIN_SPLIT_SZ"); float MIN_BURN_SZ = asteroidConfigs.getFloat("MIN_BURN_SZ"); float SZ_TO_LIFE = asteroidConfigs.getFloat("SZ_TO_LIFE"); float MAX_SPLIT_SPD = asteroidConfigs.getFloat("MAX_SPLIT_SPD"); float DUR = asteroidConfigs.getFloat("DUR"); return new AsteroidConfig(MIN_SPLIT_SZ, MIN_BURN_SZ, SZ_TO_LIFE, MAX_SPLIT_SPD, DUR); }</code><technical_language>Style issues in this file</technical_language>

Target:
static AsteroidConfig load(String moduleName) { JSONObject asteroidConfigs; try{ asteroidConfigs = Assets.getJson(moduleName + ":asteroidsConfig").getJsonValue(); }catch (RuntimeException e){ asteroidConfigs = Assets.getJson("engine:asteroidsConfig").getJsonValue(); } float minSplitSz = asteroidConfigs.getFloat("MIN_SPLIT_SZ"); float minBurnSz = asteroidConfigs.getFloat("MIN_BURN_SZ"); float szToLife = asteroidConfigs.getFloat("SZ_TO_LIFE"); float maxSplitSpd = asteroidConfigs.getFloat("MAX_SPLIT_SPD"); float dur = asteroidConfigs.getFloat("DUR"); return new AsteroidConfig(minSplitSz, minBurnSz, szToLife, maxSplitSpd, dur); }
Source:
<code>public void testGetOsDetails() { Task<OsDetails> detailsTask = app.getExecutionContext().submit(OsTasks.getOsDetails(app)); <START> OsDetails details = detailsTask.getUnchecked(); <END> assertNotNull(details); assertNotNull(details.getArch()); assertNotNull(details.getName()); assertNotNull(details.getVersion()); }</code><technical_language>log.info in this test well, details found. grep test output (e.g. if interested jenkins machine generated, manually check "unknown")</technical_language>

Target:
public void testGetOsDetails() { Task<OsDetails> detailsTask = app.getExecutionContext().submit(OsTasks.getOsDetails(app)); OsDetails details = detailsTask.getUnchecked(); LOG.info("testGetOsDetails found the following on localhost: name={}, version={}, arch={}, is64bit={}", new Object[] {details.getName(), details.getVersion(), details.getArch(), details.is64bit()}); assertNotNull(details); assertNotNull(details.getArch()); assertNotNull(details.getName()); assertNotNull(details.getVersion()); }
Source:
<code><START> public static CriticalHitEvent getCriticalHit(EntityPlayer player, Entity target, boolean vanillaCritical, float damageModifier) <END> { CriticalHitEvent hitResult = new CriticalHitEvent(player, target, damageModifier); MinecraftForge.EVENT_BUS.post(hitResult); if (hitResult.getResult() != Event.Result.DENY) { if (hitResult.getResult() == Event.Result.ALLOW || vanillaCritical) { return hitResult; } } return null; }</code><technical_language>I want a @Nullable prevent confusion</technical_language>

Target:
public static CriticalHitEvent getCriticalHit(EntityPlayer player, Entity target, boolean vanillaCritical, float damageModifier) { CriticalHitEvent hitResult = new CriticalHitEvent(player, target, damageModifier); MinecraftForge.EVENT_BUS.post(hitResult); if (hitResult.getResult() == Event.Result.ALLOW || (vanillaCritical && hitResult.getResult() == Event.Result.DEFAULT)) { return hitResult; } return null; }
Source:
<code>public String getDetail(String name) { <START> assert (details != null) : "Did you forget to load the details?"; <END> return details.get(name); }</code><technical_language>I solved this removing assert. Do run tests asserts enabled? (no :-1: intended!)</technical_language>

Target:
public String getDetail(String name) { return details.get(name); }
Source:
<code>public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object result; boolean interrupted = false; int retryCounter = 0; try { do { try { result = method.invoke(targetProxy, args); break; } catch (InvocationTargetException x) { Throwable e = x.getCause(); <START> if (retryCounter++ >= MAX_RETRIES_ON_REMOTING_INTERRUPTION || !shouldRetry(method, e)) { <END> throw e; } interrupted = true; } } while (true); } finally { if (interrupted) { Thread.currentThread().interrupt(); } } return result; }</code><technical_language>moving part (before ||) shouldRetry() method</technical_language>

Target:
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object result; boolean interrupted = false; int retryCounter = 0; try { do { try { result = method.invoke(targetProxy, args); break; } catch (InvocationTargetException x) { Throwable e = x.getCause(); if (!shouldRetry(method, e, retryCounter++)) { throw e; } interrupted = true; } } while (true); } finally { if (interrupted) { Thread.currentThread().interrupt(); } } return result; }
Source:
<code>public UnhandledServerException(String exceptionMessage, Throwable cause) { <START> super(Response.Status.UNSUPPORTED_MEDIA_TYPE, String.format(MESSAGE, exceptionMessage), cause); <END> }</code><technical_language>Is status code Response.Status.INTERNAL_SERVER_ERROR</technical_language>

Target:
public UnhandledServerException(String exceptionMessage, Throwable cause) { super(Response.Status.INTERNAL_SERVER_ERROR, String.format(MESSAGE, exceptionMessage), cause); }
Source:
<code>public FileHeader createFileHeader(DiffEntry ent) throws IOException { ByteArrayOutputStream buf = new ByteArrayOutputStream(); <START> PrintStream ps = new PrintStream(buf, true, Constants.CHARSET.name()); <END> final EditList editList; writeDiffHeader(ps, ent); if (ent.getOldMode() == GITLINK || ent.getNewMode() == GITLINK) { writeGitLinkDiffText(ps, ent); editList = new EditList(); } else { byte[] aRaw = open(ent.getOldMode(), ent.getOldId()); byte[] bRaw = open(ent.getNewMode(), ent.getNewId()); if (RawText.isBinary(aRaw) || RawText.isBinary(bRaw)) { ps.write(encodeASCII("Binary files differ\n")); editList = new EditList(); } else { RawText a = rawTextFactory.create(aRaw); RawText b = rawTextFactory.create(bRaw); editList = new MyersDiff(a, b).getEdits(); } } ps.flush(); return new FileHeader(buf.toByteArray(), editList); }</code><technical_language>Oooh. a PrintStream. Yuck. Actually, need this a PrintStream, is handling encoding. write buf directly</technical_language>

Target:
public FileHeader createFileHeader(DiffEntry ent) throws IOException, CorruptObjectException, MissingObjectException { ByteArrayOutputStream buf = new ByteArrayOutputStream(); final EditList editList; writeDiffHeader(buf, ent); if (ent.getOldMode() == GITLINK || ent.getNewMode() == GITLINK) { writeGitLinkDiffText(buf, ent); editList = new EditList(); } else { byte[] aRaw = open(ent.getOldMode(), ent.getOldId()); byte[] bRaw = open(ent.getNewMode(), ent.getNewId()); if (RawText.isBinary(aRaw) || RawText.isBinary(bRaw)) { buf.write(encodeASCII("Binary files differ\n")); editList = new EditList(); } else { RawText a = rawTextFactory.create(aRaw); RawText b = rawTextFactory.create(bRaw); editList = new MyersDiff(a, b).getEdits(); } } buf.flush(); return new FileHeader(buf.toByteArray(), editList); }
Source:
<code>public synchronized KeyPair getKeyPair() throws AmazonClientException, IOException { if (usableKeyPair == null) <START> usableKeyPair = resolvePrivateKey(this).find(connect()); <END> return usableKeyPair; }</code><technical_language>This method return null this result in NPE</technical_language>

Target:
public synchronized KeyPair getKeyPair() throws AmazonClientException, IOException { if (usableKeyPair == null) { EC2PrivateKey ec2PrivateKey = this.resolvePrivateKey(); if (ec2PrivateKey != null) { usableKeyPair = ec2PrivateKey.find(connect()); } } return usableKeyPair; }