auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void invokesCallbackOnClose() { Runnable callback = mock(Runnable.class); snapshotTransactionManager.registerClosingCallback(callback); <START> snapshotTransactionManager.close(); <END> verify(callback, times(1)).run(); }</code><technical_language>nit: verify(callback, never()).run() this</technical_language>

Target:
public void invokesCallbackOnClose() { Runnable callback = mock(Runnable.class); snapshotTransactionManager.registerClosingCallback(callback); verify(callback, never()).run(); snapshotTransactionManager.close(); verify(callback).run(); }
Source:
<code>StructBatchStreamReader(Type type, StreamDescriptor streamDescriptor, DateTimeZone hiveStorageTimeZone) throws OrcCorruptionException { requireNonNull(type, "type is null"); verifyStreamType(streamDescriptor, type, RowType.class::isInstance); this.type = (RowType) type; this.streamDescriptor = requireNonNull(streamDescriptor, "stream is null"); <START> Map<String, StreamDescriptor> nestedStreams = streamDescriptor.getNestedStreams().stream() <END> .collect(toImmutableMap(stream -> stream.getFieldName().toLowerCase(Locale.ENGLISH), stream -> stream)); ImmutableList.Builder<String> fieldNames = ImmutableList.builder(); ImmutableMap.Builder<String, BatchStreamReader> structFields = ImmutableMap.builder(); for (Field field : this.type.getFields()) { String fieldName = field.getName() .orElseThrow(() -> new IllegalArgumentException("ROW type does not have field names declared: " + type)) .toLowerCase(Locale.ENGLISH); fieldNames.add(fieldName); StreamDescriptor fieldStream = nestedStreams.get(fieldName); if (fieldStream != null) { structFields.put(fieldName, createStreamReader(field.getType(), fieldStream, hiveStorageTimeZone)); } } this.fieldNames = fieldNames.build(); this.structFields = structFields.build(); }</code><technical_language>Maps.uniqueIndex Map<String, StreamDescriptor> nestedStreams = Maps.uniqueIndex(streamDescriptor.getNestedStreams(), stream -> stream.getFieldName().toLowerCase(Locale.ENGLISH));</technical_language>

Target:
StructBatchStreamReader(Type type, StreamDescriptor streamDescriptor, DateTimeZone hiveStorageTimeZone) throws OrcCorruptionException { requireNonNull(type, "type is null"); verifyStreamType(streamDescriptor, type, RowType.class::isInstance); this.type = (RowType) type; this.streamDescriptor = requireNonNull(streamDescriptor, "stream is null"); Map<String, StreamDescriptor> nestedStreams = Maps.uniqueIndex( streamDescriptor.getNestedStreams(), stream -> stream.getFieldName().toLowerCase(Locale.ENGLISH)); ImmutableList.Builder<String> fieldNames = ImmutableList.builder(); ImmutableMap.Builder<String, BatchStreamReader> structFields = ImmutableMap.builder(); for (Field field : this.type.getFields()) { String fieldName = field.getName() .orElseThrow(() -> new IllegalArgumentException("ROW type does not have field names declared: " + type)) .toLowerCase(Locale.ENGLISH); fieldNames.add(fieldName); StreamDescriptor fieldStream = nestedStreams.get(fieldName); if (fieldStream != null) { structFields.put(fieldName, createStreamReader(field.getType(), fieldStream, hiveStorageTimeZone)); } } this.fieldNames = fieldNames.build(); this.structFields = structFields.build(); }
Source:
<code>public IndexBuilder fillIndexBuilder(final Path path) throws Exception { try (final InputStream inputStream = ioService.newInputStream(path, StandardOpenOption.READ)) { DecisionTableConfiguration configuration = KnowledgeBuilderFactory.newDecisionTableConfiguration(); <START> configuration.setInputType( DecisionTableInputType.XLS ); <END> final String drl = DecisionTableFactory.loadFromInputStream(inputStream, configuration); return fillDrlIndexBuilder(path, drl); } }</code><technical_language>please DecisionTableInputType.XLSX</technical_language>

Target:
public IndexBuilder fillIndexBuilder(final Path path) throws Exception { try (final InputStream inputStream = ioService.newInputStream(path, StandardOpenOption.READ)) { DecisionTableConfiguration configuration = KnowledgeBuilderFactory.newDecisionTableConfiguration(); configuration.setInputType( DecisionTableInputType.XLSX ); final String drl = DecisionTableFactory.loadFromInputStream(inputStream, configuration); return fillDrlIndexBuilder(path, drl); } }
Source:
<code>public void addSearchCountsQueries(final List<String> urls) { for (String urlStr : urls) { try { URL url = new URL(urlStr); Map<String, List<String>> params = Util.getQueryParams(url); List<String> projects = params.get("project"); for (String field : QueryBuilder.searchFields) { List<String> fieldQueryText = params.get(field); if (fieldQueryText == null || fieldQueryText.isEmpty()) { continue; } if (fieldQueryText.size() > 2) { <START> logger.log(Level.WARNING, "Bad format, ignoring"); <END> continue; } String value = fieldQueryText.get(0); Query q = null; try { q = getQuery(field, value); } catch (ParseException e) { logger.log(Level.FINE, "Bad request", e); } if (q != null) { suggester.onSearch(projects, q); } } } catch (MalformedURLException e) { logger.log(Level.WARNING, "Could not add search counts for " + urlStr, e); } } }</code><technical_language>log actual bad data</technical_language>

Target:
public void addSearchCountsQueries(final List<String> urls) { for (String urlStr : urls) { try { URL url = new URL(urlStr); Map<String, List<String>> params = Util.getQueryParams(url); List<String> projects = params.get("project"); for (String field : QueryBuilder.searchFields) { List<String> fieldQueryText = params.get(field); if (fieldQueryText == null || fieldQueryText.isEmpty()) { continue; } if (fieldQueryText.size() > 2) { logger.log(Level.WARNING, "Bad format, ignoring {0}", urlStr); continue; } String value = fieldQueryText.get(0); Query q = null; try { q = getQuery(field, value); } catch (ParseException e) { logger.log(Level.FINE, "Bad request", e); } if (q != null) { suggester.onSearch(projects, q); } } } catch (MalformedURLException e) { logger.log(Level.WARNING, "Could not add search counts for " + urlStr, e); } } }
Source:
<code>public void openPath() throws IOException { final Path path = localBam.toPath(); final SamReader reader = SamReaderFactory.makeDefault().open(path); LOG.info(String.format("Reading from %s ...", path)); final List<SAMRecord> slurped = Iterables.slurp(reader); final SAMFileHeader fileHeader = reader.getFileHeader(); reader.hasIndex(); reader.indexing().hasBrowseableIndex(); reader.close(); observedHeaders.add(fileHeader); observedRecordOrdering.add(slurped); Assert.assertEquals(observedHeaders.size(), 1, "read different headers than other testcases"); <START> Assert.assertEquals(observedRecordOrdering.size(), 1, "read different records than other testcases"); <END> }</code><technical_language>This test is meaningful if run _before_ exhaustInputResourcePermutation() populated observedHeaders observedRecordOrdering instead of it. This is a problem TestNG default randomizes test ordering</technical_language>

Target:
public void openPath() throws IOException { final Path path = localBam.toPath(); final List<SAMRecord> records; final SAMFileHeader fileHeader; try (final SamReader reader = SamReaderFactory.makeDefault().open(path)) { LOG.info(String.format("Reading from %s ...", path)); records = Iterables.slurp(reader); fileHeader = reader.getFileHeader(); reader.close(); } try (final SamReader fileReader = SamReaderFactory.makeDefault().open(localBam)) { final List<SAMRecord> expectedRecords = Iterables.slurp(fileReader); final SAMFileHeader expectedFileHeader = fileReader.getFileHeader(); Assert.assertEquals(records, expectedRecords); Assert.assertEquals(fileHeader, expectedFileHeader); } }
Source:
<code><START> public Map<String, Object> getMovingAverages(final String id) <END> { log.debug("GetMovingAverages task[%s]", id); try { final FullResponseHolder response = submitRequest( id, HttpMethod.GET, "rowStats", null, true ); return response.getContent() == null || response.getContent().isEmpty() ? null : jsonMapper.readValue(response.getContent(), new TypeReference<Map<String, Object>>() { }); } catch (NoTaskLocationException e) { return null; } catch (IOException e) { throw Throwables.propagate(e); } }</code><technical_language>add nullable annotation</technical_language>

Target:
public Map<String, Object> getMovingAverages(final String id) { log.debug("GetMovingAverages task[%s]", id); try { final FullResponseHolder response = submitRequest( id, HttpMethod.GET, "rowStats", null, true ); return response.getContent() == null || response.getContent().isEmpty() ? Collections.emptyMap() : jsonMapper.readValue(response.getContent(), JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT); } catch (NoTaskLocationException e) { return Collections.emptyMap(); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>public TransportConfiguration[] getTransportConfigurations(final List<String> connectorNames) { TransportConfiguration[] tcConfigs = (TransportConfiguration[]) Array.newInstance(TransportConfiguration.class, connectorNames.size()); int count = 0; for (String connectorName : connectorNames) { TransportConfiguration connector = getConnectorConfigurations().get(connectorName); if (connector == null) { <START> ActiveMQServerLogger.LOGGER.connectionConfigurationIsNull(); <END> return null; } tcConfigs[count++] = connector; } return tcConfigs; }</code><technical_language>supply connector name in log output, if connector is found, connector name is looked is missing</technical_language>

Target:
public TransportConfiguration[] getTransportConfigurations(final List<String> connectorNames) { TransportConfiguration[] tcConfigs = (TransportConfiguration[]) Array.newInstance(TransportConfiguration.class, connectorNames.size()); int count = 0; for (String connectorName : connectorNames) { TransportConfiguration connector = getConnectorConfigurations().get(connectorName); if (connector == null) { ActiveMQServerLogger.LOGGER.connectionConfigurationIsNull(connectorName == null ? "null" : connectorName); return null; } tcConfigs[count++] = connector; } return tcConfigs; }
Source:
<code>private static String getLogEntriesAsString(String startTimestamp) { <START> String filter = "resource.type=\"cloud_function\""; filter += " AND severity=INFO"; filter += " AND resource.labels.function_name=" + FUNCTION_DEPLOYED_NAME; filter += String.format(" AND timestamp>=\"%s\"", startTimestamp); <END> Page<LogEntry> logEntries = loggingClient.listLogEntries( Logging.EntryListOption.filter(filter), Logging.EntryListOption.sortOrder(Logging.SortingField.TIMESTAMP, Logging.SortingOrder.DESCENDING) ); String logsConcat = StreamSupport.stream(logEntries.getValues().spliterator(), false) .map((x) -> x.toString()) .collect(Collectors.joining("%n")); return logsConcat; }</code><technical_language>suggestion String filter = "resource.type=\"cloud_function\"" + " severity=INFO" + " resource.labels.function_name=" + FUNCTION_DEPLOYED_NAME + String.format(" timestamp>=\"%s\"", startTimestamp);</technical_language>

Target:
private static String getLogEntriesAsString(String startTimestamp) { String filter = "resource.type=\"cloud_function\"" + " AND severity=INFO" + " AND resource.labels.function_name=" + FUNCTION_DEPLOYED_NAME + String.format(" AND timestamp>=\"%s\"", startTimestamp); Page<LogEntry> logEntries = loggingClient.listLogEntries( Logging.EntryListOption.filter(filter), Logging.EntryListOption.sortOrder( Logging.SortingField.TIMESTAMP, Logging.SortingOrder.DESCENDING) ); String logsConcat = StreamSupport.stream(logEntries.getValues().spliterator(), false) .map((x) -> x.toString()) .collect(Collectors.joining("%n")); return logsConcat; }
Source:
<code>public void testNoViableAltException() throws IOException { try { DetailNodeTreeStringPrinter.printFileAst(new File(getPath( "InputNoViableAltException.javadoc"))); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage() <START> .contains("ERROR:0] Javadoc comment at column 9 has parse error. " <END> + "Details: no viable alternative at input ' <<' " + "while parsing JAVADOC_TAG")); } }</code><technical_language>[ is missed</technical_language>

Target:
public void testNoViableAltException() throws Exception { try { DetailNodeTreeStringPrinter.printFileAst(new File(getPath( "InputNoViableAltException.javadoc"))); } catch (IllegalArgumentException ex) { final String expected = (String) GET_PARSE_ERROR_MESSAGE.invoke(null, new ParseErrorMessage(0, MSG_JAVADOC_PARSE_RULE_ERROR, 9, "no viable alternative at input ' <<'", "JAVADOC_TAG")); assertEquals("Generated and expected parse error messages don't match", expected, ex.getMessage()); } }
Source:
<code>private long getPackedObjectSize(WindowCursor curs, AnyObjectId id) { PackList pList; do { pList = packList.get(); SEARCH: for (;;) { for (PackFile p : pList.packs) { try { long len = p.getObjectSize(curs, id); if (0 <= len) return len; } catch (PackMismatchException e) { PackList nList = scanPacks(pList); if (pList != nList) { <START> pList = nList; <END> continue SEARCH; } } catch (IOException e) { removePack(p); } } break SEARCH; } } while (searchPacksAgain(pList)); return -1; }</code><technical_language>above: searchPacksAgain</technical_language>

Target:
private long getPackedObjectSize(WindowCursor curs, AnyObjectId id) { PackList pList; do { SEARCH: for (;;) { pList = packList.get(); for (PackFile p : pList.packs) { try { long len = p.getObjectSize(curs, id); if (0 <= len) return len; } catch (PackMismatchException e) { if (searchPacksAgain(pList)) continue SEARCH; } catch (IOException e) { removePack(p); } } break SEARCH; } } while (searchPacksAgain(pList)); return -1; }
Source:
<code>public Tenant getTenant(String tenantUniqueID) throws TenantMgtException { TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager(); Tenant tenant; try { tenant = tenantManager.getTenant(tenantUniqueID); } catch (org.wso2.carbon.user.api.UserStoreException e) { throw new TenantManagementServerException("Error while getting the tenant.", e); } <START> String userId = getClaimValue(tenant.getAdminName(), UserCoreClaimConstants.USER_ID_CLAIM_URI, tenant.getId()); <END> tenant.setAdminUserId(userId); return tenant; }</code><technical_language>populate this in TenantManager level</technical_language>

Target:
public Tenant getTenant(String tenantUniqueID) throws TenantMgtException { TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager(); Tenant tenant; try { tenant = tenantManager.getTenant(tenantUniqueID); } catch (org.wso2.carbon.user.api.UserStoreException e) { throw new TenantManagementServerException("Error while getting the tenant.", e); } return tenant; }
Source:
<code>private Result executeCmd(String cmd) throws IOException, InterruptedException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); TeeOutputStream stdout = new TeeOutputStream(listener.getLogger(), baos); PrintStream stderr = listener.getLogger(); KeyMaterial key = null; try { key = registry.materialize(build); EnvVars env = new EnvVars(); env.putAll(build.getEnvironment(listener)); env.putAll(key.env()); boolean result = launcher.launch() .envs(env) .pwd(build.getWorkspace()) .stdout(stdout) .stderr(stderr) .cmdAsSingleString(cmd) .start().join() == 0; <START> return new Result(result, baos.toString("UTF8")); <END> } finally { if (key != null) { key.close(); } } }</code><technical_language>UTF-8? unsure if this work platforms UTF-8 platform encoding</technical_language>

Target:
private Result executeCmd(String cmd) throws IOException, InterruptedException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); TeeOutputStream stdout = new TeeOutputStream(listener.getLogger(), baos); PrintStream stderr = listener.getLogger(); boolean result = launcher.launch() .envs(build.getEnvironment(listener)) .pwd(build.getWorkspace()) .stdout(stdout) .stderr(stderr) .cmdAsSingleString(cmd) .start().join() == 0; String stdoutStr = null; try { Computer computer = Computer.currentComputer(); if (computer != null) { Charset charset = computer.getDefaultCharset(); if (charset != null) { baos.flush(); stdoutStr = baos.toString(charset.name()); } } } catch (UnsupportedEncodingException e) { logger.log(Level.FINE, "Unable to get stdout from launched command: {}", e); } finally { IOUtils.closeQuietly(baos); } return new Result(result, stdoutStr); }
Source:
<code>private URI storePackage(String storageId, String repositoryId, InputStream is) throws Exception { String path; NuspecFile nuspecFile; <START> byte[] byteArray = IOUtils.toByteArray(is); <END> InputStream inputForNuspec = new ByteArrayInputStream(byteArray); InputStream inputForNupkg = new ByteArrayInputStream(byteArray); nuspecFile = extractNuspecFile(inputForNuspec); if (nuspecFile == null) { return null; } path = String.format("%s/%s/%s.%s.nupkg", nuspecFile.getId(), nuspecFile.getVersion(), nuspecFile.getId(), nuspecFile.getVersion()); nugetArtifactManagementService.validateAndStore(storageId, repositoryId, path, inputForNupkg); Path nuspecFileTmp = Files.createTempFile(nuspecFile.getId(), "nuspec"); try (OutputStream outputStream = Files.newOutputStream(nuspecFileTmp)) { nuspecFile.saveTo(outputStream); } path = String.format("%s/%s/%s.nuspec", nuspecFile.getId(), nuspecFile.getVersion(), nuspecFile.getId()); nugetArtifactManagementService.validateAndStore(storageId, repositoryId, path, Files.newInputStream(nuspecFileTmp)); return new URI(""); }</code><technical_language>@gokhankuyucak I store potentially large binary contents in memory OutOfMemory issues. please check similar issues PR changes</technical_language>

Target:
private URI storePackage(String storageId, String repositoryId, InputStream is) throws Exception { String path; NuspecFile nuspecFile; Path packageTmp = Files.createTempFile("package", "nupkg"); Files.copy(is, packageTmp, StandardCopyOption.REPLACE_EXISTING); Path nuspecTmp = Files.createTempFile("spec", "nuspec"); Files.copy(packageTmp, nuspecTmp, StandardCopyOption.REPLACE_EXISTING); nuspecFile = extractNuspecFile(new BufferedInputStream(Files.newInputStream(packageTmp))); if (nuspecFile == null) { return null; } path = String.format("%s/%s/%s.%s.nupkg", nuspecFile.getId(), nuspecFile.getVersion(), nuspecFile.getId(), nuspecFile.getVersion()); try (InputStream tmpIn = new BufferedInputStream(Files.newInputStream(packageTmp))) { nugetArtifactManagementService.validateAndStore(storageId, repositoryId, path, tmpIn); } try (OutputStream outputStream = Files.newOutputStream(nuspecTmp)) { nuspecFile.saveTo(outputStream); } path = String.format("%s/%s/%s.nuspec", nuspecFile.getId(), nuspecFile.getVersion(), nuspecFile.getId()); nugetArtifactManagementService.validateAndStore(storageId, repositoryId, path, Files.newInputStream(nuspecTmp)); return new URI(""); }
Source:
<code>private void announceTask(Worker theWorker, TaskWrapper taskWrapper) { synchronized (statusLock) { final Task task = taskWrapper.getTask(); final TaskContext taskContext = taskWrapper.getTaskContext(); try { log.info("Coordinator asking Worker[%s] to add task[%s]", theWorker.getHost(), task.getId()); tasks.put(task.getId(), taskWrapper); cf.create() <START> .creatingParentsIfNeeded() <END> .withMode(CreateMode.EPHEMERAL) .forPath( JOINER.join( config.getTaskPath(), theWorker.getHost(), task.getId() ), jsonMapper.writeValueAsBytes(new TaskHolder(task, taskContext)) ); while (findWorkerRunningTask(taskWrapper) == null) { statusLock.wait(); } } catch (Exception e) { log.error(e, "Exception creating task[%s] for worker node[%s]", task.getId(), theWorker.getHost()); throw Throwables.propagate(e); } } }</code><technical_language>parents expecting this create? Auto-creating directories for paths meant methods of coordination multiple services leads typos causing split-brain disorder a helluva time debugging. If is some parent dir is exist this point, check for exist</technical_language>

Target:
private void announceTask(Worker theWorker, TaskWrapper taskWrapper) { synchronized (statusLock) { final Task task = taskWrapper.getTask(); final TaskContext taskContext = taskWrapper.getTaskContext(); try { log.info("Coordinator asking Worker[%s] to add task[%s]", theWorker.getHost(), task.getId()); tasks.put(task.getId(), taskWrapper); cf.create() .withMode(CreateMode.EPHEMERAL) .forPath( JOINER.join( config.getTaskPath(), theWorker.getHost(), task.getId() ), jsonMapper.writeValueAsBytes(new TaskHolder(task, taskContext)) ); while (findWorkerRunningTask(taskWrapper) == null) { statusLock.wait(config.getTaskAssignmentTimeoutDuration().getMillis()); } } catch (Exception e) { log.error(e, "Exception creating task[%s] for worker node[%s]", task.getId(), theWorker.getHost()); throw Throwables.propagate(e); } } }
Source:
<code>private void loadWebEngineFileURL(String localFilePath) { if(localFilePath != null && webEngine != null) { <START> PlatformImpl.runLater(() -> { <END> webEngine.load("file://" + localFilePath); }); } }</code><technical_language>PlatformImpl Platform</technical_language>

Target:
private void loadWebEngineFileURL(String localFilePath) { if(localFilePath != null && webEngine != null) { Platform.runLater(() -> { webEngine.load("file://" + localFilePath); }); } }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { filter = getArguments().getParcelable(PARAM_FILTER); } <START> muted_messages = new ArrayList<>(); <END> messageIndex = new SparseArray<Message>(); messageList = new ArrayList<>(); adapter = new MessageAdapter(getActivity(), messageList); }</code><technical_language>Please conventional Java variable names here. mutedMessages instead of muted_messages</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { filter = getArguments().getParcelable(PARAM_FILTER); } mutedMessages = new ArrayList<>(); messageIndex = new SparseArray<Message>(); messageList = new ArrayList<>(); adapter = new MessageAdapter(getActivity(), messageList); }
Source:
<code>private void handleRowEvent(Event event, long tableId) { LOG.trace("New event, current offset: {}, event: {}", currentOffset, event); currentTxEventSeqNo++; if (currentOffset instanceof GtidSourceOffset) { if (((GtidSourceOffset) currentOffset).incompleteTransactionsContain(currentTxGtid, currentTxEventSeqNo)) { LOG.info("Skipping event gtid {}, seqNo {}", currentTxGtid, currentTxEventSeqNo); return; } else { currentOffset = ((GtidSourceOffset) currentOffset) .withIncompleteTransaction(currentTxGtid, currentTxEventSeqNo) .withGtidSet(currentGtidSet); } } else { currentOffset = createOffset(event); } DatabaseAndTable tableName = tableMapping.get(tableId); Optional<? extends Table> tableOpt = schemaRepository.getTable(tableName); Table table = null; if (tableOpt.isPresent()) { table = tableOpt.get(); } else { LOG.error(Errors.MYSQL_002.getMessage(), tableName.getDatabase(), tableName.getTable()); table = new TableWithoutColumnsNames(tableName.getDatabase(), tableName.getTable()); } EnrichedEvent enrichedEvent = new EnrichedEvent(event, table, currentOffset); <START> eventBuffer.put(enrichedEvent); <END> }</code><technical_language>event fails buffer (that is, put succed)? is event simply lost</technical_language>

Target:
private void handleRowEvent(Event event, long tableId) { LOG.trace("New event, current offset: {}, event: {}", currentOffset, event); currentTxEventSeqNo++; if (currentOffset instanceof GtidSourceOffset) { if (((GtidSourceOffset) currentOffset).incompleteTransactionsContain(currentTxGtid, currentTxEventSeqNo)) { LOG.info("Skipping event gtid {}, seqNo {}", currentTxGtid, currentTxEventSeqNo); return; } else { currentOffset = ((GtidSourceOffset) currentOffset) .withIncompleteTransaction(currentTxGtid, currentTxEventSeqNo) .withGtidSet(currentGtidSet); } } else { currentOffset = createOffset(event); } DatabaseAndTable tableName = tableMapping.get(tableId); Optional<? extends Table> tableOpt = schemaRepository.getTable(tableName); Table table = null; if (tableOpt.isPresent()) { table = tableOpt.get(); } else { LOG.error(Errors.MYSQL_002.getMessage(), tableName.getDatabase(), tableName.getTable()); table = new TableWithoutColumnsNames(tableName.getDatabase(), tableName.getTable()); } EnrichedEvent enrichedEvent = new EnrichedEvent(event, table, currentOffset); if (!eventBuffer.put(enrichedEvent)) { LOG.error("Error adding event to buffer. Closing event buffer, disconnecting client."); eventBuffer.close(); try { client.disconnect(); } catch (IOException e) { LOG.error("Error disconnecting client: {}", e.getMessage(), e); } } }
Source:
<code>public String descriptorTypeToKind(String descriptorType, Registry registry, Meter meter) { return typeToKind.computeIfAbsent(descriptorType, k -> { <START> if (meterIsTimer(registry, meter)) { <END> return "CUMULATIVE"; } return meterToKind(registry, meter); }); }</code><technical_language>this logic in meterToKind(..)</technical_language>

Target:
public String descriptorTypeToKind(String descriptorType, Registry registry, Meter meter) { return typeToKind.computeIfAbsent(descriptorType, k -> { return meterToKind(registry, meter); }); }
Source:
<code>void close(final boolean clean) { final AtomicReference<RuntimeException> firstException = new AtomicReference<>(null); final List<T> nonSuspendedTasks = new ArrayList<>(); <START> nonSuspendedTasks.addAll(created.values()); <END> nonSuspendedTasks.addAll(running.values()); for (final T task : nonSuspendedTasks) { closeTask(clean, false, task, firstException); } for (final T task : suspended.values()) { closeTask(clean, true, task, firstException); } clear(); final RuntimeException fatalException = firstException.get(); if (fatalException != null) { throw fatalException; } }</code><technical_language>leaf code "as-is" change this line to: if (suspended.values().contains(task)) { task.closeSuspended(clean, false, firstException); } else { task.close(clean, false); }</technical_language>

Target:
void close(final boolean clean) { final AtomicReference<RuntimeException> firstException = new AtomicReference<>(null); for (final T task: allTasks()) { try { if (suspended.containsKey(task.id())) { task.closeSuspended(clean, false, null); } else { task.close(clean, false); } } catch (final TaskMigratedException e) { log.info("Failed to close since it got migrated to another thread already. " + "Closing it as zombie and move on.", taskTypeName, task.id()); firstException.compareAndSet(null, closeZombieTask(task)); } catch (final RuntimeException t) { log.error("Failed while closing due to the following error:", task.getClass().getSimpleName(), task.id(), t); if (clean) { if (!closeUnclean(task)) { firstException.compareAndSet(null, t); } } else { firstException.compareAndSet(null, t); } } } clear(); final RuntimeException fatalException = firstException.get(); if (fatalException != null) { throw fatalException; } }
Source:
<code>public void testCreationTimeout(int poolSize, int concurrency) throws Exception { ObjectCreatorThatNeverCreates objectCreatorThatNeverCreates = new ObjectCreatorThatNeverCreates(); ClockedExecutor clockedExecutor = new ClockedExecutor(); ExponentialBackOffRateLimiter rateLimiter = new ExponentialBackOffRateLimiter(0, 5000, 10, clockedExecutor, concurrency); final AsyncPool<Object> pool = new AsyncPoolImpl<Object>("object pool", objectCreatorThatNeverCreates, poolSize, Integer.MAX_VALUE, Integer.MAX_VALUE, clockedExecutor, Integer.MAX_VALUE, AsyncPoolImpl.Strategy.MRU, 0, rateLimiter, clockedExecutor, new LongTracking() ); pool.start(); List<FutureCallback<Object>> checkoutCallbacks = new ArrayList<>(); for (int i = 0; i < poolSize * 2 ; i++) { FutureCallback<Object> cb = new FutureCallback<>(); checkoutCallbacks.add(cb); rateLimiter.setPeriod(0); pool.get(cb); <START> clockedExecutor.runFor(10000); <END> } clockedExecutor.runFor(10000); for(FutureCallback<Object> cb : checkoutCallbacks) { try { cb.get(100, TimeUnit.MILLISECONDS); } catch (Exception ex) { Assert.assertTrue(ex.getCause() instanceof ObjectCreationTimeoutException); } } PoolStats stats = pool.getStats(); Assert.assertEquals(stats.getTotalCreateErrors(), poolSize * 2); Assert.assertEquals(stats.getCheckedOut(), 0); Assert.assertEquals(stats.getIdleCount(), 0); Assert.assertEquals(stats.getPoolSize(), 0); Assert.assertEquals(stats.getMaxPoolSize(), poolSize); Assert.assertEquals(stats.getIdleCount(), 0); }</code><technical_language>DEFAULT_OBJECT_CREATION_TIMEOUT</technical_language>

Target:
public void testCreationTimeout(int poolSize, int concurrency) throws Exception { ObjectCreatorThatNeverCreates objectCreatorThatNeverCreates = new ObjectCreatorThatNeverCreates(); ClockedExecutor clockedExecutor = new ClockedExecutor(); ExponentialBackOffRateLimiter rateLimiter = new ExponentialBackOffRateLimiter(0, 5000, 10, clockedExecutor, concurrency); final AsyncPool<Object> pool = new AsyncPoolImpl<Object>("object pool", objectCreatorThatNeverCreates, poolSize, Integer.MAX_VALUE, Integer.MAX_VALUE, clockedExecutor, Integer.MAX_VALUE, AsyncPoolImpl.Strategy.MRU, 0, rateLimiter, clockedExecutor, new LongTracking() ); pool.start(); List<FutureCallback<Object>> checkoutCallbacks = new ArrayList<>(); for (int i = 0; i < poolSize * 2 ; i++) { FutureCallback<Object> cb = new FutureCallback<>(); checkoutCallbacks.add(cb); rateLimiter.setPeriod(0); pool.get(cb); clockedExecutor.runFor(AsyncPoolImpl.DEFAULT_OBJECT_CREATION_TIMEOUT); } clockedExecutor.runFor(AsyncPoolImpl.DEFAULT_OBJECT_CREATION_TIMEOUT); for(FutureCallback<Object> cb : checkoutCallbacks) { try { cb.get(100, TimeUnit.MILLISECONDS); } catch (Exception ex) { Assert.assertTrue(ex.getCause() instanceof ObjectCreationTimeoutException); } } PoolStats stats = pool.getStats(); Assert.assertEquals(stats.getTotalCreateErrors(), poolSize * 2); Assert.assertEquals(stats.getCheckedOut(), 0); Assert.assertEquals(stats.getIdleCount(), 0); Assert.assertEquals(stats.getPoolSize(), 0); Assert.assertEquals(stats.getMaxPoolSize(), poolSize); Assert.assertEquals(stats.getIdleCount(), 0); }
Source:
<code>private boolean validateBacklinks() { boolean allValid = true; Map<String, ClassMetaData> realmClasses = new HashMap<String, ClassMetaData>(classesToValidate.size()); for (ClassMetaData classData: classesToValidate) { realmClasses.put(classData.getFullyQualifiedClassName(), classData); } for (Backlink backlink: backlinksToValidate) { ClassMetaData klass = realmClasses.get(backlink.getSourceClass()); <START> if (klass == null) { continue; } <END> if (!backlink.validateTarget(klass) && allValid) { allValid = false; } } return allValid; }</code><technical_language>do this. I this e.g. here: <LINK_0> library classes classpath, load class reflection introspect it. require duplicating some of logic annotation processor API's reflection API's instead</technical_language>

Target:
private boolean validateBacklinks() { boolean allValid = true; Map<String, ClassMetaData> realmClasses = new HashMap<String, ClassMetaData>(classesToValidate.size()); for (ClassMetaData classData: classesToValidate) { realmClasses.put(classData.getFullyQualifiedClassName(), classData); } for (Backlink backlink: backlinksToValidate) { ClassMetaData clazz = realmClasses.get(backlink.getSourceClass()); if (clazz == null) { continue; } if (!backlink.validateTarget(clazz) && allValid) { allValid = false; } } return allValid; }
Source:
<code>public void testExpressionWithPhoenixRowTimestamp() throws Exception { ParseNode parseNode = SQLParser.parseCondition("(PHOENIX_ROW_TIMESTAMP() = PK2)"); boolean hasPhoenixRowTimestampParseNode = false; for (ParseNode childNode : parseNode.getChildren()) { if (childNode.getClass().isAssignableFrom(PhoenixRowTimestampParseNode.class)) { <START> assertEquals("", childNode.getChildren().size(), 0); <END> hasPhoenixRowTimestampParseNode = true; } } assertTrue(hasPhoenixRowTimestampParseNode); }</code><technical_language>nit: Remove empty string print in assertion fix if condition formatting</technical_language>

Target:
public void testExpressionWithPhoenixRowTimestamp() throws Exception { ParseNode parseNode = SQLParser.parseCondition("(PHOENIX_ROW_TIMESTAMP() = PK2)"); boolean hasPhoenixRowTimestampParseNode = false; for (ParseNode childNode : parseNode.getChildren()) { if (childNode.getClass().isAssignableFrom(PhoenixRowTimestampParseNode.class)) { assertEquals(0, childNode.getChildren().size()); hasPhoenixRowTimestampParseNode = true; } } assertTrue(hasPhoenixRowTimestampParseNode); }
Source:
<code>public DefaultKieCompilationResponse(DefaultKieCompilationResponseOffProcess res) { this.defaultResponse = new DefaultCompilationResponse(res.isSuccessful(), res.getMavenOutput(), getWorkingDir(res.getWorkingDir()), res.getTargetContent(), res.getDependencies(), res.getRequestUUID()); if (res.getKieModuleMetaInfo().isPresent()) { this.kieModuleMetaInfo = res.getKieModuleMetaInfo().get(); } if (res.getKieModule().isPresent()) { this.kieModule = res.getKieModule().get(); } <START> if(res.getProjectClassLoaderStore() != null && !res.getProjectClassLoaderStore().isEmpty()){ <END> this.projectClassLoaderStore = res.getProjectClassLoaderStore(); }else{ this.projectClassLoaderStore = Collections.emptyMap(); } if(res.getEventTypeClasses()!= null && !res.getEventTypeClasses().isEmpty()) { this.eventsTypeClasses = res.getEventTypeClasses(); }else{ this.eventsTypeClasses = Collections.emptySet(); } }</code><technical_language>getProjectClassLoaderStore() return null? do returns a map (which potentially empty). need this null check. if returns null, need check if map is empty. If empty assign empty map this.projectClassLoaderStore need do separately in else branch</technical_language>

Target:
public DefaultKieCompilationResponse(DefaultKieCompilationResponseOffProcess res) { this.defaultResponse = new DefaultCompilationResponse(res.isSuccessful(), res.getMavenOutput(), getWorkingDir(res.getWorkingDir()), res.getTargetContent(), res.getDependencies(), res.getRequestUUID()); this.kieModuleMetaInfo = res.getKieModuleMetaInfo().orElse(null); this.kieModule = res.getKieModule().orElse(null); this.projectClassLoaderStore = Optional.ofNullable(res.getProjectClassLoaderStore()).orElse(Collections.emptyMap()); this.eventsTypeClasses = Optional.ofNullable(res.getEventTypeClasses()).orElse(Collections.emptySet()); }
Source:
<code>void pinCertificate(OkHttpClient.Builder builder) { Log.d(Constants.TAG, "Pinning certificate for " + url); try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); byte[] certificate = sCertificatePins.get(url.getHost()); Certificate ca = cf.generateCertificate(new ByteArrayInputStream(certificate)); String keyStoreType = KeyStore.getDefaultType(); KeyStore keyStore = KeyStore.getInstance(keyStoreType); keyStore.load(null, null); keyStore.setCertificateEntry("ca", ca); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(keyStore); TrustManager[] trustManagers = trustManagerFactory.getTrustManagers(); if (trustManagers.length != 1 || !(trustManagers[0] instanceof X509TrustManager)) { <START> throw new IllegalStateException("Unexpected default trust managers:" <END> + Arrays.toString(trustManagers)); } X509TrustManager trustManager = (X509TrustManager) trustManagers[0]; SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, new TrustManager[]{trustManager}, null); SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory(); builder.sslSocketFactory(sslSocketFactory, trustManager); } catch (CertificateException | KeyStoreException | KeyManagementException | NoSuchAlgorithmException | IOException e) { throw new IllegalStateException(e); } }</code><technical_language>nit: missing a space</technical_language>

Target:
void pinCertificate(OkHttpClient.Builder builder) { Log.d(Constants.TAG, "Pinning certificate for " + url); try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); byte[] certificate = sCertificatePins.get(url.getHost()); Certificate ca = cf.generateCertificate(new ByteArrayInputStream(certificate)); KeyStore keyStore = createSingleCertificateKeyStore(ca); X509TrustManager trustManager = createTrustManager(keyStore); SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, new TrustManager[]{trustManager}, null); SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory(); builder.sslSocketFactory(sslSocketFactory, trustManager); } catch (CertificateException | KeyStoreException | KeyManagementException | NoSuchAlgorithmException | IOException e) { throw new IllegalStateException(e); } }
Source:
<code>public List<EmailWrapper> generateFeedbackSessionClosedEmails(FeedbackSessionAttributes session) { if (session.isPrivateSession()) { return new ArrayList<>(); } CourseAttributes course = coursesLogic.getCourse(session.getCourseId()); boolean isEmailNeededForStudents = false; try { isEmailNeededForStudents = fsLogic.isFeedbackSessionHasQuestionForStudents( session.getFeedbackSessionName(), session.getCourseId()); } catch (EntityDoesNotExistException e) { log.severe("Course " + session.getCourseId() + " does not exist or " + "session " + session.getFeedbackSessionName() + " does not exist"); } List<InstructorAttributes> instructors = isEmailNeededForStudents ? instructorsLogic.getInstructorsForCourse(session.getCourseId()) <START> : new ArrayList<InstructorAttributes>(); <END> List<StudentAttributes> students = isEmailNeededForStudents ? studentsLogic.getStudentsForCourse(session.getCourseId()) : new ArrayList<StudentAttributes>(); String template = EmailTemplates.USER_FEEDBACK_SESSION.replace("${status}", FEEDBACK_STATUS_SESSION_CLOSED); String additionalContactInformation = getAdditionalContactInformationFragment(course); return generateFeedbackSessionEmailBases(course, session, students, instructors, template, EmailType.FEEDBACK_CLOSED.getSubject(), FEEDBACK_ACTION_VIEW, additionalContactInformation); }</code><technical_language>diamond operator: new ArrayList<>()</technical_language>

Target:
public List<EmailWrapper> generateFeedbackSessionClosedEmails(FeedbackSessionAttributes session) { if (session.isPrivateSession()) { return new ArrayList<>(); } CourseAttributes course = coursesLogic.getCourse(session.getCourseId()); boolean isEmailNeededForStudents = false; try { isEmailNeededForStudents = fsLogic.isFeedbackSessionHasQuestionForStudents( session.getFeedbackSessionName(), session.getCourseId()); } catch (EntityDoesNotExistException e) { log.severe("Course " + session.getCourseId() + " does not exist or " + "session " + session.getFeedbackSessionName() + " does not exist"); } List<InstructorAttributes> instructors = isEmailNeededForStudents ? instructorsLogic.getInstructorsForCourse(session.getCourseId()) : new ArrayList<>(); List<StudentAttributes> students = isEmailNeededForStudents ? studentsLogic.getStudentsForCourse(session.getCourseId()) : new ArrayList<>(); String template = EmailTemplates.USER_FEEDBACK_SESSION.replace("${status}", FEEDBACK_STATUS_SESSION_CLOSED); String additionalContactInformation = getAdditionalContactInformationFragment(course); return generateFeedbackSessionEmailBases(course, session, students, instructors, template, EmailType.FEEDBACK_CLOSED.getSubject(), FEEDBACK_ACTION_VIEW, additionalContactInformation); }
Source:
<code>public void copySupplementaryFolder(String newName) { IFolder oldSupplFolder = getTraceSupplementaryFolder(getResourceName()); IFolder newSupplFolder = getTraceSupplementaryFolder(newName + getSuffix()); if (oldSupplFolder.exists()) { try { oldSupplFolder.copy(newSupplFolder.getFullPath(), true, new NullProgressMonitor()); } catch (CoreException e) { <START> Activator.getDefault().logError("Error renaming supplementary folder " + oldSupplFolder, e); END> } } }</code><technical_language>externalize</technical_language>

Target:
public void copySupplementaryFolder(String newName) { IFolder oldSupplFolder = getTraceSupplementaryFolder(getResourceName()); IFolder newSupplFolder = getTraceSupplementaryFolder(newName + getSuffix()); if (oldSupplFolder.exists()) { try { oldSupplFolder.copy(newSupplFolder.getFullPath(), true, new NullProgressMonitor()); } catch (CoreException e) { Activator.getDefault().logError(Messages.TmfCommonProjectElement_ErrorCopyingSF + oldSupplFolder, e); } } }
Source:
<code>public Iterable<Task> open() { return Iterables.transform( this.region.table(DyTask.TBL) .frame() .through( new QueryValve() .withSelect(Select.ALL_PROJECTED_ATTRIBUTES) ) .where( new Conditions().with( DyTask.ATTR_OPEN, <START> Conditions.equalTo(String.valueOf(true)) <END> ).with( DyTask.ATTR_REPO_URN, Conditions.equalTo(this.repo.name()) ) ) , new Function<Item, Task>() { @Override public Task apply(final Item input) { return new DyTask(input); } } ); }</code><technical_language>here, Conditions.equalTo</technical_language>

Target:
public Iterable<Task> open() { return Iterables.transform( this.region.table(DyTask.TBL) .frame() .through( new QueryValve() .withSelect(Select.ALL_PROJECTED_ATTRIBUTES) ) .where( new Conditions().with( DyTask.ATTR_OPEN, String.valueOf(true) ).with( DyTask.ATTR_REPO_URN, this.repo.name() ) ), new Function<Item, Task>() { @Override public Task apply(final Item input) { return new DyTask(input); } } ); }
Source:
<code>final protected void initialize() { <START> if (!previous.isCanceled()) { <END> previous.cancel(); } onInitialize(); }</code><technical_language>This previous.isRunning() || !previous.isCanceled()</technical_language>

Target:
final protected void initialize() { if (previous != null && (previous.isRunning() || !previous.isCanceled())) { previous.cancel(); } onInitialize(); }
Source:
<code>public NodeConditionalBreakpointAction(IWorkbenchPart part) { super(part); setId(ID); setImageDescriptor(DesignerPlugin.getImageDescriptor("icons/breakpoint.png")); <START> setText("Conditional breakpoint"); END> }</code><technical_language>need i18n here</technical_language>

Target:
public NodeConditionalBreakpointAction(IWorkbenchPart part) { super(part); setId(ID); setImageDescriptor(DesignerPlugin.getImageDescriptor("icons/breakpoint.png")); setText(Messages.getString("NodeConditionalBreakpointAction.conditionalBreakpoint")); }
Source:
<code>synchronized void responseComplete() { <START> if (METRICS_ENABLED && metrics != null) { <END> reportBytesWritten(bytesWritten); bytesWritten = 0; if (requestFailed) { metrics.requestReset(requestMetric); requestFailed = false; } else { metrics.responseEnd(requestMetric, pendingResponse); } } pendingResponse = null; checkNextTick(); }</code><technical_language>mixing METRICS_ENABLED null testing? in other classes. metrics instance null if metrics disabled anyway</technical_language>

Target:
synchronized void responseComplete() { if (METRICS_ENABLED && metrics != null) { reportBytesWritten(bytesWritten); bytesWritten = 0; if (requestFailed) { metrics.requestReset(requestMetric); requestFailed = false; } else { metrics.responseEnd(requestMetric, pendingResponse); } } pendingResponse = null; if (queueing) { queueing = paused; } checkNextTick(); }
Source:
<code>private static ExecutorService createBoundedExecutor(MetricRegistry metricRegistry, String useCase) { return new InstrumentedExecutorService( PTExecutors.newThreadPoolExecutor( <START> 1, END> MAXIMUM_POOL_SIZE, THREAD_KEEP_ALIVE.toMillis(), TimeUnit.MILLISECONDS, new SynchronousQueue<>(), new ThreadFactoryBuilder() .setNameFormat("timelock-executors-" + useCase + "-%d") .setDaemon(true) .build()), metricRegistry, MetricRegistry.name(TimeLockPaxosExecutors.class, useCase, "executor")); }</code><technical_language>SINGLE_THREAD_FOR_AUTOBATCHER</technical_language>

Target:
private static ExecutorService createBoundedExecutor(MetricRegistry metricRegistry, String useCase) { return new InstrumentedExecutorService( PTExecutors.newThreadPoolExecutor( SINGLE_THREAD_FOR_MOSTLY_AUTOBATCHED_OPERATIONS, MAXIMUM_POOL_SIZE, THREAD_KEEP_ALIVE.toMillis(), TimeUnit.MILLISECONDS, new SynchronousQueue<>(), new ThreadFactoryBuilder() .setNameFormat("timelock-executors-" + useCase + "-%d") .setDaemon(true) .build()), metricRegistry, MetricRegistry.name(TimeLockPaxosExecutors.class, useCase, "executor")); }
Source:
<code>public void request_without_forward_url_should_fail() throws Exception { try{ mockMvc.perform(get(Path.PROXY_CONTEXT+"/"+BINDING_ID).accept(MediaType.ALL)) .andExpect(status().is5xxServerError()); Assert.fail("Shouldn't work"); } catch (Exception e){ <START> Assert.assertNotNull(e); <END> } }</code><technical_language>assertThrown :kissing_closed_eyes:</technical_language>

Target:
public void request_without_forward_url_should_fail() throws Exception { verifyThrown( () -> mockMvc.perform(get(Path.PROXY_CONTEXT+"/"+BINDING_ID) .accept(MediaType.ALL)) .andExpect(status().is5xxServerError()), Exception.class); }
Source:
<code>public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { <START> case 1: { <END> if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { Log.d("Scanner Message", "coarse location permission granted"); ((DemoApplication) getApplication()).setScannerStatus(SensorbergService.MSG_LOCATION_SET); } else { ((DemoApplication) getApplication()).setScannerStatus(SensorbergService.MSG_LOCATION_NOT_SET_WHEN_NEEDED); } return; } } }</code><technical_language>should've a constant (see above)</technical_language>

Target:
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { case MY_PERMISSION_REQUEST_LOCATION_SERVICES: { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { Log.d("Scanner Message", "coarse location permission granted"); ((DemoApplication) getApplication()).setLocationPermissionGranted(SensorbergServiceMessage.MSG_LOCATION_SET); } else { ((DemoApplication) getApplication()).setLocationPermissionGranted(SensorbergServiceMessage.MSG_LOCATION_NOT_SET_WHEN_NEEDED); } return; } } }
Source:
<code>public void testWithNullArrays() { final byte[] authenthicationKey = null; final byte[] encryptionKey = null; final KeySet keySet = new KeySet(authenthicationKey, encryptionKey); final KeySetDto keySetDto = this.configurationMapper.map(keySet, KeySetDto.class); <START> assertNotNull(keySet); <END> assertNotNull(keySetDto); assertNull(keySetDto.getAuthenticationKey()); assertNull(keySetDto.getEncryptionKey()); }</code><technical_language>delete this line</technical_language>

Target:
public void testWithNullArrays() { final byte[] authenthicationKey = null; final byte[] encryptionKey = null; final KeySet keySet = new KeySet(authenthicationKey, encryptionKey); final KeySetDto keySetDto = this.configurationMapper.map(keySet, KeySetDto.class); assertNotNull(keySetDto); assertNull(keySetDto.getAuthenticationKey()); assertNull(keySetDto.getEncryptionKey()); }
Source:
<code>public static void main(String... args) throws Exception { try { new RequestBodyCompression().run(); <START> } catch (IOException ioe) { <END> } }</code><technical_language>nit: ignored? :)</technical_language>

Target:
public static void main(String... args) throws Exception { new RequestBodyCompression().run(); }
Source:
<code>public boolean isSuggestionListDisplayed() { try { <START> waitForElementByElement(searchSuggestions.get(0)); <END> return searchSuggestions.get(0).isDisplayed(); } catch (NoSuchElementException|IndexOutOfBoundsException e) return false; }</code><technical_language>getSize if element is page</technical_language>

Target:
public boolean isSuggestionListDisplayed() { try { if (searchSuggestions.size() > 0) { waitForElementByElement(searchSuggestions.get(0)); return searchSuggestions.get(0).isDisplayed(); } } catch (NoSuchElementException e) return false; }
Source:
<code>default <M extends Externalizable> LogTailer<M> createTailer(String group, String name, Codec<M> codec) { int partitions = size(name); if (partitions <= 0) { <START> System.out.println(this); <END> throw new IllegalArgumentException("Log name: " + name + " not found"); } return createTailer(group, IntStream.range(0, partitions).boxed().map(partition -> new LogPartition(name, partition)).collect( Collectors.toList()), codec); }</code><technical_language>remove replace logger</technical_language>

Target:
default <M extends Externalizable> LogTailer<M> createTailer(String group, String name, Codec<M> codec) { int partitions = size(name); if (partitions <= 0) { throw new IllegalArgumentException("Log name: " + name + " not found"); } return createTailer(group, IntStream.range(0, partitions).boxed().map(partition -> new LogPartition(name, partition)).collect( Collectors.toList()), codec); }