auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static Properties resolvePropertiesFile(String fileNamePath) { Properties properties = new Properties(); try { logger.debug("Loading properties from file " + fileNamePath); <START> FileInputStream stream = new FileInputStream(fileNamePath); <END> properties.load(stream); } catch (Exception e) { logger.warn("Properties file not found : '" + fileNamePath + "'", e); } return properties; }</code><technical_language>put FileInputStream stream = new FileInputStream(fileNamePath); try is AutoClosable, I guess.</technical_language>

Target:
public static Properties resolvePropertiesFile(String fileNamePath) { Properties properties = new Properties(); logger.debug("Loading properties from file " + fileNamePath); try (FileInputStream stream = new FileInputStream(fileNamePath)) { properties.load(stream); } catch (Exception e) { logger.warn("Properties file not found : '" + fileNamePath + "'", e); } return properties; }
Source:
<code>public static CellProcessor getLongCellProcessor(Boolean required, Long equals, Long minValue, Long maxValue) { CellProcessor cellProcessor = null; if (equals != null) { cellProcessor = addEquals(cellProcessor, equals); } else if (minValue != null || maxValue != null) { cellProcessor = addLongMinMax(minValue, maxValue); } else { cellProcessor = addParseLong(null); <START> } <END> if (required == null || !required) { cellProcessor = addOptional(cellProcessor); } return cellProcessor; }</code><technical_language>getStringCellProcessor follow if else pattern.. do need cellProcessor = addParseLong(null); cellProcessor initialized new ParseLong()</technical_language>

Target:
public static CellProcessor getLongCellProcessor(Boolean required, Long equals, Long minValue, Long maxValue) { CellProcessor cellProcessor = null; if (equals != null) { cellProcessor = addEquals(cellProcessor, equals); cellProcessor = addParseLong(cellProcessor); } else if (minValue != null || maxValue != null) { cellProcessor = addLongMinMax(minValue, maxValue); } if (required == null || !required) { cellProcessor = addOptional(cellProcessor); } return cellProcessor; }
Source:
<code>public void setUpCallToAction(String callToActionText) { if (callToActionText == null) { callToActionContainer.setVisibility(GONE); } else { callToActionContainer.setVisibility(VISIBLE); <START> callToActionTextView.setText(callToActionText); <END> } }</code><technical_language>I logic is necessary. default visibility GONE</technical_language>

Target:
public void setUpCallToAction(String callToActionText) { if (callToActionText != null) { callToActionContainer.setVisibility(VISIBLE); callToActionTextView.setText(callToActionText); } else { callToActionContainer.setVisibility(GONE); } }
Source:
<code>private GlobalMetricRegistriesAdapter() { <START> DefaultMetricsSystem.initialize("HBase"); <END> JvmMetrics.initSingleton("HBase", ""); }</code><technical_language>s/HBase/Phoenix/</technical_language>

Target:
private GlobalMetricRegistriesAdapter() { DefaultMetricsSystem.initialize("Phoenix"); JvmMetrics.initSingleton("Phoenix", ""); }
Source:
<code>private void downloadUploads(final int page) { if (handler == null) { MainActivity.error("downloadUploads handler is null"); } <START> if (!busy) { <END> final int pageStart = page * ROW_COUNT; final String downloadUrl = MainActivity.UPLOADS_STATS_URL + "?pagestart=" + pageStart + "&pageend=" + (pageStart + ROW_COUNT); final ApiDownloader task = new ApiDownloader(getActivity(), ListFragment.lameStatic.dbHelper, null, downloadUrl, false, true, true, ApiDownloader.REQUEST_GET, new ApiListener() { @Override public void requestComplete(final JSONObject json, final boolean isCache) { if (!isCache) { handleUploads(json, handler); } busy = false; } }); try { task.startDownload(this); } catch (WiGLEAuthException waex) { MainActivity.info("Transactions Download Failed due to failed auth"); } } else { MainActivity.error("preventing download because previous is still in progress."); } }</code><technical_language>busy is set true</technical_language>

Target:
private void downloadUploads(final int page) { if (handler == null) { MainActivity.error("downloadUploads handler is null"); } if (!busy.get()) { final int pageStart = page * ROW_COUNT; final String downloadUrl = MainActivity.UPLOADS_STATS_URL + "?pagestart=" + pageStart + "&pageend=" + (pageStart + ROW_COUNT); busy.set(true); final ApiDownloader task = new ApiDownloader(getActivity(), ListFragment.lameStatic.dbHelper, null, downloadUrl, false, true, true, ApiDownloader.REQUEST_GET, new ApiListener() { @Override public void requestComplete(final JSONObject json, final boolean isCache) { if (!isCache) { handleUploads(json, handler); } busy.set(false); } }); try { task.startDownload(this); } catch (WiGLEAuthException waex) { MainActivity.info("Transactions Download Failed due to failed auth"); } } else { MainActivity.error("preventing download because previous is still in progress."); } }
Source:
<code><START> public boolean shouldUseCommitTemplate() { <END> return Activator.getDefault().getPreferenceStore() .getBoolean(UIPreferences.COMMIT_DIALOG_MESSAGE_TEMPLATE) && getCommitMessage() == null && getCommitTemplate().isPresent(); }</code><technical_language>is this needed</technical_language>

Target:
public boolean shouldUseCommitTemplate() { return getCommitMessage() == null && getCommitTemplate().isPresent(); }
Source:
<code><START> public Long getMaxDepth() { <END> return this.maxDepth; }</code><technical_language>I int enough for max depth. want rename field graph depth anymore</technical_language>

Target:
public long getMaxDepth() { return this.maxDepth; }
Source:
<code>private void updateActionAvailability() { boolean allowCreateSnapshot = true; if (getEntity() == null) { allowCreateSnapshot = false; <START> } <END> getNewSnapshotCommand().setIsAvailable(allowCreateSnapshot); }</code><technical_language>want disable "New Snapshot" volume is</technical_language>

Target:
private void updateActionAvailability() { boolean allowCreateSnapshot = true; if (getEntity() == null || getEntity().getStatus() == GlusterStatus.DOWN) { allowCreateSnapshot = false; } getNewSnapshotCommand().setIsAvailable(allowCreateSnapshot); }
Source:
<code>private void removeReportedPeer(NodeAddress nodeAddress) { List<Peer> reportedPeersClone = new ArrayList<>(reportedPeers); <START> Optional<Peer> reportedPeerOptional = reportedPeersClone.stream() .filter(e -> e.getNodeAddress().equals(nodeAddress)).findAny(); if (reportedPeerOptional.isPresent()) { Peer reportedPeer = reportedPeerOptional.get(); removeReportedPeer(reportedPeer); } <END> }</code><technical_language>Easier reportedPeersClone.stream() .filter(e -> e.getNodeAddress().equals(nodeAddress)) .findAny() .ifPresent(this::removeReportedPeer);</technical_language>

Target:
private void removeReportedPeer(NodeAddress nodeAddress) { List<Peer> reportedPeersClone = new ArrayList<>(reportedPeers); reportedPeersClone.stream() .filter(e -> e.getNodeAddress().equals(nodeAddress)) .findAny() .ifPresent(this::removeReportedPeer); }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DBObject<?> dbObject = (DBObject<?>) o; if (alias != null ? !alias.equals(dbObject.alias) : dbObject.alias != null) { return false; } <START> if (expressionForComparison() != null ? !expressionForComparison().equals(dbObject.expressionForComparison()) <END> : dbObject.expressionForComparison() != null) { return false; } return !(qualifier != null ? !qualifier.equals(dbObject.qualifier) : dbObject.qualifier != null); }</code><technical_language>I generally do method call once, opposed this way</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DBObject<?> dbObject = (DBObject<?>) o; if (alias != null ? !alias.equals(dbObject.alias) : dbObject.alias != null) { return false; } String myExpression = expressionForComparison(); String otherExpression = dbObject.expressionForComparison(); if (myExpression != null ? !myExpression.equals(otherExpression) : otherExpression != null) { return false; } return !(qualifier != null ? !qualifier.equals(dbObject.qualifier) : dbObject.qualifier != null); }
Source:
<code>void onDrop(DropEvent event) { event.preventDefault(); <START> int sourceIndex = Integer.parseInt(event.getData(DRAG_INDEX)); <END> if (sourceIndex != controller.getColumnIndex(column)) { controller.swapColumns(controller.getColumn(sourceIndex), column); } }</code><technical_language>1 Need catch NumberFormatException</technical_language>

Target:
void onDrop(DropEvent event) { event.preventDefault(); if (dragIndex != controller.getColumnIndex(column)) { controller.swapColumns(controller.getColumn(dragIndex), column); } dragIndex = -1; }
Source:
<code>private void handleVmDeviceChange() { List<String> vmsToUpdate = new ArrayList<String>(); for (Map.Entry<VmDynamic, VmStatistics> vmHelper : _runningVms.values()) { VmDynamic vmDynamic = vmHelper.getKey(); if (vmDynamic != null) { VM vm = _vmDict.get(vmDynamic.getId()); if (vm != null) { String dbHash = vm.getHash(); if ((dbHash == null && vmDynamic.getHash() != null) || !dbHash.equals(vmDynamic.getHash())) { vmsToUpdate.add(vmDynamic.getId().toString()); if (_vmDynamicToSave.containsKey(vm.getId())) { _vmDynamicToSave.get(vm.getId()).setHash(vmDynamic.getHash()); <START> } else { <END> vmDynamic.setHash(vmDynamic.getHash()); AddVmDynamicToList(vmDynamic); } } } } } if (vmsToUpdate.size() > 0) { updateVmDevices(vmsToUpdate); } }</code><technical_language>work , is</technical_language>

Target:
private void handleVmDeviceChange() { List<String> vmsToUpdate = new ArrayList<String>(); for (Map.Entry<VmDynamic, VmStatistics> vmHelper : _runningVms.values()) { VmDynamic vmDynamic = vmHelper.getKey(); if (vmDynamic != null) { VM vm = _vmDict.get(vmDynamic.getId()); if (vm != null) { String dbHash = vm.getHash(); if ((dbHash == null && vmDynamic.getHash() != null) || !dbHash.equals(vmDynamic.getHash())) { vmsToUpdate.add(vmDynamic.getId().toString()); if (_vmDynamicToSave.containsKey(vm.getId())) { _vmDynamicToSave.get(vm.getId()).setHash(vmDynamic.getHash()); } else { AddVmDynamicToList(vmDynamic); } } } } } if (vmsToUpdate.size() > 0) { updateVmDevices(vmsToUpdate); } }
Source:
<code>private static DistributedQueryRunner createQueryRunner(Map<String, String> extraProperties) throws Exception { <START> DistributedQueryRunner queryRunner = new DistributedQueryRunner(testSessionBuilder().build(), 4, extraProperties); <END> queryRunner.installPlugin(new GeoPlugin()); return queryRunner; }</code><technical_language>define private static final int DEFAULT_WORKER_COUNT = 4.</technical_language>

Target:
private static DistributedQueryRunner createQueryRunner(Map<String, String> extraProperties) throws Exception { DistributedQueryRunner queryRunner = new DistributedQueryRunner(testSessionBuilder().build(), DEFAULT_WORKER_COUNT, extraProperties); queryRunner.installPlugin(new GeoPlugin()); return queryRunner; }
Source:
<code>protected Response migrateIncomingPhoneNumbers(String targetAccountSid, MultivaluedMap<String, String> data, MediaType responseType) { Account effectiveAccount = userIdentityContext.getEffectiveAccount(); secure(effectiveAccount, "RestComm:Modify:IncomingPhoneNumbers"); allowOnlySuperAdmin(); try{ Account targetAccount = accountsDao.getAccount(targetAccountSid); <START> if(targetAccount.getParentSid() == null){ <END> return status(BAD_REQUEST).entity("Super Admin account numbers can not be migrated. Please provide a valid account sid").build(); }else{ String organizationSidStr = data.getFirst("OrganizationSid"); if(organizationSidStr == null){ return status(BAD_REQUEST).entity("OrganizationSid cannot be null").build(); } Sid organizationSid = null; try{ organizationSid = new Sid(organizationSidStr); }catch(IllegalArgumentException iae){ return status(BAD_REQUEST).entity("OrganizationSid is not valid").build(); } Organization destinationOrganization = organizationsDao.getOrganization(organizationSid); if(destinationOrganization == null){ return status(NOT_FOUND).entity("Destination organization not found").build(); } migrateNumbersFromAccountTree(targetAccount, destinationOrganization); return status(OK).build(); } }catch(Exception e){ logger.error("Exception while performing migrateIncomingPhoneNumbers: ", e); return status(INTERNAL_SERVER_ERROR).build(); } }</code><technical_language>do need check if targetAccount is null, assume this alwasy Null</technical_language>

Target:
protected Response migrateIncomingPhoneNumbers(String targetAccountSid, MultivaluedMap<String, String> data, MediaType responseType) { Account effectiveAccount = userIdentityContext.getEffectiveAccount(); secure(effectiveAccount, "RestComm:Modify:IncomingPhoneNumbers"); allowOnlySuperAdmin(); try{ Account targetAccount = accountsDao.getAccount(targetAccountSid); if(targetAccount == null){ return status(NOT_FOUND).entity("Account not found").build(); } if(targetAccount.getParentSid() == null){ return status(BAD_REQUEST).entity("Super Admin account numbers can not be migrated. Please provide a valid account sid").build(); }else{ String organizationSidStr = data.getFirst("OrganizationSid"); if(organizationSidStr == null){ return status(BAD_REQUEST).entity("OrganizationSid cannot be null").build(); } Sid organizationSid = null; try{ organizationSid = new Sid(organizationSidStr); }catch(IllegalArgumentException iae){ return status(BAD_REQUEST).entity("OrganizationSid is not valid").build(); } Organization destinationOrganization = organizationsDao.getOrganization(organizationSid); if(destinationOrganization == null){ return status(NOT_FOUND).entity("Destination organization not found").build(); } migrateNumbersFromAccountTree(targetAccount, destinationOrganization); return status(OK).build(); } }catch(Exception e){ logger.error("Exception while performing migrateIncomingPhoneNumbers: ", e); return status(INTERNAL_SERVER_ERROR).build(); } }
Source:
<code>public String getUrl() { return String.format("/job/%s/%d/Azure/processDownloadRequest/%s", action.getContainerName(), <START> action.getBuild().number, artifact.getBlobName()); <END> }</code><technical_language>Do support azure blob storage? Do need share storage consideration</technical_language>

Target:
public String getUrl() { return String.format("/job/%s/%d/Azure/processDownloadRequest/%s", getStorageName(), action.getBuild().number, artifact.getBlobName()); }
Source:
<code>static Comparer<byte[]> getBestComparer() { <START> if (System.getProperty("os.arch").toLowerCase().startsWith("sparc")) { <END> return lexicographicalComparerJavaImpl(); } return lexicographicalComparerJavaImpl(); }</code><technical_language>This check needed</technical_language>

Target:
static Comparer<byte[]> getBestComparer() { return lexicographicalComparerJavaImpl(); }
Source:
<code>public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSaveSmartLock = mHelper.getSaveSmartLockInstance(getActivity()); String email = getArguments().getString(ExtraConstants.EXTRA_EMAIL); String provider = getArguments().getString(ExtraConstants.EXTRA_PROVIDER); AuthUI.IdpConfig providerConfig = null; for (AuthUI.IdpConfig config : mHelper.getFlowParams().providerInfo) { if (config.getProviderId().equalsIgnoreCase(provider)) { providerConfig = config; break; } } if (providerConfig == null) { <START> finish(ResultCodes.UNKNOWN_ERROR, new Intent()); <END> return; } if (provider.equalsIgnoreCase(FacebookAuthProvider.PROVIDER_ID)) { mIdpProvider = new FacebookProvider(getContext(), providerConfig); } else if (provider.equalsIgnoreCase(GoogleAuthProvider.PROVIDER_ID)) { mIdpProvider = new GoogleProvider(getActivity(), providerConfig, email); } else if (provider.equalsIgnoreCase(TwitterAuthProvider.PROVIDER_ID)) { mIdpProvider = new TwitterProvider(getContext()); } mIdpProvider.setAuthenticationCallback(this); mIdpProvider.startLogin(getActivity()); }</code><technical_language>Changing of CANCELED UNKNOWN_ERROR is a breaking API change, people checking for CANCELED in code longer behavior. This simplify cases: * OK * CANCELED (with optional extras describing error) * NO_NETWORK (just compat, lump this CANCELED)</technical_language>

Target:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSaveSmartLock = mHelper.getSaveSmartLockInstance(getActivity()); String provider = getArguments().getString(ExtraConstants.EXTRA_PROVIDER); AuthUI.IdpConfig providerConfig = null; for (AuthUI.IdpConfig config : mHelper.getFlowParams().providerInfo) { if (config.getProviderId().equalsIgnoreCase(provider)) { providerConfig = config; break; } } if (providerConfig == null) { finish(ResultCodes.CANCELED, IdpResponse.getErrorCodeIntent(ErrorCodes.UNKNOWN_ERROR)); return; } if (provider.equalsIgnoreCase(GoogleAuthProvider.PROVIDER_ID)) { mIdpProvider = new GoogleProvider( getActivity(), providerConfig, getArguments().getString(ExtraConstants.EXTRA_EMAIL)); } else if (provider.equalsIgnoreCase(FacebookAuthProvider.PROVIDER_ID)) { mIdpProvider = new FacebookProvider( getContext(), providerConfig, mHelper.getFlowParams().themeId); } else if (provider.equalsIgnoreCase(TwitterAuthProvider.PROVIDER_ID)) { mIdpProvider = new TwitterProvider(getContext()); } mIdpProvider.setAuthenticationCallback(this); mIdpProvider.startLogin(getActivity()); }
Source:
<code>public static void nailMain(final NGContext context) throws IOException { try { Thread mainThread = Thread.currentThread(); <START> context.addClientListener(() -> mainThread.interrupt()); <END> context.addHeartbeatListener(intervalMillis -> context.out.print("H")); while(!Thread.currentThread().isInterrupted()) { Thread.sleep(5000); context.out.print("S"); } } catch (InterruptedException ignored) { System.exit(42); } System.exit(0); }</code><technical_language>nit: able a method reference here. addClientListener(mainThread::interrupt)</technical_language>

Target:
public static void nailMain(final NGContext context) throws IOException { try { Thread mainThread = Thread.currentThread(); context.addClientListener(mainThread::interrupt); context.addHeartbeatListener(() -> context.out.print("H")); while(!Thread.currentThread().isInterrupted()) { Thread.sleep(5000); context.out.print("S"); } } catch (InterruptedException ignored) { System.exit(42); } System.exit(0); }
Source:
<code>public void testFindByRegionsAndComplexFilters() throws AnnotationMetadataNotFoundException { String chr = "11"; int start = 190062; int end = 190064; Region region = new Region(chr, start, end); List<Region> regions = new ArrayList<>(); regions.add(region); List<VariantWithSamplesAndAnnotation> variantEntityList = service.findByRegionsAndComplexFilters( regions, null, null, null, new PageRequest(0, 10000)); assertEquals(1, variantEntityList.size()); for (VariantSourceEntryWithSampleNames variantSourceEntry : variantEntityList.get(0).getSourceEntries()) { if (!variantSourceEntry.getFileId().equals("ERZX00051")) { continue; } assertNotEquals(0, variantSourceEntry.getSamplesData().size()); Map<String, Map<String, String>> samplesData = variantSourceEntry.getSamplesDataMap(); assertEquals("0|1", samplesData.get("HG03805").get("GT")); } <START> assertFalse(variantEntityList.get(0).getAnnotation() == null); <END> }</code><technical_language>assertNotNull used</technical_language>

Target:
public void testFindByRegionsAndComplexFilters() throws AnnotationMetadataNotFoundException { String chr = "11"; int start = 190062; int end = 190064; Region region = new Region(chr, start, end); List<Region> regions = new ArrayList<>(); regions.add(region); List<VariantWithSamplesAndAnnotation> variantEntityList = service.findByRegionsAndComplexFilters( regions, null, null, null, new PageRequest(0, 10000)); assertEquals(1, variantEntityList.size()); for (VariantSourceEntryWithSampleNames variantSourceEntry : variantEntityList.get(0).getSourceEntries()) { if (!variantSourceEntry.getFileId().equals("ERZX00051")) { continue; } assertNotEquals(0, variantSourceEntry.getSamplesData().size()); Map<String, Map<String, String>> samplesData = variantSourceEntry.getSamplesDataMap(); assertEquals("0|1", samplesData.get("HG03805").get("GT")); } assertNotNull(variantEntityList.get(0).getAnnotation()); }
Source:
<code>public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof GenericData) { GenericData that = (GenericData) o; return super.equals(that) && Objects.equals(this.classInfo, that.classInfo); } <START> return false; <END> }</code><technical_language>I this is better: if ((!o instanceof GenericData)) { return false; } GenericData = (GenericData) o; return super.equals(that) && Objects.equals(this.classInfo, that.classInfo);</technical_language>

Target:
public boolean equals(Object o) { if (o == this) { return true; } if (o == null || !(o instanceof GenericData)) { return false; } GenericData that = (GenericData) o; return super.equals(that) && Objects.equals(this.classInfo, that.classInfo); }
Source:
<code>public static void main(final String[] args) throws Exception { Properties jobProps = HadoopSecureWrapperUtils.loadAzkabanProps(); HadoopConfigurationInjector.injectResources(new Props(null, jobProps)); hiveScript = jobProps.getProperty("hive.script"); <START> if (HadoopSecureWrapperUtils.shouldProxy(jobProps)) { <END> UserGroupInformation proxyUser = HadoopSecureWrapperUtils.setupProxyUser(jobProps, logger); proxyUser.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { runHive(args); return null; } }); } else { runHive(args); } }</code><technical_language>need if-else check HadoopSecureWrapperUtils.shouldProxy(jobProps) HadoopSecureWrapperUtils.setupProxyUser takes care of that. doAs runHive(args)</technical_language>

Target:
public static void main(final String[] args) throws Exception { Properties jobProps = HadoopSecureWrapperUtils.loadAzkabanProps(); HadoopConfigurationInjector.injectResources(new Props(null, jobProps)); hiveScript = jobProps.getProperty("hive.script"); if (HadoopSecureWrapperUtils.shouldProxy(jobProps)) { String tokenFile = System.getenv(HADOOP_TOKEN_FILE_LOCATION); UserGroupInformation proxyUser = HadoopSecureWrapperUtils.setupProxyUser(jobProps, tokenFile, logger); proxyUser.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { runHive(args); return null; } }); } else { runHive(args); } }
Source:
<code><START> public ITypedElement getLeft() { <END> if (getBaseCommit() != null && baseId != null) return CompareUtils.getFileRevisionTypedElement(gitPath, getBaseCommit(), getRepository(), baseId); return null; }</code><technical_language>other round? eclipse standard is newer version is left side</technical_language>

Target:
public ITypedElement getLeft() { if (objectExist(getRemoteCommit(), remoteId)) return CompareUtils.getFileRevisionTypedElement(gitPath, getRemoteCommit(), getRepository(), remoteId); return null; }
Source:
<code>static <T> Iterator<T> fill(int n, Supplier<? extends T> s) { Objects.requireNonNull(s, "s is null"); <START> return Collections.fill(n, s, Iterator.empty(), Iterator::of); <END> }</code><technical_language>lazy Collections.tabulate(n, f) method</technical_language>

Target:
static <T> Iterator<T> fill(int n, Supplier<? extends T> s) { Objects.requireNonNull(s, "s is null"); return Collections.fill(n, s); }
Source:
<code>public void anUpdateFirmwareOSLPMessageIsSentToDevice(final String deviceIdentification) { final Message message = this.oslpMockServer.waitForRequest(DeviceRequestMessageType.UPDATE_FIRMWARE); Assert.assertNotNull(message); Assert.assertTrue(message.hasUpdateFirmwareRequest()); <START> } <END></code><technical_language>forget check message parameters passed in message</technical_language>

Target:
public void anUpdateFirmwareOSLPMessageIsSentToDevice(final String deviceIdentification) { final Message message = this.oslpMockServer.waitForRequest(DeviceRequestMessageType.UPDATE_FIRMWARE); Assert.assertNotNull(message); Assert.assertTrue(message.hasUpdateFirmwareRequest()); @SuppressWarnings("unused") final UpdateFirmwareRequest updateFirmwareRequest = message.getUpdateFirmwareRequest(); }
Source:
<code>public void testIterator() { TmfXmlKernelTraceStub trace = fTrace; assertNotNull(trace); <START> assertNotNull(cpuAspect); <END> CallsiteAnalysis module = TmfTraceUtils.getAnalysisModuleOfClass(trace, CallsiteAnalysis.class, CallsiteAnalysis.ID); assertNotNull(module); assertTrue(module.schedule().isOK()); assertTrue(module.waitForCompletion()); UUID uuid = trace.getUUID(); assertNotNull(uuid); String cpu = "cpu"; ITmfCallsiteIterator iter = module.iterator(uuid.toString(), cpu, "0", 1); evaluateIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); evaluateIterator(iter, 71, new TmfCallsite("fs/read_write.c", 0L)); for (int i = 0; i < 10; i++) { evaluateEmptyIterator(iter); } iter = module.iterator(uuid.toString(), cpu, "0", 42); evaluateIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); for (int i = 0; i < 10; i++) { evaluateIterator(iter, 71, new TmfCallsite("fs/read_write.c", 0L)); evaluateEmptyIterator(iter); evaluatePrevIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); evaluateBackEmptyIterator(iter); } iter = module.iterator("", cpu, "0", 42); evaluateEmptyIterator(iter); iter = module.iterator(uuid.toString(), cpu, "elephant", 42); evaluateEmptyIterator(iter); }</code><technical_language>remove, compile</technical_language>

Target:
public void testIterator() { TmfXmlKernelTraceStub trace = fTrace; assertNotNull(trace); CallsiteAnalysis module = TmfTraceUtils.getAnalysisModuleOfClass(trace, CallsiteAnalysis.class, CallsiteAnalysis.ID); assertNotNull(module); assertTrue(module.schedule().isOK()); assertTrue(module.waitForCompletion()); UUID uuid = trace.getUUID(); assertNotNull(uuid); String cpu = "cpu"; ITmfCallsiteIterator iter = module.iterator(uuid.toString(), cpu, "0", 1); evaluateIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); evaluateIterator(iter, 71, new TmfCallsite("fs/read_write.c", 0L)); for (int i = 0; i < 10; i++) { evaluateEmptyIterator(iter); } iter = module.iterator(uuid.toString(), cpu, "0", 42); evaluateIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); for (int i = 0; i < 10; i++) { evaluateIterator(iter, 71, new TmfCallsite("fs/read_write.c", 0L)); evaluateEmptyIterator(iter); evaluatePrevIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); evaluateBackEmptyIterator(iter); } iter = module.iterator("", cpu, "0", 42); evaluateEmptyIterator(iter); iter = module.iterator(uuid.toString(), cpu, "elephant", 42); evaluateEmptyIterator(iter); }
Source:
<code>private static void writeReportLastScanTo(HttpMessage msg, ScanReportType reportType) throws Exception { ReportLastScan rls = new ReportLastScan(); StringBuilder report = new StringBuilder(); rls.generate(report, Model.getSingleton()); String response; if (ScanReportType.XML == reportType) { msg.setResponseHeader(API.getDefaultResponseHeader("text/xml; charset=UTF-8")); response = report.toString(); } else if (ScanReportType.MD == reportType) { msg.setResponseHeader(API.getDefaultResponseHeader("text/markdown; charset=UTF-8")); response = ReportGenerator.stringToHtml( report.toString(), Paths.get(Constant.getZapInstall(), "xml/report.md.xsl").toString()); } else if (ScanReportType.JSON == reportType) { <START> msg.setResponseHeader(API.getDefaultResponseHeader("text/json; charset=UTF-8")); <END> response = ReportGenerator.stringToJson(report.toString()); } else { msg.setResponseHeader(API.getDefaultResponseHeader("text/html; charset=UTF-8")); response = ReportGenerator.stringToHtml( report.toString(), Paths.get(Constant.getZapInstall(), "xml/report.html.xsl").toString()); } msg.setResponseBody(response); msg.getResponseHeader().setContentLength(msg.getResponseBody().length()); }</code><technical_language>application/json</technical_language>

Target:
private static void writeReportLastScanTo(HttpMessage msg, ScanReportType reportType) throws Exception { ReportLastScan rls = new ReportLastScan(); StringBuilder report = new StringBuilder(); rls.generate(report, Model.getSingleton()); String response; if (ScanReportType.XML == reportType) { msg.setResponseHeader(API.getDefaultResponseHeader("text/xml; charset=UTF-8")); response = report.toString(); } else if (ScanReportType.MD == reportType) { msg.setResponseHeader(API.getDefaultResponseHeader("text/markdown; charset=UTF-8")); response = ReportGenerator.stringToHtml( report.toString(), Paths.get(Constant.getZapInstall(), "xml/report.md.xsl").toString()); } else if (ScanReportType.JSON == reportType) { msg.setResponseHeader(API.getDefaultResponseHeader("application/json; charset=UTF-8")); response = ReportGenerator.stringToJson(report.toString()); } else { msg.setResponseHeader(API.getDefaultResponseHeader("text/html; charset=UTF-8")); response = ReportGenerator.stringToHtml( report.toString(), Paths.get(Constant.getZapInstall(), "xml/report.html.xsl").toString()); } msg.setResponseBody(response); msg.getResponseHeader().setContentLength(msg.getResponseBody().length()); }
Source:
<code>public String resolveJsModule( String scriptAddress, String moduleAddress, String sourcename, int lineno, int colno) { if (ModuleLoader.isAmbiguousIdentifier(moduleAddress)) { <START> if (errorHandler != null) { <END> errorHandler.report( CheckLevel.WARNING, JSError.make( sourcename, lineno, colno, ModuleLoader.INVALID_MODULE_PATH, moduleAddress, "BROWSER")); } return null; } String loadAddress = locate(scriptAddress, moduleAddress); if (loadAddress == null && errorHandler != null) { errorHandler.report( CheckLevel.WARNING, JSError.make(sourcename, lineno, colno, ModuleLoader.LOAD_WARNING, moduleAddress)); } return loadAddress; }</code><technical_language>forbid null for errorHandler creator pass in a no-op Errorhandler if care errors</technical_language>

Target:
public String resolveJsModule( String scriptAddress, String moduleAddress, String sourcename, int lineno, int colno) { if (ModuleLoader.isAmbiguousIdentifier(moduleAddress)) { errorHandler.report( CheckLevel.WARNING, JSError.make( sourcename, lineno, colno, ModuleLoader.INVALID_MODULE_PATH, moduleAddress, "BROWSER")); return null; } String loadAddress = locate(scriptAddress, moduleAddress); if (loadAddress == null) { errorHandler.report( CheckLevel.WARNING, JSError.make(sourcename, lineno, colno, ModuleLoader.LOAD_WARNING, moduleAddress)); } return loadAddress; }
Source:
<code>public TaskResultImpl getTaskResult(SchedulerDBManager dbManager, InternalJob job, InternalTask task, Throwable exception, TaskLogs output) throws UnknownTaskException { if (task == null){ throw new UnknownTaskException(); } TaskResultImpl taskResult; JobDescriptor jobDescriptor = job.getJobDescriptor(); try{ taskResult = (TaskResultImpl) dbManager.loadTasksResults(job.getId(), Collections.singletonList(task.getId())).get(task.getId()); <START> }catch(DatabaseManagerException e){ <END> taskResult = getEmptyTaskResultWithTaskIdAndExecutionTime(task, exception,output); } EligibleTaskDescriptor etd = null; if (jobDescriptor.getPausedTasks().get(task.getId()) != null){ etd = (EligibleTaskDescriptor) jobDescriptor.getPausedTasks().get(task.getId()); }else if (jobDescriptor.getRunningTasks().get(task.getId()) != null){ etd = (EligibleTaskDescriptor) jobDescriptor.getRunningTasks().get(task.getId()); } if (etd != null){ taskResult.setPropagatedVariables(getPropagatedVariables(dbManager, etd, job, task)); } return taskResult; }</code><technical_language>avoid this exception somehow? (<LINK_0></technical_language>

Target:
public TaskResultImpl getTaskResult(SchedulerDBManager dbManager, InternalJob job, InternalTask task, Throwable exception, TaskLogs output) throws UnknownTaskException { if (task == null) { throw new UnknownTaskException(); } TaskResultImpl taskResult; JobDescriptor jobDescriptor = job.getJobDescriptor(); EligibleTaskDescriptor etd = null; if (jobDescriptor.getPausedTasks().get(task.getId()) != null) { etd = (EligibleTaskDescriptor) jobDescriptor.getPausedTasks().get(task.getId()); } else if (jobDescriptor.getRunningTasks().get(task.getId()) != null) { etd = (EligibleTaskDescriptor) jobDescriptor.getRunningTasks().get(task.getId()); } if (jobDescriptor.getRunningTasks().get(task.getId()) != null) { taskResult = (TaskResultImpl) dbManager.loadTasksResults(job.getId(), Collections.singletonList(task.getId())).get(task.getId()); } else { taskResult = getEmptyTaskResultWithTaskIdAndExecutionTime(task, exception, output); if (etd != null) { taskResult.setPropagatedVariables(getPropagatedVariables(dbManager, etd, job, task)); } } return taskResult; }
Source:
<code>private void verifySchemaVersion() throws CatalogException { int schemaVersion = -1; schemaVersion = getSchemaVersion(); if (schemaVersion == -1 || schemaVersion != getDriverVersion()) { LOG.info(String.format("Catalog version (%d) and current driver version (%d) are mismatch to each other", schemaVersion, getDriverVersion())); LOG.info("It will start upgrade process on catalog stores."); <START> catalogSchemaManager.upgradeBaseSchema(getConnection(), schemaVersion); <END> insertSchemaVersion(); } LOG.info(String.format("The compatibility of the catalog schema (version: %d) has been verified.", getDriverVersion())); }</code><technical_language>I tajo_dump approach is productive in terms of development more safe for upgrading. tajo_dump, instruction of Tajo migration is follows: 1. execute tajo_dump dump catalog information **Tajo DDL statements** a plan text file (e.g., backup.sql). 2. create new database in catalog store (PostgreSQL MySQL) for migration 3. change catalog store config in catalog-site.xml in order newly created database 4. restart a Tajo cluster 5. run tsql -f backup.sql execute a sequence of **Tajo DDL statements** backup.sql This approach naturally allows users original catalog tables additional database backup. if upgrade is failed, original catalogs safe. Another motivation of tajo-dump approach allows change catalog schemas considering schema upgrades. Actually, catalog is evolving rapidly. important in this time. This is opinion. open discussion. Thank for work</technical_language>

Target:
private void verifySchemaVersion() throws CatalogException { int schemaVersion = -1; schemaVersion = getSchemaVersion(); if (schemaVersion == -1 || schemaVersion != getDriverVersion()) { LOG.error(String.format("Catalog version (%d) and current driver version (%d) are mismatch to each other", schemaVersion, getDriverVersion())); LOG.error("========================================================================="); LOG.error("| Catalog Store Migration Is Needed |"); LOG.error("========================================================================="); LOG.error("| You might downgrade or upgrade Apache Tajo. Downgrading or upgrading |"); LOG.error("| Tajo without migration process is only available in some versions. |"); LOG.error("| In order to learn how to migration Apache Tajo instance, |"); LOG.error("| please refer <LINK_0> |"); LOG.error("========================================================================="); throw new CatalogException("Migration Needed. Please refer <LINK_0>"); } LOG.info(String.format("The compatibility of the catalog schema (version: %d) has been verified.", getDriverVersion())); }
Source:
<code>public HostMetricTagsPair(String host, String metric, @Nullable Map<String, String> tags) { Preconditions.checkNotNull(host, "HostMetricTagsPair.host cannot be null"); Preconditions.checkNotNull(metric, "HostMetricTagsPair.metric cannot be null"); <START> this.metric = metric.trim().toLowerCase(); <END> this.host = host.trim().toLowerCase(); this.tags = tags; }</code><technical_language>Metrics case-sensitive, lowercase - trim</technical_language>

Target:
public HostMetricTagsPair(String host, String metric, @Nullable Map<String, String> tags) { Preconditions.checkNotNull(host, "HostMetricTagsPair.host cannot be null"); Preconditions.checkNotNull(metric, "HostMetricTagsPair.metric cannot be null"); this.metric = metric.trim(); this.host = host.trim().toLowerCase(); this.tags = tags; }
Source:
<code>public void tesMatchEngineFactoryRegistry() throws IOException { final Resource left = input.getExtlibraryLeft(); final Resource right = input.getExtlibraryRight(); final IMatchEngine.Factory.Registry registry = MatchEngineFactoryRegistryImpl .createStandaloneInstance(); final IComparisonScope scope = EMFCompare.createDefaultScope(left, right); IMatchEngine.Factory factory = registry.getHighestRankingMatchEngineFactory(scope); assertTrue(factory instanceof MatchEngineFactoryImpl); assertEquals(1, registry.getMatchEngineFactories(scope).size()); IMatchEngine.Factory factoryWithHighestRanking = new MatchEngineFactoryTest(); factoryWithHighestRanking.setRanking(100); registry.add(factoryWithHighestRanking); factory = registry.getHighestRankingMatchEngineFactory(scope); assertTrue(factory instanceof MatchEngineFactoryImpl); <START> assertFalse(factory instanceof MatchEngineFactoryTest); <END> assertEquals(1, registry.getMatchEngineFactories(scope).size()); IMatchEngine.Factory factoryWithMiddleRanking = new MatchEngineFactoryOtherTest(); factoryWithMiddleRanking.setRanking(50); registry.add(factoryWithMiddleRanking); factory = registry.getHighestRankingMatchEngineFactory(scope); assertTrue(factory instanceof MatchEngineFactoryImpl); assertFalse(factory instanceof MatchEngineFactoryTest); assertTrue(factory instanceof MatchEngineFactoryOtherTest); assertEquals(2, registry.getMatchEngineFactories(scope).size()); }</code><technical_language>of asserts is enough. Remove assertTrue</technical_language>

Target:
public void tesMatchEngineFactoryRegistry() throws IOException { final Resource left = input.getExtlibraryLeft(); final Resource right = input.getExtlibraryRight(); final IMatchEngine.Factory.Registry registry = MatchEngineFactoryRegistryImpl .createStandaloneInstance(); final IComparisonScope scope = EMFCompare.createDefaultScope(left, right); IMatchEngine.Factory factory = registry.getHighestRankingMatchEngineFactory(scope); assertTrue(factory instanceof MatchEngineFactoryImpl); assertEquals(1, registry.getMatchEngineFactories(scope).size()); IMatchEngine.Factory factoryWithHighestRanking = new MatchEngineFactoryTest(); factoryWithHighestRanking.setRanking(100); registry.add(factoryWithHighestRanking); factory = registry.getHighestRankingMatchEngineFactory(scope); assertFalse(factory instanceof MatchEngineFactoryTest); assertEquals(1, registry.getMatchEngineFactories(scope).size()); IMatchEngine.Factory factoryWithMiddleRanking = new MatchEngineFactoryOtherTest(); factoryWithMiddleRanking.setRanking(50); registry.add(factoryWithMiddleRanking); factory = registry.getHighestRankingMatchEngineFactory(scope); assertTrue(factory instanceof MatchEngineFactoryOtherTest); assertEquals(2, registry.getMatchEngineFactories(scope).size()); }
Source:
<code>public String getFirstNLinesOfInvalidityErrors(int maxNumOfLines) { StringBuilder errors = new StringBuilder(); ArrayList<String> invalidityErrorLines = scriptGeneratorTable.getInvalidityErrorLines(); for (int i = 0; i < invalidityErrorLines.size(); i++) { if (maxNumOfLines <= i) { errors.append("\nLimited to " + maxNumOfLines + " lines. To see an error for a specific row hover over it."); break; } errors.append(invalidityErrorLines.get(i)+"\n"); <START> } <END> return errors.toString(); }</code><technical_language>a stream a bit nicer here? like: List<String> errors = scriptGeneratorTable.getInvalidityErrorLines(); String message = errors .limit(maxNumOfLines) .collect(Collectors.joining("\n"); if (errors.size() > maxNumOfLines) { message = String.format("%s\n ... %d suppressed errors. error for a specific row hover it.", message, (errors.size() - maxNumOfLines)); } return message; message in GUI - this more user friendly bullet points a heading? moment prone a bit of wall of text if multiple errors. Feel free ignore if disagree..</technical_language>

Target:
public String getFirstNLinesOfInvalidityErrors(int maxNumOfLines) { if(!languageSupported) { firePropertyChange(LANGUAGE_SUPPORT_PROPERTY, true, false); } List<String> errors = scriptGeneratorTable.getInvalidityErrorLines(); String message = errors.stream() .limit(maxNumOfLines) .map((String error) -> String.format("- %s", error)) .collect(Collectors.joining("\n")); if (errors.size() > maxNumOfLines) { message = String.format("%s\n\n ... plus %d suppressed errors." + " To see an error for a specific row hover over it.", message, (errors.size() - maxNumOfLines)); } return message; }
Source:
<code><START> private static List<String> getMountPointsFilter() { <END> return Arrays.asList(Config.<String> getValue(ConfigValues.MountPointsToIgoreInGlusterStorageList).split(",")); }</code><technical_language>static modifier</technical_language>

Target:
private List<String> getMountPointsFilter() { return Arrays.asList(Config.<String> getValue(ConfigValues.MountPointsToIgoreInGlusterStorageList).split(",")); }
Source:
<code>protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getMissingServerHooks().isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS); return false; <START> } <END> return true; }</code><technical_language>check servers want update hook content is in state</technical_language>

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getContentConflictServerHooks().isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS); return false; } for (GlusterServerHook serverHook: getContentConflictServerHooks()) { VDS vds = getVdsDAO().get(serverHook.getServerId()); if (vds == null || vds.getStatus() != VDSStatus.Up) { setVdsName(vds.getName()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SERVER_STATUS_NOT_UP); return false; } } return true; }
Source:
<code>private boolean getForceDecimalEncoding(Configuration configuration) { <START> GMLConfiguration config; <END> if (configuration instanceof GMLConfiguration) { config = (GMLConfiguration) configuration; } else { config = configuration.getDependency(GMLConfiguration.class); } if (config == null) { return true; } else { return config.getForceDecimalEncoding(); } }</code><technical_language>code in method above, factor out</technical_language>

Target:
private boolean getForceDecimalEncoding(Configuration configuration) { GMLConfiguration config = getGMLConfiguration(configuration); if (config == null) { return true; } else { return config.getForceDecimalEncoding(); } }
Source:
<code>private boolean CanRunOnDestinationVds(List<String> messages, boolean isMigrate) { boolean returnValue = false; if (getDestinationVdsId() != null) { VDS target_vds = DbFacade.getInstance().getVdsDAO().get(getDestinationVdsId()); log.infoFormat("Checking for a specific VDS only - id:{0}, name:{1}, host_name(ip):{2}", getDestinationVdsId(), target_vds.getvds_name(), target_vds.gethost_name()); <START> returnValue = CanFindVdsToRun(messages, isMigrate, <END> new ArrayList<VDS>(Arrays.asList(new VDS[] { target_vds }))); } return returnValue; }</code><technical_language>u please simplify - creation of lists</technical_language>

Target:
private boolean CanRunOnDestinationVds(List<String> messages, boolean isMigrate) { boolean returnValue = false; if (getDestinationVdsId() != null) { VDS target_vds = DbFacade.getInstance().getVdsDAO().get(getDestinationVdsId()); log.infoFormat("Checking for a specific VDS only - id:{0}, name:{1}, host_name(ip):{2}", getDestinationVdsId(), target_vds.getvds_name(), target_vds.gethost_name()); returnValue = CanFindVdsToRun(messages, isMigrate, Arrays.asList(new VDS[] { target_vds })); } return returnValue; }
Source:
<code>private void showColorPicker(View view) { AppCompatActivity activity = UiUtils.getActivityFromView(view); FragmentManager fragmentManager = activity.getSupportFragmentManager(); if (!fragmentManager.isStateSaved()) { int currentColor = getCurrentColor(); ColorPickerDialog dialog = ColorPickerDialog.newInstance(currentColor); dialog.addOnColorPickedListener(newColor -> setNewColor(activity, newColor)); <START> dialog.setStyle(STYLE_NORMAL, R.style.AlertDialogWithTitle); <END> dialog.show(fragmentManager, null); } }</code><technical_language>please nullcheck</technical_language>

Target:
private void showColorPicker(View view) { AppCompatActivity activity = UiUtils.getActivityFromView(view); if (activity == null) { return; } FragmentManager fragmentManager = activity.getSupportFragmentManager(); if (!fragmentManager.isStateSaved()) { int currentColor = getCurrentColor(); ColorPickerDialog dialog = ColorPickerDialog.newInstance(currentColor); dialog.addOnColorPickedListener(newColor -> setNewColor(activity, newColor)); dialog.setStyle(STYLE_NORMAL, R.style.AlertDialogWithTitle); dialog.show(fragmentManager, null); } }
Source:
<code>public XmlTimeGraphView() { super(ID, new XmlPresentationProvider(ID), XmlTimeGraphDataProvider.ID); setWeight(fWeight); setTreeColumns(DEFAULT_COLUMN_NAMES); setTreeLabelProvider(new XmlTreeLabelProvider()); setFilterColumns(DEFAULT_FILTER_COLUMN_NAMES); setFilterLabelProvider(new XmlTreeLabelProvider()); setEntryComparator(ENTRY_COMPARATOR); addPartPropertyListener(event -> { Object newValue = event.getNewValue(); if (event.getProperty().equals(TmfXmlStrings.XML_OUTPUT_DATA) && newValue instanceof String) { <START> String data = (String) newValue; fViewInfo.setViewData(data); rebuild(); <END> } }); }</code><technical_language>I name change here. So, presentation provider for correct view. This property changed is called requesting output project explorer. need a new presentation provider rebuild(). If need create a new presentation provider here, need remove color settings listener overwriting member variable, add listener new one</technical_language>

Target:
public XmlTimeGraphView() { super(ID, new XmlPresentationProvider(ID), XmlTimeGraphDataProvider.ID); setWeight(fWeight); setTreeColumns(DEFAULT_COLUMN_NAMES); setTreeLabelProvider(new XmlTreeLabelProvider()); setFilterColumns(DEFAULT_FILTER_COLUMN_NAMES); setFilterLabelProvider(new XmlTreeLabelProvider()); setEntryComparator(ENTRY_COMPARATOR); addPartPropertyListener(event -> { Object newValue = event.getNewValue(); if (event.getProperty().equals(TmfXmlStrings.XML_OUTPUT_DATA) && newValue instanceof String) { String data = (String) newValue; fViewInfo.setViewData(data); TimeGraphViewer timeGraphViewer = getTimeGraphViewer(); timeGraphViewer.getTimeGraphControl().colorSettingsChanged(timeGraphViewer.getTimeGraphProvider().getStateTable()); rebuild(); } }); }
Source:
<code>public void resolveDate() throws Exception { Git git = new Git(db); writeTrashFile("file.txt", "content"); git.add().addFilepattern("file.txt").call(); git.commit().setMessage("create file").call(); try { db.resolve("master@{yesterday}"); fail("Exception not thrown"); <START> } catch (IOException e) { <END> assertNotNull(e); } }</code><technical_language>catch RevisionSyntaxException here. Other exceptions real errors</technical_language>

Target:
public void resolveDate() throws Exception { Git git = new Git(db); writeTrashFile("file.txt", "content"); git.add().addFilepattern("file.txt").call(); git.commit().setMessage("create file").call(); try { db.resolve("master@{yesterday}"); fail("Exception not thrown"); } catch (RevisionSyntaxException e) { assertNotNull(e); } }