auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() { LttngUstTrace trace = getTrace(); ILttngUstEventLayout layout; if (trace == null) { layout = DefaultLttngUstEventLayout.getInstance(); } else { layout = trace.getEventLayout(); } <START> if (fAnalysisRequirements == null) { <END> @NonNull Set<@NonNull String> requiredEvents = ImmutableSet.of( layout.eventLibcMalloc(), layout.eventLibcFree(), layout.eventLibcCalloc(), layout.eventLibcRealloc(), layout.eventLibcMemalign(), layout.eventLibcPosixMemalign() ); TmfAnalysisRequirement eventsReq = new TmfAnalysisRequirement( nullToEmptyString(SessionConfigStrings.CONFIG_ELEMENT_EVENT), requiredEvents, ValuePriorityLevel.MANDATORY); eventsReq.addInformation(nullToEmptyString(Messages.UstMemoryAnalysisModule_EventsLoadingInformation)); eventsReq.addInformation(nullToEmptyString(Messages.UstMemoryAnalysisModule_EventsLoadingExampleInformation)); TmfAnalysisRequirement domainReq = new TmfAnalysisRequirement(nullToEmptyString(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN)); domainReq.addValue(nullToEmptyString(SessionConfigStrings.CONFIG_DOMAIN_TYPE_UST), ValuePriorityLevel.MANDATORY); fAnalysisRequirements = ImmutableSet.of(domainReq, eventsReq); } return checkNotNull(fAnalysisRequirements); }</code><technical_language>do a fast return null checking beginning of method (after extracting local variable)</technical_language>

Target:
public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() { LttngUstTrace trace = getTrace(); ILttngUstEventLayout layout; if (trace == null) { layout = ILttngUstEventLayout.DEFAULT_LAYOUT; } else { layout = trace.getEventLayout(); } Set<TmfAnalysisRequirement> requirements = fAnalysisRequirements; if (requirements == null) { @NonNull Set<@NonNull String> requiredEvents = ImmutableSet.of( layout.eventLibcMalloc(), layout.eventLibcFree(), layout.eventLibcCalloc(), layout.eventLibcRealloc(), layout.eventLibcMemalign(), layout.eventLibcPosixMemalign() ); TmfAnalysisRequirement eventsReq = new TmfAnalysisRequirement( nullToEmptyString(SessionConfigStrings.CONFIG_ELEMENT_EVENT), requiredEvents, ValuePriorityLevel.MANDATORY); eventsReq.addInformation(nullToEmptyString(Messages.UstMemoryAnalysisModule_EventsLoadingInformation)); eventsReq.addInformation(nullToEmptyString(Messages.UstMemoryAnalysisModule_EventsLoadingExampleInformation)); TmfAnalysisRequirement domainReq = new TmfAnalysisRequirement(nullToEmptyString(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN)); domainReq.addValue(nullToEmptyString(SessionConfigStrings.CONFIG_DOMAIN_TYPE_UST), ValuePriorityLevel.MANDATORY); requirements = checkNotNull(ImmutableSet.of(domainReq, eventsReq)); fAnalysisRequirements = requirements; } return requirements; }
Source:
<code>public Response uploadImage( @PathParam("api") String api, @FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("file") final FormDataBodyPart body ) { String imageId = null; if (!body.getMediaType().getType().equals("image")) { <START> throw new UploadUnAuthorized("File format unauthorized " + body.getMediaType().getType()+"/"+body.getMediaType().getSubtype()); <END> } else if (fileDetail.getSize() > this.mediaService.getImageMaxSize()) { throw new UploadUnAuthorized("Max size achieved " + fileDetail.getSize()); } else { imageId = mediaService.saveApiImage(api, new MediaEntity( uploadedInputStream, body.getMediaType().getType(), body.getMediaType().getSubtype(), fileDetail.getFileName(), fileDetail.getSize() )); } return Response.status(200).entity(imageId).build(); }</code><technical_language>This class exist</technical_language>

Target:
public Response uploadImage( @PathParam("api") String api, @FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("file") final FormDataBodyPart body ) { String mediaId = null; if (!body.getMediaType().getType().equals("image")) { throw new UploadUnAuthorized("File format unauthorized " + body.getMediaType().getType()+"/"+body.getMediaType().getSubtype()); } else if (fileDetail.getSize() > this.mediaService.getMediaMaxSize()) { throw new UploadUnAuthorized("Max size achieved " + fileDetail.getSize()); } else { mediaId = mediaService.saveApiMedia(api, new MediaEntity( uploadedInputStream, body.getMediaType().getType(), body.getMediaType().getSubtype(), fileDetail.getFileName(), fileDetail.getSize() )); } return Response.status(200).entity(mediaId).build(); }
Source:
<code>public short getLifeVersion() { <START> return buffer.getShort(Version_Field_Size_In_Bytes); <END> }</code><technical_language>optional: change this Life_Version_Field_Offset_In_Bytes</technical_language>

Target:
public short getLifeVersion() { return buffer.getShort(Life_Version_Field_Offset_In_Bytes); }
Source:
<code>public void testNothing() throws CacheAccessException { final ServiceLocator serviceLocator = new ServiceLocator(); final CacheConfiguration<String, String> config = newCacheConfigurationBuilder().buildConfig(String.class, String.class); final Store.Provider service = serviceLocator.findService(Store.Provider.class); Collection<ServiceConfiguration<?>> serviceConfigs = config.getServiceConfigurations(); ServiceConfiguration<?>[] serviceConfigArray = serviceConfigs.toArray(new ServiceConfiguration[serviceConfigs.size()]); final Store<String, String> store = service.createStore(new StoreConfigurationImpl<String, String>(config), serviceConfigArray); @SuppressWarnings("unchecked") <START> final Cache<String, String> cache = new HeapCache<String, String>(mock(CacheConfiguration.class), store, LoggerFactory.getLogger(Ehcache.class+"CachingTierConfigurationBuilderTest")); <END> assertThat(cache, not(hasKey("key"))); cache.put("key", "value"); assertThat(cache, hasKey("key")); }</code><technical_language>Missing separator</technical_language>

Target:
public void testNothing() throws CacheAccessException { final ServiceLocator serviceLocator = new ServiceLocator(); final CacheConfiguration<String, String> config = newCacheConfigurationBuilder().buildConfig(String.class, String.class); final Store.Provider service = serviceLocator.findService(Store.Provider.class); Collection<ServiceConfiguration<?>> serviceConfigs = config.getServiceConfigurations(); ServiceConfiguration<?>[] serviceConfigArray = serviceConfigs.toArray(new ServiceConfiguration[serviceConfigs.size()]); final Store<String, String> store = service.createStore(new StoreConfigurationImpl<String, String>(config), serviceConfigArray); @SuppressWarnings("unchecked") final Cache<String, String> cache = new HeapCache<String, String>(mock(CacheConfiguration.class), store, LoggerFactory.getLogger(Ehcache.class + "-" + "CachingTierConfigurationBuilderTest")); assertThat(cache, not(hasKey("key"))); cache.put("key", "value"); assertThat(cache, hasKey("key")); }
Source:
<code>public static boolean process(final Point[] contour, List<Point> result) { int n = contour.length; if (n < 3) { return false; } int[] V = new int[n]; if (0.0f < area(contour)) { for (int v = 0; v < n; v++) { V[v] = v; } } else { for (int v = 0; v < n; v++) { V[v] = (n - 1) - v; } } int nv = n; int count = 2 * nv; for (int m = 0, v = nv - 1; nv > 2; ) { if (0 >= (count--)) { return false; } int u = v; if (nv <= u) { u = 0; } v = u + 1; if (nv <= v) { v = 0; } int w = v + 1; if (nv <= w) { w = 0; } if (snip(contour, u, v, w, nv, V)) { <START> int a, b, c, s, t; <END> a = V[u]; b = V[v]; c = V[w]; result.add(contour[a]); result.add(contour[b]); result.add(contour[c]); m++; for (s = v, t = v + 1; t < nv; s++, t++) { V[s] = V[t]; } nv--; count = 2 * nv; } } return true; }</code><technical_language>declare defined final</technical_language>

Target:
public static boolean process(final Point[] contour, List<Point> result) { int n = contour.length; if (n < 3) { return false; } int[] V = new int[n]; if (0.0f < area(contour)) { for (int v = 0; v < n; v++) { V[v] = v; } } else { for (int v = 0; v < n; v++) { V[v] = (n - 1) - v; } } int nv = n; int count = 2 * nv; for (int m = 0, v = nv - 1; nv > 2; ) { if (0 >= (count--)) { return false; } int u = v; if (nv <= u) { u = 0; } v = u + 1; if (nv <= v) { v = 0; } int w = v + 1; if (nv <= w) { w = 0; } if (snip(contour, u, v, w, nv, V)) { final int a = V[u]; final int b = V[v]; final int c = V[w]; result.add(contour[a]); result.add(contour[b]); result.add(contour[c]); m++; for (int s = v, int t = v + 1; t < nv; s++, t++) { V[s] = V[t]; } nv--; count = 2 * nv; } } return true; }
Source:
<code>private void updateSrcFileListForDupCopy(FileSystem dstFs, Path toPath, List<ReplChangeManager.FileInfo> srcFiles, long writeId, int stmtId) throws IOException { ListIterator<ReplChangeManager.FileInfo> iter = srcFiles.listIterator(); Path basePath = new Path(toPath, AcidUtils.baseOrDeltaSubdir(true, writeId, writeId, stmtId)); while (iter.hasNext()) { Path filePath = new Path(basePath, iter.next().getSourcePath().getName()); try { <START> if (dstFs.getFileStatus(filePath) != null) { <END> LOG.debug("File " + filePath + " is already present in base directory. So removing it from the list."); iter.remove(); } } catch (java.io.FileNotFoundException e) { continue; } } }</code><technical_language>fs.exists(path) method instead of getFileStatus. Then, need handle exception well</technical_language>

Target:
private void updateSrcFileListForDupCopy(FileSystem dstFs, Path toPath, List<ReplChangeManager.FileInfo> srcFiles, long writeId, int stmtId) throws IOException { FileStatus[] statuses; try { statuses = dstFs.listStatus(toPath, path -> { String fn = path.getName(); try { return dstFs.getFileStatus(path).isDirectory() && fn.startsWith(AcidUtils.BASE_PREFIX); } catch (IOException e) { LOG.error("File listing failed for " + toPath, e); throw new RuntimeException(e.getMessage()); } }); } catch (FileNotFoundException e) { LOG.debug("Path does not exist, will be created before copy", toPath); return; } if (statuses.length > 1) { LOG.info("Number of base directory in path is more than one. Duplicate check should not be done.", statuses, toPath); return; } ListIterator<ReplChangeManager.FileInfo> iter = srcFiles.listIterator(); Path basePath = new Path(toPath, AcidUtils.baseOrDeltaSubdir(true, writeId, writeId, stmtId)); while (iter.hasNext()) { Path filePath = new Path(basePath, iter.next().getSourcePath().getName()); if (dstFs.exists(filePath)) { LOG.debug("File " + filePath + " is already present in base directory. So removing it from the list."); iter.remove(); } } }
Source:
<code>private void raiseViolationOnInvalidReference(Table table) { Map<TagNode, List<String>> referenceableHeaders = findReferenceableHeadersPerColumnNode(table); for (int row = 0; row < table.rows().size(); ++row) { for (int col = 0; col < table.rows().get(row).size(); ++col) { Table.Column column = table.rows().get(row).get(col); if (column != null) { TagNode node = column.node(); if (hasHeaders(node)) { List<String> actual = getHeaders(column.node()); <START> List<String> expected = referenceableHeaders.getOrDefault(node, new ArrayList<>()); <END> for (String header : actual) { if (!expected.contains(header)) { if (isExistingHeader(table, header)) { createViolation(node.getStartLinePosition(), format("id \"%s\" in \"headers\" reference the header of another column/row.", header)); } else { createViolation(node.getStartLinePosition(), format("id \"%s\" in \"headers\" does not reference any <th> header.", header)); } break; } } } } } } }</code><technical_language>Collections.emptyList provide default</technical_language>

Target:
private void raiseViolationOnInvalidReference(Table table) { Map<TagNode, List<String>> referenceableHeaders = table.findReferenceableHeadersPerCellNode(); table.forEachCell((cell, row, column) -> { if (cell != NIL) { TagNode node = cell.node(); List<String> actual = cell.headers(); List<String> expected = referenceableHeaders.getOrDefault(node, Collections.emptyList()); for (String header : actual) { if (!expected.contains(header)) { if (isExistingHeader(table, header)) { createViolation(node.getStartLinePosition(), format("id \"%s\" in \"headers\" reference the header of another column/row.", header)); } else { createViolation(node.getStartLinePosition(), format("id \"%s\" in \"headers\" does not reference any <th> header.", header)); } break; } } } }); }
Source:
<code>public LicensedVideoSwapHistoryPageObject navigateToHistoryPage() { lvsHistoryBtn.click(); <START> PageObjectLogging.log("navigateToHistoryPage", "verify that the lvs history button navigates to right page", true); <END> return new LicensedVideoSwapHistoryPageObject(driver); }</code><technical_language>remove "verify the" logging description</technical_language>

Target:
public LicensedVideoSwapHistoryPageObject navigateToHistoryPage() { lvsHistoryBtn.click(); PageObjectLogging.log("navigateToHistoryPage", "lvs history button navigates to right page", true); return new LicensedVideoSwapHistoryPageObject(driver); }
Source:
<code>public List<CashPoint> findCashPoints(final Location location, final String name, final boolean includeRetired, PagingInfo pagingInfo) throws APIException { if (location == null) { throw new NullPointerException("The department must be defined"); } if (StringUtils.isEmpty(name)) { throw new IllegalArgumentException("The Cashpoint code must be defined."); } if (name.length() > 255) { <START> throw new IllegalArgumentException("The Cashpoint code must be less than 256 characters."); <END> } return executeCriteria(CashPoint.class, pagingInfo, new Action1<Criteria>() { @Override public void apply(Criteria criteria) { criteria.add(Restrictions.eq(HibernateCriteriaConstants.LOCATION, location)) .add(Restrictions.ilike(HibernateCriteriaConstants.NAME, name, MatchMode.START)); if (!includeRetired) { criteria.add(Restrictions.eq(HibernateCriteriaConstants.RETIRED, false)); } } }); }</code><technical_language>This called "Cash Point name"</technical_language>

Target:
public List<CashPoint> findCashPoints(final Location location, final String name, final boolean includeRetired, PagingInfo pagingInfo) throws APIException { if (location == null) { throw new IllegalArgumentException("The location must be defined"); } if (StringUtils.isEmpty(name)) { throw new IllegalArgumentException("The Cashpoint name must be defined."); } if (name.length() > 255) { throw new IllegalArgumentException("The Cashpoint name must be less than 256 characters."); } return executeCriteria(CashPoint.class, pagingInfo, new Action1<Criteria>() { @Override public void apply(Criteria criteria) { criteria.add(Restrictions.eq(HibernateCriteriaConstants.LOCATION, location)) .add(Restrictions.ilike(HibernateCriteriaConstants.NAME, name, MatchMode.START)); if (!includeRetired) { criteria.add(Restrictions.eq(HibernateCriteriaConstants.RETIRED, false)); } } }); }
Source:
<code>public void setEnvironment(String environment) { checkName(EnvironmentConstants.ENVIRONMENT, environment); if (environment != null) { if (!(EnvironmentConstants.DEVELOPMENT_ENVIRONMENT.equals(environment) || EnvironmentConstants.TEST_ENVIRONMENT.equals(environment) || EnvironmentConstants.PRODUCTION_ENVIRONMENT.equals(environment))) { throw new IllegalStateException(String.format("Unsupported environment: %s, only support %s/%s/%s, default is %s.", <START> environment <END> ,EnvironmentConstants.DEVELOPMENT_ENVIRONMENT ,EnvironmentConstants.TEST_ENVIRONMENT ,EnvironmentConstants.PRODUCTION_ENVIRONMENT ,EnvironmentConstants.PRODUCTION_ENVIRONMENT)); } } this.environment = environment; }</code><technical_language>Hi, this code style a bit strange, I suggest writing comma variable, this: java throw new IllegalStateException(String.format("Unsupported environment: %s, support %s/%s/%s, default is %s.", environment, EnvironmentConstants.DEVELOPMENT_ENVIRONMENT, EnvironmentConstants.TEST_ENVIRONMENT, EnvironmentConstants.PRODUCTION_ENVIRONMENT, EnvironmentConstants.PRODUCTION_ENVIRONMENT)); do think</technical_language>

Target:
public void setEnvironment(String environment) { checkName(Constants.ENVIRONMENT, environment); if (environment != null) { if (!(Constants.DEVELOPMENT_ENVIRONMENT.equals(environment) || Constants.TEST_ENVIRONMENT.equals(environment) || Constants.PRODUCTION_ENVIRONMENT.equals(environment))) { throw new IllegalStateException(String.format("Unsupported environment: %s, only support %s/%s/%s, default is %s.", environment, Constants.DEVELOPMENT_ENVIRONMENT, Constants.TEST_ENVIRONMENT, Constants.PRODUCTION_ENVIRONMENT, Constants.PRODUCTION_ENVIRONMENT)); } } this.environment = environment; }
Source:
<code>@Test public void antiJoinCorrelate() { tester(false, new JdbcTest.HrSchema()) .query("?") .withRel( builder -> builder .scan("s", "depts").as("d") .scan("s", "emps").as("e") .antiJoin( builder.equals( builder.field(2, "d", "deptno"), builder.field(2, "e", "deptno"))) .project( builder.field("deptno"), builder.field("name")) .sort(builder.field("deptno")) .build() <START> ) <END> .returnsUnordered( "deptno=30; name=Marketing", "deptno=40; name=HR"); }</code><technical_language>close parens line</technical_language>

Target:
@Test public void antiJoinCorrelate() { tester(false, new JdbcTest.HrSchema()) .query("?") .withRel( builder -> builder .scan("s", "depts").as("d") .scan("s", "emps").as("e") .antiJoin( builder.equals( builder.field(2, "d", "deptno"), builder.field(2, "e", "deptno"))) .project( builder.field("deptno"), builder.field("name")) .build()) .returnsUnordered( "deptno=30; name=Marketing", "deptno=40; name=HR"); }
Source:
<code>public List<Entitlement> entitleByProducts(AutobindData data) throws EntitlementRefusedException { Consumer consumer = data.getConsumer(); String[] productIds = data.getProductIds(); Collection<String> fromPools = data.getPossiblePools(); Date entitleDate = data.getOnDate(); Owner owner = consumer.getOwner(); List<Entitlement> entitlements = new LinkedList<Entitlement>(); List<PoolQuantity> bestPools = getBestPools(consumer, productIds, entitleDate, owner, null, fromPools); if (bestPools == null) { List<String> fullList = new ArrayList<String>(); fullList.addAll(Arrays.asList(productIds)); for (ConsumerInstalledProduct cip : consumer.getInstalledProducts()) { fullList.add(cip.getId()); } <START> log.warn("No entitlements available for products: " + fullList); <END> return null; } for (PoolQuantity entry : bestPools) { entitlements.add(addOrUpdateEntitlement(consumer, entry.getPool(), null, entry.getQuantity(), false, CallerType.BIND)); } return entitlements; }</code><technical_language>consumer installed products play here? I list of productIds is set requested, installed products</technical_language>

Target:
public List<Entitlement> entitleByProducts(AutobindData data) throws EntitlementRefusedException { Consumer consumer = data.getConsumer(); String[] productIds = data.getProductIds(); Collection<String> fromPools = data.getPossiblePools(); Date entitleDate = data.getOnDate(); Owner owner = consumer.getOwner(); List<Entitlement> entitlements = new LinkedList<Entitlement>(); List<PoolQuantity> bestPools = getBestPools(consumer, productIds, entitleDate, owner, null, fromPools); if (bestPools == null) { List<String> fullList = new ArrayList<String>(); fullList.addAll(Arrays.asList(productIds)); for (ConsumerInstalledProduct cip : consumer.getInstalledProducts()) { fullList.add(cip.getId()); } log.info("No entitlements available for products: " + fullList); return null; } for (PoolQuantity entry : bestPools) { entitlements.add(addOrUpdateEntitlement(consumer, entry.getPool(), null, entry.getQuantity(), false, CallerType.BIND)); } return entitlements; }
Source:
<code>@Override public void enqueue(final Callback<T> callback) { synchronized (this) { if (executed) throw new IllegalStateException("Already executed"); executed = true; } task = backgroundExecutor.submit(new Runnable() { @Override public void run() { if (behavior.calculateIsFailure()) { try { <START> Thread.sleep(behavior.calculateDelay(MILLISECONDS)); <END> } catch (InterruptedException e) { callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onFailure(new InterruptedIOException("canceled")); } }); return; } callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onFailure(behavior.failureException()); } }); } else { delegate.enqueue(new Callback<T>() { @Override public void onResponse(final Response<T> response) { long sleepMs = behavior.calculateDelay(MILLISECONDS); if (sleepMs > 0) { try { Thread.sleep(sleepMs); } catch (InterruptedException e) { callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onFailure(new InterruptedIOException("canceled")); } }); return; } } callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onResponse(response); } }); } @Override public void onFailure(final Throwable t) { long sleepMs = behavior.calculateDelay(MILLISECONDS); if (sleepMs > 0) { try { Thread.sleep(sleepMs); } catch (InterruptedException e) { callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onFailure(new InterruptedIOException("canceled")); } }); return; } } callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onFailure(t); } }); } }); } } }); }</code><technical_language>If delay is zero, bad happen</technical_language>

Target:
@Override public void enqueue(final Callback<T> callback) { synchronized (this) { if (executed) throw new IllegalStateException("Already executed"); executed = true; } task = backgroundExecutor.submit(new Runnable() { private boolean delaySleep() { long sleepMs = behavior.calculateDelay(MILLISECONDS); if (sleepMs > 0) { try { Thread.sleep(sleepMs); } catch (InterruptedException e) { callFailure(new InterruptedIOException("canceled")); return false; } } return true; } private void callResponse(final Response<T> response) { callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onResponse(response); } }); } private void callFailure(final Throwable throwable) { callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onFailure(throwable); } }); } @Override public void run() { if (canceled) { callFailure(new InterruptedIOException("canceled")); } else if (behavior.calculateIsFailure()) { if (delaySleep()) { callFailure(behavior.failureException()); } } else { delegate.enqueue(new Callback<T>() { @Override public void onResponse(final Response<T> response) { if (delaySleep()) { callResponse(response); } } @Override public void onFailure(final Throwable t) { if (delaySleep()) { callFailure(t); } } }); } } }); }
Source:
<code>public String getPath() { URI uri = fileRevision.getURI(); <START> if (uri != null) { <END> return uri.getPath(); } return getName(); }</code><technical_language>revert this unrelated formatting change</technical_language>

Target:
public String getPath() { URI uri = fileRevision.getURI(); if (uri != null) return uri.getPath(); return getName(); }
Source:
<code>private void checkDuplicates(CommandHandlingClass candidate) throws DuplicateCommandHandlerError { Set<CommandClass> candidateCommands = candidate.getCommands(); ImmutableMap.Builder<Set<CommandClass>, CommandHandlingClass> map = ImmutableMap.builder(); for (ModelClass<?> modelClass : classes.values()) { if (modelClass instanceof CommandHandlingClass) { CommandHandlingClass commandHandler = (CommandHandlingClass) modelClass; Set<CommandClass> commandClasses = commandHandler.getCommands(); <START> Sets.SetView<CommandClass> intersection = <END> Sets.intersection(commandClasses, candidateCommands); if (intersection.size() > 0) { map.put(intersection, commandHandler); } } } ImmutableMap<Set<CommandClass>, CommandHandlingClass> currentHandlers = map.build(); if (!currentHandlers.isEmpty()) { throw new DuplicateCommandHandlerError(candidate, currentHandlers); } }</code><technical_language>Collection instead</technical_language>

Target:
private void checkDuplicates(CommandHandlingClass candidate) throws DuplicateCommandHandlerError { Set<CommandClass> candidateCommands = candidate.getCommands(); ImmutableMap.Builder<Set<CommandClass>, CommandHandlingClass> map = ImmutableMap.builder(); for (ModelClass<?> modelClass : classes.values()) { if (modelClass instanceof CommandHandlingClass) { CommandHandlingClass commandHandler = (CommandHandlingClass) modelClass; Set<CommandClass> commandClasses = commandHandler.getCommands(); Set<CommandClass> intersection = intersection(commandClasses, candidateCommands); if (intersection.size() > 0) { map.put(intersection, commandHandler); } } } ImmutableMap<Set<CommandClass>, CommandHandlingClass> currentHandlers = map.build(); if (!currentHandlers.isEmpty()) { throw new DuplicateCommandHandlerError(candidate, currentHandlers); } }
Source:
<code>public Map<String, String> getAllVariables() { <START> return internalGetAllVariables(-1, Collections.emptySet()); <END> }</code><technical_language>suggestion return internalGetAllVariables(0, Collections.emptySet()); PR. version ArrayIndexOutOfBoundsException in [internalGetAllVariables:136](<LINK_0></technical_language>

Target:
public Map<String, String> getAllVariables() { return internalGetAllVariables(0, Collections.emptySet()); }
Source:
<code>public SslHandler newSSLHandler(SocketChannel channel) { <START> return newSSLHandler(channel, null); <END> }</code><technical_language>class implements RemoteEndpointAwareSSLOptions, this method get called code. throw UnsupportedOperationException AssertionError ensure this is case</technical_language>

Target:
public SslHandler newSSLHandler(SocketChannel channel) { SSLEngine engine = newSSLEngine(channel); return new SslHandler(engine); }
Source:
<code>public boolean validUrl(final String url) { if(!(url.toLowerCase().startsWith("http://") || url.toLowerCase().startsWith("https://"))){ Logger.error(this, "URL does not starts with http or https"); return false; } try { final CircuitBreakerUrl urlGetter = CircuitBreakerUrl.builder().setMethod(Method.GET).setUrl(url).build(); urlGetter.doString(); <START> } catch (Exception e) { END> return false; } return true; }</code><technical_language>handle specific !=200 case instead of catch exception, hiding real errors</technical_language>

Target:
public boolean validUrl(final String url) { if(!(url.toLowerCase().startsWith("http://") || url.toLowerCase().startsWith("https://"))){ Logger.error(this, "URL does not starts with http or https"); return false; } try { final CircuitBreakerUrl urlGetter = CircuitBreakerUrl.builder().setMethod(Method.GET).setUrl(url).build(); urlGetter.doString(); } catch (IOException | BadRequestException e) { return false; } return true; }
Source:
<code>private boolean isInCurrentOverWindow(RowData data, long time, boolean includeEqual) { long dataTime = data.getTimestamp(inputTimeFieldIndex, 3).getMillisecond(); long diff = time - dataTime; <START> return diff > 0 && order || diff == 0 && includeEqual; <END> }</code><technical_language>suggestion return (diff > 0 && order) || (diff == 0 && includeEqual); code more readable</technical_language>

Target:
private boolean isInCurrentOverWindow(RowData data, long time, boolean includeEqual) { long dataTime = data.getTimestamp(inputTimeFieldIndex, 3).getMillisecond(); long diff = time - dataTime; return (diff > 0 && asc) || (diff == 0 && includeEqual); }
Source:
<code>public void assertXmlApiMatchesExpected() { try { FreeStyleProject project = createJobWithWorkspaceFile("checkstyleregextest.xml"); enableWarningsWithCheckstyle(project); String buildNumber = String.valueOf(project.getNextBuildNumber()); scheduleBuild(project); XmlPage page = j.createWebClient().goToXml(project.getUrl() + buildNumber + "/checkstyleResult/api/xml"); Document test = page.getXmlDocument(); test = removeRunSpecificXmlNodes(test); Document control = loadControlDocumentFromFile("checkstyleregextest_output.xml"); Diff diff = XMLUnit.compareXML(control, test); assertThat(diff.identical()); } <START> catch (IOException | SAXException e) { <END> e.printStackTrace(); } }</code><technical_language>try catch entfernen und j.createWebClient().goToXml(project.getUrl() + buildNumber + "/checkstyleResult/api/xml") in Methode auslagern die try-catch hat und im Falle einer Exception einen AssertionError wirft</technical_language>

Target:
public void assertXmlApiMatchesExpected() { FreeStyleProject project = createJobWithWorkspaceFile("checkstyleregextest.xml"); enableWarningsWithCheckstyle(project); String buildNumber = String.valueOf(buildProjectAndReturnBuildNo(project)); XmlPage page = getXmlPage(project, buildNumber, "/checkstyleResult/api/xml"); Document test = page.getXmlDocument(); test = removeRunSpecificXmlNodes(test); Document control = loadControlDocumentFromFile("checkstyleregextest_output.xml"); XMLUnit.setIgnoreWhitespace(true); Diff diff = XMLUnit.compareXML(control, test); assertThat(diff.identical()).isTrue(); }
Source:
<code>public static void openModelElement(final Object modelElement, ECPProject ecpProject) { openModelElement(modelElement, ecpProject, <START> null); <END> }</code><technical_language>instead of Null, I hand empty map. This avoid NPEs in ModelElementOpeneWithContext</technical_language>

Target:
public static void openModelElement(final Object modelElement, ECPProject ecpProject) { openModelElement(modelElement, ecpProject, new LinkedHashMap<Object, Object>()); }
Source:
<code>public static void main(String[] args) throws Exception { QAargs qaArgs = new QAargs(); CmdLineParser parser = new CmdLineParser(qaArgs, ParserProperties.defaults().withUsageWidth(90)); try { parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); System.err.println("Example: RetrieveSentences" + parser.printExample(OptionHandlerFilter.REQUIRED)); return; } if (qaArgs.topics.isEmpty() && qaArgs.query.isEmpty()){ System.err.println("Pass either a query or a topic. Both can't be empty."); return; } RetrieveSentences rs = new RetrieveSentences(); rs.retrieveDocuments(qaArgs); rs.computeIDF(qaArgs); Map<String, Double> sentences = rs.computeIDF(qaArgs); Map.Entry<String, Double> maxEntry = null; for (Map.Entry<String, Double> entry : sentences.entrySet()) <START> { <END> if (maxEntry == null || entry.getValue().compareTo(maxEntry.getValue()) > 0) { maxEntry = entry; } } System.out.println("Answer: " + maxEntry.getKey()); }</code><technical_language>braces w/ previous line</technical_language>

Target:
public static void main(String[] args) throws Exception { Args qaArgs = new Args(); CmdLineParser parser = new CmdLineParser(qaArgs, ParserProperties.defaults().withUsageWidth(90)); try { parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); System.err.println("Example: RetrieveSentences" + parser.printExample(OptionHandlerFilter.REQUIRED)); return; } if (qaArgs.topics.isEmpty() && qaArgs.query.isEmpty()){ System.err.println("Pass either a query or a topic. Both can't be empty."); return; } RetrieveSentences rs = new RetrieveSentences(qaArgs); rs.retrieveDocuments(qaArgs); rs.getRankedPassages(qaArgs); }
Source:
<code>private List<Change> getRefsForContentAssist() throws InvocationTargetException, InterruptedException { if (changeRefs == null) { final String uriText = uriCombo.getText(); getContainer().run(true, true, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { ListRemoteOperation listOp; try { listOp = new ListRemoteOperation( repository, new URIish(uriText), Activator .getDefault() .getPreferenceStore() .getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT)); } catch (URISyntaxException e) { throw new InvocationTargetException(e); } listOp.run(monitor); changeRefs = new ArrayList<>(); for (Ref ref : listOp.getRemoteRefs()) { Change change = Change.fromRef(ref.getName()); if (change != null) changeRefs.add(change); } Collections.sort(changeRefs, <START> Collections.reverseOrder()); <END> } }); } return changeRefs; }</code><technical_language>this improvement is unrelated this change, move a separate change</technical_language>

Target:
private List<Change> getRefsForContentAssist() throws InvocationTargetException, InterruptedException { if (changeRefs == null) { final String uriText = uriCombo.getText(); getContainer().run(true, true, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { ListRemoteOperation listOp; try { listOp = new ListRemoteOperation( repository, new URIish(uriText), Activator .getDefault() .getPreferenceStore() .getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT)); } catch (URISyntaxException e) { throw new InvocationTargetException(e); } listOp.run(monitor); changeRefs = new ArrayList<>(); for (Ref ref : listOp.getRemoteRefs()) { Change change = Change.fromRef(ref.getName()); if (change != null) changeRefs.add(change); } Collections.sort(changeRefs, new Comparator<Change>() { @Override public int compare(Change o1, Change o2) { int changeDiff = o2.changeNumber .compareTo(o1.changeNumber); if (changeDiff == 0) changeDiff = o2 .getPatchSetNumber() .compareTo( o1.getPatchSetNumber()); return changeDiff; } }); } }); } return changeRefs; }
Source:
<code>public Object execute() { final List<NamedMetricSet> metricSets = NamedMetricSet.getNamedMetricSetsInContext(bundleContext); if (metricSets.size() < 1) { System.out.println("(No metric sets are currently available.)"); return null; } for (NamedMetricSet namedMetricSet : metricSets) { System.out.printf("Metric set: %s\n", namedMetricSet.getName()); if (namedMetricSet.hasDescription()) { System.out.printf("\t%s\n", namedMetricSet.getDescription()); } } <START> System.out.println(); <END> return null; }</code><technical_language>print metrics in line instead of splitting them? I imagine this: Name Description Flows Description of metric ... ..</technical_language>

Target:
public Object execute() { final List<NamedMetricSet> metricSets = NamedMetricSet.getNamedMetricSetsInContext(bundleContext); if (metricSets.size() < 1) { System.out.println("(No metric sets are currently available.)"); return null; } System.out.println("Name\tDescription"); for (NamedMetricSet namedMetricSet : metricSets) { System.out.printf("%s\t%s\n", namedMetricSet.getName(), namedMetricSet.hasDescription() ? namedMetricSet.getDescription() : "(No description)"); } System.out.println(); return null; }
Source:
<code>protected Map<String, String> getExternalAddressesAndPorts(ContainerInfo containerInfo, String internalHost) { RenderingEvaluation renderingEvaluation = getOnlineRenderingEvaluation(containerInfo, internalHost); <START> <END> Map<String, List<PortBinding>> ports = containerInfo.getNetworkSettings().getPorts(); if (isNullOrEmpty(cheDockerCustomExternalTemplate)) { return getExposedPortsToAddressPorts(renderingEvaluation.getExternalAddress(), ports, false); } else { return ports.keySet().stream() .collect(Collectors.toMap(portKey -> portKey, portKey -> renderingEvaluation.render(cheDockerCustomExternalTemplate, portKey))); } }</code><technical_language>this part of PR</technical_language>

Target:
protected Map<String, String> getExternalAddressesAndPorts(ContainerInfo containerInfo, String internalHost) { RenderingEvaluation renderingEvaluation = getOnlineRenderingEvaluation(containerInfo, internalHost); Map<String, List<PortBinding>> ports = containerInfo.getNetworkSettings().getPorts(); if (isNullOrEmpty(cheDockerCustomExternalTemplate)) { return getExposedPortsToAddressPorts(renderingEvaluation.getExternalAddress(), ports, false); } return ports.keySet().stream() .collect(Collectors.toMap(portKey -> portKey, portKey -> renderingEvaluation.render(cheDockerCustomExternalTemplate, portKey))); }
Source:
<code>public void testNameSampleSerDe() throws IOException { NameSample nameSample = createGoldSample(); <START> String fileName = "file.ser"; <END> try (FileOutputStream fileOutputStream = new FileOutputStream(tempDirectory.newFile(fileName))) { ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream); objectOutputStream.writeObject(nameSample); objectOutputStream.close(); } NameSample deSerializedNameSample = null; try (FileInputStream fileInputStream = new FileInputStream(new File(tempDirectory.getRoot(), fileName))) { ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream); deSerializedNameSample = (NameSample) objectInputStream.readObject(); } catch (ClassNotFoundException cfe) { } Assert.assertNotNull(deSerializedNameSample); Assert.assertEquals(nameSample.getId(), deSerializedNameSample.getId()); Assert.assertArrayEquals(nameSample.getNames(), deSerializedNameSample.getNames()); Assert.assertArrayEquals(nameSample.getSentence(), deSerializedNameSample.getSentence()); Assert.assertArrayEquals(nameSample.getAdditionalContext(), deSerializedNameSample.getAdditionalContext()); }</code><technical_language>write this a ByteArrayOutputStream ?</technical_language>

Target:
public void testNameSampleSerDe() throws IOException { NameSample nameSample = createGoldSample(); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(byteArrayOutputStream); out.writeObject(nameSample); out.flush(); byte[] bytes = byteArrayOutputStream.toByteArray(); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); ObjectInput objectInput = new ObjectInputStream(byteArrayInputStream); NameSample deSerializedNameSample = null; try { deSerializedNameSample = (NameSample) objectInput.readObject(); } catch (ClassNotFoundException e) { } Assert.assertNotNull(deSerializedNameSample); Assert.assertArrayEquals(nameSample.getSentence(), deSerializedNameSample.getSentence()); Assert.assertArrayEquals(nameSample.getNames(), deSerializedNameSample.getNames()); Assert.assertArrayEquals(nameSample.getAdditionalContext(), deSerializedNameSample.getAdditionalContext()); }
Source:
<code>@Override public Object invoke(MethodInvocation invocation) throws Throwable { Method method = invocation.getMethod(); if (method == null) { return invocation.proceed(); } Method mostSpecificMethod = AopUtils .getMostSpecificMethod(method, invocation.getThis().getClass()); NewSpan newSpan = SleuthAnnotationUtils.findAnnotation(mostSpecificMethod, NewSpan.class); ContinueSpan continueSpan = SleuthAnnotationUtils.findAnnotation(mostSpecificMethod, ContinueSpan.class); if (newSpan == null && continueSpan == null) { return invocation.proceed(); } Span span = tracer().getCurrentSpan(); String log = log(newSpan, continueSpan); boolean hasLog = StringUtils.hasText(log); try { if (newSpan != null) { span = spanCreator().createSpan(invocation, newSpan); } if (hasLog) { spanTagAnnotationHandler().addAnnotatedParameters(invocation); span.logEvent(log + ".start"); } return invocation.proceed(); } finally { if (span != null) { if (hasLog) { <START> span.logEvent(log + ".end"); <END> } if (newSpan != null) { tracer().close(span); } } } }</code><technical_language>If event name suggested accomplished act e.g. igredientsReceived strange events igredientsReceived.start igredientsReceived.end. log optional equal method name default @ContinueSpan ingridientService.receiveIngridients() produce events receiveIngridients.start receiveIngridients.end</technical_language>

Target:
public Object invoke(MethodInvocation invocation) throws Throwable { Method method = invocation.getMethod(); if (method == null) { return invocation.proceed(); } Method mostSpecificMethod = AopUtils .getMostSpecificMethod(method, invocation.getThis().getClass()); NewSpan newSpan = SleuthAnnotationUtils.findAnnotation(mostSpecificMethod, NewSpan.class); ContinueSpan continueSpan = SleuthAnnotationUtils.findAnnotation(mostSpecificMethod, ContinueSpan.class); if (newSpan == null && continueSpan == null) { return invocation.proceed(); } Span span = tracer().getCurrentSpan(); String log = log(continueSpan); boolean hasLog = StringUtils.hasText(log); try { if (newSpan != null) { span = spanCreator().createSpan(invocation, newSpan); } if (hasLog) { logEvent(span, log + ".before"); } spanTagAnnotationHandler().addAnnotatedParameters(invocation); return invocation.proceed(); } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Exception occurred while trying to continue the pointcut", e); } if (hasLog) { logEvent(span, log + ".afterFailure"); } tracer().addTag(Span.SPAN_ERROR_TAG_NAME, ExceptionUtils.getExceptionMessage(e)); throw e; } finally { if (span != null) { if (hasLog) { logEvent(span, log + ".after"); } if (newSpan != null) { tracer().close(span); } } } }
Source:
<code>public void afterSuite() throws IOException { for (ObjectName mbean : _server.queryNames(null, null)) { try { _server.unregisterMBean(mbean); } catch (Exception e) { } } _gSetupTool.close(); _baseAccessor.close(); _gZkClient.close(); TestHelper.stopZkServer(_zkServer); if (System.getProperty(MULTI_ZK_PROPERTY_KEY) != null) { <START> for (int i = 0; i < _numZk; i++) { if (_baseDataAccessorMap != null && _baseDataAccessorMap.containsKey(i)) { _baseDataAccessorMap.get(i).close(); } if (_clusterSetupMap != null && _clusterSetupMap.containsKey(i)) { _clusterSetupMap.get(i).close(); } if (_helixZkClientMap != null && _helixZkClientMap.containsKey(i)) { _helixZkClientMap.get(i).close(); } if (_zkServerMap != null && _zkServerMap.containsKey(i)) { TestHelper.stopZkServer(_zkServerMap.get(i)); } <END> } } }</code><technical_language>Nit: values() close get() checking time</technical_language>

Target:
public void afterSuite() throws IOException { for (ObjectName mbean : _server.queryNames(null, null)) { try { _server.unregisterMBean(mbean); } catch (Exception e) { } } _baseDataAccessorMap.values().forEach(BaseDataAccessor::close); _clusterSetupMap.values().forEach(ClusterSetup::close); _helixZkClientMap.values().forEach(HelixZkClient::close); _zkServerMap.values().forEach(TestHelper::stopZkServer); }
Source:
<code>public boolean areAckedBookiesAdheringToPlacementPolicy(Set<BookieSocketAddress> ackedBookies, int writeQuorumSize, int ackQuorumSize) { HashSet<String> rackCounter = new HashSet<>(); int minWriteQuorumNumRacksPerWriteQuorum = Math.min(writeQuorumSize, minNumRacksPerWriteQuorum); ReentrantReadWriteLock.ReadLock readLock = rwLock.readLock(); readLock.lock(); try { for (BookieSocketAddress bookie : ackedBookies) { try { rackCounter.add(knownBookies.get(bookie).getNetworkLocation()); <START> } catch (Exception e) { <END> LOG.warn("Received exception while trying to get network location of bookie: {}", bookie, e); } } if (LOG.isDebugEnabled()) { LOG.debug("areAckedBookiesAdheringToPlacementPolicy returning because number of racks = and " + "minNumRacksPerWriteQuorum = {}", rackCounter.size() >= minNumRacksPerWriteQuorum, rackCounter.size(), minNumRacksPerWriteQuorum); } } finally { readLock.unlock(); } return rackCounter.size() >= minWriteQuorumNumRacksPerWriteQuorum; }</code><technical_language>Nit: catch a generic Exception</technical_language>

Target:
public boolean areAckedBookiesAdheringToPlacementPolicy(Set<BookieSocketAddress> ackedBookies, int writeQuorumSize, int ackQuorumSize) { HashSet<String> rackCounter = new HashSet<>(); int minWriteQuorumNumRacksPerWriteQuorum = Math.min(writeQuorumSize, minNumRacksPerWriteQuorum); ReentrantReadWriteLock.ReadLock readLock = rwLock.readLock(); readLock.lock(); try { for (BookieSocketAddress bookie : ackedBookies) { rackCounter.add(knownBookies.get(bookie).getNetworkLocation()); } if (LOG.isDebugEnabled()) { LOG.debug("areAckedBookiesAdheringToPlacementPolicy returning because number of racks = and " + "minNumRacksPerWriteQuorum = {}", rackCounter.size() >= minNumRacksPerWriteQuorum, rackCounter.size(), minNumRacksPerWriteQuorum); } } finally { readLock.unlock(); } return rackCounter.size() >= minWriteQuorumNumRacksPerWriteQuorum; }
Source:
<code>protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { boolean acceptBasicAuth = (boolean) request.getSession().getServletContext().getAttribute(SSOUtils.ACCEPT_BASIC_AUTH_HEADERS); <START> if (acceptBasicAuth) { <END> response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_BASIC_URI); } else { response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_PHASE3_URI); } }</code><technical_language>redirect basic if need prompt for basic accept. remember? accept headers force 401 in servlet. paths. of if prompt accept..</technical_language>

Target:
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { SSOConfig config = (SSOConfig) request.getServletContext().getAttribute(SSOUtils.SSO_CONFIG); if (config.isEnableBasicAuth()) { response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_BASIC_URI); } else { response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_PHASE3_URI); } }
Source:
<code>public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); try { response = urlopen.open("<LINK_0>"); Matcher matcher; Matcher matcher_b; matcher = reAccounts.matcher(response); while (matcher.find()) { if ("".equals(matcher.group(1))) { continue; } matcher_b = reBalance.matcher(matcher.group(2)); if (matcher_b.find()) { String balanceString = matcher_b.group(2).replaceAll("\\<a[^>]*>","").replaceAll("\\<[^>]*>","").trim(); accounts.add(new Account(Html.fromHtml(matcher.group(1)).toString().trim() , Helpers.parseBalance(balanceString), matcher.group(1))); balance = balance.add(Helpers.parseBalance(balanceString)); } } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } <START> } finally { <END> super.updateComplete(); } }</code><technical_language>remove finally {</technical_language>

Target:
public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); response = urlopen.open("<LINK_0>"); Matcher matcher; Matcher matcher_b; matcher = reAccounts.matcher(response); while (matcher.find()) { if ("".equals(matcher.group(1))) { continue; } matcher_b = reBalance.matcher(matcher.group(2)); if (matcher_b.find()) { String balanceString = matcher_b.group(2).replaceAll("\\<a[^>]*>","").replaceAll("\\<[^>]*>","").trim(); accounts.add(new Account(Html.fromHtml(matcher.group(1)).toString().trim() , Helpers.parseBalance(balanceString), matcher.group(1))); balance = balance.add(Helpers.parseBalance(balanceString)); } } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } super.updateComplete(); }
Source:
<code>private ListenableFuture<Void> writeNGramsIndex(final NGramGenerator ngrams, final CassandraLabelId labelId, final LabelType type) { List<ResultSetFuture> list = new ArrayList<>(); while (ngrams.hasNext()) { final String nGram = ngrams.next(); ResultSetFuture result = session.executeAsync(createNGramStatement.bind() .setString(0, nGram) .setString(1, type.toValue()) .setLong(2, CassandraLabelId.toLong(labelId))); addCallback(result, new FutureCallback<ResultSet>() { @Override public void onSuccess(final ResultSet result) { } @Override public void onFailure(final Throwable throwable) { <START> LOG.error("Write of ngram with id of type {}", nGram, labelId, type); <END> } }); list.add(result); } return transform(allAsList(list), new ToVoidFunction()); }</code><technical_language>add word failed end of log message log throwable (add end of call interpolation symbol in message)</technical_language>

Target:
private ListenableFuture<Void> writeNGramsIndex(final NGramGenerator ngrams, final CassandraLabelId labelId, final LabelType type) { final List<ResultSetFuture> list = new ArrayList<>(); while (ngrams.hasNext()) { final String nGram = ngrams.next(); final ResultSetFuture result = session.executeAsync(createNGramStatement.bind() .setString(0, nGram) .setString(1, type.toValue()) .setLong(2, CassandraLabelId.toLong(labelId))); addCallback(result, new FutureCallback<ResultSet>() { @Override public void onSuccess(final ResultSet result) { } @Override public void onFailure(final Throwable throwable) { LOG.error("Write of n-gram with id of type failed", nGram, labelId, type, throwable); } }); list.add(result); } return transform(allAsList(list), new ToVoidFunction()); }