auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { if (trustManager != null) { try { trustManager.checkServerTrusted(chain, authType); return; } catch (Exception e) { } } X509Certificate ca = getCACert(chain); if (ca != null) { if (!isAccepted(ca)) { System.err.println("SSL Error:Server certificate chain verification failed."); throw new CertificateException("Server certificate chain verification failed."); } String id = String.valueOf(System.currentTimeMillis()); X509TrustManager tmpTrustManager = null; try { ks.setCertificateEntry(id, ca); tmpTrustManager = initTrustManager(ks); } catch (Exception e) { System.err.println("ASF Truster: Failed to create tmp trust store : " + e.getMessage()); throw new CertificateException(e); } try { tmpTrustManager.checkServerTrusted(chain, authType); if (this.isSaveCA) { saveStore(); trustManager = tmpTrustManager; } return; } catch (CertificateException e) { System.err.println("SSL Error:Server certificate chain verification failed and \\nthe CA is missing."); throw e; } } else { System.err .println( "SSL Error:CA certificate is not in the server certificate chain.\nPlease use the keytool command to import the server certificate."); throw new CertificateException( <START> "CA certificate is not in the server certificate chain.\\nPlease use the keytool command to import the server certificate."); <END> } }</code><technical_language>\\n</technical_language>

Target:
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { if (trustManager != null) { try { trustManager.checkServerTrusted(chain, authType); return; } catch (Exception e) { } } X509Certificate ca = getCACert(chain); if (ca != null) { if (!isAccepted(ca)) { throw new CertificateException("Server certificate chain verification failed."); } String id = String.valueOf(System.currentTimeMillis()); X509TrustManager tmpTrustManager = null; try { ks.setCertificateEntry(id, ca); tmpTrustManager = initTrustManager(ks); } catch (Exception e) { throw new CertificateException("ASF Truster: Failed to create tmp trust store", e); } try { tmpTrustManager.checkServerTrusted(chain, authType); if (this.isSaveCA) { saveStore(); trustManager = tmpTrustManager; } return; } catch (CertificateException e) { throw new CertificateException( "SSL Error:Server certificate chain verification failed and \nthe CA is missing.", e); } } else { throw new CertificateException( "CA certificate is not in the server certificate chain.\nPlease use the keytool command to import the server certificate."); } }
Source:
<code>public void testSaveAndLoadSnapshotInfo() throws Exception { File rootDir = folder.newFolder(); OMRatisSnapshotInfo omRatisSnapshotInfo = new OMRatisSnapshotInfo(rootDir); Assert.assertEquals(0, omRatisSnapshotInfo.getTerm()); Assert.assertEquals(-1, omRatisSnapshotInfo.getIndex()); int snapshotIndex = 10; int termIndex = 2; omRatisSnapshotInfo.updateTerm(termIndex); omRatisSnapshotInfo.saveRatisSnapshotToDisk(snapshotIndex); Assert.assertEquals(2, omRatisSnapshotInfo.getTerm()); <START> Assert.assertEquals(10, omRatisSnapshotInfo.getIndex()); <END> OMRatisSnapshotInfo newSnapshotInfo = new OMRatisSnapshotInfo(rootDir); Assert.assertEquals(2, newSnapshotInfo.getTerm()); Assert.assertEquals(10, newSnapshotInfo.getIndex()); }</code><technical_language>do 2 10</technical_language>

Target:
public void testSaveAndLoadSnapshotInfo() throws Exception { File rootDir = folder.newFolder(); OMRatisSnapshotInfo omRatisSnapshotInfo = new OMRatisSnapshotInfo(rootDir); Assert.assertEquals(0, omRatisSnapshotInfo.getTerm()); Assert.assertEquals(-1, omRatisSnapshotInfo.getIndex()); Random random = new Random(); int snapshotIndex = random.nextInt(50); int termIndex = random.nextInt(10); omRatisSnapshotInfo.updateTerm(termIndex); omRatisSnapshotInfo.saveRatisSnapshotToDisk(snapshotIndex); Assert.assertEquals(termIndex, omRatisSnapshotInfo.getTerm()); Assert.assertEquals(snapshotIndex, omRatisSnapshotInfo.getIndex()); OMRatisSnapshotInfo newSnapshotInfo = new OMRatisSnapshotInfo(rootDir); Assert.assertEquals(termIndex, newSnapshotInfo.getTerm()); Assert.assertEquals(snapshotIndex, newSnapshotInfo.getIndex()); }
Source:
<code>public static void show(UIFacade uiFacade, RssUpdate update) { JEditorPane versionRow = createHtml(GanttLanguage.getInstance().formatText("updateAvailable", update.getVersion())); JEditorPane descriptionRow = createHtml(update.getDescription()); Box dialogBox = Box.createVerticalBox(); dialogBox.add(versionRow); dialogBox.add(descriptionRow); JPanel panel = new JPanel(); panel.add(dialogBox); OkAction okAction = new OkAction() { @Override public void actionPerformed(ActionEvent e) { } }; <START> UIFacade.Dialog dlg = uiFacade.createDialog(panel, new Action[] { okAction, CancelAction.EMPTY }, ""); <END> dlg.show(); }</code><technical_language>Wrap dialog creation showing SwingUtilities.invokeLater call</technical_language>

Target:
public static void show(UIFacade uiFacade, RssUpdate update) { JEditorPane versionRow = createHtml(GanttLanguage.getInstance().formatText("updateAvailable", update.getVersion())); JEditorPane descriptionRow = createHtml(update.getDescription()); Box dialogBox = Box.createVerticalBox(); dialogBox.add(versionRow); dialogBox.add(descriptionRow); JPanel panel = new JPanel(); panel.add(dialogBox); OkAction okAction = new OkAction() { @Override public void actionPerformed(ActionEvent e) { } }; SwingUtilities.invokeLater(() -> { UIFacade.Dialog dlg = uiFacade.createDialog(panel, new Action[] { okAction, CancelAction.EMPTY }, ""); dlg.show(); }); }
Source:
<code>public void testInitNonEmptyRepository() { try { File directory = createTempDirectory("testInitRepository2"); File someFile = new File(directory, "someFile"); someFile.createNewFile(); assertTrue(someFile.exists()); assertTrue(directory.listFiles().length > 0); InitCommand command = new InitCommand(); command.setDirectory(directory); Repository repository = command.call().getRepository(); addRepoToClose(repository); assertNotNull(repository); <START> } catch (Exception e) { <END> fail(e.getMessage()); } }</code><technical_language>Please throw Exception</technical_language>

Target:
public void testInitNonEmptyRepository() throws IOException { File directory = createTempDirectory("testInitRepository2"); File someFile = new File(directory, "someFile"); someFile.createNewFile(); assertTrue(someFile.exists()); assertTrue(directory.listFiles().length > 0); InitCommand command = new InitCommand(); command.setDirectory(directory); Repository repository = command.call().getRepository(); addRepoToClose(repository); assertNotNull(repository); }
Source:
<code>public ProviderInfo getProviderInfo() { <START> return null; <END> }</code><technical_language>is OK return null here? CredentialsProvider interface unexpected behaviour</technical_language>

Target:
public ProviderInfo getProviderInfo() { return new ProviderInfo(BASIC_PROVIDER_NAME); }
Source:
<code>protected void executeVmCommand() { MigrateBrokerVDSCommand<?> command = new MigrateBrokerVDSCommand<>(getParameters()); command.execute(); VDSReturnValue vdsReturnValue = command.getVDSReturnValue(); VM vm = getVmDao().get(getParameters().getVmId()); if (vdsReturnValue.getSucceeded()) { ResourceManager.getInstance().AddAsyncRunningVm(getParameters().getVmId()); <START> ResourceManager.getInstance().InternalSetVmStatus(vm, VMStatus.MigratingFrom, vm.getStatusUpdatedTime()); <END> vm.setMigratingToVds(getParameters().getDstVdsId()); vmManager.update(vm.getDynamicData()); getVDSReturnValue().setReturnValue(VMStatus.MigratingFrom); } else { log.error("Failed Vm migration"); getVDSReturnValue().setSucceeded(false); getVDSReturnValue().setReturnValue(vm.getStatus()); getVDSReturnValue().setVdsError(vdsReturnValue.getVdsError()); getVDSReturnValue().setExceptionString(vdsReturnValue.getExceptionString()); getVDSReturnValue().setExceptionObject(vdsReturnValue.getExceptionObject()); } }</code><technical_language>needed (the is null anyway)</technical_language>

Target:
protected void executeVmCommand() { MigrateBrokerVDSCommand<?> command = new MigrateBrokerVDSCommand<>(getParameters()); command.execute(); VDSReturnValue vdsReturnValue = command.getVDSReturnValue(); VM vm = getVmDao().get(getParameters().getVmId()); if (vdsReturnValue.getSucceeded()) { ResourceManager.getInstance().AddAsyncRunningVm(getParameters().getVmId()); ResourceManager.getInstance().InternalSetVmStatus(vm, VMStatus.MigratingFrom); vm.setMigratingToVds(getParameters().getDstVdsId()); vmManager.update(vm.getDynamicData()); getVDSReturnValue().setReturnValue(VMStatus.MigratingFrom); } else { log.error("Failed Vm migration"); getVDSReturnValue().setSucceeded(false); getVDSReturnValue().setReturnValue(vm.getStatus()); getVDSReturnValue().setVdsError(vdsReturnValue.getVdsError()); getVDSReturnValue().setExceptionString(vdsReturnValue.getExceptionString()); getVDSReturnValue().setExceptionObject(vdsReturnValue.getExceptionObject()); } }
Source:
<code><START> public void testAnEnabledRoomIsAvailableInTheTablet() throws InterruptedException{ <END> HomeTabletPage homeTabletPage = new HomeTabletPage(); SettingsPage settingsPage = homeTabletPage.clickSettingsBtn(); homeTabletPage = settingsPage.selectRoom(roomName); SearchPage searchPage = homeTabletPage.clickSearchBtn(); searchPage.clickCollapseAdvancedBtn(); searchPage.setName(roomName); Assert.assertTrue(searchPage.roomIsDiplayed(roomName)); }</code><technical_language>Please remove " throws InterruptedException", I need</technical_language>

Target:
public void testAnEnabledRoomIsAvailableInTheTablet() { HomeTabletPage homeTabletPage = new HomeTabletPage(); SettingsPage settingsPage = homeTabletPage.clickSettingsBtn(); homeTabletPage = settingsPage.selectRoom(roomName); SearchPage searchPage = homeTabletPage.clickSearchBtn() .clickCollapseAdvancedBtn() .setName(roomName); Assert.assertTrue(searchPage.roomIsDiplayed(roomName)); }
Source:
<code>Matrix mul(Matrix that) { float[][] a = this.m; float[][] b = that.m; final int rowsA = a.length; final int colsA = a[0].length; final int rowsB = b.length; final int colsB = b[0].length; if (colsA != rowsB) { <START> throw new AssertionError("Matrix with " + colsA + " columns cannot be multiplied with matrix with " + colsB + " rows"); <END> } float[][] c = new float[rowsA][colsB]; for (int i = 0; i < rowsA; i++) { for (int j = 0; j < colsB; j++) { for (int k = 0; k < colsA; k++) { c[i][j] += a[i][k] * b[k][j]; } } } return new Matrix(c); }</code><technical_language>This is a real Error, I this, a RuntimeException more (also applies other of AssertionError)</technical_language>

Target:
Matrix mul(Matrix that) { float[][] a = this.m; float[][] b = that.m; final int rowsA = a.length; final int colsA = a[0].length; final int rowsB = b.length; final int colsB = b[0].length; if (colsA != rowsB) { throw new ArithmeticException("Matrix with " + colsA + " columns cannot be multiplied with matrix with " + colsB + " rows"); } float[][] c = new float[rowsA][colsB]; for (int i = 0; i < rowsA; i++) { for (int j = 0; j < colsB; j++) { for (int k = 0; k < colsA; k++) { c[i][j] += a[i][k] * b[k][j]; } } } return new Matrix(c); }
Source:
<code>public TimerEvent(@JsonProperty("cronExpression") final String cronExpression) { <START> this.cronExpression = cronExpression; <END> }</code><technical_language>want check for notEmpty</technical_language>

Target:
public TimerEvent(@JsonProperty("cronExpression") final String cronExpression) { this.cronExpression = notEmpty(cronExpression, "cronExpression"); }
Source:
<code>public void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { element.setAttribute(XMLConstants.ID,XMLConstants.CUSTOM_REPORTING_SERVICE); builder.setParentName(XMLConstants.DEFAULT_REPORTING_SERVICE); <START> builder.addPropertyValue(XMLConstants.REPORT_TYPE,element.getAttribute(XMLConstants.REPORT_TYPE)); <END> builder.addPropertyValue(XMLConstants.ROOT_TEMPLATE_LOCATION,element.getAttribute(XMLConstants.ROOT_TEMPLATE_LOCATION)); builder.addPropertyValue(XMLConstants.OUTPUT_REPORT_LOCATION,element.getAttribute(XMLConstants.OUTPUT_REPORT_LOCATION)); try{ parserContext.getRegistry().removeAlias(XMLConstants.REPORTING_SERVICE); } catch (Exception e){ } List<Element> elements = DomUtils.getChildElements(element); for(Element el : elements){ parserContext.getDelegate().parseCustomElement(el); } parserContext.getRegistry().registerAlias(XMLConstants.CUSTOM_REPORTING_SERVICE, XMLConstants.REPORTING_SERVICE); }</code><technical_language>super.doParse parse attributes for you</technical_language>

Target:
public void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { super.doParse(element,parserContext,builder); element.setAttribute(XMLConstants.ID,XMLConstants.CUSTOM_REPORTING_SERVICE); builder.setParentName(XMLConstants.DEFAULT_REPORTING_SERVICE); List<Element> elements = DomUtils.getChildElements(element); for(Element el : elements){ parserContext.getDelegate().parseCustomElement(el); } if(parserContext.getRegistry().getAliases(XMLConstants.REPORTING_SERVICE).length>0){ parserContext.getRegistry().removeAlias(XMLConstants.REPORTING_SERVICE); } parserContext.getRegistry().registerAlias(XMLConstants.CUSTOM_REPORTING_SERVICE, XMLConstants.REPORTING_SERVICE); }
Source:
<code><START> private Fragment getFragment(String fragmentName) { <END> if(fragmentName.equals(getString(R.string.playlist))) return new PlaylistFragment(); if(fragmentName.equals(getString(R.string.music_library))) return new MusicLibraryFragment(); if(fragmentName.equals(getString(R.string.menu))) return new MenuFragment(); return null; }</code><technical_language>this return null instead of a void method</technical_language>

Target:
private Fragment getFragment(String fragmentName) { Fragment newFragment = null; if(fragmentName.equals(getString(R.string.playlist))){ newFragment = new PlaylistFragment(); } else if(fragmentName.equals(getString(R.string.music_library))){ newFragment = new MusicLibraryFragment(); } else if(fragmentName.equals(getString(R.string.menu))){ newFragment = new MenuFragment(); } return newFragment; }
Source:
<code>public void testEventHandle() { <START> ITmfContext ctx = fTrace.seekEvent(0); ITmfEvent event; while ((event = fTrace.getNext(ctx)) != null) { fStateProvider.processEvent(event); } fStateProvider.waitForEmptyQueue(); <END> ITmfStateSystem ss = fStateProvider.getAssignedStateSystem(); assertNotNull(ss); assertEquals(ss.getAttributeName(0), "Ungrouped"); assertEquals(ss.getAttributeName(1), "counter"); assertEquals(ss.getAttributeName(2), "Grouped"); assertEquals(ss.getAttributeName(3), "CPU"); assertEquals(ss.getAttributeName(4), "0"); assertEquals(ss.getAttributeName(5), "counter"); assertEquals(ss.getAttributeName(6), "1"); assertEquals(ss.getAttributeName(7), "counter"); }</code><technical_language>I if this fTrace.sendRequest instead</technical_language>

Target:
public void testEventHandle() { ITmfContext ctx = fTrace.seekEvent(0); ITmfEvent event; while ((event = fTrace.getNext(ctx)) != null) { fStateProvider.processEvent(event); } fStateProvider.waitForEmptyQueue(); ITmfStateSystem ss = fStateProvider.getAssignedStateSystem(); assertNotNull(ss); assertEquals(8, ss.getNbAttributes()); assertEquals("Ungrouped", ss.getAttributeName(0)); assertEquals("counter", ss.getAttributeName(1)); assertEquals("Grouped", ss.getAttributeName(2)); assertEquals("CPU", ss.getAttributeName(3)); assertEquals("0", ss.getAttributeName(4)); assertEquals("counter", ss.getAttributeName(5)); assertEquals("1", ss.getAttributeName(6)); assertEquals("counter", ss.getAttributeName(7)); }
Source:
<code>public List<BusinessObjectBase> getSearchResults(Class<? extends BusinessObjectBase> businessObjectClass, MultivaluedMap<String, String> fieldValues) { List<BusinessObjectBase> results = super.getSearchResults(businessObjectClass, fieldValues); <START> List createDoneBatchFiles = new ArrayList<CreateDoneBatchFile>(); <END> for (Object file : results) { BatchFile batchFile = (BatchFile) file; CreateDoneBatchFile createDoneBatchFile; try { createDoneBatchFile = new CreateDoneBatchFile(batchFile.getId()); createDoneBatchFiles.add(createDoneBatchFile); } catch (FileNotFoundException e) { LOG.error( "An error has occured while creating a CreateDoneBatchFile from the BatchFile object in the search results: " + e.getMessage()); throw new RuntimeException(e); } } return createDoneBatchFiles; }</code><technical_language>This list is missing of generics. BusinessObjectBase generic type instead</technical_language>

Target:
public List<BusinessObjectBase> getSearchResults(Class<? extends BusinessObjectBase> businessObjectClass, MultivaluedMap<String, String> fieldValues) { List<BusinessObjectBase> results = super.getSearchResults(businessObjectClass, fieldValues); List<BusinessObjectBase> createDoneBatchFiles = new ArrayList<BusinessObjectBase>(); for (Object file : results) { BatchFile batchFile = (BatchFile) file; CreateDoneBatchFile createDoneBatchFile; try { createDoneBatchFile = new CreateDoneBatchFile(batchFile.getId()); createDoneBatchFiles.add(createDoneBatchFile); } catch (FileNotFoundException e) { LOG.error( "getSearchResults(): An error has occured while creating a CreateDoneBatchFile from the BatchFile object in the search results: " + e.getMessage()); throw new RuntimeException(e); } } return createDoneBatchFiles; }
Source:
<code>public boolean waitForInitialization() { try { fInitialized.await(); <START> } catch (InterruptedException e) <END> return fInitializationSucceeded; }</code><technical_language>false returned</technical_language>

Target:
public boolean waitForInitialization() { try { fInitialized.await(); } catch (InterruptedException e) { return false; } return fInitializationSucceeded; }
Source:
<code>protected AddVmFromTemplateCommand<AddVmParameters> createCommand() { initVM(); AddVmParameters <START> param = <END> new AddVmParameters(vm); return new AddVmFromTemplateCommand<>(param, null); }</code><technical_language>this is simple enough inlined..</technical_language>

Target:
protected AddVmFromTemplateCommand<AddVmParameters> createCommand() { initVM(); return new AddVmFromTemplateCommand<>(new AddVmParameters(vm), null); }
Source:
<code>private void saveUserInfoToSharedPref(String userId, String emailAddress, String avatarUrl, String token) { PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit() <START> .putBoolean("TOKEN_SAVED", true) <END> .putString("USERNAME", userId) .putString("EMAIL", emailAddress) .putString("AVATAR_IMAGE_URL", avatarUrl) .putString("TOKEN", token) .apply(); }</code><technical_language>before, reading strings constants</technical_language>

Target:
private void saveUserInfoToSharedPref(String userId, String emailAddress, String avatarUrl, String token) { PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit() .putBoolean(TOKEN_SAVED_KEY, true) .putString(USERNAME_KEY, userId) .putString(EMAIL_KEY, emailAddress) .putString(AVATAR_IMAGE_KEY, avatarUrl) .putString(TOKEN_KEY, token) .apply(); }
Source:
<code>public void replace(Object parentElementOrTreePath, final int index, Object element) { VirtualItem[] selectedItems = fTree.getSelection(); TreeSelection selection = (TreeSelection) getSelection(); VirtualItem[] itemsToDisassociate; if (parentElementOrTreePath instanceof TreePath) { TreePath elementPath = ((TreePath) parentElementOrTreePath).createChildPath(element); itemsToDisassociate = findItems(elementPath); } else { itemsToDisassociate = findItems(element); } for (VirtualItem parentItem : findItems(parentElementOrTreePath)) { if (index < parentItem.getItemCount()) { VirtualItem item = parentItem.getItem(new Index(index)); selection = adjustSelectionForReplace(selectedItems, selection, item, element, parentItem.getData()); for (VirtualItem itemToDisassociate : itemsToDisassociate) { if (itemToDisassociate != item && itemToDisassociate.getParent() == parentItem) { disassociate(itemToDisassociate); itemToDisassociate.getParent().clear(itemToDisassociate.getIndex()); } } associate(element, item); doUpdate(item); for (VirtualItem <START> element2 : <END> item.getItems()) { element2.setNeedsDataUpdate(); } } } if (!fPreservingSelecction) { internalSetSelection(selection, false); ISelection newSelection = getSelection(); if (!newSelection.equals(selection)) { handleInvalidSelection(selection, newSelection); } } validate(); }</code><technical_language>rename item (A '2' suffix avoided in general avoided)</technical_language>

Target:
public void replace(Object parentElementOrTreePath, final int index, Object element) { VirtualItem[] selectedItems = fTree.getSelection(); TreeSelection selection = (TreeSelection) getSelection(); VirtualItem[] itemsToDisassociate; if (parentElementOrTreePath instanceof TreePath) { TreePath elementPath = ((TreePath) parentElementOrTreePath).createChildPath(element); itemsToDisassociate = findItems(elementPath); } else { itemsToDisassociate = findItems(element); } for (VirtualItem parentItem : findItems(parentElementOrTreePath)) { if (index < parentItem.getItemCount()) { VirtualItem item = parentItem.getItem(new Index(index)); selection = adjustSelectionForReplace(selectedItems, selection, item, element, parentItem.getData()); for (VirtualItem itemToDisassociate : itemsToDisassociate) { if (itemToDisassociate != item && itemToDisassociate.getParent() == parentItem) { disassociate(itemToDisassociate); itemToDisassociate.getParent().clear(itemToDisassociate.getIndex()); } } associate(element, item); doUpdate(item); for (VirtualItem childitem : item.getItems()) { childitem.setNeedsDataUpdate(); } } } if (!fPreservingSelecction) { internalSetSelection(selection, false); ISelection newSelection = getSelection(); if (!newSelection.equals(selection)) { handleInvalidSelection(selection, newSelection); } } validate(); }
Source:
<code><START> public Set<TypeJudgement> getImpliedJudgements(IQueryMetaContext context) { <END> Set<TypeJudgement> result = new HashSet<TypeJudgement>(); IInputKey aggregateResultType = aggregator.getAggregateResultTypeAsInputKey(); for (TypeJudgement parameterJudgement : query.getTypeGuarantees()) { IInputKey inputKey = parameterJudgement.getInputKey(); Tuple judgementIndexTuple = parameterJudgement.getVariablesTuple(); Object[] judgementVariables = new Object[judgementIndexTuple.getSize()]; for (int i=0; i<judgementVariables.length; ++i) { judgementVariables[i] = actualParametersTuple.get((int) judgementIndexTuple.get(i)); } result.add(new TypeJudgement(inputKey, new FlatTuple(judgementVariables))); } if (aggregateResultType != null) { result.add(new TypeJudgement(aggregateResultType, new FlatTuple(resultVariable))); } return result; }</code><technical_language>I this is incorrect, original code remain. Reasoning: pattern containsFile(p:Package, f:File) {...} pattern small(pe:PackageableElement) { // 'pe' is guaranteed a Package; // PackageableElement! n == count find containsFile(pe, _f); check(n < 10); }</technical_language>

Target:
public Set<TypeJudgement> getImpliedJudgements(IQueryMetaContext context) { Set<TypeJudgement> result = new HashSet<TypeJudgement>(); for (TypeJudgement parameterJudgement : query.getTypeGuarantees()) { IInputKey inputKey = parameterJudgement.getInputKey(); if (context.isPosetKey(inputKey)) { Tuple judgementIndexTuple = parameterJudgement.getVariablesTuple(); Object[] judgementVariables = new Object[judgementIndexTuple.getSize()]; for (int i = 0; i < judgementVariables.length; ++i) { judgementVariables[i] = actualParametersTuple.get((int) judgementIndexTuple.get(i)); } result.add(new TypeJudgement(inputKey, new FlatTuple(judgementVariables))); } } IInputKey aggregateResultType = aggregator.getAggregateResultTypeAsInputKey(); if (aggregateResultType != null && context.isPosetKey(aggregateResultType)) { result.add(new TypeJudgement(aggregateResultType, new FlatTuple(resultVariable))); } return result; }
Source:
<code>public EGVRecord[] getRecentEGVsPages(int numOfRecentPages) { if (numOfRecentPages < 1) { throw new IllegalArgumentException("Number of pages must be greater than 1."); } log.debug("Reading EGV page range..."); int endPage = readDataBasePageRange(RecordType.EGV_DATA); <START> log.debug("Reading " + numOfRecentPages + " EGV page(s)..."); <END> numOfRecentPages = numOfRecentPages - 1; EGVRecord[] allPages = new EGVRecord[0]; for (int i = Math.min(numOfRecentPages,endPage); i >= 0; i--) { int nextPage = endPage - i; log.debug("Reading #" + i + " EGV pages (page number " + nextPage + ")"); EGVRecord[] ithEGVRecordPage = readDataBasePage(RecordType.EGV_DATA, nextPage); EGVRecord[] result = Arrays.copyOf(allPages, allPages.length + ithEGVRecordPage.length); System.arraycopy(ithEGVRecordPage, 0, result, allPages.length, ithEGVRecordPage.length); allPages = result; } log.debug("Read complete of EGV pages."); return allPages; }</code><technical_language>Replace slf4j-style variable substitution, e.g. "Reading EGV pages(s)", numOfRecentPages</technical_language>

Target:
public EGVRecord[] getRecentEGVsPages(int numOfRecentPages) { if (numOfRecentPages < 1) { throw new IllegalArgumentException("Number of pages must be greater than 1."); } log.debug("Reading EGV page range..."); int endPage = readDataBasePageRange(RecordType.EGV_DATA); log.debug("Reading EGV page(s)...", numOfRecentPages); numOfRecentPages = numOfRecentPages - 1; EGVRecord[] allPages = new EGVRecord[0]; for (int i = Math.min(numOfRecentPages,endPage); i >= 0; i--) { int nextPage = endPage - i; log.debug("Reading #{} EGV pages (page number {})", i, nextPage); EGVRecord[] ithEGVRecordPage = readDataBasePage(RecordType.EGV_DATA, nextPage); EGVRecord[] result = Arrays.copyOf(allPages, allPages.length + ithEGVRecordPage.length); System.arraycopy(ithEGVRecordPage, 0, result, allPages.length, ithEGVRecordPage.length); allPages = result; } log.debug("Read complete of EGV pages."); return allPages; }
Source:
<code>public Comparator<InstructorFeedbackResultsResponseRow> getResponseRowsSortOrder() { return Comparator.comparing((InstructorFeedbackResultsResponseRow obj) -> obj.getGiverTeam()) <START> .thenComparing((InstructorFeedbackResultsResponseRow obj) -> obj.getGiverDisplayableIdentifier()) <END> .thenComparing((InstructorFeedbackResultsResponseRow obj) -> obj.getDisplayableResponse()) .thenComparing((InstructorFeedbackResultsResponseRow obj) -> obj.getRecipientTeam()) .thenComparing((InstructorFeedbackResultsResponseRow obj) -> obj.getRecipientDisplayableIdentifier()); }</code><technical_language>row explicitly typed; rest benefit type inference. Alternatively, method reference here, e.g. InstructorFeedbackResultsResponseRow::get*</technical_language>

Target:
public Comparator<InstructorFeedbackResultsResponseRow> getResponseRowsSortOrder() { return Comparator.comparing(InstructorFeedbackResultsResponseRow::getGiverTeam) .thenComparing(InstructorFeedbackResultsResponseRow::getGiverDisplayableIdentifier) .thenComparing(InstructorFeedbackResultsResponseRow::getDisplayableResponse) .thenComparing(InstructorFeedbackResultsResponseRow::getRecipientTeam) .thenComparing(InstructorFeedbackResultsResponseRow::getRecipientDisplayableIdentifier); }
Source:
<code>private ByteBuffer parsePayLoad(ByteBuffer pcapPacketHeader, int blockLength) throws IOException, BadPcapFileException { ByteBuffer pcapPacketData; <START> <END> int interfaceId = pcapPacketHeader.getInt(); getDataLinkTypeNg(interfaceId); pcapPacketHeader.getInt(); pcapPacketHeader.getInt(); int capturedLen = pcapPacketHeader.getInt(); pcapPacketHeader.getInt(); long includedPacketLength = ConversionHelper.unsignedIntToLong(capturedLen); SeekableByteChannel fileChannel = getFileChannel(); if (fileChannel.size() - fileChannel.position() < includedPacketLength) { throw new BadPcapFileException(String.format("%04x", includedPacketLength) + " is causing buffer overrun."); } if (capturedLen > Integer.MAX_VALUE) { throw new BadPcapFileException(String.format("%04x", capturedLen) + " packet length is bigger than 2^31-1 bytes are not supported."); } pcapPacketData = ByteBuffer.allocate((int) includedPacketLength); pcapPacketData.clear(); ByteOrder byteOrder = getByteOrder(); pcapPacketHeader.order(byteOrder); int payLoad = fileChannel.read(pcapPacketData); if (payLoad == 0) { throw new BadPcapFileException(String.format("%04x", payLoad) + " is a bad payload."); } pcapPacketData.flip(); fileChannel.position(fileChannel.position() + blockLength - capturedLen - PcapFileValues.PCAPNG_PACKET_HEADER_SIZE); return pcapPacketData; }</code><technical_language>This code assumes 8 bytes of pcapPacketHeader read... true in practice safe</technical_language>

Target:
private ByteBuffer parsePayLoad(ByteBuffer pcapPacketHeader, int blockLength) throws IOException, BadPcapFileException { ByteBuffer pcapPacketData; int interfaceId = pcapPacketHeader.getInt(); getDataLinkTypeNg(interfaceId); pcapPacketHeader.getInt(); pcapPacketHeader.getInt(); int capturedLen = pcapPacketHeader.getInt(); pcapPacketHeader.getInt(); long includedPacketLength = ConversionHelper.unsignedIntToLong(capturedLen); SeekableByteChannel fileChannel = getFileChannel(); if (fileChannel.size() - fileChannel.position() < includedPacketLength) { throw new BadPcapFileException(String.format("%04x", includedPacketLength) + " is causing buffer overrun."); } pcapPacketData = ByteBuffer.allocate((int) includedPacketLength); ByteOrder byteOrder = getByteOrder(); pcapPacketHeader.order(byteOrder); int payLoad = fileChannel.read(pcapPacketData); if (payLoad == 0) { throw new BadPcapFileException(String.format("%04x", payLoad) + " is a bad payload."); } pcapPacketData.flip(); fileChannel.position(fileChannel.position() - capturedLen); return pcapPacketData; }
Source:
<code>public void testConfiguredWithContext() { <START> Context.CancellableContext context = Context.current().withDeadlineAfter(1, TimeUnit.SECONDS, mockExecutor); <END> context.run(new Runnable() { @Override public void run() { CallOptionsConfig config = new CallOptionsConfig.Builder().setUseTimeout(true).build(); CallOptionsFactory factory = new CallOptionsFactory.ConfiguredCallOptionsFactory(config); Assert.assertEquals( Context.current().getDeadline().timeRemaining(TimeUnit.MILLISECONDS), getDeadlineMs(factory, MutateRowRequest.getDefaultInstance()), 100.0 ); } }); }</code><technical_language>config useTimeout == true? takes precedence config</technical_language>

Target:
public void testConfiguredWithContext() { Deadline deadline = DeadlineUtil.deadlineWithFixedTime(1, TimeUnit.SECONDS, NOW); Context.CancellableContext context = Context.current().withDeadline(deadline, mockExecutor); context.run(new Runnable() { @Override public void run() { CallOptionsConfig config = new CallOptionsConfig.Builder() .setUseTimeout(true) .setShortRpcTimeoutMs((int) TimeUnit.SECONDS.toMillis(100)) .setLongRpcTimeoutMs((int) TimeUnit.SECONDS.toMillis(1000)) .build(); CallOptionsFactory factory = new CallOptionsFactory.ConfiguredCallOptionsFactory(config); assertEqualsDeadlines( TimeUnit.SECONDS.toMillis(1), getDeadlineMs(factory, MutateRowRequest.getDefaultInstance()) ); } }); }
Source:
<code>public MemorySplit( @JsonProperty("tableHandle") MemoryTableHandle tableHandle, @JsonProperty("partNumber") int partNumber, @JsonProperty("totalPartsPerWorker") int totalPartsPerWorker, @JsonProperty("address") HostAddress address, @JsonProperty("expectedRows") long expectedRows) { checkState(partNumber >= 0, "partNumber must be >= 0"); checkState(totalPartsPerWorker >= 1, "totalPartsPerWorker must be >= 1"); checkState(totalPartsPerWorker > partNumber, "totalPartsPerWorker must be > partNumber"); this.tableHandle = requireNonNull(tableHandle, "tableHandle is null"); this.partNumber = partNumber; this.totalPartsPerWorker = totalPartsPerWorker; <START> this.addresses = ImmutableList.of(requireNonNull(address, "address is null")); <END> this.expectedRows = expectedRows; }</code><technical_language>is addresses a list</technical_language>

Target:
public MemorySplit( @JsonProperty("tableHandle") MemoryTableHandle tableHandle, @JsonProperty("partNumber") int partNumber, @JsonProperty("totalPartsPerWorker") int totalPartsPerWorker, @JsonProperty("address") HostAddress address, @JsonProperty("expectedRows") long expectedRows) { checkState(partNumber >= 0, "partNumber must be >= 0"); checkState(totalPartsPerWorker >= 1, "totalPartsPerWorker must be >= 1"); checkState(totalPartsPerWorker > partNumber, "totalPartsPerWorker must be > partNumber"); this.tableHandle = requireNonNull(tableHandle, "tableHandle is null"); this.partNumber = partNumber; this.totalPartsPerWorker = totalPartsPerWorker; this.address = requireNonNull(address, "address is null"); this.expectedRows = expectedRows; }
Source:
<code>public int getLowestClusterHBaseVersion() { <START> return 0; <END> }</code><technical_language>This getDelegate().getLowestClusterHBaseVersion()</technical_language>

Target:
public int getLowestClusterHBaseVersion() { return getDelegate().getLowestClusterHBaseVersion(); }
Source:
<code>private static Output processNewLetter( Output state, String letter) { if (state.guess.contains(letter) || state.misses.contains(letter)) { throw new IllegalArgumentException("Letter " + letter + " was already played"); } <START> if (state.secret.contains(letter)) { Set<String> newGuess = new HashSet<>(state.guess); newGuess.add(letter); String discovered = state.secret.chars() .mapToObj(i -> String.valueOf((char) i)) .map(c -> newGuess.contains(c) ? c : "_") .collect(joining()); return new Output( state.secret, discovered, newGuess, state.misses, state.parts, discovered.contains("_") ? Status.PLAYING : Status.WIN); } else { <END> Set<String> newMisses = new HashSet<>(state.misses); newMisses.add(letter); List<Part> newParts = new ArrayList<>(state.parts); newParts.add(order[newParts.size()]); Status newStatus = newMisses.size() >= order.length ? Status.LOSS : Status.PLAYING; return new Output( state.secret, state.discovered, state.guess, newMisses, newParts, newStatus); } }</code><technical_language>Personally, branch get method structures this: java if (isAlreadyGuessed(...)) { throw IllegalArgument...; } if (isCorrectGuess(...)) { return correctGuess(...); } return incorrectGuess(...);</technical_language>

Target:
private static Output processNewLetter( Output state, String letter) { if (state.isLetterAlreadyPlayed(letter)) { throw new IllegalArgumentException("Letter " + letter + " was already played"); } if (state.isLetterInSecret(letter)) { return processCorrectGuess(state, letter); } else { return processIncorrectGuess(state, letter); } }
Source:
<code>public String toString() { return "ConnectionRetryConfig{" + "initialBackoffMillis=" + initialBackoffMillis + ", maxBackoffMillis=" + maxBackoffMillis + ", multiplier=" + multiplier + ", failOnMaxBackoff=" + failOnMaxBackoff + ", jitter=" + jitter <START> + ", enabled=" + enabled <END> + '}'; }</code><technical_language>enabled</technical_language>

Target:
public String toString() { return "ConnectionRetryConfig{" + "enabled=" + enabled + ", initialBackoffMillis=" + initialBackoffMillis + ", maxBackoffMillis=" + maxBackoffMillis + ", multiplier=" + multiplier + ", failOnMaxBackoff=" + failOnMaxBackoff + ", jitter=" + jitter + '}'; }
Source:
<code>protected File getDependency(ArtifactDescription artifactDescription) throws DeploymentException { try { Artifact artifact = artifactFactory.createArtifact(artifactDescription.getGroupId(), artifactDescription.getArtifactId(), artifactDescription.getVersion(), null, artifactDescription.getType()); log.info("Resolving " + artifact); artifactResolver.resolve(artifact, mavenProject.getRemoteArtifactRepositories(), localRepository); return artifact.getFile(); } catch (AbstractArtifactResolutionException e) { <START> throw new DeploymentException("Couldn't download artifact: " + e.getMessage(), e); <END> } }</code><technical_language>+ throw new DeploymentException("Couldn't download artifact: " + e.getMessage(), e); + throw new DeploymentException("Fail download artifact: " + artifactDesdription.getName(), e); a good idea throw exception e.getMessage send e parameter</technical_language>

Target:
protected File getDependency(ArtifactDescription artifactDescription) throws DeploymentException { try { Artifact artifact = artifactFactory.createArtifact(artifactDescription.getGroupId(), artifactDescription.getArtifactId(), artifactDescription.getVersion(), null, artifactDescription.getType()); log.info("Resolving " + artifact); artifactResolver.resolve(artifact, mavenProject.getRemoteArtifactRepositories(), localRepository); return artifact.getFile(); } catch (AbstractArtifactResolutionException e) { throw new DeploymentException("Fail download artifact: " + artifactDescription.toString(), e); } }
Source:
<code>public static String readDefaultTopic(final byte[] keystore, final char[] password) { try { final KeyStore keyStore = KeyStore.getInstance(KEYSTORE_TYPE); keyStore.load(new ByteArrayInputStream(keystore), password); final Enumeration<String> aliases = keyStore.aliases(); while (aliases.hasMoreElements()) { final String alias = aliases.nextElement(); final X509Certificate certificate = (X509Certificate) keyStore.getCertificate(alias); final X500Principal subjectX500Principal = certificate.getSubjectX500Principal(); final String subject = subjectX500Principal.getName(); if (subject != null ) { final Pattern pattern = Pattern.compile(TOPIC_PATTERN); final Matcher matcher = pattern.matcher(subject); if (matcher.matches()) { return matcher.group(1); } } } } catch (Exception e) { LOGGER.error("Error parsing .p12 file content", e); } <START> return null; END> }</code><technical_language>I log this, INFO level</technical_language>

Target:
public static String readDefaultTopic(final byte[] keystore, final char[] password) { try { final KeyStore keyStore = KeyStore.getInstance(KEYSTORE_TYPE); keyStore.load(new ByteArrayInputStream(keystore), password); final Enumeration<String> aliases = keyStore.aliases(); while (aliases.hasMoreElements()) { final String alias = aliases.nextElement(); final X509Certificate certificate = (X509Certificate) keyStore.getCertificate(alias); final X500Principal subjectX500Principal = certificate.getSubjectX500Principal(); final String subject = subjectX500Principal.getName(); if (subject != null ) { final Pattern pattern = Pattern.compile(TOPIC_PATTERN); final Matcher matcher = pattern.matcher(subject); if (matcher.matches()) { return matcher.group(1); } } } } catch (Exception e) { LOGGER.error("Error parsing .p12 file content", e); } LOGGER.info("No topic inside the .p12 file was found"); return null; }
Source:
<code>public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_on_this_day, container, false); unbinder = ButterKnife.bind(this, view); int age = requireActivity().getIntent().getIntExtra(AGE, 0); wiki = requireActivity().getIntent().getParcelableExtra(WIKISITE); date = DateUtil.getDefaultDateFor(age); yearClickedOnCardView = requireActivity().getIntent().getIntExtra(YEAR, -1); setUpToolbar(); eventsRecycler.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false)); final int topDecorationDp = 24; eventsRecycler.addItemDecoration(new HeaderMarginItemDecoration(topDecorationDp, 0)); setUpRecycler(eventsRecycler); errorView.setBackClickListener(v -> requireActivity().finish()); <START> final int animDelay = (requireActivity().getWindow().getSharedElementEnterTransition() != null && savedInstanceState == null) ? 500 : 0; onThisDayTitleView.postDelayed(() -> { if (!isAdded() || onThisDayTitleView == null) { return; } <END> updateContents(age); }, animDelay); progressBar.setVisibility(GONE); eventsRecycler.setVisibility(GONE); errorView.setVisibility(GONE); return view; }</code><technical_language>A bit messy if put code here. if create a method of it? (and move suppress checkstyle method</technical_language>

Target:
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_on_this_day, container, false); unbinder = ButterKnife.bind(this, view); int age = requireActivity().getIntent().getIntExtra(AGE, 0); wiki = requireActivity().getIntent().getParcelableExtra(WIKISITE); date = DateUtil.getDefaultDateFor(age); yearOnCardView = requireActivity().getIntent().getIntExtra(YEAR, -1); setUpToolbar(); eventsRecycler.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false)); final int topDecorationDp = 24; eventsRecycler.addItemDecoration(new HeaderMarginItemDecoration(topDecorationDp, 0)); setUpRecycler(eventsRecycler); errorView.setBackClickListener(v -> requireActivity().finish()); setUpTransitionAnimation(savedInstanceState, age); progressBar.setVisibility(GONE); eventsRecycler.setVisibility(GONE); errorView.setVisibility(GONE); return view; }
Source:
<code>public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) { <START> EditedStyleItem item = null; if (value instanceof EditedStyleItem) { item = (EditedStyleItem) value; } <END> final Component returnedComponent = myDelegate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (item == null) { returnedComponent.setBackground(isSelected ? table.getSelectionBackground() : table.getBackground()); } if (item != null && item.getSourceStyle().equals(((AttributesTableModel) table.getModel()).getSelectedStyle())) { returnedComponent.setFont(table.getFont().deriveFont(Font.BOLD)); } else { returnedComponent.setFont(table.getFont()); } if (!(returnedComponent instanceof JComponent)) { return returnedComponent; } final JComponent jComponent = (JComponent)returnedComponent; Point mousePos = table.getMousePosition(); if (mousePos != null && item != null) { if (table.getCellRect(row, column, true).contains(mousePos)) { final ItemResourceValue resValue = ((EditedStyleItem)value).getItemResourceValue(); Configuration configuration = item.getSourceStyle().getConfiguration(); String toolTipText = ThemeEditorUtils.generateToolTipText(resValue, configuration.getModule(), configuration); jComponent.setToolTipText(toolTipText); } } else { jComponent.setToolTipText(null); } return returnedComponent; }</code><technical_language>EditedStyleItem item = (value instanceof EditedStyleItem) ? (EditedStyleItem) : null;</technical_language>

Target:
public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) { EditedStyleItem item = (value instanceof EditedStyleItem) ? (EditedStyleItem) value : null; final Component returnedComponent = myDelegate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (item != null && item.getSourceStyle().equals(((AttributesTableModel) table.getModel()).getSelectedStyle())) { returnedComponent.setFont(table.getFont().deriveFont(Font.BOLD)); } else { returnedComponent.setFont(table.getFont()); } if (item != null && !item.isPublicAttribute()) { returnedComponent.setForeground(JBColor.GRAY); } else { returnedComponent.setForeground(table.getForeground()); } if (!(returnedComponent instanceof JComponent)) { return returnedComponent; } final JComponent jComponent = (JComponent)returnedComponent; Point mousePos = table.getMousePosition(); if (mousePos != null && item != null) { if (table.getCellRect(row, column, true).contains(mousePos)) { final ItemResourceValue resValue = ((EditedStyleItem)value).getItemResourceValue(); Configuration configuration = item.getSourceStyle().getConfiguration(); String toolTipText = ThemeEditorUtils.generateToolTipText(resValue, configuration.getModule(), configuration); jComponent.setToolTipText(toolTipText); } } else { jComponent.setToolTipText(null); } return returnedComponent; }
Source:
<code>private boolean isSpringBootConfigurable(MavenProject mavenProject) { <START> String springBootActivation = mavenProject.getProperties().getProperty("m2e.springboot.activation"); <END> boolean configureSpringBoot; if (springBootActivation == null) { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); configureSpringBoot = store.getBoolean(Activator.CONFIGURE_SPRING_BOOT); } else { configureSpringBoot = Boolean.valueOf(springBootActivation); } return configureSpringBoot; }</code><technical_language>a constant for "m2e.springboot.activation"</technical_language>

Target:
private boolean isSpringBootConfigurable(MavenProject mavenProject) { String springBootActivation = mavenProject.getProperties().getProperty(ACTIVATION_PROPERTY); boolean configureSpringBoot; if (springBootActivation == null) { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); configureSpringBoot = store.getBoolean(Activator.CONFIGURE_SPRING_BOOT); } else { configureSpringBoot = Boolean.valueOf(springBootActivation); } return configureSpringBoot; }
Source:
<code>public void tearDown() { if (testRealm != null) { testRealm.close(); } <START> Realm.deleteRealm(realmConfig); <END> }</code><technical_language>This happen automatically TestRealmConfigurationFactory</technical_language>

Target:
public void tearDown() { if (testRealm != null) { testRealm.close(); } }
Source:
<code>protected void subscribeActual(final Observer<? super T> o) { publisher.subscribe(new Subscriber<T>() { @Override public void onComplete() { o.onComplete(); } @Override public void onError(Throwable t) { o.onError(t); } @Override public void onNext(T t) { o.onNext(t); } @Override public void onSubscribe(Subscription inner) { <START> o.onSubscribe(Disposables.from(inner)); <END> inner.request(Long.MAX_VALUE); } }); }</code><technical_language>If outer a proper class, implement Disposable dispose() call cancel() field inner</technical_language>

Target:
protected void subscribeActual(final Observer<? super T> o) { publisher.subscribe(new PublisherSubscriber<T>(o)); }