auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onUpdate(JsonElement data) { if (active && !(data.isJsonNull())) { state = new LightData(data); updateStatus(state.getReachabilityStatus() ? ThingStatus.ONLINE : ThingStatus.OFFLINE); if (!state.getOnOffState()) { logger.debug("Setting state to OFF"); updateState(CHANNEL_BRIGHTNESS, PercentType.ZERO); return; } PercentType dimmer = state.getBrightness(); if (dimmer != null) { updateState(CHANNEL_BRIGHTNESS, dimmer); } PercentType colorTemp = state.getColorTemperature(); if (colorTemp != null) { updateState(CHANNEL_COLOR_TEMPERATURE, colorTemp); } String devicefirmware = state.getFirmwareVersion(); if (devicefirmware != null) { getThing().setProperty("firmwareVersion", devicefirmware); } String modelId = state.getModelId(); if (devicefirmware != null) { <START> getThing().setProperty("modelId", modelId); <END> } String vendor = state.getVendor(); if (devicefirmware != null) { getThing().setProperty("vendor", vendor); } logger.debug("Updating thing for lightId to state {dimmer: {}, colorTemp: {}, devicefirmware: {}, modelId: {}, vendor: {}}" , state.getLightId(), dimmer, colorTemp, devicefirmware, modelId, vendor); } }</code><technical_language>final Thing.PROPERTY_MODEL_ID instead</technical_language>

Target:
public void onUpdate(JsonElement data) { if (active && !(data.isJsonNull())) { state = new LightData(data); updateStatus(state.getReachabilityStatus() ? ThingStatus.ONLINE : ThingStatus.OFFLINE); if (!state.getOnOffState()) { logger.debug("Setting state to OFF"); updateState(CHANNEL_BRIGHTNESS, PercentType.ZERO); return; } PercentType dimmer = state.getBrightness(); if (dimmer != null) { updateState(CHANNEL_BRIGHTNESS, dimmer); } PercentType colorTemp = state.getColorTemperature(); if (colorTemp != null) { updateState(CHANNEL_COLOR_TEMPERATURE, colorTemp); } String devicefirmware = state.getFirmwareVersion(); if (devicefirmware != null) { getThing().setProperty(Thing.PROPERTY_FIRMWARE_VERSION, devicefirmware); } String modelId = state.getModelId(); if (modelId != null) { getThing().setProperty(Thing.PROPERTY_MODEL_ID, modelId); } String vendor = state.getVendor(); if (vendor != null) { getThing().setProperty(Thing.PROPERTY_VENDOR, vendor); } logger.debug("Updating thing for lightId to state {dimmer: {}, colorTemp: {}, devicefirmware: {}, modelId: {}, vendor: {}}" , state.getLightId(), dimmer, colorTemp, devicefirmware, modelId, vendor); } }
Source:
<code><START> public boolean isSessionAllStop(String sessionId) { <END> DsfServicesTracker servicesTracker = new DsfServicesTracker(MulticoreVisualizerUIPlugin.getBundleContext(), sessionId); IMIRunControl runCtrlService = servicesTracker.getService(IMIRunControl.class); servicesTracker.dispose(); if (runCtrlService != null && runCtrlService.getRunMode() == MIRunMode.ALL_STOP ) { return true; } return false; }</code><technical_language>is a good habit avoid public methods need public. Here, class in internal, matter, safer put private avoid stuck new API. Ok leave is in this case though</technical_language>

Target:
private boolean isSessionAllStop(String sessionId) { DsfServicesTracker servicesTracker = new DsfServicesTracker(MulticoreVisualizerUIPlugin.getBundleContext(), sessionId); IMIRunControl runCtrlService = servicesTracker.getService(IMIRunControl.class); servicesTracker.dispose(); if (runCtrlService != null && runCtrlService.getRunMode() == MIRunMode.ALL_STOP ) { return true; } return false; }
Source:
<code>protected boolean isGhost(EntityModel<String> value) { String text = value.getEntity(); <START> return text == null || text.isEmpty(); <END> }</code><technical_language>Please StringHelper.isNullOrEmpty()</technical_language>

Target:
protected boolean isGhost(EntityModel<String> value) { return StringUtils.isEmpty(value.getEntity()); }
Source:
<code>static org.ovirt.engine.core.common.businessentities.Disk setUpStatisticalEntityExpectations(DiskImage entity) { entity.setReadRate(1); <START> entity.setReadRate(2); <END> entity.setReadLatency(3.0); entity.setWriteLatency(4.0); entity.setFlushLatency(5.0); return entity; }</code><technical_language>setWriteRate</technical_language>

Target:
static org.ovirt.engine.core.common.businessentities.Disk setUpStatisticalEntityExpectations(DiskImage entity) { entity.setReadRate(1); entity.setWriteRate(2); entity.setReadLatency(3.0); entity.setWriteLatency(4.0); entity.setFlushLatency(5.0); return entity; }
Source:
<code>public QuotaConsumptionParametersWrapper clone() { QuotaConsumptionParametersWrapper cloneWrapper = new QuotaConsumptionParametersWrapper(getAuditLogable(), canDoActionMessages); cloneWrapper.setParameters(new ArrayList<QuotaConsumptionParameter>()); for (QuotaConsumptionParameter parameter : getParameters()) { QuotaConsumptionParameter clone = parameter instanceof QuotaStorageConsumptionParameter ? ((QuotaStorageConsumptionParameter)parameter).clone(): <START> ((QuotaVdsGroupConsumptionParameter)parameter).clone(); <END> cloneWrapper.getParameters().add(clone); } return cloneWrapper; }</code><technical_language>Do a scenario in a QutoaConsumptionParameter ability cloned</technical_language>

Target:
public QuotaConsumptionParametersWrapper clone() { QuotaConsumptionParametersWrapper cloneWrapper = new QuotaConsumptionParametersWrapper(getAuditLogable(), canDoActionMessages); cloneWrapper.setParameters(new ArrayList<QuotaConsumptionParameter>()); for (QuotaConsumptionParameter parameter : getParameters()) { cloneWrapper.getParameters().add(parameter.clone()); } return cloneWrapper; }
Source:
<code>public void initialize(URL location, ResourceBundle resources) { try { XMLSettingsLoader loader = new XMLSettingsLoader(DesignerUtil.getSettingsFile()); loadSettings(loader.getSettings()); } catch (IOException ioe) { } initializeLanguageVersionMenu(); initializeViewAnimation(); xpathPanelController.initialiseVersionChoiceBox(xpathVersionChoiceBox); sourceEditorController.languageVersionProperty().bind(languageChoiceBox.getSelectionModel().selectedItemProperty()); xpathPanelController.xpathVersionProperty().bind(xpathVersionChoiceBox.getSelectionModel().selectedItemProperty()); <START> refreshASTButton.setOnAction(e -> onRefreshASTClicked()); <END> licenseMenuItem.setOnAction(this::showLicensePopup); openFileMenuItem.setOnAction(this::onOpenFileClicked); openRecentMenu.setOnAction(e -> updateRecentFilesMenu()); openRecentMenu.setOnShowing(e -> updateRecentFilesMenu()); exportXPathMenuItem.setOnAction(event -> { try { onExportXPathToRuleClicked(event); } catch (IOException e) { } }); fileMenu.setOnShowing(this::onFileMenuShowing); sourceEditorController.refreshAST(); Platform.runLater(() -> sourceEditorController.moveCaret(0, 0)); }</code><technical_language>define (action) events in fxml, e.g. <Button fx:id="refreshASTButton" ... onAction="#onRefreshASTClicked"> method stay private, need annotate "@FXML". menu items. need instances of buttons, menuitems in controller get rid of fx:id attributes in fxml. This work theoretically. I a custom ControllerFactory FXMLLoader yet, I guess, is default implementation - fxml a specific instance of a controller attached, connection fxml controller work..</technical_language>

Target:
public void initialize(URL location, ResourceBundle resources) { try { XMLSettingsLoader loader = new XMLSettingsLoader(DesignerUtil.getSettingsFile()); loadSettings(loader.getSettings()); } catch (IOException ioe) { } initializeLanguageVersionMenu(); initializeViewAnimation(); xpathPanelController.initialiseVersionChoiceBox(xpathVersionChoiceBox); sourceEditorController.languageVersionProperty().bind(languageChoiceBox.getSelectionModel().selectedItemProperty()); xpathPanelController.xpathVersionProperty().bind(xpathVersionChoiceBox.getSelectionModel().selectedItemProperty()); refreshASTButton.setOnAction(e -> onRefreshASTClicked()); licenseMenuItem.setOnAction(e -> showLicensePopup()); openFileMenuItem.setOnAction(e -> onOpenFileClicked()); openRecentMenu.setOnAction(e -> updateRecentFilesMenu()); openRecentMenu.setOnShowing(e -> updateRecentFilesMenu()); fileMenu.setOnShowing(e -> onFileMenuShowing()); exportXPathMenuItem.setOnAction(e -> { try { onExportXPathToRuleClicked(); } catch (IOException ex) { ex.printStackTrace(); } }); sourceEditorController.refreshAST(); Platform.runLater(() -> sourceEditorController.moveCaret(0, 0)); }
Source:
<code>private ImageTicket getTestTicket() { ImageTicket ticket = new ImageTicket(); ticket.setId(Guid.createGuidFromString("799030aa-97c3-4354-871e-0adf0556fcbf")); ticket.setSize(1073741824L); <START> ticket.setUrl("https://server:port/imageio/799030aa-97c3-4354-871e-0adf0556fcbf"); <END> ticket.setTimeout(300); ticket.setOps(new String[]{"read", "write"}); return ticket; }</code><technical_language>images</technical_language>

Target:
private ImageTicket getTestTicket() { ImageTicket ticket = new ImageTicket(); ticket.setId(Guid.createGuidFromString("799030aa-97c3-4354-871e-0adf0556fcbf")); ticket.setSize(1073741824L); ticket.setUrl("https://server:port/images/799030aa-97c3-4354-871e-0adf0556fcbf"); ticket.setTimeout(300); ticket.setOps(new String[]{"read", "write"}); return ticket; }
Source:
<code>private static void validateRecord(SpecificRecord record, Properties recordFieldExpectations) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { Iterator<Entry<Object,Object>> expectationPropertiesIterator = recordFieldExpectations.entrySet().iterator(); while (expectationPropertiesIterator.hasNext()) { <START> Entry<Object,Object> fieldExpectation = expectationPropertiesIterator.next(); <END> Object currentValue = PropertyUtils.getNestedProperty(record, (String)fieldExpectation.getKey()); if ((currentValue != null && !fieldExpectation.getValue().equals(currentValue.toString())) || (currentValue == null && !NULL_VALUE_INDICATOR.equals(fieldExpectation.getValue()))) { throw new RuntimeException( "invalid field value for path: " + fieldExpectation.getKey() + ", expected: '" + fieldExpectation.getValue() + "', " + "got: '" + currentValue + "' Full object content: " + JsonUtils.toPrettyJSON(record.toString())); } } }</code><technical_language>clearer have: for (Entry<String, String> fieldExpectation : (Entry<String, String>)recordFieldExpectations.entrySet()) { ... }</technical_language>

Target:
private static void validateRecord(SpecificRecord record, Properties recordFieldExpectations) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { for (Entry<Object, Object> fieldExpectation : recordFieldExpectations.entrySet()) { Object currentValue = PropertyUtils.getNestedProperty(record, (String)fieldExpectation.getKey()); if ((currentValue != null && !fieldExpectation.getValue().equals(currentValue.toString())) || (currentValue == null && !NULL_VALUE_INDICATOR.equals(fieldExpectation.getValue()))) { throw new RuntimeException( "invalid field value for path: " + fieldExpectation.getKey() + ", expected: '" + fieldExpectation.getValue() + "', " + "got: '" + currentValue + "' Full object content: " + JsonUtils.toPrettyJSON(record.toString())); } } }
Source:
<code>private boolean executeIndicator(Indicator indicator, Connection connection) { String catalogName = getCatalogOrSchemaName(indicator.getAnalyzedElement()); if (needChangeCatalog(connection)) { <START> if (catalogName != null) { END> changeCatalog(catalogName, connection); } } Expression query = dbms().getInstantiatedExpression(indicator); if (query == null) { traceError("Query not executed for indicator: \"" + AnalysisExecutorHelper.getIndicatorName(indicator) + "\" " + "query is null"); return Boolean.FALSE; } else { try { List<Object[]> myResultSet = executeQuery(catalogName, connection, query.getBody()); Boolean isExecSuccess = indicator.storeSqlResults(myResultSet); if (!isExecSuccess) { traceError("Query not executed for indicator: \"" + AnalysisExecutorHelper.getIndicatorName(indicator) + "\" " + "SQL query: " + query.getBody()); return Boolean.FALSE; } } catch (Exception e) { traceError("Query not executed for indicator: \"" + AnalysisExecutorHelper.getIndicatorName(indicator) + "\" " + "SQL query: " + query.getBody() + ". Exception: " + e.getMessage()); return Boolean.FALSE; } } indicator.setComputed(true); return Boolean.TRUE; }</code><technical_language>change if (catalogName != null && needChangeCatalog(connection)) {</technical_language>

Target:
private boolean executeIndicator(Indicator indicator, Connection connection) { String catalogName = getCatalogOrSchemaName(indicator.getAnalyzedElement()); if (catalogName != null && needChangeCatalog(connection)) { changeCatalog(catalogName, connection); } Expression query = dbms().getInstantiatedExpression(indicator); if (query == null) { traceError("Query not executed for indicator: \"" + AnalysisExecutorHelper.getIndicatorName(indicator) + "\" " + "query is null"); return Boolean.FALSE; } else { try { List<Object[]> myResultSet = executeQuery(catalogName, connection, query.getBody()); Boolean isExecSuccess = indicator.storeSqlResults(myResultSet); if (!isExecSuccess) { traceError("Query not executed for indicator: \"" + AnalysisExecutorHelper.getIndicatorName(indicator) + "\" " + "SQL query: " + query.getBody()); return Boolean.FALSE; } } catch (Exception e) { traceError("Query not executed for indicator: \"" + AnalysisExecutorHelper.getIndicatorName(indicator) + "\" " + "SQL query: " + query.getBody() + ". Exception: " + e.getMessage()); return Boolean.FALSE; } } indicator.setComputed(true); return Boolean.TRUE; }
Source:
<code>private List<ResponseOutput> buildResponses(List<FeedbackResponseAttributes> responses, FeedbackResponseCommentSearchResultBundle bundle) { List<ResponseOutput> output = new ArrayList<>(); for (FeedbackResponseAttributes response : responses) { <START> output.add(new ResponseOutput(response.getId(), response.giver, null, null, null, <END> response.giverSection, response.recipient, null, null, response.recipientSection, response.responseDetails, getStudentComment(bundle.comments.get(response.getId()), bundle), buildComments(bundle.comments.get(response.getId()), bundle))); } return output; }</code><technical_language>is a nice builder for ResponseOutput merged recently. advantage that</technical_language>

Target:
private List<ResponseOutput> buildResponses(List<FeedbackResponseAttributes> responses, FeedbackResponseCommentSearchResultBundle bundle) { List<ResponseOutput> output = new ArrayList<>(); for (FeedbackResponseAttributes response : responses) { output.add(ResponseOutput.builder() .withResponseId(response.getId()) .withGiver(bundle.responseGiverTable.get(response.giver)) .withGiverEmail(response.giver) .withGiverSection(response.giverSection) .withRecipient(bundle.responseRecipientTable.get(response.recipient)) .withRecipientEmail(response.recipient) .withRecipientSection(response.recipientSection) .withResponseDetails(response.responseDetails) .withParticipantComment(getParticipantComment(bundle.comments.get(response.getId()), bundle)) .withInstructorComments(getInstructorComments(bundle.comments.get(response.getId()), bundle)) .build()); } return output; }
Source:
<code>public synchronized void start(ServiceProvider serviceProvider) { timeSource = serviceProvider.getService(TimeSourceService.class).getTimeSource(); managementRegistry = serviceProvider.getService(ManagementRegistryService.class); configuration = managementRegistry.getConfiguration(); cacheManager = serviceProvider.getService(CacheManagerProviderService.class).getCacheManager(); scheduledExecutorService = serviceProvider.getService(ExecutionService.class).getScheduledExecutor(configuration.getCollectorExecutorAlias()); <START> if (cacheManager instanceof ObservableCacheManager) { <END> ((ObservableCacheManager)cacheManager).registerListener(this); } }</code><technical_language>If this test evaluates false, this is cache manager silently un-monitorable. a warning that</technical_language>

Target:
public synchronized void start(ServiceProvider serviceProvider) { timeSource = serviceProvider.getService(TimeSourceService.class).getTimeSource(); managementRegistry = serviceProvider.getService(ManagementRegistryService.class); configuration = managementRegistry.getConfiguration(); cacheManager = serviceProvider.getService(CacheManagerProviderService.class).getCacheManager(); scheduledExecutorService = serviceProvider.getService(ExecutionService.class).getScheduledExecutor(configuration.getCollectorExecutorAlias()); cacheManager.registerListener(this); }
Source:
<code>private void hideSplashScreen() { try { Class splashScreenClass = Class.forName("com.install4j.api.launcher.SplashScreen"); Method hideMethod = splashScreenClass.getDeclaredMethod("hide"); hideMethod.invoke(null); <START> } catch (ClassNotFoundException e) { <END> log.debug("No install4j splash screen found to close."); } catch (NoSuchMethodException | IllegalAccessException e) { log.warn("Couldn't close install4j splash screen.", e); } catch (InvocationTargetException e) { log.error("Couldn't close install4j splash screen.", e.getCause()); } }</code><technical_language>Right, this is case want: Catching case of install4j. debug message</technical_language>

Target:
private static void hideSplashScreen() { try { final Class splashScreenClass = Class.forName("com.install4j.api.launcher.SplashScreen"); final Method hideMethod = splashScreenClass.getDeclaredMethod("hide"); hideMethod.invoke(null); } catch (ClassNotFoundException e) { log.debug("No install4j splash screen found to close."); } catch (NoSuchMethodException | IllegalAccessException e) { log.error("Couldn't close install4j splash screen.", e); } catch (InvocationTargetException e) { log.error("Couldn't close install4j splash screen.", e.getCause()); } }
Source:
<code>public Iterator<PropertyContainer> iterator() { return new Iterator<PropertyContainer>() { private final int size = 2 * value.size() + 1; private int index = 0; private final NodeValue[] nodes = value.nodes(); private final RelationshipValue[] relationships = value.relationships(); @Override public boolean hasNext() { return index < size; } @Override public PropertyContainer next() { PropertyContainer propertyContainer; <START> if ( index % 2 == 0 ) <END> { propertyContainer = mapNode( nodes[index / 2] ); } else { propertyContainer = mapRelationship( relationships[index / 2] ); } index++; return propertyContainer; } }; }</code><technical_language>important, index & 1</technical_language>

Target:
public Iterator<PropertyContainer> iterator() { return new Iterator<PropertyContainer>() { private final int size = 2 * value.size() + 1; private int index; private final NodeValue[] nodes = value.nodes(); private final RelationshipValue[] relationships = value.relationships(); @Override public boolean hasNext() { return index < size; } @Override public PropertyContainer next() { PropertyContainer propertyContainer; if ( (index & 1) == 0 ) { propertyContainer = mapNode( nodes[index >> 1] ); } else { propertyContainer = mapRelationship( relationships[index >> 1] ); } index++; return propertyContainer; } }; }
Source:
<code>protected ExprEval eval(ExprEval x, ExprEval y) { String castTo = y.stringValue(); if ("string".equals(castTo)) { return ExprEval.of(x.value() == null ? null : String.valueOf(x.value())); } if ("long".equals(castTo)) { <START> return ExprEval.of(x.type() == ExprType.STRING ? Long.valueOf(x.stringValue()) : x.longValue()); <END> } if ("double".equals(castTo)) { return ExprEval.of(x.type() == ExprType.STRING ? Double.valueOf(x.stringValue()) : x.doubleValue()); } throw new IllegalArgumentException("invalid type " + castTo); }</code><technical_language>If StringExprEval overrode longValue() doubleValue() necessary</technical_language>

Target:
protected ExprEval eval(ExprEval x, ExprEval y) { ExprType castTo; try { castTo = ExprType.valueOf(y.asString().toUpperCase()); } catch (IllegalArgumentException e) { throw new IAE("invalid type '%s'", y.asString()); } return x.castTo(castTo); }
Source:
<code>private List<BaseReport<V>> constructReport(int iTypeOfReport) { logger.entering(iTypeOfReport); List<BaseReport<V>> lb = new ArrayList<BaseReport<V>>(); BaseReport b; for (String indReport : this.reportData.keySet()) { if (iTypeOfReport == 0) { b = new SummaryReport(indReport); <START> } <END> else if (1 == iTypeOfReport) { b = new DetailsReport(indReport); } else { b = new TestOutputReport(indReport); } b.setLstEntities(this.reportData.get(indReport)); lb.add(b); } logger.exiting(lb); return lb; }</code><technical_language>previous of formatting else conditions is preferred. } else { line</technical_language>

Target:
private List<BaseReport<V>> constructReport(int iTypeOfReport) { logger.entering(iTypeOfReport); List<BaseReport<V>> lb = new ArrayList<BaseReport<V>>(); @SuppressWarnings("rawtypes") BaseReport b; for (String indReport : this.reportData.keySet()) { if (iTypeOfReport == 0) { b = new SummaryReport(indReport); } else if (1 == iTypeOfReport) { b = new DetailsReport(indReport); } else { b = new TestOutputReport(indReport); } b.setLstEntities(this.reportData.get(indReport)); lb.add(b); } logger.exiting(lb); return lb; }
Source:
<code>private void registerToHub(boolean checkPresenceFirst) { if (!checkPresenceFirst || !isAlreadyRegistered(nodeConfig)) { String tmp = "http://" + nodeConfig.getConfiguration().get(RegistrationRequest.HUB_HOST) + ":" + nodeConfig.getConfiguration().get(RegistrationRequest.HUB_PORT) + "/grid/register"; HttpClient client = httpClientFactory.getHttpClient(); try { URL registration = new URL(tmp); LOG.info("Registering the node to the hub: " + registration); BasicHttpEntityEnclosingRequest r = new BasicHttpEntityEnclosingRequest("POST", registration.toExternalForm()); int port = Integer.parseInt(nodeConfig.getConfigAsString(RegistrationRequest.PORT)); if (port == 0) { port = server.getRealPort(); Map<String, Object> config = nodeConfig.getConfiguration(); config.put(RegistrationRequest.PORT,server.getRealPort()); URL url = new URL(nodeConfig.getConfigAsString(RegistrationRequest.REMOTE_HOST)); <START> String newUrl = "http://" + url.getHost() + ":" + port; <END> config.put(RegistrationRequest.REMOTE_HOST, newUrl); } String json = nodeConfig.toJSON(); r.setEntity(new StringEntity(json,"UTF-8")); HttpHost host = new HttpHost(registration.getHost(), registration.getPort()); HttpResponse response = client.execute(host, r); if (response.getStatusLine().getStatusCode() != 200) { throw new GridException(String.format("The hub responded with %s:%s", response.getStatusLine().getStatusCode(), response.getStatusLine().getReasonPhrase())); } LOG.info("The node is registered to the hub and ready to use"); } catch (Exception e) { throw new GridException("Error sending the registration request: " + e.getMessage()); } } else { LOG.fine("The node is already present on the hub. Skipping registration."); } }</code><technical_language>assume "http" url.getProtocol()</technical_language>

Target:
private void registerToHub(boolean checkPresenceFirst) { if (!checkPresenceFirst || !isAlreadyRegistered(nodeConfig)) { String tmp = "http://" + nodeConfig.getConfiguration().get(RegistrationRequest.HUB_HOST) + ":" + nodeConfig.getConfiguration().get(RegistrationRequest.HUB_PORT) + "/grid/register"; HttpClient client = httpClientFactory.getHttpClient(); try { URL registration = new URL(tmp); LOG.info("Registering the node to the hub: " + registration); BasicHttpEntityEnclosingRequest r = new BasicHttpEntityEnclosingRequest("POST", registration.toExternalForm()); updateConfigWithRealPort(); String json = nodeConfig.toJSON(); r.setEntity(new StringEntity(json,"UTF-8")); HttpHost host = new HttpHost(registration.getHost(), registration.getPort()); HttpResponse response = client.execute(host, r); if (response.getStatusLine().getStatusCode() != 200) { throw new GridException(String.format("The hub responded with %s:%s", response.getStatusLine().getStatusCode(), response.getStatusLine().getReasonPhrase())); } LOG.info("The node is registered to the hub and ready to use"); } catch (Exception e) { throw new GridException("Error sending the registration request: " + e.getMessage()); } } else { LOG.fine("The node is already present on the hub. Skipping registration."); } }
Source:
<code>public void endElement(String uri, String localName, String qName) { if (version.equals("2") && <START> localName.equals(TaskRepositoriesExternalizer.ELEMENT_TASK_REPOSITORY) && <END> currentRepository != null) { taskRepositories.add(currentRepository); currentRepository = null; } }</code><technical_language>Add If task repositories version = "" currentRepository =null</technical_language>

Target:
public void endElement(String uri, String localName, String qName) { if (currentV2Repository != null && localName.equals(TaskRepositoriesExternalizer.ELEMENT_TASK_REPOSITORYV2)) { taskRepositoriesV2.add(currentV2Repository); currentV2Repository = null; } }
Source:
<code>public boolean test( Object value ) { assert false : "StringPrefixPredicate.test() has not been tested yet... Add tests and remove assert"; <START> return value != null && value instanceof String && ((String)value).startsWith( prefix ); <END> }</code><technical_language>This</technical_language>

Target:
public boolean test( Object value ) { return value != null && value instanceof String && ((String)value).startsWith( prefix ); }
Source:
<code>public static VirtualMachineInstance create(final String platformUpdateDomain, final String platformFaultDomain, final List<VirtualMachineStatus> statuses) { <START> return new AutoValue_VirtualMachineInstance(platformUpdateDomain, platformFaultDomain, statuses); <END> }</code><technical_language>Initialize immutable if present</technical_language>

Target:
public static VirtualMachineInstance create(final String platformUpdateDomain, final String platformFaultDomain, final List<VirtualMachineStatus> statuses) { return new AutoValue_VirtualMachineInstance(platformUpdateDomain, platformFaultDomain, statuses == null ? null : ImmutableList.copyOf(statuses)); }
Source:
<code>public static Optional<DispatchQueueFactory> getDispatchQueueFactory() { if (dispatchQueueFactory != null) { return Optional.of(dispatchQueueFactory); } if (context != null) { try { <START> dispatchQueueFactory = context.getService(context.getServiceReference(DispatchQueueFactory.class)); <END> return Optional.of(dispatchQueueFactory); } catch (Exception e) { LOG.error("Exception while retrieving DispatchQueueFactory Service from registry", e); throw e; } } return Optional.empty(); }</code><technical_language>I do null check reference passing context.getService. In previous case, check this off-heap feature is enabled config is present</technical_language>

Target:
public static Optional<DispatchQueueFactory> getDispatchQueueFactory() { if (dispatchQueueFactory != null) { return Optional.of(dispatchQueueFactory); } if (context != null) { try { ServiceReference<DispatchQueueFactory> serviceReference = context.getServiceReference(DispatchQueueFactory.class); return serviceReference == null ? Optional.empty() : Optional.of(context.getService(serviceReference)); } catch (Exception e) { LOG.error("Exception while retrieving DispatchQueueFactory Service from registry", e); throw e; } } return Optional.empty(); }
Source:
<code>public String toString() { <START> return String.format("long@0x%x=0x%x (%d)", Pointer.nativeValue(getPointer()), getValue(), getValue()); <END> }</code><technical_language>ByteByReference.java</technical_language>

Target:
public String toString() { return String.format("long@0x%1$x=0x%2$x (%2$d)", Pointer.nativeValue(getPointer()), getValue()); }
Source:
<code>public HTTPClientInterface() { final ClientResponseImpl r = new ClientResponseImpl(ClientResponse.CONNECTION_TIMEOUT, new VoltTable[0], "Request Timeout"); m_timeoutResponse = r.toJSONString(); <START> m_closeAllExecutor = CoreUtils.getSingleThreadExecutor("HttpClientInterface-closeAll"); END> m_servicePrincipal = getAuthSystem().getServicePrincipal(); m_spnegoEnabled = m_servicePrincipal != null && !m_servicePrincipal.isEmpty(); }</code><technical_language>Do u leave STEBUG</technical_language>

Target:
public HTTPClientInterface() { final ClientResponseImpl r = new ClientResponseImpl(ClientResponse.CONNECTION_TIMEOUT, new VoltTable[0], "Request Timeout"); m_timeoutResponse = r.toJSONString(); m_servicePrincipal = getAuthSystem().getServicePrincipal(); m_spnegoEnabled = m_servicePrincipal != null && !m_servicePrincipal.isEmpty(); }
Source:
<code>public Map<String, Arg> getArguments() { <START> return ImmutableBiMap.copyOf(this.arguments); <END> }</code><technical_language>..what? original is a BiMap. I assume meant ImmutableMap.copyOf(this.arguments)</technical_language>

Target:
public Map<String, Arg> getArguments() { return this.arguments; }
Source:
<code>private Estimate calculateDataSize( <START> Map<String, PartitionStatistics> statisticsSample, <END> String columnName, Estimate rowCount, Estimate nullsFraction, OptionalDouble rowsPerPartition) { if (rowCount.isValueUnknown() || !rowsPerPartition.isPresent()) { return Estimate.unknownValue(); } double knownNonNullRowCount = 0; double knownDataSize = 0; for (PartitionStatistics statistics : statisticsSample.values()) { double partitionRowCount = orElse(statistics.getBasicStatistics().getRowCount(), rowsPerPartition.getAsDouble()); HiveColumnStatistics partitionColumnStatistics = statistics.getColumnStatistics().get(columnName); if (partitionColumnStatistics == null || !partitionColumnStatistics.getAverageColumnLength().isPresent()) { continue; } double partitionNonNullCount = partitionRowCount - partitionColumnStatistics.getNullsCount().orElse(0); if (partitionNonNullCount < 0) { log.debug("null count bigger than row count in partition stats"); continue; } knownNonNullRowCount += partitionNonNullCount; knownDataSize += partitionColumnStatistics.getAverageColumnLength().getAsDouble() * partitionNonNullCount; } if (knownNonNullRowCount <= 0) { return Estimate.unknownValue(); } double nonNullCount = rowCount.getValue() * (1 - (nullsFraction.isValueUnknown() ? nullsFraction.getValue() : 0)); return new Estimate(knownDataSize / knownNonNullRowCount * nonNullCount); }</code><technical_language>This method is gonna nicer i change HiveColumnStatsitics#averageColumnLength HiveColumnStatsitics#totalValuesSizeInBytes</technical_language>

Target:
private Estimate calculateDataSize( Map<String, PartitionStatistics> statisticsSample, String columnName, Estimate rowCount, Estimate nullsFraction, OptionalDouble rowsPerPartition) { if (rowCount.isValueUnknown() || !rowsPerPartition.isPresent()) { return Estimate.unknownValue(); } double knownNonNullRowCount = 0; double knownDataSize = 0; for (PartitionStatistics statistics : statisticsSample.values()) { double partitionRowCount = orElse(statistics.getBasicStatistics().getRowCount(), rowsPerPartition.getAsDouble()); HiveColumnStatistics partitionColumnStatistics = statistics.getColumnStatistics().get(columnName); if (partitionColumnStatistics == null || !partitionColumnStatistics.getAverageColumnLength().isPresent()) { continue; } double partitionNonNullCount = partitionRowCount - partitionColumnStatistics.getNullsCount().orElse(0); if (partitionNonNullCount < 0) { log.debug("null count bigger than row count in partition stats"); continue; } knownNonNullRowCount += partitionNonNullCount; knownDataSize += partitionColumnStatistics.getAverageColumnLength().getAsDouble() * partitionNonNullCount; } if (knownNonNullRowCount == 0) { return Estimate.unknownValue(); } double nonNullCount = rowCount.getValue() * (1 - (nullsFraction.isValueUnknown() ? 0 : nullsFraction.getValue())); return new Estimate(knownDataSize / knownNonNullRowCount * nonNullCount); }
Source:
<code>public void contextRefreshed() { setDispositionConfig(config); <START> setMetadataSharingResolvers(); <END> CloseStaleVisitsSetup.setupCloseStaleVisitsTask(); NameSupport nameSupport = Context.getRegisteredComponent("nameSupport", NameSupport.class); NameTemplateSetup.configureNameTemplate(nameSupport); NameTemplateSetup.configureNameTemplate(NameSupport.getInstance()); }</code><technical_language>If this is programmatic MDS config do, call this function configureMetadataSharing()</technical_language>

Target:
public void contextRefreshed() { setDispositionConfig(config); MetadataSharingSetup.setMetadataSharingResolvers(); CloseStaleVisitsSetup.setupCloseStaleVisitsTask(); NameSupport nameSupport = Context.getRegisteredComponent("nameSupport", NameSupport.class); NameTemplateSetup.configureNameTemplate(nameSupport); NameTemplateSetup.configureNameTemplate(NameSupport.getInstance()); }
Source:
<code><START> public AbfsPerfTracker getAbfsPerfTracker() { <END> return abfsPerfTracker; }</code><technical_language>Widening method accessibility making public solely for testing is a good practice. if acces restricted package level @VisibleForTesting annotation</technical_language>

Target:
protected AbfsPerfTracker getAbfsPerfTracker() { return abfsPerfTracker; }
Source:
<code>public MessageProducer getMessageProducer(Session session, Destination destination) throws JMSConnectorException { MessageProducer messageProducer; <START> if (cachedMessageConsumer == null) { <END> messageProducer = createMessageProducer(session, destination); } else { messageProducer = cachedMessageProducer; } return messageProducer; }</code><technical_language>shouldnt this cachedMessageProducer</technical_language>

Target:
public MessageProducer getMessageProducer(Session session, Destination destination) throws JMSConnectorException { MessageProducer messageProducer; if (cachedMessageProducer == null) { messageProducer = createMessageProducer(session, destination); } else { messageProducer = cachedMessageProducer; } return messageProducer; }
Source:
<code>public Status delete(String table, String key) { try { PreparedStatement stmt = deleteStmt.get(); if (stmt == null) { stmt = session.prepare(QueryBuilder.delete().from(table) .where(QueryBuilder.eq(YCSB_KEY, QueryBuilder.bindMarker()))); stmt.setConsistencyLevel(writeConsistencyLevel); if (trace) { stmt.enableTracing(); } PreparedStatement prevStmt = deleteStmt.getAndSet(stmt); if (prevStmt != null) { stmt = prevStmt; } } logger.debug(stmt.getQueryString()); logger.debug("key = {}", key); session.execute(stmt.bind(key)); return Status.OK; } catch (Exception e) { <START> e.printStackTrace(); <END> logger.error("Error deleting key: {}", key); } return Status.ERROR; }</code><technical_language>this replaced passing exception a final argument logger call</technical_language>

Target:
public Status delete(String table, String key) { try { PreparedStatement stmt = deleteStmt.get(); if (stmt == null) { stmt = session.prepare(QueryBuilder.delete().from(table) .where(QueryBuilder.eq(YCSB_KEY, QueryBuilder.bindMarker()))); stmt.setConsistencyLevel(writeConsistencyLevel); if (trace) { stmt.enableTracing(); } PreparedStatement prevStmt = deleteStmt.getAndSet(stmt); if (prevStmt != null) { stmt = prevStmt; } } logger.debug(stmt.getQueryString()); logger.debug("key = {}", key); session.execute(stmt.bind(key)); return Status.OK; } catch (Exception e) { logger.error(MessageFormatter.format("Error deleting key: {}", key).getMessage(), e); } return Status.ERROR; }
Source:
<code>public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException { RefactoringStatus refactoringStatus = RefactoringStatus.create(Resources.checkInSync(fResource)); if (refactoringStatus != null && !refactoringStatus.isOK()) { boolean autoRefresh= Platform.getPreferencesService().getBoolean(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PREF_LIGHTWEIGHT_AUTO_REFRESH, false, null); if (autoRefresh) { fResource.refreshLocal(IResource.DEPTH_INFINITE, pm); refactoringStatus= RefactoringStatus.create(Resources.checkInSync(fResource)); } } <START> return refactoringStatus; <END> }</code><technical_language>Creating a RefactoringStatus a bit of work. I agree Sarika; this done once: IStatus status = Resources.checkInSync(fResource); if (!status.isOK()) { boolean autoRefresh = ... if (autoRefresh) { ... status = Resource.checkInSync(fResource); } } return RefactoringStatus.create(status); Note checkInSync() returns a null IStatus, null check needed either</technical_language>

Target:
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException { IStatus status= Resources.checkInSync(fResource); if (!status.isOK()) { boolean autoRefresh= Platform.getPreferencesService().getBoolean(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PREF_LIGHTWEIGHT_AUTO_REFRESH, false, null); if (autoRefresh) { fResource.refreshLocal(IResource.DEPTH_INFINITE, pm); status= Resources.checkInSync(fResource); } } return RefactoringStatus.create(status); }
Source:
<code>public void loadConfig() { Map<String, Object> ret = readConfigFromFile(configFilename); <START> for (String id : TypeUtils.getListOfStrings(ret.get(POLICY_CONF.HEALTH_POLICIES.key))) { <END> configs.put(id, (Map<String, String>) ret.get(id)); } }</code><technical_language>enums config keys</technical_language>

Target:
public void loadConfig() { Map<String, Object> ret = readConfigFromFile(configFilename); for (String id : TypeUtils.getListOfStrings(ret.get(PolicyConfigKey.HEALTH_POLICIES.key))) { configs.put(id, (Map<String, Object>) ret.get(id)); } }
Source:
<code><START> public Observable<Boolean> progressObservable() { <END> return ResponseOrError.combineProgressObservable(ImmutableList.of( ResponseOrError.transform(postsDao.postSuccesObserver()))) .lift(OperatorSampleWithLastWithObservable.<Boolean>create(showProgress)); }</code><technical_language>tests for progress</technical_language>

Target:
public Observable<Boolean> progressObservable() { return showProgress; }
Source:
<code>public NonLinearLeastSquareWithPenalty(final Decomposition<?> decomposition, final MatrixAlgebra algebra, final double eps) { ArgumentChecker.notNull(decomposition, "decomposition"); ArgumentChecker.notNull(algebra, "algebra"); <START> ArgumentChecker.isTrue(eps > 0, "must have possitive eps"); <END> _decomposition = decomposition; _algebra = algebra; _eps = eps; }</code><technical_language>s/possitive/positive/</technical_language>

Target:
public NonLinearLeastSquareWithPenalty(final Decomposition<?> decomposition, final MatrixAlgebra algebra, final double eps) { ArgumentChecker.notNull(decomposition, "decomposition"); ArgumentChecker.notNull(algebra, "algebra"); ArgumentChecker.isTrue(eps > 0, "must have positive eps"); _decomposition = decomposition; _algebra = algebra; _eps = eps; }
Source:
<code>private synchronized void handleProcessTerminatedEvent(ProcessTerminatedDebugListener listener) { <START> if( listener.myProcess != null && !listener.myProcess.equals(getProcess())) <END> return; System.out.println(getProcess()); if( getServer().getServerState() != IServer.STATE_STOPPED) { stopPolling(); addProcessTerminatedEvent(); getActualBehavior().setServerStopped(); } DebugPlugin.getDefault().removeDebugEventListener(listener); processListener = null; process = null; nextStopRequiresForce = false; }</code><technical_language>multiple servers starting...is guaranteed overlap</technical_language>

Target:
private synchronized void handleProcessTerminatedEvent(ProcessTerminatedDebugListener listener) { if( listener.myProcess != null && !listener.myProcess.equals(getProcess())) return; if( getServer().getServerState() != IServer.STATE_STOPPED) { stopPolling(); addProcessTerminatedEvent(); getActualBehavior().setServerStopped(); } DebugPlugin.getDefault().removeDebugEventListener(listener); processListener = null; process = null; nextStopRequiresForce = false; }
Source:
<code>public void postBegin() { <START> super.postBegin(); <END> airBlock = blockManager.getBlock(BlockManager.AIR_ID); }</code><technical_language>This is unnecessary. super method do</technical_language>

Target:
public void postBegin() { blockItemFactory = new BlockItemFactory(entityManager); airBlock = blockManager.getBlock(BlockManager.AIR_ID); }
Source:
<code>public PropertyParameter(String name, String... values) { <START> m_name = name.toUpperCase(); END> addValues(values); }</code><technical_language>add assertion</technical_language>

Target:
public PropertyParameter(String name, String... values) { Assertions.assertNotNull(name); m_name = name.toUpperCase(); addValues(values); }
Source:
<code>public static String maskMessage(String message, Pattern maskPattern, String maskString) { Matcher matcher = maskPattern.matcher(message); if (matcher.find()) { StringBuilder maskedMessage = new StringBuilder(""); for (int i = 0; i <= matcher.groupCount(); i++) { int start; int end; if (i == 0) { start = 0; } else { start = matcher.end(i); maskedMessage.append(maskString); } if (i == matcher.groupCount()) { end = message.length() - 1; } else { end = matcher.start(i + 1) - 1; } if (start > end || end >= message.length()) { <START> continue; <END> } for (int j = start; j <= end; j++) { maskedMessage.append(message.charAt(j)); } } return String.valueOf(maskedMessage); } return message; }</code><technical_language>break</technical_language>

Target:
public static String maskMessage(String message, Pattern maskPattern, String maskString) { Matcher matcher = maskPattern.matcher(message); List<Pair<Integer, Integer>> groups = new ArrayList<>(); while (matcher.find()) { for (int i = 1; i <= matcher.groupCount(); i++) { groups.add(new Pair<>(matcher.start(i), matcher.end(i))); } } if (groups.size() == 0) { return message; } StringBuilder maskedMessage = new StringBuilder(""); for (int i = 0; i <= groups.size(); i++) { int start; int end; if (i == 0) { start = 0; } else { start = groups.get(i-1).getSecond(); maskedMessage.append(maskString); } if (i == groups.size()) { end = message.length() - 1; } else { end = groups.get(i).getFirst() - 1; } maskedMessage.append(message.substring(start, end+1)); } return String.valueOf(maskedMessage); }
Source:
<code>public boolean canFillFluidType(FluidStack fluid) <START> { <END> return true; }</code><technical_language>longer part of IFluidHandler? Do plan replace improved TankInfo stuff</technical_language>

Target:
public boolean canFillFluidType(FluidStack fluid) { return canFill(); }
Source:
<code>public void testSelection() { getTreeViewer().expandToLevel(element_1, AbstractTreeViewer.ALL_LEVELS); getTreeViewer().expandToLevel(element_2, AbstractTreeViewer.ALL_LEVELS); getTreeViewer().setSelection(new StructuredSelection(element_1_3)); <START> ISelection selection <END> = getTreeViewer().getStructuredSelection(); assertTrue(selection instanceof ITreeSelection); ITreeSelection treeSelection = (ITreeSelection) selection; assertEquals(new TreeSelection(new TreePath(new Object[] { element_1, element_1_3 }), null), treeSelection); Widget[] items = getTreeViewer().testFindItems(element_2_1_2); TreeItem[] treeItems = new TreeItem[items.length]; System.arraycopy(items, 0, treeItems, 0, items.length); assertEquals(4, treeItems.length); for (TreeItem treeItem : treeItems) { assertNotNull(treeItem); } getTreeViewer().getTree().setSelection(treeItems); treeSelection = getTreeViewer().getStructuredSelection(); List paths = Arrays.asList(treeSelection.getPaths()); assertEquals(4, paths.size()); assertTrue(paths.contains(treePath_1_2_21_212)); assertTrue(paths.contains(treePath_1_21_212)); assertTrue(paths.contains(treePath_1_212)); assertTrue(paths.contains(treePath_2_21_212)); getTreeViewer().setSelection( new TreeSelection(new TreePath[] { treePath_2_21_212 }, null)); assertEquals(1, getTreeViewer().getTree().getSelectionCount()); assertMatchingPath(treePath_2_21_212, getTreeViewer().getTree() .getSelection()[0]); }</code><technical_language>change ITreeSelection</technical_language>

Target:
public void testSelection() { getTreeViewer().expandToLevel(element_1, AbstractTreeViewer.ALL_LEVELS); getTreeViewer().expandToLevel(element_2, AbstractTreeViewer.ALL_LEVELS); getTreeViewer().setSelection(new StructuredSelection(element_1_3)); ITreeSelection treeSelection = getTreeViewer().getStructuredSelection(); assertEquals(new TreeSelection(new TreePath(new Object[] { element_1, element_1_3 }), null), treeSelection); Widget[] items = getTreeViewer().testFindItems(element_2_1_2); TreeItem[] treeItems = new TreeItem[items.length]; System.arraycopy(items, 0, treeItems, 0, items.length); assertEquals(4, treeItems.length); for (TreeItem treeItem : treeItems) { assertNotNull(treeItem); } getTreeViewer().getTree().setSelection(treeItems); treeSelection = getTreeViewer().getStructuredSelection(); List paths = Arrays.asList(treeSelection.getPaths()); assertEquals(4, paths.size()); assertTrue(paths.contains(treePath_1_2_21_212)); assertTrue(paths.contains(treePath_1_21_212)); assertTrue(paths.contains(treePath_1_212)); assertTrue(paths.contains(treePath_2_21_212)); getTreeViewer().setSelection( new TreeSelection(new TreePath[] { treePath_2_21_212 }, null)); assertEquals(1, getTreeViewer().getTree().getSelectionCount()); assertMatchingPath(treePath_2_21_212, getTreeViewer().getTree() .getSelection()[0]); }
Source:
<code>private DispatchedBatchLoader dispatchBatchLoader(DataLoaderRegistry dataLoaderRegistry, String key) { final DataLoader<Object, DataFetcherResult> dataLoader = dataLoaderRegistry.getDataLoader(key); <START> final int dispatchDepth = dataLoader.dispatchDepth(); <END> return new DispatchedBatchLoader<>(key, dispatchDepth, dispatchDepth > 0 ? dataLoader.dispatch() : completedFuture(emptyList())); }</code><technical_language>dispatchDepth > 0 ? dataLoader.dispatch() : completedFuture(emptyList()) dont need this. dataLoader.dispatch() returns empty list if is do return new DispatchedBatchLoader<>(key, dispatchDepth,dataLoader.dispatch());</technical_language>

Target:
private DataLoaderDispatchCall dispatchBatchLoader(DataLoaderRegistry dataLoaderRegistry, String key) { final DataLoader<Object, DataFetcherResult> dataLoader = dataLoaderRegistry.getDataLoader(key); return new DataLoaderDispatchCall<>(dataLoader.dispatchDepth(), dataLoader.dispatch()); }
Source:
<code><START> public Workflow findWorkflowByIdAndCheckWorkflowAndUser(Long entryId, User user) { <END> Workflow workflow = workflowDAO.findById(entryId); checkEntry(workflow); checkUser(user, workflow); return workflow; }</code><technical_language>this private</technical_language>

Target:
private Workflow findWorkflowByIdAndCheckWorkflowAndUser(Long entryId, User user) { Workflow workflow = workflowDAO.findById(entryId); checkEntry(workflow); checkUser(user, workflow); return workflow; }
Source:
<code>protected void handlePost(HttpServletRequest req, HttpServletResponse resp, Session session) throws IOException { if (GET_ALL_EXECUTIONS_URI.match(req.getRequestURI(), new HashMap<>())) { ExecutionParameters executionParameters = extractExecutionParameters(req, resp, session); if (executionParameters == null) { return; } String executionId; try { executionId = executionService.createExecution(executionParameters); } catch (CloudFlowValidationException e) { sendErrorResponse(resp, HttpServletResponse.SC_BAD_REQUEST, e.getMessage()); return; } catch (CloudFlowException e) { sendErrorResponse(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DEFAULT_500_ERROR_MESSAGE); return; } logger.info(String.format("New execution of flow %s was successfully queued with id %s", executionParameters.getFlowId(), executionId)); <START> resp.setHeader("Location", GET_SINGLE_EXECUTION_URI.createURI(executionId)); <END> sendResponse(resp, HttpServletResponse.SC_CREATED, new HashMap<>()); } else { sendErrorResponse(resp, HttpServletResponse.SC_NOT_FOUND, DEFAULT_404_ERROR_MESSAGE); } }</code><technical_language>Nice! this supported. Is common pass information in header</technical_language>

Target:
protected void handlePost(HttpServletRequest req, HttpServletResponse resp, Session session) throws IOException { String requestURI = req.getRequestURI(); if (GET_ALL_EXECUTIONS_URI.match(requestURI, new HashMap<>())) { handleCreateExecution(req, resp, session); } else { sendErrorResponse(resp, HttpServletResponse.SC_NOT_FOUND, DEFAULT_404_ERROR_MESSAGE); } }