auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public FeedAdapter(String target, FeedConfiguration feedConfiguration, FeedSource feedSource, FeedPublisher feedPublisher, List<AdapterResponseInterceptor<Feed>>adapterResponseInterceptorList) { super(target); if ( adapterResponseInterceptorList == null ) { throw new IllegalArgumentException("adapterResponseInterceptorList argument must not be null"); } if ( adapterResponseInterceptorList.isEmpty() ) { throw new IllegalArgumentException("adapterResponseInterceptorList argument must contain at least one element"); <START> } <END> this.feedConfiguration = feedConfiguration; final List<String> allowedMethodsList = new LinkedList<String>(); if (feedSource != null) { this.feedSource = feedSource; allowedMethodsList.add("GET"); } else { this.feedSource = DisabledFeedSource.getInstance(); } if (feedPublisher != null) { this.feedPublisher = feedPublisher; allowedMethodsList.add("PUT"); allowedMethodsList.add("POST"); allowedMethodsList.add("DELETE"); } else { this.feedPublisher = DisabledPublisher.getInstance(); } final String[] allowedMethods = allowedMethodsList.toArray(new String[allowedMethodsList.size()]); feedResponseHandler = new FeedResponseHandler(allowedMethods, adapterResponseInterceptorList); entryResponseHandler = new EntryResponseHandler(allowedMethods); emptyBodyResponseHandler = new EmptyBodyResponseHandler(allowedMethods); }</code><technical_language>curious. is this check necessary</technical_language>

Target:
public FeedAdapter(String target, FeedConfiguration feedConfiguration, FeedSource feedSource, FeedPublisher feedPublisher, List<AdapterResponseInterceptor<Feed>>adapterResponseInterceptorList) { super(target); if ( adapterResponseInterceptorList == null ) { throw new IllegalArgumentException("adapterResponseInterceptorList argument must not be null"); } this.feedConfiguration = feedConfiguration; final List<String> allowedMethodsList = new LinkedList<String>(); if (feedSource != null) { this.feedSource = feedSource; allowedMethodsList.add("GET"); } else { this.feedSource = DisabledFeedSource.getInstance(); } if (feedPublisher != null) { this.feedPublisher = feedPublisher; allowedMethodsList.add("PUT"); allowedMethodsList.add("POST"); allowedMethodsList.add("DELETE"); } else { this.feedPublisher = DisabledPublisher.getInstance(); } final String[] allowedMethods = allowedMethodsList.toArray(new String[allowedMethodsList.size()]); feedResponseHandler = new FeedResponseHandler(allowedMethods, adapterResponseInterceptorList); entryResponseHandler = new EntryResponseHandler(allowedMethods); emptyBodyResponseHandler = new EmptyBodyResponseHandler(allowedMethods); }
Source:
<code>public BlockScopeEnv(Env parent, int localsSize) { super(parent); if (localsSize <= 0) { locals = Collections.emptyMap(); types = Collections.emptyMap(); } else { <START> locals = new HashMap<String, Object>(localsSize); <END> types = new HashMap<String, Class>(localsSize); } }</code><technical_language>I understanding initialCapacity. If intended localsSize expected number of entries, want avoid rehashing, need localsSize * 4 / 3 + 1</technical_language>

Target:
public BlockScopeEnv(Env parent, int localsSize) { super(parent); if (localsSize <= 0) { locals = Collections.EMPTY_MAP; types = Collections.EMPTY_MAP; } else { locals = Maps.newHashMapWithExpectedSize(localsSize); types = Maps.newHashMapWithExpectedSize(localsSize); } }
Source:
<code>public static boolean isProcessRunning(Platform platform, int pid) { try { final Process pidof; if (platform == Platform.Linux || platform == Platform.OS_X) { pidof = Runtime.getRuntime().exec( new String[] { "kill", "-0", "" + pid }); return pidof.waitFor() == 0; } else { <START> final String cmd = "tasklist.exe /FI \"PID eq " + pid <END> + "\" /FO CSV"; logger.fine("Command: " + cmd); pidof = Runtime.getRuntime().exec(cmd); int returnStatus = pidof.waitFor(); String output = CharStreams .toString(new InputSupplier<InputStreamReader>() { public InputStreamReader getInput() throws IOException { return new InputStreamReader( pidof.getInputStream()); } }); if (logger.isLoggable(Level.FINE)) { logger.fine("returnStatus: " + returnStatus); logger.fine("tasklist.exe: " + output); String error = CharStreams .toString(new InputSupplier<InputStreamReader>() { public InputStreamReader getInput() throws IOException { return new InputStreamReader( pidof.getErrorStream()); } }); logger.fine("tasklist.exe error: " + error); } return output.contains("" + pid); } } catch (IOException e) { logger.severe("IOException when trying to get process status:" + e.getMessage()); e.printStackTrace(); } catch (InterruptedException e) { logger.severe("IOException when trying to get process status:" + e.getMessage()); e.printStackTrace(); } return false; }</code><technical_language>reuse stuff here.. build a command line, pipe io somewhere.</technical_language>

Target:
public static boolean isProcessRunning(Platform platform, int pid) { try { final Process pidof; if (platform == Platform.Linux || platform == Platform.OS_X) { pidof = Runtime.getRuntime().exec( new String[] { "kill", "-0", "" + pid }); return pidof.waitFor() == 0; } else { final String[] cmd = { "tasklist.exe", "/FI", "PID eq " + pid ,"/FO", "CSV" }; logger.finer("Command: " + Arrays.asList(cmd)); ProcessBuilder processBuilder = ProcessControl .newProcessBuilder(Arrays.asList(cmd), true); Process process = processBuilder.start(); LogWatchStreamProcessor logWatch = new LogWatchStreamProcessor(""+pid, new HashSet<String>(), StreamToLineProcessor.wrap(Processors.silent())); Processors.connect(new InputStreamReader(process.getInputStream()), logWatch); logWatch.waitForResult(2000); logger.finer("logWatch output: " + logWatch.getOutput()); return logWatch.isInitWithSuccess(); } } catch (IOException e) { logger.severe("IOException when trying to get process status:" + e.getMessage()); e.printStackTrace(); } catch (InterruptedException e) { logger.severe("IOException when trying to get process status:" + e.getMessage()); e.printStackTrace(); } return false; }
Source:
<code>private AbstractTreeIterator getTreeIterator(String name) throws IOException { final ObjectId id = db.resolve(name); if (id == null) throw new IllegalArgumentException(name); final CanonicalTreeParser p = new CanonicalTreeParser(); <START> try (final ObjectReader or = db.newObjectReader()) { <END> p.reset(or, new RevWalk(db).parseTree(id)); return p; } }</code><technical_language>(optional)</technical_language>

Target:
private AbstractTreeIterator getTreeIterator(String name) throws IOException { final ObjectId id = db.resolve(name); if (id == null) throw new IllegalArgumentException(name); final CanonicalTreeParser p = new CanonicalTreeParser(); try (ObjectReader or = db.newObjectReader()) { p.reset(or, new RevWalk(db).parseTree(id)); return p; } }
Source:
<code>@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); result = SQLite.select().from(Result.class).where(Result_Table.id.eq(getIntent().getIntExtra(ID, 0))).querySingle(); assert result != null; setTheme(result.getTestSuite().getThemeLight()); setContentView(R.layout.activity_result_detail); ButterKnife.bind(this); setSupportActionBar(toolbar); ActionBar bar = getSupportActionBar(); if (bar != null) { bar.setDisplayHomeAsUpEnabled(true); bar.setTitle(result.getTestSuite().getTitle()); } pager.setAdapter(new ResultHeaderAdapter()); tabLayout.setupWithViewPager(pager); LinearLayoutManager layoutManager = new LinearLayoutManager(this); recycler.setLayoutManager(layoutManager); recycler.addItemDecoration(new DividerItemDecoration(this, layoutManager.getOrientation())); result.is_viewed = true; result.save(); items = new ArrayList<>(); adapter = new HeterogeneousRecyclerAdapter<>(this, items); recycler.setAdapter(adapter); <START> snackbar = Snackbar.make(coordinatorLayout, R.string.Snackbar_ResultsSomeNotUploaded_Text, Snackbar.LENGTH_INDEFINITE).setAction(R.string.Snackbar_ResultsSomeNotUploaded_UploadAll, v1 -> new MKCollectorResubmitSettingsAsyncTask(this).execute(result.id, null)); <END> }</code><technical_language>wrapped</technical_language>

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); result = SQLite.select().from(Result.class) .where(Result_Table.id.eq(getIntent().getIntExtra(ID, 0))).querySingle(); assert result != null; setTheme(result.getTestSuite().getThemeLight()); setContentView(R.layout.activity_result_detail); ButterKnife.bind(this); setSupportActionBar(toolbar); ActionBar bar = getSupportActionBar(); if (bar != null) { bar.setDisplayHomeAsUpEnabled(true); bar.setTitle(result.getTestSuite().getTitle()); } pager.setAdapter(new ResultHeaderAdapter()); tabLayout.setupWithViewPager(pager); LinearLayoutManager layoutManager = new LinearLayoutManager(this); recycler.setLayoutManager(layoutManager); recycler.addItemDecoration(new DividerItemDecoration(this, layoutManager.getOrientation())); result.is_viewed = true; result.save(); items = new ArrayList<>(); adapter = new HeterogeneousRecyclerAdapter<>(this, items); recycler.setAdapter(adapter); snackbar = Snackbar.make(coordinatorLayout, R.string.Snackbar_ResultsSomeNotUploaded_Text, Snackbar.LENGTH_INDEFINITE) .setAction(R.string.Snackbar_ResultsSomeNotUploaded_UploadAll, v1 -> runMKCollectorResubmitSettingsAsyncTask()); }
Source:
<code>protected void executeQueryCommand() { VDSReturnValue returnValue = getBackendResourceManager().RunVdsCommand(VDSCommandType.GetGlusterVolumeAdvancedDetails, new GlusterVolumeAdvancedDetailsVDSParameters(getClusterUtils() <START> .getUpServer(getParameters().getClusterId()).getId(), getParameters().getClusterId(), <END> getParameters().getVolumeName(), getParameters().getBrickName(), getParameters().detailsRequired())); getQueryReturnValue().setReturnValue(returnValue.getReturnValue()); }</code><technical_language>Throw exception if is server found</technical_language>

Target:
protected void executeQueryCommand() { try { VDSReturnValue returnValue = getBackendResourceManager().RunVdsCommand(VDSCommandType.GetGlusterVolumeAdvancedDetails, new GlusterVolumeAdvancedDetailsVDSParameters(getUpServerId(), getParameters().getClusterId(), getParameters().getVolumeName(), getParameters().getBrickName(), getParameters().detailsRequired())); getQueryReturnValue().setReturnValue(returnValue.getReturnValue()); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>private void formatAnnotation(JFieldVar field, JDefinedClass clazz, String propertyName, JsonNode node) { <START> String format = node.has("format") == true ? node.get("format").asText() : null; <END> if ("date-time".equalsIgnoreCase(format)) { ruleFactory.getAnnotator().jsonFormat(field, clazz, propertyName, node); } }</code><technical_language>simplify this java String format = node.path("format").asText();</technical_language>

Target:
private void formatAnnotation(JFieldVar field, JDefinedClass clazz, String propertyName, JsonNode node) { String format = node.path("format").asText(); if ("date-time".equalsIgnoreCase(format)) { ruleFactory.getAnnotator().dateField(field, node); } }
Source:
<code>public static QueryStatusEncoding submitted(final QueryEncoding query) { QueryStatusEncoding ret = new QueryStatusEncoding(); ret.rawQuery = query.rawQuery; ret.logicalRa = query.logicalRa; ret.plan = query.plan; <START> ret.profilingMode = query.profilingMode.toString(); <END> ret.ftMode = query.ftMode.toString(); ret.submitTime = DateTimeUtils.nowInISO8601(); ret.status = Status.ACCEPTED; ret.language = query.language; return ret; }</code><technical_language>. here, need .toString() if a PROFILING_MODE instead</technical_language>

Target:
public static QueryStatusEncoding submitted(final QueryEncoding query) { QueryStatusEncoding ret = new QueryStatusEncoding(); ret.rawQuery = query.rawQuery; ret.logicalRa = query.logicalRa; ret.plan = query.plan; ret.profilingMode = query.profilingMode; ret.ftMode = query.ftMode.toString(); ret.submitTime = DateTime.now(); ret.status = Status.ACCEPTED; ret.language = query.language; return ret; }
Source:
<code>private OmniGradleBuild fetchGradleBuildStructure(IProgressMonitor monitor) { org.eclipse.buildship.core.workspace.GradleBuild gradleBuild = CorePlugin.gradleWorkspaceManager().getGradleBuild(this.fixedAttributes); GradleBuild model = gradleBuild.getModelProvider().fetchModel(GradleBuild.class, FetchStrategy.FORCE_RELOAD, getToken(), monitor); <START> return DefaultOmniGradleBuild.from(model); <END> }</code><technical_language>ModelProvider return correct model types. wrapping happen</technical_language>

Target:
private OmniGradleBuild fetchGradleBuildStructure(IProgressMonitor monitor) { ModelProvider modelProvider = CorePlugin.gradleWorkspaceManager().getGradleBuild(this.fixedAttributes).getModelProvider(); return modelProvider.fetchGradleBuild(FetchStrategy.FORCE_RELOAD, getToken(), monitor); }
Source:
<code>public ArrayList<ApplicationRecord> getVisibleAppRecords() { <START> ArrayList<ApplicationRecord> visible = new ArrayList<ApplicationRecord>(); <END> for (ApplicationRecord r : getInstalledAppRecords()) { if (!r.isArchived()) { visible.add(r); } } System.out.println("NUM VISIBLE APPS FOUND: " + visible.size()); return visible; }</code><technical_language>mixing tabs & spaces</technical_language>

Target:
public ArrayList<ApplicationRecord> getVisibleAppRecords() { ArrayList<ApplicationRecord> visible = new ArrayList<>(); for (ApplicationRecord r : getInstalledAppRecords()) { if (r.isVisible()) { visible.add(r); } } return visible; }
Source:
<code>public boolean hasSomeResults() { <START> return !results.isEmpty(); <END> }</code><technical_language>I assume list is null. right</technical_language>

Target:
public boolean hasSomeResults() { return results != null && !results.isEmpty(); }
Source:
<code>public String toString() { List<String> strings = new ArrayList<String>(); for (Long value : getValue() ) { switch (base) { case 2: strings.add("0b" + Long.toBinaryString(value)); break; case 8: strings.add('0' + Long.toOctalString(value)); break; case 10: strings.add(value.toString()); break; case 16: strings.add("0x" + Long.toHexString(value)); break; default: strings.add(value.toString()); break; <START> } <END> } return getName() + '=' + strings.toString(); }</code><technical_language>yuck, copy-pasted code :P This unified excerpt in IntegerField. a protected method in super-class, another separate file-level class. (probably former?)</technical_language>

Target:
public String toString() { List<String> strings = new ArrayList<String>(); for (Long value : getValue() ) { strings.add(formatNumber(value, base)); } return getName() + '=' + strings.toString(); }
Source:
<code>protected VMs mapCollection(List<org.ovirt.engine.core.common.businessentities.VM> entities, boolean isFiltered) { VMs collection = new VMs(); for (org.ovirt.engine.core.common.businessentities.VM entity : entities) { VM vm = map(entity); <START> if (isFiltered) { <END> vm.setHost(null); vm.setPlacementPolicy(null); } collection.getVMs().add(addLinks(populate(vm, entity))); } return collection; }</code><technical_language>Please extract method here, this is copy paste lines 140 - 146</technical_language>

Target:
protected VMs mapCollection(List<org.ovirt.engine.core.common.businessentities.VM> entities, boolean isFiltered) { VMs collection = new VMs(); for (org.ovirt.engine.core.common.businessentities.VM entity : entities) { VM vm = map(entity); if (isFiltered) { removeRestrictedInfoFromVM(vm); } collection.getVMs().add(addLinks(populate(vm, entity))); } return collection; }
Source:
<code>public void ovfUpdate_timer() { log.info("OvfDataUpdater: Attempting to update VMs/Templates Ovf."); <START> List<storage_pool> storagePools = getStoragePoolDao().getAll(); <END> for (storage_pool pool : storagePools) { try { if (StoragePoolStatus.Up == pool.getstatus()) { clearProccessedInfo(); log.infoFormat("OvfDataUpdater: Attempting to update vms Ovf in Data Center {0}", pool.getname()); updateOvfForVmsOfStoragePool(pool.getId()); clearProccessedInfo(); log.infoFormat("OvfDataUpdater: Attempting to update templates Ovf in Data Center {0}", pool.getname()); updateOvfForTemplatesOfStoragePool(pool.getId()); log.infoFormat("OvfDataUpdater: Attempting to remove uneeded Ovfs in Data Center {0}", pool.getname()); removeOvfForTemplatesAndVmsOfStoragePool(pool.getId()); } } catch (Exception ex) { addAuditLogError(pool.getname()); log.errorFormat("Exception while trying to update VMs/Templates ovf in Data Center {0}, the exception is {1}", pool.getname(), ex.getMessage()); log.debug(ex.getStackTrace()); } } clearProccessedInfo(); }</code><technical_language>add a "getAllWithStatus(StoragePoolSatus)" method DAO. more efficient iterating of them</technical_language>

Target:
public void ovfUpdate_timer() { ITEMS_COUNT_PER_UPDATE = reloadConfigValue(); log.info("OvfDataUpdater: Attempting to update VMs/Templates Ovf."); List<storage_pool> storagePools = getStoragePoolDao().getAllByStatus(StoragePoolStatus.Up); for (storage_pool pool : storagePools) { try { initProccessedInfoLists(); log.infoFormat("OvfDataUpdater: Attempting to update VM OVFs in Data Center {0}", pool.getname()); updateOvfForVmsOfStoragePool(pool.getId()); log.infoFormat("OvfDataUpdater: Attempting to update template OVFs in Data Center {0}", pool.getname()); updateOvfForTemplatesOfStoragePool(pool.getId()); log.infoFormat("OvfDataUpdater: Attempting to remove uneeded template/vm OVFs in Data Center {0}", pool.getname()); removeOvfForTemplatesAndVmsOfStoragePool(pool.getId()); } catch (Exception ex) { addAuditLogError(pool.getname()); log.errorFormat("Exception while trying to update VMs/Templates ovf in Data Center {0}, the exception is {1}", pool.getname(), ex.getMessage()); log.debug(ex.getStackTrace()); } } proccessedIdsInfo = null; proccessedOvfGenerationsInfo = null; }
Source:
<code>protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { <START> synchronized (getClassLoadingLock(name)) { <END> Class<?> clazz = findLoadedClass(name); if (clazz == null) { clazz = super.loadClass(name, resolve); if (!name.startsWith("java.") && !name.startsWith("javax.") && !name.startsWith("sun.") && !name.startsWith("org.xml.") && !name.startsWith("org.junit.")) { try { boolean definalize = filters.contains(name); if (!definalize) { for (int i = name.indexOf('.'); i > 0; i = name.indexOf('.', ++i)) { if (filters.contains(name.substring(0, i))) { definalize = true; break; } } } clazz = reloadClass(clazz, definalize); } catch (NotFoundException e) { throw new ClassNotFoundException(e.getMessage(), e); } catch (CannotCompileException e) { throw (ClassFormatError) new ClassFormatError(e.getMessage()).initCause(e); } } } if (resolve) { resolveClass(clazz); } return clazz; } }</code><technical_language>wondering if deadlock here, in case circular reciprocal references classes. won't, 100%</technical_language>

Target:
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { synchronized (getClassLoadingLock(name)) { Class<?> clazz = findLoadedClass(name); if (clazz == null) { clazz = super.loadClass(name, resolve); if (DeFinalizeClassLoader.isNotFromAReservedPackage(name)) { try { clazz = reloadClass(clazz, shouldDefinalize(name)); } catch (NotFoundException e) { throw new ClassNotFoundException(e.getMessage(), e); } catch (CannotCompileException e) { throw (ClassFormatError) new ClassFormatError(e.getMessage()).initCause(e); } } } if (resolve) { resolveClass(clazz); } return clazz; } }
Source:
<code>public boolean execute(MultiKeyMap<Integer, Triplet> slice, int leftBound, int rightBound, double mz) { double[] referenceEIC = new double[rightBound - leftBound + 1]; CurveTool.normalize(slice, leftBound, rightBound, (int) Math.round(mz * 10000), referenceEIC); BiGaussian objBiGaussian = new BiGaussian(slice, 140.1037, 1, 23); double[] bigaussianValues = new double[rightBound - leftBound + 1]; for (int i = 0; i < referenceEIC.length; i++) { bigaussianValues[i] = objBiGaussian.getValue(leftBound + i); } double[] normBigaussianValues = new double[rightBound - leftBound + 1]; CurveTool.normalize(bigaussianValues, normBigaussianValues); double similarityValue = CurveTool.similarityValue(referenceEIC, normBigaussianValues, leftBound, rightBound); final double peakSimilarityThreshold = 0.25; <START> boolean goodPeak = similarityValue > peakSimilarityThreshold ? true : false; <END> return goodPeak; }</code><technical_language>I need ternary operator. similarityValue > peakSimilarityThreshold return a boolean, right? return instead of storing in goodPeak</technical_language>

Target:
public boolean execute(MultiKeyMap<Integer, Triplet> slice, int leftBound, int rightBound, double mz) { double[] referenceEIC = new double[rightBound - leftBound + 1]; CurveTool.normalize(slice, leftBound, rightBound, (int) Math.round(mz * 10000), referenceEIC); BiGaussian objBiGaussian = new BiGaussian(slice, mz, leftBound, rightBound); double[] bigaussianValues = IntStream.range(0, referenceEIC.length) .mapToDouble(i -> objBiGaussian.getValue(leftBound + i)).toArray(); double[] normBigaussianValues = new double[rightBound - leftBound + 1]; CurveTool.normalize(bigaussianValues, normBigaussianValues); double similarityValue = CurveTool.similarityValue(referenceEIC, normBigaussianValues, leftBound, rightBound); return similarityValue > PEAK_SIMILARITY_THRESHOLD; }
Source:
<code>protected boolean requiresWaitForAngular(Method method) { String methodName = method.getName(); <START> return !methodsNoWait.contains(methodName); <END> }</code><technical_language>do methods inspected in constructor, instead of checking for annotation in this method, checking static list (possibly caching result in a field repeated call)? methods checked for instance created, is expensive time wise. I expect methods annotated. if annotation is present a wait required, time spent checking for is important</technical_language>

Target:
protected boolean requiresWaitForAngular(Method method) { String methodName = method.getName(); return !METHODS_NO_WAIT.contains(methodName) && !hasNoWaitAnnotation(method); }
Source:
<code>private void handleAppearanceColorListSelection() { ColorEntry selectedColor= getSelectedAppearanceColorOption(); <START> RGB rgb= PreferenceConverter.getColor(fOverlayStore, selectedColor.currentColorKey); <END> fAppearanceColorEditor.setColorValue(rgb); updateAppearanceColorWidgets(selectedColor.defaultColorKey); }</code><technical_language>this a getRGB() method in ColorEntry if more once</technical_language>

Target:
private void handleAppearanceColorListSelection() { ColorEntry selectedColor= getSelectedAppearanceColorOption(); RGB rgb= selectedColor.getRGB(false); fAppearanceColorEditor.setColorValue(rgb); updateAppearanceColorWidgets(selectedColor.isSystemDefaultKey); }
Source:
<code>public Set<Organization> getStarredOrganizations(@ApiParam(hidden = true) @Auth User user) { User u = userDAO.findById(user.getId()); <START> return u.getStarredOrganizations().stream().filter(element -> element instanceof Organization) <END> .collect(Collectors.toCollection(LinkedHashSet::new)); }</code><technical_language>filter is redundant element is instance of Organization, it? is possibility of nulls? I need is return u.getStarredOrganizations</technical_language>

Target:
public Set<Organization> getStarredOrganizations(@ApiParam(hidden = true) @Auth User user) { User u = userDAO.findById(user.getId()); return u.getStarredOrganizations(); }
Source:
<code>public Response queryCaseByVariables(@Context HttpHeaders headers, String payload, @ApiParam(value = "optional pagination - at which page to start, defaults to 0 (meaning first)", required = false) @QueryParam("page") @DefaultValue("0") Integer page, @ApiParam(value = "optional pagination - size of the result, defaults to 10", required = false) @QueryParam("pageSize") @DefaultValue("10") Integer pageSize) { Header conversationIdHeader = buildConversationIdHeader("", context, headers); Variant v = getVariant(headers); try { String type = getContentType(headers); CaseInstanceCustomVarsList processVariableSummaryList = caseManagementRuntimeDataServiceBase.queryCasesByVariables(payload, type, new QueryContext(page * pageSize, pageSize)); <START> logger.debug("Returning result of process instance search: {}", processVariableSummaryList); <END> return createCorrectVariant(processVariableSummaryList, headers, Response.Status.OK, conversationIdHeader); } catch (Exception e) { logger.error("Unexpected error during processing {}", e.getMessage(), e); return internalServerError(errorMessage(e), v, conversationIdHeader); } }</code><technical_language>Log message "cases search" instead of "process"</technical_language>

Target:
public Response queryCaseByVariables(@Context HttpHeaders headers, String payload, @ApiParam(value = "optional pagination - at which page to start, defaults to 0 (meaning first)", required = false) @QueryParam("page") @DefaultValue("0") Integer page, @ApiParam(value = "optional pagination - size of the result, defaults to 10", required = false) @QueryParam("pageSize") @DefaultValue("10") Integer pageSize) { Header conversationIdHeader = buildConversationIdHeader("", context, headers); Variant v = getVariant(headers); try { String type = getContentType(headers); CaseInstanceCustomVarsList processVariableSummaryList = caseManagementRuntimeDataServiceBase.queryCasesByVariables(payload, type, new QueryContext(page * pageSize, pageSize)); logger.debug("Returning result of case instance search: {}", processVariableSummaryList); return createCorrectVariant(processVariableSummaryList, headers, Response.Status.OK, conversationIdHeader); } catch (Exception e) { logger.error("Unexpected error during processing {}", e.getMessage(), e); return internalServerError(errorMessage(e), v, conversationIdHeader); } }
Source:
<code>private Group nextRowInternal() throws IOException, TranslatorException { while (rowIterator != null) { if (pageRowCount-- <= 0) { this.rowIterator = null; PageReadStore nextRowGroup = this.reader.readNextRowGroup(); if(nextRowGroup == null){ VirtualFile nextParquetFile = getNextParquetFile(); if (nextParquetFile == null) { return null; } this.rowIterator = readParquetFile(nextParquetFile); continue; <START> } else{ <END> this.pageRowCount = nextRowGroup.getRowCount(); this.rowIterator = columnIO.getRecordReader(nextRowGroup, new GroupRecordConverter(filteredSchema)); } } return rowIterator.read(); } return null; }</code><technical_language>Depending code quality tool running, get a warning in situations this - else nesting is needed if case complete fully escaping</technical_language>

Target:
private Group nextRowInternal() throws IOException, TranslatorException { while (rowIterator != null) { if (pageRowCount-- <= 0) { this.rowIterator = null; PageReadStore nextRowGroup = this.reader.readNextRowGroup(); if(nextRowGroup == null){ VirtualFile nextParquetFile = getNextParquetFile(); if (nextParquetFile == null) { return null; } this.rowIterator = readParquetFile(nextParquetFile); continue; } this.pageRowCount = nextRowGroup.getRowCount(); this.rowIterator = columnIO.getRecordReader(nextRowGroup, new GroupRecordConverter(filteredSchema)); } Group presentRow = rowIterator.read(); if(presentRow == null){ return nextRowInternal(); } return presentRow; } return null; }
Source:
<code>public void testLiveEventListGet() throws Exception { Client client = getLiveClient(); Request<ScopedList<Event>> request = new Event.ListRequestBuilder().build(); <START> <END> ScopedList<Event> events = client.sendRequest(request, new TypeReference<ScopedList<Event>>() { }); assertEquals(20, events.getLimit()); assertEquals(114, events.getTotal()); Event event = events.getData().get(0); assertNotNull(event); }</code><technical_language>remove a newline</technical_language>

Target:
public void testLiveEventListGet() throws Exception { Request<ScopedList<Event>> request = new Event.ListRequestBuilder().build(); ScopedList<Event> events = client.sendRequest(request, new TypeReference<ScopedList<Event>>() { }); assertEquals(20, events.getLimit()); assertEquals(114, events.getTotal()); Event event = events.getData().get(0); assertNotNull(event); }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); genderOptionsList = new ArrayList<>(); clientClassificationList = new ArrayList<>(); clientTypeList = new ArrayList<>(); officeList = new ArrayList<>(); staffList = new ArrayList<>(); Bundle bundle = this.getArguments(); <START> if (bundle != null) { <END> int groupId = getArguments().getInt("groupId"); mGroupId = groupId; } }</code><technical_language>suggestion if (bundle) {</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); genderOptionsList = new ArrayList<>(); clientClassificationList = new ArrayList<>(); clientTypeList = new ArrayList<>(); officeList = new ArrayList<>(); staffList = new ArrayList<>(); Bundle bundle = this.getArguments(); if (bundle != null) { mGroupId = getArguments().getInt("groupId"); } }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } <START> if (o == null || getClass() != o.getClass()) { <END> return false; } URL url = (URL) o; if (port != url.port) { return false; } if (secure != url.secure) { return false; } if (!domain.equals(url.domain)) { return false; } if (!host.equals(url.host)) { return false; } return path.equals(url.path); }</code><technical_language>possibly instanceof here... null is passed instanceof returns false</technical_language>

Target:
public boolean equals(Object o) { if (o instanceof URL) { URL other = (URL) o; return domain.equals(other.domain) && host.equals(other.host) && path.equals(other.path) && port == other.port && secure == other.secure; } return false; }
Source:
<code>public ErrorLogBean() { <START> try { <END> dropdowns = service.getDropdowns(); } catch (Exception ex) { LOG.error("Error calling service.dropdowns: {}", ex.getMessage(), ex); HelperUtil.addMessageError(null, SERVICE_ERROR); } }</code><technical_language>catching exception in constructor. init method @PostConstruct annotation</technical_language>

Target:
public ErrorLogBean() { dropdowns = service.getDropdowns(); }
Source:
<code>private boolean shouldReplayEvent(FileStatus dir, DumpType dumpType) throws SemanticException { if (dbNameOrPattern == null || dbNameOrPattern.isEmpty()) { return true; } else if ((tblNameOrPattern == null) || (tblNameOrPattern.isEmpty())) { Database database; try { database = Hive.get().getDatabase(dbNameOrPattern); } catch (HiveException e) { LOG.info("failed to get the database " + dbNameOrPattern); return true; } String replLastId; Map<String, String> params = database.getParameters(); if (params != null && (params.containsKey(ReplicationSpec.KEY.CURR_STATE_ID.toString()))) { replLastId = params.get(ReplicationSpec.KEY.CURR_STATE_ID.toString()); if (Long.parseLong(replLastId) >= Long.parseLong(dir.getPath().getName())) { LOG.debug("Event " + dumpType + " with replId " + Long.parseLong(dir.getPath().getName()) + " is already replayed. LastReplId - " + Long.parseLong(replLastId)); return false; } } } else { Table tbl; try { tbl = Hive.get().getTable(dbNameOrPattern, tblNameOrPattern); } catch (HiveException e) { LOG.info("failed to get the table " + dbNameOrPattern + "." + tblNameOrPattern); return true; } if (tbl != null) { <START> Map<String, String> params = tbl.getParameters(); <END> if (params != null && (params.containsKey(ReplicationSpec.KEY.CURR_STATE_ID.toString()))) { String replLastId = params.get(ReplicationSpec.KEY.CURR_STATE_ID.toString()); if (Long.parseLong(replLastId) >= Long.parseLong(dir.getPath().getName())) { LOG.debug("Event " + dumpType + " with replId " + Long.parseLong(dir.getPath().getName()) + " is already replayed. LastReplId - " + Long.parseLong(replLastId)); return false; } } } } return true; }</code><technical_language>This code snippet validate repl state is duplicated for database case well. a static method in ReplicationSpec takes current event id parameters map arguments</technical_language>

Target:
private boolean shouldReplayEvent(FileStatus dir, DumpType dumpType) throws SemanticException { if (dbNameOrPattern == null || dbNameOrPattern.isEmpty()) { return true; } else if ((tblNameOrPattern == null) || (tblNameOrPattern.isEmpty())) { Database database; try { database = Hive.get().getDatabase(dbNameOrPattern); return isEventNotReplayed(database.getParameters(), dir, dumpType); } catch (HiveException e) { LOG.debug("failed to get the database " + dbNameOrPattern); return true; } } else { Table tbl; try { tbl = Hive.get().getTable(dbNameOrPattern, tblNameOrPattern); return isEventNotReplayed(tbl.getParameters(), dir, dumpType); } catch (HiveException e) { LOG.debug("failed to get the table " + dbNameOrPattern + "." + tblNameOrPattern); return true; } } }
Source:
<code>public Parser<String, Object> makeParser() { <START> if (firstRowIsHeader) { <END> return new CSVParser(Optional.fromNullable(listDelimiter), columns, firstRowIsHeader); } else { return new CSVParser(Optional.fromNullable(listDelimiter), columns); } }</code><technical_language>This return new CSVParser(Optional.fromNullable(listDelimiter), columns, firstRowIsHeader)</technical_language>

Target:
public Parser<String, Object> makeParser() { return new CSVParser(Optional.fromNullable(listDelimiter), columns, hasHeaderRow); }
Source:
<code>public String getLabel(Object object) { <START> return "" + object; END> }</code><technical_language>invoke object.toString()</technical_language>

Target:
public String getLabel(Object object) { return object.toString(); }
Source:
<code>public View getView(int position, View convertView, ViewGroup parent) { HierarchyElementView hev; if (convertView == null) { hev = new HierarchyElementView(mContext, mItems.get(position)); } else { hev = (HierarchyElementView)convertView; <START> HierarchyElement entry = mItems.get(position); <END> hev.setPrimaryText(entry.getPrimaryText(), entry.getTextColor()); hev.setSecondaryText(entry.getSecondaryText(), entry.getTextColor()); hev.setIcon(entry.getIcon()); hev.setColor(entry.getBgColor()); } if (mItems.get(position).getSecondaryText() == null || mItems.get(position).getSecondaryText().equals("")) { hev.showSecondary(false); } else { hev.showSecondary(true); } return hev; }</code><technical_language>nice add a function this HierarchyElementView accepts a HierarchyElement parse out colors/texts (since this is a repeated in HierarchyElementview)</technical_language>

Target:
public View getView(int position, View convertView, ViewGroup parent) { HierarchyElementView hev; if (convertView == null) { hev = new HierarchyElementView(mContext, mItems.get(position)); } else { hev = (HierarchyElementView)convertView; HierarchyElement entry = mItems.get(position); hev.setFromHierarchyElement(entry); } if (mItems.get(position).getSecondaryText() == null || mItems.get(position).getSecondaryText().equals("")) { hev.showSecondary(false); } else { hev.showSecondary(true); } return hev; }
Source:
<code>private static String getAccessLevelValue(Object value) { <START> String retentionValue = null; <END> if (value instanceof Tree) { Tree tree = (Tree) value; if (tree.is(Tree.Kind.MEMBER_SELECT)) { retentionValue = ((MemberSelectExpressionTree) tree).identifier().name(); } else if (tree.is(Tree.Kind.IDENTIFIER)) { retentionValue = ((IdentifierTree) tree).name(); } } else if (value instanceof Symbol.VariableSymbol) { retentionValue = ((Symbol.VariableSymbol) value).name(); } return retentionValue; }</code><technical_language>This is a retentionValue... Access level. Rename variable simply drop return immediately it. RetentionValue is variable name java.lang.annotation.Retention (copy-pasted ReflectionOnNonRuntimeAnnotationCheck ?)</technical_language>

Target:
private static String getAccessLevelValue(Object value) { if (value instanceof Tree) { Tree tree = (Tree) value; if (tree.is(Tree.Kind.MEMBER_SELECT)) { return ((MemberSelectExpressionTree) tree).identifier().name(); } else if (tree.is(Tree.Kind.IDENTIFIER)) { return ((IdentifierTree) tree).name(); } } else if (value instanceof Symbol.VariableSymbol) { return ((Symbol.VariableSymbol) value).name(); } return null; }
Source:
<code><START> public IPath replacePath(IPath path, int index, String newValue) { <END> final String[] segmentsNode = path.segments(); segmentsNode[index - 1] = newValue; String renamedPath = ""; for (final String segmentNode : segmentsNode) { renamedPath += segmentNode; renamedPath += NAME_DEFAULT_VARIABLES_GROUP; } return new Path(renamedPath); }</code><technical_language>do need this all</technical_language>

Target:
public IPath replacePath(IPath path, int index, String newValue) { final String[] segmentsNode = path.segments(); segmentsNode[index - 1] = newValue; String renamedPath = ""; for (final String segmentNode : segmentsNode) { renamedPath += segmentNode; renamedPath += Path.ROOT.toString(); } return new Path(renamedPath); }
Source:
<code>public Concept getNonCodedDrugConcept() { <START> String conceptUuid = Context.getAdministrationService().getGlobalProperty(OpenmrsConstants.GP_DRUG_NON_CODED_CONCEPT_UUID); <END> return Context.getConceptService().getConceptByUuid(conceptUuid); }</code><technical_language>need check conceptUuid is null blank</technical_language>

Target:
public Concept getNonCodedDrugConcept() { String conceptUuid = Context.getAdministrationService().getGlobalProperty(OpenmrsConstants.GP_DRUG_ORDER_DRUG_OTHER); if(org.apache.commons.lang.StringUtils.isNotBlank(conceptUuid)){ return Context.getConceptService().getConceptByUuid(conceptUuid); } return null; }
Source:
<code>private void addRouteDefinitions(List<RouteDefinition> routeDefinitions) { try { camelContext.addRouteDefinitions(routeDefinitions); } catch (Exception e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>throwing RuntimeException</technical_language>

Target:
private void addRouteDefinitions(List<RouteDefinition> routeDefinitions) { try { camelContext.addRouteDefinitions(routeDefinitions); } catch (Exception e) { throw new RuntimeCamelException(e); } }
Source:
<code>public long nextLong() { <START> TokenResponse token = rt.getSequencerView().nextOrderedGuid(); <END> return (token.getEpoch() & MAX_EPOCH) << SHIFT_EPOCH | (token.getSequence() & MAX_SEQUENCE); }</code><technical_language>this strange. please explain nextOrderedGuid situated SeqencerView</technical_language>

Target:
public long nextLong() { long currentTimestamp = getCorrectedTimestamp(); return (currentTimestamp << TIMESTAMP_SHIFT) | ((instanceId & MAX_INSTANCE_ID) << INSTANCE_ID_SHIFT) | (timestampCorrection & MAX_TIMESTAMP_CORRECTION); }
Source:
<code>public int getVersion() { <START> return 3; <END> }</code><technical_language>2? Besides this a constant, beginning of class, lost line 152</technical_language>

Target:
public int getVersion() { return VERSION_NUMBER; }
Source:
<code>private ApiResultWrapper sisUploadCall(String csvFileContent){ String url = Utils.urlConstructor("/accounts/1/sis_imports?batch_mode=0&override_sis_stickiness=0&extension=csv"); HttpPost post = new HttpPost(url); post.setEntity(new StringEntity(csvFileContent, ContentType.create(Utils.CONSTANT_MIME_TEXT_CSV, "UTF-8"))); <START> ApiResultWrapper arw = Utils.makeApiCall(post); <END> M_log.debug("API response: "+arw.getApiResp()); return arw; }</code><technical_language>if call times out</technical_language>

Target:
private ApiResultWrapper sisUploadCall(String csvFileContent){ String url = Utils.urlConstructor(Utils.URL_CHUNK_ACCOUNTS_1_SIS_IMPORTS+Utils.URL_CHUNK_SIS_IMPORT_WITH_BATCH_MODE_STICKINESS_DISABLED); HttpPost post = new HttpPost(url); post.setEntity(new StringEntity(csvFileContent, ContentType.create(Utils.CONSTANT_MIME_TEXT_CSV, "UTF-8"))); ApiResultWrapper arw = Utils.makeApiCall(post); M_log.debug("API response: "+arw.getApiResp()); return arw; }
Source:
<code>public void handleInspectAddressesRequest(RequestMsg req, ChannelHandlerContext ctx, IServerRouter r) { final List<Long> addresses = req.getPayload().getInspectAddressesRequest().getAddressList(); List<Long> emptyAddresses = new ArrayList<>(); if (log.isTraceEnabled()) { log.trace("handleInspectAddressesRequest[{}]: " + "addresses {}", req.getHeader().getRequestId(), addresses); } for (long address : addresses) { try { <START> if (!streamLog.contains(address)) emptyAddresses.add(address); <END> } catch (TrimmedException te) { r.sendResponse(getResponseMsg(req.getHeader(), getTrimmedErrorMsg()), ctx); return; } catch (DataCorruptionException dce) { r.sendResponse(getResponseMsg(req.getHeader(), getDataCorruptionErrorMsg(address)), ctx); return; } } r.sendResponse(getResponseMsg(req.getHeader(), getInspectAddressesResponseMsg(emptyAddresses)), ctx); }</code><technical_language>Format if block wrap in curly brackets new lines</technical_language>

Target:
public void handleInspectAddressesRequest(RequestMsg req, ChannelHandlerContext ctx, IServerRouter r) { final List<Long> addresses = req.getPayload().getInspectAddressesRequest().getAddressList(); List<Long> emptyAddresses = new ArrayList<>(); if (log.isTraceEnabled()) { log.trace("handleInspectAddressesRequest[{}]: " + "addresses {}", req.getHeader().getRequestId(), addresses); } for (long address : addresses) { try { if (!streamLog.contains(address)) { emptyAddresses.add(address); } } catch (TrimmedException te) { r.sendResponse(getResponseMsg(req.getHeader(), getTrimmedErrorMsg()), ctx); return; } catch (DataCorruptionException dce) { r.sendResponse(getResponseMsg(req.getHeader(), getDataCorruptionErrorMsg(address)), ctx); return; } } r.sendResponse(getResponseMsg(req.getHeader(), getInspectAddressesResponseMsg(emptyAddresses)), ctx); }
Source:
<code>private static void logClientInitWarning() { <START> DebugLogger.INSTANCE.w("It appears that Bugsnag.init() was called more than once. " <END> + "Subsequent calls have no effect, but may indicate that Bugsnag is not integrated in " + "an Application subclass, which can lead to undesired behaviour."); }</code><technical_language>is DebugLogger.INSTANCE.w a sneaky of calling logger logging is disabled</technical_language>

Target:
private static void logClientInitWarning() { getClient().logger.w("It appears that Bugsnag.init() was called more than once. " + "Subsequent calls have no effect, but may indicate that Bugsnag is not integrated in" + " an Application subclass, which can lead to undesired behaviour."); }
Source:
<code>public void deleteUsers(List<User> users) { EKBCommit commit = getEKBCommit(); preparePersistenceAccess(); for (User user : users) { <START> List<User> result = queryService.queryByString(User.class, "username:\"" + user.getUsername() + "\""); <END> if (result.size() == 0) { LOGGER.warn("User {1} does not exist.", user.getUsername()); } else { commit.addDelete(user); } } persistService.commit(commit); revokePersistenceAccess(); }</code><technical_language>query(QueryRequest) method</technical_language>

Target:
public void deleteUsers(List<User> users) { EKBCommit commit = getEKBCommit(); preparePersistenceAccess(); for (User user : users) { List<User> result = queryService.query(User.class, QueryRequest.query("username", user.getUsername())); if (result.size() == 0) { LOGGER.warn("User {1} does not exist.", user.getUsername()); } else { commit.addDelete(user); } } persistService.commit(commit); revokePersistenceAccess(); }
Source:
<code>public static Map<String, ValueType> rowSignatureFor(final GroupByQuery query) { final ImmutableMap.Builder<String, ValueType> types = ImmutableMap.builder(); for (DimensionSpec dimensionSpec : query.getDimensions()) { types.put(dimensionSpec.getOutputName(), dimensionSpec.getOutputType()); } for (AggregatorFactory aggregatorFactory : query.getAggregatorSpecs()) { final String typeName = aggregatorFactory.getTypeName(); final ValueType valueType = GuavaUtils.getEnumIfPresent( ValueType.class, <START> typeName == null ? null : StringUtils.toUpperCase(typeName) <END> ); if (valueType != null) { types.put(aggregatorFactory.getName(), valueType); } } return types.build(); }</code><technical_language>Suggested GuavaUtils.getEnumIfPresent() accept null value, here, move check out of GuavaUtils.getEnumIfPresent() call</technical_language>

Target:
public static Map<String, ValueType> rowSignatureFor(final GroupByQuery query) { final ImmutableMap.Builder<String, ValueType> types = ImmutableMap.builder(); for (DimensionSpec dimensionSpec : query.getDimensions()) { types.put(dimensionSpec.getOutputName(), dimensionSpec.getOutputType()); } for (AggregatorFactory aggregatorFactory : query.getAggregatorSpecs()) { final String typeName = aggregatorFactory.getTypeName(); final ValueType valueType; if (typeName != null) { valueType = GuavaUtils.getEnumIfPresent(ValueType.class, StringUtils.toUpperCase(typeName)); } else { valueType = null; } if (valueType != null) { types.put(aggregatorFactory.getName(), valueType); } } return types.build(); }
Source:
<code>public void pause(boolean persist) throws Exception { if (AuditLogger.isEnabled()) { AuditLogger.pause(addressInfo); } checkStarted(); clearIO(); try { if (!addressInfo.isPaused()) { addressInfo.pause(); if (persist) { server.getStorageManager().storeAddressStatus(addressInfo.getId(), AddressStatus.PAUSED); <START> } <END> Bindings bindings = server.getPostOffice().lookupBindingsForAddress(addressInfo.getName()); if (bindings != null) { for (Binding binding : bindings.getBindings()) { if (binding instanceof QueueBinding) { QueueControl coreQueueControl = (QueueControl) managementService.getResource(ResourceNames.QUEUE + binding.getUniqueName().toString()); if (coreQueueControl != null) { coreQueueControl.pause(); } } } } } } finally { blockOnIO(); } }</code><technical_language>I this logic moved AddressInfo#pause method users of AddressInfo get persistence functionality control object. Also, needs a detect multiple invocations of pause PAUSED records added bindings journal size increase time</technical_language>

Target:
public void pause(boolean persist) { if (AuditLogger.isEnabled()) { AuditLogger.pause(addressInfo); } checkStarted(); clearIO(); try { addressInfo.setPostOffice(server.getPostOffice()); addressInfo.setStorageManager(server.getStorageManager()); addressInfo.pause(persist); } finally { blockOnIO(); } }
Source:
<code>public void testSomethingByIterableHandleNullWithEmptyList() { final SomethingByIterableHandleNull s = handle.attach(SomethingByIterableHandleNull.class); final List<Something> out = s.get(new ArrayList<Object>()); <START> Assert.assertEquals(4, out.size()); <END> }</code><technical_language>I expect out empty here, yes</technical_language>

Target:
public void testSomethingByIterableHandleNullWithEmptyList() { final SomethingByIterableHandleNull s = handle.attach(SomethingByIterableHandleNull.class); final List<Something> out = s.get(new ArrayList<Object>()); Assert.assertEquals(0, out.size()); }