auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testRemovingCacheConfigurationListener() { Listener configurationListener = new Listener(); List<CacheConfigurationChangeListener> cacheConfigurationChangeListeners = new ArrayList<>(); cacheConfigurationChangeListeners.add(configurationListener); this.runtimeConfiguration.addCacheConfigurationListener(cacheConfigurationChangeListeners); this.cache.getRuntimeConfiguration().updateResourcePools(createResourcePools()); assertThat(configurationListener.eventSet.size(), is(1)); this.runtimeConfiguration.removeCacheConfigurationListener(configurationListener); <START> this.cache.getRuntimeConfiguration().updateResourcePools(createResourcePools()); <END> assertThat(configurationListener.eventSet.size(), is(1) ); }</code><technical_language>This unnerves a tad ... is identically-configured ResourcePools instance replacement sufficient ensure removed listener fired? fired replacement is effective NOP? (The previous version _distinctly configured_ ResourcePools instances.)</technical_language>

Target:
public void testRemovingCacheConfigurationListener() { Listener configurationListener = new Listener(); List<CacheConfigurationChangeListener> cacheConfigurationChangeListeners = new ArrayList<>(); cacheConfigurationChangeListeners.add(configurationListener); this.runtimeConfiguration.addCacheConfigurationListener(cacheConfigurationChangeListeners); this.cache.getRuntimeConfiguration().updateResourcePools(createResourcePools(20L)); assertThat(configurationListener.eventSet.size(), is(1)); this.runtimeConfiguration.removeCacheConfigurationListener(configurationListener); this.cache.getRuntimeConfiguration().updateResourcePools(createResourcePools(5L)); assertThat(configurationListener.eventSet.size(), is(1) ); }
Source:
<code>private void passwordObservable() { <START> Observable<String> observable = RxTextView.textChanges(password1EditText).skip(1).debounce(600, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread()) .map(CharSequence::toString); observable.subscribe(this::passwordCheck, LOG::error); <END> Observable<String> observable1 = RxTextView.textChanges(password2EditText).skip(1).debounce(600, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread()) .map(CharSequence::toString); observable.subscribe(this::checkConfirmPassword); Observable<Boolean> observable2 = Observable.combineLatest(observable, observable1, (s, s2) -> { return checkMatchpassword(s, s2); }); observable2.subscribe(this::showMatchError, LOG::error); }</code><technical_language>split observable subscription. do this RxTextView.textChanges(password1EditText) .skipInitialValue() .debounce(600, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread()) .map(CharSequence::toString); .subscribe(this::passwordCheck, LOG::error); mistakes</technical_language>

Target:
private void passwordObservable() { RxTextView.textChanges(password1EditText) .skipInitialValue() .debounce(600, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread()) .map(CharSequence::toString) .subscribe(this::passwordCheck, LOG::error); RxTextView.textChanges(password2EditText) .skipInitialValue() .debounce(600, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread()) .map(CharSequence::toString) .subscribe(this::checkConfirmPassword); }
Source:
<code>public void findById() throws Exception { <START> Optional<Capability> actual = catalog.findById(2); <END> Capability expected = new Capability(2, "B"); assertThat(actual.get(), deepEquals(expected)); }</code><technical_language>Capability actual = catalog.findById(2).get()</technical_language>

Target:
public void findById() throws Exception { Capability actual = catalog.findById(2).get(); Capability expected = new Capability(2, "B"); assertThat(actual, deepEquals(expected)); }
Source:
<code>private int getattrInternal(String path, FileStat stat) { final AlluxioURI uri = mPathResolverCache.getUnchecked(path); try { URIStatus status = mFileSystem.getStatus(uri); long size = status.getLength(); stat.st_size.set(size); stat.st_blocks.set((int) Math.ceil((double) size / 512)); final long ctime_sec = status.getLastModificationTimeMs() / 1000; <START> final long ctime_nsec = (status.getLastModificationTimeMs() % 1000) * 1000; <END> stat.st_ctim.tv_sec.set(ctime_sec); stat.st_ctim.tv_nsec.set(ctime_nsec); stat.st_mtim.tv_sec.set(ctime_sec); stat.st_mtim.tv_nsec.set(ctime_nsec); if (mIsUserGroupTranslation) { stat.st_uid.set(mUidCache.get(status.getOwner())); stat.st_gid.set(mGidCache.get(status.getGroup())); } else { stat.st_uid.set(DEFAULT_UID); stat.st_gid.set(DEFAULT_GID); } int mode = status.getMode(); if (status.isFolder()) { mode |= FileStat.S_IFDIR; } else { mode |= FileStat.S_IFREG; } stat.st_mode.set(mode); stat.st_nlink.set(1); } catch (FileDoesNotExistException | InvalidPathException e) { LOG.debug("Failed to get info of {}, path does not exist or is invalid", path); return -ErrorCodes.ENOENT(); } catch (Throwable e) { LOG.error("Failed to getattr {}: ", path, e); return -ErrorCodes.EIO(); } return 0; }</code><technical_language>Is this supposed nanoseconds? 1000000ns in 1ms</technical_language>

Target:
private int getattrInternal(String path, FileStat stat) { final AlluxioURI uri = mPathResolverCache.getUnchecked(path); try { URIStatus status = mFileSystem.getStatus(uri); long size = status.getLength(); stat.st_size.set(size); stat.st_blocks.set((int) Math.ceil((double) size / 512)); final long ctime_sec = status.getLastModificationTimeMs() / 1000; final long ctime_nsec = (status.getLastModificationTimeMs() % 1000) * 1_000_000L; stat.st_ctim.tv_sec.set(ctime_sec); stat.st_ctim.tv_nsec.set(ctime_nsec); stat.st_mtim.tv_sec.set(ctime_sec); stat.st_mtim.tv_nsec.set(ctime_nsec); if (mIsUserGroupTranslation) { stat.st_uid.set(mUidCache.get(status.getOwner())); stat.st_gid.set(mGidCache.get(status.getGroup())); } else { stat.st_uid.set(DEFAULT_UID); stat.st_gid.set(DEFAULT_GID); } int mode = status.getMode(); if (status.isFolder()) { mode |= FileStat.S_IFDIR; } else { mode |= FileStat.S_IFREG; } stat.st_mode.set(mode); stat.st_nlink.set(1); } catch (FileDoesNotExistException | InvalidPathException e) { LOG.debug("Failed to get info of {}, path does not exist or is invalid", path); return -ErrorCodes.ENOENT(); } catch (Throwable e) { LOG.error("Failed to getattr {}: ", path, e); return -ErrorCodes.EIO(); } return 0; }
Source:
<code>public void given__mockScm__when__uninstantiating__then__noRaw$class() throws Exception { MockSCMController c = MockSCMController.create(); try { c.createRepository("test"); MockSCM instance = new MockSCM(c, "test", new MockSCMHead("master"), new MockSCMRevision( new MockSCMHead("master"), c.getRevision("test", "master"))); assertThat(DescribableModel.uninstantiate2_(instance).toString(), allOf( <START> startsWith("@"), <END> not(containsString(", $")), not(containsString("=$")), not(containsString("[$")), not(containsString("{$")) )); } finally { c.close(); } }</code><technical_language>This TreeMaps internally, assert exact form for toString stable</technical_language>

Target:
public void given__mockScm__when__uninstantiating__then__noRaw$class() throws Exception { MockSCMController c = MockSCMController.create(); try { c.createRepository("test"); MockSCM instance = new MockSCM(c, "test", new MockSCMHead("master"), new MockSCMRevision( new MockSCMHead("master"), c.getRevision("test", "master"))); assertThat(DescribableModel.uninstantiate2_(instance).toString(), allOf( startsWith("@"), not(containsString(", $")), not(containsString("=$")), not(containsString("[$")), not(containsString("{$")) )); assertThat(DescribableModel.uninstantiate2_(instance).toString(), is("@mockScm(" + "controllerId=" + c.getId() + "," + "head=master," + "repository=test," + "revision=" + c.getRevision("test", "master") + ")")); } finally { c.close(); } }
Source:
<code>private <START> void getUserDb() <END> { DbUser u = getParameters().getUserToAdd(); user = dbUserDao.getByExternalId(u.getDomain(), u.getExternalId()); }</code><technical_language>I more readeable if return DbUser instead of setting private user attribute, in method "get" prefix. confusing. pass DBUser userDbIsSet method</technical_language>

Target:
private void getUserDb() { DbUser u = getParameters().getUserToUpdate(); user = dbUserDao.getByExternalId(u.getDomain(), u.getExternalId()); }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_crime_list, container, false); mCrimeRecyclerView = (RecyclerView) view.findViewById(R.id.crime_recycler_view); mCrimeRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); <START> CrimeExpandableAdapter mCrimeExpandableAdapter = new CrimeExpandableAdapter(getActivity(), generateCrimes()); <END> mCrimeExpandableAdapter.setCustomParentAnimationViewId(R.id.parent_list_item_expand_arrow); mCrimeExpandableAdapter.setParentClickableViewAnimationDefaultDuration(); mCrimeExpandableAdapter.setParentAndIconExpandOnClick(true); mCrimeRecyclerView.setAdapter(mCrimeExpandableAdapter); return view; }</code><technical_language>This variable name crimeExpandableAdapter a member variable</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_crime_list, container, false); mCrimeRecyclerView = (RecyclerView) view.findViewById(R.id.crime_recycler_view); mCrimeRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); CrimeExpandableAdapter crimeExpandableAdapter = new CrimeExpandableAdapter(getActivity(), generateCrimes()); crimeExpandableAdapter.setCustomParentAnimationViewId(R.id.parent_list_item_expand_arrow); crimeExpandableAdapter.setParentClickableViewAnimationDefaultDuration(); crimeExpandableAdapter.setParentAndIconExpandOnClick(true); mCrimeRecyclerView.setAdapter(crimeExpandableAdapter); return view; }
Source:
<code>private String extractArchive(String fileName, File outputDirectory) { if (StringUtils.isEmpty(fileName)) { return null; } <START> logger.info("Extracting OpenShift archive {}.", fileName); <END> String extractedDirectory = null; if (fileName.endsWith(SUFFIX_ZIP)) { extractedDirectory = StringUtils.chomp(fileName, SUFFIX_ZIP); FileHelper.unzipFile(new File(fileName), outputDirectory); } else if (fileName.endsWith(SUFFIX_TAR_GZ)) { extractedDirectory = StringUtils.chomp(fileName, SUFFIX_TAR_GZ); FileHelper.extractTarGz(new File(fileName), outputDirectory); } return extractedDirectory; }</code><technical_language>Logger info String.format, in place for arguments. Please NLS.bind(...) argument for logger info successfully map</technical_language>

Target:
private String extractArchive(String fileName, File outputDirectory) { if (StringUtils.isEmpty(fileName)) { return null; } LOGGER.info(NLS.bind("Extracting OpenShift archive {0}.", fileName)); String extractedDirectory = null; if (fileName.endsWith(SUFFIX_ZIP)) { extractedDirectory = StringUtils.chomp(fileName, SUFFIX_ZIP); FileHelper.unzipFile(new File(fileName), outputDirectory); } else if (fileName.endsWith(SUFFIX_TAR_GZ)) { extractedDirectory = StringUtils.chomp(fileName, SUFFIX_TAR_GZ); FileHelper.extractTarGz(new File(fileName), outputDirectory); } return extractedDirectory; }
Source:
<code>public static boolean[] populateNullVector( @Nullable final boolean[] nullVector, final ReadableVectorOffset offset, final PeekableIntIterator nullIterator ) { if (!nullIterator.hasNext()) { return null; } final boolean[] retVal; if (nullVector != null) { retVal = nullVector; } else { retVal = new boolean[offset.getMaxVectorSize()]; } if (offset.isContiguous()) { final int startOffset = offset.getStartOffset(); nullIterator.advanceIfNeeded(startOffset); if (!nullIterator.hasNext()) { return null; } for (int i = 0; i < offset.getCurrentVectorSize(); i++) { final int row = i + startOffset; nullIterator.advanceIfNeeded(row); if (!nullIterator.hasNext()) { <START> retVal[i] = false; <END> continue; } retVal[i] = row == nullIterator.peekNext(); } } else { final int[] currentOffsets = offset.getOffsets(); nullIterator.advanceIfNeeded(currentOffsets[0]); if (!nullIterator.hasNext()) { return null; } for (int i = 0; i < offset.getCurrentVectorSize(); i++) { final int row = currentOffsets[i]; nullIterator.advanceIfNeeded(row); if (!nullIterator.hasNext()) { retVal[i] = false; continue; } retVal[i] = row == nullIterator.peekNext(); } } return retVal; }</code><technical_language>Arrays.fill fill rest falses, break? more efficient</technical_language>

Target:
public static boolean[] populateNullVector( @Nullable final boolean[] nullVector, final ReadableVectorOffset offset, final PeekableIntIterator nullIterator ) { if (!nullIterator.hasNext()) { return null; } final boolean[] retVal; if (nullVector != null) { retVal = nullVector; } else { retVal = new boolean[offset.getMaxVectorSize()]; } if (offset.isContiguous()) { final int startOffset = offset.getStartOffset(); nullIterator.advanceIfNeeded(startOffset); if (!nullIterator.hasNext()) { return null; } for (int i = 0; i < offset.getCurrentVectorSize(); i++) { final int row = i + startOffset; nullIterator.advanceIfNeeded(row); if (!nullIterator.hasNext()) { Arrays.fill(retVal, i, offset.getCurrentVectorSize(), false); break; } retVal[i] = row == nullIterator.peekNext(); } } else { final int[] currentOffsets = offset.getOffsets(); nullIterator.advanceIfNeeded(currentOffsets[0]); if (!nullIterator.hasNext()) { return null; } for (int i = 0; i < offset.getCurrentVectorSize(); i++) { final int row = currentOffsets[i]; nullIterator.advanceIfNeeded(row); if (!nullIterator.hasNext()) { Arrays.fill(retVal, i, offset.getCurrentVectorSize(), false); break; } retVal[i] = row == nullIterator.peekNext(); } } return retVal; }
Source:
<code>public void determineOptions() { String uri = getResourceUri(); if (StringUtils.isNotBlank(uri)) { Response optionsResponse = buildBaseRequestSpecification().options(uri); Headers headers = optionsResponse.getHeaders(); List<Header> allowHeaders = headers.getList(ALLOW); <START> if (allowHeaders.size() == 1) { <END> Header allowHeader = allowHeaders.get(0); String allow = allowHeader.getValue(); if (allow != null) { String[] methods = allow.split("\\s*,\\s*"); for (String method : methods) { options.add(method); } } } else { for (Header allowHeader : allowHeaders) { options.add(allowHeader.getValue()); } } } }</code><technical_language>split Allow header ",". This approach assumes 1 header 1 header both. I fix this if</technical_language>

Target:
public void determineOptions() { String uri = getResourceUri(); if (StringUtils.isNotBlank(uri)) { Response optionsResponse = buildBaseRequestSpecification().options(uri); Headers headers = optionsResponse.getHeaders(); List<Header> allowHeaders = headers.getList(ALLOW); for (Header allowHeader : allowHeaders) { String allow = allowHeader.getValue(); if (allow != null) { String[] methods = allow.split("\\s*,\\s*"); for (String method : methods) { options.add(method); } } } } }
Source:
<code>public void testAddingInvalidElements() { MApplication app = MApplicationFactory.INSTANCE.createApplication(); List l = app.getChildren(); l.add(MBasicFactory.INSTANCE.createWindow()); try { l.add(MBasicFactory.INSTANCE.createPart()); fail("The adding of this should have failed"); <START> } catch (IllegalArgumentException | ArrayStoreException | ClassCastException e) { <END> } catch (Exception e) { throw new RuntimeException(e); } l.add(MBasicFactory.INSTANCE.createWindow()); assertEquals(2, l.size()); }</code><technical_language>This get more readable, format</technical_language>

Target:
public void testAddingInvalidElements() { MApplication app = MApplicationFactory.INSTANCE.createApplication(); List l = app.getChildren(); l.add(MBasicFactory.INSTANCE.createWindow()); try { l.add(MBasicFactory.INSTANCE.createPart()); fail("The adding of this should have failed"); } catch (IllegalArgumentException e) { } catch (ArrayStoreException e) { } catch (ClassCastException e) { } catch (Exception e) { throw new RuntimeException(e); } l.add(MBasicFactory.INSTANCE.createWindow()); assertEquals(2, l.size()); }
Source:
<code>private static CompilerPass createPeepholeOptimizationsPass( AbstractCompiler compiler, String passName) { final boolean late = false; final boolean useTypesForOptimization = compiler.getOptions().useTypesForLocalOptimization; List<AbstractPeepholeOptimization> optimizations = new ArrayList<>(); optimizations.add(new MinimizeExitPoints()); optimizations.add(new PeepholeMinimizeConditions(late)); optimizations.add(new PeepholeSubstituteAlternateSyntax(late)); optimizations.add(new PeepholeReplaceKnownMethods(late, useTypesForOptimization)); optimizations.add(new PeepholeRemoveDeadCode()); if (compiler.getOptions().j2clPassMode.shouldAddJ2clPasses()) { optimizations.add(new J2clEqualitySameRewriterPass(useTypesForOptimization)); optimizations.add(new J2clStringValueOfRewriterPass()); } optimizations.add(new PeepholeFoldConstants(late, useTypesForOptimization)); optimizations.add(new PeepholeCollectPropertyAssignments()); <START> optimizations.add(new PeepholeCombineArrayPush()); <END> return new PeepholeOptimizationsPass(compiler, passName, optimizations); }</code><technical_language>this optimization requires type information work, add list useTypesForOptimization is true</technical_language>

Target:
private static CompilerPass createPeepholeOptimizationsPass( AbstractCompiler compiler, String passName) { final boolean late = false; final boolean useTypesForOptimization = compiler.getOptions().useTypesForLocalOptimization; List<AbstractPeepholeOptimization> optimizations = new ArrayList<>(); optimizations.add(new MinimizeExitPoints()); optimizations.add(new PeepholeMinimizeConditions(late)); optimizations.add(new PeepholeSubstituteAlternateSyntax(late)); optimizations.add(new PeepholeReplaceKnownMethods(late, useTypesForOptimization)); optimizations.add(new PeepholeRemoveDeadCode()); if (compiler.getOptions().j2clPassMode.shouldAddJ2clPasses()) { optimizations.add(new J2clEqualitySameRewriterPass(useTypesForOptimization)); optimizations.add(new J2clStringValueOfRewriterPass()); } optimizations.add(new PeepholeFoldConstants(late, useTypesForOptimization)); optimizations.add(new PeepholeCollectPropertyAssignments()); if (useTypesForOptimization) { optimizations.add(new PeepholeCombineArrayPush()); } return new PeepholeOptimizationsPass(compiler, passName, optimizations); }
Source:
<code>static Stream<Arguments> performSearchParameters() { ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class); when(importFormatPreferences.getFieldContentFormatterPreferences()) .thenReturn(mock(FieldContentFormatterPreferences.class)); List<Set<SearchBasedFetcher>> fetcherParameters = new ArrayList<>(); List<SearchBasedFetcher> list = new ArrayList<>(); list.add(new ArXiv(importFormatPreferences)); list.add(new INSPIREFetcher(importFormatPreferences)); list.add(new GvkFetcher()); list.add(new AstrophysicsDataSystem(importFormatPreferences)); list.add(new MathSciNet(importFormatPreferences)); list.add(new ZbMATH(importFormatPreferences)); list.add(new GoogleScholar(importFormatPreferences)); list.add(new DBLPFetcher(importFormatPreferences)); list.add(new SpringerFetcher()); list.add(new CrossRef()); list.add(new CiteSeer()); list.add(new DOAJFetcher(importFormatPreferences)); list.add(new IEEE(importFormatPreferences)); <START> for (int i = 1; i < list.size(); i++) { <END> fetcherParameters.add(new HashSet<>(list.subList(0, i))); } return fetcherParameters.stream().map(Arguments::of); }</code><technical_language>do some sets? include one, like: +3 subsets matched respective bits? 6543210 0110001 --> list entry 5,4,0 (Not others of it)</technical_language>

Target:
static Stream<Arguments> performSearchParameters() { ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class); when(importFormatPreferences.getFieldContentFormatterPreferences()) .thenReturn(mock(FieldContentFormatterPreferences.class)); List<Set<SearchBasedFetcher>> fetcherParameters = new ArrayList<>(); List<SearchBasedFetcher> list = new ArrayList<>(); list.add(new ArXiv(importFormatPreferences)); list.add(new INSPIREFetcher(importFormatPreferences)); list.add(new GvkFetcher()); list.add(new AstrophysicsDataSystem(importFormatPreferences)); list.add(new MathSciNet(importFormatPreferences)); list.add(new ZbMATH(importFormatPreferences)); list.add(new GoogleScholar(importFormatPreferences)); list.add(new DBLPFetcher(importFormatPreferences)); list.add(new SpringerFetcher()); list.add(new CrossRef()); list.add(new CiteSeer()); list.add(new DOAJFetcher(importFormatPreferences)); list.add(new IEEE(importFormatPreferences)); for (int i = 1; i < Math.pow(2, list.size()); i += 273) { Set<SearchBasedFetcher> fetchers = new HashSet<>(); for (int j = 0; Math.pow(2, j) <= i; j++) { if ((i >> j) % 2 == 1) { fetchers.add(list.get(j)); } } fetcherParameters.add(fetchers); } return fetcherParameters.stream().map(Arguments::of); }
Source:
<code>public void fetch(Callback callback) { <START> long started = System.nanoTime(); <END> if (deferred) { throw new IllegalStateException("Fit cannot be used with fetch."); } if (data.hasImage()) { if (!data.hasPriority()) { data.priority(Priority.LOW); } Request request = createRequest(started); String key = createKey(request, new StringBuilder()); Bitmap bitmap = picasso.quickMemoryCacheCheck(key); if (bitmap != null) { if (picasso.loggingEnabled) { log(OWNER_MAIN, VERB_COMPLETED, request.plainId(), "from " + MEMORY); } if (callback != null) { callback.onSuccess(); } return; } Action action = new FetchAction(picasso, request, skipMemoryCache, key, tag, callback); picasso.submit(action); } }</code><technical_language>completely re-implement fetch. fetch() call fetch(null) implementation</technical_language>

Target:
public void fetch(Callback callback) { long started = System.nanoTime(); if (deferred) { throw new IllegalStateException("Fit cannot be used with fetch."); } if (data.hasImage()) { if (!data.hasPriority()) { data.priority(Priority.LOW); } Request request = createRequest(started); String key = createKey(request, new StringBuilder()); Bitmap bitmap = picasso.quickMemoryCacheCheck(key); if (bitmap != null) { if (picasso.loggingEnabled) { log(OWNER_MAIN, VERB_COMPLETED, request.plainId(), "from " + MEMORY); } if (callback != null) { callback.onSuccess(); } return; } Action action = new FetchAction(picasso, request, memoryPolicy, networkPolicy, tag, key, callback); picasso.submit(action); } }
Source:
<code>public ValidationResult mixedClusterServicesSupported() { <START> boolean mixedClusterEnavled = Config.<Boolean> getValue(ConfigValues.AllowClusterWithVirtGlusterEnabled); <END> return ValidationResult.failWith(VdcBllMessages.VDS_GROUP_ENABLING_BOTH_VIRT_AND_GLUSTER_SERVICES_NOT_ALLOWED) .when(cluster.supportsGlusterService() && cluster.supportsVirtService() && !mixedClusterEnavled); }</code><technical_language>typo s/Enavled/Enabled</technical_language>

Target:
public ValidationResult mixedClusterServicesSupported() { boolean mixedClusterEnabled = Config.<Boolean> getValue(ConfigValues.AllowClusterWithVirtGlusterEnabled); return ValidationResult.failWith(VdcBllMessages.VDS_GROUP_ENABLING_BOTH_VIRT_AND_GLUSTER_SERVICES_NOT_ALLOWED) .when(cluster.supportsGlusterService() && cluster.supportsVirtService() && !mixedClusterEnabled); }
Source:
<code>public void eventReceived(Object output) { if (output instanceof MIOutput) { MIOOBRecord[] records = ((MIOutput)output).getMIOOBRecords(); for (MIOOBRecord r : records) { if (r instanceof MINotifyAsyncOutput) { MINotifyAsyncOutput notifyOutput = (MINotifyAsyncOutput)r; String asyncClass = notifyOutput.getAsyncClass(); if ("record-started".equals(asyncClass) || "record-stopped".equals(asyncClass)) { if ("record-stopped".equals(asyncClass)) { fReverseTraceMethod = ReverseTraceMethod.STOP_TRACE; setReverseModeEnabled(false); } else { getConnection().queueCommand( fCommandFactory.createCLIInfoRecord(getConnection().getContext()), <START> new DataRequestMonitor<CLIInfoRecordInfo>(getExecutor(), null) { <END> @Override public void handleSuccess() { CLIInfoRecordInfo output = getData(); fReverseTraceMethod = output.getReverseMethod(); setReverseModeEnabled(true); } }); } } } } } }</code><technical_language>In rare case of error this command in wrong state. defaulting FULL_TRACE in case. I user's point of view better</technical_language>

Target:
public void eventReceived(Object output) { if (output instanceof MIOutput) { MIOOBRecord[] records = ((MIOutput)output).getMIOOBRecords(); for (MIOOBRecord r : records) { if (r instanceof MINotifyAsyncOutput) { MINotifyAsyncOutput notifyOutput = (MINotifyAsyncOutput)r; String asyncClass = notifyOutput.getAsyncClass(); if ("record-started".equals(asyncClass) || "record-stopped".equals(asyncClass)) { if ("record-stopped".equals(asyncClass)) { fReverseTraceMethod = ReverseTraceMethod.STOP_TRACE; setReverseModeEnabled(false); } else { getConnection().queueCommand( fCommandFactory.createCLIInfoRecord(getConnection().getContext()), new DataRequestMonitor<CLIInfoRecordInfo>(getExecutor(), null) { @Override public void handleCompleted() { if (isSuccess()) { CLIInfoRecordInfo output = getData(); fReverseTraceMethod = output.getReverseMethod(); setReverseModeEnabled(true); } else { fReverseTraceMethod = ReverseTraceMethod.FULL_TRACE; } } }); } } } } } }
Source:
<code>public void runReadWithFilterUsingUri() throws Exception { final CountDownLatch latch = new CountDownLatch(1); HttpProviderFactory factory = mock(HttpProviderFactory.class); when(factory.get(anyObject())).thenReturn(mock(HttpProvider.class)); RestAdapter<Data> adapter = new RestAdapter<Data>(Data.class, url); Object restRunner = UnitTestUtils.getPrivateField(adapter, "restRunner"); UnitTestUtils.setPrivateField(restRunner, "httpProviderFactory", factory); ReadFilter filter = new ReadFilter(); <START> filter.setLinkUri(URI.create("rail%2Ftrails?limit=10&where=%7B%22model%22:%22BMW%22%7D")); <END> adapter.read(filter, new Callback<List<Data>>() { @Override public void onSuccess(List<Data> data) { latch.countDown(); } @Override public void onFailure(Exception e) { latch.countDown(); } }); latch.await(500, TimeUnit.MILLISECONDS); verify(factory).get(eq(new URL(url.toString() + "rail%2Ftrails?limit=10&where=%7B%22model%22:%22BMW%22%7D"))); }</code><technical_language>@pilhuhn Reusing test is fine. @anuj1708 test needs @Test annotation run though</technical_language>

Target:
public void runReadWithFilterUsingUri() throws Exception { final CountDownLatch latch = new CountDownLatch(1); HttpProviderFactory factory = mock(HttpProviderFactory.class); when(factory.get(anyObject())).thenReturn(mock(HttpProvider.class)); RestAdapter<Data> adapter = new RestAdapter<Data>(Data.class, url); Object restRunner = UnitTestUtils.getPrivateField(adapter, "restRunner"); UnitTestUtils.setPrivateField(restRunner, "httpProviderFactory", factory); ReadFilter filter = new ReadFilter(); filter.setLinkUri(URI.create("rail%2Ftrails?limit=10&where=%7B%22model%22:%22BMW%22%7D")); adapter.read(filter, new Callback<List<Data>>() { @Override public void onSuccess(List<Data> data) { latch.countDown(); } @Override public void onFailure(Exception e) { latch.countDown(); } }); latch.await(500, TimeUnit.MILLISECONDS); verify(factory).get(Mockito.argThat(new ObjectVarArgsMatcher(new URL(url.toString() + "rail%2Ftrails?limit=10&where=%7B%22model%22:%22BMW%22%7D"), 60000))); }
Source:
<code>public HeliumBundleFactory( ZeppelinConfiguration conf, File nodeInstallationDir, File moduleDownloadPath) throws TaskRunnerException { this.heliumLocalRepoDirectory = new File(moduleDownloadPath, HELIUM_LOCAL_REPO); this.heliumBundleDirectory = new File(heliumLocalRepoDirectory, HELIUM_BUNDLES_DIR); this.heliumLocalModuleDirectory = new File(heliumLocalRepoDirectory, HELIUM_LOCAL_MODULE_DIR); this.yarnCacheDir = new File(heliumLocalRepoDirectory, YARN_CACHE_DIR); <START> this.defaultNpmRegistryUrl = conf.getHeliumNpmRegistryUrl(); <END> this.defaultNpmRegistryRepo = conf.getHeliumNpmRegistryRepo(); nodeInstallationDirectory = (nodeInstallationDir == null) ? heliumLocalRepoDirectory : nodeInstallationDir; frontEndPluginFactory = new FrontendPluginFactory( heliumLocalRepoDirectory, nodeInstallationDirectory); gson = new Gson(); }</code><technical_language>need other proxy settings for - node installation - npm installation (not npm packages, npm itself) - yarn installation include in this PR? FYI, <LINK_0></technical_language>

Target:
public HeliumBundleFactory( ZeppelinConfiguration conf, File nodeInstallationDir, File moduleDownloadPath) throws TaskRunnerException { this.heliumLocalRepoDirectory = new File(moduleDownloadPath, HELIUM_LOCAL_REPO); this.heliumBundleDirectory = new File(heliumLocalRepoDirectory, HELIUM_BUNDLES_DIR); this.heliumLocalModuleDirectory = new File(heliumLocalRepoDirectory, HELIUM_LOCAL_MODULE_DIR); this.yarnCacheDir = new File(heliumLocalRepoDirectory, YARN_CACHE_DIR); this.defaultNodeInstallerUrl = conf.getHeliumNodeInstallerUrl(); this.defaultNpmInstallerUrl = conf.getHeliumNpmInstallerUrl(); this.defaultYarnInstallerUrl = conf.getHeliumYarnInstallerUrl(); nodeInstallationDirectory = (nodeInstallationDir == null) ? heliumLocalRepoDirectory : nodeInstallationDir; frontEndPluginFactory = new FrontendPluginFactory( heliumLocalRepoDirectory, nodeInstallationDirectory); gson = new Gson(); }
Source:
<code>@Override public PMMLExportable getPMMLExportable() throws MLPmmlExportException { if (model instanceof PMMLExportable) { <START> return (PMMLExportable)model; <END> } else { throw new MLPmmlExportException("PMML export not supported for model type"); } }</code><technical_language>formatted</technical_language>

Target:
public PMMLExportable getPMMLExportable() throws MLPmmlExportException { if (model instanceof PMMLExportable) { return (PMMLExportable)model; } else { throw new MLPmmlExportException("PMML export not supported for model type"); } }
Source:
<code>public void testCreateLabelWhereNoneExists() throws UnsupportedOperationException, Exception { PID pid = makePid(); Path file = createTempFile("test", "txt"); <START> FileObject fileObj = repositoryObjectFactory.createFileObject(pid, ModelFactory.createDefaultModel()); <END> fileObj.addOriginalFile(file.toUri(), filename, mimetype, null, null); String label = "work_filename"; MvcResult result = mvc.perform(put("/edit/filename/" + pid.getUUID()) .param("label", label)) .andExpect(status().is2xxSuccessful()) .andReturn(); Map<String, Object> respMap = getMapFromResponse(result); assertEquals(pid.getUUID(), respMap.get("pid")); assertEquals("editLabel", respMap.get("action")); assertEquals("work_filename", fileObj.getOriginalFile().getModel().getRequiredProperty( fileObj.getOriginalFile().getResource(), Ebucore.filename).getLiteral().toString()); }</code><technical_language>pass in null for model</technical_language>

Target:
public void testCreateLabelWhereNoneExists() throws UnsupportedOperationException, Exception { PID pid = makePid(); Path file = createTempFile("test", "txt"); FileObject fileObj = repositoryObjectFactory.createFileObject(pid, null); fileObj.addOriginalFile(file.toUri(), filename, mimetype, null, null); String label = "work_filename"; MvcResult result = mvc.perform(put("/edit/filename/" + pid.getUUID()) .param("label", label)) .andExpect(status().is2xxSuccessful()) .andReturn(); Map<String, Object> respMap = getMapFromResponse(result); assertEquals(pid.getUUID(), respMap.get("pid")); assertEquals("editLabel", respMap.get("action")); assertEquals("work_filename", fileObj.getOriginalFile().getResource().getProperty(Ebucore.filename) .getLiteral().toString()); }
Source:
<code>public void nodeSkipped(JupiterEngineExecutionContext context, TestDescriptor descriptor, SkipResult result) { <START> invokeTestWatchers(context, t -> { <END> t.testSkipped(createTestIdentifier(), result.getReason(), context.getExtensionContext()); }); }</code><technical_language>Please rename t watcher</technical_language>

Target:
public void nodeSkipped(JupiterEngineExecutionContext context, TestDescriptor descriptor, SkipResult result) { if (context != null) { invokeTestWatchers(context, watcher -> { watcher.testDisabled(context.getExtensionContext(), result.getReason()); }, false); } }
Source:
<code><START> public String getGeneralProblemsMessage() { <END> StringBuilder message = new StringBuilder(); for (Object error: getErrors()) { message.append(error.toString()).append("\n"); } for (Object warning: getWarnings()) { message.append(warning.toString()).append("\n"); } return message.toString(); }</code><technical_language>public start. I a rule public methods I can. declare some method public remove/rename/change arguments of this method. declare visibility public</technical_language>

Target:
private String getGeneralProblemsMessage() { StringBuilder message = new StringBuilder(); addMessages(message, getErrors().values()); addMessages(message, getWarnings().values()); return message.toString(); }
Source:
<code>public void getAttribute_shouldReturnNullWhenExistingPersonAttributeTypeIsVoided () throws Exception { Person person = personHelper(true, 1, 2, 3, "name1", "name2", "name3", "value1", "value2", "value3"); PersonAttributeType type = new PersonAttributeType(new Integer(3)); type.setName("name3"); <START> Assert.assertNull(null, person.getAttribute(type)); <END> }</code><technical_language>This is incorrect, Assert.assertNull(person.getAttribute(type));</technical_language>

Target:
public void getAttribute_shouldReturnNullWhenExistingPersonAttributeTypeIsVoided () throws Exception { Person person = personHelper(true, 1, 2, 3, "name1", "name2", "name3", "value1", "value2", "value3"); PersonAttributeType type = new PersonAttributeType(new Integer(3)); type.setName("name3"); Assert.assertNull(person.getAttribute(type)); }
Source:
<code>private EcoTopologyDefinition loadTopologyFromYaml(Yaml yaml, InputStream inputStream, InputStream propsIn, boolean envFilter) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); int b; while ((b = inputStream.read()) != -1) { bos.write(b); } String yamlDefinitionStr = bos.toString(); if (propsIn != null) { <START> LOG.info("Performing property substitution."); <END> Properties props = new Properties(); props.load(propsIn); for (Object key : props.keySet()) { yamlDefinitionStr = yamlDefinitionStr.replace("${" + key + "}", props.getProperty((String) key)); } } else { LOG.info("Not performing property substitution."); } if (envFilter) { LOG.info("Performing environment variable substitution."); Map<String, String> envs = System.getenv(); for (String key : envs.keySet()) { yamlDefinitionStr = yamlDefinitionStr.replace("${ENV-" + key + "}", envs.get(key)); } } else { LOG.info("Not performing environment variable substitution."); } return (EcoTopologyDefinition) yaml.load(yamlDefinitionStr); }</code><technical_language>LOG.info - I assuming prints information eco topology submission</technical_language>

Target:
private EcoTopologyDefinition loadTopologyFromYaml(Yaml yaml, InputStream inputStream, InputStream propsIn, boolean envFilter) throws IOException { LOG.info("Parsing eco config file"); ByteArrayOutputStream bos = new ByteArrayOutputStream(); int b; while ((b = inputStream.read()) != -1) { bos.write(b); } String yamlDefinitionStr = bos.toString(); if (propsIn != null) { LOG.info("Performing property substitution."); Properties props = new Properties(); props.load(propsIn); for (Object key : props.keySet()) { yamlDefinitionStr = yamlDefinitionStr.replace("${" + key + "}", props.getProperty((String) key)); } } else { LOG.info("Not performing property substitution."); } if (envFilter) { LOG.info("Performing environment variable substitution."); Map<String, String> envs = System.getenv(); for (String key : envs.keySet()) { yamlDefinitionStr = yamlDefinitionStr.replace("${ENV-" + key + "}", envs.get(key)); } } else { LOG.info("Not performing environment variable substitution."); } return (EcoTopologyDefinition) yaml.load(yamlDefinitionStr); }
Source:
<code>private boolean updateThumbnailEvent(CatalogModifyEvent event) { for (int i = 0; i < event.getNewValues().size(); i++) { if (event.getNewValues().get(i) instanceof MetadataMap) { MetadataMap oldMap = (MetadataMap)event.getOldValues().get(i); MetadataMap newMap = (MetadataMap)event.getNewValues().get(i); if (oldMap.containsKey(Metadata.THUMBNAIL) && newMap.containsKey(Metadata.THUMBNAIL) <START> && oldMap.get(Metadata.THUMBNAIL) != newMap.get(Metadata.THUMBNAIL) ) { <END> return true; } if ((oldMap.containsKey(Metadata.THUMBNAIL) && !newMap.containsKey(Metadata.THUMBNAIL)) || (!oldMap.containsKey(Metadata.THUMBNAIL) && newMap.containsKey(Metadata.THUMBNAIL))) { return true; } if (oldMap.containsKey(Metadata.THUMBNAIL) && newMap.containsKey(Metadata.THUMBNAIL) && oldMap.get(Metadata.THUMBNAIL) == newMap.get(Metadata.THUMBNAIL) ) { newMap.remove(Metadata.THUMBNAIL); } } } return false; }</code><technical_language>object equality comparison</technical_language>

Target:
private boolean updateThumbnailEvent(CatalogModifyEvent event) { for (int i = 0; i < event.getNewValues().size(); i++) { if (event.getNewValues().get(i) instanceof MetadataMap) { MetadataMap oldMap = (MetadataMap)event.getOldValues().get(i); MetadataMap newMap = (MetadataMap)event.getNewValues().get(i); if (updateMetadataMap(oldMap, newMap)) { return true; } } } return false; }
Source:
<code>public static void assertEqualsNoEol(String expected, String actual) { <START> assertEquals(normalizeEolInTextBlock(expected, EOL), normalizeEolInTextBlock(actual, EOL)); <END> }</code><technical_language>is compare a string "\n"'s in some output contains some kind of line ending, is normalized "\n" match. If I remember correctly :-)</technical_language>

Target:
public static void assertEqualsNoEol(String expected, String actual) { assertEqualsStringIgnoringEol(expected, actual); }
Source:
<code>public Collection<AKContentOverride> getContentOverrides() { <START> return this.contentOverrides; <END> }</code><technical_language>a cosmetic here. I great encapsulated methods (removeContentOverride, setContentOverrides, addContentOverride). methods I unmodifiable collection returning getContentOverrides clients accidently modify contentOverrides collection directly: public Collection<AKContentOverride> getContentOverrides() { return Collections.unmodifiableCollection(this.contentOverrides); } for values() sets returned for fields: pools, products</technical_language>

Target:
public Collection<AKContentOverride> getContentOverrides() { return Collections.unmodifiableCollection(this.contentOverrides); }
Source:
<code>public static boolean showMarkers(IWorkbenchPage page, IMarker[] markers, boolean showView) { boolean returnValue = false; IMarker marker = <START> markers[0]; <END> try { String viewId = getViewId(marker); IMarker[] markersSameView = getMarkersOfView(viewId, markers); if (viewId == null) viewId = IPageLayout.ID_PROBLEM_VIEW; IViewPart view = showView ? page.showView(viewId) : page .findView(viewId); if (view != null) returnValue = MarkerSupportInternalUtilities.showMarkers(view, markersSameView); } catch (CoreException e) { Policy.handle(e); } return returnValue; }</code><technical_language>Please add check if markers is null empty marker is null return in this case</technical_language>

Target:
public static boolean showMarkers(IWorkbenchPage page, IMarker[] markers, boolean showView) { if (null == markers || 0 == markers.length || null == markers[0]) return false; boolean returnValue = false; try { String viewId = getViewId(markers[0]); IMarker[] markersSameView = getMarkersOfView(viewId, markers); if (viewId == null) viewId = IPageLayout.ID_PROBLEM_VIEW; IViewPart view = showView ? page.showView(viewId) : page .findView(viewId); if (view != null) returnValue = MarkerSupportInternalUtilities.showMarkers(view, markersSameView); } catch (CoreException e) { Policy.handle(e); } return returnValue; }
Source:
<code>void propogateInputChange() { if (!inputChangeListeners.isEmpty()) { Object[] allListeners = inputChangeListeners.getListeners(); for (Object <START> allListener : <END> allListeners) { final ICompareInputChangeListener listener = (ICompareInputChangeListener) allListener; SafeRunner.run(new ISafeRunnable() { @Override public void run() throws Exception { listener.compareInputChanged((ICompareInput)SaveableCompareEditorInput.this.getCompareResult()); } @Override public void handleException(Throwable exception) { } }); } } }</code><technical_language>listener</technical_language>

Target:
void propogateInputChange() { if (!inputChangeListeners.isEmpty()) { Object[] allListeners = inputChangeListeners.getListeners(); for (Object l : allListeners) { final ICompareInputChangeListener listener = (ICompareInputChangeListener)l; SafeRunner.run(new ISafeRunnable() { @Override public void run() throws Exception { listener.compareInputChanged((ICompareInput)SaveableCompareEditorInput.this.getCompareResult()); } @Override public void handleException(Throwable exception) { } }); } } }
Source:
<code>public void stop() { <START> log.info("Stopping DerbyConnector...."); <END> storage.stop(); }</code><technical_language>dots</technical_language>

Target:
public void stop() { log.info("Stopping DerbyConnector..."); storage.stop(); }
Source:
<code><START> public TaskListenerExecutor getObject() { <END> beforeTaskInstances = new HashMap<>(); afterTaskInstances = new HashMap<>(); failedTaskInstances = new HashMap<>(); initializeExecutor(); return new TaskListenerExecutor(beforeTaskInstances, afterTaskInstances, failedTaskInstances); }</code><technical_language>For this case, a default (no arg) constructor TaskListenerExecutor a good idea</technical_language>

Target:
public TaskListenerExecutor getObject() { this.beforeTaskInstances = new HashMap<>(); this.afterTaskInstances = new HashMap<>(); this.failedTaskInstances = new HashMap<>(); initializeExecutor(); return new TaskListenerExecutor(beforeTaskInstances, afterTaskInstances, failedTaskInstances); }
Source:
<code>public void visitFilter(VisitableXmlElement<FilterType> visitable) { JAXBElement<FilterType> element = visitable.getElement(); String localPart = element.getName().getLocalPart(); logLocalPart(localPart); FilterType filterType = element.getValue(); JAXBElement<?> root = Stream.of( filterType.getComparisonOps(), filterType.getLogicOps(), filterType.getSpatialOps(), filterType.getTemporalOps()) .filter(Objects::nonNull) .findAny() .orElse(null); if (root != null) { <START> LOGGER.debug("Valid root found, beginning traversal..."); <END> makeVisitable(root).accept(this); return; } handleUnsupported(filterType.getId()); handleUnsupported(filterType.getExtensionOps()); handleUnsupported(filterType.getFunction()); throw new FilterProcessingException("No valid starting element for the filter was found"); }</code><technical_language>trace</technical_language>

Target:
public void visitFilter(VisitableXmlElement<FilterType> visitable) { JAXBElement<FilterType> element = visitable.getElement(); String localPart = element.getName().getLocalPart(); traceLocalPart(localPart); FilterType filterType = element.getValue(); JAXBElement<?> root = Stream.of( filterType.getComparisonOps(), filterType.getLogicOps(), filterType.getSpatialOps(), filterType.getTemporalOps()) .filter(Objects::nonNull) .findAny() .orElse(null); if (root != null) { LOGGER.trace("Valid root found, beginning traversal..."); makeVisitable(root).accept(this); return; } handleUnsupported(filterType.getId()); handleUnsupported(filterType.getExtensionOps()); handleUnsupported(filterType.getFunction()); throw new FilterProcessingException("No valid starting element for the filter was found"); }
Source:
<code>public void getConditionsByPatientUuid_shouldReturnListOfActiveConditions() { Condition condition = new Condition(); IdType id = new IdType(); id.setValue(CONDITION_UUID); condition.setId(id); Patient patientRef = Context.getPatientService().getPatient(2); Reference patient = FHIRUtils.buildPatientOrPersonResourceReference(patientRef); condition.setSubject(patient); condition.setClinicalStatus(Condition.ConditionClinicalStatus.ACTIVE); condition.setCode(new CodeableConcept().addCoding( new Coding().setCode("999").setDisplay("NO").setSystem(FHIRConstants.OPENMRS_URI)).setText("NO")); getService().createFHIRCondition(condition); <START> List<Condition> activeConditions = getService().getConditionsByPatientUuid(patientRef.getUuid()); <END> assertFalse(activeConditions.isEmpty()); assertEquals(activeConditions.get(0).getClinicalStatus().getDisplay(), "Active"); assertEquals(activeConditions.get(0).getClinicalStatus().name(), "ACTIVE"); }</code><technical_language>assert list empty saving? saving</technical_language>

Target:
public void getConditionsByPatientUuid_shouldReturnListOfActiveConditions() { Condition condition = new Condition(); IdType id = new IdType(); id.setValue(CONDITION_UUID); condition.setId(id); Patient patient = Context.getPatientService().getPatient(2); Reference patientReference = FHIRUtils.buildPatientOrPersonResourceReference(patient); condition.setSubject(patientReference); condition.setClinicalStatus(Condition.ConditionClinicalStatus.ACTIVE); condition.setCode(new CodeableConcept().addCoding( new Coding().setCode("999").setDisplay("NO").setSystem(FHIRConstants.OPENMRS_URI)).setText("NO")); List<Condition> activeConditions = getService().getConditionsByPatientUuid(patient.getUuid()); assertTrue(activeConditions.isEmpty()); getService().createFHIRCondition(condition); activeConditions = getService().getConditionsByPatientUuid(patient.getUuid()); assertNotNull(activeConditions); assertFalse(activeConditions.isEmpty()); assertEquals(activeConditions.get(0).getClinicalStatus().getDisplay(), "Active"); assertEquals(activeConditions.get(0).getClinicalStatus().name(), "ACTIVE"); }