auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<ModuleDetails> readAllModulesIncludingThirdPartyIfAny( String... thirdPartyPackages) { final Set<String> standardModuleFileNames = new Reflections("com.puppycrawl.tools.checkstyle.meta", new ResourcesScanner()).getResources(Pattern.compile(".*\\.xml")); final Set<String> allMetadataSources = new HashSet<>(standardModuleFileNames); for (String packageName : thirdPartyPackages) { final Set<String> thirdPartyModuleFileNames = new Reflections(packageName, new ResourcesScanner()) .getResources(Pattern.compile(".*checkstylemeta-.*\\.xml")); allMetadataSources.addAll(thirdPartyModuleFileNames); } final List<ModuleDetails> result = new ArrayList<>(); allMetadataSources.forEach(fileName -> { final ModuleType moduleType; if (fileName.endsWith("FileFilter.xml")) { moduleType = ModuleType.FILEFILTER; } else if (fileName.endsWith("Filter.xml")) { moduleType = ModuleType.FILTER; } else { moduleType = ModuleType.CHECK; } ModuleDetails moduleDetails = null; try { moduleDetails = read(getClass().getResourceAsStream("/" + fileName), moduleType); } catch (ParserConfigurationException | IOException | SAXException ex) { <START> ex.printStackTrace(); <END> } result.add(moduleDetails); }); return result; }</code><technical_language>please wrap exception runtime exception rethrow it. catch (ParserConfigurationException | IOException | SAXException ex) { new IllegalStateException("Problem read modules including party if any", ex)</technical_language>

Target:
public static List<ModuleDetails> readAllModulesIncludingThirdPartyIfAny( String... thirdPartyPackages) { final Set<String> standardModuleFileNames = new Reflections("com.puppycrawl.tools.checkstyle.meta", new ResourcesScanner()).getResources(Pattern.compile(".*\\.xml")); final Set<String> allMetadataSources = new HashSet<>(standardModuleFileNames); for (String packageName : thirdPartyPackages) { final Set<String> thirdPartyModuleFileNames = new Reflections(packageName, new ResourcesScanner()) .getResources(Pattern.compile(".*checkstylemeta-.*\\.xml")); allMetadataSources.addAll(thirdPartyModuleFileNames); } final List<ModuleDetails> result = new ArrayList<>(); for (String fileName : allMetadataSources) { final ModuleType moduleType; if (fileName.endsWith("FileFilter.xml")) { moduleType = ModuleType.FILEFILTER; } else if (fileName.endsWith("Filter.xml")) { moduleType = ModuleType.FILTER; } else { moduleType = ModuleType.CHECK; } final ModuleDetails moduleDetails; try { moduleDetails = read(XmlMetaReader.class.getResourceAsStream("/" + fileName), moduleType); } catch (ParserConfigurationException | IOException | SAXException ex) { throw new IllegalStateException("Problem to read all modules including third " + "party if any. Problem detected at file: " + fileName, ex); } result.add(moduleDetails); } return result; }
Source:
<code>private void removeChildren(Guid snapshot) { List<Guid> children = new ArrayList<>(); getImageChildren(snapshot, children); <START> children.stream().sorted(Collections.reverseOrder()).forEach(child -> removeSnapshot(diskImageDao.getSnapshotById(child))); <END> }</code><technical_language>Nice, Maor! "sorted" method triggered suspicion</technical_language>

Target:
private void removeChildren(Guid snapshot) { List<Guid> children = new ArrayList<>(); getImageChildren(snapshot, children); Collections.reverse(children); children.forEach(child -> removeSnapshot(diskImageDao.getSnapshotById(child))); }
Source:
<code>public RepositoryInputStream getInputStream(RepositoryPath path) <START> throws IOException, <END> NoSuchAlgorithmException, ArtifactTransportException, ProviderImplementationException { Repository repository = path.getFileSystem().getRepository(); Storage storage = repository.getStorage(); String sPath = RepositoryFiles.stringValue(path); artifactOperationsValidator.validate(storage.getId(), repository.getId(), sPath); RepositoryProvider repositoryProvider = repositoryProviderRegistry.getProvider(repository.getType()); RepositoryInputStream is = repositoryProvider.newInputStream(path); if (is == null) { throw new ArtifactResolutionException(String.format("Artifact [%s] not found.", sPath)); } return is; }</code><technical_language>I exceptions thrown. (Or, least, I this case in GroupRepositoryProvider)</technical_language>

Target:
public RepositoryInputStream getInputStream(RepositoryPath path) throws IOException { Repository repository = path.getFileSystem().getRepository(); artifactOperationsValidator.validate(path); RepositoryProvider repositoryProvider = repositoryProviderRegistry.getProvider(repository.getType()); RepositoryInputStream is = repositoryProvider.getInputStream(path); if (is == null) { throw new ArtifactResolutionException(String.format("Artifact [%s] not found.", path)); } return is; }
Source:
<code>public Collection<String> getAvailableServers(String container) throws IOException { <START> List<String> members = (List<String>) parseBody(fetch(() -> client.cacheManager(container).info()), Map.class).get("cluster_members"); <END> return members; }</code><technical_language>remove members</technical_language>

Target:
public Collection<String> getAvailableServers(String container) throws IOException { return (List<String>) parseBody(fetch(() -> client.cacheManager(container).info()), Map.class).get("cluster_members"); }
Source:
<code>public ReservoirSampler(int numSpots) { <START> this.numSpot = numSpots; <END> this.reservoir = createArray(); this.index = new AtomicInteger(0); rand = new Random(System.nanoTime()); }</code><technical_language>numSpotes - reservoir.length, point in keeping both</technical_language>

Target:
public ReservoirSampler(int numSpots) { this.reservoir = createArray(numSpots); this.index = new AtomicInteger(0); random = new Random(System.nanoTime()); }
Source:
<code>private void fetchMetricTags(final String metricName) { PatternsCS.pipe(_kairosDbClient.queryMetricTags( new MetricsQuery.Builder() .setStartTime(Instant.ofEpochMilli(0)) .setMetrics(ImmutableList.of( new Metric.Builder() .setName(metricName) .build() )) .build()).handle((response, failure) -> { if (failure != null) { return new TagNamesMessage.Builder() .setFailure(true) .setMetricName(metricName) <START> .setThrowable(failure) <END> .build(); } else { return new TagNamesMessage.Builder() .setFailure(false) .setMetricName(metricName) .setTagNames(response.getQueries().get(0).getResults().get(0).getTags().keySet()) .build(); } }), getContext().dispatcher()) .to(getSelf()); }</code><technical_language>dual "has a failure" "marked a failure" paradigm</technical_language>

Target:
private void fetchMetricTags(final String metricName) { _metrics.recordCounter("rollup/metric_name/received", 1); final long startTime = System.nanoTime(); PatternsCS.pipe(_kairosDbClient.queryMetricTags( new MetricsQuery.Builder() .setStartTime(Instant.ofEpochMilli(0)) .setMetrics(ImmutableList.of( new Metric.Builder() .setName(metricName) .build() )) .build()).handle((response, failure) -> { final String baseMetricName = "rollup/tag_names"; _metrics.recordCounter(baseMetricName + "/success", failure == null ? 1 : 0); _metrics.recordTimer( baseMetricName + "/request", System.nanoTime() - startTime, Optional.of(Units.NANOSECOND)); if (failure != null) { return new TagNamesMessage.Builder() .setMetricName(metricName) .setFailure(failure) .build(); } else { if (response.getQueries().isEmpty() || response.getQueries().get(0).getResults().isEmpty()) { return new TagNamesMessage.Builder() .setMetricName(metricName) .setFailure(new Exception("Unexpected query result.")) .build(); } else { return new TagNamesMessage.Builder() .setMetricName(metricName) .setTagNames(response.getQueries().get(0).getResults().get(0).getTags().keySet()) .build(); } } }), getContext().dispatcher()) .to(getSelf()); }
Source:
<code>public void stop() throws IOException, TimeoutException { stopping = true; if (channel == null) { return; } if (tag != null && isChannelOpen()) { channel.basicCancel(tag); } try { lock.acquire(); if (isChannelOpen()) { channel.close(); } <START> lock.release(); <END> } catch (TimeoutException e) { log.error("Timeout occured"); throw e; } catch (InterruptedException e1) { log.error("Thread Interrupted!"); } }</code><technical_language>here... in outer finally block, catch (InterruptedException e1)</technical_language>

Target:
public void stop() throws IOException, TimeoutException { stopping = true; if (channel == null) { return; } if (tag != null && isChannelOpen()) { channel.basicCancel(tag); } try { lock.acquire(); if (isChannelOpen()) { channel.close(); } } catch (TimeoutException e) { log.error("Timeout occured"); throw e; } catch (InterruptedException e1) { log.error("Thread Interrupted!"); } finally { lock.release(); } }
Source:
<code>private void handleAddInput() { <START> int i = 1; <END> }</code><technical_language>Please remove this</technical_language>

Target:
private void handleAddInput() { }
Source:
<code>public void createPartControl(Composite parent) { <START> <END> ScrolledComposite container = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL); container.setLayout(new FillLayout(SWT.HORIZONTAL | SWT.VERTICAL)); int panelWidthFromColumns = 0; for (LogMessageFields column : LogMessageFields.COLUMNS) { panelWidthFromColumns += column.getDefaultColumnWidth(); } container.setMinSize(panelWidthFromColumns + TABLE_PADDING, 300); container.setExpandHorizontal(true); container.setExpandVertical(true); LogDisplay logDisplay = new LogDisplay(container, logDisplayModel); container.setContent(logDisplay); }</code><technical_language>immediately clear this removed</technical_language>

Target:
public void createPartControl(Composite parent) { parent.setLayout(new FillLayout(SWT.VERTICAL | SWT.HORIZONTAL)); ScrolledComposite container = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL); container.setLayout(new FillLayout(SWT.HORIZONTAL | SWT.VERTICAL)); int panelWidthFromColumns = 0; for (LogMessageFields column : LogMessageFields.COLUMNS) { panelWidthFromColumns += column.getDefaultColumnWidth(); } container.setMinSize(panelWidthFromColumns + TABLE_PADDING, 300); container.setExpandHorizontal(true); container.setExpandVertical(true); LogDisplay logDisplay = new LogDisplay(container, logDisplayModel); container.setContent(logDisplay); }
Source:
<code>public boolean equals(final Object o) { <START> throw new RuntimeException("comparing of SRALazyRecords is not implemented yet"); <END> }</code><technical_language>need implement equals(), hashCode(), clone(), able this SAMRecord implementation correctly in GATK</technical_language>

Target:
public boolean equals(final Object o) { if (o instanceof SRALazyRecord) { SRALazyRecord otherRecord = (SRALazyRecord)o; otherRecord.getReferenceIndex(); otherRecord.getAlignmentStart(); } getReferenceIndex(); getAlignmentStart(); return super.equals(o); }
Source:
<code>public CompletionStage<RestResponse> challenge(RestRequest request, ChannelHandlerContext ctx) { String auth = request.getAuthorizationHeader(); if (auth != null && auth.length() > 5) { String type = auth.substring(0, 5); type = type.toLowerCase(); if ("basic".equals(type)) { String cookie = auth.substring(6); cookie = new String(Base64.getDecoder().decode(cookie.getBytes())); String[] split = cookie.split(":"); try { request.setSubject(domain.authenticate(split[0], split[1])); <START> return VOID_RESPONSE; <END> } catch (SecurityException e) { } } } return CompletableFuture.completedFuture(new NettyRestResponse.Builder().status(HttpResponseStatus.UNAUTHORIZED).authenticate(authenticateHeader).build()); }</code><technical_language>challenge() method block domain.authenticate()? This guy takes a large chunk of REST request processing time afraid</technical_language>

Target:
public CompletionStage<RestResponse> challenge(RestRequest request, ChannelHandlerContext ctx) { String auth = request.getAuthorizationHeader(); if (auth != null && auth.length() > 5) { String type = auth.substring(0, 5); if ("basic".equalsIgnoreCase(type)) { String cookie = auth.substring(6); cookie = new String(Base64.getDecoder().decode(cookie.getBytes())); String[] split = cookie.split(":"); return CompletableFuture.supplyAsync(() -> { request.setSubject(domain.authenticate(split[0], split[1])); return VOID_RESPONSE; }); } } return CompletableFuture.completedFuture(new NettyRestResponse.Builder().status(HttpResponseStatus.UNAUTHORIZED).authenticate(authenticateHeader).build()); }
Source:
<code>public Note getNoteFromUrl(final String hash, AuthenticationInfo subject) throws IOException { Callable<Note> task = new Callable<Note>() { @Override public Note call() throws Exception { return getNote(hash); } }; Future<Note> noteFuture = executorService.submit(task); Note note = null; try { note = noteFuture.get(15, TimeUnit.SECONDS); } catch (InterruptedException e) { LOG.error("Failed to download Note, Interrupted", e); } catch (ExecutionException e) { LOG.error("Failed to get note", e); Throwable cause = e.getCause(); if (cause instanceof IOException) <START> throw (IOException) cause; <END> } catch (TimeoutException e) { LOG.error("TimeOut reached", e); } finally { noteFuture.cancel(true); } return note; }</code><technical_language>Please code project coding conventions <LINK_0></technical_language>

Target:
public Note getNoteFromUrl(final String hash, AuthenticationInfo subject) throws IOException { Callable<Note> task = new Callable<Note>() { @Override public Note call() throws Exception { return getNote(hash); } }; Future<Note> noteFuture = executorService.submit(task); Note note = null; try { note = noteFuture.get(15, TimeUnit.SECONDS); } catch (InterruptedException e) { LOG.error("Failed to download Note, Interrupted", e); } catch (ExecutionException e) { LOG.error("Failed to get note", e); Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } } catch (TimeoutException e) { LOG.error("TimeOut reached", e); } finally { noteFuture.cancel(true); } return note; }
Source:
<code>public PostListingController(PostListingURL url, final Context context) { if(url.pathType() == RedditURLParser.SUBREDDIT_POST_LISTING_URL) { if(url.asSubredditPostListURL().order == null) { url = url.asSubredditPostListURL().sort(defaultOrder(context)); } } else if(url.pathType() == RedditURLParser.USER_POST_LISTING_URL) { if(url.asUserPostListURL().order == null) { <START> url = url.asUserPostListURL().sort(defaultOrder(context)); <END> } } this.url = url; }</code><technical_language>defaultOrder RISING though</technical_language>

Target:
public PostListingController(PostListingURL url, final Context context) { if(url.pathType() == RedditURLParser.SUBREDDIT_POST_LISTING_URL) { if(url.asSubredditPostListURL().order == null) { url = url.asSubredditPostListURL().sort(defaultOrder(context)); } } else if(url.pathType() == RedditURLParser.USER_POST_LISTING_URL) { if(url.asUserPostListURL().order == null) { url = url.asUserPostListURL().sort(PostSort.NEW); } } this.url = url; }
Source:
<code>private long getMillisSinceLastCompact() { AgnosticResultSet rs = conns.get().selectResultSetUnregisteredQuery( "SELECT FLOOR(EXTRACT(EPOCH FROM GREATEST( " + " last_vacuum, last_autovacuum, last_analyze, last_autoanalyze" + "))*1000) AS last, " + "FLOOR(EXTRACT(EPOCH FROM CURRENT_TIMESTAMP)*1000) AS current " + "FROM pg_stat_user_tables WHERE relname = ?", prefixedTableName()); AgnosticResultRow row = Iterables.getOnlyElement(rs.rows()); <START> long last = row.getLong("last", -1); <END> if (last == -1) { return Long.MAX_VALUE; } long current = row.getLong("current"); return current - last; }</code><technical_language>extract a method vacuumWasNeverRun()</technical_language>

Target:
private long getMillisSinceLastCompact() { AgnosticResultSet rs = conns.get().selectResultSetUnregisteredQuery( "SELECT FLOOR(EXTRACT(EPOCH FROM GREATEST( " + " last_vacuum, last_autovacuum, last_analyze, last_autoanalyze" + "))*1000) AS last, " + "FLOOR(EXTRACT(EPOCH FROM CURRENT_TIMESTAMP)*1000) AS current " + "FROM pg_stat_user_tables WHERE relname = ?", prefixedTableName()); AgnosticResultRow row = Iterables.getOnlyElement(rs.rows()); Optional<Long> lastVacuumTime = getLastVacuumTime(row); if (vacuumWasNeverRun(lastVacuumTime)) { return Long.MAX_VALUE; } long currentVacuumTime = row.getLong("current"); long timeSinceLastCompact = currentVacuumTime - lastVacuumTime.orElseThrow( () -> new IllegalStateException("Should not calculate time since last compact if it doesn't exist!")); log.info("For table {}, we compacted ms ago", timeSinceLastCompact, prefixedTableName()); return timeSinceLastCompact; }
Source:
<code>static void clientWithQueryOptions(DatabaseId db) { SpannerOptions options = SpannerOptions.newBuilder() .setDefaultQueryOptions( <START> db, QueryOptions.newBuilder().setOptimizerVersion("latest").build()) <END> .build(); Spanner spanner = options.getService(); DatabaseClient dbClient = spanner.getDatabaseClient(db); try (ResultSet resultSet = dbClient .singleUse() .executeQuery(Statement.of("SELECT SingerId, AlbumId, AlbumTitle FROM Albums"))) { while (resultSet.next()) { System.out.printf( "%d %d %s\n", resultSet.getLong(0), resultSet.getLong(1), resultSet.getString(2)); } } }</code><technical_language>I want set a version default changing "1" ideal. suggestion db, QueryOptions.newBuilder().setOptimizerVersion("1").build())</technical_language>

Target:
static void clientWithQueryOptions(DatabaseId db) { SpannerOptions options = SpannerOptions.newBuilder() .setDefaultQueryOptions( db, QueryOptions.newBuilder().setOptimizerVersion("1").build()) .build(); Spanner spanner = options.getService(); DatabaseClient dbClient = spanner.getDatabaseClient(db); try (ResultSet resultSet = dbClient .singleUse() .executeQuery(Statement.of("SELECT SingerId, AlbumId, AlbumTitle FROM Albums"))) { while (resultSet.next()) { System.out.printf( "%d %d %s\n", resultSet.getLong(0), resultSet.getLong(1), resultSet.getString(2)); } } }
Source:
<code>public void bundleChanged(BundleEvent event) { int eventType = event.getType(); if (eventType == BundleEvent.STARTING) { progressMonitor.split(5); String symbolicName = event.getBundle().getSymbolicName(); String taskName = NLS.bind(WorkbenchMessages.Startup_Loading, symbolicName); progressMonitor.subTask(taskName); spinEventQueueToUpdateUi(displayForStartupListener); } if (eventType == BundleEvent.STARTED) { progressMonitor.split(5); progressMonitor.subTask(WorkbenchMessages.Startup_Loading_Workbench); <START> <END> } }</code><technical_language>STARTING STARTED in pairs. code accounted for that. nested, if OSGi platform load bundles in parallel (don't if allowed to), in order. invariant is for a bundle get STARTING STARTED. get flickering spin event loop in case, I expect STARTED branch update in UI. Also, else-if more here</technical_language>

Target:
public void bundleChanged(BundleEvent event) { int eventType = event.getType(); if (eventType == BundleEvent.STARTING) { progressMonitor.split(9); String symbolicName = event.getBundle().getSymbolicName(); String taskName = NLS.bind(WorkbenchMessages.Startup_Loading, symbolicName); progressMonitor.subTask(taskName); spinEventQueueToUpdateUi(displayForStartupListener); } if (eventType == BundleEvent.STARTED) { progressMonitor.split(9); progressMonitor.subTask(WorkbenchMessages.Startup_Loading_Workbench); } }
Source:
<code><START> protected int getMaxBinSize() { <END> if (maxBinSize == -1) { maxBinSize = calculateBinIndex(maxFileSizeUpperBound) + 1; } return maxBinSize; }</code><technical_language>change this method fileSize argument</technical_language>

Target:
int getMaxBinSize() { if (maxBinSize == -1) { maxBinSize = nextClosestPowerIndexOfTwo(maxFileSizeUpperBound) - 10 + 1; } return maxBinSize; }
Source:
<code>public RankedAdapterFactoryDescriptor.Registry createFilteredAdapterFactoryRegistry() { String disabledAdapterFactoriesString = getEMFComparePreferences().get( EMFComparePreferences.DISABLED_ADAPTER_FACTORY, ""); final List<String> disabledAdapterFactories = Lists.newArrayList(disabledAdapterFactoriesString .split(";")); <START> Multimap<Collection<?>, RankedAdapterFactoryDescriptor> filteredRegistry = ImmutableListMultimap <END> .copyOf(Multimaps.filterValues(adapterFactoryRegistry, new Predicate<RankedAdapterFactoryDescriptor>() { public boolean apply(RankedAdapterFactoryDescriptor input) { return !disabledAdapterFactories.contains(input.getId()); } })); return new RankedAdapterFactoryDescriptorRegistryImpl( ComposedAdapterFactory.Descriptor.Registry.INSTANCE, filteredRegistry); }</code><technical_language>if require a listmultimap, do create one, ImmutableMultimap#copyOf() instead (i in previous review, sorry)</technical_language>

Target:
public RankedAdapterFactoryDescriptor.Registry createFilteredAdapterFactoryRegistry() { String disabledAdapterFactoriesString = getEMFComparePreferences().get( EMFComparePreferences.DISABLED_ADAPTER_FACTORY, ""); final List<String> disabledAdapterFactories = Lists.newArrayList(disabledAdapterFactoriesString .split(";")); Multimap<Collection<?>, RankedAdapterFactoryDescriptor> filteredRegistry = ImmutableMultimap .copyOf(Multimaps.filterValues(adapterFactoryRegistry, new Predicate<RankedAdapterFactoryDescriptor>() { public boolean apply(RankedAdapterFactoryDescriptor input) { return !disabledAdapterFactories.contains(input.getId()); } })); return new RankedAdapterFactoryDescriptorRegistryImpl( ComposedAdapterFactory.Descriptor.Registry.INSTANCE, filteredRegistry); }
Source:
<code>private void completeSlaveNames(BusinessEntityMap<VdsNetworkInterface> nicsFromBackend, HostNic bond) { <START> if (bond.getBonding().isSetSlaves()) { <END> for (HostNic slave : bond.getBonding().getSlaves().getHostNics()) { if (!slave.isSetName() && slave.isSetId()){ Guid slaveId = new Guid(slave.getId()); String slaveNameFromBackend = nicsFromBackend.get(slaveId).getName(); slave.setName(slaveNameFromBackend); } } } }</code><technical_language>call "bond.getBonding()" return null, need check: if (bond.isSetBonding() && bond.getBonding().isSetSlaves()) { ... }</technical_language>

Target:
private void completeSlaveNames(BusinessEntityMap<VdsNetworkInterface> nicsFromBackend, HostNic bond) { if (bond.isSetBonding() && bond.getBonding().isSetSlaves()) { for (HostNic slave : bond.getBonding().getSlaves().getHostNics()) { if (!slave.isSetName() && slave.isSetId()){ Guid slaveId = new Guid(slave.getId()); String slaveNameFromBackend = nicsFromBackend.get(slaveId).getName(); slave.setName(slaveNameFromBackend); } } } }
Source:
<code>public String getExceptionMessage(Throwable t) { if (t instanceof CompletionException) { Throwable cause = t.getCause(); if (cause != null) <START> t = cause; <END> } String message = t.getLocalizedMessage(); if (t instanceof LocalizedException) { final LocalizedException localizedException = (LocalizedException) t; final String key = localizedException.getMessageKey(); if (keysMap.containsKey(key)) { message = getLocalizedMessage(keysMap.get(key), (Object[]) localizedException.getMessageParameters()); } } if (StringUtils.isEmpty(message) && t.getCause() != null) { if (t.getCause() instanceof LocalizedException) { final LocalizedException localizedException = (LocalizedException) t.getCause(); final String key = localizedException.getMessageKey(); if (keysMap.containsKey(key)) { message = getLocalizedMessage(keysMap.get(key), (Object[]) localizedException.getMessageParameters()); } } else { message = t.getCause().getLocalizedMessage(); } } if (StringUtils.isEmpty(message)) { message = t.toString(); } return message; }</code><technical_language>reassign this variable? create new</technical_language>

Target:
public String getExceptionMessage(Throwable t) { if (t instanceof CompletionException) { Throwable cause = t.getCause(); if (cause != null) return getExceptionMessage(cause); } String message = t.getLocalizedMessage(); if (t instanceof LocalizedException) { final LocalizedException localizedException = (LocalizedException) t; final String key = localizedException.getMessageKey(); if (keysMap.containsKey(key)) { message = getLocalizedMessage(keysMap.get(key), (Object[]) localizedException.getMessageParameters()); } } if (StringUtils.isEmpty(message) && t.getCause() != null) { if (t.getCause() instanceof LocalizedException) { final LocalizedException localizedException = (LocalizedException) t.getCause(); final String key = localizedException.getMessageKey(); if (keysMap.containsKey(key)) { message = getLocalizedMessage(keysMap.get(key), (Object[]) localizedException.getMessageParameters()); } } else { message = t.getCause().getLocalizedMessage(); } } if (StringUtils.isEmpty(message)) { message = t.toString(); } return message; }
Source:
<code>private void testStartAndCompleteTask(ResponseHandler responseHandler) { Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_USERTASK); assertThat(processInstanceId).isNotNull(); List<ProcessInstance> processInstances = queryClient.findProcessInstances(0, 100); assertThat(processInstances).isNotNull().hasSize(1); assertThat(processInstances.get(0)).isNotNull(); assertThat(processInstances.get(0).getState()).isEqualTo(org.kie.api.runtime.process.ProcessInstance.STATE_ACTIVE); List<TaskSummary> tasks = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertThat(tasks).hasSize(1); Long taskId = tasks.get(0).getId(); taskClient.setResponseHandler(responseHandler); taskClient.startTask(CONTAINER_ID, taskId, USER_YODA); taskClient.completeTask(CONTAINER_ID, taskId, USER_YODA, new HashMap<String, Object>()); <START> delay(); <END> taskClient.setResponseHandler(new RequestReplyResponseHandler()); tasks = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertThat(tasks).hasSize(1); taskId = tasks.get(0).getId(); taskClient.setResponseHandler(responseHandler); taskClient.startTask(CONTAINER_ID, taskId, USER_YODA); taskClient.completeTask(CONTAINER_ID, taskId, USER_YODA, new HashMap<String, Object>()); delay(); ProcessInstance processInstance = queryClient.findProcessInstanceById(processInstanceId); assertThat(processInstance).isNotNull(); assertThat(processInstance.getState()).isEqualTo(org.kie.api.runtime.process.ProcessInstance.STATE_COMPLETED); }</code><technical_language>issue is previous Thread.sleep</technical_language>

Target:
private void testStartAndCompleteTask(ResponseHandler responseHandler) throws Exception { Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_USERTASK); assertThat(processInstanceId).isNotNull(); List<ProcessInstance> processInstances = queryClient.findProcessInstances(0, 100); assertThat(processInstances).isNotNull().hasSize(1); assertThat(processInstances.get(0)).isNotNull(); assertThat(processInstances.get(0).getState()).isEqualTo(org.kie.api.runtime.process.ProcessInstance.STATE_ACTIVE); List<TaskSummary> tasks = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertThat(tasks).hasSize(1); Long taskId = tasks.get(0).getId(); taskClient.setResponseHandler(responseHandler); taskClient.startTask(CONTAINER_ID, taskId, USER_YODA); taskClient.completeTask(CONTAINER_ID, taskId, USER_YODA, new HashMap<String, Object>()); taskClient.setResponseHandler(new RequestReplyResponseHandler()); KieServerSynchronization.waitForTaskStatus(taskClient, taskId, Status.Completed.name()); tasks = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertThat(tasks).hasSize(1); taskId = tasks.get(0).getId(); taskClient.setResponseHandler(responseHandler); taskClient.startTask(CONTAINER_ID, taskId, USER_YODA); taskClient.completeTask(CONTAINER_ID, taskId, USER_YODA, new HashMap<String, Object>()); KieServerSynchronization.waitForProcessInstanceToFinish(processClient, CONTAINER_ID, processInstanceId); }
Source:
<code>public void testTDJobRequestParamsWithHiveEngineVersion() throws Exception { Path projectPath = Paths.get("").normalize().toAbsolutePath(); Config config = newConfig() .set("database", "testdb") .set("query", "select 1") .set("engine", "hive") <START> .set("hive_engine_version", "stable") <END> .set("presto_engine_version", "current"); when(op.submitNewJobWithRetry(any(TDJobRequest.class))).thenReturn(""); when(op.getDatabase()).thenReturn("testdb"); TDJobRequest jobRequest = testTDJobRequestParams(projectPath, config); assertEquals("testdb", jobRequest.getDatabase()); assertEquals("select 1", jobRequest.getQuery()); assertEquals("hive", jobRequest.getType().toString() ); assertTrue(jobRequest.getEngineVersion().isPresent()); assertEquals("stable", jobRequest.getEngineVersion().get().toString()); }</code><technical_language>adding engine_version check new parameter expectedly overrides it</technical_language>

Target:
public void testTDJobRequestParamsWithHiveEngineVersion() throws Exception { Path projectPath = Paths.get("").normalize().toAbsolutePath(); String stmt = "select 1"; Config config = newConfig() .set("database", "testdb") .set("query", stmt) .set("engine", "hive") .set("hive_engine_version", "stable"); when(op.submitNewJobWithRetry(any(TDJobRequest.class))).thenReturn(""); when(op.getDatabase()).thenReturn("testdb"); TDJobRequest jobRequest = testTDJobRequestParams(projectPath, config); assertEquals("testdb", jobRequest.getDatabase()); assertEquals(wrapStmtWithComment(taskRequest, stmt), jobRequest.getQuery()); assertEquals("hive", jobRequest.getType().toString() ); assertTrue(jobRequest.getEngineVersion().isPresent()); assertEquals("stable", jobRequest.getEngineVersion().get().toString()); }
Source:
<code>private static List<String> getEndpointURLs(JSONObject endpointConfig, String type, String apiName) { List<String> urls = new ArrayList<>(); if (endpointConfig != null) { try { Object item; item = endpointConfig.get(type); if (item instanceof JSONArray) { JSONArray endpointsJSON = new JSONArray(endpointConfig.getJSONArray(type).toString()); for (int i = 0; i < endpointsJSON.length(); i++) { try { String urlValue = endpointsJSON.getJSONObject(i).get(APIConstants.API_DATA_URL).toString(); urls.add(urlValue); } catch (JSONException ex) { log.error("Endpoint URL extraction from endpoints JSON object failed in API: " + apiName, ex); } } } else if (item instanceof JSONObject) { JSONObject endpointJSON = new JSONObject(endpointConfig.getJSONObject(type).toString()); try { String urlValue = endpointJSON.get(APIConstants.API_DATA_URL).toString(); urls.add(urlValue); } catch (JSONException ex) { log.error("Endpoint URL extraction from endpoint JSON object failed in API: " + apiName, ex); } } } catch (JSONException ex) { <START> log.info("Endpoint type: " + type + " not found in API: " + apiName); <END> } } return urls; }</code><technical_language>this scenario ignored</technical_language>

Target:
private static List<String> getEndpointURLs(JSONObject endpointConfig, String type, String apiName) throws APIImportExportException { List<String> urls = new ArrayList<>(); if (endpointConfig != null) { try { Object item; item = endpointConfig.get(type); if (item instanceof JSONArray) { JSONArray endpointsJSON = new JSONArray(endpointConfig.getJSONArray(type).toString()); for (int i = 0; i < endpointsJSON.length(); i++) { try { String urlValue = endpointsJSON.getJSONObject(i).get(APIConstants.API_DATA_URL).toString(); urls.add(urlValue); } catch (JSONException ex) { log.error("Endpoint URL extraction from endpoints JSON object failed in API: " + apiName, ex); } } } else if (item instanceof JSONObject) { JSONObject endpointJSON = new JSONObject(endpointConfig.getJSONObject(type).toString()); try { String urlValue = endpointJSON.get(APIConstants.API_DATA_URL).toString(); urls.add(urlValue); } catch (JSONException ex) { log.error("Endpoint URL extraction from endpoint JSON object failed in API: " + apiName, ex); } } } catch (JSONException ex) { String errorMsg = "Endpoint type: " + type + " not found in API: " + apiName; throw new APIImportExportException(errorMsg); } } return urls; }
Source:
<code>private Map<String, String> getTableOptions(final int tableId) throws CatalogException { Connection conn = null; PreparedStatement pstmt = null; ResultSet res = null; Map<String, String> options = TUtil.newHashMap(); try { String tidSql = "SELECT key_, value_ FROM " + TB_OPTIONS + " WHERE TID=?"; conn = getConnection(); pstmt = conn.prepareStatement(tidSql); pstmt.setInt(1, tableId); res = pstmt.executeQuery(); while (res.next()) { String key = res.getString("KEY_"); String value = res.getString("VALUE_"); <START> options.put(key, value); <END> } } catch (SQLException se) { throw new CatalogException(se); } finally { CatalogUtil.closeQuietly(pstmt, res); } return options; }</code><technical_language>New objects unnecessary resources. I t more if create new String objects follows. options.put(res.getString("KEY_"), res.getString("VALUE_"));</technical_language>

Target:
private Map<String, String> getTableOptions(final int tableId) throws CatalogException { Connection conn = null; PreparedStatement pstmt = null; ResultSet res = null; Map<String, String> options = TUtil.newHashMap(); try { String tidSql = "SELECT key_, value_ FROM " + TB_OPTIONS + " WHERE TID=?"; conn = getConnection(); pstmt = conn.prepareStatement(tidSql); pstmt.setInt(1, tableId); res = pstmt.executeQuery(); while (res.next()) { options.put(res.getString("KEY_"), res.getString("VALUE_")); } } catch (SQLException se) { throw new CatalogException(se); } finally { CatalogUtil.closeQuietly(pstmt, res); } return options; }
Source:
<code>protected String decrypt(String value) { try { Logger.d(TAG, "Started decrypt"); final byte[] bytes = value != null ? Base64.decode(value, Base64.DEFAULT) : new byte[0]; SecretKey secretKey = getSecretKeyForAPI(); Cipher pbeCipher = Cipher.getInstance(CIPHER_ALGORITHM); IvParameterSpec ivSpec = new IvParameterSpec(IV); pbeCipher.init(Cipher.DECRYPT_MODE, secretKey, ivSpec); String decrypted = new String(pbeCipher.doFinal(bytes), AuthenticationConstants.ENCODING_UTF8); Logger.d(TAG, "Finished decryption"); return decrypted; } catch (Exception e) { <START> Logger.e(TAG, "It failed to use encryption", "", ADALError.ENCRYPTION_FAILED); <END> } return value; }</code><technical_language>log exception itself</technical_language>

Target:
protected String decrypt(String value) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, KeyStoreException, CertificateException, NoSuchProviderException, InvalidAlgorithmParameterException, UnrecoverableEntryException, IOException, InvalidKeyException, DigestException, IllegalBlockSizeException, BadPaddingException { Logger.d(TAG, "Starting decryption"); if (StringExtensions.IsNullOrBlank(value)) { throw new IllegalArgumentException("input is empty or null"); } if (!value.substring(0, ENCODE_VERSION_LENGTH).equals(ENCODE_VERSION)) { throw new IllegalArgumentException("Encode version does not match"); } final byte[] bytes = Base64.decode(value.substring(ENCODE_VERSION_LENGTH), Base64.DEFAULT); String keyVersionCheck = new String(bytes, 0, KEY_VERSION_BLOB_LENGTH, AuthenticationConstants.ENCODING_UTF8); SecretKey versionKey = getKeyForVersion(keyVersionCheck); SecretKey versionMacKey = getMacKey(versionKey); int ivIndex = bytes.length - DATA_KEY_LENGTH - MAC_LENGTH; int macIndex = bytes.length - MAC_LENGTH; int encryptedLength = ivIndex - KEY_VERSION_BLOB_LENGTH; if (ivIndex < 0 || macIndex < 0 || encryptedLength < 0) { throw new IllegalArgumentException( "Given value is smaller than the IV vector and MAC length"); } Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM); Mac mac = Mac.getInstance(MAC_ALGORITHM); mac.init(versionMacKey); mac.update(bytes, 0, macIndex); byte[] macDigest = mac.doFinal(); assertMac(bytes, macIndex, bytes.length, macDigest); cipher.init(Cipher.DECRYPT_MODE, versionKey, new IvParameterSpec(bytes, ivIndex, DATA_KEY_LENGTH)); String decrypted = new String(cipher.doFinal(bytes, KEY_VERSION_BLOB_LENGTH, encryptedLength), AuthenticationConstants.ENCODING_UTF8); Logger.d(TAG, "Finished decryption"); return decrypted; }
Source:
<code><START> public <END> UnassociatedEditorStrategyRegistry getUnassociatedEditorStrategyRegistry() { if (unassociatedEditorStrategyRegistry == null) { unassociatedEditorStrategyRegistry = new UnassociatedEditorStrategyRegistry(); } return unassociatedEditorStrategyRegistry; }</code><technical_language>synchronized</technical_language>

Target:
public synchronized UnassociatedEditorStrategyRegistry getUnassociatedEditorStrategyRegistry() { if (unassociatedEditorStrategyRegistry == null) { unassociatedEditorStrategyRegistry = new UnassociatedEditorStrategyRegistry(); } return unassociatedEditorStrategyRegistry; }
Source:
<code>private static void count(Object inputBase, long inputAddress, int inputSize, int[] counts) { long input = inputAddress; Arrays.fill(counts, 0); <START> if (inputSize != 0) { <END> for (int i = 0; i < inputSize; i++) { int symbol = UNSAFE.getByte(inputBase, input) & 0xFF; input++; counts[symbol]++; } } }</code><technical_language>I need this</technical_language>

Target:
private static void count(Object inputBase, long inputAddress, int inputSize, int[] counts) { long input = inputAddress; Arrays.fill(counts, 0); for (int i = 0; i < inputSize; i++) { int symbol = UNSAFE.getByte(inputBase, input) & 0xFF; input++; counts[symbol]++; } }
Source:
<code>public List<String> filterAllRunningServers(List<String> servers) { List<String> running = new LinkedList<>(); for (String server : servers) { <START> Library.letsSleep(100); <END> if (isServerRunning(server)) { running.add(server); } } return running; }</code><technical_language>break requests? I reason for it</technical_language>

Target:
public List<String> filterAllRunningServers(List<String> servers) { List<String> running = new LinkedList<>(); for (String server : servers) { if (isServerRunning(server)) { running.add(server); } } return running; }
Source:
<code>private static boolean isNullableThroughNonNull(Symbol symbol) { List<SymbolMetadata.AnnotationValue> valuesForAnnotation = symbol.metadata().valuesForAnnotation("javax.annotation.Nonnull"); if (valuesForAnnotation == null) { return false; } <START> if (valuesForAnnotation.isEmpty()) { <END> return false; } return checkAnnotationParameter(valuesForAnnotation, "when", "MAYBE") || checkAnnotationParameter(valuesForAnnotation, "when", "UNKNOWN"); }</code><technical_language>I factorize this in condition of previous if</technical_language>

Target:
private static boolean isNullableThroughNonNull(Symbol symbol) { List<SymbolMetadata.AnnotationValue> valuesForAnnotation = symbol.metadata().valuesForAnnotation("javax.annotation.Nonnull"); if (valuesForAnnotation == null || valuesForAnnotation.isEmpty()) { return false; } return checkAnnotationParameter(valuesForAnnotation, "when", "MAYBE") || checkAnnotationParameter(valuesForAnnotation, "when", "UNKNOWN"); }
Source:
<code>public void testGetAllFolders() { this.studyTDI.createFolderTestData(this.commonTestProject.getUniqueID()); this.studyTDI.createFolderTestData(null); final List<FolderReference> allFolders = this.manager.getAllFolders(); <START> Assert.assertTrue(allFolders.size() >= 2); <END> }</code><technical_language>get original size added 2 folders list</technical_language>

Target:
public void testGetAllFolders() { final int originalSize = this.manager.getAllFolders().size(); this.studyTDI.createFolderTestData(this.commonTestProject.getUniqueID()); this.studyTDI.createFolderTestData(null); final int newSize = this.manager.getAllFolders().size(); Assert.assertEquals("The new size should be equal to the original size + 2", originalSize+2, newSize); }
Source:
<code>private Boolean messageComplete(String messageKey, String value) { <START> Boolean exists = redisClientDelegate.withCommandsClient(c -> { <END> return c.exists(messageKey); }); return exists && redisClientDelegate.withCommandsClient(c -> { return c.get(messageKey).equals(value); }); }</code><technical_language>I this is safely concurrent Echo instances. Reads non-blocking, multiple Echoes attempt write 'completed' key here, behavior is clear</technical_language>

Target:
private Boolean messageComplete(String messageKey, String value) { return redisClientDelegate.withCommandsClient(c -> { return getCRC32(value).equals(c.get(messageKey)); }); }
Source:
<code>public SrvResolver build() { DnsSrvResolver srvResolver = this.srvResolver; if (srvResolver == null) { srvResolver = <START> DnsSrvResolvers.newBuilder().cachingLookups(true).retainingDataOnFailures(true).build(); <END> } return new SrvResolver(srvResolver, srvRecord); }</code><technical_language>this a static memoized supplier before</technical_language>

Target:
public SrvResolver build() { DnsSrvResolver srvResolver = this.srvResolver; if (srvResolver == null) { srvResolver = DEFAULT_DNS_RESOLVER.get(); } return new SrvResolver(srvResolver, srvRecord); }
Source:
<code>protected Model readModelWorker(Model model, String filenameOrURI, String baseURI, String syntax) { String mappedURI = mapURI(filenameOrURI) ; if ( log.isDebugEnabled() && !mappedURI.equals(filenameOrURI) ) log.debug("Map: " + filenameOrURI + " => " + mappedURI) ; Lang lang = (syntax != null) ? RDFLanguages.nameToLang(syntax) : RDFLanguages.resourceNameToLang(mappedURI, Lang.RDFXML) ; if ( baseURI == null ) baseURI = SysRIOT.chooseBaseIRI(filenameOrURI) ; try(TypedInputStream in = streamManager.openNoMapOrNull(mappedURI)) { if ( in == null ) { if ( log.isDebugEnabled() ) <START> log.debug("Failed to locate '"+mappedURI+"'") ; <END> throw new NotFoundException("Not found: "+filenameOrURI) ; } Lang lang2 = RDFDataMgr.determineLang(mappedURI, in.getContentType(), lang); model.read(in, baseURI, lang2.getName()) ; } return model ; }</code><technical_language>I understand it, log.debug("Failed locate '{}'", mappedURI) [avoids need](<LINK_0> explicitly check isDebugEnabled()</technical_language>

Target:
protected Model readModelWorker(Model model, String filenameOrURI, String baseURI, String syntax) { String mappedURI = mapURI(filenameOrURI) ; if ( log.isDebugEnabled() && !mappedURI.equals(filenameOrURI) ) log.debug("Map: " + filenameOrURI + " => " + mappedURI) ; Lang lang = (syntax != null) ? RDFLanguages.nameToLang(syntax) : RDFLanguages.resourceNameToLang(mappedURI, Lang.RDFXML) ; if ( baseURI == null ) baseURI = SysRIOT.chooseBaseIRI(filenameOrURI) ; try(TypedInputStream in = streamManager.openNoMapOrNull(mappedURI)) { if ( in == null ) { FmtLog.debug(log, "Failed to locate '%s'", mappedURI); throw new NotFoundException("Not found: "+filenameOrURI) ; } Lang lang2 = RDFDataMgr.determineLang(mappedURI, in.getContentType(), lang); model.read(in, baseURI, lang2.getName()) ; } return model ; }
Source:
<code>private void createClass() throws JClassAlreadyExistsException { <START> builderClass = holder.getGeneratedClass()._class(PUBLIC | STATIC, "IntentBuilder" + ModelConstants.generationSuffix()); <END> builderClass._extends(getSuperClass()); holder.setIntentBuilderClass(builderClass); contextField = ref("context"); intentField = ref("intent"); }</code><technical_language>Here, I name class IntentBuilder. class is risk of conflict. Then, again, a IntentBuilderImpl weird</technical_language>

Target:
private void createClass() throws JClassAlreadyExistsException { builderClass = holder.getGeneratedClass()._class(PUBLIC | STATIC, "IntentBuilder" + generationSuffix()); builderClass._extends(getSuperClass()); holder.setIntentBuilderClass(builderClass); contextField = ref("context"); intentField = ref("intent"); }
Source:
<code>private java.io.File writeDataIfEmptyFile(Folder folder, String fileName, java.io.File fileData) throws IOException{ <START> Logger.warn(this, "The file " + folder.getPath() + fileName + " that is trying to be uploaded is empty. A byte will be written to the file because empty files are not allowed in the system"); <END> FileUtil.write(fileData, emptyFileData); return fileData; }</code><technical_language>include IF in this method well: if(fileData.length() == 0 && !Config.getBooleanProperty("CONTENT_ALLOW_ZERO_LENGTH_FILES", false) in call (line 924) : if (HttpManager.request().getUserAgentHeader().contains("Cyberduck") { writeDataIfEmptyFile(params..) } (line 974) writeDataIfEmptyFile(params..)</technical_language>

Target:
private java.io.File writeDataIfEmptyFile(Folder folder, String fileName, java.io.File fileData) throws IOException{ if(fileData.length() == 0 && !Config.getBooleanProperty("CONTENT_ALLOW_ZERO_LENGTH_FILES", false)){ Logger.warn(this, "The file " + folder.getPath() + fileName + " that is trying to be uploaded is empty. A byte will be written to the file because empty files are not allowed in the system"); FileUtil.write(fileData, emptyFileData); } return fileData; }
Source:
<code>public void eventDispatched(final MIRunningEvent e) { if (fDisableNextRunningEventDmcSet.remove(e.getDMContext())) { return; } if (fRunToLineActiveOperation == null && fStepInToSelectionActiveOperation == null) { getSession().dispatchEvent(new ResumedEvent(e.getDMContext(), e), getProperties()); } else { MIThreadRunState threadState = fThreadRunStates.get(e.getDMContext()); <START> if (threadState.fLatestEvent instanceof SuspendedEvent) { <END> getSession().dispatchEvent(new ResumedEvent(e.getDMContext(), e), getProperties()); } } }</code><technical_language>Please change ISuspendedDMEvent, is generic interface</technical_language>

Target:
public void eventDispatched(final MIRunningEvent e) { if (fDisableNextRunningEventDmcSet.remove(e.getDMContext())) { return; } if (fRunToLineActiveOperation == null && fStepInToSelectionActiveOperation == null) { getSession().dispatchEvent(new ResumedEvent(e.getDMContext(), e), getProperties()); } else { MIThreadRunState threadState = fThreadRunStates.get(e.getDMContext()); if (threadState.fLatestEvent instanceof ISuspendedDMEvent) { getSession().dispatchEvent(new ResumedEvent(e.getDMContext(), e), getProperties()); } } }
Source:
<code>private boolean isSelectedValue(final List<CaptureObjectDefinitionDto> selectedValues, final DataObject dataObject) throws ProtocolAdapterException { final CosemObjectDefinitionDto cosemObjectDefinitionDto = this.dlmsHelperService <START> .readObjectDefinition(dataObject, "capture-object"); <END> final int classId = cosemObjectDefinitionDto.getClassId(); final byte[] obisBytes = cosemObjectDefinitionDto.getLogicalName().toByteArray(); final byte attributeIndex = (byte) cosemObjectDefinitionDto.getAttributeIndex(); final int dataIndex = cosemObjectDefinitionDto.getDataIndex(); if (InterfaceClass.CLOCK.id() == classId && Arrays.equals(OBIS_BYTES_CLOCK, obisBytes) && ClockAttribute.TIME.attributeId() == attributeIndex && 0 == dataIndex) { return true; } for (final CaptureObjectDefinitionDto captureObjectDefinition : selectedValues) { final int classIdSelectedValue = captureObjectDefinition.getClassId(); final byte[] obisBytesSelectedValue = captureObjectDefinition.getLogicalName().toByteArray(); final byte attributeIndexSelectedValue = captureObjectDefinition.getAttributeIndex(); final int dataIndexSelectedValue; if (captureObjectDefinition.getDataIndex() == null) { dataIndexSelectedValue = 0; } else { dataIndexSelectedValue = captureObjectDefinition.getDataIndex(); } if (classIdSelectedValue == classId && Arrays.equals(obisBytesSelectedValue, obisBytes) && attributeIndexSelectedValue == attributeIndex && dataIndexSelectedValue == dataIndex) { return true; } } return false; }</code><technical_language>![MINOR](<LINK_0> Define a constant instead of duplicating this literal "capture-object" 3 times. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private boolean isSelectedValue(final List<CaptureObjectDefinitionDto> selectedValues, final DataObject dataObject) throws ProtocolAdapterException { final CosemObjectDefinitionDto cosemObjectDefinitionDto = this.dlmsHelperService .readObjectDefinition(dataObject, "capture-object"); if (this.isClockDefinition(cosemObjectDefinitionDto)) { return true; } for (final CaptureObjectDefinitionDto captureObjectDefinition : selectedValues) { if (this.isDefinitionOfSameObject(cosemObjectDefinitionDto, captureObjectDefinition)) { return true; } } return false; }