auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ManagementChannelHandler startReceiving(Channel channel) { final ManagementChannelHandler handler = new ManagementChannelHandler(ManagementClientChannelStrategy.create(channel), getExecutor()); UserInfo userInfo = channel.getConnection().getUserInfo(); final Subject subject; if (userInfo instanceof SubjectUserInfo) { subject = ((SubjectUserInfo) userInfo).getSubject(); } else { subject = new Subject(); } handler.addHandlerFactory(new ModelControllerClientOperationHandler(getController(), handler, subject)); <START> channel.addCloseHandler(handler); <END> channel.receiveMessage(handler.getReceiver()); return handler; }</code><technical_language>this in particular, other cases? In general this good, i need double check though, I surprised this there</technical_language>

Target:
public ManagementChannelHandler startReceiving(Channel channel) { final ManagementChannelHandler handler = new ManagementChannelHandler(ManagementClientChannelStrategy.create(channel), getExecutor()); UserInfo userInfo = channel.getConnection().getUserInfo(); final Subject subject; if (userInfo instanceof SubjectUserInfo) { subject = ((SubjectUserInfo) userInfo).getSubject(); } else { subject = new Subject(); } handler.addHandlerFactory(new ModelControllerClientOperationHandler(getController(), handler, subject)); channel.receiveMessage(handler.getReceiver()); return handler; }
Source:
<code>public Object visit(ASTFunctionDeclaration node, Object data) { Context context = (Context) data; GoloFunction function = new GoloFunction( node.getName(), node.isLocal() ? LOCAL : PUBLIC, node.isAugmentation() ? AUGMENT : MODULE); if (node.isDecorator()) { function.setDecorator(true); } node.setIrElement(function); while (context.objectStack.peek() instanceof Decorator) { function.addDecorator((Decorator) context.objectStack.pop()); } context.objectStack.push(function); if (!function.getDecorators().isEmpty()) { <START> function.setDecoratorRef("__$$_" + function.getName() + "_decorator_" + context.nextDecoratorId++); <END> } node.childrenAccept(this, data); context.objectStack.pop(); if (!function.getDecorators().isEmpty()) { ASTFunctionDeclaration decorator = createDecorator(function.getDecoratorRef(), function.getDecorators(), node.isAugmentation()); decorator.jjtAccept(this, data); } return data; }</code><technical_language>decorator name (if available) in synthetic function name (more readable debugging). Else, I __$$_decorated_foo_0 is a name</technical_language>

Target:
public Object visit(ASTFunctionDeclaration node, Object data) { Context context = (Context) data; GoloFunction function = new GoloFunction( node.getName(), node.isLocal() ? LOCAL : PUBLIC, node.isAugmentation() ? AUGMENT : MODULE); if (node.isDecorator()) { function.setDecorator(true); } node.setIrElement(function); while (context.objectStack.peek() instanceof Decorator) { function.addDecorator((Decorator) context.objectStack.pop()); } context.objectStack.push(function); if (!function.getDecorators().isEmpty()) { function.setDecoratorRef("__$$_" + function.getName() + "_decorator_" + context.nextDecoratorId++); } node.childrenAccept(this, data); context.objectStack.pop(); if (!function.getDecorators().isEmpty()) { ASTFunctionDeclaration decorator = createDecorator( function.getDecoratorRef(), function.getDecorators()); decorator.setAugmentation(node.isAugmentation()); decorator.jjtAccept(this, data); } return data; }
Source:
<code>void deleteCollection() { try { for (CosmosAsyncClient cosmosAsyncClient : clientDocsMap.keySet()) { cosmosAsyncClient.getDatabase(configuration.getDatabaseId()).getContainer(configuration.getCollectionId()).delete().block(); } } catch (CosmosClientException e) { if (e.getStatusCode() == HttpConstants.StatusCodes.NOTFOUND) { } else { throw e; } } finally { <START> System.out.println("Container on all client have been deleted successfully"); <END> } }</code><technical_language>please logger, System.out/err. Please do everywhere</technical_language>

Target:
void deleteCollection() { try { for (CosmosAsyncClient cosmosAsyncClient : clientDocsMap.keySet()) { cosmosAsyncClient.getDatabase(configuration.getDatabaseId()).getContainer(configuration.getCollectionId()).delete().block(); } } catch (CosmosClientException e) { if (e.getStatusCode() == HttpConstants.StatusCodes.NOTFOUND) { } else { throw e; } } finally { logger.info("Container on all client have been deleted successfully"); } }
Source:
<code>private CompletionStage<RestResponse> stop(RestRequest restRequest) { <START> List<String> servers = restRequest.parameters().get("server"); <END> invocationHelper.getServer().serverStop(servers); return CompletableFuture.completedFuture(new NettyRestResponse.Builder().build()); }</code><technical_language>This moved ClusterResource. ServerResource is server REST call is made. feels strange call http://serverA:11222/rest/v2/server/stop?server=serverB</technical_language>

Target:
private CompletionStage<RestResponse> stop(RestRequest restRequest) { invocationHelper.getServer().serverStop(Collections.emptyList()); return CompletableFuture.completedFuture(new NettyRestResponse.Builder().build()); }
Source:
<code>private <T> void packHandler(OutputObjectState state, T handler) throws IOException { if (!isHandlerPersistable(handler)) { <START> state.packBoolean(false); <END> return; } try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ObjectOutputStream objectStream = new ObjectOutputStream(outputStream)) { objectStream.writeObject(handler); state.packBoolean(true); state.packString(handler.getClass().getName()); state.packBytes(outputStream.toByteArray()); } LOGGER.tracef("Persisted handler: '%s'", handler); }</code><technical_language>Log a warning if handler serializable - add a note docs is expectation</technical_language>

Target:
private <T> void packHandler(OutputObjectState state, T handler) throws IOException { if (!isHandlerPersistable(handler)) { LOGGER.warnf("Ignoring a non-serializable handler %s", handler); state.packBoolean(false); return; } try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ObjectOutputStream objectStream = new ObjectOutputStream(outputStream)) { objectStream.writeObject(handler); state.packBoolean(true); state.packString(handler.getClass().getName()); state.packBytes(outputStream.toByteArray()); } LOGGER.tracef("Persisted handler: '%s'", handler); }
Source:
<code>private Column<GwtChannelInfo, String> getInputCellColumn(final GwtConfigParameter param) { final String id = param.getId(); final GwtConfigParameterType type = param.getType(); final String max = param.getMax(); final String min = param.getMin(); final ValidationInputCell cell = new ValidationInputCell(); final Column<GwtChannelInfo, String> result = new Column<GwtChannelInfo, String>(cell) { @Override public String getValue(final GwtChannelInfo object) { <START> return object.get(id).toString(); <END> } }; result.setFieldUpdater(new FieldUpdater<GwtChannelInfo, String>() { @Override public void update(final int index, final GwtChannelInfo object, final String value) { ValidationData viewData; if (!PropertiesUi.this.validateType(type, value) || max != null && !PropertiesUi.this.validateMax(value, max) || min != null && !PropertiesUi.this.validateMin(value, min)) { viewData = cell.getViewData(object); viewData.setInvalid(true); PropertiesUi.this.nonValidatedCells.add(object.getId()); PropertiesUi.this.setNonValidated(true); PropertiesUi.this.channelTable.redraw(); return; } PropertiesUi.this.nonValidatedCells.remove(object.getId()); PropertiesUi.this.setNonValidated(false); PropertiesUi.this.setDirty(true); PropertiesUi.this.channelTable.redraw(); object.set(param.getId(), value); } }); return result; }</code><technical_language>object.get(id) return null result in NPE</technical_language>

Target:
private Column<GwtChannelInfo, String> getInputCellColumn(final GwtConfigParameter param) { final String id = param.getId(); final GwtConfigParameterType type = param.getType(); final String max = param.getMax(); final String min = param.getMin(); final ValidationInputCell cell = new ValidationInputCell(); final Column<GwtChannelInfo, String> result = new Column<GwtChannelInfo, String>(cell) { @Override public String getValue(final GwtChannelInfo object) { Object result = object.get(id); if (result != null) { return result.toString(); } return null; } }; result.setFieldUpdater(new FieldUpdater<GwtChannelInfo, String>() { @Override public void update(final int index, final GwtChannelInfo object, final String value) { ValidationData viewData; if (!PropertiesUi.this.validateType(type, value) || max != null && !PropertiesUi.this.validateMax(value, max) || min != null && !PropertiesUi.this.validateMin(value, min)) { viewData = cell.getViewData(object); viewData.setInvalid(true); PropertiesUi.this.nonValidatedCells.add(object.getId()); PropertiesUi.this.setNonValidated(true); PropertiesUi.this.channelTable.redraw(); return; } PropertiesUi.this.nonValidatedCells.remove(object.getId()); PropertiesUi.this.setNonValidated(false); PropertiesUi.this.setDirty(true); PropertiesUi.this.channelTable.redraw(); object.set(param.getId(), value); } }); return result; }
Source:
<code>public String extractTelecom(PRPAMT201306UV02PatientTelecom patientTelecom) { LOG.trace("Entering HL7Parser201305Utils.ExtractTelecom method..."); String telecom = null; <START> if (CollectionUtils.isNotEmpty(patientTelecom.getValue()) && patientTelecom.getValue().get(0) != null) { <END> TELExplicit telecomValue = patientTelecom.getValue().get(0); LOG.info("Found patientTelecom in query parameters = " + telecomValue.getValue()); telecom = telecomValue.getValue(); if (!StringUtils.startsWith(telecom, "tel:")) { telecom = null; LOG.info("Found patientTelecom in query parameters is not in the correct uri format"); } } else { LOG.info("message does not contain a patientTelecom"); } LOG.trace("Exiting HL7Parser201305Utils.ExtractTelecom method..."); return telecom; }</code><technical_language>Check for redundancy call for !=null</technical_language>

Target:
public String extractTelecom(PRPAMT201306UV02PatientTelecom patientTelecom) { LOG.trace("Entering HL7Parser201305Utils.ExtractTelecom method..."); String telecom = null; if (CollectionUtils.isNotEmpty(patientTelecom.getValue())) { TELExplicit telecomValue = patientTelecom.getValue().get(0); LOG.info("Found patientTelecom in query parameters = ", telecomValue.getValue()); telecom = telecomValue.getValue(); if (!StringUtils.startsWith(telecom, "tel:")) { telecom = null; LOG.info("Found patientTelecom in query parameters is not in the correct uri format"); } } else { LOG.info("message does not contain a patientTelecom"); } LOG.trace("Exiting HL7Parser201305Utils.ExtractTelecom method..."); return telecom; }
Source:
<code>public void testInvalidDuration() { handle.createQuery("select foo from intervals where id=?") .bind(0, 5) .mapTo(Duration.class) <START> .findOnly(); <END> }</code><technical_language>is example of a test is difficult understand in isolation, critical data (what is in interval id=5?) is in IntervalTestCommon instead of in a setup method a one-off in test itself</technical_language>

Target:
public void testInvalidDuration() { handle.createQuery("select foo from intervals where id=?") .bind(0, 3) .mapTo(Duration.class) .findOnly(); }
Source:
<code>public Optional<List<InternalNode>> getBucketToNode() { if (bucketToNodeAndCache.size() == 0) { return Optional.empty(); } <START> return Optional.of(bucketToNodeAndCache.values().stream().map(InternalNodeAndCache::getInternalNode).collect(Collectors.toList())); <END> }</code><technical_language>Yeah I if want check is initial preferred mapping exists, exclusive explicit :D. Also, method name need changed reflect fact returning mapping is initial mapping</technical_language>

Target:
public Optional<List<InternalNode>> getBucketToNode() { if (bucketToNodeInfo.isEmpty()) { return Optional.empty(); } return Optional.of(bucketToNodeInfo.values().stream().map(InternalNodeInfo::getInternalNode).collect(Collectors.toList())); }
Source:
<code>private static int count(String query) throws StorageException { PreparedStatement s = null; ResultSet result = null; try { Connection conn = connector.obtainSession(); s = conn.prepareStatement(query); result = s.executeQuery(); if (result.next()) { return result.getInt(1); } else { throw new StorageException( String.format("Count result set is empty. Query: %s", query)); } } catch (SQLException ex) { throw new StorageException(ex); } finally { if (s != null) { try { s.close(); } catch (SQLException ex) { } } <START> if (result != null) { <END> try { result.close(); } catch (SQLException ex) { } } connector.closeSession(); } }</code><technical_language>exception issue</technical_language>

Target:
private static int count(String query) throws StorageException { PreparedStatement s = null; ResultSet result = null; try { Connection conn = connector.obtainSession(); s = conn.prepareStatement(query); result = s.executeQuery(); if (result.next()) { return result.getInt(1); } else { throw new StorageException( String.format("Count result set is empty. Query: %s", query)); } } catch (SQLException ex) { throw new StorageException(ex); } finally { if (s != null) { try { s.close(); } catch (SQLException ex) { LOG.warn("Exception when closing the PrepareStatement", ex); } } if (result != null) { try { result.close(); } catch (SQLException ex) { LOG.warn("Exception when closing the ResultSet", ex); } } connector.closeSession(); } }
Source:
<code>public void pull(Context ctx) { Log.d(TAG, "Starting PULL process..."); context = ctx; try { register(); enableMetaDataFlags(); TrackerController.setMaxEvents(getMaxEvents()); TrackerController.setStartDate(EventExtended.format(getStartDate().getTime(), EventExtended.AMERICAN_DATE_FORMAT)); TrackerController.setEndDate(EventExtended.format(Calendar.getInstance().getTime(), EventExtended.AMERICAN_DATE_FORMAT)); MetaDataController.setFullOrganisationUnitHierarchy(AppSettingsBuilder.isFullHierarchy()); MetaDataController.clearMetaDataLoadedFlags(); MetaDataController.wipe(); PopulateDB.wipeSDKData(); PopulateDB.wipeDatabase(); postProgress(context.getString(R.string.progress_pull_downloading)); try { job = DhisService.loadData(context); <START> } catch (Exception ex) { <END> Log.e(TAG, "pullS: " + ex.getLocalizedMessage()); ex.printStackTrace(); } } catch (Exception ex) { Log.e(TAG, "pull: " + ex.getLocalizedMessage()); unregister(); postException(ex); } }</code><technical_language>isDownloadOnlyLastEvents functionality deleted, download event filtering dates</technical_language>

Target:
public void pull(Context ctx) { Log.d(TAG, "Starting PULL process..."); context = ctx; try { register(); enableMetaDataFlags(); TrackerController.setMaxEvents(getMaxEvents()); TrackerController.setStartDate(EventExtended.format(getStartDate().getTime(), EventExtended.AMERICAN_DATE_FORMAT)); TrackerController.setEndDate(EventExtended.format(Calendar.getInstance().getTime(), EventExtended.AMERICAN_DATE_FORMAT)); TrackerController.setDownloadData(!isNoData()); MetaDataController.setFullOrganisationUnitHierarchy(AppSettingsBuilder.isFullHierarchy()); MetaDataController.clearMetaDataLoadedFlags(); MetaDataController.wipe(); PopulateDB.wipeSDKData(); PopulateDB.wipeDatabase(); postProgress(context.getString(R.string.progress_pull_downloading)); try { if (AppSettingsBuilder.isDownloadOnlyLastEvents()) { job = DhisService.loadLastData(context); } else { job = DhisService.loadData(context); } } catch (Exception ex) { Log.e(TAG, "pullS: " + ex.getLocalizedMessage()); ex.printStackTrace(); } } catch (Exception ex) { Log.e(TAG, "pull: " + ex.getLocalizedMessage()); unregister(); postException(ex); } }
Source:
<code>public CompletableFuture<Boolean> sendFollowRequest(String targetUsername, SymmetricKey requestedKey) { return getSharingFolder().thenCompose(sharing -> { return sharing.getChildren(network).thenCompose(children -> { CompletableFuture<Boolean> res = new CompletableFuture<>(); boolean alreadySentRequest = children.stream() .filter(f -> f.getFileProperties().name.equals(targetUsername)) .findAny() .isPresent(); if (alreadySentRequest) { <START> res.completeExceptionally(new Exception("Follow Request already sent!")); <END> return res; } return getFollowing().thenCompose(following -> { boolean alreadyFollowing = following.stream().filter(x -> x.equals(targetUsername)).findAny().isPresent(); if (alreadyFollowing) { res.completeExceptionally(new Exception("User already a follower!")); return res; } return getPublicKeys(targetUsername).thenCompose(targetUserOpt -> { if (!targetUserOpt.isPresent()) { res.completeExceptionally(new Exception("User does not exist!")); return res; } PublicBoxingKey targetUser = targetUserOpt.get().right; return sharing.mkdir(targetUsername, network, null, true, crypto).thenCompose(friendRoot -> { EntryPoint entry = new EntryPoint(friendRoot.getPointer().capability.readOnly(), username); FollowRequest followReq = new FollowRequest(Optional.of(entry), Optional.ofNullable(requestedKey)); PublicKeyHash targetSigner = targetUserOpt.get().left; return blindAndSendFollowRequest(targetSigner, targetUser, followReq); }); }); }); }); }); }</code><technical_language>Futures.errored</technical_language>

Target:
public CompletableFuture<Boolean> sendFollowRequest(String targetUsername, SymmetricKey requestedKey) { return getSharingFolder().thenCompose(sharing -> { return sharing.getChildren(network).thenCompose(children -> { boolean alreadySentRequest = children.stream() .filter(f -> f.getFileProperties().name.equals(targetUsername)) .findAny() .isPresent(); if (alreadySentRequest) { return Futures.errored(new Exception("Follow Request already sent!")); } return getFollowing().thenCompose(following -> { boolean alreadyFollowing = following.stream().filter(x -> x.equals(targetUsername)).findAny().isPresent(); if (alreadyFollowing) { return Futures.errored(new Exception("User already a follower!")); } return getPublicKeys(targetUsername).thenCompose(targetUserOpt -> { if (!targetUserOpt.isPresent()) { return Futures.errored(new Exception("User does not exist!")); } PublicBoxingKey targetUser = targetUserOpt.get().right; return sharing.mkdir(targetUsername, network, null, true, crypto).thenCompose(friendRoot -> { EntryPoint entry = new EntryPoint(friendRoot.getPointer().capability.readOnly(), username); FollowRequest followReq = new FollowRequest(Optional.of(entry), Optional.ofNullable(requestedKey)); PublicKeyHash targetSigner = targetUserOpt.get().left; return blindAndSendFollowRequest(targetSigner, targetUser, followReq); }); }); }); }); }); }
Source:
<code>private void createTrustManagersFromConfiguration(SSLFactory.Mode mode, String truststoreType, String truststoreLocation, <START> long storesReloadInterval) <END> throws IOException, GeneralSecurityException { String passwordProperty = resolvePropertyName(mode, SSL_TRUSTSTORE_PASSWORD_TPL_KEY); String truststorePassword = getPassword(conf, passwordProperty, ""); if (truststorePassword.isEmpty()) { truststorePassword = null; } long truststoreReloadInterval = conf.getLong( resolvePropertyName(mode, SSL_TRUSTSTORE_RELOAD_INTERVAL_TPL_KEY), storesReloadInterval); if (LOG.isDebugEnabled()) { LOG.debug(mode.toString() + " TrustStore: " + truststoreLocation); } trustManager = new ReloadingX509TrustManager( truststoreType, truststoreLocation, truststorePassword); if (truststoreReloadInterval > 0) { fileMonitoringTimer.schedule( new FileMonitoringTimerTask( Paths.get(truststoreLocation), path -> trustManager.loadFrom(path), exception -> LOG.error(ReloadingX509TrustManager.RELOAD_ERROR_MESSAGE, exception)), truststoreReloadInterval, truststoreReloadInterval); } if (LOG.isDebugEnabled()) { LOG.debug(mode.toString() + " Loaded TrustStore: " + truststoreLocation); } trustManagers = new TrustManager[]{trustManager}; }</code><technical_language>rest of this class do this extreme rightward shifting of parameters</technical_language>

Target:
private void createTrustManagersFromConfiguration(SSLFactory.Mode mode, String truststoreType, String truststoreLocation, long storesReloadInterval) throws IOException, GeneralSecurityException { String passwordProperty = resolvePropertyName(mode, SSL_TRUSTSTORE_PASSWORD_TPL_KEY); String truststorePassword = getPassword(conf, passwordProperty, ""); if (truststorePassword.isEmpty()) { truststorePassword = null; } long truststoreReloadInterval = conf.getLong( resolvePropertyName(mode, SSL_TRUSTSTORE_RELOAD_INTERVAL_TPL_KEY), storesReloadInterval); if (LOG.isDebugEnabled()) { LOG.debug(mode.toString() + " TrustStore: " + truststoreLocation + ", reloading at " + truststoreReloadInterval + " millis."); } trustManager = new ReloadingX509TrustManager( truststoreType, truststoreLocation, truststorePassword); if (truststoreReloadInterval > 0) { fileMonitoringTimer.schedule( new FileMonitoringTimerTask( Paths.get(truststoreLocation), path -> trustManager.loadFrom(path), exception -> LOG.error(ReloadingX509TrustManager.RELOAD_ERROR_MESSAGE, exception)), truststoreReloadInterval, truststoreReloadInterval); } if (LOG.isDebugEnabled()) { LOG.debug(mode.toString() + " Loaded TrustStore: " + truststoreLocation); } trustManagers = new TrustManager[]{trustManager}; }
Source:
<code>public boolean isConnectionValid( Connection connection, int timeout ) throws SQLException { try { return provider.isConnectionValid(connection, timeout); } catch (SQLException sqle) { <START> log.error("Error trying to check if the underlying connection is valid", sqle); <END> return false; } }</code><technical_language>@Dudssource Thanks for updating this PR. create a new PR, fix this one. If change branch locally force-push branch fork, automatically update this PR. rebase changes right base branch git rebase -i 5.0.x cherry-picking commit separately. discard of commits make, upstream/master branch, want in this PR. merging master branch, step messes master branch temporarily. done this PR, force-update fork's master upstream/master again, normal</technical_language>

Target:
public boolean isConnectionValid( Connection connection, int timeout ) throws SQLException { try { return provider.isConnectionValid(connection, timeout); } catch (SQLException sqle) { log.debug("Unable to check if the underlying connection is valid", sqle); return false; } }
Source:
<code>public AppiumCommandExecutor(Map<String, CommandInfo> additionalCommands, URL addressOfRemoteServer, HttpClient.Factory httpClientFactory) { super(additionalCommands, addressOfRemoteServer, httpClientFactory); <START> service = null; <END> }</code><technical_language>this a reason of unexpected NPE</technical_language>

Target:
public AppiumCommandExecutor(Map<String, CommandInfo> additionalCommands, URL addressOfRemoteServer, HttpClient.Factory httpClientFactory) { this(additionalCommands, null, checkNotNull(addressOfRemoteServer), httpClientFactory); }
Source:
<code>public void testInt2777UnboundResourceAfterTransactionComplete() { MessageSource<?> source = () -> null; SourcePollingChannelAdapter adapter = new SourcePollingChannelAdapter(); adapter.setSource(source); adapter.setOutputChannelName("bar"); adapter.setBeanFactory(new TestUtils.TestApplicationContext()); adapter.onInit(); TransactionSynchronizationManager.initSynchronization(); TransactionSynchronizationManager.setActualTransactionActive(true); doPoll(adapter); TransactionSynchronizationManager.setActualTransactionActive(false); TransactionSynchronizationManager.unbindResource(source); TransactionSynchronizationManager.setActualTransactionActive(true); doPoll(adapter); TransactionSynchronizationManager.setActualTransactionActive(false); TransactionSynchronizationManager.clearSynchronization(); <START> TransactionSynchronizationManager.unbindResource(source); <END> }</code><technical_language>M-m-m. do changes? Thanks</technical_language>

Target:
public void testInt2777UnboundResourceAfterTransactionComplete() { SourcePollingChannelAdapter adapter = new SourcePollingChannelAdapter(); adapter.setSource(() -> null); TransactionSynchronizationManager.setActualTransactionActive(true); doPoll(adapter); TransactionSynchronizationManager.setActualTransactionActive(false); TransactionSynchronizationManager.setActualTransactionActive(true); doPoll(adapter); TransactionSynchronizationManager.setActualTransactionActive(false); }
Source:
<code>public void rejectsOldRelease() throws IOException { final Repo repo = new MkGithub().randomRepo(); final Issue issue = repo.issues().create("", ""); final Agent agent = new CommentsTag(repo.github()); repo.releases().create("1.0"); repo.releases().create("2.0"); repo.releases().create("3.0-b"); <START> final Talk talk = CommentsTagTest.talk(issue, "1.5"); <END> agent.execute(talk); final Comment.Smart response = new Comment.Smart( repo.issues().get(1).comments().get(1) ); MatcherAssert.assertThat( response.body(), Matchers.containsString("version tag is too low") ); }</code><technical_language>@gumbelmj talk is a redundant variable here</technical_language>

Target:
public void rejectsOldRelease() throws IOException { final Repo repo = new MkGithub().randomRepo(); final Issue issue = repo.issues().create("", ""); final Agent agent = new CommentsTag(repo.github()); repo.releases().create("1.0"); repo.releases().create("2.0"); repo.releases().create("3.0-b"); agent.execute(CommentsTagTest.talk(issue, "1.5")); final Comment.Smart response = new Comment.Smart( repo.issues().get(1).comments().get(1) ); MatcherAssert.assertThat( response.body(), Matchers.containsString("version tag is too low") ); }
Source:
<code>private boolean sessionHasStarted(InputStream responseStream) { Gson gson = new Gson(); JsonObject jsonResponse = gson.fromJson(new InputStreamReader(responseStream), JsonObject .class); return jsonResponse != null && jsonResponse.has("ok") <START> && !jsonResponse.get("ok").isJsonNull(); <END> }</code><technical_language>This check ok true, exists, null</technical_language>

Target:
private boolean sessionHasStarted(InputStream responseStream) { Gson gson = new Gson(); JsonObject jsonResponse = gson.fromJson(new InputStreamReader(responseStream), JsonObject .class); return jsonResponse != null && jsonResponse.has("ok") && jsonResponse.get("ok").isJsonPrimitive() && jsonResponse.getAsJsonPrimitive("ok").isBoolean() && jsonResponse.getAsJsonPrimitive("ok").getAsBoolean(); }
Source:
<code>public void getAndRemoveElementsRemovesOldestElements() { eventStore.putAll(ImmutableList.of(EVENT_1, EVENT_2, EVENT_3)); eventStore.putAll(ImmutableList.of(EVENT_4)); LockWatchEvents events = eventStore.retentionEvents(); assertThat(events.events().stream().map(LockWatchEvent::sequence)).containsExactly(1L, 2L); <START> assertThat(events.versionRange().map(Range::upperEndpoint)).hasValue(2L); <END> assertThat(eventStore.getStateForTesting().eventMap().firstKey()).isEqualTo(3L); }</code><technical_language>This feels more of a test of LockWatchEvents? remove it, checking set of events in line above</technical_language>

Target:
public void getAndRemoveElementsRemovesOldestElements() { eventStore.putAll(makeEvents(EVENT_1, EVENT_2, EVENT_3)); eventStore.putAll(makeEvents(EVENT_4)); LockWatchEvents events = eventStore.retentionEvents(); assertThat(events.events().stream().map(LockWatchEvent::sequence)).containsExactly(1L, 2L); assertThat(eventStore.getStateForTesting().eventMap().firstKey()).isEqualTo(3L); }
Source:
<code><START> public static DefaultCalculationRunner ofMultiThreaded() { <END> return new DefaultCalculationRunner(CalculationTaskRunner.ofMultiThreaded()); }</code><technical_language>factory methods package scoped class</technical_language>

Target:
static DefaultCalculationRunner ofMultiThreaded() { return new DefaultCalculationRunner(CalculationTaskRunner.ofMultiThreaded()); }
Source:
<code>public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { logger.debug("RRD4J Received incoming chart request: ", req); <START> int width = 1024; <END> try { width = Integer.parseInt(req.getParameter("w")); } catch (Exception e) { } int height = 512; try { height = Integer.parseInt(req.getParameter("h")); } catch (Exception e) { } Long period = PERIODS.get(req.getParameter("period")); if (period == null) { period = PERIODS.get("D"); } Date timeEnd = new Date(); Date timeBegin = new Date(timeEnd.getTime() - period); res.setContentType("image/"+getChartType()); try { BufferedImage chart = createChart(null, null, timeBegin, timeEnd, height, width, req.getParameter("items"), req.getParameter("groups")); ImageIO.write(chart, getChartType(), res.getOutputStream()); } catch (ItemNotFoundException e) { logger.debug("Item not found error while generating chart."); } catch (IllegalArgumentException e) { logger.debug("Illegal argument in chart: {}", e); } }</code><technical_language>change this? This optimized for smartphones - setting, fonts get small is readable anymore. for new chart - is usable a smartphone. I prefer low-res big fonts default (also means traffic) if user wants PC/tablet-only, manually define a size</technical_language>

Target:
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { logger.debug("RRD4J Received incoming chart request: ", req); int width = 480; try { width = Integer.parseInt(req.getParameter("w")); } catch (Exception e) { } int height = 240; try { height = Integer.parseInt(req.getParameter("h")); } catch (Exception e) { } Long period = PERIODS.get(req.getParameter("period")); if (period == null) { period = PERIODS.get("D"); } Date timeEnd = new Date(); Date timeBegin = new Date(timeEnd.getTime() - period); res.setContentType("image/"+getChartType()); try { BufferedImage chart = createChart(null, null, timeBegin, timeEnd, height, width, req.getParameter("items"), req.getParameter("groups")); ImageIO.write(chart, getChartType().toString(), res.getOutputStream()); } catch (ItemNotFoundException e) { logger.debug("Item not found error while generating chart."); } catch (IllegalArgumentException e) { logger.debug("Illegal argument in chart: {}", e); } }
Source:
<code>public void addLife() { <START> lives.set(Math.min(lives.get() + 1, (int) settings.getInteger("MAX_LIVES"))); <END> }</code><technical_language>cast int, Integer.intValue() (settings.getInteger("...").intValue()). Do note if setting is null, ways give problems. <organisation</technical_language>

Target:
public void addLife() { lives.set(Math.min(lives.get() + 1, settings.getInteger("MAX_LIVES"))); }
Source:
<code>public void one() { int count = execute(); if (count != 1) { <START> throw new IllegalStateException("Expected one modified row, got: " + count); <END> } }</code><technical_language>grammar nit: 1, one, :</technical_language>

Target:
public void one() { int count = execute(); if (count != 1) { throw new IllegalStateException("Expected 1 modified row, got " + count); } }
Source:
<code>protected List<String> generateSurveillanceRowValues(final CertifiedProductSearchDetails listing, final Surveillance surv) { List<String> result = new ArrayList<String>(); result.add(listing.getChplProductNumber()); <START> result.add(env.getProperty("chplUrlBegin") + "#/listing/" + listing.getId()); <END> result.add(listing.getCertifyingBody().get(CertifiedProductSearchDetails.ACB_NAME_KEY).toString()); result.add(listing.getCurrentStatus().getStatus().getName()); result.add(listing.getDeveloper().getName()); result.add(listing.getProduct().getName()); result.add(listing.getVersion().getVersion()); result.add(surv.getFriendlyId()); if (surv.getStartDate() != null) { LocalDateTime survStartDate = LocalDateTime.ofInstant(Instant.ofEpochMilli(surv.getStartDate().getTime()), ZoneId.systemDefault()); result.add(dateFormatter.format(survStartDate)); } else { result.add(""); } if (surv.getEndDate() != null) { LocalDateTime survEndDate = LocalDateTime.ofInstant(Instant.ofEpochMilli(surv.getEndDate().getTime()), ZoneId.systemDefault()); result.add(dateFormatter.format(survEndDate)); } else { result.add(""); } result.add(surv.getType().getName()); if (surv.getRandomizedSitesUsed() != null) { result.add(surv.getRandomizedSitesUsed().toString()); } else { result.add(""); } result.add(surv.getLastModifiedDate().toInstant().atOffset(ZoneOffset.UTC).format(dateTimeFormatter)); return result; }</code><technical_language>this is new listingDetailsUrl property right? that</technical_language>

Target:
protected List<String> generateSurveillanceRowValues(final CertifiedProductSearchDetails listing, final Surveillance surv) { List<String> result = new ArrayList<String>(); result.add(listing.getChplProductNumber()); result.add(env.getProperty("chplUrlBegin") + env.getProperty("listingDetailsUrl") + listing.getId()); result.add(listing.getCertifyingBody().get(CertifiedProductSearchDetails.ACB_NAME_KEY).toString()); result.add(listing.getCurrentStatus().getStatus().getName()); result.add(listing.getDeveloper().getName()); result.add(listing.getProduct().getName()); result.add(listing.getVersion().getVersion()); result.add(surv.getFriendlyId()); if (surv.getStartDate() != null) { LocalDateTime survStartDate = LocalDateTime.ofInstant(Instant.ofEpochMilli(surv.getStartDate().getTime()), ZoneId.systemDefault()); result.add(dateFormatter.format(survStartDate)); } else { result.add(""); } if (surv.getEndDate() != null) { LocalDateTime survEndDate = LocalDateTime.ofInstant(Instant.ofEpochMilli(surv.getEndDate().getTime()), ZoneId.systemDefault()); result.add(dateFormatter.format(survEndDate)); } else { result.add(""); } result.add(surv.getType().getName()); if (surv.getRandomizedSitesUsed() != null) { result.add(surv.getRandomizedSitesUsed().toString()); } else { result.add(""); } result.add(surv.getLastModifiedDate().toInstant().atOffset(ZoneOffset.UTC).format(dateTimeFormatter)); return result; }
Source:
<code>public void drawParticles(Material material, ParticleRenderingData<ParticleDataSpriteComponent> particleSystem, Vector3f camera) { ParticlePool particlePool = particleSystem.particlePool; material.setBoolean("useTexture", particleSystem.particleData.texture != null); if (particleSystem.particleData.texture != null) { GL13.glActiveTexture(GL13.GL_TEXTURE0); glBindTexture(GL11.GL_TEXTURE_2D, particleSystem.particleData.texture.getId()); <START> material.setFloat2("texSize", particleSystem.particleData.textureSize.x(), particleSystem.particleData.textureSize.y()); <END> } glPushMatrix(); glTranslatef(-camera.x(), -camera.y(), -camera.z()); for (int i = 0; i < particlePool.livingParticles(); i++) { final int i2 = i * 2; final int i3 = i * 3; final int i4 = i * 4; material.setFloat3("position", particlePool.position[i3], particlePool.position[i3 + 1], particlePool.position[i3 + 2] ); material.setFloat3("scale", particlePool.scale[i3], particlePool.scale[i3 + 1], particlePool.scale[i3 + 2] ); material.setFloat4("color", particlePool.color[i4], particlePool.color[i4 + 1], particlePool.color[i4 + 2], particlePool.color[i4 + 3] ); material.setFloat2("texOffset", particlePool.textureOffset[i2], particlePool.textureOffset[i2 + 1] ); drawUnitQuad.call(); } glPopMatrix(); }</code><technical_language>simplified: suggestion material.setFloat2("texSize", particleSystem.particleData.textureSize);</technical_language>

Target:
public void drawParticles(Material material, ParticleRenderingData<ParticleDataSpriteComponent> particleSystem, Vector3f camera) { ParticlePool particlePool = particleSystem.particlePool; material.setBoolean("useTexture", particleSystem.particleData.texture != null); if (particleSystem.particleData.texture != null) { GL13.glActiveTexture(GL13.GL_TEXTURE0); glBindTexture(GL11.GL_TEXTURE_2D, particleSystem.particleData.texture.getId()); material.setFloat2("texSize", particleSystem.particleData.textureSize); } glPushMatrix(); glTranslatef(-camera.x(), -camera.y(), -camera.z()); for (int i = 0; i < particlePool.livingParticles(); i++) { final int i2 = i * 2; final int i3 = i * 3; final int i4 = i * 4; material.setFloat3("position", particlePool.position[i3], particlePool.position[i3 + 1], particlePool.position[i3 + 2] ); material.setFloat3("scale", particlePool.scale[i3], particlePool.scale[i3 + 1], particlePool.scale[i3 + 2] ); material.setFloat4("color", particlePool.color[i4], particlePool.color[i4 + 1], particlePool.color[i4 + 2], particlePool.color[i4 + 3] ); material.setFloat2("texOffset", particlePool.textureOffset[i2], particlePool.textureOffset[i2 + 1] ); drawUnitQuad.call(); } glPopMatrix(); }
Source:
<code>private ChannelBuffer encodeContent(String content) { ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); byte[] contentBytes = content.getBytes(); <START> buf.writeByte(0x00); END> buf.writeByte(contentBytes.length + 6); buf.writeByte(0x00); buf.writeByte(0x00); buf.writeByte(0x04); buf.writeByte(0x00); buf.writeBytes(content.getBytes(StandardCharsets.UTF_8)); return buf; }</code><technical_language>I writeShort instead of writing bytes separately</technical_language>

Target:
private ChannelBuffer encodeContent(String content) { ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); byte[] contentBytes = content.getBytes(); buf.writeShort(contentBytes.length + 6); buf.writeByte(0x00); buf.writeByte(0x00); buf.writeByte(0x04); buf.writeByte(0x00); buf.writeBytes(content.getBytes(StandardCharsets.UTF_8)); return buf; }
Source:
<code>public void setLocation(Vector3d position, UUID world) { Optional<WorldProperties> prop = Sponge.getServer().getWorldProperties(world); if (!prop.isPresent()) { throw new IllegalArgumentException("Invalid World: No world found for UUID"); } Optional<World> loaded = Sponge.getServer().loadWorld(prop.get()); if (!loaded.isPresent()) { throw new IllegalArgumentException("Invalid World: Could not load world for UUID"); } <START> this.setLocation(new Location<>(loaded.get(), position)); <END> }</code><technical_language>Call loaded.orElseThrow(() -> new IllegalArgumentException("Invalid World: load world for UUID")) instead</technical_language>

Target:
public boolean setLocation(Vector3d position, UUID world) { WorldProperties prop = Sponge.getServer().getWorldProperties(world).orElseThrow(() -> new IllegalArgumentException("Invalid World: No world found for UUID")); World loaded = Sponge.getServer().loadWorld(prop).orElseThrow(() -> new IllegalArgumentException("Invalid World: Could not load world for UUID")); return this.setLocation(new Location<>(loaded, position)); }
Source:
<code>public TmfPieChartStatisticsModel getPieChartModel(){ <START> return fPieChartModel; <END> }</code><technical_language>purpose of getPieChartModel method allow extenders overwrite implementation. So, do instead: if (fPieChartModel == null) { fPieChartModel = new TmfPieChartStatisticsModel(); } return fPieChartModel;</technical_language>

Target:
public TmfPieChartStatisticsModel getPieChartModel(){ if (fPieChartModel == null) { fPieChartModel = new TmfPieChartStatisticsModel(); } return fPieChartModel; }
Source:
<code>public ArticlePageObject showMeMyWiki() { <START> changeImplicitWait(250, TimeUnit.MILLISECONDS); <END> try { new WebDriverWait(driver, 180).until(CommonExpectedConditions.elementNotPresent( LOADING_INDICATOR_BY)); } finally { restoreDefaultImplicitWait(); } scrollAndClick(submitButton); Log.log("submit", "Submit button clicked", true, driver); return new ArticlePageObject(); }</code><technical_language>move this 250 some const</technical_language>

Target:
public ArticlePageObject showMeMyWiki() { changeImplicitWait(IMPLICIT_SHORT, TimeUnit.MILLISECONDS); try { new WebDriverWait(driver, CREATE_WIKI_TIMEOUT).until(CommonExpectedConditions.elementNotPresent( LOADING_INDICATOR_BY)); } finally { restoreDefaultImplicitWait(); } scrollAndClick(submitButton); Log.log("submit", "Submit button clicked", true, driver); return new ArticlePageObject(); }
Source:
<code>public static void main(String[] args) throws Exception { String repoPath = System.getProperty("git_repo"); if (repoPath == null) { repoPath = "."; System.out.println( "System property <START> '-Dgit_repo' not <END> specified, using current directory: " + new File(repoPath).getAbsolutePath()); } try (Repository db = new FileRepository(repoPath + "/.git")) { for (String cmd : args) { List<String> result = execute(cmd, db); for (String line : result) { System.out.println(line); } } } }</code><technical_language>system property is called "git_repo" "-Dgit_repo"</technical_language>

Target:
public static void main(String[] args) throws Exception { String repoPath = System.getProperty("git_repo"); if (repoPath == null) { repoPath = "."; System.out.println( "System property 'git_repo' not specified, using current directory: " + new File(repoPath).getAbsolutePath()); } try (Repository db = new FileRepository(repoPath + "/.git")) { for (String cmd : args) { List<String> result = execute(cmd, db); for (String line : result) { System.out.println(line); } } } }
Source:
<code><START> private static Object[] createInMemory() throws URISyntaxException, MalformedURLException, SSLException, CertificateException { <END> Tracer tracer = NoopTracerFactory.create(); EventBus bus = ZeroMqEventBus.create( new ZContext(), "inproc://end-to-end-pub", "inproc://end-to-end-sub", true); URI nodeUri = new URI("http://localhost:4444"); CombinedHandler handler = new CombinedHandler(); HttpClient.Factory clientFactory = new RoutableHttpClientFactory( nodeUri.toURL(), handler, HttpClient.Factory.createDefault()); SessionMap sessions = new LocalSessionMap(tracer, bus); handler.addHandler(sessions); Distributor distributor = new LocalDistributor(tracer, bus, clientFactory, sessions); handler.addHandler(distributor); LocalNode node = LocalNode.builder(tracer, bus, clientFactory, nodeUri) .add(CAPS, createFactory(nodeUri)) .build(); handler.addHandler(node); distributor.add(node); Router router = new Router(tracer, clientFactory, sessions, distributor); Server<?> server = createServer(router); server.start(); return new Object[] { server, clientFactory }; }</code><technical_language>this point, throw Exception is fine. a test</technical_language>

Target:
private static Object[] createInMemory() throws CertificateException, MalformedURLException, SSLException, URISyntaxException { Tracer tracer = NoopTracerFactory.create(); EventBus bus = ZeroMqEventBus.create( new ZContext(), "inproc://end-to-end-pub", "inproc://end-to-end-sub", true); URI nodeUri = new URI("http://localhost:4444"); CombinedHandler handler = new CombinedHandler(); HttpClient.Factory clientFactory = new RoutableHttpClientFactory( nodeUri.toURL(), handler, HttpClient.Factory.createDefault()); SessionMap sessions = new LocalSessionMap(tracer, bus); handler.addHandler(sessions); Distributor distributor = new LocalDistributor(tracer, bus, clientFactory, sessions); handler.addHandler(distributor); LocalNode node = LocalNode.builder(tracer, bus, clientFactory, nodeUri) .add(CAPS, createFactory(nodeUri)) .build(); handler.addHandler(node); distributor.add(node); Router router = new Router(tracer, clientFactory, sessions, distributor); Server<?> server = createServer(router); server.start(); return new Object[] { server, clientFactory }; }
Source:
<code>public void run() { try { PluginWrapper installed = plugin.getInstalled(); synchronized(installed) { if (!installed.isEnabled()) { try { installed.enable(); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to enable " + plugin.getDisplayName(), e); error = e; <START> status = new Failure(e); <END> } if (dynamicLoad) { try { pm.dynamicLoad(getDestination(), true); } catch (Exception e) { LOGGER.log(Level.SEVERE, "Failed to dynamically load " + plugin.getDisplayName(), e); error = e; requiresRestart = true; status = new Failure(e); } } else { requiresRestart = true; } } } status = new Success(); } catch(Throwable e) { LOGGER.log(Level.SEVERE, "An unexpected error occurred while attempting to enable " + plugin.getDisplayName(), e); error = e; requiresRestart = true; status = new Failure(e); } }</code><technical_language>For this case if a local <code>final Status _status</code> declaration. allow ensure set in code branch. assign end</technical_language>

Target:
public void run() { try { PluginWrapper installed = plugin.getInstalled(); synchronized(installed) { if (!installed.isEnabled()) { try { installed.enable(); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to enable " + plugin.getDisplayName(), e); error = e; status = new Failure(e); } if (dynamicLoad) { try { pm.dynamicLoad(getDestination(), true); } catch (Exception e) { LOGGER.log(Level.SEVERE, "Failed to dynamically load " + plugin.getDisplayName(), e); error = e; requiresRestart = true; status = new Failure(e); } } else { requiresRestart = true; } } } } catch(Throwable e) { LOGGER.log(Level.SEVERE, "An unexpected error occurred while attempting to enable " + plugin.getDisplayName(), e); error = e; requiresRestart = true; status = new Failure(e); } if(status instanceof Pending) { status = new Success(); } }
Source:
<code>public static BlobAll deserializeBlobAll(InputStream stream, StoreKeyFactory storeKeyFactory) throws IOException, MessageFormatException { <START> skipHeaders(stream); <END> StoreKey storeKey = storeKeyFactory.getStoreKey(new DataInputStream(stream)); BlobProperties blobProperties = deserializeBlobProperties(stream); byte[] userMetadata = deserializeUserMetadata(stream).array(); BlobData blobData = deserializeBlob(stream); return new BlobAll(storeKey, new BlobInfo(blobProperties, userMetadata), blobData); }</code><technical_language>this is right do? header versions other useful things. a MessageSievingInputStream::checkForMessageValidity() deserializes record. want do similar</technical_language>

Target:
public static BlobAll deserializeBlobAll(InputStream stream, StoreKeyFactory storeKeyFactory) throws IOException, MessageFormatException { validateHeader(stream); StoreKey storeKey = storeKeyFactory.getStoreKey(new DataInputStream(stream)); BlobProperties blobProperties = deserializeBlobProperties(stream); byte[] userMetadata = deserializeUserMetadata(stream).array(); BlobData blobData = deserializeBlob(stream); return new BlobAll(storeKey, new BlobInfo(blobProperties, userMetadata), blobData); }
Source:
<code>private void updateExpTime() { <START> if (_ignoreChanges) return; <END> final TextBoxWidget expTimeTextBox = getExposureTimeTextBox(); if (expTimeTextBox != null && getDataObject() != null) { final String newExpTime = getDataObject().getExposureTimeAsString(); if (!newExpTime.equals(expTimeTextBox.getText())) { expTimeTextBox.setText(newExpTime); } } }</code><technical_language>if (!_ignoreChanges) doX</technical_language>

Target:
private void updateExpTime() { if (!_ignoreChanges) { final TextBoxWidget expTimeTextBox = getExposureTimeTextBox(); if (expTimeTextBox != null && getDataObject() != null) { final String newExpTime = getDataObject().getExposureTimeAsString(); if (!newExpTime.equals(expTimeTextBox.getText())) { expTimeTextBox.setText(newExpTime); } } } }
Source:
<code>public ProjectFeatureFlag(String name, boolean enabled) { <START> this(name, enabled, null); <END> }</code><technical_language>check name</technical_language>

Target:
public ProjectFeatureFlag(String name, boolean enabled) { this(notEmpty(name, "name"), enabled, null); }
Source:
<code>public void showAd(Context context) { if ((interstitialAd == null) || (context == null)) { ThreadUtils.postOnUiThread(new Runnable() { @Override public void run() { <START> if (mediationAdLoadCallback != null) { <END> mediationAdLoadCallback.onFailure( "Verizon Ads SDK incentivized video interstitial failed to load and cannot be shown"); } } }); return; } interstitialAd.show(context); }</code><technical_language>mediationAdLoadCallback is required here. code like: if(mediationRewardedAdCallback != null) { mediationRewardedAdCallback.onAdFailedToShow("Failure Message"); }</technical_language>

Target:
public void showAd(Context context) { if ((interstitialAd == null) || (context == null)) { if (mediationAdLoadCallback != null) { mediationAdLoadCallback.onFailure("Verizon Ads SDK incentivized video interstitial failed to load and cannot be shown"); } return; } interstitialAd.show(context); }