auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static ReportedConfigurations map(org.ovirt.engine.core.common.businessentities.network.ReportedConfigurations entity, ReportedConfigurations template) { ReportedConfigurations model = template == null ? new ReportedConfigurations() : template; model.setInSync(entity.isNetworkInSync()); List<ReportedConfiguration> reportedConfigurationList = model.getReportedConfigurations(); for (org.ovirt.engine.core.common.businessentities.network.ReportedConfiguration reportedConfiguration : entity.getReportedConfigurationList()) { <START> ReportedConfiguration conf = new ReportedConfiguration(); <END> conf.setInSync(reportedConfiguration.isInSync()); conf.setName(reportedConfiguration.getType().getName()); conf.setValue(reportedConfiguration.getActualValue()); reportedConfigurationList.add(conf); } return model; }</code><technical_language>also, late rename ReportedConfiguration.value expected add actual it, snippet current api.xsd: <xs:complexType name="ReportedConfiguration"> <xs:sequence> <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/> <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="1"/> <xs:element name="in_sync" type="xs:boolean" minOccurs="1" maxOccurs="1"/> </xs:sequence> </xs:complexType></technical_language>

Target:
public static ReportedConfigurations map(org.ovirt.engine.core.common.businessentities.network.ReportedConfigurations entity, ReportedConfigurations template) { ReportedConfigurations model = template == null ? new ReportedConfigurations() : template; model.setInSync(entity.isNetworkInSync()); List<ReportedConfiguration> reportedConfigurationList = model.getReportedConfigurations(); for (org.ovirt.engine.core.common.businessentities.network.ReportedConfiguration reportedConfiguration : entity.getReportedConfigurationList()) { ReportedConfiguration conf = new ReportedConfiguration(); conf.setInSync(reportedConfiguration.isInSync()); conf.setName(reportedConfiguration.getType().getName()); conf.setActualValue(reportedConfiguration.getActualValue()); conf.setExpectedValue(reportedConfiguration.getExpectedValue()); reportedConfigurationList.add(conf); } return model; }
Source:
<code>protected boolean writeNeedsRemoteValue(InvocationContext ctx, WriteCommand command, Object key) { if (command.hasFlag(Flag.CACHE_MODE_LOCAL)) { return false; } if (ctx.isOriginLocal()) { if (!command.readsExistingValues()) { return false; } <START> if (command.hasFlag(Flag.SKIP_REMOTE_LOOKUP)) { <END> return false; } } else { if (!command.alwaysReadsExistingValues()) { return false; } } return true; }</code><technical_language>this changed return !command.hasFlag(Flag.SKIP_REMOTE_LOOKUP))</technical_language>

Target:
protected boolean writeNeedsRemoteValue(InvocationContext ctx, WriteCommand command, Object key) { if (command.hasFlag(Flag.CACHE_MODE_LOCAL)) { return false; } if (ctx.isOriginLocal()) { if (!command.readsExistingValues()) { return false; } return !command.hasFlag(Flag.SKIP_REMOTE_LOOKUP); } else { return command.alwaysReadsExistingValues(); } }
Source:
<code>public void testProjectionWithValues() throws Exception { List<Row> data = Arrays.asList( Row.of( (byte) 1, (short) 1, 1, 1L, 1.1f, 1.1, new BigDecimal("1.1"), true, LocalTime.of(1, 1, 1), LocalDate.of(1, 1, 1), LocalDateTime.of(1, 1, 1, 1, 1, 1, 1), Instant.ofEpochMilli(1), "1", new byte[] {1}, new BigDecimal[]{new BigDecimal("1.1")}, createMap("1", new BigDecimal("1.1")) ), Row.of( (byte) 2, (short) 2, 2, 2L, 2.2f, 2.2, new BigDecimal("2.2"), false, LocalTime.of(2, 2, 2), LocalDate.of(2, 2, 2), LocalDateTime.of(2, 2, 2, 2, 2, 2, 2), Instant.ofEpochMilli(2), "2", new byte[] {2}, new BigDecimal[]{new BigDecimal("2.2")}, createMap("2", new BigDecimal("2.2")) ) ); tEnv().createTemporaryFunction("func", new CustomScalarFunction()); Table t = tEnv().fromValues(data) .select(call( "func", <START> IntStream.rangeClosed(0, 15).mapToObj(idx -> $("f" + idx)).toArray(Expression[]::new))); <END> TestCollectionTableFactory.reset(); tEnv().sqlUpdate( "CREATE TABLE SinkTable(str STRING) WITH ('connector' = 'COLLECTION')"); t.insertInto("SinkTable"); tEnv().execute(""); List<Row> actual = TestCollectionTableFactory.getResult(); List<Row> expected = Arrays.asList( Row.of( "1,1,1,1,1.1,1.1,1.1,true,01:01:01,0001-01-01,0001-01-01T01:01:01.000000001," + "1970-01-01T00:00:00.001Z,1,[1],[1.1],{1=1.1}"), Row.of( "2,2,2,2,2.2,2.2,2.2,false,02:02:02,0002-02-02,0002-02-02T02:02:02.000000002," + "1970-01-01T00:00:00.002Z,2,[2],[2.2],{2=2.2}") ); assertThat( new HashSet<>(actual), equalTo(new HashSet<>(expected))); }</code><technical_language>fancy expressions for selecting a range of columns</technical_language>

Target:
public void testProjectionWithValues() throws Exception { List<Row> data = Arrays.asList( Row.of( (byte) 1, (short) 1, 1, 1L, 1.1f, 1.1, new BigDecimal("1.1"), true, LocalTime.of(1, 1, 1), LocalDate.of(1, 1, 1), LocalDateTime.of(1, 1, 1, 1, 1, 1, 1), Instant.ofEpochMilli(1), "1", new byte[] {1}, new BigDecimal[]{new BigDecimal("1.1")}, createMap("1", new BigDecimal("1.1")) ), Row.of( (byte) 2, (short) 2, 2, 2L, 2.2f, 2.2, new BigDecimal("2.2"), false, LocalTime.of(2, 2, 2), LocalDate.of(2, 2, 2), LocalDateTime.of(2, 2, 2, 2, 2, 2, 2), Instant.ofEpochMilli(2), "2", new byte[] {2}, new BigDecimal[]{new BigDecimal("2.2")}, createMap("2", new BigDecimal("2.2")) ) ); tEnv().createTemporaryFunction("func", new CustomScalarFunction()); Table t = tEnv().fromValues(data) .select(call("func", withColumns(range("f0", "f15")))); TestCollectionTableFactory.reset(); tEnv().sqlUpdate( "CREATE TABLE SinkTable(str STRING) WITH ('connector' = 'COLLECTION')"); t.insertInto("SinkTable"); tEnv().execute(""); List<Row> actual = TestCollectionTableFactory.getResult(); List<Row> expected = Arrays.asList( Row.of( "1,1,1,1,1.1,1.1,1.1,true,01:01:01,0001-01-01,0001-01-01T01:01:01.000000001," + "1970-01-01T00:00:00.001Z,1,[1],[1.1],{1=1.1}"), Row.of( "2,2,2,2,2.2,2.2,2.2,false,02:02:02,0002-02-02,0002-02-02T02:02:02.000000002," + "1970-01-01T00:00:00.002Z,2,[2],[2.2],{2=2.2}") ); assertThat( new HashSet<>(actual), equalTo(new HashSet<>(expected))); }
Source:
<code><START> public BalanceResource getSubResource(String id) { <END> return inject(new BackendBalanceResource(id, getPolicyUnit(id))); }</code><technical_language>getSubResource --> getBalanceSubResource, for consistency</technical_language>

Target:
public BalanceResource getSubResource(String id) { return inject(new BackendBalanceResource(id)); }
Source:
<code>void createHandle (int index) { state |= HANDLE; fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_widget_set_has_window (fixedHandle, true); handle = gtk_box_new (OS.GTK_ORIENTATION_VERTICAL, false, 0); if (handle == 0) error (SWT.ERROR_NO_HANDLES); if ((style & SWT.V_SCROLL) != 0) { scrolledHandle = OS.gtk_scrolled_window_new (0, 0); if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_scrolled_window_set_policy (scrolledHandle, OS.GTK_POLICY_NEVER, OS.GTK_POLICY_AUTOMATIC); OS.gtk_container_add (fixedHandle, scrolledHandle); if (OS.GTK_VERSION < OS.VERSION(3, 8, 0)) { OS.gtk_scrolled_window_add_with_viewport (scrolledHandle, handle); } else { OS.gtk_container_add(scrolledHandle, handle); } long viewport = OS.gtk_bin_get_child (scrolledHandle); OS.gtk_viewport_set_shadow_type (viewport, OS.GTK_SHADOW_NONE); } else { OS.gtk_container_add (fixedHandle, handle); } OS.gtk_container_set_border_width (handle, 0); <START> if (OS.GTK_VERSION < OS.VERSION(3, 21, 0)) { <END> setFontDescription(defaultFont().handle); } }</code><technical_language>Generally check for GTK dev versions. GTK3.21 is a development version, this call GTK3.22</technical_language>

Target:
void createHandle (int index) { state |= HANDLE; fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_widget_set_has_window (fixedHandle, true); handle = gtk_box_new (OS.GTK_ORIENTATION_VERTICAL, false, 0); if (handle == 0) error (SWT.ERROR_NO_HANDLES); if ((style & SWT.V_SCROLL) != 0) { scrolledHandle = OS.gtk_scrolled_window_new (0, 0); if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_scrolled_window_set_policy (scrolledHandle, OS.GTK_POLICY_NEVER, OS.GTK_POLICY_AUTOMATIC); OS.gtk_container_add (fixedHandle, scrolledHandle); if (OS.GTK_VERSION < OS.VERSION(3, 8, 0)) { OS.gtk_scrolled_window_add_with_viewport (scrolledHandle, handle); } else { OS.gtk_container_add(scrolledHandle, handle); } long viewport = OS.gtk_bin_get_child (scrolledHandle); OS.gtk_viewport_set_shadow_type (viewport, OS.GTK_SHADOW_NONE); } else { OS.gtk_container_add (fixedHandle, handle); } OS.gtk_container_set_border_width (handle, 0); if (OS.GTK_VERSION < OS.VERSION(3, 22, 0)) { setFontDescription(defaultFont().handle); } }
Source:
<code>public void append(long key, ByteBuffer payLoad) { LongConsumer lambda; if (listener != null && fireEvents) { lambda = (k) -> { Chain beforeAppend = segmentFor(k).getAndAppend(k, payLoad); <START> listener.onAppend(payLoad.duplicate(), beforeAppend); <END> }; } else { lambda = (k) -> segmentFor(k).append(k, payLoad); } try { lambda.accept(key); } catch (OversizeMappingException e) { consumeOversizeMappingException(key, lambda); } }</code><technical_language>Listener null right? able drop initial null check. pulled conditional out. method hot path dispatch a lambda... this negative performance effects</technical_language>

Target:
public void append(long key, ByteBuffer payLoad) { LongConsumer lambda; if (listener != null && fireEvents) { lambda = (k) -> { Chain beforeAppend = segmentFor(k).getAndAppend(k, payLoad); listener.onAppend(beforeAppend, payLoad.duplicate()); }; } else { lambda = (k) -> segmentFor(k).append(k, payLoad); } try { lambda.accept(key); } catch (OversizeMappingException e) { consumeOversizeMappingException(key, lambda); } }
Source:
<code>public Map<String, String> getBinaryFulltext(String id) { State state = transaction.getStateForRead(id); String fulltext = (String) state.get(KEY_FULLTEXT_BINARY); <START> if (fulltextStoredInBlob) { String key = fulltext; if (key != null) { <END> DocumentBlobManager blobManager = Framework.getService(DocumentBlobManager.class); try { BlobInfo blobInfo = new BlobInfo(); blobInfo.key = key; Blob blob = blobManager.readBlob(blobInfo, getRepositoryName()); fulltext = blob.getString(); } catch (IOException e) { throw new PropertyException("Cannot read fulltext blob for doc: " + id, e); } } } return Collections.singletonMap("binarytext", fulltext); }</code><technical_language>about: java if (fulltextStoredInBlob && fulltext != null)</technical_language>

Target:
public Map<String, String> getBinaryFulltext(String id) { State state = transaction.getStateForRead(id); String fulltext = (String) state.get(KEY_FULLTEXT_BINARY); if (fulltextStoredInBlob && fulltext != null) { DocumentBlobManager blobManager = Framework.getService(DocumentBlobManager.class); try { BlobInfo blobInfo = new BlobInfo(); blobInfo.key = fulltext; Blob blob = blobManager.readBlob(blobInfo, getRepositoryName()); fulltext = blob.getString(); } catch (IOException e) { throw new PropertyException("Cannot read fulltext blob for doc: " + id, e); } } return Collections.singletonMap(BINARY_FULLTEXT_MAIN_KEY, fulltext); }
Source:
<code>public TestEntity readFrom(ProtoStreamReader reader) throws IOException { <START> return new TestEntity(reader.readString("name1"), reader.readString("name2"), <END> reader.readString("name3"), reader.readString("name4"), reader.readString("name5"), reader.readString("name6")); }</code><technical_language>This lines a lot of pandas sad depressed :)</technical_language>

Target:
public TestEntity readFrom(ProtoStreamReader reader) throws IOException { String name1 = reader.readString("name1"); String name2 = reader.readString("name2"); String name3 = reader.readString("name3"); String name4 = reader.readString("name4"); String name5 = reader.readString("name5"); String name6 = reader.readString("name6"); return new TestEntity(name1, name2, name3, name4, name5, name6); }
Source:
<code>public void onLogout() { AsyncQuery query = new AsyncQuery(); query.setHandleFailure(true); query.setModel(this); query.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object ReturnValue) { if (clientAgentType.isIE8OrBelow()) { Window.Location.reload(); } <START> frontend.setLoggedInUser(null); <END> getLoginModel().resetAfterLogout(); AsyncDataProvider.clearCache(); connectAutomaticallyManager.resetAlreadyOpened(); ApplicationInit.super.onLogout(); } }; Frontend.LogoffAsync(frontend.getLoggedInUser(), query); }</code><technical_language>"clearLoggedInUser" method clear user password. is password cleared now</technical_language>

Target:
public void onLogout() { AsyncQuery query = new AsyncQuery(); query.setHandleFailure(true); query.setModel(this); query.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object ReturnValue) { if (clientAgentType.isIE8OrBelow()) { Window.Location.reload(); } frontend.clearLoggedInUser(); getLoginModel().resetAfterLogout(); AsyncDataProvider.clearCache(); connectAutomaticallyManager.resetAlreadyOpened(); ApplicationInit.super.onLogout(); } }; frontend.logoffAsync(frontend.getLoggedInUser(), query); }
Source:
<code>protected boolean maybeInitFilesystem(final List<String> paths) throws IOException { if (getFilesystem() == null) { if (!paths.isEmpty()) { <START> initS3AFileSystem(paths.get(0)); <END> } else { LOG.debug("No path on command line, so not instantiating FS"); } } return getFilesystem() != null; }</code><technical_language>Do need worry a race condition maybeInitFilesystem is called multiple times initS3AFileSystem is called multiple times? initS3AFileSystem protection initializing multiple times</technical_language>

Target:
boolean maybeInitFilesystem(final List<String> paths) throws IOException { if (getFilesystem() == null) { if (!paths.isEmpty()) { initS3AFileSystem(paths.get(0)); } else { LOG.debug("No path on command line, so not instantiating FS"); } } return getFilesystem() != null; }
Source:
<code>public void writeRateLimitShouldBeRespectedByConcurrentWritingThreads() throws InterruptedException { <START> int oneTodoSizeInBytes = 167; <END> int numThreads = 5; int numWritesPerThread = 10; ExecutorService executorService = Executors.newFixedThreadPool(numThreads); List<Future> futures = new ArrayList<>(numThreads); long start = System.nanoTime(); IntStream.range(0, numThreads).forEach(i -> futures.add(executorService.submit(() -> { IntStream.range(0, numWritesPerThread).forEach(j -> writeNTodosOfSize(1, 100)); return null; }))); executorService.shutdown(); Preconditions.checkState(executorService.awaitTermination(30L, TimeUnit.SECONDS), "Read tasks did not finish in 30s"); long timeTakenToWriteInSeconds = TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - start); assertThatAllWritesWereSuccessful(futures); long actualWriteRate = (numThreads * numWritesPerThread * oneTodoSizeInBytes) / timeTakenToWriteInSeconds; assertThat(actualWriteRate).isLessThan( writeBytesPerSecond + (writeBytesPerSecond / 10 )); }</code><technical_language>nit: hoping a programmatic of generating this, non-blocking</technical_language>

Target:
public void writeRateLimitShouldBeRespectedByConcurrentWritingThreads() throws InterruptedException { int oneTodoSizeInBytes = 167; int numThreads = 5; int numWritesPerThread = 10; ExecutorService executorService = Executors.newFixedThreadPool(numThreads); List<Future> futures = new ArrayList<>(numThreads); long start = System.nanoTime(); IntStream.range(0, numThreads).forEach(i -> futures.add(executorService.submit(() -> { IntStream.range(0, numWritesPerThread).forEach(j -> writeNTodosOfSize(1, 100)); return null; }))); executorService.shutdown(); Preconditions.checkState(executorService.awaitTermination(30L, TimeUnit.SECONDS), "Read tasks did not finish in 30s"); long writeTime = System.nanoTime() - start; assertThatAllWritesWereSuccessful(futures); double actualBytesWritten = numThreads * numWritesPerThread * oneTodoSizeInBytes; double maxReadBytesLimit = readBytesPerSecond * ((double) writeTime / TimeUnit.SECONDS.toNanos(1) + 5 ); assertThat(actualBytesWritten).isLessThan(maxReadBytesLimit); }
Source:
<code>public void search(final String term) { <START> final boolean isNewSearch = Objects.equals(term, currentTerm); <END> final Optional<SearchResult<T>> result; if (isNewSearch) { result = findNextElement(term); } else { result = findFirstElement(term); } currentResult = result.orElse(currentResult); currentTerm = term; triggerOnFoundCommand(); }</code><technical_language>Variable name is misleading.. isNewSearch is !Objects.equals(term, currentTerm)</technical_language>

Target:
public void search(final String term) { final boolean isNewSearch = !Objects.equals(term, currentTerm); final Optional<SearchResult<T>> result; if (isNewSearch) { result = findFirstElement(term); } else { result = findNextElement(term); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); }
Source:
<code>public void onEntityPathfind(EntityPathfindEvent event) { this.event = event; Entity entity = event.getEntity(); Entity target = event.getTargetEntity(); this.entity = new EntityTag(entity); this.target = target != null ? new EntityTag(target) : null; EntityTag.rememberEntity(entity); <START> EntityTag.rememberEntity(target); <END> fire(event); EntityTag.forgetEntity(entity); EntityTag.forgetEntity(target); }</code><technical_language>remember/forgets here</technical_language>

Target:
public void onEntityPathfind(EntityPathfindEvent event) { this.event = event; this.entity = new EntityTag(event.getEntity()); Entity target = event.getTargetEntity(); this.target = target != null ? new EntityTag(target) : null; fire(event); }
Source:
<code>private <R> R withConnection(Function<Object, R> function) { ConnectionSupplier connectionSupplier; try { connectionSupplier = connectionSupplierFactory.getConnectionSupplier(); <START> try { <END> R result = function.apply(connectionSupplier.getConnection()); connectionSupplier.close(); return result; } catch (Exception e) { connectionSupplier.invalidateConnection(); throw new ConnectionException(COULD_NOT_OBTAIN_A_CONNECTION, e); } } catch (Exception e) { throw new MuleRuntimeException(createStaticMessage(COULD_NOT_OBTAIN_A_CONNECTION), e); } }</code><technical_language>Is necessary nested try-catch scopes? simpler</technical_language>

Target:
private <R> R withConnection(Function<Object, R> function) { ConnectionSupplier connectionSupplier = getConnectionSupplier(); Object connection = getConnection(connectionSupplier); try { R result = function.apply(connection); connectionSupplier.close(); return result; } catch (Exception e) { if (isFirstPage) { closeDelegate(connection); } connectionSupplier.invalidateConnection(); throw new MuleRuntimeException(createStaticMessage(COULD_NOT_EXECUTE), e); } }
Source:
<code>private boolean isConnectionReset(Throwable t) { <START> return (t instanceof SocketException && (t.getMessage().contains("Connection reset"))) || <END> (t.getCause() != null && isConnectionReset(t.getCause())); }</code><technical_language>Message null, add a guard check</technical_language>

Target:
private boolean isConnectionReset(Throwable t) { return (t instanceof SocketException && (t.getMessage() != null && t.getMessage().contains("Connection reset"))) || (t.getCause() != null && isConnectionReset(t.getCause())); }
Source:
<code>public void onUnimprovedStepCountLimitInputChange( ChangeEvent event ) { try { Integer value = unimprovedStepCountLimitInput.getValue().isEmpty() ? null : Integer.parseInt( unimprovedStepCountLimitInput.getValue() ); presenter.onUnimprovedStepCountLimitChange( value ); } catch ( NumberFormatException e ) { <START> <END> } }</code><technical_language>Likewise.</technical_language>

Target:
public void onUnimprovedStepCountLimitInputChange( ChangeEvent event ) { boolean isNumeric = unimprovedStepCountLimitInput.getValue().matches( "\\d+" ); if (isNumeric) { presenter.onUnimprovedStepCountLimitChange( Integer.parseInt( unimprovedStepCountLimitInput.getValue() ) ); } else { presenter.onUnimprovedStepCountLimitChange( 0 ); unimprovedStepCountLimitInput.setValue( "0" ); } }
Source:
<code>public static List<Path> getPaths(List<String> uriStrings) throws RuntimeException { return uriStrings.stream().map(s -> { try { return IOUtil.getPath(s); } catch (IOException e) { <START> throw new RuntimeException(e); <END> } }).collect(Collectors.toList()); }</code><technical_language>RuntimeIOException maybe</technical_language>

Target:
public static List<Path> getPaths(List<String> uriStrings) throws RuntimeIOException { return uriStrings.stream().map(s -> { try { return IOUtil.getPath(s); } catch (IOException e) { throw new RuntimeIOException(e); } }).collect(Collectors.toList()); }
Source:
<code>public TranslationSystemImpl(Context context) { config = context.get(Config.class).getSystem(); AssetManager assetManager = context.get(AssetManager.class); <START> Set<ResourceUrn> urns = assetManager.getAvailableAssets(Translation.class); <END> for (ResourceUrn urn : urns) { Optional<Translation> asset = assetManager.getAsset(urn, Translation.class); if (asset.isPresent()) { Translation trans = asset.get(); Uri uri = trans.getProjectUri(); if (uri.isValid()) { TranslationProject proj = projects.computeIfAbsent(uri, e -> new StandardTranslationProject()); proj.add(trans); trans.subscribe(this::onAssetChanged); logger.info("Discovered " + trans); } else { logger.warn("Ignoring invalid project uri: {}", uri); } } } }</code><technical_language>I if this needs done upfront, done demand. information needed discover relevant asset is a translation uri + locale, loading indexing, search for needed</technical_language>

Target:
public TranslationSystemImpl(Context context) { config = context.get(Config.class).getSystem(); assetManager = context.get(AssetManager.class); refresh(); }
Source:
<code>public void disable() { <START> for (CustomSpeedController motor : motors) { <END> motor.disable(); } }</code><technical_language>SpeedController CustomSpeedController</technical_language>

Target:
public void disable() { for (SpeedController motor : motors) { motor.disable(); } }
Source:
<code>public synchronized ILogData previous() { final QueuedStreamContext context = getCurrentContext(); final long oldPointer = context.getGlobalPointer(); log.trace("previous[{}]: max={} min={}", this, context.maxResolution, context.minResolution); if (context.getGlobalPointer() == Address.NEVER_READ) { return null; } Long prevAddress = context .resolvedQueue.lower(context.getGlobalPointer()); if (prevAddress == null && Address.isAddress(context.minResolution) || prevAddress != null && prevAddress <= context.minResolution) { context.setGlobalPointer(prevAddress == null ? Address.NEVER_READ : prevAddress - 1L); remainingUpTo(context.minResolution); context.minResolution = Address.NON_ADDRESS; context.setGlobalPointer(oldPointer); prevAddress = context .resolvedQueue.lower(context.getGlobalPointer()); log.trace("previous[{}]: updated resolved queue {}", this, context.resolvedQueue); } context.readQueue.clear(); if (prevAddress != null) { log.trace("previous[{}]: updated read queue {}", this, context.readQueue); context.setGlobalPointer(prevAddress); <START> return read(prevAddress); <END> } log.trace("previous[{}]: reached the beginning of the stream resetting" + " the stream pointer to {}", this, Address.NON_ADDRESS); context.setGlobalPointer(Address.NON_ADDRESS); return null; }</code><technical_language>checking compaction mark here</technical_language>

Target:
public synchronized ILogData previous() { final QueuedStreamContext context = getCurrentContext(); final long oldPointer = context.getGlobalPointer(); log.trace("previous[{}]: max={} min={}", this, context.maxResolution, context.minResolution); if (context.getGlobalPointer() == Address.NEVER_READ) { return null; } compactionMarkCheck(oldPointer - 1L); Long prevAddress = context .resolvedQueue.lower(context.getGlobalPointer()); if (prevAddress == null && Address.isAddress(context.minResolution) || prevAddress != null && prevAddress <= context.minResolution) { context.setGlobalPointer(prevAddress == null ? Address.NEVER_READ : prevAddress - 1L); remainingUpTo(context.minResolution); context.minResolution = Address.NON_ADDRESS; context.setGlobalPointer(oldPointer); prevAddress = context .resolvedQueue.lower(context.getGlobalPointer()); log.trace("previous[{}]: updated resolved queue {}", this, context.resolvedQueue); } context.readQueue.clear(); if (prevAddress != null) { compactionMarkCheck(prevAddress); log.trace("previous[{}]: updated read queue {}", this, context.readQueue); context.setGlobalPointer(prevAddress); return read(prevAddress, prevAddress); } log.trace("previous[{}]: reached the beginning of the stream resetting" + " the stream pointer to {}", this, Address.NON_ADDRESS); context.setGlobalPointer(Address.NON_ADDRESS); return null; }
Source:
<code>public void handleCommand(ChannelUID channelUID, Command command) { if (command instanceof OnOffType) { Integer ioChannel = Integer.valueOf(channelUID.getId().substring(channelUID.getId().length() - 1)); if (ioChannel != null && ioChannel < ((AbstractDigitalOwDevice) sensors.get(0)).getChannelCount()) { Bridge bridge = getBridge(); if (bridge != null) { OwBaseBridgeHandler bridgeHandler = (OwBaseBridgeHandler) bridge.getHandler(); if (bridgeHandler != null) { if (!((AbstractDigitalOwDevice) sensors.get(0)).writeChannel(bridgeHandler, ioChannel, command)) { <START> logger.info("writing to channel in thing not permitted (input channel)", channelUID, <END> this.thing.getUID()); } } else { logger.info("bridge handler not found"); } } else { logger.info("bridge not found"); } } } super.handleCommand(channelUID, command); }</code><technical_language>reduce debug</technical_language>

Target:
public void handleCommand(ChannelUID channelUID, Command command) { if (command instanceof OnOffType) { Integer ioChannel = Integer.valueOf(channelUID.getId().substring(channelUID.getId().length() - 1)); if (ioChannel != null && ioChannel < ((AbstractDigitalOwDevice) sensors.get(0)).getChannelCount()) { Bridge bridge = getBridge(); if (bridge != null) { OwBaseBridgeHandler bridgeHandler = (OwBaseBridgeHandler) bridge.getHandler(); if (bridgeHandler != null) { if (!((AbstractDigitalOwDevice) sensors.get(0)).writeChannel(bridgeHandler, ioChannel, command)) { logger.debug("writing to channel in thing not permitted (input channel)", channelUID, this.thing.getUID()); } } else { logger.warn("bridge handler not found"); } } else { logger.warn("bridge not found"); } } } super.handleCommand(channelUID, command); }
Source:
<code>public void startService() { super.startService(); <START> <END> thumb.setRest(2.0); index.setRest(2.0); majeure.setRest(2.0); ringFinger.setRest(2.0); pinky.setRest(2.0); wrist.setRest(90.0); setVelocity(45.0, 45.0, 45.0, 45.0, 45.0, 45.0); if (controller == null) { controller = (ServoController) startPeer("arduino"); } }</code><technical_language>TODO: remove this hard coded stuff out of startService method</technical_language>

Target:
public void startService() { super.startService(); if (thumb == null) { thumb = (ServoControl)startPeer("thumb"); } if (index == null) { index = (ServoControl)startPeer("index"); } if (majeure == null) { majeure = (ServoControl)startPeer("majeure"); } if (ringFinger == null) { ringFinger = (ServoControl)startPeer("ringFinger"); } if (pinky == null) { pinky = (ServoControl)startPeer("pinky"); } if (wrist == null) { wrist = (ServoControl)startPeer("wrist"); } }
Source:
<code>public void run() { <START> if (taskRequestor == null) { <END> taskRequestor.setupTaskAndConn(1); } recoveryScheduler.startRecovery(failedGroupMap); final long startTime = System.currentTimeMillis(); recoveryScheduler.awaitUntilRecoveryFinish(); LOG.log(Level.INFO, "Recovery is finished in {0} ms...", System.currentTimeMillis() - startTime); }</code><technical_language>!=</technical_language>

Target:
public void run() { if (taskRequestor != null) { taskRequestor.setupTaskAndConn(1); } recoveryScheduler.startRecovery(failedGroupMap); final long startTime = System.currentTimeMillis(); recoveryScheduler.awaitUntilRecoveryFinish(); LOG.log(Level.INFO, "Recovery is finished in {0} ms...", System.currentTimeMillis() - startTime); }
Source:
<code><START> public static boolean isConsideredPrimitive(Class type) { <END> return typeIsPrimitiveOrReferenceBoolean(type) || typeIsPrimitiveOrReferenceByte(type) || typeIsPrimitiveOrReferenceChar(type) || typeIsPrimitiveOrReferenceShort(type) || typeIsPrimitiveOrReferenceInt(type) || typeIsPrimitiveOrReferenceFloat(type) || typeIsPrimitiveOrReferenceLong(type) || typeIsPrimitiveOrReferenceDouble(type) || type == byte[].class || type == String.class || type.isEnum(); }</code><technical_language>another handled a map</technical_language>

Target:
public static boolean isConsideredPrimitive(Class type) { return type.isEnum() || typesConsideredPrimitive.contains(type); }
Source:
<code>private static <T> T get(Class<T> type) { BundleContext context = <START> FrameworkUtil.getBundle(SearchFormsLoaderCommand.class).getBundleContext(); <END> return context.getService(context.getServiceReference(type)); }</code><technical_language>SearchFormsManageCommand.class</technical_language>

Target:
private static <T> T get(Class<T> type) { BundleContext context = FrameworkUtil.getBundle(SearchFormsManageCommand.class).getBundleContext(); return context.getService(context.getServiceReference(type)); }
Source:
<code>public EnrolledCoursesResponse call( ) throws Exception{ try { if(courseId!=null){ ServiceManager api = environment.getServiceManager(); try { enrolledCoursesResponse = new ArrayList<EnrolledCoursesResponse>(api.getEnrolledCourses(false)); for (EnrolledCoursesResponse course : enrolledCoursesResponse) { if (course.getCourse().getId().equals(courseId)) { return course; } } } catch(Exception ex) { logger.error(ex, true); } } return null; <START> } catch(Exception ex) { <END> handle(ex); logger.error(ex); } return null; }</code><technical_language>I Exceptions bubble out of this method; If want handle exception, do call site this task is created</technical_language>

Target:
public EnrolledCoursesResponse call() throws Exception { for (EnrolledCoursesResponse course : environment.getServiceManager().getEnrolledCourses(false)) { if (course.getCourse().getId().equals(courseId)) { return course; } } throw new RuntimeException("Course not found in enrolled courses response"); }
Source:
<code>public void testConcurrentCreationWithOverwrite_bothSucceed() throws IOException, ExecutionException, InterruptedException { URI path = GoogleCloudStorageFileSystemIntegrationTest.getTempFilePath(); Path hadoopPath = ghfsHelper.castAsHadoopPath(path); assertThrows(FileNotFoundException.class, () -> ghfs.getFileStatus(hadoopPath)); String text = "Hello World!"; ExecutorService executorService = Executors.newFixedThreadPool(2); Future<Integer> future1 = executorService.submit( <START> () -> ghfsHelper.writeFile(hadoopPath, text, 1, true)); <END> Future<Integer> future2 = executorService.submit( () -> ghfsHelper.writeFile(hadoopPath, text, 1, true)); Integer numBytesWritten1 = future1.get(); Integer numBytesWritten2 = future2.get(); assertThat(numBytesWritten1).isEqualTo(text.getBytes(UTF_8).length); assertThat(numBytesWritten2).isEqualTo(text.getBytes(UTF_8).length); executorService.shutdown(); String readText = ghfsHelper.readTextFile(hadoopPath, 0, text.getBytes().length, true); assertThat(readText).isEqualTo(text); }</code><technical_language>Write content validate file content equals of them</technical_language>

Target:
public void testConcurrentCreationWithOverwrite_bothSucceed() throws Exception { URI path = GoogleCloudStorageFileSystemIntegrationTest.getTempFilePath(); Path hadoopPath = ghfsHelper.castAsHadoopPath(path); assertThrows(FileNotFoundException.class, () -> ghfs.getFileStatus(hadoopPath)); String text1 = "Hello World!"; String text2 = "World Hello! Long"; ExecutorService executorService = Executors.newFixedThreadPool(2); List<Future<Integer>> futures = executorService.invokeAll( ImmutableList.of( () -> ghfsHelper.writeFile( hadoopPath, text1, 1, true), () -> ghfsHelper.writeFile( hadoopPath, text2, 1, true))); executorService.shutdown(); assertThat(futures.get(0).get()).isEqualTo(text1.length()); assertThat(futures.get(1).get()).isEqualTo(text2.length()); String readText = ghfsHelper.readTextFile(hadoopPath); assertThat(ImmutableList.of(readText)).containsAnyOf(text1, text2); }
Source:
<code>public void init() { String configEnv = url.getParameter(Constants.CONFIG_ENV_KEY); String configAddr = url.getParameter(Constants.CONFIG_ADDRESS_KEY); String configCluster = url.getParameter(Constants.CONFIG_CLUSTER_KEY); if (configEnv != null) { System.setProperty(APOLLO_ENV_KEY, configEnv); } if (configAddr != null) { System.setProperty(APOLLO_ADDR_KEY, configAddr); } if (configCluster != null) { System.setProperty(APOLLO_CLUSTER_KEY, configCluster); } <START> dubboConfig = ConfigService.getConfig("dubbo"); <END> appConfig = ConfigService.getAppConfig(); }</code><technical_language>I user pass namespace name for dubbo config? If specified, a default namespace, application. I in some companies, tend maintain a public inheritable config provide optimized default, allow specific application override some of configs. for configs, name dubbo in apollo, public namespaces prefixed department prefix ensure uniqueness</technical_language>

Target:
public void init() { String configEnv = url.getParameter(Constants.CONFIG_ENV_KEY); String configAddr = url.getAddress(); String configCluster = url.getParameter(Constants.CONFIG_CLUSTER_KEY); if (configEnv != null) { System.setProperty(APOLLO_ENV_KEY, configEnv); } if (StringUtils.isEmpty(configEnv) && !Constants.ANYHOST_VALUE.equals(configAddr)) { System.setProperty(APOLLO_ADDR_KEY, configAddr); } if (configCluster != null) { System.setProperty(APOLLO_CLUSTER_KEY, configCluster); } dubboConfig = ConfigService.getConfig("dubbo"); appConfig = ConfigService.getAppConfig(); }
Source:
<code>public static byte[] toUtf8(final String string) { if(string == null){ <START> return null; <END> } try { return string.getBytes(UTF8_STRING); } catch (UnsupportedEncodingException e) { throw Throwables.propagate(e); } }</code><technical_language>annotate nullable</technical_language>

Target:
public static byte[] toUtf8(final String string) { try { return string.getBytes(UTF8_STRING); } catch (UnsupportedEncodingException e) { throw Throwables.propagate(e); } }
Source:
<code>public static BlobProperties getBlobPropertiesFromStream(DataInputStream stream) throws IOException { long version = stream.readShort(); <START> if (version == Current_Version) { <END> long ttl = stream.readLong(); boolean isPrivate = stream.readByte() == 1 ? true : false; long creationTime = stream.readLong(); long blobSize = stream.readLong(); String contentType = Utils.readIntString(stream); String ownerId = Utils.readIntString(stream); String serviceId = Utils.readIntString(stream); return new SystemMetadata(blobSize, serviceId, ownerId, contentType, isPrivate, ttl, creationTime); } else { throw new IllegalArgumentException("stream has unknown blob property version " + version); } }</code><technical_language>change, call this variable Version1 Current_Version</technical_language>

Target:
public static BlobProperties getBlobPropertiesFromStream(DataInputStream stream) throws IOException { long version = stream.readShort(); if (version == Version1) { long ttl = stream.readLong(); boolean isPrivate = stream.readByte() == 1 ? true : false; long creationTime = stream.readLong(); long blobSize = stream.readLong(); String contentType = Utils.readIntString(stream); String ownerId = Utils.readIntString(stream); String serviceId = Utils.readIntString(stream); return new SystemMetadata(blobSize, serviceId, ownerId, contentType, isPrivate, ttl, creationTime); } else { throw new IllegalArgumentException("stream has unknown blob property version " + version); } }
Source:
<code><START> public Integer getMaxPartition() { <END> return _maxPartition; }</code><technical_language>Same. need autobox</technical_language>

Target:
public int getMaxPartition() { return _maxPartition; }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SpatialDimensionSchema that = (SpatialDimensionSchema) o; if (dimName != null ? !dimName.equals(that.dimName) : that.dimName != null) { return false; } <START> if (dims != null ? !dims.equals(that.dims) : that.dims != null) { <END> return false; } return this.delimiter.equals(that.delimiter); }</code><technical_language>java.util.Objects.equals(dims, that.dims)</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SpatialDimensionSchema that = (SpatialDimensionSchema) o; if (!Objects.equals(dimName, that.dimName)) { return false; } if (!Objects.equals(dims, that.dims)) { return false; } return this.delimiter.equals(that.delimiter); }
Source:
<code>public void shouldFailTLSHandshakeDueToWrongCertInKnownCertsFile() throws Throwable { SocketChannel channel = SocketChannel.open(); channel.connect( new InetSocketAddress( "localhost", 7687 ) ); File knownCerts = File.createTempFile( "neo4j_known_certs", ".tmp" ); knownCerts.deleteOnExit(); createFakeServerCertPairInKnownCerts( "localhost", 7687, knownCerts ); SSLSocketChannel sslChannel = null; try { sslChannel = new SSLSocketChannel( "localhost", 7687, channel, mock( Logger.class ), usingKnownCerts( knownCerts ) ); sslChannel.close(); } catch ( SSLHandshakeException e ) { assertEquals( "General SSLEngine problem", e.getMessage() ); assertEquals( "General SSLEngine problem", e.getCause().getMessage() ); assertTrue( e.getCause().getCause().getMessage().startsWith( <START> "The certificate received from the server is different from the one we've known in file" ) ); <END> } finally { if ( sslChannel != null ) { sslChannel.close(); } } }</code><technical_language>perspective of a user is well-versed TLS trust-on-first-use, awesome tailor this message helping user fix problem. Eg, change this message more lines of: Unable connect neo4j neo4j://blahblah, encryption certificate server changed. This is a security feature protect man-in-the-middle attacks. If trust certificate server now, simply remove line starts <blah> in file <bleh>. certificate server is: <cert info>. I a long exception message, I issue - independent of which, main point give user a hand in explaining resolve it</technical_language>

Target:
public void shouldFailTLSHandshakeDueToWrongCertInKnownCertsFile() throws Throwable { SocketChannel channel = SocketChannel.open(); channel.connect( new InetSocketAddress( "localhost", 7687 ) ); File knownCerts = File.createTempFile( "neo4j_known_certs", ".tmp" ); knownCerts.deleteOnExit(); createFakeServerCertPairInKnownCerts( "localhost", 7687, knownCerts ); SSLSocketChannel sslChannel = null; try { sslChannel = new SSLSocketChannel( "localhost", 7687, channel, mock( Logger.class ), usingKnownCerts( knownCerts ) ); sslChannel.close(); } catch ( SSLHandshakeException e ) { assertEquals( "General SSLEngine problem", e.getMessage() ); assertEquals( "General SSLEngine problem", e.getCause().getMessage() ); assertTrue( e.getCause().getCause().getMessage().contains( "If you trust the certificate the server uses now, simply remove the line that starts with" ) ); } finally { if ( sslChannel != null ) { sslChannel.close(); } } }
Source:
<code>public static Message poeticFormRequiresDbmMaintainer() { <START> return new Message(Type.ERROR, "Poetic-form must be maintained by only 'RIPE-DBM-MNT'"); <END> }</code><technical_language>Reorder sentence? "Poetic-form maintained by.."</technical_language>

Target:
public static Message poeticFormRequiresDbmMaintainer() { return new Message(Type.ERROR, "Poetic-form must only be maintained by 'RIPE-DBM-MNT'"); }
Source:
<code>void poll(RequestRegistrationCallback<GetOperation> requestRegistrationCallback) { if (operationCompleted) { return; } if (operationException.get() == null) { if (firstChunk.isReady() || firstChunk.isInProgress()) { firstChunk.poll(requestRegistrationCallback); } <START> if (firstChunk.onDecryptMode()) { <END> firstChunk.maybeProcessDecryptCallbackAndCompleteOperation(); } if (firstChunk.isComplete()) { if (blobDataChannel != null) { blobDataChannel.maybeWriteToChannel(); } if (dataChunks != null) { for (GetChunk dataChunk : dataChunks) { if (dataChunk.isFree() && chunkIdIterator.hasNext()) { dataChunk.initialize(chunkIdIterator.nextIndex(), (BlobId) chunkIdIterator.next()); } if (dataChunk.isInProgress() || (dataChunk.isReady() || dataChunk.onDecryptMode() && numChunksRetrieved - blobDataChannel.getNumChunksWrittenOut() < NonBlockingRouter.MAX_IN_MEM_CHUNKS)) { dataChunk.poll(requestRegistrationCallback); if (dataChunk.isComplete()) { onChunkOperationComplete(dataChunk); if (operationCompleted) { break; } } } } } } } if (operationException.get() != null) { abort(operationException.get()); } }</code><technical_language>This combined previous isReady() check</technical_language>

Target:
void poll(RequestRegistrationCallback<GetOperation> requestRegistrationCallback) { if (operationCompleted) { return; } if (operationException.get() == null) { if (firstChunk.isReady() || firstChunk.isInProgress()) { firstChunk.poll(requestRegistrationCallback); } if (firstChunk.isComplete()) { onChunkOperationComplete(firstChunk); if (blobDataChannel != null) { blobDataChannel.maybeWriteToChannel(); } if (dataChunks != null) { for (GetChunk dataChunk : dataChunks) { if (dataChunk.isFree() && chunkIdIterator.hasNext()) { dataChunk.initialize(chunkIdIterator.nextIndex(), (BlobId) chunkIdIterator.next()); } if (dataChunk.isInProgress() || (dataChunk.isReady() && numChunksRetrieved - blobDataChannel.getNumChunksWrittenOut() < NonBlockingRouter.MAX_IN_MEM_CHUNKS)) { dataChunk.poll(requestRegistrationCallback); if (dataChunk.isComplete()) { onChunkOperationComplete(dataChunk); if (operationCompleted) { break; } } } } } } } if (operationException.get() != null) { abort(operationException.get()); } }
Source:
<code>public List<Patient> getPatients(String query, boolean includeVoided, Integer start, Integer length) throws APIException { <START> List<Patient> patients = new Vector<Patient>(); <END> if (StringUtils.isBlank(query)) { return patients; } return dao.getPatients(query, includeVoided, start, length); }</code><technical_language>Avoid Vector. return Collections.emptyList() below</technical_language>

Target:
public List<Patient> getPatients(String query, boolean includeVoided, Integer start, Integer length) throws APIException { if (StringUtils.isBlank(query)) { return Collections.emptyList(); } return dao.getPatients(query, includeVoided, start, length); }
Source:
<code>protected GetRequest createGetRequest(BlobId blobId, MessageFormatFlags flag) { ArrayList<BlobId> blobIds = new ArrayList<BlobId>(1); <START> blobIds.add(blobId); <END> List<PartitionRequestInfo> partitionRequestInfoList = new ArrayList<PartitionRequestInfo>(); PartitionRequestInfo partitionRequestInfo = new PartitionRequestInfo(blobId.getPartition(), blobIds); partitionRequestInfoList.add(partitionRequestInfo); return new GetRequest(NonBlockingRouter.correlationIdGenerator.incrementAndGet(), routerConfig.routerHostname, flag, partitionRequestInfoList, GetOptions.None); }</code><technical_language>Collections.singletonList() more concise. List returned is immutable if is of importance</technical_language>

Target:
protected GetRequest createGetRequest(BlobId blobId, MessageFormatFlags flag) { List<BlobId> blobIds = Collections.singletonList(blobId); List<PartitionRequestInfo> partitionRequestInfoList = Collections.singletonList(new PartitionRequestInfo(blobId .getPartition(), blobIds)); return new GetRequest(NonBlockingRouter.correlationIdGenerator.incrementAndGet(), routerConfig.routerHostname, flag, partitionRequestInfoList, GetOptions.None); }
Source:
<code>static ModeledSegment convertACNVModeledSegmentToModeledSegment(ACNVModeledSegment acnvModeledSegment, TargetCollection<TargetCoverage> targets) { <START> double updatedCenter = acnvModeledSegment.getSegmentMeanPosteriorSummary().center(); <END> if (Math.pow(2, updatedCenter) <= 0) { updatedCenter = ParamUtils.log2(TangentNormalizer.EPSILON); } return new ModeledSegment(acnvModeledSegment.getInterval(), ModeledSegment.NO_CALL, targets.targetCount(acnvModeledSegment.getInterval()), updatedCenter); }</code><technical_language>simply updatedCenter = Math.max(acnvModeledSegment.getSegmentMeanPosteriorSummary().center(), ParamUtils.log2(TangentNormalizer.EPSILON))</technical_language>

Target:
static ModeledSegment convertACNVModeledSegmentToModeledSegment(ACNVModeledSegment acnvModeledSegment, TargetCollection<TargetCoverage> targets) { final double updatedCenter = Math.max(acnvModeledSegment.getSegmentMeanPosteriorSummary().center(), ParamUtils.log2(TangentNormalizer.EPSILON)); return new ModeledSegment(acnvModeledSegment.getInterval(), ModeledSegment.NO_CALL, targets.targetCount(acnvModeledSegment.getInterval()), updatedCenter); }
Source:
<code>private MethodInvocation createStandaloneJ7HashCall() { MethodInvocation j7Invoc= fAst.newMethodInvocation(); <START> for (IVariableBinding fField : fFields) { <END> j7Invoc.arguments().add(fAst.newSimpleName(fField.getName())); } j7Invoc.setExpression(getQualifiedName(JAVA_UTIL_OBJECTS)); j7Invoc.setName(fAst.newSimpleName(METHODNAME_HASH)); return j7Invoc; }</code><technical_language>rename field</technical_language>

Target:
private MethodInvocation createStandaloneJ7HashCall() { MethodInvocation j7Invoc= fAst.newMethodInvocation(); for (IVariableBinding field : fFields) { j7Invoc.arguments().add(fAst.newSimpleName(field.getName())); } j7Invoc.setExpression(getQualifiedName(JAVA_UTIL_OBJECTS)); j7Invoc.setName(fAst.newSimpleName(METHODNAME_HASH)); return j7Invoc; }