auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Map<String, Resource> exportReportsOf(final Object source) { final Map<String, Resource> reportResources = new HashMap<>(); final Map<String, ExportReportInstruction> instructions = getScopedExportInstruction(); instructions.entrySet() .forEach(config -> { <START> final File destination = IO.getFile(_processor.getBase(), cleanKey(config.getKey())); <END> final ExportReportInstruction instruction = config.getValue(); final Map.Entry<String, Resource> templateResource = getTemplateResource(instruction, destination, _processor.getBase()); if (templateResource != null) { reportResources.put(destination.getPath(), new EmbeddedResource(transform(source, instruction.locale() .orElse(""), config.getValue() .configName() .orElse(""), templateResource.getValue(), templateResource.getKey(), instruction.parameters()), 0L)); } else { reportResources.put(destination.getPath(), new EmbeddedResource(getGeneratedReport(source, config.getValue() .locale() .orElse(""), config.getValue() .configName() .orElse(""), FileHelper.getExtension(destination)), 0L)); } }); return reportResources; }</code><technical_language>I for Processor.removeDuplicateMarker(config.getKey()). means do need cleanKey method</technical_language>

Target:
public Map<String, Resource> exportReportsOf(final Object source) { final Map<String, Resource> reportResources = new HashMap<>(); final Map<String, ExportReportInstruction> instructions = getScopedExportInstruction(); instructions.entrySet() .forEach(config -> { final File destination = IO.getFile(_processor.getBase(), Processor.removeDuplicateMarker(config.getKey())); final ExportReportInstruction instruction = config.getValue(); final Map.Entry<String, Resource> templateResource = getTemplateResource(instruction, destination, _processor.getBase()); if (templateResource != null) { reportResources.put(destination.getPath(), new EmbeddedResource(transform(source, instruction.locale() .orElse(""), config.getValue() .configName() .orElse(""), templateResource.getValue(), templateResource.getKey(), instruction.parameters()), 0L)); } else { reportResources.put(destination.getPath(), new EmbeddedResource(getGeneratedReport(source, config.getValue() .locale() .orElse(""), config.getValue() .configName() .orElse(""), FileHelper.getExtension(destination)), 0L)); } }); return reportResources; }
Source:
<code>public void serialize(T value, DataOutputView target) throws IOException { this.writer = new Output((OutputStream)target); <START> this.kryoSerializer.register(type); <END> this.kryoSerializer.writeClassAndObject(this.writer, value); this.writer.close(); }</code><technical_language>registering type in constructor</technical_language>

Target:
public void serialize(T value, DataOutputView target) throws IOException { this.writer = new Output((OutputStream)target); this.kryoSerializer.writeClassAndObject(this.writer, value); this.writer.close(); }
Source:
<code>public EmailSendingStatus sendEmail(EmailWrapper email) { sentEmails.add(email); <START> return new EmailSendingStatus(200, null); <END> }</code><technical_language>200 -> HttpStatus.SC_OK</technical_language>

Target:
public EmailSendingStatus sendEmail(EmailWrapper email) { sentEmails.add(email); return new EmailSendingStatus(HttpStatus.SC_OK, null); }
Source:
<code><START> public static Collection<Object[]> data() { <END> System.setProperty(OCS_ENABLED, "true"); final ClassLoader classLoader = ExtensionModelJsonGeneratorTestCase.class.getClassLoader(); final ServiceRegistry serviceRegistry = mock(ServiceRegistry.class); when(serviceRegistry.lookupProviders(DeclarationEnricher.class, classLoader)) .thenReturn(asList(new JavaXmlDeclarationEnricher())); List<ExtensionJsonGeneratorTestUnit> extensions; extensions = asList(newTestUnit(javaLoader, TestOAuthExtension.class, "test-oauth-ocs.json")); BiFunction<Class<?>, ExtensionModelLoader, ExtensionModel> createExtensionModel = (extension, loader) -> { ExtensionModel model = loadExtension(extension, loader); if (extensionModels.put(model.getName(), model) != null) { throw new IllegalArgumentException(format("Extension names must be unique. Name [%s] for extension [%s] was already used", model.getName(), extension.getName())); } return model; }; return extensions.stream() .map(e -> e.toTestParams(createExtensionModel)) .collect(toList()); }</code><technical_language>Avoid code duplication parent class</technical_language>

Target:
public static Collection<Object[]> data() { List<ExtensionJsonGeneratorTestUnit> extensions = Collections.singletonList(newTestUnit(javaLoader, TestOAuthExtension.class, "test-oauth-ocs.json")); try { return callWithProperty(OCS_ENABLED, "true", () -> createExtensionModels(extensions)); } catch (Throwable t) { throw new RuntimeException("Failed to create the extension models for the test.", t); } }
Source:
<code>private BiPredicate<PendingCertificationResultTestToolDTO, PendingCertificationResultTestToolDTO> getPredicate() { return new BiPredicate<PendingCertificationResultTestToolDTO, PendingCertificationResultTestToolDTO>() { @Override public boolean test(final PendingCertificationResultTestToolDTO dto1, final PendingCertificationResultTestToolDTO dto2) { <START> if (dto1.getName() != null && dto2.getName() != null <END> && dto1.getVersion() != null && dto2.getVersion() != null) { return dto1.getName().equals(dto2.getName()) && dto1.getVersion().equals(dto2.getVersion()); } else { return false; } } }; }</code><technical_language>a bunch of &&,s right? it's: if (a & b & c & d) return e & f else return false return (a & b & c & d & e & f) of a, b, c, ... clauses have</technical_language>

Target:
private BiPredicate<PendingCertificationResultTestToolDTO, PendingCertificationResultTestToolDTO> getPredicate() { return new BiPredicate<PendingCertificationResultTestToolDTO, PendingCertificationResultTestToolDTO>() { @Override public boolean test(final PendingCertificationResultTestToolDTO dto1, final PendingCertificationResultTestToolDTO dto2) { return ObjectUtils.allNotNull(dto1.getName(), dto2.getName(), dto1.getVersion(), dto2.getVersion()) && dto1.getName().equals(dto2.getName()) && dto1.getVersion().equals(dto2.getVersion()); } }; }
Source:
<code>void apply(RequestBuilder builder, @Nullable Map<String, T> value) throws IOException { if (value == null) { throw Utils.parameterError(method, p, "Query map was null"); } boolean fail = false; String entryKey = null; T entryValue = null; for (Map.Entry<String, T> entry : value.entrySet()) { entryKey = entry.getKey(); if (entryKey == null) { throw Utils.parameterError(method, p, "Query map contained null key."); } entryValue = entry.getValue(); if (entryValue == null) { throw Utils.parameterError( method, p, "Query map contained null value for key '" + entryKey + "'."); } String convertedEntryValue; <START> if (entryValue instanceof List || entryValue.getClass().isArray()) { <END> List<String> list = null; if (entryValue.getClass().isArray()) { throw new UnsupportedOperationException(); } if (entryValue instanceof List) { list = (List<String>) entryValue; } Iterator i = list.iterator(); if (!i.hasNext()) { throw new IllegalArgumentException(); } convertedEntryValue = valueConverter.convert((T) i.next()); if (convertedEntryValue == null) { fail = true; break; } else { builder.addQueryParam(entryKey, convertedEntryValue, encoded); } while (i.hasNext()) { convertedEntryValue = valueConverter.convert((T) i.next()); if (convertedEntryValue == null) { fail = true; break; } else { builder.addQueryParam(entryKey, convertedEntryValue, encoded); } } } else { convertedEntryValue = valueConverter.convert(entryValue); if (convertedEntryValue == null) { fail = true; break; } else { builder.addQueryParam(entryKey, convertedEntryValue, encoded); } } } if (fail) { throw Utils.parameterError( method, p, "Query map value '" + entryValue + "' converted to null by " + valueConverter.getClass().getName() + " for key '" + entryKey + "'."); } }</code><technical_language>multi-value map get method return a List,it a Collection, Iterable is more suitable</technical_language>

Target:
void apply(RequestBuilder builder, @Nullable Map<String, T> value) throws IOException { if (value == null) { throw Utils.parameterError(method, p, "Query map was null"); } boolean fail = false; String entryKey = null; T entryValue = null; for (Map.Entry<String, T> entry : value.entrySet()) { entryKey = entry.getKey(); if (entryKey == null) { throw Utils.parameterError(method, p, "Query map contained null key."); } entryValue = entry.getValue(); if (entryValue == null) { throw Utils.parameterError( method, p, "Query map contained null value for key '" + entryKey + "'."); } String convertedEntryValue; if (entryValue instanceof Iterable) { Iterator i = ((Iterable) entryValue).iterator(); while (i.hasNext()) { Object t = i.next(); if (t == null) { fail = true; break; } else { convertedEntryValue = valueConverter.convert((T) t); builder.addQueryParam(entryKey, convertedEntryValue, encoded); } } } else { convertedEntryValue = valueConverter.convert(entryValue); if (convertedEntryValue == null) { fail = true; break; } else { builder.addQueryParam(entryKey, convertedEntryValue, encoded); } } } if (fail) { throw Utils.parameterError( method, p, "Query map value '" + entryValue + "' converted to null by " + valueConverter.getClass().getName() + " for key '" + entryKey + "'."); } }
Source:
<code>private void deeplyPrint(IStatus status, PrintStream strm, int level) { appendLevelPrefix(strm, level); String msg = status.getMessage(); strm.println(msg); Throwable cause = status.getException(); if (cause != null) { strm.print("Caused by: "); if (stackTrace || !(msg.equals(cause.getMessage()) || msg.equals(cause.toString()))) deeplyPrint(cause, strm, level); } if (status.isMultiStatus()) { IStatus[] children = status.getChildren(); for (IStatus <START> children1 : <END> children) { deeplyPrint(children1, strm, level + 1); } } }</code><technical_language>child</technical_language>

Target:
private void deeplyPrint(IStatus status, PrintStream strm, int level) { appendLevelPrefix(strm, level); String msg = status.getMessage(); strm.println(msg); Throwable cause = status.getException(); if (cause != null) { strm.print("Caused by: "); if (stackTrace || !(msg.equals(cause.getMessage()) || msg.equals(cause.toString()))) deeplyPrint(cause, strm, level); } if (status.isMultiStatus()) { IStatus[] children = status.getChildren(); for (IStatus child : children) { deeplyPrint(child, strm, level + 1); } } }
Source:
<code>public RestRequest makeRequest(int method, String url, java.util.Map<String, String> params, RestRequest.Listener listener, RestRequest.ErrorListener errorListener) { AppLog.v(T.TESTS, this.getClass() + ": makeRequest(" + url + ")"); RestRequest dummyReturnValue = new RestRequest(method, url, params, listener, errorListener); String filename = mPrefix + "-" + url.replace("https://", "").replace("/", "-").replace(".", "-").replace("?", "-") + ".json"; if ("password-invalid".equals(mPrefix) && errorListener != null) { errorListener.onErrorResponse(forgeVolleyErrorFromFilename(filename)); return dummyReturnValue; } if ("username-exists".equals(mPrefix) && errorListener != null) { errorListener.onErrorResponse(forgeVolleyErrorFromFilename(filename)); return dummyReturnValue; } if ("timeout".equals(mPrefix) && errorListener != null) { errorListener.onErrorResponse(forgeVolleyTimeoutError()); return dummyReturnValue; } if ("site-reserved".equals(mPrefix) && errorListener != null) { errorListener.onErrorResponse(forgeVolleyErrorFromFilename(filename)); return dummyReturnValue; } String data = fileToString(filename); if (data == null) { AppLog.e(T.TESTS, "Can't read file: " + filename); if (errorListener != null) { <START> errorListener.onErrorResponse(new VolleyError("Can't read file: " + filename)); <END> } return dummyReturnValue; } try { JSONObject jsonObj = new JSONObject(data); listener.onResponse(jsonObj); } catch (JSONException je) { AppLog.e(T.TESTS, je.toString()); } return dummyReturnValue; }</code><technical_language>onErrorResponse expected call a test. simply raise a RuntimeException here</technical_language>

Target:
public RestRequest makeRequest(int method, String url, java.util.Map<String, String> params, RestRequest.Listener listener, RestRequest.ErrorListener errorListener) { AppLog.v(T.TESTS, this.getClass() + ": makeRequest(" + url + ")"); RestRequest dummyReturnValue = new RestRequest(method, url, params, listener, errorListener); String filename = mPrefix + "-" + url.replace("https://", "").replace("/", "-").replace(".", "-").replace("?", "-") + ".json"; if ("password-invalid".equals(mPrefix) && errorListener != null) { errorListener.onErrorResponse(forgeVolleyErrorFromFilename(filename)); return dummyReturnValue; } if ("username-exists".equals(mPrefix) && errorListener != null) { errorListener.onErrorResponse(forgeVolleyErrorFromFilename(filename)); return dummyReturnValue; } if ("timeout".equals(mPrefix) && errorListener != null) { errorListener.onErrorResponse(forgeVolleyTimeoutError()); return dummyReturnValue; } if ("site-reserved".equals(mPrefix) && errorListener != null) { errorListener.onErrorResponse(forgeVolleyErrorFromFilename(filename)); return dummyReturnValue; } String data = fileToString(filename); if (data == null) { AppLog.e(T.TESTS, "Can't read file: " + filename); throw new RuntimeException("Can't read file: " + filename); } try { JSONObject jsonObj = new JSONObject(data); listener.onResponse(jsonObj); } catch (JSONException je) { AppLog.e(T.TESTS, je.toString()); } return dummyReturnValue; }
Source:
<code>public ExecutionResult execute(Project project) { ProjectPreferenceManager projectPrefManager = new ProjectPreferenceManager(project, RepositoryPlugin.PLUGIN_ID, false); final String prjKey = "repository.project.id"; final String prodKey = "product.date.id"; final String value = projectPrefManager.getValue(prjKey); if (StringUtils.isBlank(value)) { String v = System.getProperty(prodKey, String.valueOf(System.currentTimeMillis())); <START> projectPrefManager.setValue(prjKey, <END> StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.MIGRATION_TOKEN).encrypt(v)); projectPrefManager.save(); return ExecutionResult.SUCCESS_NO_ALERT; } return ExecutionResult.NOTHING_TO_DO; }</code><technical_language>this StudioEncryption, other migration classes crypto migration util</technical_language>

Target:
public ExecutionResult execute(Project project) { ProjectPreferenceManager projectPrefManager = new ProjectPreferenceManager(project, RepositoryPlugin.PLUGIN_ID, false); final String prjKey = "repository.project.id"; final String prodKey = "product.date.id"; final String value = projectPrefManager.getValue(prjKey); if (StringUtils.isBlank(value)) { String v = System.getProperty(prodKey, String.valueOf(System.currentTimeMillis())); projectPrefManager.setValue(prjKey, CryptoMigrationUtil.encrypt(v)); projectPrefManager.save(); return ExecutionResult.SUCCESS_NO_ALERT; } return ExecutionResult.NOTHING_TO_DO; }
Source:
<code>private void parseOtherAlg(final OtherAlgorithm other) throws TypeImportException, XMLStreamException { String language = getAttributeValue(LibraryElementTags.LANGUAGE_ATTRIBUTE); if <START> (language != null) { <END> other.setLanguage(language); } else { throw new TypeImportException(Messages.FBTImporter_OTHER_ALG_MISSING_LANG_EXCEPTION); } String text = getAttributeValue(LibraryElementTags.TEXT_ATTRIBUTE); if (text != null) { other.setText(text); } else { throw new TypeImportException(Messages.FBTImporter_OTHER_ALG_MISSING_TEXT_EXCEPTION); } proceedToEndElementNamed(LibraryElementTags.OTHER_ELEMENT); }</code><technical_language>order of operands</technical_language>

Target:
private void parseOtherAlg(final OtherAlgorithm other) throws TypeImportException, XMLStreamException { String language = getAttributeValue(LibraryElementTags.LANGUAGE_ATTRIBUTE); if (null != language) { other.setLanguage(language); } else { throw new TypeImportException(Messages.FBTImporter_OTHER_ALG_MISSING_LANG_EXCEPTION); } String text = getAttributeValue(LibraryElementTags.TEXT_ATTRIBUTE); if (null != text) { other.setText(text); } else { throw new TypeImportException(Messages.FBTImporter_OTHER_ALG_MISSING_TEXT_EXCEPTION); } proceedToEndElementNamed(LibraryElementTags.OTHER_ELEMENT); }
Source:
<code>public boolean isStop() { if (this.scannerParam.getMaxScanDurationInMins() > 0) { if (System.currentTimeMillis() - this.hostProcessStartTime > TimeUnit.MINUTES.toMillis(this.scannerParam.getMaxScanDurationInMins())) { <START> return true; <END> } } return (isStop || parentScanner.isStop()); }</code><technical_language>set reason a variable stopReason(?) in isSkipped(Plugin) instead of checking if limit reached. explicitly stop scan, checks reordered (i.e. check isStop || parentScanner.isStop())</technical_language>

Target:
public boolean isStop() { if (this.scannerParam.getMaxScanDurationInMins() > 0) { if (System.currentTimeMillis() - this.hostProcessStartTime > TimeUnit.MINUTES.toMillis(this.scannerParam.getMaxScanDurationInMins())) { this.stopReason = Constant.messages.getString("ascan.progress.label.skipped.reason.maxScan"); this.stop(); } } return (isStop || parentScanner.isStop()); }
Source:
<code>private void setTripDetails(ObaTripDetailsResponse data) { mTripInfo = data; final int code = mTripInfo.getCode(); if (code == ObaApi.OBA_OK) { setEmptyText(""); } else { setEmptyText(UIHelp.getRouteErrorString(getActivity(), code)); return; } setUpHeader(); mAdapter = new TripDetailsAdapter(); setListAdapater(mAdapter); if (mStopId != null) { final int stopIndex = findIndexForStop(mTripInfo.getSchedule().getStopTimes(), mStopId); if (stopIndex != -1) { final ListView listView = getListView(); listView.post(new Runnable() { @Override public void run() { <START> listView.smoothScrollToPosition(stopIndex); <END> } }); } } }</code><technical_language>smooth scroll strange - change setting position ListView snaps position scrolling. IIRC, listview.setSelection() is method this</technical_language>

Target:
private void setTripDetails(ObaTripDetailsResponse data) { mTripInfo = data; final int code = mTripInfo.getCode(); if (code == ObaApi.OBA_OK) { setEmptyText(""); } else { setEmptyText(UIHelp.getRouteErrorString(getActivity(), code)); return; } setUpHeader(); final ListView listView = getListView(); if (mAdapter == null) { mAdapter = new TripDetailsAdapter(); setListAdapater(mAdapter); if (mStopId != null) { final int stopIndex = findIndexForStop(mTripInfo.getSchedule().getStopTimes(), mStopId); if (stopIndex != -1) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(stopIndex); } }); } } } else { int index = listView.getFirstVisiblePosition(); View v = listView.getChildAt(0); int top = (v == null) ? 0 : v.getTop(); mAdapter.notifyDataSetChanged(); listView.setSelectionFromTop(index, top); } }
Source:
<code>public void null_key_should_throw_NPE() { underTest = new AnalysisPropertyDto(); <START> expectedException.expect(NullPointerException.class); <END> underTest.setKey(null); }</code><technical_language>message tested</technical_language>

Target:
public void null_key_should_throw_NPE() { underTest = new AnalysisPropertyDto(); expectedException.expect(NullPointerException.class); expectedException.expectMessage("key cannot be null"); underTest.setKey(null); }
Source:
<code>public DiskQuotaConfig loadConfig() throws IOException, ConfigurationException { DiskQuotaConfig quotaConfig; <START> InputStream configIn; <END> if (resourceProvider.hasInput()) { try{ configIn = resourceProvider.in(); } catch (IOException e) { configIn = null; } } else { configIn = null; } if (configIn != null) { log.info("Quota config is: " + resourceProvider.getLocation()); try { quotaConfig = loadConfiguration(configIn); if (null == quotaConfig) { throw new ConfigurationException("Couldn't parse configuration file " + resourceProvider.getLocation()); } } catch (RuntimeException e) { log.error( "Error loading DiskQuota configuration from " + resourceProvider.getLocation() + ": " + e.getMessage() + ". Deferring to a default (disabled) configuration", e); quotaConfig = new DiskQuotaConfig(); } finally { configIn.close(); } } else { log.info("DiskQuota configuration could not be read: " + resourceProvider.getLocation()); quotaConfig = new DiskQuotaConfig(); } quotaConfig.setDefaults(); validateConfig(quotaConfig); return quotaConfig; }</code><technical_language>try-with-resources variables implicitly final so, if here, consider refactoring finding config location a helper method</technical_language>

Target:
public DiskQuotaConfig loadConfig() throws IOException, ConfigurationException { DiskQuotaConfig quotaConfig = null; if (resourceProvider.hasInput()) { log.info("Quota config is: " + resourceProvider.getLocation()); try (InputStream configIn = resourceProvider.in()) { quotaConfig = loadConfiguration(configIn); if (null == quotaConfig) { throw new ConfigurationException("Couldn't parse configuration file " + resourceProvider.getLocation()); } } catch (IOException | RuntimeException e) { log.error( "Error loading DiskQuota configuration from " + resourceProvider.getLocation() + ": " + e.getMessage() + ". Deferring to a default (disabled) configuration", e); } } else { log.info("DiskQuota configuration is not readable: " + resourceProvider.getLocation()); } if (quotaConfig == null) { quotaConfig = new DiskQuotaConfig(); } quotaConfig.setDefaults(); validateConfig(quotaConfig); return quotaConfig; }
Source:
<code>public void handle(SyncGroupResponse syncResponse, RequestFuture<ByteBuffer> future) { Errors error = syncResponse.error(); if (error == Errors.NONE) { sensors.syncLatency.record(response.requestLatencyMs()); future.complete(ByteBuffer.wrap(syncResponse.data.assignment())); } else { requestRejoin(); if (error == Errors.GROUP_AUTHORIZATION_FAILED) { future.raise(new GroupAuthorizationException(rebalanceConfig.groupId)); } else if (error == Errors.REBALANCE_IN_PROGRESS) { log.debug("SyncGroup failed because the group began another rebalance"); future.raise(error); } else if (error == Errors.FENCED_INSTANCE_ID) { log.error("Received fatal exception: group.instance.id gets fenced"); future.raise(error); } else if (error == Errors.UNKNOWN_MEMBER_ID || error == Errors.ILLEGAL_GENERATION) { log.debug("SyncGroup failed: {}", error.message()); <START> resetGeneration(this.getClass().getName() + " encountering " + error); <END> future.raise(error); } else if (error == Errors.COORDINATOR_NOT_AVAILABLE || error == Errors.NOT_COORDINATOR) { log.debug("SyncGroup failed: {}", error.message()); markCoordinatorUnknown(); future.raise(error); } else { future.raise(new KafkaException("Unexpected error from SyncGroup: " + error.message())); } } }</code><technical_language>necessary pass in class name, log4j able reveal it. Also, double logging here, conflicting L525 L645. Consider removing some of loggings</technical_language>

Target:
public void handle(SyncGroupResponse syncResponse, RequestFuture<ByteBuffer> future) { Errors error = syncResponse.error(); if (error == Errors.NONE) { sensors.syncLatency.record(response.requestLatencyMs()); future.complete(ByteBuffer.wrap(syncResponse.data.assignment())); } else { requestRejoin(); if (error == Errors.GROUP_AUTHORIZATION_FAILED) { future.raise(GroupAuthorizationException.forGroupId(rebalanceConfig.groupId)); } else if (error == Errors.REBALANCE_IN_PROGRESS) { log.debug("SyncGroup failed because the group began another rebalance"); future.raise(error); } else if (error == Errors.FENCED_INSTANCE_ID) { log.error("Received fatal exception: group.instance.id gets fenced"); future.raise(error); } else if (error == Errors.UNKNOWN_MEMBER_ID || error == Errors.ILLEGAL_GENERATION) { log.debug("SyncGroup failed: {}", error.message()); resetGeneration(); future.raise(error); } else if (error == Errors.COORDINATOR_NOT_AVAILABLE || error == Errors.NOT_COORDINATOR) { log.debug("SyncGroup failed: {}", error.message()); markCoordinatorUnknown(); future.raise(error); } else { future.raise(new KafkaException("Unexpected error from SyncGroup: " + error.message())); } } }
Source:
<code>protected void initSelectedType() { final VmInterfaceType defaultNicType = getDeafultNicTypeByProfile(); final Collection<VmInterfaceType> vnicTypes = supportedVnicTypes == null ? new ArrayList<VmInterfaceType>() : supportedVnicTypes; <START> if (getNicType().getItems() != vnicTypes) { <END> getNicType().setItems(vnicTypes, defaultNicType); } else { getNicType().setSelectedItem(defaultNicType); } }</code><technical_language>getNicType().getItems() != null</technical_language>

Target:
protected void initSelectedType() { final VmInterfaceType defaultNicType = getDeafultNicTypeByProfile(); final Collection<VmInterfaceType> vnicTypes = supportedVnicTypes == null ? new ArrayList<VmInterfaceType>() : supportedVnicTypes; if (getNicType().getItems() == null) { getNicType().setItems(vnicTypes, defaultNicType); } else { getNicType().setSelectedItem(defaultNicType); } }
Source:
<code>public void testDynamicImportSpecifier() { testTypes( "var foo = undefined; import(foo);", <START> "dynamic import specifier\n" <END> + "found : undefined\n" + "required: string"); }</code><technical_language>please lines() instead of string concatenation</technical_language>

Target:
public void testDynamicImportSpecifier() { testTypes( "var foo = undefined; import(foo);", lines("dynamic import specifier", "found : undefined", "required: string")); }
Source:
<code>public void copyNodeWithEmptyMultiValueProperty() throws Exception { <START> String configuration = <END> "{\"indexProviders\": {\n" + " \"local\": {\n" + " \"classname\": \"org.modeshape.jcr.index.local.LocalIndexProvider\",\n" + " \"directory\": \"target/1234/indexes\"\n" + " }\n" + " },\n" + " \"indexes\": {\n" + " \"nodeTypes\": {\n" + " \"kind\": \"nodeType\",\n" + " \"provider\": \"local\",\n" + " \"synchronous\": \"true\",\n" + " \"nodeType\": \"nt:base\",\n" + " \"columns\": \"jcr:primaryType(STRING)\"\n" + " }}}"; startRepositoryWithConfiguration(configuration); session.getRootNode().addNode("a"); Node node = session.getNode("/a"); node.addMixin("mix:referenceable"); session.save(); node.removeMixin("mix:referenceable"); session.save(); assertTrue(node.hasProperty("jcr:mixinTypes")); assertThat(node.getProperty("jcr:mixinTypes").getValues().length, is(0)); session.getWorkspace().copy(session.getNode("/a").getPath(), "/a2"); session.save(); }</code><technical_language>this extracted in a separate JSON configuration file</technical_language>

Target:
public void copyNodeWithEmptyMultiValueProperty() throws Exception { startRepositoryWithConfigurationFrom("config/repo-config-local-provider-and-nodetype-index.json"); session.getRootNode().addNode("a"); Node node = session.getNode("/a"); node.addMixin("mix:referenceable"); session.save(); node.removeMixin("mix:referenceable"); session.save(); assertTrue(node.hasProperty("jcr:mixinTypes")); assertThat(node.getProperty("jcr:mixinTypes").getValues().length, is(0)); session.getWorkspace().copy(session.getNode("/a").getPath(), "/a2"); session.save(); }
Source:
<code>public String promptForExternalConfiguration() { SystemAccess.Console console = system.console(); console.format("WARNING: Please ensure that you have made backups of the directory [%s] before proceeding.\n", niogitDir); Collection<String> validResponses = Arrays.asList("yes", "no"); String response; do { response = console.readLine("Do you want provide a path to an external Pom migration json with dependencies and repositories ? [yes/no]: ").toLowerCase(); } while (!validResponses.contains(response)); if("yes".equals(response)){ do { <START> response = console.readLine("Please insert the path to folder containing the pom-migration.json file : ").trim(); <END> } while (!response.equals("") && !jsonExists(response)); return response + "/" + JSON_POM_FILE; }else{ return ""; } }</code><technical_language>Please insert -> Please provide; this more robust: File.separator Windows aware</technical_language>

Target:
public String promptForExternalConfiguration() { SystemAccess.Console console = system.console(); Collection<String> validResponses = Arrays.asList("yes", "no"); String response; do { response = console.readLine("Do you want provide a path to an external Pom migration json with dependencies and repositories ? [yes/no]: ").toLowerCase(); } while (!validResponses.contains(response)); if ("yes".equals(response)) { boolean valid = false; response = console.readLine("Please provide the path to folder containing the pom-migration.json file : ").trim(); do { if (!jsonExists(response)) { response = console.readLine("The file pom-migration.json doesn't exist in the directory you provided. Please try again :").trim(); } else { valid = true; } } while (response != null && !valid); return response + File.separator + JSON_POM_FILE; } else { return ""; } }
Source:
<code><START> private static StringBuilder getStringBuilder() { <END> StringBuilder sb = TL_STRING_BUILDER.get(); sb.setLength(0); return sb; }</code><technical_language>Super nit-picky if code calling this package sublass a breaking change. a big deal all</technical_language>

Target:
protected static StringBuilder getStringBuilder() { StringBuilder sb = TL_STRING_BUILDER.get(); sb.setLength(0); return sb; }
Source:
<code>private SlotManagerBuilder() { this.slotMatchingStrategy = AnyMatchingSlotMatchingStrategy.INSTANCE; this.scheduledExecutor = TestingUtils.defaultScheduledExecutor(); this.taskManagerRequestTimeout = TestingUtils.infiniteTime(); this.slotRequestTimeout = TestingUtils.infiniteTime(); this.taskManagerTimeout = TestingUtils.infiniteTime(); <START> this.maxSlotNum = Integer.MAX_VALUE; <END> this.waitResultConsumedBeforeRelease = true; }</code><technical_language>nit: MAX_SLOT_NUM.defaultValue()</technical_language>

Target:
private SlotManagerBuilder() { this.slotMatchingStrategy = AnyMatchingSlotMatchingStrategy.INSTANCE; this.scheduledExecutor = TestingUtils.defaultScheduledExecutor(); this.taskManagerRequestTimeout = TestingUtils.infiniteTime(); this.slotRequestTimeout = TestingUtils.infiniteTime(); this.taskManagerTimeout = TestingUtils.infiniteTime(); this.waitResultConsumedBeforeRelease = true; this.defaultWorkerResourceSpec = WorkerResourceSpec.ZERO; this.numSlotsPerWorker = 1; this.slotManagerMetricGroup = UnregisteredMetricGroups.createUnregisteredSlotManagerMetricGroup(); this.maxSlotNum = ResourceManagerOptions.MAX_SLOT_NUM.defaultValue(); }
Source:
<code>public void bindFieldPrimitiveValues() throws SQLException { int index = ThreadLocalRandom.current().nextInt(); verifyBindField(++index, Schema.INT8_SCHEMA, (byte) 42).setByte(index, (byte) 42); verifyBindField(++index, Schema.INT16_SCHEMA, (short) 42).setShort(index, (short) 42); verifyBindField(++index, Schema.INT32_SCHEMA, 42).setInt(index, 42); verifyBindField(++index, Schema.INT64_SCHEMA, 42L).setLong(index, 42L); verifyBindField(++index, Schema.BOOLEAN_SCHEMA, false).setBoolean(index, false); verifyBindField(++index, Schema.BOOLEAN_SCHEMA, true).setBoolean(index, true); verifyBindField(++index, Schema.FLOAT32_SCHEMA, -42f).setFloat(index, -42f); verifyBindField(++index, Schema.FLOAT64_SCHEMA, 42d).setDouble(index, 42d); verifyBindField(++index, Schema.BYTES_SCHEMA, new byte[]{42}).setBytes(index, new byte[]{42}); verifyBindField(++index, Schema.BYTES_SCHEMA, ByteBuffer.wrap(new byte[]{42})).setBytes(index, new byte[]{42}); <START> verifyBindField(++index, Schema.STRING_SCHEMA, "yep").setString(index, "yep"); <END> }</code><technical_language>missing verifyBindField() calls fordecimal, date, time, timestamp</technical_language>

Target:
public void bindFieldPrimitiveValues() throws SQLException { int index = ThreadLocalRandom.current().nextInt(); verifyBindField(++index, Schema.INT8_SCHEMA, (byte) 42).setByte(index, (byte) 42); verifyBindField(++index, Schema.INT16_SCHEMA, (short) 42).setShort(index, (short) 42); verifyBindField(++index, Schema.INT32_SCHEMA, 42).setInt(index, 42); verifyBindField(++index, Schema.INT64_SCHEMA, 42L).setLong(index, 42L); verifyBindField(++index, Schema.BOOLEAN_SCHEMA, false).setBoolean(index, false); verifyBindField(++index, Schema.BOOLEAN_SCHEMA, true).setBoolean(index, true); verifyBindField(++index, Schema.FLOAT32_SCHEMA, -42f).setFloat(index, -42f); verifyBindField(++index, Schema.FLOAT64_SCHEMA, 42d).setDouble(index, 42d); verifyBindField(++index, Schema.BYTES_SCHEMA, new byte[]{42}).setBytes(index, new byte[]{42}); verifyBindField(++index, Schema.BYTES_SCHEMA, ByteBuffer.wrap(new byte[]{42})).setBytes(index, new byte[]{42}); verifyBindField(++index, Schema.STRING_SCHEMA, "yep").setString(index, "yep"); verifyBindField(++index, Decimal.schema(0), new BigDecimal("1.5").setScale(0, BigDecimal.ROUND_HALF_EVEN)).setBytes(index, new byte[]{2}); verifyBindField(++index, Date.SCHEMA, new java.util.Date(0)).setInt(index, 0); verifyBindField(++index, Time.SCHEMA, new java.util.Date(1000)).setInt(index, 1000); verifyBindField(++index, Timestamp.SCHEMA, new java.util.Date(100)).setLong(index, 100); }
Source:
<code>private static Iterable<IMarkerEvent> getMarkers(TimeGraphControl timeGraphControl, ITimeGraphEntry entry, Point pt) { List<IMarkerEvent> markers = timeGraphControl.getMarkers(); List<IMarkerEvent> retVal = new ArrayList<>(); if (markers != null) { <START> int height = Math.max(timeGraphControl.getItemHeight(), 10) / 2; <END> long fuzzStart = timeGraphControl.getTimeAtX(pt.x - height); long fuzzEnd = timeGraphControl.getTimeAtX(pt.x + height); for (IMarkerEvent marker : markers) { if (Objects.equals(marker.getEntry(), entry)) { long duration = marker.getDuration(); long startTime = marker.getTime(); long endTime = startTime + duration; if ((startTime < fuzzEnd) && (endTime > fuzzStart)) { retVal.add(marker); } } } } return retVal; }</code><technical_language>height, fuzz - If want 5, 5 of 10... - This work expected getItemHeight() is a default, entry height, getItemHeight() is affected vertical zoom level. If want real item height get getItemBounds().height, if 5 time of item height</technical_language>

Target:
private static Iterable<IMarkerEvent> getMarkers(TimeGraphControl timeGraphControl, ITimeGraphEntry entry, Point pt) { List<IMarkerEvent> markers = timeGraphControl.getMarkers(); List<IMarkerEvent> retVal = new ArrayList<>(); if (markers != null) { int fuzz = 5; long fuzzStart = timeGraphControl.getTimeAtX(pt.x - fuzz); long fuzzEnd = timeGraphControl.getTimeAtX(pt.x + fuzz); for (IMarkerEvent marker : markers) { if (Objects.equals(marker.getEntry(), entry)) { long duration = marker.getDuration(); long startTime = marker.getTime(); long endTime = startTime + duration; if ((startTime < fuzzEnd) && (endTime > fuzzStart)) { retVal.add(marker); } } } } return retVal; }
Source:
<code><START> protected void completeInitiatingFuture(boolean deploy, IgniteUuid reqSrvcId, Throwable err) { <END> GridFutureAdapter<?> fut = deploy ? depFuts.remove(reqSrvcId) : undepFuts.remove(reqSrvcId); if (fut == null) return; if (err != null) { fut.onDone(err); if (deploy) { U.warn(log, "Failed to deploy service, cfg=" + ((GridServiceDeploymentFuture)fut).configuration(), err); } else U.warn(log, "Failed to undeploy service, srvcId=" + reqSrvcId, err); } else fut.onDone(); }</code><technical_language>protected? I a lot of protected in patch, needs 3rd party code (or test) is supposed extend classes. please review protected usages replace private/package-private possible</technical_language>

Target:
void completeInitiatingFuture(boolean deploy, IgniteUuid reqSrvcId, Throwable err) { GridFutureAdapter<?> fut = deploy ? depFuts.remove(reqSrvcId) : undepFuts.remove(reqSrvcId); if (fut == null) return; if (err != null) { fut.onDone(err); if (deploy) { U.warn(log, "Failed to deploy service, cfg=" + ((GridServiceDeploymentFuture)fut).configuration(), err); } else U.warn(log, "Failed to undeploy service, srvcId=" + reqSrvcId, err); } else fut.onDone(); }
Source:
<code>public boolean isSameType(IType type) { if (type == this) return true; if (type instanceof ITypedef) return type.isSameType(this); ICPPClassTemplate classTemplate = getClassTemplate(); if (type instanceof ICPPDeferredClassInstance) { final ICPPDeferredClassInstance rhs = (ICPPDeferredClassInstance) type; if (!classTemplate.isSameType((IType) rhs.getSpecializedBinding())) return false; return CPPTemplates.haveSameArguments(this, rhs); <START> } else if (type instanceof PDOMCPPClassTemplate) { <END> return classTemplate == type; } return false; }</code><technical_language>This condition means deferred instances of template represent type. This right. Changes in isSameType methods tested separately content assist tests</technical_language>

Target:
public boolean isSameType(IType type) { if (type == this) return true; if (type instanceof ITypedef) return type.isSameType(this); ICPPClassTemplate classTemplate = getClassTemplate(); if (type instanceof ICPPDeferredClassInstance) { final ICPPDeferredClassInstance rhs = (ICPPDeferredClassInstance) type; if (!classTemplate.isSameType((IType) rhs.getSpecializedBinding())) return false; return CPPTemplates.haveSameArguments(this, rhs); } return false; }
Source:
<code><START> public Marshaller getMarshaller() throws JAXBException { <END> if (marshaller == null) { marshaller = JAXBContext.newInstance(ServiceDefinitionsWrapper.class).createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); } return marshaller; }</code><technical_language>this public? synchronized</technical_language>

Target:
private synchronized Marshaller getMarshaller() throws JAXBException { if (marshaller == null) { marshaller = JAXBContext.newInstance(ServiceDefinitionsWrapper.class).createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); } return marshaller; }
Source:
<code>public StaticFunctionHandle lookupFunction(QualifiedName name, List<TypeSignatureProvider> parameterTypes) <START> { <END> Collection<SqlFunction> allCandidates = functions.get(name); List<SqlFunction> exactCandidates = allCandidates.stream() .filter(function -> function.getSignature().getTypeVariableConstraints().isEmpty()) .collect(Collectors.toList()); Optional<Signature> match = matchFunctionExact(exactCandidates, parameterTypes); if (match.isPresent()) { return new StaticFunctionHandle(match.get()); } List<SqlFunction> genericCandidates = allCandidates.stream() .filter(function -> !function.getSignature().getTypeVariableConstraints().isEmpty()) .collect(Collectors.toList()); match = matchFunctionExact(genericCandidates, parameterTypes); if (match.isPresent()) { return new StaticFunctionHandle(match.get()); } throw new PrestoException(FUNCTION_NOT_FOUND, constructFunctionNotFoundErrorMessage(name, parameterTypes, allCandidates)); }</code><technical_language>reason above. FunctionHandle cleaner</technical_language>

Target:
public FunctionHandle lookupFunction(QualifiedName name, List<TypeSignatureProvider> parameterTypes) { Collection<SqlFunction> allCandidates = functions.get(name); List<SqlFunction> exactCandidates = allCandidates.stream() .filter(function -> function.getSignature().getTypeVariableConstraints().isEmpty()) .collect(Collectors.toList()); Optional<Signature> match = matchFunctionExact(exactCandidates, parameterTypes); if (match.isPresent()) { return new StaticFunctionHandle(match.get()); } List<SqlFunction> genericCandidates = allCandidates.stream() .filter(function -> !function.getSignature().getTypeVariableConstraints().isEmpty()) .collect(Collectors.toList()); match = matchFunctionExact(genericCandidates, parameterTypes); if (match.isPresent()) { return new StaticFunctionHandle(match.get()); } throw new PrestoException(FUNCTION_NOT_FOUND, constructFunctionNotFoundErrorMessage(name, parameterTypes, allCandidates)); }
Source:
<code>public void testCycleGeneration() throws ParseException, IOException { final ClassLoader cl = Thread.currentThread().getContextClassLoader(); Idl idl = new Idl(cl.getResourceAsStream("input/cycle.avdl"), "UTF-8"); Protocol protocol = idl.CompilationUnit(); String json = protocol.toString(); <START> System.out.println(json); <END> SpecificCompiler compiler = new SpecificCompiler(protocol); compiler.setStringType(GenericData.StringType.String); File output = new File("./target"); compiler.compileToDestination(null, output); Map<String, Schema> schemas = new HashMap<String, Schema>(); for (Schema schema : protocol.getTypes()) { final String name = schema.getName(); schemas.put(name, schema); } GenericRecordBuilder rb2 = new GenericRecordBuilder(schemas.get("SampleNode")); rb2.set("count", 10); rb2.set("subNodes", Collections.EMPTY_LIST); GenericData.Record node = rb2.build(); GenericRecordBuilder mb = new GenericRecordBuilder(schemas.get("Method")); mb.set("declaringClass", "Test"); mb.set("methodName", "test"); GenericData.Record method = mb.build(); GenericRecordBuilder spb = new GenericRecordBuilder(schemas.get("SamplePair")); spb.set("method", method); spb.set("node", node); GenericData.Record sp = spb.build(); GenericRecordBuilder rb = new GenericRecordBuilder(schemas.get("SampleNode")); rb.set("count", 10); rb.set("subNodes", Arrays.asList(sp)); GenericData.Record record = rb.build(); serDeserRecord(record); }</code><technical_language>Nit: replace stderr/stdout calls a logger</technical_language>

Target:
public void testCycleGeneration() throws ParseException, IOException { final ClassLoader cl = Thread.currentThread().getContextClassLoader(); Idl idl = new Idl(cl.getResourceAsStream("input/cycle.avdl"), "UTF-8"); Protocol protocol = idl.CompilationUnit(); String json = protocol.toString(); LOG.info(json); SpecificCompiler compiler = new SpecificCompiler(protocol); compiler.setStringType(GenericData.StringType.String); File output = new File("./target"); compiler.compileToDestination(null, output); Map<String, Schema> schemas = new HashMap<String, Schema>(); for (Schema schema : protocol.getTypes()) { final String name = schema.getName(); schemas.put(name, schema); } GenericRecordBuilder rb2 = new GenericRecordBuilder(schemas.get("SampleNode")); rb2.set("count", 10); rb2.set("subNodes", Collections.EMPTY_LIST); GenericData.Record node = rb2.build(); GenericRecordBuilder mb = new GenericRecordBuilder(schemas.get("Method")); mb.set("declaringClass", "Test"); mb.set("methodName", "test"); GenericData.Record method = mb.build(); GenericRecordBuilder spb = new GenericRecordBuilder(schemas.get("SamplePair")); spb.set("method", method); spb.set("node", node); GenericData.Record sp = spb.build(); GenericRecordBuilder rb = new GenericRecordBuilder(schemas.get("SampleNode")); rb.set("count", 10); rb.set("subNodes", Arrays.asList(sp)); GenericData.Record record = rb.build(); serDeserRecord(record); }
Source:
<code>public boolean isPasswordSameAsUserName(final String username) throws MiddlewareQueryException { try { if (username != null) { final Criteria criteria = this.getSession().createCriteria(User.class).add(Restrictions.eq("name", username)) .add(Restrictions.eq("password", username)); @SuppressWarnings("unchecked") final List<User> users = criteria.list(); return !users.isEmpty() ? true : false; } <START> } catch (final HibernateException e) { <END> this.logAndThrowException("Error with getByUsernameAndPassword(username=" + username + ") query from User: " + e.getMessage(), e); } return false; }</code><technical_language>@vmaletta @cuenyad please log throw exception, this method? (I before). means logs cleaner - Exception is occurring is handled. I want get rid of logAndThrowException method eventually</technical_language>

Target:
public boolean isPasswordSameAsUserName(final String username) throws MiddlewareQueryException { try { if (username != null) { final Criteria criteria = this.getSession().createCriteria(User.class).add(Restrictions.eq("name", username)) .add(Restrictions.eq("password", username)); @SuppressWarnings("unchecked") final List<User> users = criteria.list(); return !users.isEmpty() ? true : false; } } catch (final HibernateException e) { final String message = "Error with getByUsernameAndPassword(username=" + username + ") query from User: " + e.getMessage(); UserDAO.LOG.error(message, e); throw new MiddlewareQueryException(message, e); } return false; }
Source:
<code>public String toString() { if (string == null) { String lineSeparator = System.lineSeparator(); StringBuilder <START> buffer = <END> new StringBuilder(); buffer.append("Command("); buffer.append(id); buffer.append(','); buffer.append(name == null ? "" : name); buffer.append(','); buffer.append(lineSeparator); buffer.append("\t\t"); buffer.append(description == null ? "" : description); buffer.append(','); buffer.append(lineSeparator); buffer.append("\t\t"); buffer.append(category == null ? "" : category.toString()); buffer.append(','); buffer.append(lineSeparator); buffer.append("\t\t"); buffer.append(handler == null ? "" : handler.toString()); buffer.append(','); buffer.append(lineSeparator); buffer.append("\t\t"); buffer.append(parameters == null ? "" : Arrays.toString(parameters)); buffer.append(','); buffer.append(returnType == null ? "" : returnType.toString()); buffer.append(','); buffer.append("" + defined); buffer.append(')'); string = buffer.toString(); } return string; }</code><technical_language>rename "builder"</technical_language>

Target:
public String toString() { if (string == null) { String lineSeparator = System.lineSeparator(); StringBuilder builder = new StringBuilder(); builder.append("Command("); builder.append(id); builder.append(','); builder.append(name == null ? "" : name); builder.append(','); builder.append(lineSeparator); builder.append("\t\t"); builder.append(description == null ? "" : description); builder.append(','); builder.append(lineSeparator); builder.append("\t\t"); builder.append(category == null ? "" : category.toString()); builder.append(','); builder.append(lineSeparator); builder.append("\t\t"); builder.append(handler == null ? "" : handler.toString()); builder.append(','); builder.append(lineSeparator); builder.append("\t\t"); builder.append(parameters == null ? "" : Arrays.toString(parameters)); builder.append(','); builder.append(returnType == null ? "" : returnType.toString()); builder.append(','); builder.append("" + defined); builder.append(')'); string = builder.toString(); } return string; }
Source:
<code>protected void selectAndReveal(ISelection selection) { <START> List<IPackageFragmentRoot> roots = new ArrayList<IPackageFragmentRoot>(); <END> for (Object element : ((IStructuredSelection) selection).toList()) { if (element instanceof IPackageFragmentRoot) { roots.add((IPackageFragmentRoot) element); } } fProvider.handleFolderCreation(roots); super.selectAndReveal(selection); }</code><technical_language>Remove redundant type information</technical_language>

Target:
protected void selectAndReveal(ISelection selection) { List<IPackageFragmentRoot> roots = new ArrayList<>(); for (Object element : ((IStructuredSelection) selection).toList()) { if (element instanceof IPackageFragmentRoot) { roots.add((IPackageFragmentRoot) element); } } fProvider.handleFolderCreation(roots); super.selectAndReveal(selection); }