auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean equals(Object o) { if (o instanceof SessionEditorInput && <START> getInput() != <END> null) { SessionEditorInput otherSessionEditorInput = (SessionEditorInput) o; if (otherSessionEditorInput.getSession() != null && otherSessionEditorInput.getSession().isOpen()) { EObject otherEObject = otherSessionEditorInput.getSession().getTransactionalEditingDomain().getResourceSet().getEObject(getURI(), false); getInput().equals(otherEObject); } } return super.equals(o); }</code><technical_language>extracted</technical_language>

Target:
public boolean equals(Object o) { if (o instanceof SessionEditorInput && getInput() != null) { SessionEditorInput otherSessionEditorInput = (SessionEditorInput) o; Session otherSession = otherSessionEditorInput.getSession(); if (otherSession != null && otherSession.isOpen()) { EObject otherEObject = otherSession.getTransactionalEditingDomain().getResourceSet().getEObject(getURI(), false); return getInput().equals(otherEObject); } } return super.equals(o); }
Source:
<code>private void createOptionsArea(Composite workArea) { Composite optionsGroup = new Composite(workArea, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginBottom = 2 * layout.marginHeight; layout.marginHeight = 0; optionsGroup.setLayout(layout); optionsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); nestedProjectsCheckbox = new Button(optionsGroup, SWT.CHECK); nestedProjectsCheckbox .setText(UIText.GitProjectsImportPage_SearchForNestedProjects); nestedProjectsCheckbox.setLayoutData(new GridData( GridData.FILL_HORIZONTAL)); nestedProjectsCheckbox.setSelection(nestedProjects); nestedProjectsCheckbox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { nestedProjects = nestedProjectsCheckbox.getSelection(); setProjectsList(lastPath); } }); hideConflictingProjectsCheckBox = new Button(optionsGroup, SWT.CHECK); hideConflictingProjectsCheckBox .setText(UIText.GitProjectsImportPage__hideConflictingProjects); hideConflictingProjectsCheckBox.setLayoutData(new GridData( GridData.FILL_HORIZONTAL)); hideConflictingProjectsCheckBox .addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { projectsList.removeFilter(conflictingProjectsFilter); if (hideConflictingProjectsCheckBox <START> .getSelection()) { <END> projectsList.addFilter(conflictingProjectsFilter); } } }); }</code><technical_language>style nit: curly braces single line blocks (see contributor guide)</technical_language>

Target:
private void createOptionsArea(Composite workArea) { Composite optionsGroup = new Composite(workArea, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginBottom = 2 * layout.marginHeight; layout.marginHeight = 0; optionsGroup.setLayout(layout); optionsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); nestedProjectsCheckbox = new Button(optionsGroup, SWT.CHECK); nestedProjectsCheckbox .setText(UIText.GitProjectsImportPage_SearchForNestedProjects); nestedProjectsCheckbox.setLayoutData(new GridData( GridData.FILL_HORIZONTAL)); nestedProjectsCheckbox.setSelection(nestedProjects); nestedProjectsCheckbox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { nestedProjects = nestedProjectsCheckbox.getSelection(); setProjectsList(lastPath); } }); hideConflictingProjectsCheckBox = new Button(optionsGroup, SWT.CHECK); hideConflictingProjectsCheckBox .setText(UIText.GitProjectsImportPage_HideConflictingProjects); hideConflictingProjectsCheckBox.setLayoutData(new GridData( GridData.FILL_HORIZONTAL)); hideConflictingProjectsCheckBox .addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { projectsList.removeFilter(conflictingProjectsFilter); if (hideConflictingProjectsCheckBox .getSelection()) { projectsList.addFilter(conflictingProjectsFilter); } } }); }
Source:
<code>public void run() throws Exception { ui.header("Review Labels"); boolean enabled = ui.yesno(false, "Install Verified label"); Config cfg = allProjectsConfig.load(); if (enabled) { cfg.setString(KEY_LABEL, LABEL_VERIFIED, KEY_FUNCTION, "MaxWithBlock"); cfg.setStringList(KEY_LABEL, LABEL_VERIFIED, KEY_VALUE, Arrays.asList(new String[] {"-1 Fails", " 0 No score", "+1 Verified"})); <START> allProjectsConfig.save("Review Label Initialization"); <END> } }</code><technical_language>I tested this, if user is running init existing site, Verified label, selects "yes" this option</technical_language>

Target:
public void run() throws Exception { Config cfg = allProjectsConfig.load(); if (!cfg.getSubsections(KEY_LABEL).contains(LABEL_VERIFIED)) { ui.header("Review Labels"); boolean enabled = ui.yesno(false, "Install Verified label"); if (enabled) { cfg.setString(KEY_LABEL, LABEL_VERIFIED, KEY_FUNCTION, "MaxWithBlock"); cfg.setStringList(KEY_LABEL, LABEL_VERIFIED, KEY_VALUE, Arrays.asList(new String[] {"-1 Fails", " 0 No score", "+1 Verified"})); allProjectsConfig.save("Review Label Initialization"); } } }
Source:
<code>public void step(int step, Closure closure) { if (step == 0) { <START> return; <END> } final boolean isAscending; if (step < 0) { step *= -1; isAscending = isReverse(); } else { isAscending = !isReverse(); } final long from = getFrom().longValue(), to = getTo().longValue(); if (isAscending) { for (long value = from; value <= to; value += step) { closure.call(value); } } else { for (long value = to; value >= from; value -= step) { closure.call(value); } } }</code><technical_language>This controversial me. If I a for loop: for (int x = 0; x < 5; x += 0) { } I expect infinite loop (except for case of upper bound initial handle separately anyway) compiler optimizing a no-op. previous early detection exception more sense me. Groovy give shortcuts handle cases errors in a more elegant this a bigger magical step normal</technical_language>

Target:
public void step(int step, Closure closure) { if (step == 0) { if (!getFrom().equals(getTo())) { throw new GroovyRuntimeException("Infinite loop detected due to step size of 0"); } return; } final boolean isAscending; if (step < 0) { step *= -1; isAscending = isReverse(); } else { isAscending = !isReverse(); } final long from = getFrom().longValue(), to = getTo().longValue(); if (isAscending) { for (long value = from; value <= to; value += step) { closure.call(value); } } else { for (long value = to; value >= from; value -= step) { closure.call(value); } } }
Source:
<code>private Optional<HmmPdfInterface> getPdfFromObsModel(final SleepHmmBayesNetProtos.ObsModel obsModel) { <START> final int measNumber = obsModel.getMeasType(0).getNumber(); <END> if (obsModel.hasGaussian()) { return Optional.of((HmmPdfInterface)new GaussianPdf(obsModel.getGaussian().getMean(),obsModel.getGaussian().getStddev(),measNumber)); } if (obsModel.hasAlphabet()) { final int N = obsModel.getAlphabet().getProbabilitiesCount(); final List<Double> alphabetProbs = Lists.newArrayList(); for (int i = 0; i < N; i++) { alphabetProbs.add(obsModel.getAlphabet().getProbabilities(i)); } return Optional.of((HmmPdfInterface)new DiscreteAlphabetPdf(alphabetProbs,measNumber)); } if (obsModel.hasChisquare()) { return Optional.of((HmmPdfInterface)new ChiSquarePdf(obsModel.getChisquare().getMean(),measNumber)); } if (obsModel.hasGamma()) { return Optional.of((HmmPdfInterface)new GammaPdf(obsModel.getGamma().getMean(),obsModel.getGamma().getStddev(),measNumber)); } if (obsModel.hasPoisson()) { return Optional.of((HmmPdfInterface)new PoissonPdf(obsModel.getPoisson().getMean(),measNumber)); } return Optional.absent(); }</code><technical_language>do prevent this bug happening again</technical_language>

Target:
private Optional<HmmPdfInterface> getPdfFromObsModel(final SleepHmmBayesNetProtos.ObsModel obsModel) { if (obsModel.getMeasTypeCount() < 1) { return Optional.absent(); } final int measNumber = obsModel.getMeasType(0).getNumber(); if (obsModel.hasGaussian()) { return Optional.of((HmmPdfInterface)new GaussianPdf(obsModel.getGaussian().getMean(),obsModel.getGaussian().getStddev(),measNumber)); } if (obsModel.hasAlphabet()) { final int N = obsModel.getAlphabet().getProbabilitiesCount(); final List<Double> alphabetProbs = Lists.newArrayList(); for (int i = 0; i < N; i++) { alphabetProbs.add(obsModel.getAlphabet().getProbabilities(i)); } return Optional.of((HmmPdfInterface)new DiscreteAlphabetPdf(alphabetProbs,measNumber)); } if (obsModel.hasChisquare()) { return Optional.of((HmmPdfInterface)new ChiSquarePdf(obsModel.getChisquare().getMean(),measNumber)); } if (obsModel.hasGamma()) { return Optional.of((HmmPdfInterface)new GammaPdf(obsModel.getGamma().getMean(),obsModel.getGamma().getStddev(),measNumber)); } if (obsModel.hasPoisson()) { return Optional.of((HmmPdfInterface)new PoissonPdf(obsModel.getPoisson().getMean(),measNumber)); } return Optional.absent(); }
Source:
<code>public void testExtractEncryptionContext() { Map<String, String> encryptionContext = KmsTextEncryptor.extractEncryptionContext(ENCRYPTION_TEXT); <START> assertEquals(NUMBER_OF_ENTRIES, encryptionContext.size()); <END> int found = 0; for (Entry<String, String> entry : encryptionContext.entrySet()) { if ("param".equals(entry.getKey())) { assertEquals("L’homme c’est rien", entry.getValue()); found++; } else if ("test".equals(entry.getKey())) { assertEquals("l’oeuvre c’est tout", entry.getValue()); found++; } else if ("valueless".equals(entry.getKey())) { assertEquals("An empty value must still be added!", "", entry.getValue()); found++; } } assertEquals("Test did not find right number of key and value pairs", NUMBER_OF_ENTRIES, found); }</code><technical_language>this test simplified [AssertJ](<LINK_0> java assertThat(KmsTextEncryptor.extractEncryptionContext(ENCRYPTION_TEXT)) .containsOnly( entry("param", "L'homme c'est rien"), entry("test", "l'oeuvre c'est tout"), entry("valueless", ""));</technical_language>

Target:
public void testExtractEncryptionContext() { assertThat(KmsTextEncryptor.extractEncryptionContext(ENCRYPTION_TEXT)) .containsOnly( entry("param", "L’homme c’est rien"), entry("test", "l’oeuvre c’est tout"), entry("valueless", "")); }
Source:
<code>private JarPackageData configureJar(final ICompilationUnit[] compilationUnits) { final JarPackageData jarPackakeData = newJarPackageData(); jarPackakeData.setJarLocation(Path.fromOSString(toFile.getAbsolutePath())); jarPackakeData.setElements(compilationUnits); jarPackakeData.setDeprecationAware(true); jarPackakeData.setExportJavaFiles(includeSources); jarPackakeData.setOverwrite(true); <START> jarPackakeData.setExportErrors(false); <END> return jarPackakeData; }</code><technical_language>some side effects connectors. (When sources compile.)</technical_language>

Target:
private JarPackageData configureJar(final ICompilationUnit[] compilationUnits) { final JarPackageData jarPackakeData = newJarPackageData(); jarPackakeData.setJarLocation(Path.fromOSString(toFile.getAbsolutePath())); jarPackakeData.setElements(compilationUnits); jarPackakeData.setDeprecationAware(true); jarPackakeData.setExportJavaFiles(includeSources); jarPackakeData.setOverwrite(true); return jarPackakeData; }
Source:
<code>protected EObject addRow(EClass clazz, Setting mainSetting) { if (clazz.isAbstract() || clazz.isInterface()) { Activator .getInstance() .getLog() .log( new Status( IStatus.WARNING, "org.eclipse.emf.ecp.view.table.ui.swt", "The class " + clazz.getName() + " is abstract or an interface.")); <START> return null; <END> } final EObject modelElement = mainSetting.getEObject(); final EObject instance = clazz.getEPackage().getEFactoryInstance().create(clazz); final EditingDomain editingDomain = getEditingDomain(mainSetting); if (editingDomain == null) { return null; } editingDomain.getCommandStack().execute( AddCommand.create(editingDomain, modelElement, mainSetting.getEStructuralFeature(), instance)); return instance; }</code><technical_language>do return null throw checked exception</technical_language>

Target:
protected void addRow(EClass clazz, Setting mainSetting) { if (clazz.isAbstract() || clazz.isInterface()) { Activator .getInstance() .getLog() .log( new Status( IStatus.WARNING, "org.eclipse.emf.ecp.view.table.ui.swt", "The class " + clazz.getName() + " is abstract or an interface.")); } final EObject modelElement = mainSetting.getEObject(); final EObject instance = clazz.getEPackage().getEFactoryInstance().create(clazz); final EditingDomain editingDomain = getEditingDomain(mainSetting); if (editingDomain == null) { } editingDomain.getCommandStack().execute( AddCommand.create(editingDomain, modelElement, mainSetting.getEStructuralFeature(), instance)); }
Source:
<code>public String getBuildNumber() { <START> return properties.get("build.number"); <END> }</code><technical_language>I suggest *BuildInfoFields.BUILD_NUMBER* instead of "build.number"</technical_language>

Target:
public String getBuildNumber() { return properties.get(BuildInfoFields.BUILD_NUMBER); }
Source:
<code>public void whenGetEventsWithUknownTopicThenTopicNotFound() { given() <START> .param("batch_limit", "5") <END> .param("stream_timeout", "1") .when() .get(createStreamEndpointUrl("blah-topic")) .then() .statusCode(HttpStatus.NOT_FOUND.value()) .and() .body("detail", equalTo("topic not found")); }</code><technical_language>Is this required in order test desired behaviour</technical_language>

Target:
public void whenGetEventsWithUknownTopicThenTopicNotFound() { given() .when() .get(createStreamEndpointUrl("blah-topic")) .then() .statusCode(HttpStatus.NOT_FOUND.value()) .and() .body("detail", equalTo("topic not found")); }
Source:
<code>public AtsProgramArtifactToken(Long id, String name, ArtifactTypeToken artifactType) { <START> super(id, GUID.create(), name, CoreBranches.COMMON, artifactType); <END> }</code><technical_language>Please call ArtifactToken constructors guid</technical_language>

Target:
public AtsProgramArtifactToken(Long id, String name, ArtifactTypeToken artifactType) { super(id, name, CoreBranches.COMMON, artifactType); }
Source:
<code>public IvParameterSpec getIV(){ <START> return iv; <END> }</code><technical_language>clearer throw if key type IV instead of returning null</technical_language>

Target:
public IvParameterSpec getIV(){ if(!type.hasIV()){ throw new UnsupportedTypeException(type); } return iv; }
Source:
<code>public void parsePom(File file) { try { <START> parsePom(new FileInputStream(file)); <END> } catch (FileNotFoundException ex) { LOGGER.error("Error while opening POM file", ex); } }</code><technical_language>unclosed file stream</technical_language>

Target:
public void parsePom(File file) { try (FileInputStream fileInputStream = new FileInputStream(file)) { parsePom(fileInputStream); } catch (IOException ex) { LOGGER.error("Error while reading POM file", ex); } }
Source:
<code>protected Hits<SnomedRefSetMemberIndexEntry> filter(Hits<SnomedRefSetMemberIndexEntry> allResults) throws IOException { Multimap<String, SnomedRefSetMemberIndexEntry> referencedComponentToMemberMap = ArrayListMultimap.create(); allResults.getHits().forEach(m -> referencedComponentToMemberMap.put(m.getReferencedComponentId(), m)); Query<String> query = Query.selectPartial(String.class, SnomedDescriptionIndexEntry.class, singleton(SnomedDescriptionIndexEntry.Fields.ID)) .where(Expressions.builder() <START> .must(SnomedDescriptionIndexEntry.Expressions.ids(referencedComponentToMemberMap.keySet())) <END> .filter(SnomedDescriptionIndexEntry.Expressions.languageCode(languageCode)) .build()) .limit(referencedComponentToMemberMap.keySet().size()) .build(); List<String> descriptionIdsWithLanguageCode = getRevisionSearcher().search(query).getHits(); List<SnomedRefSetMemberIndexEntry> filteredMembers = descriptionIdsWithLanguageCode.stream() .flatMap(id -> referencedComponentToMemberMap.get(id).stream()) .collect(toList()); return new Hits<SnomedRefSetMemberIndexEntry>(filteredMembers, allResults.getOffset(), allResults.getLimit(), allResults.getTotal()); }</code><technical_language>filter() speed query execution</technical_language>

Target:
protected Hits<SnomedRefSetMemberIndexEntry> filter(Hits<SnomedRefSetMemberIndexEntry> allResults) throws IOException { Multimap<String, SnomedRefSetMemberIndexEntry> referencedComponentToMemberMap = ArrayListMultimap.create(); allResults.getHits().forEach(m -> referencedComponentToMemberMap.put(m.getReferencedComponentId(), m)); Query<String> query = Query.selectPartial(String.class, SnomedDescriptionIndexEntry.class, singleton(SnomedDescriptionIndexEntry.Fields.ID)) .where(Expressions.builder() .filter(SnomedDescriptionIndexEntry.Expressions.ids(referencedComponentToMemberMap.keySet())) .filter(SnomedDescriptionIndexEntry.Expressions.languageCode(languageCode)) .build()) .limit(referencedComponentToMemberMap.keySet().size()) .build(); List<String> descriptionIdsWithLanguageCode = getRevisionSearcher().search(query).getHits(); List<SnomedRefSetMemberIndexEntry> filteredMembers = descriptionIdsWithLanguageCode.stream() .flatMap(id -> referencedComponentToMemberMap.get(id).stream()) .collect(toList()); return new Hits<SnomedRefSetMemberIndexEntry>(filteredMembers, allResults.getOffset(), allResults.getLimit(), allResults.getTotal()); }
Source:
<code>public void logsProblem() throws Exception { final RqFallback req = new RqFallback.Fake( HttpURLConnection.HTTP_NOT_FOUND ); MatcherAssert.assertThat( <START> new FbLog4j().route(req).has(), <END> Matchers.is(false) ); }</code><technical_language>@piddubnyi 4 spaces</technical_language>

Target:
public void logsProblem() throws Exception { final ByteArrayOutputStream baos = this.setUpLoggerStream(); final RqFallback req = new RqFallback.Fake( HttpURLConnection.HTTP_NOT_FOUND ); MatcherAssert.assertThat( new FbLog4j().route(req).has(), Matchers.is(false) ); MatcherAssert.assertThat( new String(baos.toByteArray()), Matchers.stringContainsInOrder( Arrays.asList("ERROR", "failed with") ) ); }
Source:
<code>public PermissionEditor(ProjectAccess projectAccess, boolean readOnly, AccessSection section, LabelTypes labelTypes) { this.readOnly = readOnly; this.section = section; this.projectName = projectAccess.getProjectName(); this.labelTypes = labelTypes; normalName = new ValueLabel<String>(new PermissionNameRenderer(projectAccess.getCapabilities())); <START> deletedName = new ValueLabel<String>(new PermissionNameRenderer(projectAccess.getCapabilities())); <END> initWidget(uiBinder.createAndBindUi(this)); groupToAdd.setProject(projectName); rules = ListEditor.of(new RuleEditorSource()); exclusiveGroup.setEnabled(!readOnly); exclusiveGroup.setVisible(RefConfigSection .isValid(section.getName())); if (readOnly) { addContainer.removeFromParent(); addContainer = null; deletePermission.removeFromParent(); deletePermission = null; } }</code><technical_language>Reuse PermissionNameRenderer instance normalName</technical_language>

Target:
public PermissionEditor(ProjectAccess projectAccess, boolean readOnly, AccessSection section, LabelTypes labelTypes) { this.readOnly = readOnly; this.section = section; this.projectName = projectAccess.getProjectName(); this.labelTypes = labelTypes; PermissionNameRenderer nameRenderer = new PermissionNameRenderer(projectAccess.getCapabilities()); normalName = new ValueLabel<String>(nameRenderer); deletedName = new ValueLabel<String>(nameRenderer); initWidget(uiBinder.createAndBindUi(this)); groupToAdd.setProject(projectName); rules = ListEditor.of(new RuleEditorSource()); exclusiveGroup.setEnabled(!readOnly); exclusiveGroup.setVisible(RefConfigSection .isValid(section.getName())); if (readOnly) { addContainer.removeFromParent(); addContainer = null; deletePermission.removeFromParent(); deletePermission = null; } }
Source:
<code>public synchronized void parse(InputStream stream, IProgressMonitor monitor) throws IOException { this.status = null; setProgressMonitor(monitor); monitor.beginTask(Messages.repo_loading, IProgressMonitor.UNKNOWN); try { getParser(); InstallableUnitsHandler handler = new InstallableUnitsHandler(); xmlReader.setContentHandler(mode.equals(PARSER_MODE.REPO) <START> ? new <END> RepositoryDocHandler(INSTALLABLE_UNITS_ELEMENT, handler) : handler); xmlReader.parse(new InputSource(stream)); if (isValidXML()) { units = handler.getUnits(); } } catch (SAXException e) { if (!(e.getException() instanceof OperationCanceledException)) throw new IOException(e.getMessage()); } catch (ParserConfigurationException e) { throw new IOException(e.getMessage()); } finally { monitor.done(); stream.close(); } }</code><technical_language>personally, I find if more readable here. changed later</technical_language>

Target:
public synchronized void parse(InputStream stream, IProgressMonitor monitor) throws IOException { this.status = null; setProgressMonitor(monitor); monitor.beginTask(Messages.repo_loading, IProgressMonitor.UNKNOWN); try { getParser(); InstallableUnitsHandler handler = new InstallableUnitsHandler(); if (mode.equals(PARSER_MODE.REPO)) xmlReader.setContentHandler(new RepositoryDocHandler(INSTALLABLE_UNITS_ELEMENT, handler)); else xmlReader.setContentHandler(handler); xmlReader.parse(new InputSource(stream)); if (isValidXML()) { units = handler.getUnits(); } } catch (SAXException e) { if (!(e.getException() instanceof OperationCanceledException)) throw new IOException(e.getMessage()); } catch (ParserConfigurationException e) { throw new IOException(e.getMessage()); } finally { monitor.done(); stream.close(); } }
Source:
<code>public SignaturePad(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.getTheme().obtainStyledAttributes( attrs, R.styleable.SignaturePad, 0, 0); try { mMinWidth = a.getDimensionPixelSize(R.styleable.SignaturePad_minWidth, convertDpToPx(3)); mMaxWidth = a.getDimensionPixelSize(R.styleable.SignaturePad_maxWidth, convertDpToPx(7)); mVelocityFilterWeight = a.getFloat(R.styleable.SignaturePad_velocityFilterWeight, 0.9f); <START> mIsDoubleClick = a.getBoolean(R.styleable.SignaturePad_isDoubleClick, true); <END> mPaint.setColor(a.getColor(R.styleable.SignaturePad_penColor, Color.BLACK)); } finally { a.recycle(); } mPaint.setAntiAlias(true); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStrokeJoin(Paint.Join.ROUND); mDirtyRect = new RectF(); clear(); }</code><technical_language>I prefer this feature disabled default</technical_language>

Target:
public SignaturePad(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.getTheme().obtainStyledAttributes( attrs, R.styleable.SignaturePad, 0, 0); try { mMinWidth = a.getDimensionPixelSize(R.styleable.SignaturePad_minWidth, convertDpToPx(3)); mMaxWidth = a.getDimensionPixelSize(R.styleable.SignaturePad_maxWidth, convertDpToPx(7)); mVelocityFilterWeight = a.getFloat(R.styleable.SignaturePad_velocityFilterWeight, 0.9f); mClearOnDoubleClick = a.getBoolean(R.styleable.SignaturePad_clearOnDoubleClick, false); mPaint.setColor(a.getColor(R.styleable.SignaturePad_penColor, Color.BLACK)); } finally { a.recycle(); } mPaint.setAntiAlias(true); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStrokeJoin(Paint.Join.ROUND); mDirtyRect = new RectF(); clear(); }
Source:
<code>public String name() { <START> return "uncompress-request"; <END> }</code><technical_language>updating this PR I merge tagging next release. Thanks for fix btw</technical_language>

Target:
public String name() { return "uncompress"; }
Source:
<code>public void start() { synchronized (lock) { if (!started.getAndSet(true)) { if (lookupSnapshot != null) { final List<LookupBean> lookupBeanList = lookupSnapshot.pullExistingSnapshot(); for (LookupBean lookupBean : lookupBeanList ) { this.put(lookupBean.name, lookupBean.factory); } <START> if (lookupConfig.getSnapshotPeriod().getMillis() != 0) { <END> executor.scheduleAtFixedRate( new Runnable() { @Override public void run() { try { LOGGER.debug("taking snapshot"); lookupSnapshot.takeSnapshot(getAllAsList()); } catch (Exception e) { LOGGER.error(e, "Exception during periodic snapshot"); } } }, lookupConfig.getSnapshotPeriod().toStandardDuration().getMillis(), lookupConfig.getSnapshotPeriod().toStandardDuration().getMillis(), TimeUnit.MILLISECONDS ); } } LOGGER.info("Started lookup factory references manager"); } } }</code><technical_language>I benefit in periodic snapshots. This exact class mutation methods state changed. adding another background process persist change a easy clear change</technical_language>

Target:
public void start() { synchronized (lock) { if (!started.getAndSet(true)) { if (lookupSnapshotTaker != null) { final List<LookupBean> lookupBeanList = lookupSnapshotTaker.pullExistingSnapshot(); for (LookupBean lookupBean : lookupBeanList) { this.put(lookupBean.name, lookupBean.factory); } } LOGGER.info("Started lookup factory references manager"); } } }
Source:
<code>private void upsertData(String tenantId) throws SQLException { for (int u = 1; u <= NUM_USERS; u++) { String userId = "user" + userNum++; int age = RANDOM.nextInt(99) + 1; if(tenantId.equals(sourceOnlyTenant) || tenantId.equals(sourceAndTargetTenant)) { upsertData(sourceStmt, tenantId, userId, age); <START> if (u == 1 || u == 5) { <END> sourceSplitPoints.add(ByteUtil.concat(Bytes.toBytes(tenantId), QueryConstants.SEPARATOR_BYTE_ARRAY, Bytes.toBytes(userId))); } } if (tenantId.equals(sourceAndTargetTenant) || tenantId.equals(targetOnlyTenant)) { upsertData(targetStmt, tenantId, userId, age); if (u == 1) { targetSplitPoints.add(ByteUtil.concat(Bytes.toBytes(tenantId), QueryConstants.SEPARATOR_BYTE_ARRAY, Bytes.toBytes(userId))); } } } }</code><technical_language>nit: if (u ==1 || u == NUM_USERS /2)</technical_language>

Target:
private void upsertData(String tenantId) throws SQLException { for (int u = 1; u <= NUM_USERS; u++) { String userId = "user" + userNum++; int age = RANDOM.nextInt(99) + 1; if(tenantId.equals(sourceOnlyTenant) || tenantId.equals(sourceAndTargetTenant)) { upsertData(sourceStmt, tenantId, userId, age); if (u == 1 || u == NUM_USERS/2) { sourceSplitPoints.add(ByteUtil.concat(Bytes.toBytes(tenantId), QueryConstants.SEPARATOR_BYTE_ARRAY, Bytes.toBytes(userId))); } } if (tenantId.equals(sourceAndTargetTenant) || tenantId.equals(targetOnlyTenant)) { upsertData(targetStmt, tenantId, userId, age); if (u == 1) { targetSplitPoints.add(ByteUtil.concat(Bytes.toBytes(tenantId), QueryConstants.SEPARATOR_BYTE_ARRAY, Bytes.toBytes(userId))); } } } }
Source:
<code>public IStreamView get(UUID stream, StreamOptions options) { IStreamView streamView = runtime.getLayoutView().getLayout().getLatestSegment() .getReplicationMode().getStreamView(runtime, stream, options); <START> return streamView; <END> }</code><technical_language>this line is removed? This is meant cache raw streams (thread-safe streams)</technical_language>

Target:
public IStreamView get(UUID stream, StreamOptions options) { IStreamView streamView = runtime.getLayoutView().getLayout().getLatestSegment() .getReplicationMode().getStreamView(runtime, stream, options); streamCache.put(stream, streamView); return streamView; }
Source:
<code>public void shouldNotCreateDirectoryForNonNativeTableInDumpDirectory() throws Throwable { String createTableQuery = "CREATE TABLE custom_serdes( serde_id bigint COMMENT 'from deserializer', name string " + "COMMENT 'from deserializer', slib string COMMENT 'from deserializer') " + "ROW FORMAT SERDE 'org.apache.hive.storage.jdbc.JdbcSerDe' " + "STORED BY 'org.apache.hive.storage.jdbc.JdbcStorageHandler' " + "WITH SERDEPROPERTIES ('serialization.format'='1') " + "TBLPROPERTIES ( " + "'hive.sql.database.type'='METASTORE', " + "'hive.sql.query'='SELECT \"SERDE_ID\", \"NAME\", \"SLIB\" FROM \"SERDES\"')"; WarehouseInstance.Tuple bootstrapTuple = primary .run("use " + primaryDbName) .run(createTableQuery).dump(primaryDbName, null); <START> Path cSerdesTableDumpLocation = new Path(bootstrapTuple.dumpLocation <END> + Path.SEPARATOR + primaryDbName + Path.SEPARATOR + "custom_serdes"); FileSystem fs = cSerdesTableDumpLocation.getFileSystem(primary.hiveConf); assertFalse(fs.exists(cSerdesTableDumpLocation)); }</code><technical_language>instead of path separator create new path generic</technical_language>

Target:
public void shouldNotCreateDirectoryForNonNativeTableInDumpDirectory() throws Throwable { String createTableQuery = "CREATE TABLE custom_serdes( serde_id bigint COMMENT 'from deserializer', name string " + "COMMENT 'from deserializer', slib string COMMENT 'from deserializer') " + "ROW FORMAT SERDE 'org.apache.hive.storage.jdbc.JdbcSerDe' " + "STORED BY 'org.apache.hive.storage.jdbc.JdbcStorageHandler' " + "WITH SERDEPROPERTIES ('serialization.format'='1') " + "TBLPROPERTIES ( " + "'hive.sql.database.type'='METASTORE', " + "'hive.sql.query'='SELECT \"SERDE_ID\", \"NAME\", \"SLIB\" FROM \"SERDES\"')"; WarehouseInstance.Tuple bootstrapTuple = primary .run("use " + primaryDbName) .run(createTableQuery).dump(primaryDbName, null); Path cSerdesTableDumpLocation = new Path( new Path(bootstrapTuple.dumpLocation, primaryDbName), "custom_serdes"); FileSystem fs = cSerdesTableDumpLocation.getFileSystem(primary.hiveConf); assertFalse(fs.exists(cSerdesTableDumpLocation)); }
Source:
<code>public void testRequestRollWithMultiWal() throws Exception { Map<FSHLog, Path> wals = new HashMap<>(); for (int i = 1; i <= 3; i++) { FSHLog wal = new FSHLog(FS, ROOT_DIR, LOG_DIR, ARCHIVE_DIR, CONF, null, true, WAL_PREFIX, getWALSuffix(i)); wal.init(); wals.put(wal, wal.getCurrentFileName()); ROLLER.addWAL(wal); <START> Thread.sleep(3000); <END> } Iterator<Map.Entry<FSHLog, Path>> it = wals.entrySet().iterator(); Map.Entry<FSHLog, Path> walEntry = it.next(); walEntry.getKey().requestLogRoll(); Thread.sleep(5000); assertNotEquals(walEntry.getValue(), walEntry.getKey().getCurrentFileName()); walEntry.setValue(walEntry.getKey().getCurrentFileName()); while (it.hasNext()) { walEntry = it.next(); assertEquals(walEntry.getValue(), walEntry.getKey().getCurrentFileName()); } Thread.sleep(LOG_ROLL_PERIOD + 5000); for (Map.Entry<FSHLog, Path> entry : wals.entrySet()) { assertNotEquals(entry.getValue(), entry.getKey().getCurrentFileName()); entry.getKey().close(); } }</code><technical_language>need a 3 sec sleep here?</technical_language>

Target:
public void testRequestRollWithMultiWal() throws Exception { Map<FSHLog, Path> wals = new HashMap<>(); for (int i = 1; i <= 3; i++) { FSHLog wal = new FSHLog(FS, ROOT_DIR, LOG_DIR, ARCHIVE_DIR, CONF, null, true, WAL_PREFIX, getWALSuffix(i)); wal.init(); wals.put(wal, wal.getCurrentFileName()); ROLLER.addWAL(wal); Thread.sleep(1000); } Iterator<Map.Entry<FSHLog, Path>> it = wals.entrySet().iterator(); Map.Entry<FSHLog, Path> walEntry = it.next(); walEntry.getKey().requestLogRoll(); Thread.sleep(5000); assertNotEquals(walEntry.getValue(), walEntry.getKey().getCurrentFileName()); walEntry.setValue(walEntry.getKey().getCurrentFileName()); while (it.hasNext()) { walEntry = it.next(); assertEquals(walEntry.getValue(), walEntry.getKey().getCurrentFileName()); } Thread.sleep(LOG_ROLL_PERIOD + 5000); for (Map.Entry<FSHLog, Path> entry : wals.entrySet()) { assertNotEquals(entry.getValue(), entry.getKey().getCurrentFileName()); entry.getKey().close(); } }
Source:
<code>public void testCreateSmbFileObjectWithBackSlash3() throws IOException { System.setProperty("file.separator", "\\"); SmbShare smbShare = new SmbShare("smb://myshare\\shared\\"); SmbSession smbSession = new SmbSession(smbShare); SmbFile smbFile = smbSession.createSmbFileObject("..\\another"); <START> assertEquals("smb://myshare/shared/../another", smbFile.getCanonicalPath()); <END> }</code><technical_language>This is wrong, too. If request create a file in root of smb://myshare, need pursue anyway. happened relative path resolution in this new client</technical_language>

Target:
public void testCreateSmbFileObjectWithBackSlash3() throws IOException { System.setProperty("file.separator", "\\"); SmbConfig config = new SmbConfig(); config.setHost("myshare"); config.setPort(445); config.setShareAndDir("shared\\"); SmbShare smbShare = new SmbShare(config); SmbSession smbSession = new SmbSession(smbShare); SmbFile smbFile = smbSession.createSmbFileObject("..\\another"); assertEquals("smb://myshare:445/another", smbFile.getPath()); smbSession.close(); }
Source:
<code>public void listSettings() { ConfigurationClient configurationClient = createSyncConfigurationClient(); SettingSelector settingSelector = new SettingSelector().keys("prodDBConnection"); PagedIterable<ConfigurationSetting> csStream = configurationClient.listSettings(settingSelector); csStream.streamByPage().forEach(setting -> { System.out.printf("Key: %s, Value: %s", setting.value().get(0).key(), setting.value().get(0).value()); <START> }); <END> END: com.azure.data.applicationconfig.configurationclient.listSettings#settingSelector }</code><technical_language>This sample considerably more complex. a need 'streamByPage' here, removed simplified</technical_language>

Target:
public void listSettings() { ConfigurationClient configurationClient = createSyncConfigurationClient(); SettingSelector settingSelector = new SettingSelector().keys("prodDBConnection"); configurationClient.listSettings(settingSelector).forEach(setting -> { System.out.printf("Key: %s, Value: %s", setting.key(), setting.value()); }); END: com.azure.data.applicationconfig.configurationclient.listSettings#settingSelector }
Source:
<code>public void stop() throws InterruptedException { scheduler.shutdown(); <START> scheduler.awaitTermination(60, TimeUnit.SECONDS); <END> if (!scheduler.isTerminated()) { LOG.warn("Unable to terminate scheduler"); } }</code><technical_language>block for more task shutdown ms, ideally less. call shutdownNow() if timeout expires</technical_language>

Target:
public void stop() throws InterruptedException { scheduler.shutdown(); scheduler.awaitTermination(terminationDuration.toMillis(), TimeUnit.MILLISECONDS); if (!scheduler.isTerminated()) { LOG.warn("Unable to terminate scheduler"); scheduler.shutdownNow(); } }
Source:
<code>public static void addUser() throws IOException, CommandFailedException { OfflineManagementClient offlineClient = ManagementClient.offline( OfflineOptions.standalone() <START> .rootDirectory(new File(System.getProperty("user.dir"), "target/jboss-as")) <END> .configurationFile("standalone.xml") .build()); offlineClient.apply(PropertiesFileAuth.mgmtUsers().defineUser(USERNAME, PASS)); }</code><technical_language>I new File("target/jboss-as") work same</technical_language>

Target:
public static void addUser() throws IOException, CommandFailedException { offlineClient = ManagementClient.offline( OfflineOptions.standalone() .rootDirectory(new File("target/jboss-as")) .configurationFile("standalone.xml") .build()); offlineClient.apply(PropertiesFileAuth.mgmtUsers().defineUser(USERNAME, PASS)); }
Source:
<code>public static Intent getPlayerIntent(@NonNull final Context context, @NonNull final Class targetClazz, @NonNull final PlayQueue playQueue, @Nullable final String quality, final boolean resumePlayback) { Intent intent = new Intent(context, targetClazz); final String cacheKey = SerializedCache.getInstance().put(playQueue, PlayQueue.class); if (cacheKey != null) intent.putExtra(VideoPlayer.PLAY_QUEUE_KEY, cacheKey); if (quality != null) intent.putExtra(VideoPlayer.PLAYBACK_QUALITY, quality); intent.putExtra(VideoPlayer.RESUME_PLAYBACK, resumePlayback); <START> int playerType = intent.getIntExtra(VideoPlayer.PLAYER_TYPE, VideoPlayer.PLAYER_TYPE_VIDEO); <END> intent.putExtra(VideoPlayer.PLAYER_TYPE, playerType); return intent; }</code><technical_language>retrieving data a newly generated intent? Also, I this function is a putExtra(VideoPlayer.PLAYER_TYPE, playerType argument</technical_language>

Target:
public static Intent getPlayerIntent(@NonNull final Context context, @NonNull final Class targetClazz, @NonNull final PlayQueue playQueue, @Nullable final String quality, final boolean resumePlayback) { Intent intent = new Intent(context, targetClazz); final String cacheKey = SerializedCache.getInstance().put(playQueue, PlayQueue.class); if (cacheKey != null) { intent.putExtra(VideoPlayer.PLAY_QUEUE_KEY, cacheKey); } if (quality != null) { intent.putExtra(VideoPlayer.PLAYBACK_QUALITY, quality); } intent.putExtra(VideoPlayer.RESUME_PLAYBACK, resumePlayback); intent.putExtra(VideoPlayer.PLAYER_TYPE, VideoPlayer.PLAYER_TYPE_VIDEO); return intent; }
Source:
<code>public void execute(final ExecutionStack stack, final IDelegateBridge bridge) { if (battleState.isOver() || isDestroyerPresent() || isEvaderNotPresent() || isRetreatNotPossible() || isAutoWinScenario()) { return; } final Collection<Unit> unitsToRetreat = CollectionUtils.getMatches( battleState.getUnits(BattleState.Side.OFFENSE), Matches.unitCanEvade()); if (unitsToRetreat.isEmpty()) { return; } final Collection<Territory> retreatTerritories; <START> if (Properties.getSubmersibleSubs(battleState.getGameData())) { <END> retreatTerritories = List.of(battleState.getBattleSite()); } else { retreatTerritories = battleState.getAttackerRetreatTerritories(); } EvaderRetreat.retreatUnits( EvaderRetreat.Parameters.builder() .battleState(battleState) .battleActions(battleActions) .side(BattleState.Side.OFFENSE) .bridge(bridge) .possibleRetreatSites(retreatTerritories) .units(unitsToRetreat) .step(getName()) .build()); }</code><technical_language>nit, good place for a ternary here. thoughts objections that</technical_language>

Target:
public void execute(final ExecutionStack stack, final IDelegateBridge bridge) { if (battleState.isOver() || isDestroyerPresent() || isEvaderNotPresent() || isRetreatNotPossible() || isAutoWinScenario()) { return; } final Collection<Unit> unitsToRetreat = CollectionUtils.getMatches( battleState.getUnits(BattleState.Side.OFFENSE), Matches.unitCanEvade()); if (unitsToRetreat.isEmpty()) { return; } EvaderRetreat.retreatUnits( EvaderRetreat.Parameters.builder() .battleState(battleState) .battleActions(battleActions) .side(BattleState.Side.OFFENSE) .bridge(bridge) .units(unitsToRetreat) .build(), Properties.getSubmersibleSubs(battleState.getGameData()) ? List.of(battleState.getBattleSite()) : battleState.getAttackerRetreatTerritories(), getName()); }
Source:
<code>public Signature(StreamInput in) throws IOException { name = new FunctionName(in); kind = FunctionInfo.Type.values()[in.readVInt()]; int argsSize = in.readVInt(); argumentTypes = new ArrayList<>(argsSize); for (int i = 0; i < argsSize; i++) { <START> argumentTypes.add(new TypeSignature(in)); <END> } returnType = new TypeSignature(in); int variableConstraintsSize = in.readVInt(); typeVariableConstraints = new ArrayList<>(variableConstraintsSize); for (int i = 0; i < variableConstraintsSize; i++) { typeVariableConstraints.add(new TypeVariableConstraint(in)); } int arityGroupSize = in.readVInt(); variableArityGroup = new ArrayList<>(arityGroupSize); for (int i = 0; i < arityGroupSize; i++) { variableArityGroup.add(new TypeSignature(in)); } variableArity = in.readBoolean(); allowCoercion = in.readBoolean(); }</code><technical_language>Is this safe stream TypeSignature this? I this lose information if ObjectParameterTypeSignature</technical_language>

Target:
public Signature(StreamInput in) throws IOException { name = new FunctionName(in); kind = FunctionInfo.Type.values()[in.readVInt()]; int argsSize = in.readVInt(); argumentTypes = new ArrayList<>(argsSize); for (int i = 0; i < argsSize; i++) { argumentTypes.add(TypeSignature.fromStream(in)); } returnType = TypeSignature.fromStream(in); bindingInfo = null; }
Source:
<code>private MetricRegistryImpl createMetricRegistry(String retentionPolicy, InfluxDB.ConsistencyLevel consistencyLevel) { MetricConfig metricConfig = new MetricConfig(); <START> metricConfig.setProperty(InfluxdbReporterOptions.SCHEME.key(), "http"); <END> metricConfig.setProperty(InfluxdbReporterOptions.HOST.key(), "localhost"); metricConfig.setProperty(InfluxdbReporterOptions.PORT.key(), String.valueOf(wireMockRule.port())); metricConfig.setProperty(InfluxdbReporterOptions.DB.key(), TEST_INFLUXDB_DB); metricConfig.setProperty(InfluxdbReporterOptions.RETENTION_POLICY.key(), retentionPolicy); metricConfig.setProperty(InfluxdbReporterOptions.CONSISTENCY.key(), consistencyLevel.name()); return new MetricRegistryImpl( MetricRegistryConfiguration.defaultMetricRegistryConfiguration(), Collections.singletonList(ReporterSetup.forReporter("test", metricConfig, new InfluxdbReporter()))); }</code><technical_language>I this necessary http is default value</technical_language>

Target:
private MetricRegistryImpl createMetricRegistry(String retentionPolicy, InfluxDB.ConsistencyLevel consistencyLevel) { MetricConfig metricConfig = new MetricConfig(); metricConfig.setProperty(InfluxdbReporterOptions.HOST.key(), "localhost"); metricConfig.setProperty(InfluxdbReporterOptions.PORT.key(), String.valueOf(wireMockRule.port())); metricConfig.setProperty(InfluxdbReporterOptions.DB.key(), TEST_INFLUXDB_DB); metricConfig.setProperty(InfluxdbReporterOptions.RETENTION_POLICY.key(), retentionPolicy); metricConfig.setProperty(InfluxdbReporterOptions.CONSISTENCY.key(), consistencyLevel.name()); return new MetricRegistryImpl( MetricRegistryConfiguration.defaultMetricRegistryConfiguration(), Collections.singletonList(ReporterSetup.forReporter("test", metricConfig, new InfluxdbReporter()))); }
Source:
<code>public boolean decode(byte[] wbxmlBody) { int i = 4; if (false == ((wbxmlBody[i] & WBXML_TOKEN_MASK) == 0x05)) { return false; } if (false == ((wbxmlBody[i] & WBXML_TOKEN_WITH_ATTRS) == WBXML_TOKEN_WITH_ATTRS)) { return false; } i++; if ((wbxmlBody[i] & WBXML_TOKEN_MASK) == 0x05) { i += 8; } <START> if (false == ((wbxmlBody[i] & WBXML_TOKEN_MASK) == 0x06 || (wbxmlBody[i] & WBXML_TOKEN_MASK) == 0x07)) { <END> return false; } if (wbxmlBody[i + 1] != WBXML_INLINE_STRING) { return false; } i += 2; int len = 0; int j = i; while (wbxmlBody[j] != 0) { j++; len++; } String value = new String(wbxmlBody, i, len); mEmailAddress = value; return true; }</code><technical_language>1-- columns</technical_language>

Target:
public boolean decode(byte[] wbxmlBody) { try { int i = 4; if (false == ((wbxmlBody[i] & WBXML_TOKEN_MASK) == 0x05)) { return false; } if (false == ((wbxmlBody[i] & WBXML_TOKEN_WITH_ATTRS) == WBXML_TOKEN_WITH_ATTRS)) { return false; } i++; if ((wbxmlBody[i] & WBXML_TOKEN_MASK) == 0x05) { i += 8; } if (false == ((wbxmlBody[i] & WBXML_TOKEN_MASK) == 0x06 || (wbxmlBody[i] & WBXML_TOKEN_MASK) == 0x07)) { return false; } if (wbxmlBody[i + 1] != WBXML_INLINE_STRING) { return false; } i += 2; int len = 0; int j = i; while (wbxmlBody[j] != 0) { j++; len++; } String value = new String(wbxmlBody, i, len); mEmailAddress = value; return true; } catch (Exception e) { if (Email.DEBUG) { Log.d(Email.LOG_TAG, "EMNReceiver::onReceive() exception caught"); } } return false; }
Source:
<code>private static String runJob(final File repository, final String jobName) throws Exception { final String jobFileName = URLDecoder.decode(new File(repository, "jobs/" + jobName + ".analysis.xml").getPath(), "UTF-8"); final String confFileName = <START> URLDecoder.decode(new File(repository, "conf.xml").getPath(), "UTF-8"); <END> final ProcessBuilder builder = new ProcessBuilder(JAVA_EXECUTABLE, "-cp", System.getProperty("java.class.path"), Main.class.getCanonicalName(), "-job", jobFileName, "-conf", confFileName); final Process process = builder.start(); final StringBuilder result = new StringBuilder(); new Thread(() -> { try { final InputStream is = process.getInputStream(); int c; while ((c = is.read()) != -1) { result.append((char) c); } } catch (IOException e) { e.printStackTrace(); } }).start(); assertEquals(0, process.waitFor()); return result.toString(); }</code><technical_language>logic is repeated twice, extract a helper method</technical_language>

Target:
private static String runJob(final File repository, final String jobName) throws Exception { final String jobFileName = getAbsoluteFilename(repository, "jobs/" + jobName + ".analysis.xml"); final String confFileName = getAbsoluteFilename(repository, "conf.xml"); final ProcessBuilder builder = new ProcessBuilder(JAVA_EXECUTABLE, "-cp", System.getProperty("java.class.path"), Main.class.getCanonicalName(), "-job", jobFileName, "-conf", confFileName); final Process process = builder.start(); final StringBuilder result = new StringBuilder(); new Thread(() -> { try { final InputStream is = process.getInputStream(); int c; while ((c = is.read()) != -1) { result.append((char) c); } } catch (IOException e) { e.printStackTrace(); } }).start(); assertEquals(0, process.waitFor()); return result.toString(); }
Source:
<code>public static Collaboration getBaseProtocol(Resource resource) { if (resource != null && resource.getContents().size() > 0) { for (EObject eObject : resource.getContents()) { <START> if (eObject instanceof Collaboration && ProtocolUtils.isProtocol(eObject)) { <END> if (isBaseProtocol((Collaboration) eObject)) { return (Collaboration) eObject; } } } } else { Activator.log.error("Impossible to get content of the Model Library", null); } return null; }</code><technical_language>Again, protocols resource roots</technical_language>

Target:
public static Collaboration getBaseProtocol(Resource resource) { if (resource != null && resource.getContents().size() > 0) { TreeIterator<EObject> allContents = resource.getAllContents(); while (allContents.hasNext()) { EObject eObject = allContents.next(); if (eObject instanceof Collaboration && ProtocolUtils.isProtocol(eObject)) { if (isBaseProtocol((Collaboration) eObject)) { return (Collaboration) eObject; } } } } else { Activator.log.error("Impossible to get content of the Model Library", null); } return null; }
Source:
<code>public List<List<String>> lemmatize(final List<String> tokens, final List<String> posTags) { <START> List<List<String>> allLemmas = new ArrayList<List<String>>(); <END> for (int i = 0; i < tokens.size(); i++) { allLemmas.add(this.getAllLemmas(tokens.get(i), posTags.get(i))); } return allLemmas; }</code><technical_language>need type RHS</technical_language>

Target:
public List<List<String>> lemmatize(final List<String> tokens, final List<String> posTags) { List<List<String>> allLemmas = new ArrayList<>(); for (int i = 0; i < tokens.size(); i++) { allLemmas.add(this.getAllLemmas(tokens.get(i), posTags.get(i))); } return allLemmas; }
Source:
<code>private HiveReader(HiveSourceSplit split) throws IOException { JobConf clonedConf = new JobConf(jobConfWrapper.conf()); addSchemaToConf(clonedConf); HiveTableInputSplit oldSplit = new HiveTableInputSplit(-1, split.toMapRedSplit(), clonedConf, split.getHiveTablePartition()); hiveMapredSplitReader = new HiveMapredSplitReader(clonedConf, partitionKeys, fieldTypes, selectedFields, oldSplit, hiveShim); <START> serializer = new RowDataSerializer((RowType) producedDataType.getLogicalType()); <END> }</code><technical_language>If want migrate HiveMapredSplitReader now, create JIRA for this</technical_language>

Target:
private HiveReader(HiveSourceSplit split) throws IOException { selectedFields = computeSelectedFields(); JobConf clonedConf = new JobConf(jobConfWrapper.conf()); addSchemaToConf(clonedConf); HiveTableInputSplit oldSplit = new HiveTableInputSplit(-1, split.toMapRedSplit(), clonedConf, split.getHiveTablePartition()); hiveMapredSplitReader = new HiveMapredSplitReader(clonedConf, partitionKeys, fieldTypes, selectedFields, oldSplit, hiveShim); serializer = new RowDataSerializer(producedRowType); }
Source:
<code>public void onTimer(MessageCollector collector, TaskCoordinator coordinator) { <START> List<TriggerKey<WK>> keys = triggerScheduler.runPendingCallbacks(); <END> for (TriggerKey<WK> key : keys) { TriggerImplWrapper triggerImplWrapper = triggers.get(key); if (triggerImplWrapper != null) { triggerImplWrapper.onTimer(key, collector, coordinator); } } }</code><technical_language>nit: I thought pattern allow window operator specific code lives scheduler invoke callbacks accordingly, like: triggerScheduler.runPendingCallbacks((key) -> { TriggerImplWrapper wrapper = triggers.get(key); if (wrapper != null) { wrapper.onTimer(key, collector, coordinator); } }) strong this point. If specific reasons to, I fine current code</technical_language>

Target:
public void onTimer(MessageCollector collector, TaskCoordinator coordinator) { List<TriggerKey<WK>> keys = triggerScheduler.runPendingCallbacks(); for (TriggerKey<WK> key : keys) { TriggerImplHandler triggerImplHandler = triggers.get(key); if (triggerImplHandler != null) { triggerImplHandler.onTimer(key, collector, coordinator); } } }