auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> private void assertVcAreEqual(final VariantContext actual, final VariantContext expected) { <END> if (expected == null) { Assert.assertNull(actual); return; } Assert.assertNotNull(actual); Assert.assertEquals(actual.getContig(), expected.getContig()); Assert.assertEquals(actual.getStart(), expected.getStart()); Assert.assertEquals(actual.getEnd(), expected.getEnd()); expected.getAlleles().sort(new AlleleComparator()); actual.getAlleles().sort(new AlleleComparator()); Assert.assertEquals(expected.getAlleles(), actual.getAlleles()); assertGenotypeContextsAreEquals(actual.getGenotypes(), expected.getGenotypes()); }</code><technical_language>Assert.equals(actual, expected)? work. tests in VC class I believe</technical_language>

Target:
private void assertVcAreEqual(final VariantContext actual, final VariantContext expected) { if (expected == null) { Assert.assertNull(actual); return; } Assert.assertNotNull(actual, "null status"); Assert.assertEquals(actual.getContig(), expected.getContig(),"Different contigs: "); Assert.assertEquals(actual.getStart(), expected.getStart(), "Different starts: "); Assert.assertEquals(actual.getEnd(), expected.getEnd(), "Different ends: "); Assert.assertTrue(actual.hasSameAllelesAs(expected), "Alleles differ between " + actual + " and " + expected + ": "); assertGenotypeContextsAreEquals(actual.getGenotypes(), expected.getGenotypes()); }
Source:
<code>Byte[] toBytes(Integer v) { Byte[] barr = ArrayUtils.toObject(ByteBuffer.allocate(9).putLong(1, v).array()); <START> barr[0] = 0x19; <END> return barr; }</code><technical_language>ValueTag.XS_INTEGER_TAG instead of hard coding tag</technical_language>

Target:
Byte[] toBytes(Integer v) { Byte[] barr = ArrayUtils.toObject(ByteBuffer.allocate(9).putLong(1, v).array()); barr[0] = ValueTag.XS_INTEGER_TAG; return barr; }
Source:
<code>public static RoomValidationHelper createInstance(){ <START> Injector injector = Guice.createInjector(new RoomRuntimeModule()); <END> return new RoomValidationHelper(injector.getInstance(RoomParser.class)); }</code><technical_language>I prefer new org.eclipse.etrice.core.RoomStandaloneSetup().createInjector();</technical_language>

Target:
public static RoomValidationHelper createInstance(){ Injector injector = new org.eclipse.etrice.core.RoomStandaloneSetup().createInjector(); return new RoomValidationHelper(injector.getInstance(RoomParser.class)); }
Source:
<code>private SCM findSCM(CruiseConfig modifiedConfig) { SCMs scms = modifiedConfig.getSCMs(); SCM existingSCM = scms.find(globalScmConfig.getSCMId()); if (existingSCM == null) { <START> result.notFound(LocalizedMessage.string("SCM_MATERIAL_NOT_FOUND"), HealthStateType.notFound()); <END> throw new NullPointerException(String.format("The pluggable scm material with id '%s' is not found.", globalScmConfig.getSCMId())); } else { return existingSCM; } }</code><technical_language>RESOURCE_NOT_FOUND instead, remove SCM_MATERIAL_NOT_FOUND if elsewhere</technical_language>

Target:
private SCM findSCM(CruiseConfig modifiedConfig) { SCMs scms = modifiedConfig.getSCMs(); SCM existingSCM = scms.find(globalScmConfig.getSCMId()); if (existingSCM == null) { result.notFound(LocalizedMessage.string("RESOURCE_NOT_FOUND"), HealthStateType.notFound()); throw new NullPointerException(String.format("The pluggable scm material with id '%s' is not found.", globalScmConfig.getSCMId())); } else { return existingSCM; } }
Source:
<code>public boolean shouldBroadcastPublicIpv4Addr() { <START> return configInstance.getBooleanProperty(namespace + ADVERTISE_PUBLIC_IPV4_ADDR, super.shouldBroadcastPublicIpv4Addr()).get(); <END> }</code><technical_language>_KEY stay consistent</technical_language>

Target:
public boolean shouldBroadcastPublicIpv4Addr() { return configInstance.getBooleanProperty(namespace + BROADCAST_PUBLIC_IPV4_ADDR_KEY, super.shouldBroadcastPublicIpv4Addr()).get(); }
Source:
<code>public static APIQuerySubmissionResult submitQuery() throws IOException, InjectionException, URISyntaxException { final SourceConfiguration localTextSocketSource1Conf = new TextSocketSourceConfigurationBuilderImpl() .set(TextSocketSourceParameters.SOCKET_HOST_ADDRESS, source1Host) .set(TextSocketSourceParameters.SOCKET_HOST_PORT, source1Port) .build(); <START> <END> final SourceConfiguration localTextSocketSource2Conf = new TextSocketSourceConfigurationBuilderImpl() .set(TextSocketSourceParameters.SOCKET_HOST_ADDRESS, source2Host) .set(TextSocketSourceParameters.SOCKET_HOST_PORT, source2Port) .build(); final SinkConfiguration localTextSocketSinkConf = new TextSocketSinkConfigurationBuilderImpl() .set(TextSocketSinkParameters.SOCKET_HOST_ADDRESS, SINK_HOST) .set(TextSocketSinkParameters.SOCKET_HOST_PORT, SINK_PORT) .build(); final MISTBiFunction<Integer, Integer, Integer> reduceFunction = (v1, v2) -> { return v1 + v2; }; final ContinuousStream sourceStream1 = new TextSocketSourceStream<>(localTextSocketSource1Conf) .map(s -> new Tuple2(s, 1)); final ContinuousStream sourceStream2 = new TextSocketSourceStream<>(localTextSocketSource2Conf) .map(s -> new Tuple2(s, 1)); final Sink sink = sourceStream1 .union(sourceStream2) .reduceByKey(0, String.class, reduceFunction) .textSocketOutput(localTextSocketSinkConf); final MISTQuery query = sink.getQuery(); final MISTExecutionEnvironment executionEnvironment = new MISTExecutionEnvironmentImpl(driverHost, driverPort); return executionEnvironment.submit(query); }</code><technical_language>remove empty line</technical_language>

Target:
public static APIQuerySubmissionResult submitQuery() throws IOException, InjectionException, URISyntaxException, StreamTypeMismatchException { final SourceConfiguration localTextSocketSource1Conf = new TextSocketSourceConfigurationBuilderImpl() .set(TextSocketSourceParameters.SOCKET_HOST_ADDRESS, source1Host) .set(TextSocketSourceParameters.SOCKET_HOST_PORT, source1Port) .build(); final SourceConfiguration localTextSocketSource2Conf = new TextSocketSourceConfigurationBuilderImpl() .set(TextSocketSourceParameters.SOCKET_HOST_ADDRESS, source2Host) .set(TextSocketSourceParameters.SOCKET_HOST_PORT, source2Port) .build(); final SinkConfiguration localTextSocketSinkConf = new TextSocketSinkConfigurationBuilderImpl() .set(TextSocketSinkParameters.SOCKET_HOST_ADDRESS, SINK_HOST) .set(TextSocketSinkParameters.SOCKET_HOST_PORT, SINK_PORT) .build(); final MISTBiFunction<Integer, Integer, Integer> reduceFunction = (v1, v2) -> { return v1 + v2; }; final ContinuousStream sourceStream1 = new TextSocketSourceStream<>(localTextSocketSource1Conf) .map(s -> new Tuple2(s, 1)); final ContinuousStream sourceStream2 = new TextSocketSourceStream<>(localTextSocketSource2Conf) .map(s -> new Tuple2(s, 1)); final Sink sink = sourceStream1 .union(sourceStream2) .reduceByKey(0, String.class, reduceFunction) .textSocketOutput(localTextSocketSinkConf); final MISTQuery query = sink.getQuery(); final MISTExecutionEnvironment executionEnvironment = new MISTExecutionEnvironmentImpl(driverHost, driverPort); return executionEnvironment.submit(query); }
Source:
<code>private void drawText(Canvas canvas, PointF pos) { if (mText != null && mText != "") { <START> Iterator<Paint> iter = mTextStyle.iterator(); <END> while (iter.hasNext()) { Paint p = iter.next(); p.setTextSize(DEFAULT_TEXT_SIZE * mScaleFactor); canvas.drawText(mText, pos.x, pos.y, p); } } }</code><technical_language>I is slightly easier cleaner for(Paint p : mTextStyle){ p.setTextSize(DEFAULT_TEXT_SIZE \* mScaleFactor); canvas.drawText(mText, pos.x, pos.y, p); }</technical_language>

Target:
private void drawText(Canvas canvas, PointF pos) { if (mText != null && mText != "") { for (Paint p : mTextStyle) { p.setTextSize(DEFAULT_TEXT_SIZE * mScaleFactor); canvas.drawText(mText, pos.x, pos.y, p); } } }
Source:
<code>public void should_pass_if_actual_contains_given_values_exactly_with_null_elements() { iterables.assertContainsExactlyInAnyOrder(someInfo(), actual, array("Luke", "Yoda", "Leia")); actual.add(null); <START> iterables.assertContainsExactlyInAnyOrder(someInfo(), actual, array("Luke", "Yoda", "Leia", null)); <END> }</code><technical_language>I shuffle order</technical_language>

Target:
public void should_pass_if_actual_contains_given_values_exactly_with_null_elements() { iterables.assertContainsExactlyInAnyOrder(someInfo(), actual, array("Leia", "Yoda", "Luke")); actual.add(null); iterables.assertContainsExactlyInAnyOrder(someInfo(), actual, array("Leia", null, "Yoda", "Luke")); }
Source:
<code>protected String getRepositoryAlias(String url) { String alias = url; <START> alias = alias.substring(alias.lastIndexOf("/") + 1); <END> final int lastDotIndex = alias.lastIndexOf('.'); if (lastDotIndex > 0) { alias = alias.substring(0, lastDotIndex); } return alias; }</code><technical_language>a tiny nitpick :smile: prefer lastIndexOf(Char) lastIndexOf(String) can</technical_language>

Target:
protected String getRepositoryAlias(String url) { String alias = url; alias = alias.substring(alias.lastIndexOf('/') + 1); final int lastDotIndex = alias.lastIndexOf('.'); if (lastDotIndex > 0) { alias = alias.substring(0, lastDotIndex); } return alias; }
Source:
<code>public void distributeEntities() { synchronized (memberChangeMutex) { Function<Entity, String> bucketFunction = getConfig(BUCKET_FUNCTION); EntitySpec<? extends BasicGroup> bucketSpec = getConfig(BUCKET_SPEC); if (bucketFunction == null || bucketSpec == null) return; Map<String, BasicGroup> buckets = getAttribute(BUCKETS); Multimap<String, Entity> entityMapping = Multimaps.index( Iterables.filter(getMembers(), Predicates.compose(Predicates.notNull(), bucketFunction)), bucketFunction); for (String name : entityMapping.keySet()) { BasicGroup bucket = buckets.get(name); if (bucket == null) { bucket = addChild(EntitySpec.create(bucketSpec).displayName(name)); Entities.manage(bucket); buckets.put(name, bucket); } bucket.setMembers(entityMapping.get(name)); } Set<String> empty = ImmutableSet.copyOf(Sets.difference(buckets.keySet(), entityMapping.keySet())); for (String name : empty) { Group removed = buckets.remove(name); removeChild(removed); Entities.unmanage(removed); } <START> setAttribute(BUCKETS, buckets); <END> } }</code><technical_language>I worry modifying map returned getAttribute problems - e.g. a ConcurrentModificationException in another caller retrieves this attribute, in REST api polled web-console</technical_language>

Target:
public void distributeEntities() { synchronized (memberChangeMutex) { Function<Entity, String> bucketFunction = getConfig(BUCKET_FUNCTION); EntitySpec<? extends BasicGroup> bucketSpec = getConfig(BUCKET_SPEC); if (bucketFunction == null || bucketSpec == null) return; Map<String, BasicGroup> buckets = MutableMap.copyOf(getAttribute(BUCKETS)); Multimap<String, Entity> entityMapping = Multimaps.index( Iterables.filter(getMembers(), Predicates.compose(Predicates.notNull(), bucketFunction)), bucketFunction); for (String name : entityMapping.keySet()) { BasicGroup bucket = buckets.get(name); if (bucket == null) { bucket = addChild(EntitySpec.create(bucketSpec).displayName(name)); Entities.manage(bucket); buckets.put(name, bucket); } bucket.setMembers(entityMapping.get(name)); } Set<String> empty = ImmutableSet.copyOf(Sets.difference(buckets.keySet(), entityMapping.keySet())); for (String name : empty) { Group removed = buckets.remove(name); removeChild(removed); Entities.unmanage(removed); } setAttribute(BUCKETS, ImmutableMap.copyOf(buckets)); } }
Source:
<code>public String getMessage() { if (lightblueResponse != null) { StringBuffer sb = new StringBuffer(super.getMessage()); if (!StringUtils.isEmpty(lightblueResponse.getRequestId())) { <START> sb.append(" RequestID:").append(lightblueResponse.getRequestId()); <END> } sb.append(' ').append(lightblueResponse.getText()); return sb.toString(); } else { return super.getMessage(); } }</code><technical_language>If RequestID="<id>", splunk extract automatically</technical_language>

Target:
public String getMessage() { if (lightblueResponse != null) { StringBuffer sb = new StringBuffer(super.getMessage()); if (!StringUtils.isEmpty(lightblueResponse.getRequestId())) { sb.append(" RequestID=").append(lightblueResponse.getRequestId()); } sb.append(' ').append(lightblueResponse.getText()); return sb.toString(); } else { return super.getMessage(); } }
Source:
<code>public void close() { <START> if (_baselineCalculateExecutor != null) { _baselineCalculateExecutor.shutdown(); } <END> if (_assignmentMetadataStore != null) { _assignmentMetadataStore.close(); } _metricCollector.unregister(); }</code><technical_language>This shut pool down, follow Oracle recommends shut ExecutorService? void shutdownAndAwaitTermination(ExecutorService pool) { pool.shutdown(); // Disable new tasks submitted try { // Wait a while for existing tasks terminate if (!pool.awaitTermination(60, TimeUnit.SECONDS)) { pool.shutdownNow(); // Cancel currently executing tasks // Wait a while for tasks respond cancelled if (!pool.awaitTermination(60, TimeUnit.SECONDS)) System.err.println("Pool terminate"); } } catch (InterruptedException ie) { // (Re-)Cancel if current thread interrupted pool.shutdownNow(); // Preserve interrupt status Thread.currentThread().interrupt(); } <LINK_0></technical_language>

Target:
public void close() { if (_baselineCalculateExecutor != null) { _baselineCalculateExecutor.shutdownNow(); } if (_assignmentMetadataStore != null) { _assignmentMetadataStore.close(); } _metricCollector.unregister(); }
Source:
<code>private void startTracing() throws Throwable { <START> final AsyncCompletionWaitor wait = new AsyncCompletionWaitor(); <END> fSession.getExecutor().submit(new Runnable() { @Override public void run() { fTraceService.getTraceStatus( fTraceTargetDmc, new DataRequestMonitor<ITraceStatusDMData>(fSession.getExecutor(), null) { @Override @ConfinedToDsfExecutor("fExecutor") protected void handleCompleted() { if (getData().isTracingSupported()) { fTraceService.startTracing( fTraceTargetDmc, new RequestMonitor(fSession.getExecutor(), null) { @Override @ConfinedToDsfExecutor("fExecutor") protected void handleCompleted() { wait.waitFinished(getStatus()); } }); } else { wait.waitFinished(getStatus()); } } }); } }); wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER); assertTrue(wait.getMessage(), wait.isOK()); }</code><technical_language>a Query() is easier. AsyncCompletionWaitor() early on, Query proved simpler. is fine leave is code is written already. I wanted mention for next time</technical_language>

Target:
private void startTracing() throws Throwable { final AsyncCompletionWaitor wait = new AsyncCompletionWaitor(); fSession.getExecutor().submit(new Runnable() { @Override public void run() { fTraceService.getTraceStatus( fTraceTargetDmc, new DataRequestMonitor<ITraceStatusDMData>(fSession.getExecutor(), null) { @Override @ConfinedToDsfExecutor("fExecutor") protected void handleCompleted() { if (isSuccess() && getData().isTracingSupported()) { fTraceService.startTracing( fTraceTargetDmc, new RequestMonitor(fSession.getExecutor(), null) { @Override @ConfinedToDsfExecutor("fExecutor") protected void handleCompleted() { wait.waitFinished(getStatus()); } }); } else { wait.waitFinished(getStatus()); } } }); } }); wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER); assertTrue(wait.getMessage(), wait.isOK()); }
Source:
<code>public long getSwapUsed() { <START> long swapAvailable = 0; <END> List<String> memInfo = null; try { memInfo = FileUtil.readFile("/proc/meminfo"); } catch (IOException e) { LOG.error("Problem with /proc/meminfo: {}", e.getMessage()); } for (String checkLine : memInfo) { if (checkLine.startsWith("SwapFree:")) { String[] memorySplit = checkLine.split("\\s+"); swapAvailable = parseMeminfo(memorySplit); break; } } return swapAvailable; }</code><technical_language>changed method name internals. Also, need change (or commit if changed already) updated SystemInfoTest</technical_language>

Target:
public long getSwapUsed() { long swapFree = 0; long swapTotal = 0; List<String> memInfo = null; try { memInfo = FileUtil.readFile("/proc/meminfo"); for (String checkLine : memInfo) { if (checkLine.startsWith("SwapFree:")) { String[] memorySplit = checkLine.split("\\s+"); swapFree = parseMeminfo(memorySplit); break; } } swapTotal = getSwapTotal(); } catch (IOException e) { LOG.error("Problem with /proc/meminfo: {}", e.getMessage()); } return swapTotal - swapFree; }
Source:
<code>public List<TransactionInfo> getTransactionsForSegments(Address destination, int requestTopologyId, Set<Integer> segments) throws InterruptedException { if (trace) { log.tracef("Received request for transactions from node %s for segments %s of cache %s with topology id %d", destination, segments, cacheName, requestTopologyId); } final CacheTopology cacheTopology = getCacheTopology(requestTopologyId, destination, true); final ConsistentHash readCh = cacheTopology.getReadConsistentHash(); Set<Integer> ownedSegments = readCh.getSegmentsForOwner(rpcManager.getAddress()); if (!ownedSegments.containsAll(segments)) { segments.removeAll(ownedSegments); throw new IllegalArgumentException("Segments " + segments + " are not owned by " + rpcManager.getAddress()); } List<TransactionInfo> transactions = new ArrayList<TransactionInfo>(); if (configuration.transaction().transactionMode().isTransactional()) { <START> if (!configuration.transaction().transactionProtocol().isTotalOrder()) { <END> collectTransactionsToTransfer(transactions, transactionTable.getRemoteTransactions(), segments, cacheTopology); collectTransactionsToTransfer(transactions, transactionTable.getLocalTransactions(), segments, cacheTopology); } if (trace) { log.tracef("Found %d transaction(s) to transfer", transactions.size()); } } return transactions; }</code><technical_language>send GET_TRANSACTIONS command if is enabled</technical_language>

Target:
public List<TransactionInfo> getTransactionsForSegments(Address destination, int requestTopologyId, Set<Integer> segments) throws InterruptedException { if (trace) { log.tracef("Received request for transactions from node %s for segments %s of cache %s with topology id %d", destination, segments, cacheName, requestTopologyId); } final CacheTopology cacheTopology = getCacheTopology(requestTopologyId, destination, true); final ConsistentHash readCh = cacheTopology.getReadConsistentHash(); Set<Integer> ownedSegments = readCh.getSegmentsForOwner(rpcManager.getAddress()); if (!ownedSegments.containsAll(segments)) { segments.removeAll(ownedSegments); throw new IllegalArgumentException("Segments " + segments + " are not owned by " + rpcManager.getAddress()); } List<TransactionInfo> transactions = new ArrayList<TransactionInfo>(); if (configuration.transaction().transactionMode().isTransactional()) { collectTransactionsToTransfer(transactions, transactionTable.getRemoteTransactions(), segments, cacheTopology); collectTransactionsToTransfer(transactions, transactionTable.getLocalTransactions(), segments, cacheTopology); if (trace) { log.tracef("Found %d transaction(s) to transfer", transactions.size()); } } return transactions; }
Source:
<code>public void registerDataSetObserver(DataSetObserver observer) { try { mDataSetObservable.registerObserver(observer); } catch (IllegalStateException e) { <START> } <END> }</code><technical_language>log error Log.e in logcat if strange</technical_language>

Target:
public void registerDataSetObserver(DataSetObserver observer) { try { mDataSetObservable.registerObserver(observer); } catch (IllegalStateException e) { Log.e(TAG, "Observer " + observer.getClass().getSimpleName() + " could not be registered to " + mDataSetObservable.getClass().getSimpleName()); } }
Source:
<code>void assertNrOfEventListeners(int extra) { Collection<GerritEventListener> gerritEventListeners = getGerritEventListeners(); int nbrOfListeners = extra; nbrOfListeners++; nbrOfListeners++; nbrOfListeners++; nbrOfListeners++; <START> assertEquals(nbrOfListeners, gerritEventListeners.size()); <END> }</code><technical_language>means good :) alot more cleaner easier read test previously</technical_language>

Target:
void assertNrOfEventListeners(int extra) { Collection<GerritEventListener> gerritEventListeners = getGerritEventListeners(); int nbrOfListeners = extra; nbrOfListeners++; nbrOfListeners++; nbrOfListeners++; GerritServer server = PluginImpl.getServer_(PluginImpl.DEFAULT_SERVER_NAME); if (server.isConnected() && server.getConfig().isEnableProjectAutoCompletion() && server.isProjectCreatedEventsSupported()) { nbrOfListeners++; } assertEquals(nbrOfListeners, gerritEventListeners.size()); }
Source:
<code>public boolean isSelectQuestionNumberEnabled(int qnNumber) { <START> WebElement qnNumSelect = browser.driver.findElement(By.id("questionnum-" + qnNumber)); <END> return qnNumSelect.isEnabled(); }</code><technical_language>I extract a method get desired web element</technical_language>

Target:
public boolean isSelectQuestionNumberEnabled(int qnNumber) { WebElement qnNumSelect = getSelectQuestionNumberDropdown(qnNumber); return qnNumSelect.isEnabled(); }
Source:
<code>public void stop() { new Thread( "Shutdown Thread" ) { @Override @SuppressFBWarnings("DM_EXIT") @SuppressWarnings("TooBroadCatch") public void run() { BungeeCord.this.isRunning = false; stopListeners(); getLogger().info( "Closing pending connections" ); connectionLock.readLock().lock(); try { getLogger().log( Level.INFO, "Disconnecting {0} connections", connections.size() ); for ( UserConnection user : connections.values() ) { user.disconnect( getTranslation( "restart" ) ); } } finally { connectionLock.readLock().unlock(); } getLogger().info( "Closing IO threads" ); eventLoops.shutdownGracefully(); try { eventLoops.awaitTermination( Long.MAX_VALUE, TimeUnit.NANOSECONDS ); } catch ( InterruptedException ex ) { } if ( reconnectHandler != null ) { getLogger().info( "Saving reconnect locations" ); reconnectHandler.save(); reconnectHandler.close(); } saveThread.cancel(); metricsThread.cancel(); getLogger().info( "Disabling plugins" ); <START> pluginManager.disablePlugins(); <END> getLogger().info( "Thank you and goodbye" ); for ( Handler handler : getLogger().getHandlers() ) { handler.close(); } System.exit( 0 ); } }.start(); }</code><technical_language>Actually, disabled in order, random. change this line reverse iterate</technical_language>

Target:
public void stop() { new Thread( "Shutdown Thread" ) { @Override @SuppressFBWarnings("DM_EXIT") @SuppressWarnings("TooBroadCatch") public void run() { BungeeCord.this.isRunning = false; stopListeners(); getLogger().info( "Closing pending connections" ); connectionLock.readLock().lock(); try { getLogger().log( Level.INFO, "Disconnecting {0} connections", connections.size() ); for ( UserConnection user : connections.values() ) { user.disconnect( getTranslation( "restart" ) ); } } finally { connectionLock.readLock().unlock(); } getLogger().info( "Closing IO threads" ); eventLoops.shutdownGracefully(); try { eventLoops.awaitTermination( Long.MAX_VALUE, TimeUnit.NANOSECONDS ); } catch ( InterruptedException ex ) { } if ( reconnectHandler != null ) { getLogger().info( "Saving reconnect locations" ); reconnectHandler.save(); reconnectHandler.close(); } saveThread.cancel(); metricsThread.cancel(); getLogger().info( "Disabling plugins" ); for ( Plugin plugin : Lists.reverse( new ArrayList<>( pluginManager.getPlugins() ) ) ) { try { plugin.onDisable(); for ( Handler handler : plugin.getLogger().getHandlers() ) { handler.close(); } } catch ( Throwable t ) { getLogger().log( Level.SEVERE, "Exception disabling plugin " + plugin.getDescription().getName(), t ); } getScheduler().cancel( plugin ); plugin.getExecutorService().shutdownNow(); } getLogger().info( "Thank you and goodbye" ); for ( Handler handler : getLogger().getHandlers() ) { handler.close(); } System.exit( 0 ); } }.start(); }
Source:
<code>public boolean supports(HttpServletRequest request) { String authHeader = request.getHeader(AUTHORIZATION_HEADER); boolean hasCookie = false; if (request.getCookies() != null) { hasCookie = Arrays.stream(request.getCookies()) .anyMatch(c -> c.getName() .equals(AUTHORIZATION_COOKIE)); } <START> if ((authHeader != null && authHeader.startsWith(BEARER_AUTHORIZATION_PREFIX)) || hasCookie) <END> { return true; } return false; }</code><technical_language>(authHeader != null && authHeader.startsWith(BEARER_AUTHORIZATION_PREFIX)) this assign hasHeader variable done hasCookie</technical_language>

Target:
public boolean supports(HttpServletRequest request) { boolean hasHeader = false; boolean hasCookie = false; if(request.getHeader(AUTHORIZATION_HEADER) != null) { String authHeader = request.getHeader(AUTHORIZATION_HEADER); hasHeader = StringUtils.isNotBlank(authHeader) && authHeader.startsWith(BEARER_AUTHORIZATION_PREFIX); } else if (request.getCookies() != null) { hasCookie = Arrays.stream(request.getCookies()) .anyMatch(c -> c.getName() .equals(AUTHORIZATION_COOKIE)); } if (hasHeader || hasCookie) { return true; } return false; }
Source:
<code>public LogParserGlobalConfig(JenkinsConfig context) { super(context, "/hudson-plugins-logparser-LogParserPublisher/log-parser"); <START> addButton = control("repeatable-add"); <END> }</code><technical_language>This moved initializer control is resolved lazily</technical_language>

Target:
public LogParserGlobalConfig(JenkinsConfig context) { super(context, "/hudson-plugins-logparser-LogParserPublisher/log-parser"); }
Source:
<code>private static boolean matches(@Nonnull Class<?>[] parameterTypes, @Nonnull Object[] parameters, boolean varargs) { if (varargs) { int fixedLen = parameterTypes.length - 1; Class<?> componentType = parameterTypes[fixedLen].getComponentType(); assert componentType != null; int arrayLength = parameters.length - fixedLen; if (arrayLength >= 0) { if (arrayLength == 1 && parameterTypes[fixedLen].isInstance(parameters[fixedLen])) { } else { Object array = Array.newInstance(componentType, arrayLength); for (int i = 0; i < arrayLength; i++) { <START> Array.set(array, i, parameters[fixedLen + i]); <END> } Object[] parameters2 = new Object[fixedLen + 1]; System.arraycopy(parameters, 0, parameters2, 0, fixedLen); parameters2[fixedLen] = array; parameters = parameters2; } } } if (parameters.length != parameterTypes.length) { return false; } for (int i = 0; i < parameterTypes.length; i++) { if (parameters[i] == null) { if (parameterTypes[i].isPrimitive()) { return false; } else { continue; } } if (parameterTypes[i].isInstance(parameters[i])) { continue; } if ( parameterTypes[i].isPrimitive() && parameters[i] != null && isInstancePrimitive(ClassUtils.primitiveToWrapper(parameterTypes[i]), parameters[i]) ) { continue; } if (parameterTypes[i] == String.class && parameters[i] instanceof GString) { continue; } return false; } return true; }</code><technical_language>I assume set operation arraycopy handle primitives boxing/unboxing</technical_language>

Target:
private static boolean matches(@Nonnull Class<?>[] parameterTypes, @Nonnull Object[] parameters, boolean varargs) { if (varargs) { parameters = parametersForVarargs(parameterTypes, parameters); } if (parameters.length != parameterTypes.length) { return false; } for (int i = 0; i < parameterTypes.length; i++) { if (parameters[i] == null) { if (parameterTypes[i].isPrimitive()) { return false; } else { continue; } } if (parameterTypes[i].isInstance(parameters[i])) { continue; } if ( parameterTypes[i].isPrimitive() && parameters[i] != null && isInstancePrimitive(ClassUtils.primitiveToWrapper(parameterTypes[i]), parameters[i]) ) { continue; } if (parameterTypes[i] == String.class && parameters[i] instanceof GString) { continue; } return false; } return true; }
Source:
<code>public IntegerCopyNumberTransitionProbabilityCacheCollection( @Nonnull final IntegerCopyNumberTransitionMatrixCollection transitionMatrixCollection, final boolean padStates) { sexGenotypeAndContigToTransitionMatrixCacheMap = new HashMap<>(); constructCacheMapFromMatrixCollection(padStates ? transitionMatrixCollection.cloneWithPaddedStates() : transitionMatrixCollection); padded = padStates; <START> if (padded) { <END> maxCopyNumber = transitionMatrixCollection.getMaxCopyNumberInCollection(); } else { maxCopyNumber = 0; } sexGenotypesSet = Collections.unmodifiableSet(transitionMatrixCollection.getSexGenotypes()); contigsSet = Collections.unmodifiableSet(transitionMatrixCollection.getContigs()); }</code><technical_language>If get rid of flag, a ternary here</technical_language>

Target:
public IntegerCopyNumberTransitionProbabilityCacheCollection( @Nonnull final IntegerCopyNumberTransitionMatrixCollection transitionMatrixCollection, final boolean padStates) { Utils.nonNull(transitionMatrixCollection, "The transition matrix cache collection must be non-null"); sexGenotypeAndContigToTransitionMatrixCacheMap = constructCacheMapFromMatrixCollection(padStates ? transitionMatrixCollection.cloneWithPaddedStates() : transitionMatrixCollection); padded = padStates; maxCopyNumber = padded ? transitionMatrixCollection.getMaxCopyNumberInCollection() : UNDEFINED_MAX_COPY_NUMBER; sexGenotypesSet = Collections.unmodifiableSet(transitionMatrixCollection.getSexGenotypes()); contigSet = Collections.unmodifiableSet(transitionMatrixCollection.getContigs()); }
Source:
<code>public SqlDataTypeSpec withNullable(Boolean nullable) { <START> if (nullable.equals(this.nullable)) { <END> return this; } return new SqlDataTypeSpec(collectionsTypeName, typeName, precision, scale, charSetName, timeZone, nullable, getParserPosition()); }</code><technical_language>called in place, parser, argument 'false', matter much. do properly: call java.util.Objects.equals(Object, Object)</technical_language>

Target:
public SqlDataTypeSpec withNullable(Boolean nullable) { if (Objects.equals(nullable, this.nullable)) { return this; } return new SqlDataTypeSpec(collectionsTypeName, typeName, precision, scale, charSetName, timeZone, nullable, getParserPosition()); }
Source:
<code><START> public static int[] getDecimalPrecisionAndScale(byte[] bytes, int offset, int length) { <END> if (length == 1 && bytes[offset] == ZERO_BYTE) { return new int[] {0, 0}; } int signum = ((bytes[offset] & 0x80) == 0) ? -1 : 1; int scale; int index; int digitOffset; if (signum == 1) { scale = (byte)(((bytes[offset] & 0x7F) - 65) * -2); index = offset + length; digitOffset = POS_DIGIT_OFFSET; } else { scale = (byte)((~bytes[offset] - 65 - 128) * -2); index = offset + length - (bytes[offset + length - 1] == NEG_TERMINAL_BYTE ? 1 : 0); digitOffset = -NEG_DIGIT_OFFSET; } length = index - offset; int precision = 2 * (length - 1); int d = signum * bytes[--index] - digitOffset; if (d % 10 == 0) { d /= 10; scale--; precision -= 1; } d = signum * bytes[1] - digitOffset; if (d < 10) { precision -= 1; } scale += (length - 2) * 2; if (scale < 0) { precision = precision - scale; scale = 0; } return new int[] {precision, scale}; }</code><technical_language>Nice - pretty cool. share this code function deserializes a BigDecimal</technical_language>

Target:
public static int[] getDecimalPrecisionAndScale(byte[] bytes, int offset, int length) { if (length == 1 && bytes[offset] == ZERO_BYTE) { return new int[] {0, 0}; } int signum = ((bytes[offset] & 0x80) == 0) ? -1 : 1; int scale; int index; int digitOffset; if (signum == 1) { scale = (byte)(((bytes[offset] & 0x7F) - 65) * -2); index = offset + length; digitOffset = POS_DIGIT_OFFSET; } else { scale = (byte)((~bytes[offset] - 65 - 128) * -2); index = offset + length - (bytes[offset + length - 1] == NEG_TERMINAL_BYTE ? 1 : 0); digitOffset = -NEG_DIGIT_OFFSET; } length = index - offset; int precision = 2 * (length - 1); int d = signum * bytes[--index] - digitOffset; if (d % 10 == 0) { d /= 10; scale--; precision -= 1; } d = signum * bytes[offset+1] - digitOffset; if (d < 10) { precision -= 1; } scale += (length - 2) * 2; if (scale < 0) { precision = precision - scale; scale = 0; } return new int[] {precision, scale}; }
Source:
<code>private static OGCGeometry readSimpleGeometry(BasicSliceInput input, Slice inputSlice, GeometryType type, int length) { int currentPosition = toIntExact(input.position()); ByteBuffer geometryBuffer = inputSlice.toByteBuffer(currentPosition, length).slice(); input.setPosition(currentPosition + length); <START> Geometry esriGeometry = local().execute(0, Unknown, geometryBuffer); <END> return createFromEsriGeometry(esriGeometry, type.isMultitype()); }</code><technical_language>static import imported version readable, in this case local() is telling reader much. static import it</technical_language>

Target:
private static OGCGeometry readSimpleGeometry(BasicSliceInput input, Slice inputSlice, GeometryType type, int length) { int currentPosition = toIntExact(input.position()); ByteBuffer geometryBuffer = inputSlice.toByteBuffer(currentPosition, length).slice(); input.setPosition(currentPosition + length); Geometry esriGeometry = OperatorImportFromESRIShape.local().execute(0, Unknown, geometryBuffer); return createFromEsriGeometry(esriGeometry, type.isMultitype()); }
Source:
<code>private static Req affirmative(final Comment.Smart comment, final URI home) throws IOException { new Answer(comment).post( true, String.format( QnRelease.PHRASES.getString("QnRelease.start"), home.toASCIIString() ) ); return new Req.Simple( "release", <START> new MapOf<String, String>( <END> new MapEntry<String, String>("head_branch", "master"), new MapEntry<String, String>( "head", String.format( "git@github.com:%s.git", comment.issue().repo().coordinates() ) ) ) ); }</code><technical_language>@filfreire SolidMap is</technical_language>

Target:
private static Req affirmative(final Comment.Smart comment, final URI home) throws IOException { new Answer(comment).post( true, String.format( QnRelease.PHRASES.getString("QnRelease.start"), home.toASCIIString() ) ); return new Req.Simple( "release", new SolidMap<String, String>( new MapEntry<String, String>("head_branch", "master"), new MapEntry<String, String>( "head", String.format( "git@github.com:%s.git", comment.issue().repo().coordinates() ) ) ) ); }
Source:
<code>public ClaimsBasedSecurityChannel(Mono<RequestResponseChannel> responseChannelMono, TokenCredential tokenCredential, CbsAuthorizationType authorizationType, AmqpRetryOptions retryOptions) { this.authorizationType = Objects.requireNonNull(authorizationType, "'authorizationType' cannot be null."); this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); this.credential = Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null."); <START> this.cbsChannelMono = Objects.requireNonNull(responseChannelMono, "'cbsChannelMono' cannot be null."); <END> }</code><technical_language>This change. error message name of param instead of instance variable name</technical_language>

Target:
public ClaimsBasedSecurityChannel(Mono<RequestResponseChannel> responseChannelMono, TokenCredential tokenCredential, CbsAuthorizationType authorizationType, AmqpRetryOptions retryOptions) { this.authorizationType = Objects.requireNonNull(authorizationType, "'authorizationType' cannot be null."); this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); this.credential = Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null."); this.cbsChannelMono = Objects.requireNonNull(responseChannelMono, "'responseChannelMono' cannot be null."); }
Source:
<code>public CompletableFuture<Optional<byte[]>> getRaw(Multihash hash) { return Futures.of(map(hash, h -> { GetObjectRequest get = new GetObjectRequest(bucket, folder + hashToKey(hash)); <START> Histogram.Timer readTimer = readTimerLog.labels(h.toString()).startTimer(); <END> try (S3Object res = s3Client.getObject(get); DataInputStream din = new DataInputStream(new BufferedInputStream(res.getObjectContent()))) { return Optional.of(Serialize.readFully(din)); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } finally { readTimer.observeDuration(); } }, e -> Optional.empty())); }</code><technical_language>want label hash - create in tsdb</technical_language>

Target:
public CompletableFuture<Optional<byte[]>> getRaw(Multihash hash) { return Futures.of(map(hash, h -> { GetObjectRequest get = new GetObjectRequest(bucket, folder + hashToKey(hash)); Histogram.Timer readTimer = readTimerLog.labels("read").startTimer(); try (S3Object res = s3Client.getObject(get); DataInputStream din = new DataInputStream(new BufferedInputStream(res.getObjectContent()))) { return Optional.of(Serialize.readFully(din)); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } finally { readTimer.observeDuration(); } }, e -> Optional.empty())); }
Source:
<code>public void getTimestampsForGivenRows() { String expected = "SELECT key, column1, column2 FROM \"foo__bar\"" + " WHERE key = ? LIMIT 100;"; <START> executor.getTimestamps(TABLE_REF, ImmutableList.of(ROW, END_ROW), LIMIT); <END> verify(queryExecutor).prepare(argThat(byteBufferMatcher(expected)), any()); verify(queryExecutor).executePrepared(eq(1), eq(ImmutableList.of(ByteBuffer.wrap(ROW)))); }</code><technical_language>sanity check return values too. I ETE tests for sweep ensure loading is done correctly. worth running large internal product tests more comprehensive compare bytes etc</technical_language>

Target:
public void getTimestampsForGivenRows() { String expected = "SELECT key, column1, column2 FROM \"foo__bar\"" + " WHERE key = ? LIMIT 100;"; executor.getTimestamps(TABLE_REF, ImmutableList.of(ROW, END_ROW), LIMIT); verify(queryExecutor).prepare(argThat(byteBufferMatcher(expected)), eq(ROW), any()); verify(queryExecutor).executePrepared(eq(1), eq(ImmutableList.of(ByteBuffer.wrap(ROW)))); }
Source:
<code><START> public static String str(Object x) { <END> if ( x == null ) return "<null>" ; return x.toString() ; }</code><technical_language>I suggest leave this, @Deprecated. str() is supposed reminiscent of SPARQL STR. str(...) is this is a pattern</technical_language>

Target:
public static String str(Object x) { return Objects.toString(x, "<null>"); }
Source:
<code>public void onAttach(Activity activity) { super.onAttach(activity); try { mListener = (ShareFragmentListener) activity; } catch (ClassCastException e) { <START> throw new ClassCastException(activity.toString() <END> + " must implement OnShareFragmentInteractionListener"); } }</code><technical_language>throw IllegalStateException , similar</technical_language>

Target:
public void onAttach(Activity activity) { super.onAttach(activity); try { mListener = (ShareFragmentListener) activity; } catch (IllegalStateException e) { throw new IllegalStateException(activity.toString() + " must implement OnShareFragmentInteractionListener"); } }
Source:
<code>public void displaySource(Object element, IWorkbenchPage page, boolean forceSourceLookup) { SCTDebugTarget newTarget = unwrapTarget(element); if (!newTarget.getModelIdentifier().equals(IDebugConstants.ID_DEBUG_MODEL) || newTarget.getDebugTarget().isTerminated()) return; if (newTarget != null && activeDebugTarget != newTarget){ if (activeSourceDisplay != null) activeSourceDisplay.terminate(false); activeSourceDisplay = new SCTSourceDisplay( (ISimulationEngine) newTarget.getAdapter(ISimulationEngine.class)); } try { activeSourceDisplay.displaySource(newTarget, page, forceSourceLookup); activeDebugTarget = newTarget; <START> } catch (RuntimeException e) { <END> if(element instanceof SCTDebugTarget) { try { ((SCTDebugTarget) element).terminate(); } catch (DebugException e2) { throw e; } } } }</code><technical_language>catch RuntimeExceptions, check root for exception instead</technical_language>

Target:
public void displaySource(Object element, IWorkbenchPage page, boolean forceSourceLookup) { SCTDebugTarget newTarget = unwrapTarget(element); if (!newTarget.getModelIdentifier().equals(IDebugConstants.ID_DEBUG_MODEL) || newTarget.getDebugTarget().isTerminated()) return; if (newTarget != null && activeDebugTarget != newTarget){ if (activeSourceDisplay != null) activeSourceDisplay.terminate(false); activeSourceDisplay = new SCTSourceDisplay( (ISimulationEngine) newTarget.getAdapter(ISimulationEngine.class)); } activeSourceDisplay.displaySource(newTarget, page, forceSourceLookup); activeDebugTarget = newTarget; }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; Map<String, String> details = new HashMap<String, String>(); <START> details.put("HTTP-Verb", "GET"); <END> details.put("Date", httpRequest.getHeader("Date")); details.put("Authorization", httpRequest.getHeader("Authorization")); details.put("Resource", httpRequest.getRequestURI()); try { Authentication authentication = authenticationManager .authenticate(new ApiUserAuthentication(new ApiUser(), details)); SecurityContextHolder.getContext() .setAuthentication(authentication); } catch (AuthenticationException e) { } chain.doFilter(request, response); }</code><technical_language>actual request get _verb_. - <LINK_0></technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; Map<String, String> details = new HashMap<String, String>(); details.put("HTTP-Verb", httpRequest.getMethod()); details.put("Date", httpRequest.getHeader("Date")); details.put("Authorization", httpRequest.getHeader("Authorization")); details.put("Resource", httpRequest.getRequestURI()); try { Authentication authentication = authenticationManager .authenticate(new ApiUserAuthentication(new ApiUser(), details)); SecurityContextHolder.getContext() .setAuthentication(authentication); } catch (AuthenticationException e) { } chain.doFilter(request, response); }
Source:
<code>public AffineTransform inverse() { double det = this.determinant(); return new AffineTransform( (m11 * m22 - m21 * m12) / det, <START> (m02 * m21 - m22 * m01) / det, <END> (m01 * m12 - m11 * m02) / det, (m01 * (m22 * m13 - m12 * m23) + m02 * (m11 * m23 - m21 * m13) - m03 * (m11 * m22 - m21 * m12)) / det, (m12 * m20 - m22 * m10) / det, (m00 * m22 - m20 * m02) / det, (m02 * m10 - m12 * m00) / det, (m00 * (m12 * m23 - m22 * m13) - m02 * (m10 * m23 - m20 * m13) + m03 * (m10 * m22 - m20 * m12)) / det, (m10 * m21 - m20 * m11) / det, (m01 * m20 - m21 * m00) / det, (m00 * m11 - m10 * m01) / det, (m00 * (m21 * m13 - m11 * m23) + m01 * (m10 * m23 - m20 * m13) - m03 * (m10 * m21 - m20 * m11)) / det); }</code><technical_language>this m02 is literally change made, revert other multiplications original order shrink diff</technical_language>

Target:
public AffineTransform inverse() { double det = this.determinant(); return new AffineTransform( (m11 * m22 - m21 * m12) / det, (m21 * m02 - m01 * m22) / det, (m01 * m12 - m11 * m02) / det, (m01 * (m22 * m13 - m12 * m23) + m02 * (m11 * m23 - m21 * m13) - m03 * (m11 * m22 - m21 * m12)) / det, (m20 * m12 - m10 * m22) / det, (m00 * m22 - m20 * m02) / det, (m10 * m02 - m00 * m12) / det, (m00 * (m12 * m23 - m22 * m13) - m02 * (m10 * m23 - m20 * m13) + m03 * (m10 * m22 - m20 * m12)) / det, (m10 * m21 - m20 * m11) / det, (m20 * m01 - m00 * m21) / det, (m00 * m11 - m10 * m01) / det, (m00 * (m21 * m13 - m11 * m23) + m01 * (m10 * m23 - m20 * m13) - m03 * (m10 * m21 - m20 * m11)) / det); }
Source:
<code>public synchronized void refreshInternalResourceGroups() { boolean requeue = false; boolean versionChanged = false; int specVersion = configurationManager.get().getSpecVersion(); for (InternalResourceGroup rootGroup : rootGroups) { <START> log.info("Root group" + rootGroup.getId().toString() + " version: " + rootGroup.getVersion() + " latest version: " + rootGroup.getLatest().getVersion()); <END> if (rootGroup.getLatest().getVersion() < specVersion) { versionChanged = true; break; } } if (!versionChanged) { return; } log.info("Version changed, new spec version: " + specVersion); for (ResourceGroupId id : groups.keySet()) { InternalResourceGroup group = groups.get(id).getLatest(); if (group.getVersion() != specVersion) { requeue = true; } createGroupIfNecessary(group, refreshResourceGroupExecutor, specVersion); } if (requeue) { for (ResourceGroupId id : groups.keySet()) { InternalResourceGroup group = groups.get(id).getLatest(); if (group.getPrev().isPresent()) { group.getPrev().get().requeueToNext(); } } } for (InternalResourceGroup group : rootGroups) { while (group.getNext().isPresent()) { group.purgeExpiredResourceGroups(); group = group.getNext().get(); } } }</code><technical_language>This function is called right? printing info noisy unnecessary expensive</technical_language>

Target:
public synchronized void refreshInternalResourceGroups() { boolean requeue = false; boolean versionChanged = false; int specVersion = configurationManager.get().getSpecVersion(); for (InternalResourceGroup rootGroup : rootGroups) { if (rootGroup.getLatest().getVersion() < specVersion) { versionChanged = true; break; } } if (!versionChanged) { return; } for (ResourceGroupId id : groups.keySet()) { InternalResourceGroup group = groups.get(id).getLatest(); if (group.getVersion() != specVersion) { requeue = true; } createGroupIfNecessary(group, refreshResourceGroupExecutor, specVersion); } if (requeue) { for (ResourceGroupId id : groups.keySet()) { InternalResourceGroup group = groups.get(id).getLatest(); if (group.getPrev().isPresent()) { group.getPrev().get().requeueToNext(); } } } for (InternalResourceGroup group : rootGroups) { while (group.getNext().isPresent()) { group.purgeExpiredResourceGroups(); group = group.getNext().get(); } } }
Source:
<code>public synchronized IndexWriter getTimestampsWriter() { if (fTimestampsWriter == null) { try { Directory indexDir = FSDirectory .open(Paths.get(fIndexRoot.append(fContainerId) <START> .append(TIMESTAMPS_DIR).toOSString())); <END> IndexWriterConfig config = new IndexWriterConfig( new SimpleAnalyzer()); config.setOpenMode(OpenMode.CREATE_OR_APPEND); fTimestampsWriter = new IndexWriter(indexDir, config); } catch (IOException e) { Logger.logException(e); } } return fTimestampsWriter; }</code><technical_language>Lucene works java7 Path, IPath eclipse is needed, fIndexRoot declared string, then: Paths.get(fIndexRoot, fContainerId, TIMESTAMPS_DIR) (similar code in a places)</technical_language>

Target:
public synchronized IndexWriter getTimestampsWriter() { if (fTimestampsWriter == null) { try { Directory indexDir = FSDirectory.open( Paths.get(fIndexRoot, fContainerId, TIMESTAMPS_DIR)); IndexWriterConfig config = new IndexWriterConfig( new SimpleAnalyzer()); config.setOpenMode(OpenMode.CREATE_OR_APPEND); fTimestampsWriter = new IndexWriter(indexDir, config); } catch (IOException e) { Logger.logException(e); } } return fTimestampsWriter; }
Source:
<code>public void verifyPageHeader(String expectedHeader) { waitForElementByXPath(String.format(headerTextSelector, expectedHeader)); <START> } <END></code><technical_language>beneficial add PageObjectLogging here</technical_language>

Target:
public void verifyPageHeader(String expectedHeader) { waitForElementByXPath(String.format(headerTextSelector, expectedHeader)); PageObjectLogging.log( "SpecialPageHeader", "Special Page Header is the same as expected", true, driver ); }
Source:
<code>SecurityWebFilterChain springSecurity(ServerHttpSecurity http) throws Exception { http .authorizeExchange() <START> .anyExchange().access(authorizationManager()) <END> .and() .oauth2ResourceServer() .bearerTokenConverter(bearerTokenAuthenticationConverter()) .jwt() .publicKey(publicKey()); return http.build(); }</code><technical_language>Is a reason need this extra instrumentation, opposed suggestion .anyExchange().hasAuthority("SCOPE_message:read") If can, nice able reduce number of moving parts in a test</technical_language>

Target:
SecurityWebFilterChain springSecurity(ServerHttpSecurity http) throws Exception { http .authorizeExchange() .anyExchange().hasAuthority("SCOPE_message:read") .and() .oauth2ResourceServer() .bearerTokenConverter(bearerTokenAuthenticationConverter()) .jwt() .publicKey(publicKey()); return http.build(); }