auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private File createMockPropertiesFile() throws IOException { File pFile = new File(mTestDir, PackageFiles.PAYLOAD_PROPERTIES_FILE_NAME); try (BufferedWriter w = new BufferedWriter(new FileWriter(pFile))) { w.write(PROPERTIES_CONTENTS); } return pFile; }

Target:
private File createMockPropertiesFile() throws IOException { File propertiesFile = new File(mTestDir, PackageFiles.PAYLOAD_PROPERTIES_FILE_NAME); Files.asCharSink(propertiesFile, Charsets.UTF_8).write(PROPERTIES_CONTENTS); return propertiesFile; }
Source:
public Result[] search(String q, int k) throws IOException { IndexSearcher searcher = new IndexSearcher(reader); searcher.setSimilarity(similarity); Query query = AnalyzerUtils.buildBagOfWordsQuery(LuceneDocumentGenerator.FIELD_BODY, analyzer, q); TopDocs rs = searcher.search(query, k); ScoreDoc[] hits = rs.scoreDocs; Result[] results = new Result[hits.length]; for (int i = 0; i < hits.length; i++) { Document doc = searcher.doc(hits[i].doc); String docid = doc.getField(LuceneDocumentGenerator.FIELD_ID).stringValue(); IndexableField field = doc.getField(LuceneDocumentGenerator.FIELD_RAW); String content = doc == null ? null : field.stringValue(); results[i] = new Result(docid, hits[i].doc, hits[i].score, content); } return results; }

Target:
public Result[] search(String q, int k) throws IOException { IndexSearcher searcher = new IndexSearcher(reader); searcher.setSimilarity(similarity); Query query = AnalyzerUtils.buildBagOfWordsQuery(LuceneDocumentGenerator.FIELD_BODY, analyzer, q); TopDocs rs = searcher.search(query, k); ScoreDoc[] hits = rs.scoreDocs; Result[] results = new Result[hits.length]; for (int i = 0; i < hits.length; i++) { Document doc = searcher.doc(hits[i].doc); String docid = doc.getField(LuceneDocumentGenerator.FIELD_ID).stringValue(); IndexableField field = doc.getField(LuceneDocumentGenerator.FIELD_RAW); String content = field == null ? null : field.stringValue(); results[i] = new Result(docid, hits[i].doc, hits[i].score, content); } return results; }
Source:
public void setSize(final int width, final int height) { this.syncExec(() -> browser.setSize(width, height)); }

Target:
public void setSize(final int width, final int height) { syncExec(() -> browser.setSize(width, height)); }
Source:
private void sendBatchMetrics(final MiniBatchResult miniBatchResult, final int epochIdx, final int miniBatchIdx, final int processedDataItemCount, final double miniBatchElapsedTime) { final double batchComputeTime = miniBatchResult.getComputeTime(); final double batchPullTime = miniBatchResult.getTotalPullTime(); final double batchPushTime = miniBatchResult.getTotalPushTime(); epochTime.addRecord(batchComputeTime, batchPullTime, batchPushTime); final DolphinWorkerMetrics batchMetric = DolphinWorkerMetrics.newBuilder() .setType(WorkerMetricsType.BatchMetrics) .setBatchMetrics( BatchMetrics.newBuilder() .setBatchTimeSec(miniBatchElapsedTime) .setBatchCustomMetrics( Metrics.newBuilder() .setData(miniBatchResult.getAppMetrics()) .build()) .setNumBatchDataInstances(processedDataItemCount) .setBatchIdx(miniBatchIdx) .setEpochIdx(epochIdx) .setBatchPushTimeSec(batchPushTime) .setBatchPullTimeSec(batchPullTime) .setBatchCompTimeSec(batchComputeTime) .build() ) .build(); metricCollector.addCustomMetric(batchMetric); metricCollector.flush(); LOG.log(Level.INFO, "MiniBatchMetrics {0}", batchMetric); }

Target:
private void sendBatchMetrics(final MiniBatchResult miniBatchResult, final int epochIdx, final int miniBatchIdx, final int processedDataItemCount, final double miniBatchElapsedTime) { final BatchMetrics batchMetrics = BatchMetrics.newBuilder() .setBatchTimeSec(miniBatchElapsedTime) .setBatchCustomMetrics( Metrics.newBuilder() .setData(miniBatchResult.getAppMetrics()) .build()) .setNumBatchDataInstances(processedDataItemCount) .setBatchIdx(miniBatchIdx) .setEpochIdx(epochIdx) .setBatchPushTimeSec(miniBatchResult.getTotalPushTime()) .setBatchPullTimeSec(miniBatchResult.getTotalPullTime()) .setBatchCompTimeSec(miniBatchResult.getComputeTime()) .build(); final DolphinWorkerMetrics encapsulatedMetrics = DolphinWorkerMetrics.newBuilder() .setType(WorkerMetricsType.BatchMetrics) .setBatchMetrics(batchMetrics) .build(); metricCollector.addCustomMetric(encapsulatedMetrics); metricCollector.flush(); LOG.log(Level.INFO, "MiniBatchMetrics {0}", batchMetrics); }
Source:
private boolean openConfirmationDialog(ExecutionEvent event, String question) throws ExecutionException { MessageDialog dlg = new MessageDialog(getShell(event), UIText.DiscardChangesAction_confirmActionTitle, null, question, MessageDialog.CONFIRM, 0, UIText.DiscardChangesAction_discardChangesButtonText, IDialogConstants.CANCEL_LABEL); return dlg.open() == 0; }

Target:
private boolean openConfirmationDialog(ExecutionEvent event, String question) throws ExecutionException { MessageDialog dlg = new MessageDialog(getShell(event), UIText.DiscardChangesAction_confirmActionTitle, null, question, MessageDialog.CONFIRM, 0, UIText.DiscardChangesAction_discardChangesButtonText, IDialogConstants.CANCEL_LABEL); return dlg.open() == Window.OK; }
Source:
private void assertGeometryToBingTiles(String wkt, int zoomLevel, List<String> expectedQuadKeys) { assertFunction("transform(geometry_to_bing_tiles(ST_GeometryFromText('" + wkt +"'), " + zoomLevel + "), x -> bing_tile_quadkey(x))", new ArrayType(VARCHAR), expectedQuadKeys); }

Target:
private void assertGeometryToBingTiles(String wkt, int zoomLevel, List<String> expectedQuadKeys) { assertFunction(format("transform(geometry_to_bing_tiles(ST_GeometryFromText('%s'), %s), x -> bing_tile_quadkey(x))", wkt, zoomLevel), new ArrayType(VARCHAR), expectedQuadKeys); }
Source:
public IBuildElement getBuildElementFromUrl(IBuildServer server, String url) { if (url.startsWith(server.getUrl())) { String path = url.substring(server.getUrl().length()); Pattern p = Pattern.compile(".*/job/(.*)/(\\d+)"); Matcher matcher = p.matcher(url); if (matcher.find()) { IBuildPlan plan = IBuildFactory.INSTANCE.createBuildPlan(); plan.setServer(server); plan.setName(matcher.group(1)); plan.setId(matcher.group(1)); plan.setUrl(url); IBuild build = IBuildFactory.INSTANCE.createBuild(); build.setId(matcher.group(2)); build.setLabel(matcher.group(2)); build.setPlan(plan); return build; } } return null; }

Target:
public IBuildElement getBuildElementFromUrl(IBuildServer server, String url) { if (url.startsWith(server.getUrl())) { String path = url.substring(server.getUrl().length()); Pattern p = Pattern.compile("(.*/job/(.*)/)(\\d+)"); Matcher matcher = p.matcher(url); if (matcher.find()) { IBuildPlan plan = IBuildFactory.INSTANCE.createBuildPlan(); plan.setServer(server); plan.setName(matcher.group(2)); plan.setId(matcher.group(2)); plan.setUrl(matcher.group(1)); IBuild build = IBuildFactory.INSTANCE.createBuild(); build.setId(matcher.group(3)); build.setLabel(matcher.group(3)); build.setPlan(plan); build.setUrl(url); return build; } } return null; }
Source:
public CustomizeActionBars(IWorkbenchWindowConfigurer configurer, IEclipseContext context) { this.configurer = configurer; workbenchTrimElements = new ArrayList<MTrimElement>(); statusLineManager = new StatusLineManager(); menuManager = new MenuManager("MenuBar", ActionSet.MAIN_MENU); this.configurer = configurer; IRendererFactory rendererFactory = context.get(IRendererFactory.class); EModelService modelService = context.get(EModelService.class); windowModel = modelService.createModelElement(MTrimmedWindow.class); app = context.get(MApplication.class); IEclipseContext eclipseContext = app.getContext().createChild("window - CustomizeActionBars"); windowModel.setContext(eclipseContext); eclipseContext.set(MWindow.class.getName(), windowModel); Shell shell = new Shell(); windowModel.setWidget(shell); windowModel.setToBeRendered(false); app.getChildren().add(windowModel); shell.setData(org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer.OWNING_ME, windowModel); mainMenu = modelService.createModelElement(MMenu.class); mainMenu.setElementId(ActionSet.MAIN_MENU); menuRenderer = (MenuManagerRenderer) rendererFactory.getRenderer(mainMenu, null); menuRenderer.linkModelToManager(mainMenu, menuManager); windowModel.setMainMenu(mainMenu); coolBarManager = new CoolBarToTrimManager(app, windowModel, workbenchTrimElements, rendererFactory); }

Target:
public CustomizeActionBars(IWorkbenchWindowConfigurer configurer, IEclipseContext context) { this.configurer = configurer; statusLineManager = new StatusLineManager(); menuManager = new MenuManager("MenuBar", ActionSet.MAIN_MENU); IRendererFactory rendererFactory = context.get(IRendererFactory.class); EModelService modelService = context.get(EModelService.class); windowModel = modelService.createModelElement(MTrimmedWindow.class); app = context.get(MApplication.class); IEclipseContext eclipseContext = app.getContext().createChild("window - CustomizeActionBars"); windowModel.setContext(eclipseContext); eclipseContext.set(MWindow.class, windowModel); Shell shell = new Shell(); windowModel.setWidget(shell); windowModel.setToBeRendered(false); app.getChildren().add(windowModel); shell.setData(org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer.OWNING_ME, windowModel); mainMenu = modelService.createModelElement(MMenu.class); mainMenu.setElementId(ActionSet.MAIN_MENU); menuRenderer = (MenuManagerRenderer) rendererFactory.getRenderer(mainMenu, null); menuRenderer.linkModelToManager(mainMenu, menuManager); windowModel.setMainMenu(mainMenu); coolBarManager = new CoolBarToTrimManager(app, windowModel, new ArrayList<MTrimElement>(), rendererFactory); }
Source:
public void handleRequest(final DataInput input, final ActiveOperation.ResultHandler<Void> resultHandler, final ManagementRequestContext<RegistrationContext> context) throws IOException { final byte status = input.readByte(); final RegistrationContext registration = context.getAttachment(); registration.completeRegistration(context, status == DomainControllerProtocol.PARAM_OK); }

Target:
public void handleRequest(final DataInput input, final ActiveOperation.ResultHandler<Void> resultHandler, final ManagementRequestContext<RegistrationContext> context) throws IOException { final byte status = input.readByte(); final String message = input.readUTF(); final RegistrationContext registration = context.getAttachment(); registration.completeRegistration(context, status == DomainControllerProtocol.PARAM_OK); }
Source:
public void registerPatient() { new PatientService().registerPatient(mPatient); mLastViewedPatientsView.finishRegisterActivity(); }

Target:
public void registerPatient() { new PatientService().registerPatient(mPatient); mRegisterPatientView.startPatientDashbordActivity(mPatient); mRegisterPatientView.finishRegisterActivity(); }
Source:
private void verifyChannelActive() throws RestServiceException { if (channelClosed.get() || !(ctx.channel().isActive())) { logger.trace("Channel is closed. No more interaction possible", ctx.channel()); nettyMetrics.channelWriteAfterClose.inc(); throw new RestServiceException("Channel " + ctx.channel() + " has already been closed before write", RestServiceErrorCode.ChannelAlreadyClosed); } }

Target:
private void verifyChannelActive() throws RestServiceException { if (channelClosed.get() || !(ctx.channel().isActive())) { throw new RestServiceException("Channel is closed and cannot accept operations", RestServiceErrorCode.ChannelAlreadyClosed); } }
Source:
protected void checkThread(IThread thread, boolean checked) { fThreadViewer.setChecked(thread, checked); IDebugTarget target= (thread).getDebugTarget(); if (checked) { if (!fThreadViewer.getChecked(target)) { fThreadViewer.setChecked(target, true); } IThread[] threads; try { threads= target.getThreads(); } catch (DebugException exception) { JDIDebugUIPlugin.log(exception); return; } for (IThread thread2 : threads) { if (thread2 != thread) { fThreadViewer.setChecked(thread2, false); } } } else { fThreadViewer.setChecked(target, false); } }

Target:
protected void checkThread(IThread thread, boolean checked) { fThreadViewer.setChecked(thread, checked); IDebugTarget target= (thread).getDebugTarget(); if (checked) { if (!fThreadViewer.getChecked(target)) { fThreadViewer.setChecked(target, true); } IThread[] threads; try { threads= target.getThreads(); } catch (DebugException exception) { JDIDebugUIPlugin.log(exception); return; } for (IThread targetThread : threads) { if (targetThread != thread) { fThreadViewer.setChecked(targetThread, false); } } } else { fThreadViewer.setChecked(target, false); } }
Source:
public void nextValueThrowsExceptionOnEmptyList() { final List<String> EMPTY_LIST = Arrays.asList(); final String NO_NEXT_VALUE_ERROR = "Empty Error Message"; new VerboseIterable<String>( EMPTY_LIST, NO_NEXT_VALUE_ERROR). iterator().next(); }

Target:
public final void nextValueThrowsExceptionOnEmptyList() { new VerboseIterable<String>( Collections.<String>emptyList(), "Expected Error Message" ).iterator().next(); }
Source:
private void removeStoredRenditions(Map<String, List<String>> liveDocumentRefsToRenditionRefs) { List<String> liveDocumentRefs = new ArrayList<>(liveDocumentRefsToRenditionRefs.keySet()); if (liveDocumentRefs.isEmpty()) { return; } int processedSourceIds = 0; while (processedSourceIds < liveDocumentRefs.size()) { int limit = processedSourceIds + BATCH_SIZE > liveDocumentRefs.size() ? liveDocumentRefs.size() : processedSourceIds + BATCH_SIZE; List<String> batchSourceIds = liveDocumentRefs.subList(processedSourceIds, limit); List<String> existingSourceIds = new ArrayList<>(); String query = NXQLQueryBuilder.getQuery("SELECT ecm:uuid FROM Document WHERE ecm:uuid IN ?", new Object[] { batchSourceIds }, true, true, null); try (IterableQueryResult result = session.queryAndFetch(query, NXQL.NXQL)) { result.forEach(res -> existingSourceIds.add(res.get(NXQL.ECM_UUID).toString())); } batchSourceIds.removeAll(existingSourceIds); List<String> renditionRefsToDelete = batchSourceIds.stream() .map(liveDocumentRefsToRenditionRefs::get) .reduce(new ArrayList<>(), (allRefs, refs) -> { allRefs.addAll(refs); return allRefs; }); if (!renditionRefsToDelete.isEmpty()) { session.removeDocuments( renditionRefsToDelete.stream() .map(IdRef::new) .collect(Collectors.toList()) .toArray(new DocumentRef[renditionRefsToDelete.size()])); } if (TransactionHelper.isTransactionActiveOrMarkedRollback()) { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } processedSourceIds += BATCH_SIZE; } }

Target:
private void removeStoredRenditions(Map<String, List<String>> liveDocumentRefsToRenditionRefs) { List<String> liveDocumentRefs = new ArrayList<>(liveDocumentRefsToRenditionRefs.keySet()); if (liveDocumentRefs.isEmpty()) { return; } int processedSourceIds = 0; while (processedSourceIds < liveDocumentRefs.size()) { int limit = processedSourceIds + BATCH_SIZE > liveDocumentRefs.size() ? liveDocumentRefs.size() : processedSourceIds + BATCH_SIZE; List<String> batchSourceIds = liveDocumentRefs.subList(processedSourceIds, limit); List<String> existingSourceIds = new ArrayList<>(); String query = NXQLQueryBuilder.getQuery("SELECT ecm:uuid FROM Document WHERE ecm:uuid IN ?", new Object[] { batchSourceIds }, true, true, null); try (IterableQueryResult result = session.queryAndFetch(query, NXQL.NXQL)) { result.forEach(res -> existingSourceIds.add(res.get(NXQL.ECM_UUID).toString())); } batchSourceIds.removeAll(existingSourceIds); List<String> renditionRefsToDelete = batchSourceIds.stream() .map(liveDocumentRefsToRenditionRefs::get) .reduce(new ArrayList<>(), (allRefs, refs) -> { allRefs.addAll(refs); return allRefs; }); if (!renditionRefsToDelete.isEmpty()) { session.removeDocuments(renditionRefsToDelete.stream().map(IdRef::new).toArray(DocumentRef[]::new)); } if (TransactionHelper.isTransactionActiveOrMarkedRollback()) { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } processedSourceIds += BATCH_SIZE; } }
Source:
private long getBackoffTimeWhenSweepHasNotRun() { return 20 * (1000 + sweepPauseMillis.get()); }

Target:
private Duration getBackoffTimeWhenSweepHasNotRun() { return Duration.ofMillis(sweepPauseMillis.get()).plusSeconds(1).multipliedBy(20); }
Source:
public void setLastSeenQuorumVerifier(QuorumVerifier qv, boolean writeToDisk){ QuorumCnxManager qcm = qcmRef.get(); Object outerLockObject = (qcm != null) ? qcm : QV_LOCK; synchronized (outerLockObject) { synchronized (QV_LOCK) { if (lastSeenQuorumVerifier != null && lastSeenQuorumVerifier.getVersion() > qv.getVersion()) { LOG.error("setLastSeenQuorumVerifier called with stale config " + qv.getVersion() + ". Current version: " + quorumVerifier.getVersion()); } if (lastSeenQuorumVerifier != null && lastSeenQuorumVerifier.getVersion() == qv.getVersion()) { return; } lastSeenQuorumVerifier = qv; if (qcm != null && quorumVerifier != null && lastSeenQuorumVerifier != null) { Map<Long, QuorumServer> committedView = quorumVerifier.getAllMembers(); for (Entry<Long, QuorumServer> e : lastSeenQuorumVerifier.getAllMembers().entrySet()) { if (e.getKey() != getId() && !committedView.containsKey(e.getKey())) qcm.connectOne(e.getKey()); } } if (writeToDisk) { try { String fileName = getNextDynamicConfigFilename(); if (fileName != null) { QuorumPeerConfig.writeDynamicConfig(fileName, qv, true); } } catch (IOException e) { LOG.error("Error writing next dynamic config file to disk: ", e.getMessage()); } } } } }

Target:
public void setLastSeenQuorumVerifier(QuorumVerifier qv, boolean writeToDisk){ QuorumCnxManager qcm = qcmRef.get(); Object outerLockObject = (qcm != null) ? qcm : QV_LOCK; synchronized (outerLockObject) { synchronized (QV_LOCK) { if (lastSeenQuorumVerifier != null && lastSeenQuorumVerifier.getVersion() > qv.getVersion()) { LOG.error("setLastSeenQuorumVerifier called with stale config " + qv.getVersion() + ". Current version: " + quorumVerifier.getVersion()); } if (lastSeenQuorumVerifier != null && lastSeenQuorumVerifier.getVersion() == qv.getVersion()) { return; } lastSeenQuorumVerifier = qv; if (qcm != null) { connectNewPeers(qcm); } if (writeToDisk) { try { String fileName = getNextDynamicConfigFilename(); if (fileName != null) { QuorumPeerConfig.writeDynamicConfig(fileName, qv, true); } } catch (IOException e) { LOG.error("Error writing next dynamic config file to disk: ", e.getMessage()); } } } } }
Source:
public static String sanitizeSecondCachedKey(final Contentlet vanityUrl) throws DotDataException, DotRuntimeException, DotSecurityException { Host host = hostAPI.find(vanityUrl.getStringProperty(VanityUrlContentType.SITE_FIELD_VAR), APILocator.systemUser(), false); return sanitizeSecondCacheKey(host.getIdentifier(), vanityUrl.getLanguageId()); }

Target:
public static String sanitizeSecondCachedKey(final Contentlet vanityUrl) throws DotDataException, DotSecurityException { Host host = hostAPI.find(vanityUrl.getStringProperty(VanityUrlContentType.SITE_FIELD_VAR), APILocator.systemUser(), false); return sanitizeSecondCacheKey(host.getIdentifier(), vanityUrl.getLanguageId()); }
Source:
public void deleteDataSource(Long dataSourceId) throws KeywordSearchServiceException { try { KeywordSearch.getServer().deleteDataSource(dataSourceId); } catch (NoOpenCoreException ex) { logger.log(Level.WARNING, NbBundle.getMessage(SolrSearchService.class, "SolrSearchService.deleteDataSource.exceptionMessage.noCurrentSolrCore")); throw new KeywordSearchServiceException(NbBundle.getMessage(SolrSearchService.class, "SolrSearchService.deleteDataSource.exceptionMessage.noCurrentSolrCore")); } }

Target:
public void deleteDataSource(Long dataSourceId) throws KeywordSearchServiceException { try { Server ddsServer = KeywordSearch.getServer(); ddsServer.deleteDataSource(dataSourceId); } catch (IOException | KeywordSearchModuleException | NoOpenCoreException | SolrServerException ex) { logger.log(Level.WARNING, NbBundle.getMessage(SolrSearchService.class, "SolrSearchService.DeleteDataSource.msg", dataSourceId), ex); throw new KeywordSearchServiceException(NbBundle.getMessage(SolrSearchService.class, "SolrSearchService.DeleteDataSource.msg", dataSourceId), ex); } }
Source:
public void storeAuthenticationConfigurationResource(Resource resource, InputStream is) throws IOException { if (!(resource instanceof WritableResource)) { logger.warn(String.format("Skip store of readonly resource [%s].", resource)); return; } WritableResource writableResource = (WritableResource) resource; OutputStream os = writableResource.getOutputStream(); IOUtils.copy(is, os); }

Target:
public void storeAuthenticationConfigurationResource(Resource resource, InputStream is) throws IOException { if (!(resource instanceof WritableResource)) { logger.warn(String.format("Could not store read-only resource [%s].", resource)); return; } WritableResource writableResource = (WritableResource) resource; OutputStream os = writableResource.getOutputStream(); IOUtils.copy(is, os); }
Source:
public GdbFullCliConsolePage(GdbFullCliConsole gdbConsole, IDebuggerConsoleView view) { fConsole = gdbConsole; fView = view; fLaunch = gdbConsole.getLaunch(); if (fLaunch instanceof GdbLaunch) { fSession = ((GdbLaunch)fLaunch).getSession(); } else { fSession = null; assert false; } fConsolePropertyChangeListener = new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB)) { String terminateStr = event.getNewValue().toString(); Boolean terminate = terminateStr.equals(Boolean.FALSE.toString()) ? Boolean.FALSE : Boolean.TRUE; fAtutoTerminateAction.setChecked(terminate); } } }; GdbUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fConsolePropertyChangeListener); }

Target:
public GdbFullCliConsolePage(GdbFullCliConsole gdbConsole, IDebuggerConsoleView view) { fConsole = gdbConsole; fView = view; fLaunch = gdbConsole.getLaunch(); if (fLaunch instanceof GdbLaunch) { fSession = ((GdbLaunch)fLaunch).getSession(); } else { fSession = null; assert false; } fConsolePropertyChangeListener = new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB)) { String terminateStr = event.getNewValue().toString(); boolean terminate = terminateStr.equals(Boolean.FALSE.toString()) ? false : true; fAutoTerminateAction.setChecked(terminate); } } }; GdbUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fConsolePropertyChangeListener); }
Source:
public synchronized void close() { _isClosed = true; List<ServiceHandle<S>> oldInstancesServiceHandles = Lists.newArrayList(_instancesPerEndpoint.values()); _instancesPerEndpoint = Maps.newHashMap(); for(ServiceHandle<S> serviceHandle: oldInstancesServiceHandles) { try { destroyService(serviceHandle); } catch(Exception ignored) } }

Target:
public synchronized void close() { _isClosed = true; for (ServiceHandle<S> serviceHandle : _instancesPerEndpoint.values()) { putInDeletedList(serviceHandle); } _instancesPerEndpoint = Maps.newHashMap(); _mostRecentClientCreationTimePerEndpoint.clear(); _evictedList.invalidateAll(); _toBeDeletedList.invalidateAll(); _cleanupFuture.cancel(false); _metrics.close(); }
Source:
private void updateTimeSinceLastTutorial() { timeSinceLastTutorial = System.currentTimeMillis(); }

Target:
private void updateTimeSinceLastTutorial() { millisSinceLastTutorial = System.currentTimeMillis(); }
Source:
public void addBackgroundPage(final ScenarioGridWidget scenarioGridWidget) { kieView.getMultiPage().addPage(BACKGROUND_TAB_INDEX, new PageImpl(scenarioGridWidget, ScenarioSimulationEditorConstants.INSTANCE.backgroundTabTitle()) { @Override public void onFocus() { super.onFocus(); onBackGroundTabSelected(); } }); }

Target:
public void addBackgroundPage(final ScenarioGridWidget scenarioGridWidget) { kieView.getMultiPage().addPage(BACKGROUND_TAB_INDEX, new PageImpl(scenarioGridWidget, ScenarioSimulationEditorConstants.INSTANCE.backgroundTabTitle()) { @Override public void onFocus() { super.onFocus(); onBackgroundTabSelected(); } }); }
Source:
public void processImage(int pageNum, PageFormat pageFormat) { printShields(); super.processImage(pageNum, pageFormat); for (int loc = 0; loc < mech.locations(); loc++) { Element critRect = getSVGDocument().getElementById(CRITS + mech.getLocationAbbr(loc)); if (critRect instanceof SVGRectElement) { writeLocationCriticals(loc, (SVGRectElement) critRect); } } hideElement(HEAVY_DUTY_GYRO_PIP, mech.getGyroType() != Mech.GYRO_HEAVY_DUTY); Element hsRect = getSVGDocument().getElementById(HEAT_SINK_PIPS); if (hsRect instanceof SVGRectElement) { drawHeatSinkPips((SVGRectElement) hsRect, mech.heatSinks()); } if (mech.hasETypeFlag(Entity.ETYPE_LAND_AIR_MECH)) { Element si = getSVGDocument().getElementById(SI_PIPS); if (si instanceof SVGRectElement) { drawSIPips((SVGRectElement) si); } else { MegaMekLab.getLogger().error(getClass(), "Region siPips does not exist in template or is not a <rect>"); } } }

Target:
public void processImage(int pageNum, PageFormat pageFormat) { printShields(); super.processImage(pageNum, pageFormat); for (int loc = 0; loc < mech.locations(); loc++) { Element critRect = getSVGDocument().getElementById(CRITS + mech.getLocationAbbr(loc)); if (critRect instanceof SVGRectElement) { writeLocationCriticals(loc, (SVGRectElement) critRect); } } hideElement(HEAVY_DUTY_GYRO_PIP, mech.getGyroType() != Mech.GYRO_HEAVY_DUTY); Element hsRect = getSVGDocument().getElementById(HEAT_SINK_PIPS); if (hsRect instanceof SVGRectElement) { drawHeatSinkPips((SVGRectElement) hsRect, mech.heatSinks()); } if (mech.hasETypeFlag(Entity.ETYPE_LAND_AIR_MECH)) { Element si = getSVGDocument().getElementById(SI_PIPS); if (si instanceof SVGRectElement) { drawSIPips((SVGRectElement) si); } else { MegaMekLab.getLogger().error(this, "Region siPips does not exist in template or is not a <rect>"); } } }
Source:
public String getQueryFeature(final int configurationIndex, final double queryRuntime) throws PerfEnforceException { String featureFilePath = Paths.get( onlineLearningPath, "features", String.valueOf(PerfEnforceDriver.configurations.get(configurationIndex))) .toString(); try { BufferedReader featureReader = new BufferedReader(new FileReader(featureFilePath)); String result = featureReader.readLine(); if (queryRuntime != 0) { String[] parts = result.split(","); result = parts[0] + "," + parts[1] + "," + parts[2] + "," + parts[3] + "," + parts[4] + "," + parts[5] + "," + queryRuntime; } featureReader.close(); return result; } catch (Exception e) { throw new PerfEnforceException("Error collecting query feature"); } }

Target:
public String getQueryFeature(final int configurationIndex, final double queryRuntime) throws PerfEnforceException { String featureFilePath = Paths.get( onlineLearningPath, "features", String.valueOf(PerfEnforceDriver.configurations.get(configurationIndex))) .toString(); try (BufferedReader featureReader = new BufferedReader(new FileReader(featureFilePath))) { String result = featureReader.readLine(); if (queryRuntime != 0) { String[] parts = result.split(","); result = Joiner.on(",").join(parts); result += "," + queryRuntime; } return result; } catch (Exception e) { throw new PerfEnforceException("Error collecting query feature"); } }
Source:
public void testTransactionPropagates() throws Exception { Foo foo = db.getJdbi().open().attach(Foo.class); try { foo.insertAndFail(1, "Jeff"); fail("should have raised an exception"); } catch (Exception e){ assertThat(e).isNotNull(); } Something n = foo.createBar().findById(1); assertThat(n).isNull(); }

Target:
public void testTransactionPropagates() throws Exception { Foo foo = db.getJdbi().open().attach(Foo.class); assertThatExceptionOfType(Exception.class).isThrownBy(() -> foo.insertAndFail(1, "Jeff")); Something n = foo.createBar().findById(1); assertThat(n).isNull(); }
Source:
public static void readInDocFromString(String fName, ByteBufferInputStream bbis, DataInputStream di, ArrayBackedValueStorage abvs, XMLParser parser) throws HyracksDataException { if (!fName.contains("hdfs:/")) { File file = new File(fName); if (file.exists()) { parser.parseDocument(file, abvs); } } else { fName = fName.replaceAll("hdfs:/", ""); HDFSFunctions hdfs = new HDFSFunctions(null, null); FileSystem fs = hdfs.getFileSystem(); if (fs != null) { try { Path xmlDocument = new Path(fName); if (fs.exists(xmlDocument)) { InputStream in = fs.open(xmlDocument).getWrappedStream(); parser.parseHDFSDocument(in, abvs); in.close(); } fs.close(); } catch (IOException e) { throw new HyracksDataException(e); } finally { } } } }

Target:
public static void readInDocFromString(String fName, ByteBufferInputStream bbis, DataInputStream di, ArrayBackedValueStorage abvs, XMLParser parser) throws HyracksDataException { if (!fName.contains("hdfs:/")) { File file = new File(fName); if (file.exists()) { parser.parseDocument(file, abvs); } } else { HDFSFunctions hdfs = new HDFSFunctions(null, null); FileSystem fs = hdfs.getFileSystem(); if (fs != null) { try { String fHdfsName = fName.replaceAll("hdfs:/", ""); Path xmlDocument = new Path(fHdfsName); if (fs.exists(xmlDocument)) { InputStream in = fs.open(xmlDocument).getWrappedStream(); parser.parseHDFSDocument(in, abvs); in.close(); } fs.close(); } catch (IOException e) { throw new HyracksDataException(e); } } } }
Source:
public MultiPartEventForwarder() { payloadParamName = Context.getConfig().getString("event.forward.paramMode.payloadParamName", "payload"); additionalParams = Context.getConfig().getString("event.forward.paramMode.additionalParams", ""); }

Target:
public MultiPartEventForwarder() { payloadParamName = Context.getConfig().getString("event.forward.paramMode.payloadParamName", "payload"); additionalParams = Context.getConfig().getString("event.forward.paramMode.additionalParams"); }
Source:
public CsvSchema csvSchema() { CsvSchema.Builder schemaBuilder = new CsvSchema.Builder() ; for (String value : getContent().keySet()) { schemaBuilder.addColumn(value, CsvSchema.ColumnType.STRING); } return schemaBuilder.build(); }

Target:
public CsvSchema csvSchema() { CsvSchema.Builder schemaBuilder = new CsvSchema.Builder() ; for (String value : getRegister().getFields()) { schemaBuilder.addColumn(value, CsvSchema.ColumnType.STRING); } return schemaBuilder.build(); }
Source:
Registration with(MBeanServer server) { this.server = server; return this; }

Target:
protected Registration with(MBeanServer server) { this.server = server; return this; }
Source:
private List<String> getTeamNames(FeedbackSessionResultsBundle bundle) { List<String> teamNames = new ArrayList<String>(); for (String studentEmail : bundle.emailTeamNameTable.keySet()) { String teamName = bundle.emailTeamNameTable.get(studentEmail); if (!teamNames.contains(teamName)) { teamNames.add(teamName); } } return teamNames; }

Target:
private List<String> getTeamNames(FeedbackSessionResultsBundle bundle) { List<String> teamNames = new ArrayList<String>(); for (Set<String> teamNamesForSection : bundle.sectionTeamNameTable.values()) { teamNames.addAll(teamNamesForSection); } return teamNames; }
Source:
@NonNull public ListCardItemView setSubtitle(@Nullable CharSequence subtitle) { subtitleView.setText(subtitle); return this; }

Target:
@NonNull public ListCardItemView setSubtitle(@Nullable CharSequence subtitle) { subtitleView.setText((String) subtitle); return this; }
Source:
public void close() throws IOException { writerCheckpointMutex.lock(); try { if ( closed ) { return; } closed = true; writer.close(); pagedFile.close(); } finally { writerCheckpointMutex.unlock(); } }

Target:
public void close() throws IOException { writerCheckpointMutex.lock(); try { if ( closed ) { return; } writer.close(); pagedFile.close(); closed = true; } finally { writerCheckpointMutex.unlock(); } }
Source:
public void changedAttributeHook(PerunSessionImpl session, User user, Attribute attribute) throws InternalErrorException, WrongReferenceAttributeValueException { try { String userNamespace = attribute.getFriendlyNameParameter(); if(userNamespace.equals("lifescience-hostel-persistent-shadow") && attribute.getValue() != null){ ExtSource extSource = session.getPerunBl().getExtSourcesManagerBl().getExtSourceByName(session, extSourceNameLSH); UserExtSource userExtSource = new UserExtSource(extSource, 0, attribute.getValue().toString()); session.getPerunBl().getUsersManagerBl().addUserExtSource(session, user, userExtSource); } } catch (UserExtSourceExistsException ex) { log.warn("LIFESCIENCE HOSTEL IdP external source already exists for the user.", ex); } catch (ExtSourceNotExistsException ex) { throw new InternalErrorException("IdP external source for LIFESCIENCE HOSTEL doesn't exist.", ex); } }

Target:
public void changedAttributeHook(PerunSessionImpl session, User user, Attribute attribute) throws InternalErrorException, WrongReferenceAttributeValueException { try { String userNamespace = attribute.getFriendlyNameParameter(); if(userNamespace.equals("lifescience-hostel-persistent-shadow") && attribute.getValue() != null){ ExtSource extSource = session.getPerunBl().getExtSourcesManagerBl().getExtSourceByName(session, extSourceNameLSH); UserExtSource userExtSource = new UserExtSource(extSource, 0, ((String)attribute.getValue())); session.getPerunBl().getUsersManagerBl().addUserExtSource(session, user, userExtSource); } } catch (UserExtSourceExistsException ex) { log.warn("LIFESCIENCE HOSTEL IdP external source already exists for the user.", ex); } catch (ExtSourceNotExistsException ex) { throw new InternalErrorException("IdP external source for LIFESCIENCE HOSTEL doesn't exist.", ex); } }
Source:
public static String convertStringToSearchQuery(String input) { if (input == null) { return "%"; } return "%" + input.trim().toUpperCase().replaceAll("[\\s,%]+", " ").replaceAll("_", Matcher.quoteReplacement("\\_")) + "%"; }

Target:
public static String convertStringToSearchQuery(String input) { if (input == null) { return "%"; } return "%" + input.trim().toUpperCase().replaceAll("(\\s|,)+", " ").replaceAll("_", Matcher.quoteReplacement("\\_")).replaceAll("%", Matcher.quoteReplacement("\\%")) + "%"; }
Source:
private Request translateRequest(final ClientRequest clientRequest) { final HttpMethod method = HttpMethod.fromString(clientRequest.getMethod()); if (method == null) { throw new ProcessingException(LocalizationMessages.METHOD_NOT_SUPPORTED(clientRequest.getMethod())); } final URI uri = clientRequest.getUri(); Request request = null; switch (method) { case GET: request = client.newRequest(uri); request.method(method); break; case POST: request = client.newRequest(uri); request.method(method); break; case PUT: request = client.newRequest(uri); request.method(method); break; case DELETE: request = client.newRequest(uri); request.method(method); break; case HEAD: request = client.newRequest(uri); request.method(method); break; case OPTIONS: request = client.newRequest(uri); request.method(method); break; case TRACE: request = client.newRequest(uri); request.method(method); break; case CONNECT: request = client.newRequest(uri); request.method(method); break; case MOVE: request = client.newRequest(uri); request.method(method); break; } request.followRedirects(PropertiesHelper.getValue(clientRequest.getConfiguration().getProperties(), ClientProperties.FOLLOW_REDIRECTS, client.isFollowRedirects())); final Object readTimeout = clientRequest.getConfiguration().getProperties().get(ClientProperties.READ_TIMEOUT); if (readTimeout != null && readTimeout instanceof Integer && (Integer)readTimeout > 0) { request.timeout((Integer) readTimeout, TimeUnit.MILLISECONDS); } writeOutBoundHeaders(clientRequest.getHeaders(), request); return request; }

Target:
private Request translateRequest(final ClientRequest clientRequest) { final HttpMethod method = HttpMethod.fromString(clientRequest.getMethod()); if (method == null) { throw new ProcessingException(LocalizationMessages.METHOD_NOT_SUPPORTED(clientRequest.getMethod())); } final URI uri = clientRequest.getUri(); Request request = client.newRequest(uri); request.method(method); request.followRedirects(clientRequest.resolveProperty(ClientProperties.FOLLOW_REDIRECTS, true)); final Object readTimeout = clientRequest.getConfiguration().getProperties().get(ClientProperties.READ_TIMEOUT); if (readTimeout != null && readTimeout instanceof Integer && (Integer)readTimeout > 0) { request.timeout((Integer) readTimeout, TimeUnit.MILLISECONDS); } writeOutBoundHeaders(clientRequest.getHeaders(), request); return request; }
Source:
public Client resolveArgument(final MethodParameter parameter, final ModelAndViewContainer mavContainer, final NativeWebRequest request, final WebDataBinderFactory binderFactory) throws Exception { final Optional<String> clientId = Optional.ofNullable(request.getUserPrincipal()).map(Principal::getName); if (!featureToggleService.isFeatureEnabled(CHECK_APPLICATION_LEVEL_PERMISSIONS) || clientId.filter(settings.getAdminClientId()::equals).isPresent()) { return Client.PERMIT_ALL; } final Optional<Client> principal = clientId.map(Client.Authorized::new); if (settings.getAuthMode() == SecuritySettings.AuthMode.OFF) { return principal.orElseGet(() -> Client.PERMIT_ALL); } return principal.orElseThrow(() -> new UnauthorizedUserException("Client unauthorized")); }

Target:
public Client resolveArgument(final MethodParameter parameter, final ModelAndViewContainer mavContainer, final NativeWebRequest request, final WebDataBinderFactory binderFactory) throws Exception { final Optional<String> clientId = Optional.ofNullable(request.getUserPrincipal()).map(Principal::getName); if (!featureToggleService.isFeatureEnabled(CHECK_APPLICATION_LEVEL_PERMISSIONS) || clientId.filter(settings.getAdminClientId()::equals).isPresent() || settings.getAuthMode() == OFF) { return Client.PERMIT_ALL; } return clientId.map(Client.Authorized::new) .orElseThrow(() -> new UnauthorizedUserException("Client unauthorized")); }
Source:
protected void executeCommand() { boolean success = true; StorageServerConnections connection = getConnection(); if (!Guid.isNullOrEmpty(getVdsId())) { Pair<Boolean, Integer> result = connectHostToStorage(); boolean isValidConnection = result.getFirst(); if (!isValidConnection) { VdcFault fault = new VdcFault(); fault.setError(VdcBllErrors.forValue(result.getSecond())); getReturnValue().setFault(fault); success = false; } } setSucceeded(success); if (success) { connection.setid(Guid.newGuid().toString()); saveConnection(connection); getReturnValue().setActionReturnValue(getConnection().getid()); setSucceeded(true); } }

Target:
protected void executeCommand() { boolean success = true; StorageServerConnections connection = getConnection(); if (!Guid.isNullOrEmpty(getParameters().getVdsId())) { Pair<Boolean, Integer> result = connectHostToStorage(); boolean isValidConnection = result.getFirst(); if (!isValidConnection) { VdcFault fault = new VdcFault(); fault.setError(VdcBllErrors.forValue(result.getSecond())); getReturnValue().setFault(fault); success = false; } } if (success) { connection.setid(Guid.newGuid().toString()); saveConnection(connection); getReturnValue().setActionReturnValue(getConnection().getid()); } setSucceeded(success); }
Source:
public void fillResponseTextBox(int qnNumber, int responseNumber, String text) { WebElement element = browser.driver.findElement( By.name(Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-" + qnNumber + "-" + responseNumber)); click(element); element.clear(); element.sendKeys(text); JavascriptExecutor jsExecutor = (JavascriptExecutor) browser.driver; jsExecutor.executeScript("$(arguments[0]).change();", element); }

Target:
public void fillResponseTextBox(int qnNumber, int responseNumber, String text) { WebElement element = browser.driver.findElement( By.name(Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-" + qnNumber + "-" + responseNumber)); click(element); fillTextBox(element, text); JavascriptExecutor jsExecutor = (JavascriptExecutor) browser.driver; jsExecutor.executeScript("$(arguments[0]).change();", element); }
Source:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateMessageEventCatching emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertMessageEventExecutionSet(emptyTopEvent.getExecutionSet(), EMPTY_VALUE, NON_CANCELLING, ""); assertDataIOSet(emptyTopEvent.getDataIOSet(), EMPTY_VALUE); }

Target:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateMessageEventCatching emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertMessageEventExecutionSet(emptyTopEvent.getExecutionSet(), EMPTY_VALUE, NON_CANCELLING, EMPTY_VALUE); assertDataIOSet(emptyTopEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
void compute(ProgressMonitor pm) throws IOException { if (pm == null) pm = NullProgressMonitor.INSTANCE; pm.beginTask(JGitText.get().renamesFindingByContent, 2 * srcs.size() * dsts.size()); int mNext = buildMatrix(pm); out = new ArrayList<>(Math.min(mNext, dsts.size())); for (--mNext; mNext >= 0; mNext--) { if (pm.isCancelled()) { throw new CancelledException(JGitText.get().renameCancelled); } long ent = matrix[mNext]; int sIdx = srcFile(ent); int dIdx = dstFile(ent); DiffEntry s = srcs.get(sIdx); DiffEntry d = dsts.get(dIdx); if (d == null) { pm.update(1); continue; } ChangeType type; if (s.changeType == ChangeType.DELETE) { s.changeType = ChangeType.RENAME; type = ChangeType.RENAME; } else { type = ChangeType.COPY; } out.add(DiffEntry.pair(type, s, d, score(ent))); dsts.set(dIdx, null); pm.update(1); } srcs = compactSrcList(srcs); dsts = compactDstList(dsts); pm.endTask(); }

Target:
void compute(ProgressMonitor pm) throws IOException, CanceledException { if (pm == null) pm = NullProgressMonitor.INSTANCE; pm.beginTask(JGitText.get().renamesFindingByContent, 2 * srcs.size() * dsts.size()); int mNext = buildMatrix(pm); out = new ArrayList<>(Math.min(mNext, dsts.size())); for (--mNext; mNext >= 0; mNext--) { if (pm.isCancelled()) { throw new CanceledException(JGitText.get().renameCancelled); } long ent = matrix[mNext]; int sIdx = srcFile(ent); int dIdx = dstFile(ent); DiffEntry s = srcs.get(sIdx); DiffEntry d = dsts.get(dIdx); if (d == null) { pm.update(1); continue; } ChangeType type; if (s.changeType == ChangeType.DELETE) { s.changeType = ChangeType.RENAME; type = ChangeType.RENAME; } else { type = ChangeType.COPY; } out.add(DiffEntry.pair(type, s, d, score(ent))); dsts.set(dIdx, null); pm.update(1); } srcs = compactSrcList(srcs); dsts = compactDstList(dsts); pm.endTask(); }
Source:
public String renderArticle(HttpServletRequest request, Model model, @SiteParam Site site, RequestedDoiVersion articleId) throws IOException { ArticlePointer articlePointer = articleMetadataFactory.get(site, articleId) .validateVisibility("article") .populate(request, model) .fillAmendments(model) .getArticlePointer(); XmlContent xmlContent = getXmlContent(site, articlePointer); model.addAttribute("articleText", xmlContent.html); model.addAttribute("references", xmlContent.references); model.addAttribute("isArticlePage", true); return site + "/ftl/article/article"; }

Target:
public String renderArticle(HttpServletRequest request, Model model, @SiteParam Site site, RequestedDoiVersion articleId) throws IOException { ArticlePointer articlePointer = articleMetadataFactory.get(site, articleId) .validateVisibility("article") .populate(request, model) .fillAmendments(model) .getArticlePointer(); XmlContent xmlContent = getXmlContent(site, articlePointer); model.addAttribute("articleText", xmlContent.html); model.addAttribute("references", xmlContent.references); return site + "/ftl/article/article"; }
Source:
public UserDevfileImpl getById(String id) throws NotFoundException, ServerException { requireNonNull(id); try { final UserDevfileImpl devfile = managerProvider.get().find(UserDevfileImpl.class, id); if (devfile == null) { throw new NotFoundException(format("Devfile with id '%s' doesn't exist", id)); } return new UserDevfileImpl(devfile); } catch (RuntimeException ex) { throw new ServerException(ex.getLocalizedMessage(), ex); } }

Target:
public Optional<UserDevfile> getById(String id) throws ServerException { requireNonNull(id); try { final UserDevfileImpl devfile = managerProvider.get().find(UserDevfileImpl.class, id); if (devfile == null) { return Optional.empty(); } return Optional.of(new UserDevfileImpl(devfile)); } catch (RuntimeException ex) { throw new ServerException(ex.getLocalizedMessage(), ex); } }
Source:
public static ConsistencyCheckStrategy getById(byte id) { for (ConsistencyCheckStrategy type : values()) { if (type.id == id) { return type; } } throw new IllegalArgumentException("Could not find a ConsistencyCheckStrategy with an ID:" + id); }

Target:
public static ConsistencyCheckStrategy getById(byte id) { for (ConsistencyCheckStrategy type : VALUES) { if (type.id == id) { return type; } } throw new IllegalArgumentException("Could not find a ConsistencyCheckStrategy with an ID:" + id); }
Source:
public void close() { for (TopicPartition tp : assignment) { try { topicPartitionWriters.get(tp).close(); } catch (ConnectException e) { log.error("Error closing writer for {}. Error: {}", tp, e.getMessage()); } finally { topicPartitionWriters.remove(tp); } } assignment.clear(); }

Target:
public void close() { for (TopicPartition tp : assignment) { try { topicPartitionWriters.get(tp).close(); } catch (ConnectException e) { log.error("Error closing writer for {}. Error: {}", tp, e.getMessage()); } } topicPartitionWriters.clear(); assignment.clear(); }
Source:
public Subscription subscribe(String name) { realm.checkIfValid(); if (realm instanceof DynamicRealm) { throw new IllegalStateException("'subscribe' is not available for queries on Dynamic Realms."); } if (osList != null) { throw new IllegalStateException("Cannot create subscriptions for queries based on a 'RealmList. Subscribe to the object holding the list instead.'"); } if (TextUtils.isEmpty(name)) { throw new IllegalArgumentException("Non-empty 'name' required."); } long rowIndex = nativeSubscribe(realm.getSharedRealm().getNativePtr(), name, query.getNativePtr(), queryDescriptors.getNativePtr()); CheckedRow row = ((Realm) realm).getTable(Subscription.class).getCheckedRow(rowIndex); return realm.get(Subscription.class, null, row); }

Target:
public Subscription subscribe(String name) { realm.checkIfValid(); if (realm instanceof DynamicRealm) { throw new IllegalStateException("'subscribe' is not supported for queries on Dynamic Realms."); } if (osList != null) { throw new IllegalStateException("Cannot create subscriptions for queries based on a 'RealmList. Subscribe to the object holding the list instead.'"); } if (TextUtils.isEmpty(name)) { throw new IllegalArgumentException("Non-empty 'name' required."); } long rowIndex = nativeSubscribe(realm.getSharedRealm().getNativePtr(), name, query.getNativePtr(), queryDescriptors.getNativePtr()); CheckedRow row = ((Realm) realm).getTable(Subscription.class).getCheckedRow(rowIndex); return realm.get(Subscription.class, null, row); }
Source:
public boolean equals(Object other) { if (other == null) { return false; } if (this.getClass() != other.getClass()) { return false; } if (this == other) { return true; } if (!address.equals(other.toString())) { return false; } return true; }

Target:
public boolean equals(Object other) { if (other == null) { return false; } if (this.getClass() != other.getClass()) { return false; } if (this == other) { return true; } return Objects.equals(address, other.toString()); }