auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void setLocation(String location, Job job) throws IOException { if (DEBUG) LOG.debug("LoadFunc.setLocation(" + location + ", " + job + ")"); storeInUDFContext(PARQUET_COLUMN_INDEX_ACCESS, Boolean.toString(columnIndexAccess)); setInput(location, job); storeInUDFContext(PARQUET_PIG_SCHEMA, pigSchemaToString(schema)); <START> getConfiguration(job).set(PARQUET_PIG_SCHEMA, pigSchemaToString(schema)); <END> storeInUDFContext(PARQUET_PIG_REQUIRED_FIELDS, serializeRequiredFieldList(requiredFieldList)); getConfiguration(job).set(PARQUET_PIG_REQUIRED_FIELDS, serializeRequiredFieldList(requiredFieldList)); getConfiguration(job).set(PARQUET_COLUMN_INDEX_ACCESS, Boolean.toString(columnIndexAccess)); }</code><technical_language>do need mechanisms</technical_language>

Target:
public void setLocation(String location, Job job) throws IOException { if (DEBUG) LOG.debug("LoadFunc.setLocation(" + location + ", " + job + ")"); setInput(location, job); }
Source:
<code><START> public <V> Map<K, V> getNextTrainingDataSplit() { <END> int expectedMiniBatchIndex = nextSplitIndex / numDataSplitsPerMiniBatch; if (expectedMiniBatchIndex > numMiniBatchesPerEpoch) { expectedMiniBatchIndex = numMiniBatchesPerEpoch; } if (expectedMiniBatchIndex == currentMiniBatch) { final Map<K, V> nextTrainingDataSplit = new HashMap<>(); for (final K key : trainingDataSplits.get(nextSplitIndex++)) { final Pair<K, V> keyValuePair = memoryStore.get(key); if (keyValuePair == null) { continue; } nextTrainingDataSplit.put(keyValuePair.getFirst(), keyValuePair.getSecond()); } return nextTrainingDataSplit; } return Collections.emptyMap(); }</code><technical_language>hard parse. refactor I mentioned above? API following. Iterator<Split> getDataSplitsForMiniBatch();</technical_language>

Target:
public <V> Map<K, V> getNextTrainingDataSplit() { if (!trainingDataSplitsIterator.hasNext()) { return Collections.emptyMap(); } final List<K> keyList = trainingDataSplitsIterator.next(); final Map<K, V> nextTrainingDataSplit = new HashMap<>(); for (final K key : keyList) { final Pair<K, V> keyValuePair = memoryStore.get(key); if (keyValuePair == null) { continue; } nextTrainingDataSplit.put(keyValuePair.getFirst(), keyValuePair.getSecond()); } return nextTrainingDataSplit; }
Source:
<code>public AuthenticationResult getAuthTokenInBackground(final AuthenticationRequest request, final BrokerEvent brokerEvent) throws AuthenticationException { verifyNotOnMainThread(); <START> setAndLogBrokerInstallationStatuses(brokerEvent); <END> final Bundle requestBundle = getBrokerOptions(request); final Bundle bundleResult; if (isBrokerAccountServiceSupported()) { bundleResult = BrokerAccountServiceHandler.getInstance().getAuthToken(mContext, requestBundle, brokerEvent); } else { bundleResult = getAuthTokenFromAccountManager(request, requestBundle); } if (bundleResult == null) { Logger.v(TAG, "No bundle result returned from broker for silent request."); return null; } return getResultFromBrokerResponse(bundleResult, request); }</code><technical_language>Is reason put installation check instead of canSwitchToBroker other upriver functions talking broker</technical_language>

Target:
public AuthenticationResult getAuthTokenInBackground(final AuthenticationRequest request, final BrokerEvent brokerEvent) throws AuthenticationException { verifyNotOnMainThread(); setBrokerInstallationStatuses(brokerEvent); final Bundle requestBundle = getBrokerOptions(request); final Bundle bundleResult; if (isBrokerAccountServiceSupported()) { bundleResult = BrokerAccountServiceHandler.getInstance().getAuthToken(mContext, requestBundle, brokerEvent); } else { bundleResult = getAuthTokenFromAccountManager(request, requestBundle); } if (bundleResult == null) { Logger.v(TAG, "No bundle result returned from broker for silent request."); return null; } return getResultFromBrokerResponse(bundleResult, request); }
Source:
<code>public StatementExecution(PreparedStatement statement, boolean clearParameters) { this.statement = statement; if (clearParameters) { try { statement.clearParameters(); <START> } catch (SQLException e) { <END> e.printStackTrace(); } } }</code><technical_language>This hides exception - case clearParameters execute in try block</technical_language>

Target:
public StatementExecution(PreparedStatement statement, boolean clearParameters) { this.statement = statement; if (clearParameters) { try { statement.clearParameters(); } catch (SQLException e) { throw new RuntimeException("Exception while clearing parameters on PreparedStatement", e); } } }
Source:
<code>public Object execute(final Object[] parameters) { final ReactiveCosmosParameterAccessor accessor = new ReactiveCosmosParameterParameterAccessor(getQueryMethod(), parameters); final ResultProcessor processor = getQueryMethod().getResultProcessor().withDynamicProjection(accessor); List<SqlParameter> sqlParameters = getQueryMethod().getParameters().stream() <START> .map(p -> new SqlParameter("@" + p.getName().get(), <END> toCosmosDbValue(parameters[p.getIndex()]))) .collect(Collectors.toList()); SqlQuerySpec querySpec = new SqlQuerySpec(query, sqlParameters); Flux<?> flux = this.operations.runQuery(querySpec, processor.getReturnedType().getDomainType(), processor.getReturnedType().getReturnedType()); return flux; }</code><technical_language>p.getName().orElse("") instead of p.getName().get() avoid NPE</technical_language>

Target:
public Object execute(final Object[] parameters) { final ReactiveCosmosParameterAccessor accessor = new ReactiveCosmosParameterParameterAccessor(getQueryMethod(), parameters); final ResultProcessor processor = getQueryMethod().getResultProcessor().withDynamicProjection(accessor); List<SqlParameter> sqlParameters = getQueryMethod().getParameters().stream() .map(p -> new SqlParameter("@" + p.getName().orElse(""), toCosmosDbValue(parameters[p.getIndex()]))) .collect(Collectors.toList()); SqlQuerySpec querySpec = new SqlQuerySpec(query, sqlParameters); Flux<?> flux = this.operations.runQuery(querySpec, processor.getReturnedType().getDomainType(), processor.getReturnedType().getReturnedType()); return flux; }
Source:
<code>public FlowMetaData deserialiseFlow(String metaData) { FlowMetaDataImpl result; try { <START> ObjectMapper mapper = new ObjectMapper(); <END> SimpleModule m = new SimpleModule(); m.addAbstractTypeMapping(FlowMetaData.class, FlowMetaDataImpl.class); m.addAbstractTypeMapping(FlowElementMetaData.class, FlowElementMetaDataImpl.class); m.addAbstractTypeMapping(Transition.class, TransitionImpl.class); mapper.registerModule(m); result = mapper.readValue(metaData, FlowMetaDataImpl.class); } catch (Exception e) { throw new RuntimeException("Exception has occurred creating flow meta data object!", e); } return result; }</code><technical_language>mapper initialised in constructor once. is need for creating new mapper time</technical_language>

Target:
public FlowMetaData deserialiseFlow(String metaData) { FlowMetaDataImpl result; try { result = this.mapper.readValue(metaData, FlowMetaDataImpl.class); } catch (Exception e) { throw new RuntimeException("Exception has occurred creating flow meta data object!", e); } return result; }
Source:
<code>protected Object getFieldValue(ITmfEvent event, String field) { Object value = null; if (ITmfEvent.EVENT_FIELD_CONTENT.equals(field)) { value = event.getContent().toString(); } else if (ITmfEvent.EVENT_FIELD_TYPE.equals(field)) { value = event.getType().getName(); } else if (ITmfEvent.EVENT_FIELD_TIMESTAMP.equals(field)) { value = event.getTimestamp().toString(); } else if (ITmfEvent.EVENT_FIELD_SOURCE.equals(field)) { value = event.getSource(); } else if (ITmfEvent.EVENT_FIELD_REFERENCE.equals(field)) { value = event.getReference(); } else { ITmfEventField eventField; if (!(field.startsWith(SLASH_STRING))) { eventField = event.getContent().getField(field); } else { List<String> list = getPathList(field); <START> eventField = event.getContent().getSubField(list.toArray(new String[list.size()])); <END> } if (eventField != null) { value = eventField.getValue(); } } return value; }</code><technical_language>enhance api here</technical_language>

Target:
protected Object getFieldValue(ITmfEvent event, String field) { Object value = null; if (ITmfEvent.EVENT_FIELD_CONTENT.equals(field)) { value = event.getContent().toString(); } else if (ITmfEvent.EVENT_FIELD_TYPE.equals(field)) { value = event.getType().getName(); } else if (ITmfEvent.EVENT_FIELD_TIMESTAMP.equals(field)) { value = event.getTimestamp().toString(); } else if (ITmfEvent.EVENT_FIELD_SOURCE.equals(field)) { value = event.getSource(); } else if (ITmfEvent.EVENT_FIELD_REFERENCE.equals(field)) { value = event.getReference(); } else { ITmfEventField eventField; if (!(field.startsWith(SLASH_STRING))) { eventField = event.getContent().getField(field); } else { List<String> list = getPathList(field); ITmfEventField topField = event.getContent(); eventField = getSubField(topField, list); } if (eventField != null) { value = eventField.getValue(); } } return value; }
Source:
<code><START> public EDDifferentialPrivacy(double epsilon, double delta, <END> DataGeneralizationScheme generalization) { super(delta); this.epsilon = epsilon; this.generalization = generalization; this.beta = calculateBeta(epsilon); this.k = calculateK(getDelta(), epsilon, this.beta); }</code><technical_language>this constructor simply call other one</technical_language>

Target:
public EDDifferentialPrivacy(double epsilon, double delta, DataGeneralizationScheme generalization) { this(epsilon, delta, generalization, false); }
Source:
<code>public static boolean transferFilesUnderNewStructure (String sourceFolder, String destFolder, String additionalFolder, boolean move, boolean recursive) { boolean result = true; try { File f = new File(sourceFolder); File file[] = f.listFiles(); for (int i = 0; i < file.length; i++) { File sourceFile = file[i]; File destFile = new File(destFolder + File.separator + file[i].getName()); if (!sourceFile.isHidden()) { if (sourceFile.isFile()) { if (additionalFolder != null && additionalFolder.length() > 0) { destFile = createFolder (destFile.getParentFile(), additionalFolder); destFile = new File(destFile, file[i].getName()); } result = copyFile (sourceFile.getPath(), destFile.getPath() ); } else { if (sourceFile.isDirectory() && recursive && !sourceFile.getName().equals(".") && !sourceFile.getName().equals("..") ) { result = transferFilesUnderNewStructure (sourceFile.getPath(), destFile.getPath(), additionalFolder, move, recursive); } } if (!result) break; if (move) sourceFile.delete(); } } return result; } catch (Exception e) { <START> return false; <END> } }</code><technical_language>log this error user is warned wrong migrating files is handled higher in app</technical_language>

Target:
public static boolean transferFilesUnderNewStructure (String sourceFolder, String destFolder, String additionalFolder, boolean move, boolean recursive) { boolean result = true; try { File f = new File(sourceFolder); File file[] = f.listFiles(); for (int i = 0; i < file.length; i++) { File sourceFile = file[i]; File destFile = new File(destFolder + File.separator + file[i].getName()); if (!sourceFile.isHidden()) { if (sourceFile.isFile()) { if (additionalFolder != null && additionalFolder.length() > 0) { destFile = createFolder (destFile.getParentFile(), additionalFolder); destFile = new File(destFile, file[i].getName()); } result = copyFile (sourceFile.getPath(), destFile.getPath() ); } else { if (sourceFile.isDirectory() && recursive && !sourceFile.getName().equals(".") && !sourceFile.getName().equals("..") ) { result = transferFilesUnderNewStructure (sourceFile.getPath(), destFile.getPath(), additionalFolder, move, recursive); } } if (!result) { Log.e("Alfresco", "File copy failed for " + sourceFile.getName() ); break; } if (move) sourceFile.delete(); } } return result; } catch (Exception e) { Log.e("Alfresco", "Error during file transfer: " + e.getMessage() ); e.printStackTrace(); return false; } }
Source:
<code>public CallStatus call() throws Exception { MapService mapService = getService(); MapServiceContext mapServiceContext = mapService.getMapServiceContext(); QueryRunner queryRunner = mapServiceContext.getMapQueryRunner(getName()); MapContainer mapContainer = mapServiceContext.getMapContainer(name); <START> switch (mapContainer.getMapConfig().getInMemoryFormat()) { <END> case NATIVE: BitSet localPartitions = localPartitions(); if (localPartitions.cardinality() == 0) { result = queryRunner.populateEmptyResult(query, Collections.<Integer>emptyList()); return DONE_RESPONSE; } return new OffloadedImpl(queryRunner, localPartitions); default: result = queryRunner.runIndexOrPartitionScanQueryOnOwnedPartitions(query); return DONE_RESPONSE; } }</code><technical_language>minor: list options explicitly throw in default, if add another storage format spot places requiring attention easily</technical_language>

Target:
public CallStatus call() throws Exception { MapService mapService = getService(); MapServiceContext mapServiceContext = mapService.getMapServiceContext(); QueryRunner queryRunner = mapServiceContext.getMapQueryRunner(getName()); MapContainer mapContainer = mapServiceContext.getMapContainer(name); switch (mapContainer.getMapConfig().getInMemoryFormat()) { case BINARY: case OBJECT: result = queryRunner.runIndexOrPartitionScanQueryOnOwnedPartitions(query); return DONE_RESPONSE; case NATIVE: BitSet localPartitions = localPartitions(); if (localPartitions.cardinality() == 0) { result = queryRunner.populateEmptyResult(query, Collections.<Integer>emptyList()); return DONE_RESPONSE; } else { return new OffloadedImpl(queryRunner, localPartitions); } default: throw new IllegalArgumentException("Unsupported in memory format"); } }
Source:
<code>public Integer invoke() { Integer result = 0; try (InputStream in = cache.getViaStream(key)) { int read = 0; while ((read = in.read(buffer)) != -1) result = result + read; return value = result; } catch (IOException e) { throw new RuntimeException(e); <START> } catch (NullPointerException e) { <END> return null; } }</code><technical_language>I if (in == null) return null is a slightly deal this..</technical_language>

Target:
public Integer invoke() { Integer result = 0; try (InputStream in = cache.getViaStream(key)) { if (in == null) return null; int read = 0; while ((read = in.read(buffer)) != -1) result = result + read; return value = result; } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>public Reader readHtml(final SitePageContext sitePageContext, String pageType, String key, final Set<HtmlElementTransformation> transformations, final Collection<HtmlElementSubstitution> substitutions) throws IOException { Map<String, Object> pageConfig = sitePageContext.getSite().getTheme().getConfigMap(pageType); RemoteCacheKey cacheKey = RemoteCacheKey.create(pageType, key); Number cacheTtl = (Number) pageConfig.get("cacheTtl"); Optional<Integer> version = Optional.absent(); String transformedHtml = requestCachedReader(cacheKey, key, version, new CacheDeserializer<Reader, String>() { @Override public String read(Reader htmlReader) throws IOException { <START> String htmlString = IOUtils.toString(htmlReader); <END> Document document = Jsoup.parseBodyFragment(htmlString); for (HtmlElementTransformation transformation : transformations) { transformation.apply(sitePageContext, siteSet, document); } for (HtmlElementSubstitution substitution : substitutions) { substitution.substitute(document); } return document.getElementsByTag("body").html(); } }); return new StringReader(transformedHtml); }</code><technical_language>absence of this is a problem. Potentially a big one. this coerce TTL for editorial content deposited Lemur CRepo for else. obstacles relying timestamps, timed cache expiration for content newly saved in Lemur show site in a timely fashion. If throw out custom TTL, Lemur content global TTL set for remoteServiceCache, is hour. This degradation in behavior acceptable. root of problem is Ehcache allow set TTL a per-insertion basis, instead flexibility split smaller caches, expiry policy. So, fix refactor Wombat's API classes, instead of sharing CachedRemoteService beans, individual beans inject Cache objects somehow</technical_language>

Target:
public Reader readHtml(final SitePageContext sitePageContext, String pageType, String key, final Set<HtmlElementTransformation> transformations, final Collection<HtmlElementSubstitution> substitutions) throws IOException { RemoteCacheKey cacheKey = RemoteCacheKey.create(RemoteCacheSpace.EDITORIAL_CONTENT, pageType, key); Optional<Integer> version = Optional.absent(); String transformedHtml = requestCachedReader(cacheKey, key, version, (Reader htmlReader) -> { String htmlString = IOUtils.toString(htmlReader); Document document = Jsoup.parseBodyFragment(htmlString); for (HtmlElementTransformation transformation : transformations) { transformation.apply(sitePageContext, siteSet, document); } for (HtmlElementSubstitution substitution : substitutions) { substitution.substitute(document); } return document.getElementsByTag("body").html(); }); return new StringReader(transformedHtml); }
Source:
<code><START> public Integer getWidthPercent () { <END> if (widthPercent == null || widthPercent == 0){ switch (this.width) { case 12: this.widthPercent = 100; break; case 9: this.widthPercent = 75; break; case 8: this.widthPercent = 66; break; case 6: this.widthPercent = 50; break; case 4: this.widthPercent = 33; break; case 3: this.widthPercent = 25; } } return widthPercent; }</code><technical_language>this handle Map, key -></technical_language>

Target:
public Integer getWidthPercent () { if (widthPercent == null || widthPercent == 0){ this.widthPercent = this.mapWithWidthPercent.get(this.width); } return widthPercent; }
Source:
<code>protected String[] customCommandLineValidation() { if (URI == null) { URI = "file:" + REFERENCE.getAbsolutePath(); } if (OUTPUT == null) { final String name = REFERENCE.getName(); final String fastaExt = ReferenceSequenceFileFactory.FASTA_EXTENSIONS.stream() .filter(name::endsWith).findFirst().orElseGet(() -> ""); OUTPUT = new File(REFERENCE.getParentFile(), <START> REFERENCE.getName().replace(fastaExt, IOUtil.DICT_FILE_EXTENSION)); <END> } return null; }</code><technical_language>I this a bug (also implementation in GATK, reveiwing this one.) show wrong please a test a fasta files: break.txt.txt -> break.txt.dict (rather break.dict.fasta break.dict.dict) break.fasta.fasta -> break.fasta.dict</technical_language>

Target:
protected String[] customCommandLineValidation() { if (URI == null) { URI = "file:" + REFERENCE.getAbsolutePath(); } if (OUTPUT == null) { OUTPUT = getDefaultDictionaryForReferenceSequence(REFERENCE); logger.info("Output dictionary will be written in ", OUTPUT); } return null; }
Source:
<code>private void visit( Properties properties ) { if ( properties != null ) { for ( Map.Entry<Object, Object> entry : properties.entrySet() ) { Object v = entry.getValue(); if ( v instanceof String ) { String value = (String) v; String inter = interpolate( value ); <START> if ( value != inter && Objects.nonNull( inter ) ) <END> { entry.setValue( inter ); } } } } }</code><technical_language>nonNull is in Lambda Method Reference this. reason Objects.nonNull introduced in Java 1.8. Simple is better. != null</technical_language>

Target:
private void visit( Properties properties ) { if ( properties != null ) { for ( Map.Entry<Object, Object> entry : properties.entrySet() ) { Object v = entry.getValue(); if ( v instanceof String ) { String value = (String) v; String inter = interpolate( value ); if ( value != inter && inter != null ) { entry.setValue( inter ); } } } } }
Source:
<code>public void onNext(Frame frame) { <START> log.append(new String(frame.getPayload())); <END> }</code><technical_language>log directly</technical_language>

Target:
public void onNext(Frame frame) { log.info(frame.toString()); }
Source:
<code>public void clear() throws CacheAccessException { boolean interrupted = false; while(!cachingTierRef.compareAndSet(realCachingTier, noopCachingTier)) { synchronized (noopCachingTier) { if(cachingTierRef.get() == noopCachingTier) { try { noopCachingTier.wait(); } catch (InterruptedException e) { interrupted = true; } } } } try { authoritativeTier.clear(); } finally { try { realCachingTier.invalidate(); } finally { <START> if(interrupted) { <END> Thread.currentThread().interrupt(); } if(!cachingTierRef.compareAndSet(noopCachingTier, realCachingTier)) { throw new AssertionError("Something bad happened"); } synchronized (noopCachingTier) { noopCachingTier.notify(); } } } }</code><technical_language>This moved authoritative clear call. a party's authoritative tier implementation interrupts</technical_language>

Target:
public void clear() throws CacheAccessException { boolean interrupted = false; while(!cachingTierRef.compareAndSet(realCachingTier, noopCachingTier)) { synchronized (noopCachingTier) { if(cachingTierRef.get() == noopCachingTier) { try { noopCachingTier.wait(); } catch (InterruptedException e) { interrupted = true; } } } } if(interrupted) { Thread.currentThread().interrupt(); } try { authoritativeTier.clear(); } finally { try { realCachingTier.invalidate(); } finally { if(!cachingTierRef.compareAndSet(noopCachingTier, realCachingTier)) { throw new AssertionError("Something bad happened"); } synchronized (noopCachingTier) { noopCachingTier.notify(); } } } }
Source:
<code>private @Nullable ScriptingMarkerSource findMarkerSourceFromAdapters(ITmfTrace trace) { for (IMarkerEventSource source : TmfTraceAdapterManager.getAdapters(trace, IMarkerEventSource.class)) { if <START> (source.getClass() == ScriptingMarkerSource.class) { <END> ScriptingMarkerSource markerSource = (ScriptingMarkerSource) source; if (markerSource.getTrace().equals(trace)) { markerSource.initializeAdapterMarkersLists(); fScriptingMarkerSourceMap.put(trace, markerSource); return markerSource; } } } return null; }</code><technical_language>instanceof</technical_language>

Target:
private @Nullable ScriptingMarkerSource findMarkerSourceFromAdapters(ITmfTrace trace) { for (IMarkerEventSource source : TmfTraceAdapterManager.getAdapters(trace, IMarkerEventSource.class)) { if (source instanceof ScriptingMarkerSource) { ScriptingMarkerSource markerSource = (ScriptingMarkerSource) source; if (Objects.equals(markerSource.getTrace(), trace)) { markerSource.initializeAdapterMarkersLists(); fScriptingMarkerSourceMap.put(trace, markerSource); return markerSource; } } } return null; }
Source:
<code>public void testAddInvalidDataToIndex() throws Exception { startGrid(); grid().cluster().state(ClusterState.ACTIVE); sql("CREATE TABLE TEST (ID INT PRIMARY KEY, VAL_INT INT, VAL_DATE DATE) " + "WITH \"CACHE_NAME=test,VALUE_TYPE=ValueType0\""); sql("CREATE INDEX TEST_0_VAL_DATE_IDX ON TEST(VAL_DATE)"); sql("CREATE INDEX TEST_1_VAL_INT_IDX ON TEST(VAL_INT)"); BinaryObjectBuilder bob = grid().binary().builder("ValueType0"); bob.setField("VAL_INT", 10); bob.setField("VAL_DATE", new java.util.Date()); GridTestUtils.assertThrowsAnyCause(log, () -> { grid().cache("test").put(0, bob.build()); return null; }, CachePartialUpdateCheckedException.class, "Failed to update keys"); <START> sql("DROP INDEX TEST_0_VAL_DATE_IDX"); <END> List<List<?>> res = sql("SELECT VAL_INT FROM TEST WHERE VAL_INT > 0").getAll(); assertEquals(1, res.size()); }</code><technical_language>verify index dropped insert values error</technical_language>

Target:
public void testAddInvalidDataToIndex() throws Exception { startGrid(); grid().cluster().state(ClusterState.ACTIVE); sql("CREATE TABLE TEST (ID INT PRIMARY KEY, VAL_INT INT, VAL_DATE DATE) " + "WITH \"CACHE_NAME=test,VALUE_TYPE=ValueType0\""); sql("CREATE INDEX TEST_0_VAL_DATE_IDX ON TEST(VAL_DATE)"); sql("CREATE INDEX TEST_1_VAL_INT_IDX ON TEST(VAL_INT)"); BinaryObjectBuilder bob = grid().binary().builder("ValueType0"); bob.setField("VAL_INT", 10); bob.setField("VAL_DATE", new java.util.Date()); GridTestUtils.assertThrowsAnyCause(log, () -> { grid().cache("test").put(0, bob.build()); return null; }, CachePartialUpdateCheckedException.class, "Failed to update keys"); sql("DROP INDEX TEST_0_VAL_DATE_IDX"); grid().cache("test").put(1, bob.build()); List<List<?>> res = sql("SELECT VAL_INT FROM TEST WHERE VAL_INT > 0").getAll(); assertEquals(2, res.size()); }
Source:
<code>public void close(Duration timeout) { if (timeout.toMillis() < 0) throw new IllegalArgumentException("The timeout cannot be negative."); acquire(); try { if (!closed) { close(timeout.toMillis(), false); <START> closed = true; <END> } } finally { release(); } }</code><technical_language>motivation change this</technical_language>

Target:
public void close(Duration timeout) { if (timeout.toMillis() < 0) throw new IllegalArgumentException("The timeout cannot be negative."); acquire(); try { if (!closed) { close(timeout.toMillis(), false); } } finally { closed = true; release(); } }
Source:
<code>public static void lockGroupMembership(Group group, List<Member> members) throws InternalErrorException, InterruptedException { if(group == null) throw new InternalErrorException("Group can't be null when creating lock for group and list of members."); if(members == null || members.isEmpty()) throw new InternalErrorException("Members can't be null or empty when creating lock for group and list of members."); Collections.sort(members); List<Lock> returnedLocks = new ArrayList<>(); try { <START> groupsLocks.putIfAbsent(group, new ReentrantReadWriteLock(true)); <END> Lock readGroupLock = groupsLocks.get(group).readLock(); readGroupLock.lock(); returnedLocks.add(readGroupLock); for (Member member : members) { Map<Member, Lock> newLockForMember = new HashMap<>(); newLockForMember.put(member, new ReentrantLock(true)); groupsMembersLocks.putIfAbsent(group, newLockForMember); Lock memberLock = groupsMembersLocks.get(group).get(member); memberLock.lock(); returnedLocks.add(memberLock); } TransactionSynchronizationManager.bindResource(uniqueKey, returnedLocks); } catch (Exception ex) { unlockAll(returnedLocks); throw ex; } }</code><technical_language>constructor of ReentrantReadWriteLock is called time brings unnecessary overhead object constructed cleared garbage collector</technical_language>

Target:
public static void lockGroupMembership(Group group, List<Member> members) throws InternalErrorException, InterruptedException { if(group == null) throw new InternalErrorException("Group can't be null when creating lock for group and list of members."); if(members == null) throw new InternalErrorException("Members can't be null or empty when creating lock for group and list of members."); Collections.sort(members); List<Lock> returnedLocks = new ArrayList<>(); try { ReadWriteLock groupReadWriteLock = groupsLocks.get(group); if(groupReadWriteLock == null) { groupsLocks.putIfAbsent(group, new ReentrantReadWriteLock(true)); groupReadWriteLock = groupsLocks.get(group); } groupReadWriteLock.readLock().lock(); returnedLocks.add(groupReadWriteLock.readLock()); for (Member member : members) { ConcurrentHashMap<Member, Lock> membersLocks = groupsMembersLocks.get(group); if(membersLocks == null) { groupsMembersLocks.putIfAbsent(group, new ConcurrentHashMap<Member, Lock>()); membersLocks = groupsMembersLocks.get(group); } Lock memberLock = membersLocks.get(member); if(memberLock == null) { membersLocks.putIfAbsent(member, new ReentrantLock(true)); memberLock = membersLocks.get(member); } memberLock.lock(); returnedLocks.add(memberLock); } if(TransactionSynchronizationManager.getResource(uniqueKey) == null) { TransactionSynchronizationManager.bindResource(uniqueKey, returnedLocks); } else { ((List<Lock>) TransactionSynchronizationManager.getResource(uniqueKey)).addAll(returnedLocks); } } catch (Exception ex) { unlockAll(returnedLocks); throw ex; } }
Source:
<code>public Pair<Node, JsonObj> optimizePushdown(JobConf jobConf, Deserializer deserializer, ExprNodeDesc exprNodeDesc) { if (exprNodeDesc == null) { return new Pair<Node, JsonObj>(null, null); } Settings settings = HadoopSettingsManager.loadFrom(jobConf); boolean isES50 = SettingsUtils.isEs50(settings); log.info("[PushDown][isES50] : " + isES50); SargableParser sargableParser = EsSargableParser.getInstance(); <START> if (sargableParser == null) { <END> return new Pair<Node, JsonObj>(null, null); } FieldAlias fieldAlias = HiveUtils.alias(settings); HiveTreeBuilder hiveTreeBuilder = new HiveTreeBuilder(fieldAlias, sargableParser); EsTreeParser parser = new EsTreeParser(sargableParser, isES50); String preFilterQuery = settings.getQuery(); if (StringUtils.isNotEmpty(preFilterQuery)) { QueryBuilder rawQuery = QueryUtils.parseQuery(settings); if (rawQuery != null && !(rawQuery instanceof MatchAllQueryBuilder)) { log.info("[PushDown][Pre Filter " + ES_QUERY + "] : " + preFilterQuery); JsonObj preFilterJson = new EsQueryParser(rawQuery, isES50).parse(); parser.setPreFilterJson(preFilterJson); } } OpNode root = hiveTreeBuilder.build(exprNodeDesc); if (root != null) { JsonObj esQuery = parser.parse(root); if (esQuery != null) { log.info("[PushDown][Final Filter " + ES_QUERY + "] : " + esQuery.toQuery()); } return new Pair<Node, JsonObj>(root, esQuery); } return new Pair<Node, JsonObj>(null, null); }</code><technical_language>this null? If is I this silently ignored</technical_language>

Target:
private Pair<Node, JsonObj> optimizePushdown(JobConf jobConf, Deserializer deserializer, ExprNodeDesc exprNodeDesc) { if (exprNodeDesc == null) { return new Pair<Node, JsonObj>(null, null); } Settings settings = HadoopSettingsManager.loadFrom(jobConf); boolean isES50 = SettingsUtils.isEs50(settings); SargableParser sargableParser = new EsSargableParser(); FieldAlias fieldAlias = HiveUtils.alias(settings); HiveTreeBuilder hiveTreeBuilder = new HiveTreeBuilder(fieldAlias, sargableParser); EsTreeParser parser = new EsTreeParser(sargableParser, isES50); OpNode root = hiveTreeBuilder.build(exprNodeDesc); if (root != null) { JsonObj filters = parser.parse(root); if (filters != null) { log.info("[PushDown][Final Filter " + InternalConfigurationOptions.INTERNAL_ES_QUERY_FILTERS + "] : " + filters.toQuery()); } return new Pair<Node, JsonObj>(root, filters); } return new Pair<Node, JsonObj>(null, null); }
Source:
<code>private Set<Point> getStraightPath( Point origin, Point delta, int length, boolean includeImpassable ){ Set<Point> points = new HashSet<>(); Rectangle bounds = new Rectangle(size); Point current = new Point(origin); <START> for (int i=0; i<length; i++){ <END> current.translate(delta.x, delta.y); if ( bounds.contains(current) && (includeImpassable || isPassable(current)) && !hasTypeAt(Pillar.class, current) ){ points.add(new Point(current)); } else { break; } } return points; }</code><technical_language>I familiar rules of Bomberman, a bomb hits a Box, ends destroying box, explosion continue (though for a range of 1, this matter much)</technical_language>

Target:
private Set<Point> getStraightPath( Point origin, Point delta, int length, boolean includeImpassable ){ Set<Point> points = new HashSet<>(); Rectangle bounds = new Rectangle(size); Point current = new Point(origin); for (int i=0; i<length; i++){ current.translate(delta.x, delta.y); if (bounds.contains(current)){ if ( (includeImpassable || isPassable(current)) && !hasTypeAt(Pillar.class, current) ){ points.add(new Point(current)); } if (!isPassable(current)){ break; } } } return points; }
Source:
<code>private boolean shouldBeDistributed(PlanNode planNode) { return planNode instanceof AggregationNode || planNode instanceof JoinNode || <START> (planNode instanceof TopNNode && ((TopNNode) planNode).getStep().equals(TopNNode.Step.PARTIAL)); <END> }</code><technical_language>method grow (i wanted add here), putting this in a more lengthy more readable way? (Note, I changed TopNNode's condition) if (planNode instanceof JoinNode) { return true; } if (planNode instanceof AggregationNode) { return true; // differentiate partial/... } if (planNode instanceof TopNNode) { return ((TopNNode) planNode).getStep() != TopNNode.Step.FINAL; } return false;</technical_language>

Target:
private boolean shouldBeDistributed(PlanNode planNode) { if (planNode instanceof JoinNode) { return true; } if (planNode instanceof AggregationNode) { return true; } if (planNode instanceof TopNNode) { return ((TopNNode) planNode).getStep() == TopNNode.Step.PARTIAL; } return false; }
Source:
<code>public void fillMap(EventFields event, Key key, Value value) { <START> List<Map.Entry<Key,Value>> map = null; <END> try { map = decodeRow(key, value); } catch (Exception e) { } try { if(map != null) { for(Map.Entry<Key,Value> kv : map) { if(visibilityEvaluator.evaluate(kv.getKey().getColumnVisibilityParsed())) { String colq = kv.getKey().getColumnQualifier().toString(); int idx = colq.indexOf(NULL_BYTE); String fieldName = colq.substring(0, idx); String fieldValue = colq.substring(idx + 1); event.put(fieldName, new FieldValue(getColumnVisibility(kv.getKey()), fieldValue.getBytes(), kv.getValue().get())); } } } } catch(Exception e) { throw new RuntimeException(e); } }</code><technical_language>Collections.emptyMap() instead of null avoid null check below</technical_language>

Target:
public void fillMap(EventFields event, Key key, Value value) { List<Map.Entry<Key,Value>> entryList = Collections.emptyList(); try { entryList = decodeRow(key, value); } catch (Exception e) { } try { for(Map.Entry<Key,Value> kv : entryList) { String colq = kv.getKey().getColumnQualifier().toString(); int idx = colq.indexOf(NULL_BYTE); String fieldName = colq.substring(0, idx); String fieldValue = colq.substring(idx + 1); event.put(fieldName, new EventFields.FieldValue(getColumnVisibility(kv.getKey()), fieldValue.getBytes(), kv.getValue().get())); } } catch(Exception e) { throw new RuntimeException(e); } }
Source:
<code>public void schemaReaderTest() throws Exception { MsAccessSchemaReader schemaReader = new MsAccessSchemaReader(); schemaReader.setSource(new FileIOSupplier(getSourceTempFilePath())); schemaReader.setParameter(JDBCSchemaReader.PARAM_USER, Value.of(USER_NAME)); schemaReader.setParameter(JDBCSchemaReader.PARAM_PASSWORD, Value.of(PASSWORD)); <START> schemaReader.setIsSchemaNameQuoted(false); <END> IOReport report = schemaReader.execute(new LogProgressIndicator()); assertTrue(report.isSuccess()); Schema schema = schemaReader.getSchema(); Collection<? extends TypeDefinition> k = schema.getTypes(); for (TypeDefinition def : k) System.out.println(def.getDisplayName()); assertTrue(schema != null); }</code><technical_language>Setting this behavior done in MsAccessSchemaReader class. want customize behavior of class, adaptable user</technical_language>

Target:
public void schemaReaderTest() throws Exception { MsAccessSchemaReader schemaReader = new MsAccessSchemaReader(); schemaReader.setSource(new FileIOSupplier(getSourceTempFilePath())); schemaReader.setParameter(JDBCSchemaReader.PARAM_USER, Value.of(USER_NAME)); schemaReader.setParameter(JDBCSchemaReader.PARAM_PASSWORD, Value.of(PASSWORD)); IOReport report = schemaReader.execute(new LogProgressIndicator()); assertTrue(report.isSuccess()); TEMP_SOURCE_FILE_NAME = null; Schema schema = schemaReader.getSchema(); assertTrue(schema != null); Collection<? extends TypeDefinition> k = schema.getMappingRelevantTypes(); for (TypeDefinition def : k) System.out.println(def.getDisplayName()); checkTables(k); }
Source:
<code>Class<?> forName(String name) throws ClassNotFoundException { if (preferredLoader != null) { return classForName(name, preferredLoader); } try { return classForName(name, contextLoader); } catch (ClassNotFoundException e) { <START> if (JHelper.objectSameReference(callerLoader, contextLoader)) { <END> throw e; } else { return classForName(name, callerLoader); } } }</code><technical_language>matter if == .equals</technical_language>

Target:
Class<?> forName(String name) throws ClassNotFoundException { if (preferredLoader != null) { return classForName(name, preferredLoader); } try { return classForName(name, contextLoader); } catch (ClassNotFoundException e) { if (callerLoader == contextLoader) { throw e; } else { return classForName(name, callerLoader); } } }
Source:
<code><START> BasicAuthInterceptor(ZipkinElasticsearchHttpStorageProperties es) { <END> this.es = es; }</code><technical_language>this dynamic, initialize credentials request</technical_language>

Target:
BasicAuthInterceptor(ZipkinElasticsearchHttpStorageProperties es) { basicCredentials = Credentials.basic(es.getUsername(), es.getPassword()); }
Source:
<code>public void stop(StopContext context) { JChannel channel = this.getValue(); channel.disconnect(); if (channel instanceof JChannel) { <START> try { <END> JmxConfigurator.unregisterChannel((JChannel) channel, this.server.getValue(), this.name); } catch (Exception e) { LOGGER.debug(e.getMessage(), e); } } }</code><technical_language>.. below</technical_language>

Target:
public void stop(StopContext context) { JChannel channel = this.getValue(); channel.disconnect(); try { JmxConfigurator.unregisterChannel(channel, this.server.getValue(), this.name); } catch (Exception e) { LOGGER.debug(e.getMessage(), e); } }
Source:
<code>public void should_report_warnings_per_axis() { String file = "matrix-warnings.txt"; MatrixProject job = setupJob("/warnings_plugin/" + file, MatrixProject.class, WarningsBuildSettings.class, new AnalysisConfigurator<WarningsBuildSettings>() { @Override public void configure(WarningsBuildSettings settings) { settings.addConsoleParser("GNU C Compiler 4 (gcc)"); } }); job.configure(); job.addUserAxis("user_axis", "one two three"); job.addShellStep("cat " + file + "| grep $user_axis"); job.save(); Build build = buildSuccessfulJob(job); String title = "GNU C Compiler Warnings"; assertThatActionExists(job, build, title); build.open(); assertThat(driver, hasContent(title + ": 12")); Map<String, Integer> warningsPerAxis = new HashMap<>(); warningsPerAxis.put("user_axis=one", 4); warningsPerAxis.put("user_axis=two", 6); warningsPerAxis.put("user_axis=three", 2); for (MatrixConfiguration axis : job.getConfigurations()) { Build axisBuild = axis.getLastBuild(); assertThat(axisBuild, hasAction(title)); assertThat(driver, hasContent(title + ": " + warningsPerAxis.get(axis.name))); } try { <START> TimeUnit.SECONDS.sleep(1); <END> } catch (InterruptedException e) { } driver.navigate().refresh(); assertThatConfigurationTabIsCorrectlyFilled(job); assertThatFoldersTabIsCorrectlyFilled(job); assertThatFilesTabIsCorrectlyFilled(job); }</code><technical_language>CapybaraPortingLayerImpl#sleep simplifies this</technical_language>

Target:
public void should_report_warnings_per_axis() { String file = "matrix-warnings.txt"; MatrixProject job = setupJob("/warnings_plugin/" + file, MatrixProject.class, WarningsBuildSettings.class, new AnalysisConfigurator<WarningsBuildSettings>() { @Override public void configure(WarningsBuildSettings settings) { settings.addConsoleParser("GNU C Compiler 4 (gcc)"); } }); job.configure(); job.addUserAxis("user_axis", "one two three"); job.addShellStep("cat " + file + "| grep $user_axis"); job.save(); Build build = buildSuccessfulJob(job); String title = "GNU C Compiler Warnings"; assertThatActionExists(job, build, title); build.open(); assertThat(driver, hasContent(title + ": 12")); Map<String, Integer> warningsPerAxis = new HashMap<>(); warningsPerAxis.put("user_axis=one", 4); warningsPerAxis.put("user_axis=two", 6); warningsPerAxis.put("user_axis=three", 2); for (MatrixConfiguration axis : job.getConfigurations()) { Build axisBuild = axis.getLastBuild(); assertThat(axisBuild, hasAction(title)); assertThat(driver, hasContent(title + ": " + warningsPerAxis.get(axis.name))); } sleep(1000); driver.navigate().refresh(); assertThatConfigurationTabIsCorrectlyFilled(job); assertThatFoldersTabIsCorrectlyFilled(job); assertThatFilesTabIsCorrectlyFilled(job); }
Source:
<code>public List<LongSplit> snapshotState(long checkpointId) { if (split == null) { return Collections.emptyList(); } throttle = split.numCompletedCheckpoints >= minCheckpoints; <START> LOG.info("Snapshotted @ subtask (~{} attempt)", split, split.nextNumber % split.increment, numRestarts); <END> return singletonList(split); }</code><technical_language>~</technical_language>

Target:
public List<LongSplit> snapshotState(long checkpointId) { if (split == null) { return Collections.emptyList(); } throttle = split.numCompletedCheckpoints >= minCheckpoints; LOG.info("Snapshotted @ subtask ({} attempt)", split, split.nextNumber % split.increment, numRestarts); return singletonList(split); }
Source:
<code>public void outjectRequestMap() { for (ValuedParameter vparameter : methodInfo.getValuedParameters()) { <START> result.include(vparameter.getParameter().getName(), vparameter.getValue()); <END> } }</code><technical_language>create a vparameter.getName() delegates Parameter</technical_language>

Target:
public void outjectRequestMap() { for (ValuedParameter vparameter : methodInfo.getValuedParameters()) { result.include(vparameter.getName(), vparameter.getValue()); } }
Source:
<code>public List<RemoteReference> lsRemote(LsRemoteRequest request) throws UnauthorizedException, GitException { String remoteUrl = request.getRemoteUrl(); LsRemoteCommand lsRemoteCommand = getGit().lsRemote(); lsRemoteCommand.setRemote(remoteUrl); Collection<Ref> refs; try { refs = lsRemoteCommand.call(); } catch (GitAPIException exception) { if (exception.getMessage().contains(ERROR_AUTHENTICATION_REQUIRED)) { throw new UnauthorizedException(String.format(ERROR_AUTHENTICATION_FAILED, remoteUrl)); } else { throw new GitException(exception.getMessage(), exception); } } <START> List<RemoteReference> remoteRefs = new ArrayList<>(refs.size()); <END> for (Ref ref : refs) { String commitId = ref.getObjectId().name(); String name = ref.getName(); RemoteReference remoteRef = newDto(RemoteReference.class).withCommitId(commitId).withReferenceName(name); remoteRefs.add(remoteRef); } return remoteRefs; }</code><technical_language>stream api</technical_language>

Target:
public List<RemoteReference> lsRemote(LsRemoteRequest request) throws UnauthorizedException, GitException { String remoteUrl = request.getRemoteUrl(); LsRemoteCommand lsRemoteCommand = getGit().lsRemote().setRemote(remoteUrl); Collection<Ref> refs; try { refs = lsRemoteCommand.call(); } catch (GitAPIException exception) { if (exception.getMessage().contains(ERROR_AUTHENTICATION_REQUIRED)) { throw new UnauthorizedException(String.format(ERROR_AUTHENTICATION_FAILED, remoteUrl)); } else { throw new GitException(exception.getMessage(), exception); } } return refs.stream() .map(ref -> newDto(RemoteReference.class).withCommitId(ref.getObjectId().name()).withReferenceName(ref.getName())) .collect(Collectors.toList()); }
Source:
<code>private static void appendMyPlacesLayers(final JSONArray layerList, final List<Long> publishedMyPlaces, final User user, final long viewID, final Set<String> bundleIds, final String mapSrs, final boolean useDirectURL, final boolean modifyURLs, final JSONArray plugins) { if (publishedMyPlaces.isEmpty()) { return; } final boolean myPlacesBundlePresent = isMyplacesBundlePresent(bundleIds); final String uuid = user.getUuid(); final List<MyPlaceCategory> myPlacesLayers = myPlaceService .getMyPlaceLayersById(publishedMyPlaces); for (MyPlaceCategory mpLayer : myPlacesLayers) { if (!mpLayer.isPublished() && !mpLayer.isOwnedBy(uuid)) { LOGGER.info("Found my places layer in selected that is no longer published. ViewID:", viewID, "Myplaces layerId:", mpLayer.getId()); continue; } if (myPlacesBundlePresent && mpLayer.isOwnedBy(uuid)) { continue; } JSONObject myPlaceLayer = null; <START> if (plugins != null && plugins.toString().indexOf(PLUGIN_WFSVECTORLAYER) != -1) { <END> myPlaceLayer = MyPlacesService.parseLayerToJSON(mpLayer, mapSrs); JSONHelper.putValue(myPlaceLayer, LayerJSONFormatter.KEY_TYPE, OskariLayer.TYPE_WFS); } if (myPlaceLayer != null) { layerList.put(myPlaceLayer); } } }</code><technical_language>I need check plugin anymore. present matter now. frontend show this a wfslayer log a warning doesnt recognize a layer type wfs. This if-statement removed true if frontend ignores layer if show it. This do transition period supporting new WFS-client transport</technical_language>

Target:
private static void appendMyPlacesLayers(final JSONArray layerList, final List<Long> publishedMyPlaces, final User user, final long viewID, final Set<String> bundleIds, final String mapSrs, final boolean useDirectURL, final boolean modifyURLs, final JSONArray plugins) { if (publishedMyPlaces.isEmpty()) { return; } final boolean myPlacesBundlePresent = isMyplacesBundlePresent(bundleIds); final String uuid = user.getUuid(); final List<MyPlaceCategory> myPlacesLayers = myPlaceService .getMyPlaceLayersById(publishedMyPlaces); for (MyPlaceCategory mpLayer : myPlacesLayers) { if (!mpLayer.isPublished() && !mpLayer.isOwnedBy(uuid)) { LOGGER.info("Found my places layer in selected that is no longer published. ViewID:", viewID, "Myplaces layerId:", mpLayer.getId()); continue; } if (myPlacesBundlePresent && mpLayer.isOwnedBy(uuid)) { continue; } JSONObject myPlaceLayer = MyPlacesService.parseLayerToJSON(mpLayer, mapSrs); JSONHelper.putValue(myPlaceLayer, LayerJSONFormatter.KEY_TYPE, OskariLayer.TYPE_WFS); layerList.put(myPlaceLayer); } }
Source:
<code>public URI getSvnUrl() throws SubversionPluginTestException { <START> String url = PROTOCOL_SVN + ipBound(80) + ':' + port(3690); <END> return createUri(url); }</code><technical_language>is supposed ipBound(3690)</technical_language>

Target:
public URI getSvnUrl() throws SubversionPluginTestException { String url = PROTOCOL_SVN + ipBound(3690) + ':' + port(3690); return createUri(url); }
Source:
<code>protected Optional<TypedValue> getValue(String name, StatementContext ctx2) { @SuppressWarnings("unchecked") PojoProperty<Object> property = (PojoProperty<Object>) properties.getProperties().get(name); if (property == null) { return Optional.empty(); } <START> return Optional.of(new TypedValue(property.getQualifiedType(), property.get(obj))); <END> }</code><technical_language>Do opinion (in future, now, get this done already) rewriting this similar lines Optional.ofNullable(property).map(prop -> new TypedValue(prop.getQualifiedType(), prop.get(obj)))</technical_language>

Target:
protected Optional<TypedValue> getValue(String name, StatementContext ctx2) { @SuppressWarnings("unchecked") PojoProperty<Object> property = (PojoProperty<Object>) properties.getProperties().get(name); return Optional.ofNullable(property) .map(p -> new TypedValue(p.getQualifiedType(), p.get(obj))); }
Source:
<code>public static boolean <START> isInvalidBranchName(String <END> branchName) { if (HEAD.equals(branchName)) { return true; } if ((R_HEADS + HEAD).equals(branchName)) { return true; } return branchName.startsWith("-"); }</code><technical_language>optional: I easier understand if reversed, isValidBranchName. more consistent Repository#isValidRefName, too</technical_language>

Target:
public static boolean isInvalidBranchName(String branchName) { if (HEAD.equals(branchName)) { return true; } return branchName.startsWith("-"); }
Source:
<code>public List<DevfileLocation> devfileFileLocations() { return devfileFilenames .stream() <START> .map( <END> f -> new DevfileLocation() { @Override public Optional<String> filename() { return Optional.ofNullable(f); } @Override public String location() { return rawFileLocation(f); } }) .collect(Collectors.toList()); }</code><technical_language>move DevfileLocation creation a method, reference method in stream. devfileFilename null, Optional.of(String) public List<DevfileLocation> devfileFileLocations() { return devfileFilenames .stream() .map(this::createDevfileLocation) .collect(Collectors.toList()); } private DevfileLocation createDevfileLocation(String devfileFilename) { return new DevfileLocation() { @Override public Optional<String> filename() { return Optional.of(devfileFilename); } @Override public String location() { return rawFileLocation(devfileFilename); } }; } WDYT</technical_language>

Target:
public List<DevfileLocation> devfileFileLocations() { return devfileFilenames.stream().map(this::createDevfileLocation).collect(Collectors.toList()); }
Source:
<code>public void setUp() { <START> setting = new SettingImpl<>(new SimpleUri("engine-tests:TestSetting"), <END> 50, new RangedNumberValidator<>(0, 100, false, false)); eventResult = -1; setting.subscribe(propertyChangeEvent -> eventResult = (int) propertyChangeEvent.getNewValue()); }</code><technical_language>put SimpleUri in a variable, constructor call cleaner visually</technical_language>

Target:
public void setUp() { setting = new SettingImpl<>(SETTING_ID, 50, new RangedNumberValidator<>(0, 100, false, false)); eventResult = -1; setting.subscribe(propertyChangeEvent -> eventResult = (int) propertyChangeEvent.getNewValue()); }