auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Schema addFieldToSchema(Schema schema, String addFieldKey) { List<Schema.Field> newFields = new ArrayList<>(); for (Schema.Field field : schema.getFields()) { newFields.add(field); } Schema.Field newField = Schema.Field.of(addFieldKey, Schema.of(Schema.Type.STRING)); newFields.add(newField); return Schema.recordOf(schema.getRecordName(), newFields); }

Target:
public static Schema addFieldToSchema(Schema schema, String addFieldKey) { List<Schema.Field> newFields = new ArrayList<>(schema.getFields().size() + 1); newFields.addAll(schema.getFields()); Schema.Field newField = Schema.Field.of(addFieldKey, Schema.of(Schema.Type.STRING)); newFields.add(newField); return Schema.recordOf(schema.getRecordName(), newFields); }
Source:
public VolumeList startCreateVolume(OmVolumeArgs args) throws IOException { try { if(isAclEnabled) { checkAcls(ResourceType.VOLUME, StoreType.OZONE, ACLType.CREATE, args.getVolume(), null, null); } VolumeList volumeList = volumeManager.createVolume(args); return volumeList; } catch (Exception ex) { throw ex; } }

Target:
public VolumeList startCreateVolume(OmVolumeArgs args) throws IOException { if(isAclEnabled) { checkAcls(ResourceType.VOLUME, StoreType.OZONE, ACLType.CREATE, args.getVolume(), null, null); } VolumeList volumeList = volumeManager.createVolume(args); return volumeList; }
Source:
public void addTab(final DialogTab tab) { tabContainer.add(tab); tab.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { switchTab(tab); } }); tab.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if (32 == event.getNativeKeyCode()) { switchTab(tab); } } }); if (tabContainer.getWidgetCount() == 1) { switchTab(tab); } }

Target:
public void addTab(final DialogTab tab) { tabContainer.add(tab); tab.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { switchTab(tab); } }); tab.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if (SPACE_KEY_CODE == event.getNativeKeyCode()) { switchTab(tab); } } }); if (tabContainer.getWidgetCount() == 1) { switchTab(tab); } }
Source:
private void setupFieldList() { final String selectField = translate(GuidedDecisionTableErraiConstants.FieldPageView_SelectField); fieldsList.clear(); fieldsList.addItem("-- " + selectField + " --", ""); page.forEachFactField(fieldName -> fieldsList.addItem(fieldName)); fieldsList.setSelectedIndex(getCurrentIndexFromList(getCurrentValue(), fieldsList)); }

Target:
public void setupFieldList() { final String selectField = translate(GuidedDecisionTableErraiConstants.FieldPageView_SelectField); fieldsList.clear(); fieldsList.addItem("-- " + selectField + " --", ""); }
Source:
public void testDoubleBufferedBlockResettableIterator() throws Exception { final BlockResettableMutableObjectIterator<Record> iterator = new BlockResettableMutableObjectIterator<Record>(this.memman, this.reader, this.serializer, 2, memOwner); iterator.open(); int lower = 0; int upper = 0; do { lower = upper; upper = lower; Record target = new Record(); while ((target = iterator.next(target)) != null) { int val = target.getField(0, IntValue.class).getValue(); Assert.assertEquals(upper++, val); } for (int i = 0; i < 5; ++i) { iterator.reset(); target = new Record(); int count = 0; while ((target = iterator.next(target)) != null) { int val = target.getField(0, IntValue.class).getValue(); Assert.assertEquals(lower + (count++), val); } Assert.assertEquals(upper - lower, count); } } while (iterator.nextBlock()); Assert.assertEquals(NUM_VALUES, upper); iterator.close(); }

Target:
public void testDoubleBufferedBlockResettableIterator() throws Exception { try { final BlockResettableMutableObjectIterator<Record> iterator = new BlockResettableMutableObjectIterator<Record>(this.memman, this.reader, this.serializer, 2, memOwner); iterator.open(); int lower = 0; int upper = 0; do { lower = upper; upper = lower; Record target = new Record(); while ((target = iterator.next(target)) != null) { int val = target.getField(0, IntValue.class).getValue(); Assert.assertEquals(upper++, val); } for (int i = 0; i < 5; ++i) { iterator.reset(); target = new Record(); int count = 0; while ((target = iterator.next(target)) != null) { int val = target.getField(0, IntValue.class).getValue(); Assert.assertEquals(lower + (count++), val); } Assert.assertEquals(upper - lower, count); } } while (iterator.nextBlock()); Assert.assertEquals(NUM_VALUES, upper); iterator.close(); } catch (Exception ex) { Assert.fail("Test encountered an exception: " + ex.getMessage()); } }
Source:
public static CloseableHttpResponse executeHTTPRequest(HttpRequestBase method, HttpClient httpClient) throws IOException, ArtifactSynchronizerException { CloseableHttpResponse httpResponse = null; int retryCount = 0; boolean retry; do { try { httpResponse = (CloseableHttpResponse) httpClient.execute(method); retry = false; } catch (IOException ex) { retryCount++; if (retryCount < retries) { retry = true; log.warn("Failed retrieving from remote endpoint: " + ex.getMessage() + ". Retrying after " + timeoutInSeconds + " seconds."); try { Thread.sleep(timeoutInSeconds * 1000); } catch (InterruptedException e) { } } else { throw ex; } } } while (retry); if (httpResponse.getStatusLine().getStatusCode() == 200) { return httpResponse; } else { httpResponse.close(); String errorMessage = EntityUtils.toString(httpResponse.getEntity(), APIConstants.DigestAuthConstants.CHARSET); throw new ArtifactSynchronizerException(errorMessage + "Eevnthub status code is:" + httpResponse.getStatusLine().getStatusCode()); } }

Target:
public static CloseableHttpResponse executeHTTPRequest(HttpRequestBase method, HttpClient httpClient) throws IOException, ArtifactSynchronizerException { CloseableHttpResponse httpResponse = null; int retryCount = 0; boolean retry; do { try { httpResponse = (CloseableHttpResponse) httpClient.execute(method); retry = false; } catch (IOException ex) { retryCount++; if (retryCount < retries) { retry = true; log.warn("Failed retrieving from remote endpoint: " + ex.getMessage() + ". Retrying after " + timeoutInSeconds + " seconds."); try { Thread.sleep(timeoutInSeconds * 1000); } catch (InterruptedException e) { } } else { throw ex; } } } while (retry); if (httpResponse.getStatusLine().getStatusCode() == 200) { return httpResponse; } else { httpResponse.close(); String errorMessage = EntityUtils.toString(httpResponse.getEntity(), APIConstants.DigestAuthConstants.CHARSET); throw new ArtifactSynchronizerException(errorMessage + "Event-Hub status code is : " + httpResponse.getStatusLine().getStatusCode()); } }
Source:
private static void clearPrefixedSystemProperties(String prefix, Map<String, String> targetPropertyMap) { for (Object element : System.getProperties().keySet()) { String propertyName = (String) element; if (propertyName.startsWith(prefix) && !targetPropertyMap.containsKey(propertyName)) { targetPropertyMap.put(propertyName, null); } } }

Target:
private static void clearPrefixedSystemProperties(String prefix, Map<String, String> targetPropertyMap) { for (Object key : System.getProperties().keySet()) { String propertyName = (String) key; if (propertyName.startsWith(prefix) && !targetPropertyMap.containsKey(propertyName)) { targetPropertyMap.put(propertyName, null); } } }
Source:
public void testBandMergeWithNodata() throws FileNotFoundException, IOException { double noDataValue = -10000d; Range nodata = RangeFactory.create(noDataValue, noDataValue); double[] background = new double[] {noDataValue}; RenderedImage twoBands = null; PlanarImage pi = PlanarImage.wrapRenderedImage(imageWithNodata2); pi.setProperty("GC_NODATA", new NoDataContainer(nodata)); ImageWorker worker = new ImageWorker() .setNoData(nodata) .setBackground(background) .mosaic( new RenderedImage[] {pi}, MosaicDescriptor.MOSAIC_TYPE_OVERLAY, null, null, new double[][] {{-32768}}, null); twoBands = worker.addBand(worker.getRenderedImage(), false).getRenderedImage(); RenderedImage singleBand = new ImageWorker(twoBands).retainBands(1).getRenderedImage(); RenderedImage threeBands = new ImageWorker(twoBands).addBand(singleBand, false).getRenderedImage(); double[] threeSamples = new double[3]; threeBands.getData().getPixel(18, 18, threeSamples); for (double sample : threeSamples) { assertEquals(noDataValue, sample, 1E-6); } }

Target:
public void testBandMergeWithNodata() throws FileNotFoundException, IOException { double noDataValue = -10000d; Range nodata = RangeFactory.create(noDataValue, noDataValue); double[] background = new double[] {noDataValue}; RenderedImage twoBands = null; PlanarImage pi = PlanarImage.wrapRenderedImage(imageWithNodata2); pi.setProperty("GC_NODATA", new NoDataContainer(nodata)); ImageWorker worker = new ImageWorker(pi).setNoData(nodata).setBackground(background); twoBands = worker.addBand(worker.getRenderedImage(), false).getRenderedImage(); RenderedImage oneBand = new ImageWorker(twoBands).retainBands(1).getRenderedImage(); RenderedImage threeBands = new ImageWorker(twoBands).addBand(oneBand, false).getRenderedImage(); double[] threeSamples = new double[3]; threeBands.getData().getPixel(18, 18, threeSamples); for (double sample : threeSamples) { assertEquals(noDataValue, sample, 1E-6); } }
Source:
public void invalidate(final boolean direct) { if (direct) { layoutState = LAYOUT_REDO; } else if (layoutState != LAYOUT_REDO) { layoutState = LAYOUT_PROPAGATE; } if (getParent() instanceof AbstractBlockBox) { ((AbstractBlockBox) getParent()).invalidate(false); } }

Target:
public void invalidate(final boolean direct) { if (direct) { layoutState = LAYOUT_REDO; } else { layoutState = LAYOUT_PROPAGATE; } if (getParent() instanceof AbstractBlockBox) { ((AbstractBlockBox) getParent()).invalidate(false); } }
Source:
private void getRowCount(){ JsonNode jn = ((DatabaseClientImpl) client).getServices() .getResource(null, "internal/viewinfo", null, params, new JacksonHandle()) .get(); long batchCount = (this.rowCount/this.batchSize); this.bucketSize = (Long.MAX_VALUE/batchCount); }

Target:
private void getRowCount(){ JsonNode jn = ((DatabaseClientImpl) getPrimaryClient()).getServices() .getResource(null, "internal/viewinfo", null, params, new JacksonHandle()) .get(); long batchCount = (this.rowCount/super.getBatchSize()); this.bucketSize = (Long.MAX_VALUE/batchCount); }
Source:
private void activateContextService() { fActiveContexts.add(fContextService.activateContext(CONTEXT)); }

Target:
private void activateContextService() { if(!fActiveContexts.isEmpty()) { deactivateContextService(); } fActiveContexts.add(fContextService.activateContext(CONTEXT)); }
Source:
public SeekableByteChannel buildChannel(final String key) throws IOException { final Path objectPath = this.root.resolve(key); final Path parentPath = objectPath.getParent(); if (parentPath != null) { Files.createDirectories(FileUtils.resolveForSymbolic(parentPath)); } if (!FileUtils.isTransferablePath(objectPath)) { throw new UnrecoverableIOException(objectPath + " is not a regular file."); } try { striped.get(key).lock(); if (Files.notExists(objectPath)) { Files.createDirectories(objectPath.getParent()); return FileChannel.open( objectPath, StandardOpenOption.SPARSE, StandardOpenOption.WRITE, StandardOpenOption.CREATE_NEW ); } } finally { striped.get(key).unlock(); } return FileChannel.open( objectPath, StandardOpenOption.WRITE ); }

Target:
public SeekableByteChannel buildChannel(final String key) throws IOException { final Path objectPath = this.root.resolve(key); final Path parentPath = objectPath.getParent(); if (parentPath != null) { Files.createDirectories(FileUtils.resolveForSymbolic(parentPath)); } if (!FileUtils.isTransferablePath(objectPath)) { throw new UnrecoverableIOException(objectPath + " is not a regular file."); } final Lock lock = striped.get(key); try { lock.lock(); if (Files.notExists(objectPath)) { Files.createDirectories(objectPath.getParent()); return FileChannel.open( objectPath, StandardOpenOption.SPARSE, StandardOpenOption.WRITE, StandardOpenOption.CREATE_NEW ); } } finally { lock.unlock(); } return FileChannel.open( objectPath, StandardOpenOption.WRITE ); }
Source:
private boolean updateVmLease() { if (Objects.equals(oldVm.getLeaseStorageDomainId(), newVmStatic.getLeaseStorageDomainId())) { return true; } if (getVm().isDown()) { if (!addVmLease(newVmStatic.getLeaseStorageDomainId(), newVmStatic.getId())){ return false; } removeVmLease(oldVm.getLeaseStorageDomainId(), oldVm.getId()); } else { if (oldVm.getLeaseStorageDomainId() != null) { runVdsCommand(VDSCommandType.HotUnplugLease, new LeaseVDSParameters(getVm().getRunOnVds(), oldVm.getId(), oldVm.getLeaseStorageDomainId())); removeVmLease(oldVm.getLeaseStorageDomainId(), oldVm.getId()); } else { VmLeaseParameters params = new VmLeaseParameters(getStoragePoolId(), newVmStatic.getLeaseStorageDomainId(), newVmStatic.getId()); params.setVdsId(getVm().getRunOnVds()); return runInternalAction(VdcActionType.HotPlugLease, params).getSucceeded(); } } return true; }

Target:
private boolean updateVmLease() { if (Objects.equals(oldVm.getLeaseStorageDomainId(), newVmStatic.getLeaseStorageDomainId())) { return true; } if (getVm().isDown()) { if (!addVmLease(newVmStatic.getLeaseStorageDomainId(), newVmStatic.getId())){ return false; } removeVmLease(oldVm.getLeaseStorageDomainId(), oldVm.getId()); } else { if (oldVm.getLeaseStorageDomainId() != null) { runVdsCommand(VDSCommandType.HotUnplugLease, new LeaseVDSParameters(getVm().getRunOnVds(), oldVm.getId(), oldVm.getLeaseStorageDomainId())); removeVmLease(oldVm.getLeaseStorageDomainId(), oldVm.getId()); } else { VmLeaseParameters params = new VmLeaseParameters(getStoragePoolId(), newVmStatic.getLeaseStorageDomainId(), newVmStatic.getId()); params.setVdsId(getVm().getRunOnVds()); params.setHotPlugLease(true); return runInternalAction(VdcActionType.AddVmLease, params).getSucceeded(); } } return true; }
Source:
private void updateTable() { fTree.setItemCount(0); if (fTrace == null) { return; } ITmfTrace[] traces; if (fTrace instanceof TmfExperiment) { TmfExperiment experiment = (TmfExperiment) fTrace; traces = experiment.getTraces(); } else { traces = new ITmfTrace[] { fTrace }; } for (ITmfTrace trace : traces) { if (trace instanceof CtfTmfTrace) { TreeItem item = new TreeItem(fTree, SWT.NONE); item.setText(0, trace.getName()); CtfTmfTrace ctfTrace = (CtfTmfTrace) trace; for (String varName : ctfTrace.getEnvNames()) { TreeItem subItem = new TreeItem(item, SWT.NONE); subItem.setText(0, varName); subItem.setText(1, ctfTrace.getEnvValue(varName)); } } } for (TreeColumn column : fTree.getColumns()) { column.pack(); } }

Target:
private void updateTable() { fTree.setItemCount(0); if (fTrace == null) { return; } ITmfTrace[] traces; if (fTrace instanceof TmfExperiment) { TmfExperiment experiment = (TmfExperiment) fTrace; traces = experiment.getTraces(); } else { traces = new ITmfTrace[] { fTrace }; } for (ITmfTrace trace : traces) { if (trace instanceof CtfTmfTrace) { TreeItem item = new TreeItem(fTree, SWT.NONE); item.setText(0, trace.getName()); CtfTmfTrace ctfTrace = (CtfTmfTrace) trace; for (String varName : ctfTrace.getEnvNames()) { TreeItem subItem = new TreeItem(item, SWT.NONE); subItem.setText(0, varName); subItem.setText(1, ctfTrace.getEnvValue(varName)); } } } for (TreeColumn column : fTree.getColumns()) { column.pack(); } for (int i = 0; i < fTree.getItemCount(); i++) { fTree.getItem(i).setExpanded(true); } }
Source:
public static void preloadXmlAnalysesOutput(File xmlFile) { if (!xmlValidate(xmlFile).isOK()) { return; } removeXmlOutput(xmlFile.getAbsolutePath()); try { Document doc = XmlUtils.getDocumentFromFile(xmlFile); for (OutputType outputType : OutputType.values()) { NodeList outputNodes = doc.getElementsByTagName(outputType.getXmlElem()); for (int i = 0; i < outputNodes.getLength(); i++) { Set<String> analysesId = new HashSet<>(); Element node = (Element) outputNodes.item(i); List<Element> headNodes = TmfXmlUtils.getChildElements(node, TmfXmlStrings.HEAD); if (headNodes.size() != 1) { return; } Element headElement = headNodes.get(0); List<Element> analysisNodes = TmfXmlUtils.getChildElements(headElement, TmfXmlStrings.ANALYSIS); for (Element analysis : analysisNodes) { String analysisId = analysis.getAttribute(TmfXmlStrings.ID); analysesId.add(analysisId); } String outputId = node.getAttribute(TmfXmlStrings.ID); List<Element> label = TmfXmlUtils.getChildElements(headNodes.get(0), TmfXmlStrings.LABEL); if (label.isEmpty()) { return; } Element labelElement = label.get(0); String outputLabel = labelElement.getAttribute(TmfXmlStrings.VALUE); XmlOutputElement output = new XmlOutputElement(xmlFile.getAbsolutePath(), outputType.getXmlElem(), outputId, outputLabel, analysesId); AddXmlOutput(output); } } } catch (ParserConfigurationException | SAXException | IOException e) { Activator.logError("Error opening XML file", e); } }

Target:
public static void preloadXmlAnalysesOutput(File xmlFile) { if (!xmlValidate(xmlFile).isOK()) { return; } removeXmlOutput(xmlFile.getAbsolutePath()); try { Document doc = XmlUtils.getDocumentFromFile(xmlFile); for (OutputType outputType : OutputType.values()) { NodeList outputNodes = doc.getElementsByTagName(outputType.getXmlElem()); for (int i = 0; i < outputNodes.getLength(); i++) { Set<String> analysesId = new HashSet<>(); Element node = (Element) outputNodes.item(i); List<Element> headNodes = TmfXmlUtils.getChildElements(node, TmfXmlStrings.HEAD); if (headNodes.size() != 1) { return; } Element headElement = headNodes.get(0); List<Element> analysisNodes = TmfXmlUtils.getChildElements(headElement, TmfXmlStrings.ANALYSIS); for (Element analysis : analysisNodes) { String analysisId = analysis.getAttribute(TmfXmlStrings.ID); analysesId.add(analysisId); } String outputId = node.getAttribute(TmfXmlStrings.ID); List<Element> label = TmfXmlUtils.getChildElements(headNodes.get(0), TmfXmlStrings.LABEL); if (label.isEmpty()) { return; } Element labelElement = label.get(0); String outputLabel = labelElement.getAttribute(TmfXmlStrings.VALUE); XmlOutputElement output = new XmlOutputElement(xmlFile.getAbsolutePath(), outputType.getXmlElem(), outputId, outputLabel, analysesId); addXmlOutput(output); } } updateCachedOuputElements(); } catch (ParserConfigurationException | SAXException | IOException e) { Activator.logError("Error opening XML file", e); } }
Source:
public GitRepository(URI repositoryUri, String branch, String cacheDirectoryPath, LocalRepository.Factory localRepositoryFactory, FileUtilities fileUtilities) { super(); this.fileUtilities = fileUtilities; this.repositoryUri = repositoryUri; this.branch = branch == null ? "master" : branch; this.localRepositoryFactory = localRepositoryFactory; this.localFolder = createRepositoryLocation(cacheDirectoryPath); this.lockFile = new File(this.localFolder.getAbsolutePath() + "_lock"); }

Target:
public GitRepository(URI repositoryUri, String branch, String cacheDirectoryPath, LocalRepository.Factory localRepositoryFactory, FileUtilities fileUtilities) { super(); this.fileUtilities = fileUtilities; this.repositoryUri = repositoryUri; this.branch = branch == null ? "master" : branch; this.localRepositoryFactory = localRepositoryFactory; this.localFolder = createRepositoryLocation(cacheDirectoryPath); this.lockFile = new File(this.localFolder.getAbsolutePath() + ".lock"); }
Source:
public void execute(final Scenario scenario) throws Throwable { Timeout.timeout(new Timeout.Callback<Object>() { @Override public Object call() throws Throwable { backend.invoke(body, new Object[]{scenario}); return null; } }, timeout); }

Target:
public void execute(final Scenario scenario) throws Throwable { Timeout.timeout(new Timeout.Callback<Object>() { @Override public Object call() throws Throwable { backend.invoke(body, new Object[]{scenario}); return null; } }, timeoutMillis); }
Source:
private Collection<FeedbackResponseComment> getFeedbackResponseCommentEntitiesForSessionInSection(String courseId, String feedbackSessionName, String section) { Map<String, FeedbackResponseComment> FeedbackResponseCommentList = new HashMap<String, FeedbackResponseComment>(); Query q = getPM().newQuery(FeedbackResponseComment.class); q.declareParameters("String courseIdParam, String feedbackSessionNameParam, String sectionParam"); q.setFilter("courseId == courseIdParam && " + "feedbackSessionName == feedbackSessionNameParam && giverSection == sectionParam"); @SuppressWarnings("unchecked") List<FeedbackResponseComment> firstQueryResponseComments = (List<FeedbackResponseComment>) q.execute(courseId, feedbackSessionName, section); for (FeedbackResponseComment responseComment : firstQueryResponseComments) { if (!JDOHelper.isDeleted(responseComment)) { FeedbackResponseCommentList.put(String.valueOf(responseComment.getFeedbackResponseCommentId()), responseComment); } } q.setFilter("courseId == courseIdParam && " + "feedbackSessionName == feedbackSessionNameParam && receiverSection == sectionParam"); @SuppressWarnings("unchecked") List<FeedbackResponseComment> secondQueryResponseComments = (List<FeedbackResponseComment>) q.execute(courseId, feedbackSessionName, section); for (FeedbackResponseComment responseComment : secondQueryResponseComments) { if (!JDOHelper.isDeleted(responseComment)) { FeedbackResponseCommentList.put(String.valueOf(responseComment.getFeedbackResponseCommentId()), responseComment); } } return FeedbackResponseCommentList.values(); }

Target:
private Collection<FeedbackResponseComment> getFeedbackResponseCommentEntitiesForSessionInSection( String courseId, String feedbackSessionName, String section) { Map<String, FeedbackResponseComment> feedbackResponseCommentList = new HashMap<String, FeedbackResponseComment>(); Query q = getPM().newQuery(FeedbackResponseComment.class); q.declareParameters("String courseIdParam, String feedbackSessionNameParam, String sectionParam"); q.setFilter("courseId == courseIdParam && " + "feedbackSessionName == feedbackSessionNameParam && giverSection == sectionParam"); @SuppressWarnings("unchecked") List<FeedbackResponseComment> firstQueryResponseComments = (List<FeedbackResponseComment>) q.execute(courseId, feedbackSessionName, section); for (FeedbackResponseComment responseComment : firstQueryResponseComments) { if (!JDOHelper.isDeleted(responseComment)) { feedbackResponseCommentList.put( String.valueOf(responseComment.getFeedbackResponseCommentId()), responseComment); } } q.setFilter("courseId == courseIdParam && " + "feedbackSessionName == feedbackSessionNameParam && receiverSection == sectionParam"); @SuppressWarnings("unchecked") List<FeedbackResponseComment> secondQueryResponseComments = (List<FeedbackResponseComment>) q.execute(courseId, feedbackSessionName, section); for (FeedbackResponseComment responseComment : secondQueryResponseComments) { if (!JDOHelper.isDeleted(responseComment)) { feedbackResponseCommentList.put( String.valueOf(responseComment.getFeedbackResponseCommentId()), responseComment); } } return feedbackResponseCommentList.values(); }
Source:
public void clientVersion(final String version) { final String name = name(group, TYPE + "_meter_client_version", version); Meter m = clientVersionMeters.get(name); if (m == null) { m = registry.meter(name); clientVersionMeters.put(name, m); } m.mark(); }

Target:
public void clientVersion(final String version) { final String name = name(group, TYPE + "_meter_client_version", version); registry.meter(name).mark(); }
Source:
public boolean hasNext() { for (;;) { if (currentChunk != null && currentChunk.hasNext()) { return true; } else if (iteratorOverChunks.hasNext()) { currentChunk = nextChunk(); } else { return false; } } }

Target:
public boolean hasNext() { for (;;) { if (currentChunk != null && currentChunk.hasNext()) { return true; } if (iteratorOverChunks.hasNext()) { currentChunk = nextChunk(); } else { return false; } } }
Source:
void beforeReleaseWrite(FullPageId pageId, long ptr, boolean pageWalRec) throws IgniteCheckedException { boolean walIsNotDisable = !walMgr.disabled(pageId.groupId()); boolean pageRecOrAlwaysWriteFullPage = walMgr != null && (pageWalRec || walMgr.isAlwaysWriteFullPages()); if (pageRecOrAlwaysWriteFullPage && walIsNotDisable) walMgr.log(new PageSnapshot(pageId, ptr, pageSize(), realPageSize(pageId.groupId()))); }

Target:
void beforeReleaseWrite(FullPageId pageId, long ptr, boolean pageWalRec) throws IgniteCheckedException { boolean walIsNotDisable = walMgr != null && !walMgr.disabled(pageId.groupId()); boolean pageRecOrAlwaysWriteFullPage = walMgr != null && (pageWalRec || walMgr.isAlwaysWriteFullPages()); if (pageRecOrAlwaysWriteFullPage && walIsNotDisable) walMgr.log(new PageSnapshot(pageId, ptr, pageSize(), realPageSize(pageId.groupId()))); }
Source:
public void testStorageSpaceQuotaParam() { StorageSpaceQuotaParam sp = new StorageSpaceQuotaParam( StorageSpaceQuotaParam.DEFAULT); assertEquals(Long.valueOf(StorageSpaceQuotaParam.DEFAULT), sp.getValue()); sp = new StorageSpaceQuotaParam(100L); assertEquals(new Long(100), sp.getValue()); }

Target:
public void testStorageSpaceQuotaParam() { StorageSpaceQuotaParam sp = new StorageSpaceQuotaParam( StorageSpaceQuotaParam.DEFAULT); assertEquals(Long.valueOf(StorageSpaceQuotaParam.DEFAULT), sp.getValue()); sp = new StorageSpaceQuotaParam(100L); assertEquals(100L, sp.getValue().longValue()); }
Source:
public CqlQueryResponse executeCqlQuery(CqlRequest cqlRequest) throws UnsupportedQueryException, SourceUnavailableException, FederationException { QueryRequest request = cqlRequest.createQueryRequest(catalogFramework.getId(), filterBuilder); Stopwatch stopwatch = Stopwatch.createStarted(); List<QueryResponse> responses = Collections.synchronizedList(new ArrayList<>()); List<Result> results; if (cqlRequest.getCount() == 0) { results = retrieveHitCount(request, responses); } else { results = retrieveResults(cqlRequest, request, responses); } QueryResponse response = new QueryResponseImpl( request, results, true, responses .stream() .filter(Objects::nonNull) .map(QueryResponse::getHits) .findFirst() .orElse(-1L), responses .stream() .filter(Objects::nonNull) .map(QueryResponse::getProperties) .findFirst() .orElse(Collections.emptyMap()), responses .stream() .filter(Objects::nonNull) .map(QueryResponse::getProcessingDetails) .findFirst() .orElse(Collections.EMPTY_SET)); stopwatch.stop(); return new CqlQueryResponse( cqlRequest.getId(), request, response, cqlRequest.getSourceResponseString(), stopwatch.elapsed(TimeUnit.MILLISECONDS), cqlRequest.isNormalize(), filterAdapter, actionRegistry, descriptors); }

Target:
public CqlQueryResponse executeCqlQuery(CqlRequest cqlRequest) throws UnsupportedQueryException, SourceUnavailableException, FederationException { QueryRequest request = cqlRequest.createQueryRequest(catalogFramework.getId(), filterBuilder); Stopwatch stopwatch = Stopwatch.createStarted(); List<QueryResponse> responses = Collections.synchronizedList(new ArrayList<>()); List<Result> results; if (cqlRequest.getCount() == 0) { results = retrieveHitCount(request, responses); } else { results = retrieveResults(cqlRequest, request, responses); } QueryResponse response = new QueryResponseImpl( request, results, true, responses .stream() .filter(Objects::nonNull) .map(QueryResponse::getHits) .findFirst() .orElse(-1L), responses .stream() .filter(Objects::nonNull) .map(QueryResponse::getProperties) .findFirst() .orElse(Collections.emptyMap()), responses .stream() .filter(Objects::nonNull) .map(QueryResponse::getProcessingDetails) .reduce( new HashSet<>(), (l, r) -> { l.addAll(r); return l; })); stopwatch.stop(); return new CqlQueryResponse( cqlRequest.getId(), request, response, cqlRequest.getSourceResponseString(), stopwatch.elapsed(TimeUnit.MILLISECONDS), cqlRequest.isNormalize(), filterAdapter, actionRegistry, descriptors); }
Source:
public void handleNotification(StatisticsNotification notification) { long totalCount = 0; long totalTime = 0; for (StatisticId statId : notification) { StatisticDescriptor descriptor = statId.getStatisticDescriptor(); String name = descriptor.getName(); Number value; try { value = notification.getValue(statId); } catch (StatisticNotFoundException e) { value = 0; } log(name, value); if (name.equals(StatsKey.VM_GC_STATS_COLLECTIONS)) { totalCount += value.longValue(); } else if (name.equals(StatsKey.VM_GC_STATS_COLLECTION_TIME)) { totalTime += value.longValue(); } } collections = totalCount; collectionTime = totalTime; }

Target:
public void handleNotification(StatisticsNotification notification) { for (StatisticId statId : notification) { StatisticDescriptor descriptor = statId.getStatisticDescriptor(); String name = descriptor.getName(); Number value; try { value = notification.getValue(statId); } catch (StatisticNotFoundException e) { value = 0; } log(name, value); if (name.equals(StatsKey.VM_GC_STATS_COLLECTIONS)) { collections.put(statId.getStatistics().getUniqueId(), value); } else if (name.equals(StatsKey.VM_GC_STATS_COLLECTION_TIME)) { collectionTime.put(statId.getStatistics().getUniqueId(), value); } } }
Source:
public List<Resource> getResources(PerunSession sess, Map<String, String> attributesWithSearchingValues, boolean allowPartialMatchForString) throws PrivilegeException, InternalErrorException, AttributeNotExistsException, WrongAttributeAssignmentException { if (!AuthzResolver.authorizedInternal(sess, "getResources_Map<String, String>_policy", Collections.emptyList())) throw new PrivilegeException(sess, "getResources"); return searcherBl.getResources(sess, attributesWithSearchingValues, allowPartialMatchForString); }

Target:
public List<Resource> getResources(PerunSession sess, Map<String, String> attributesWithSearchingValues, boolean allowPartialMatchForString) throws PrivilegeException, InternalErrorException, AttributeNotExistsException, WrongAttributeAssignmentException { if (!AuthzResolver.authorizedInternal(sess, "getResources_Map<String_String>_policy")) throw new PrivilegeException(sess, "getResources"); return searcherBl.getResources(sess, attributesWithSearchingValues, allowPartialMatchForString); }
Source:
public UriPrefixingClientHttpRequestFactory(ClientHttpRequestFactory factory, URI uriPrefix) { this.wrapped = notNull(factory, "factory"); this.prefixer = new UriPrefixer(uriPrefix); }

Target:
UriPrefixingClientHttpRequestFactory(ClientHttpRequestFactory factory, URI uriPrefix) { this.wrapped = notNull(factory, "factory"); this.prefixer = new UriPrefixer(uriPrefix); }
Source:
public void bytesConverterTypeParseTest() { Map<String, KafkaSerDe.BytesConverterType> testCases = new HashMap<String, KafkaSerDe.BytesConverterType>() {{ put("confluent", KafkaSerDe.BytesConverterType.CONFLUENT); put("conFLuent", KafkaSerDe.BytesConverterType.CONFLUENT); put("Confluent", KafkaSerDe.BytesConverterType.CONFLUENT); put("CONFLUENT", KafkaSerDe.BytesConverterType.CONFLUENT); put(" confluent ", KafkaSerDe.BytesConverterType.CONFLUENT); put("skip", KafkaSerDe.BytesConverterType.SKIP); put("sKIp", KafkaSerDe.BytesConverterType.SKIP); put("SKIP", KafkaSerDe.BytesConverterType.SKIP); put(" skip ", KafkaSerDe.BytesConverterType.SKIP); put("SKIP1", KafkaSerDe.BytesConverterType.NONE); put("skipper", KafkaSerDe.BytesConverterType.NONE); put("", KafkaSerDe.BytesConverterType.NONE); put(null, KafkaSerDe.BytesConverterType.NONE); put("none", KafkaSerDe.BytesConverterType.NONE); put("NONE", KafkaSerDe.BytesConverterType.NONE); put(" none ", KafkaSerDe.BytesConverterType.NONE); }}; for(Map.Entry<String, KafkaSerDe.BytesConverterType> entry: testCases.entrySet()){ Assert.assertEquals(entry.getValue(), KafkaSerDe.BytesConverterType.fromString(entry.getKey())); } }

Target:
public void bytesConverterTypeParseTest() { Map<String, KafkaSerDe.BytesConverterType> testCases = new HashMap<String, KafkaSerDe.BytesConverterType>() {{ put("skip", KafkaSerDe.BytesConverterType.SKIP); put("sKIp", KafkaSerDe.BytesConverterType.SKIP); put("SKIP", KafkaSerDe.BytesConverterType.SKIP); put(" skip ", KafkaSerDe.BytesConverterType.SKIP); put("SKIP1", KafkaSerDe.BytesConverterType.NONE); put("skipper", KafkaSerDe.BytesConverterType.NONE); put("", KafkaSerDe.BytesConverterType.NONE); put(null, KafkaSerDe.BytesConverterType.NONE); put("none", KafkaSerDe.BytesConverterType.NONE); put("NONE", KafkaSerDe.BytesConverterType.NONE); }}; for(Map.Entry<String, KafkaSerDe.BytesConverterType> entry: testCases.entrySet()) { Assert.assertEquals(entry.getValue(), KafkaSerDe.BytesConverterType.fromString(entry.getKey())); } }
Source:
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { if (!alreadyEncoded(responseContext)) { for (Encoding encoding : ENCODINGS) { if (acceptsEncoding(requestContext, encoding.encoding)) { MultivaluedMap<String, Object> headers = responseContext.getHeaders(); headers.add(HttpHeaders.VARY, HttpHeaders.ACCEPT_ENCODING); headers.add(HttpHeaders.CONTENT_ENCODING, encoding.encoding); responseContext.setEntityStream(encoding.compressor.apply(responseContext.getEntityStream())); } } } }

Target:
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { if (isTooSmall(responseContext) || isEncoded(responseContext) || isUncompressable(responseContext)) { return; } List<String> headerLines = requestContext.getHeaders().get(HttpHeaders.ACCEPT_ENCODING); if (headerLines == null) { return; } List<String> acceptedEncodings = parsedHeaders.getUnchecked(headerLines); for (Encoding encoding : Encoding.values()) { if (acceptedEncodings.contains(encoding.encoding)) { MultivaluedMap<String, Object> headers = responseContext.getHeaders(); headers.add(HttpHeaders.VARY, HttpHeaders.ACCEPT_ENCODING); headers.add(HttpHeaders.CONTENT_ENCODING, encoding.encoding); responseContext.setEntityStream(encoding.compressor.apply(responseContext.getEntityStream())); return; } } }
Source:
public void testFindWorkingVersionHTMLPage() throws Exception{ String ext="."+Config.getStringProperty("VELOCITY_PAGE_EXTENSION"); Template template=new Template(); template.setTitle("TEST TEMPLATE VERSIONABLE"); template.setBody("<html><body> I'm mostly empty </body></html>"); template=APILocator.getTemplateAPI().saveTemplate(template, host, user, false); Folder folder = APILocator.getFolderAPI().createFolders("/testingVersionable", host, user, false); HTMLPage page=new HTMLPage(); page.setPageUrl("testpage"+ext); page.setFriendlyName("testpage"+ext); page.setTitle("testpage"+ext); page=APILocator.getHTMLPageAPI().saveHTMLPage(page, template, folder, user, false); Versionable verAPI = APILocator.getVersionableAPI().findWorkingVersion(page.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),page.getTitle()); assertEquals(verAPI.getInode(),page.getInode()); APILocator.getHTMLPageAPI().delete(page, user, false); APILocator.getFolderAPI().delete(folder, user, false); APILocator.getTemplateAPI().delete(template, user, false); }

Target:
public void testFindWorkingVersionHTMLPage() throws Exception{ HTMLPage page = createHTMLPage(); Versionable verAPI = APILocator.getVersionableAPI().findWorkingVersion(page.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),page.getTitle()); assertEquals(verAPI.getInode(),page.getInode()); Folder folder = APILocator.getHTMLPageAPI().getParentFolder(page); Template template = APILocator.getHTMLPageAPI().getTemplateForWorkingHTMLPage(page); APILocator.getHTMLPageAPI().delete(page, user, false); APILocator.getFolderAPI().delete(folder, user, false); APILocator.getTemplateAPI().delete(template, user, false); }
Source:
private JsonResult getInstructorJoinStatus(String regkey) { InstructorAttributes instructor = logic.getInstructorForRegistrationKey(regkey); if (instructor == null) { return new JsonResult("No instructor with given registration key: " + regkey, HttpStatus.SC_NOT_FOUND); } String institute = getRequestParamValue(Const.ParamsNames.INSTRUCTOR_INSTITUTION); String mac = getRequestParamValue(Const.ParamsNames.INSTITUTION_MAC); if (institute != null && !StringHelper.isCorrectSignature(institute, mac)) { return new JsonResult("Error in URL validation. Please re-check the URL.", HttpStatus.SC_BAD_REQUEST); } return getJoinStatusResult(instructor.isRegistered()); }

Target:
private JsonResult getInstructorJoinStatus(String regkey) { InstructorAttributes instructor = logic.getInstructorForRegistrationKey(regkey); if (instructor == null) { return new JsonResult("No instructor with given registration key: " + regkey, HttpStatus.SC_NOT_FOUND); } return getJoinStatusResult(instructor.isRegistered()); }
Source:
private Source getMockSource() throws UnsupportedQueryException { Source mockSource = mock(Source.class); when(mockSource.getId()).thenReturn("1"); when(mockSource.query(any(QueryRequest.class))).thenReturn(mockResponse); return mockSource; }

Target:
private Source getMockSource() throws UnsupportedQueryException { Source mockSource = mock(Source.class); when(mockSource.getId()).thenReturn(UUID.randomUUID().toString()); when(mockSource.query(any(QueryRequest.class))).thenReturn(mockResponse); return mockSource; }
Source:
public List<TaskDTO> findAll(String sort, Integer offset, Integer size, Map filters) throws DataException { LoginForm login = (LoginForm) Helper.getManagedBeanValue("#{LoginForm}"); if (login == null) { return new ArrayList<>(); } BoolQueryBuilder subquery = new BoolQueryBuilder(); subquery.should(createSimpleQuery("processingUser", login.getMyBenutzer().getId(), true)); subquery.should(createSimpleQuery("users.id", login.getMyBenutzer().getId(), true)); for (UserGroup userGroup : login.getMyBenutzer().getUserGroups()) { subquery.should(createSimpleQuery("userGroups.id", userGroup.getId(), true)); } BoolQueryBuilder query = new BoolQueryBuilder(); query.must(subquery); query.must(createSimpleQuery("processingStatus", TaskStatus.LOCKED.getValue(), false)); query.must(createSimpleQuery("processingStatus", TaskStatus.DONE.getValue(), false)); AktuelleSchritteForm form = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); if (form.getHideCorrectionTasks()) { query.must(createSimpleQuery("priority", 10, true)); } if (!form.getShowAutomaticTasks()) { query.must(createSimpleQuery("typeAutomatic", "false", true)); } return convertJSONObjectsToDTOs(searcher.findDocuments(query.toString(), sort, offset, size), false); }

Target:
public List<TaskDTO> findAll(String sort, Integer offset, Integer size, Map filters) throws DataException { LoginForm login = (LoginForm) Helper.getManagedBeanValue("#{LoginForm}"); if (login == null) { return new ArrayList<>(); } BoolQueryBuilder query = createUserTaskQuery(login); return convertJSONObjectsToDTOs(searcher.findDocuments(query.toString(), sort, offset, size), false); }
Source:
public String toString() { switch (this) { case TIME: return "SCHEDULE"; case LOAD: return "LOAD"; case METRIC: return "METRIC"; case PROMETHEUS: return "PROMETHEUS"; default: throw new IllegalArgumentException(); } }

Target:
public String toString() { switch (this) { case TIME: return "SCHEDULE"; default: return name(); } }
Source:
public Attachment createAttachment(PersistableBusinessObject parent, String uploadedFileName, String mimeType, int fileSize, InputStream fileContents, String attachmentTypeCode) throws IOException { if(parent == null) { throw new IllegalArgumentException("invalid (null or uninitialized) document"); } else if(StringUtils.isBlank(uploadedFileName)) { throw new IllegalArgumentException("invalid (blank) fileName"); } else if(StringUtils.isBlank(mimeType)) { throw new IllegalArgumentException("invalid (blank) mimeType"); } else if(fileSize <= 0) { throw new IllegalArgumentException("invalid (non-positive) fileSize"); } else if(fileContents == null) { throw new IllegalArgumentException("invalid (null) inputStream"); } else { byte[] fileContentsAsByteArray = IOUtils.toByteArray(fileContents); InputStream fileContentsToScan = new ByteArrayInputStream(fileContentsAsByteArray); if (!ScanResult.Status.PASSED.equals(antiVirusService.scan(fileContentsToScan).getStatus())) { LOG.error("createAttachment, virus protection failure! uploadedFileName: " + uploadedFileName + " mimeType: " + mimeType + " attachmentTypeCode: " + attachmentTypeCode + " parent object: " + parent); throw new IllegalArgumentException("file contents failed virus scan"); } else { InputStream fileContentsForAttachment = new ByteArrayInputStream(fileContentsAsByteArray); return super.createAttachment(parent, uploadedFileName, mimeType, fileSize, fileContentsForAttachment, attachmentTypeCode); } } }

Target:
public Attachment createAttachment(PersistableBusinessObject parent, String uploadedFileName, String mimeType, int fileSize, InputStream fileContents, String attachmentTypeCode) throws IOException { if(parent == null) { throw new IllegalArgumentException("invalid (null or uninitialized) document"); } else if(StringUtils.isBlank(uploadedFileName)) { throw new IllegalArgumentException("invalid (blank) fileName"); } else if(StringUtils.isBlank(mimeType)) { throw new IllegalArgumentException("invalid (blank) mimeType"); } else if(fileSize <= 0) { throw new IllegalArgumentException("invalid (non-positive) fileSize"); } else if(fileContents == null) { throw new IllegalArgumentException("invalid (null) inputStream"); } else { byte[] fileContentsAsByteArray = IOUtils.toByteArray(fileContents); InputStream fileContentsToScan = new ByteArrayInputStream(fileContentsAsByteArray); ScanResult virusScanResults = antiVirusService.scan(fileContentsToScan); if (!ScanResult.Status.PASSED.equals(virusScanResults.getStatus())) { LOG.error("createAttachment, virus protection failure! uploadedFileName: " + uploadedFileName + ", mimeType: " + mimeType + ", attachmentTypeCode: " + attachmentTypeCode + ", scan result: " + virusScanResults.getStatus() + ", parent object: " + parent); throw new IllegalArgumentException("file contents failed virus scan"); } else { InputStream fileContentsForAttachment = new ByteArrayInputStream(fileContentsAsByteArray); return super.createAttachment(parent, uploadedFileName, mimeType, fileSize, fileContentsForAttachment, attachmentTypeCode); } } }
Source:
public LuceneAnalysisDefinitionTranslationMapBuilder(Class<D> targetClass) { super(); this.targetClass = targetClass; }

Target:
public LuceneAnalysisDefinitionTranslationMapBuilder(Class<D> targetClass) { this.targetClass = targetClass; }
Source:
public CRAMFileWriter(final OutputStream outputStream, final OutputStream indexOS, final boolean presorted, final ReferenceSource referenceSource, final SAMFileHeader samFileHeader, final String fileName) { if (outputStream == null) { throw new IllegalArgumentException("CRAMWriter output stream can not be null."); } if (referenceSource == null) { throw new IllegalArgumentException("A reference is required for CRAM writers"); } if (samFileHeader == null) { throw new IllegalArgumentException("A valid SAMFileHeader is required for CRAM writers"); } this.outputStream = outputStream; this.samFileHeader = samFileHeader; this.fileName = fileName; initCRAMWriter(indexOS, referenceSource, samFileHeader, presorted); }

Target:
public CRAMFileWriter(final OutputStream outputStream, final OutputStream indexOS, final boolean presorted, final ReferenceSource referenceSource, final SAMFileHeader samFileHeader, final String fileName) { if (outputStream == null) { throw new IllegalArgumentException("CRAMWriter output stream can not be null."); } if (referenceSource == null) { throw new IllegalArgumentException("A reference is required for CRAM writers"); } if (samFileHeader == null) { throw new IllegalArgumentException("A valid SAMFileHeader is required for CRAM writers"); } this.samFileHeader = samFileHeader; this.fileName = fileName; setSortOrder(samFileHeader.getSortOrder(), presorted); cramContainerStream = new CRAMContainerStreamWriter(outputStream, indexOS, referenceSource, samFileHeader, fileName); setHeader(samFileHeader); }
Source:
public void savePinTypesListState(){ sizepinTypeTitleInputs = pinTypeTitleInputs.size(); sizeuploadMarker = uploadMarker.size(); sizeparentCatElements = parentCatElements.size(); PageObjectLogging.log("savePinTypesListState", "State of pin types list is saved", true); }

Target:
public void savePinTypesListState() { amountPinTypeTitleInputs = pinTypeTitleInputs.size(); amountUploadMarker = uploadMarker.size(); amountParentCatElements = parentCatElements.size(); PageObjectLogging.log("savePinTypesListState", "State of pin types list is saved", true); }
Source:
FlatRow readRows( final ByteString rowKey, final ColumnFamily columnFamily, final ReadRowsRequest request, final Function<ByteString, Boolean> matchesColumn ) { final FlatRow.Builder builder = FlatRow.newBuilder().withRowKey(rowKey); storage .entrySet() .stream() .filter(e -> { final boolean matches = matchesColumn.apply(e.getKey()); final Optional<RowFilter> filter = request.getFilter(); System.out.println(filter); return matches; }) .map(column -> FlatRow.Cell .newBuilder() .withFamily(columnFamily.getName()) .withQualifier(column.getKey()) .withValue(column.getValue()) .build()) .forEach(builder::addCell); return builder.build(); }

Target:
FlatRow readRows( final ByteString rowKey, final ColumnFamily columnFamily, final ReadRowsRequest request, final Function<ByteString, Boolean> matchesColumn ) { final FlatRow.Builder builder = FlatRow.newBuilder().withRowKey(rowKey); storage .entrySet() .stream() .filter(e -> { final boolean matches = matchesColumn.apply(e.getKey()); final Optional<RowFilter> filter = request.getFilter(); return matches; }) .map(column -> FlatRow.Cell .newBuilder() .withFamily(columnFamily.getName()) .withQualifier(column.getKey()) .withValue(column.getValue()) .build()) .forEach(builder::addCell); return builder.build(); }
Source:
public void removeItem(final DataType dataType) { cleanSubTypes(dataType.getUUID()); final Optional<Element> dataTypeRow = Optional.ofNullable(getDataTypeRow(dataType)); dataTypeRow.ifPresent(Element::remove); }

Target:
public void removeItem(final DataType dataType) { cleanSubTypes(dataType.getUUID()); final Optional<Element> dataTypeRow = Optional.ofNullable(getDataTypeRow(dataType)); dataTypeRow.ifPresent(ElementHelper::remove); }
Source:
public void resize (int width, int height) { boolean resize = currentScreenFBO.getHeight() != height || currentScreenFBO.getWidth() != width || nextScreenFBO.getHeight() != height || nextScreenFBO.getWidth() != width; if (false) { currentScreenFBO.dispose(); nextScreenFBO.dispose(); currentScreenFBO = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, false); nextScreenFBO = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, false); } if (screen != null) screen.resize(width, height); if (nextScreen != null) nextScreen.resize(width, height); }

Target:
public void resize (int width, int height) { if (screen != null) screen.resize(width, height); if (nextScreen != null) nextScreen.resize(width, height); }
Source:
private void updateMetricData(Connection connection) throws SQLException { Statement statement = connection.createStatement(); statement.execute("select * from pg_stat_database where datname='connector';"); ResultSet resultSet = statement.getResultSet(); resultSet.next(); for (String key: integerDatabaseStatsMap.keySet() ) { integerDatabaseStatsMap.put(key, resultSet.getInt(key)); } for (String key: doubleDatabaseStatsMap.keySet() ) { doubleDatabaseStatsMap.put(key, resultSet.getDouble(key)); } resultSet.close(); statement.close(); }

Target:
private void updateMetricData(Connection connection) { try (Statement statement = connection.createStatement()) { statement.execute("select * from pg_stat_database where datname='connector';"); try (ResultSet resultSet = statement.getResultSet()) { resultSet.next(); for (String key : longDatabaseStatsMap.keySet()) { longDatabaseStatsMap.put(key, resultSet.getLong(key)); } for (String key : doubleDatabaseStatsMap.keySet()) { doubleDatabaseStatsMap.put(key, resultSet.getDouble(key)); } } statsHealthy = 1; } catch (SQLException e) { statsHealthy = 0; } }
Source:
public void requestPersistence() { persistenceRequested = true; if (timer == null) { timer = UserThread.runPeriodically(() -> { persistNow(null); UserThread.execute(() -> timer = null); }, source.delayInSec, TimeUnit.SECONDS); } }

Target:
public void requestPersistence() { persistenceRequested = true; if (timer == null) { timer = UserThread.runAfter(() -> { persistNow(null); UserThread.execute(() -> timer = null); }, source.delayInSec, TimeUnit.SECONDS); } }