auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void extractComments() { for (int i = 0; i < tokenStream.size(); i++) { Token token = tokenStream.get(i); if (token.getChannel() != Token.HIDDEN_CHANNEL) { continue; } if (ListenerUtil.isSingleLineComment(token)) { singleLineComments.add(token); } if (ListenerUtil.isMultilineComment(token)) { multilineComments.add(token); } } }

Target:
private void extractComments() { for (Token token : tokenStream.getTokens()) { if (token.getChannel() != Token.HIDDEN_CHANNEL) { continue; } if (ListenerUtil.isSingleLineComment(token)) { singleLineComments.add(token); } if (ListenerUtil.isMultilineComment(token)) { multilineComments.add(token); } } }
Source:
public void testBatchWithMismatchedResultArray() throws Exception { Table table = getDefaultTable(); Exception actualError = null; try { table.batchCallback(ImmutableList.of(), new Object[1], null); } catch (Exception ex) { actualError = ex; } assertNull(actualError); }

Target:
public void testBatchWithMismatchedResultArray() throws Exception { Table table = getDefaultTable(); Exception actualError = null; Batch.Callback mockCallBack = Mockito.mock(Batch.Callback.class); try { table.batchCallback(ImmutableList.of(), new Object[1], mockCallBack); } catch (Exception ex) { actualError = ex; } assertNull(actualError); verify(mockCallBack, Mockito.never()).update(Mockito.any(), Mockito.any(), Mockito.any()); }
Source:
public BaseLivyInterpreter(Properties property) { super(property); this.livyURL = property.getProperty("zeppelin.livy.url"); this.displayAppInfo = Boolean.parseBoolean( property.getProperty("zeppelin.livy.displayAppInfo", "true")); this.sessionCreationTimeout = Integer.parseInt( property.getProperty("zeppelin.livy.session.create_timeout", 120 + "")); this.pullStatusInterval = Integer.parseInt( property.getProperty("zeppelin.livy.pull_status.interval.millis", 1000 + "")); this.restTemplate = createRestTemplate(); if (!StringUtils.isBlank(property.getProperty("zeppelin.livy.http.headers"))) { String[] headers = property.getProperty("zeppelin.livy.http.headers").split(";"); for (String header : headers) { String[] splits = header.split(":"); customHeaders.put(splits[0].trim(), splits[1].trim()); } } }

Target:
public BaseLivyInterpreter(Properties property) { super(property); this.livyURL = property.getProperty("zeppelin.livy.url"); this.displayAppInfo = Boolean.parseBoolean( property.getProperty("zeppelin.livy.displayAppInfo", "true")); this.sessionCreationTimeout = Integer.parseInt( property.getProperty("zeppelin.livy.session.create_timeout", 120 + "")); this.pullStatusInterval = Integer.parseInt( property.getProperty("zeppelin.livy.pull_status.interval.millis", 1000 + "")); this.restTemplate = createRestTemplate(); if (!StringUtils.isBlank(property.getProperty("zeppelin.livy.http.headers"))) { String[] headers = property.getProperty("zeppelin.livy.http.headers").split(";"); for (String header : headers) { String[] splits = header.split(":", -1); if (splits.length != 2) { throw new RuntimeException("Invalid format of http headers: " + header + ", valid http header format is HEADER_NAME:HEADER_VALUE"); } customHeaders.put(splits[0].trim(), envSubstitute(splits[1].trim())); } } }
Source:
public void jmsPort_shouldBeExportedWithCorrectId() throws Exception { if (!featuresService.isInstalled(featuresService.getFeature("openengsb-ports-ws"))) { featuresService.installFeature("openengsb-ports-jms"); } OutgoingPort serviceWithId = OpenEngSBCoreServices.getServiceUtilsService().getServiceWithId(OutgoingPort.class, "jms-json", 60000); assertNotNull(serviceWithId); }

Target:
public void jmsPort_shouldBeExportedWithCorrectId() throws Exception { OutgoingPort serviceWithId = OpenEngSBCoreServices.getServiceUtilsService().getServiceWithId(OutgoingPort.class, "jms-json", 60000); assertNotNull(serviceWithId); }
Source:
protected MuleMessage doRequest(final long timeout) throws Exception { boolean activeDeclarationsOnly = amqpConnector.isActiveDeclarationsOnly(); final String exchangeName = declarator.declareExchange(channel, endpoint, activeDeclarationsOnly); if (StringUtils.isNotEmpty(endpointUtil.getQueueName(endpoint.getAddress())) || endpoint.getProperties().containsKey(ENDPOINT_PROPERTY_QUEUE_DURABLE) || endpoint.getProperties().containsKey(ENDPOINT_PROPERTY_QUEUE_AUTO_DELETE) || endpoint.getProperties().containsKey(ENDPOINT_PROPERTY_QUEUE_EXCLUSIVE)) { declarator.declareEndpoint(channel, endpoint, activeDeclarationsOnly, exchangeName); } final AmqpMessage amqpMessage = messageConsumer.consumeMessage(channel, getQueueName(), amqpConnector.getAckMode().isAutoAck(), timeout); if (amqpMessage == null) return null; final MuleMessage muleMessage = createMuleMessage(amqpMessage); messagePropertiesHandler.addInvocationProperties(channel, amqpMessage, muleMessage, amqpConnector); messagePropertiesHandler.ackMessageIfNecessary(channel, amqpMessage, endpoint); return muleMessage; }

Target:
protected MuleMessage doRequest(final long timeout) throws Exception { declarator.declareExchangeAndEndpointIfNecessary(channel, endpoint, amqpConnector.isActiveDeclarationsOnly()); final AmqpMessage amqpMessage = messageConsumer.consumeMessage(channel, getQueueName(), amqpConnector.getAckMode().isAutoAck(), timeout); if (amqpMessage == null) return null; final MuleMessage muleMessage = createMuleMessage(amqpMessage); messagePropertiesHandler.addInvocationProperties(channel, amqpMessage, muleMessage, amqpConnector); messagePropertiesHandler.ackMessageIfNecessary(channel, amqpMessage, endpoint); return muleMessage; }
Source:
public final static <T> Observable<T> mergeDelayError(Iterable<? extends Observable<? extends T>> sequences) { return mergeDelayError(from(sequences)); }

Target:
public static <T> Observable<T> mergeDelayError(Iterable<? extends Observable<? extends T>> sequences) { return mergeDelayError(from(sequences)); }
Source:
public void handleShiftClick(GlowPlayer player, InventoryView view, int clickedSlot, ItemStack clickedItem) { if (getSlotType(view.convertSlot(clickedSlot)) == SlotType.RESULT) { Recipe recipe = getRecipe(); if (recipe == null) { return; } final ItemStack[] matrix = getMatrix(); int recipeAmount = CraftingManager.getLayers(matrix); clickedItem.setAmount(clickedItem.getAmount() * recipeAmount); player.getInventory().tryToFillSlots(clickedItem, 8, -1, 35, 8); CraftingManager cm = ((GlowServer) Bukkit.getServer()).getCraftingManager(); cm.removeItems(matrix, this, recipeAmount); } else { clickedItem = player.getInventory().tryToFillSlots(clickedItem, 9, 36, 0, 9); view.setItem(clickedSlot, clickedItem); } }

Target:
public void handleShiftClick(GlowPlayer player, InventoryView view, int clickedSlot, ItemStack clickedItem) { if (getSlotType(view.convertSlot(clickedSlot)) == SlotType.RESULT) { Recipe recipe = getRecipe(); if (recipe == null) { return; } final ItemStack[] matrix = getMatrix(); int recipeAmount = CraftingManager.getLayers(matrix); clickedItem.setAmount(clickedItem.getAmount() * recipeAmount); player.getInventory().tryToFillSlots(clickedItem, 8, -1, 35, 8); CraftingManager cm = player.getServer().getCraftingManager(); cm.removeItems(matrix, this, recipeAmount); } else { clickedItem = player.getInventory().tryToFillSlots(clickedItem, 9, 36, 0, 9); view.setItem(clickedSlot, clickedItem); } }
Source:
public static boolean isIssueJBEAP(JiraIssue issue) { return issue != null && issue.getProduct() != null && issue.getProduct().isPresent() && issue.getProduct().get().equals(JBEAPProject); }

Target:
public static boolean isIssueJBEAP(JiraIssue issue) { return issue != null && issue.getProduct().isPresent() && issue.getProduct().get().equals(JBEAPProject); }
Source:
public QueryCriteria startingWith(@Nullable Object o) { regex("^"+o.toString()); return this; }

Target:
public QueryCriteria startingWith(@Nullable Object o) { if (o instanceof QueryCriteria) { QueryCriteria term = where("\"%\"").plus(o); like(term); } else { like(o.toString() + "%"); } return this; }
Source:
public void streamSEDDetailsDocumentContents(HttpServletResponse response) throws EntityRetrievalException, IOException { Path path = Paths.get(env.getProperty("downloadSEDFolderPath")); File downloadFile = new File(path.toUri()); byte[] data = Files.readAllBytes(path); if (data != null && data.length > 0) { ByteArrayInputStream inputStream = new ByteArrayInputStream(data); String mimeType = "text/csv"; response.setContentType(mimeType); response.setContentLength((int) data.length); String headerKey = "Content-Disposition"; String headerValue = String.format("attachment; filename=\"%s\"", downloadFile.getName()); response.setHeader(headerKey, headerValue); OutputStream outStream = response.getOutputStream(); byte[] buffer = new byte[1024]; int bytesRead = -1; while ((bytesRead = inputStream.read(buffer)) != -1) { outStream.write(buffer, 0, bytesRead); } inputStream.close(); outStream.close(); } }

Target:
public void streamSEDDetailsDocumentContents(HttpServletResponse response) throws EntityRetrievalException, IOException { Path path = Paths.get(env.getProperty("downloadFolderPath"), env.getProperty("SEDDownloadName")); File downloadFile = new File(path.toUri()); byte[] data = Files.readAllBytes(path); if (data != null && data.length > 0) { ByteArrayInputStream inputStream = new ByteArrayInputStream(data); String mimeType = "text/csv"; response.setContentType(mimeType); response.setContentLength((int) data.length); String headerKey = "Content-Disposition"; String headerValue = String.format("attachment; filename=\"%s\"", downloadFile.getName()); response.setHeader(headerKey, headerValue); OutputStream outStream = response.getOutputStream(); byte[] buffer = new byte[1024]; int bytesRead = -1; while ((bytesRead = inputStream.read(buffer)) != -1) { outStream.write(buffer, 0, bytesRead); } inputStream.close(); outStream.close(); } }
Source:
public Collection<Integer> getCategoryIds(Language language, int articleId) throws DaoException { String http = new String("http://"); String host = new String(".wikipedia.org"); String query = new String("/w/api.php?action=query&prop=categories&format=json&pageids="); List<LocalCategory> categoryList = new LocalCategoryListQueryReply(LiveUtils.getInfoByQuery(http + language.getLangCode() + host + query + new Integer(articleId).toString() + "&cmlimit=" + new Integer(Integer.MAX_VALUE).toString()), language).getCategoryList(); List<Integer> categoryIdsList = new ArrayList<Integer>(); for(LocalCategory m: categoryList){ categoryIdsList.add(m.getLocalId()); } return categoryIdsList; }

Target:
public Collection<Integer> getCategoryIds(Language language, int articleId) throws DaoException { LiveAPIQuery.LiveAPIQueryBuilder builder = new LiveAPIQuery.LiveAPIQueryBuilder("CATEGORIES", language).addPageid(articleId); List<Integer> categoryIdsList = new ArrayList<Integer>(); List<QueryReply> replies = builder.build().getValuesFromQueryResult(); for (QueryReply reply : replies) { categoryIdsList.add(reply.pageId); } return categoryIdsList; }
Source:
public static Map<Integer, StudyEntryPropertyData> map(final GermplasmListData source, final List<Integer> germplasmDescriptorIds) { final Map<Integer, StudyEntryPropertyData> studyEntryProperties = new HashMap<>(); for(final Integer variableId: germplasmDescriptorIds) { if(TermId.ENTRY_TYPE.getId() == variableId) { studyEntryProperties.put(TermId.ENTRY_TYPE.getId(), createStudyEntryPropertyValue(TermId.ENTRY_TYPE.getId(), DEFAULT_ENTRY_TYPE)); } else if(TermId.SEED_SOURCE.getId() == variableId) { studyEntryProperties.put(TermId.SEED_SOURCE.getId(), createStudyEntryPropertyValue(TermId.SEED_SOURCE.getId(), source.getSeedSource())); } else if(TermId.GROUPGID.getId() == variableId) { studyEntryProperties.put(TermId.GROUPGID.getId(), createStudyEntryPropertyValue(TermId.GROUPGID.getId(), String.valueOf(source.getGermplasm().getMgid()))); } else if(TermId.CROSS.getId() == variableId){ studyEntryProperties.put(TermId.CROSS.getId(), createStudyEntryPropertyValue(TermId.CROSS.getId(), String.valueOf(source.getGroupName()))); } else if(TermId.GERMPLASM_SOURCE.getId() == variableId) { studyEntryProperties.put(TermId.GERMPLASM_SOURCE.getId(), createStudyEntryPropertyValue(TermId.GERMPLASM_SOURCE.getId(), source.getSeedSource())); } else if (TermId.ENTRY_CODE.getId() == variableId) { studyEntryProperties.put(TermId.ENTRY_CODE.getId(), createStudyEntryPropertyValue(TermId.ENTRY_CODE.getId(), source.getEntryCode())); } } return studyEntryProperties; }

Target:
public static Map<Integer, StudyEntryPropertyData> map(final GermplasmListData source, final List<Integer> germplasmDescriptorIds) { final Map<Integer, StudyEntryPropertyData> studyEntryProperties = new HashMap<>(); for(final Integer variableId: germplasmDescriptorIds) { if(TermId.ENTRY_TYPE.getId() == variableId) { studyEntryProperties.put(TermId.ENTRY_TYPE.getId(), createStudyEntryPropertyValue(TermId.ENTRY_TYPE.getId(), DEFAULT_ENTRY_TYPE)); } else if(TermId.SEED_SOURCE.getId() == variableId) { studyEntryProperties.put(TermId.SEED_SOURCE.getId(), createStudyEntryPropertyValue(TermId.SEED_SOURCE.getId(), source.getSeedSource())); } else if(TermId.GROUPGID.getId() == variableId) { studyEntryProperties.put(TermId.GROUPGID.getId(), createStudyEntryPropertyValue(TermId.GROUPGID.getId(), String.valueOf(source.getGermplasm().getMgid()))); } else if(TermId.CROSS.getId() == variableId){ studyEntryProperties.put(TermId.CROSS.getId(), createStudyEntryPropertyValue(TermId.CROSS.getId(), String.valueOf(source.getGroupName()))); } else if(TermId.GERMPLASM_SOURCE.getId() == variableId) { studyEntryProperties.put(TermId.GERMPLASM_SOURCE.getId(), createStudyEntryPropertyValue(TermId.GERMPLASM_SOURCE.getId(), source.getSeedSource())); } } return studyEntryProperties; }
Source:
private EntityRecord toEntityRecord(E entity) { final String idString = idToString(entity.getId()); final Any state = toAny(entity.getState()); final EntityRecord.Builder builder = EntityRecord.newBuilder() .setEntityState(state) .setEntityId(idString) .setWhenModified(entity.whenModified()) .setVersion(entity.getVersion()); return builder.build(); }

Target:
private EntityStorageRecord toEntityRecord(E entity) { final I id = entity.getId(); final EntityStorageRecord.Id entityId = toRecordId(id); final M state = entity.getState(); final Any stateAny = toAny(state); final Timestamp whenModified = entity.whenModified(); final int version = entity.getVersion(); final EntityStorageRecord.Builder builder = EntityStorageRecord.newBuilder() .setState(stateAny) .setId(entityId) .setWhenModified(whenModified) .setVersion(version); return builder.build(); }
Source:
public void testTableWriterInfo() { PageSinkManager pageSinkManager = new PageSinkManager(); pageSinkManager.addConnectorPageSinkProvider(CONNECTOR_ID, new ConstantPageSinkProvider(new MemoryAccountingTestPageSink())); TableWriterOperator tableWriterOperator = (TableWriterOperator) createTableWriterOperator(pageSinkManager); RowPagesBuilder rowPagesBuilder = rowPagesBuilder(BIGINT); for (int i = 0; i < 100; i++) { rowPagesBuilder.addSequencePage(100, 0); } List<Page> pages = rowPagesBuilder.build(); long pageSize = pages.get(0).getRetainedSizeInBytes(); for (int i = 0; i < pages.size(); i++) { Page page = pages.get(i); tableWriterOperator.addInput(page); TableWriterInfo info = tableWriterOperator.getInfo(); assertEquals(info.getPageSinkPeakMemoryUsage(), pageSize * (i + 1)); } }

Target:
public void testTableWriterInfo() { PageSinkManager pageSinkManager = new PageSinkManager(); pageSinkManager.addConnectorPageSinkProvider(CONNECTOR_ID, new ConstantPageSinkProvider(new MemoryAccountingTestPageSink())); TableWriterOperator tableWriterOperator = (TableWriterOperator) createTableWriterOperator(pageSinkManager); RowPagesBuilder rowPagesBuilder = rowPagesBuilder(BIGINT); for (int i = 0; i < 100; i++) { rowPagesBuilder.addSequencePage(100, 0); } List<Page> pages = rowPagesBuilder.build(); long peakMemoryUsage = 0; for (int i = 0; i < pages.size(); i++) { Page page = pages.get(i); peakMemoryUsage += page.getRetainedSizeInBytes(); tableWriterOperator.addInput(page); TableWriterInfo info = tableWriterOperator.getInfo(); assertEquals(info.getPageSinkPeakMemoryUsage(), peakMemoryUsage); } }
Source:
static public String getMetadataName(String blobName) { MessageDigest messageDigest; try { messageDigest = MessageDigest.getInstance("SHA-256"); messageDigest.update(blobName.getBytes(OrionConstantValues.ENCODING)); byte[] digest = messageDigest.digest(); BigInteger bigInteger = new BigInteger(1, digest); return bigInteger.toString(16); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return String.valueOf(blobName.hashCode()); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return String.valueOf(blobName.hashCode()); } }

Target:
public static String getMetadataName(String blobName) { MessageDigest messageDigest; try { messageDigest = MessageDigest.getInstance("SHA-256"); messageDigest.update(blobName.getBytes(OrionConstantValues.ENCODING)); final byte[] digest = messageDigest.digest(); final BigInteger bigInteger = new BigInteger(1, digest); return bigInteger.toString(16); } catch (final NoSuchAlgorithmException e) { e.printStackTrace(); return String.valueOf(blobName.hashCode()); } catch (final UnsupportedEncodingException e) { e.printStackTrace(); return String.valueOf(blobName.hashCode()); } }
Source:
private void resolveImpl(PackList packList, AbbreviatedObjectId id, boolean noGarbage, HashSet<ObjectId> matches) throws IOException { if (MAX_RESOLVE_MATCHES <= matches.size()) { return; } for (DfsPackFile pack : packList.packs) { if (noGarbage && pack.isGarbage()) { continue; } pack.resolve(this, matches, id, MAX_RESOLVE_MATCHES); if (MAX_RESOLVE_MATCHES <= matches.size()) { break; } } }

Target:
private void resolveImpl(PackList packList, AbbreviatedObjectId id, boolean noGarbage, HashSet<ObjectId> matches) throws IOException { for (DfsPackFile pack : packList.packs) { if (noGarbage && pack.isGarbage()) { continue; } pack.resolve(this, matches, id, MAX_RESOLVE_MATCHES); if (MAX_RESOLVE_MATCHES <= matches.size()) { break; } } }
Source:
protected void setUpGetHostIdExpectations(int idx) throws Exception { VDS host = BackendHostsResourceTest.setUpEntityExpectations(control.createMock(VDS.class), control.createMock(RpmVersion.class), idx); setUpGetEntityExpectations(VdcQueryType.GetVdsByName, GetVdsByNameParameters.class, new String[] { "Name" }, new Object[] { NAMES[idx] }, host); }

Target:
protected void setUpGetHostIdExpectations(int idx) throws Exception { VDS host = BackendHostsResourceTest.setUpEntityExpectations(control.createMock(VDS.class), idx); setUpGetEntityExpectations(VdcQueryType.GetVdsByName, GetVdsByNameParameters.class, new String[] { "Name" }, new Object[] { NAMES[idx] }, host); }
Source:
private void createAndAddErrorPageHandler( ServletContextHandler httpServiceContext, Bundle refBundle) { ServletHandler handler = httpServiceContext.getServletHandler(); ServletHolder errorServletHolder = new ServletHolder(new ErrorServlet()); errorServletHolder.setServletHandler(handler); try { errorServletHolder.start(); errorServletHolder.initialize(); } catch (Exception e) { LOGGER.warn( "Unable to initialize an errorServletHolder for {}. Jetty's default error page will be used for this context", refBundle.getSymbolicName(), e); return; } LOGGER.info( "Injecting an error page into into ID: {}", refBundle.getSymbolicName(), refBundle.getBundleId()); handler.addServletWithMapping(errorServletHolder, errorPagePath); ErrorPageErrorHandler errorPageErrorHandler = new ErrorPageErrorHandler(); errorPageErrorHandler.setErrorPages(errorCodesMap); httpServiceContext.setErrorHandler(errorPageErrorHandler); }

Target:
private void createAndAddErrorPageHandler( ServletContextHandler httpServiceContext, Bundle refBundle) { ServletHandler handler = httpServiceContext.getServletHandler(); ServletHolder errorServletHolder = new ServletHolder(new ErrorServlet()); errorServletHolder.setServletHandler(handler); try { errorServletHolder.start(); errorServletHolder.initialize(); } catch (Exception e) { LOGGER.warn( "Unable to initialize an errorServletHolder for {}. Jetty's default error page will be used for this context", refBundle.getSymbolicName(), e); return; } LOGGER.info( "Injecting an error page into ID: {}", refBundle.getSymbolicName(), refBundle.getBundleId()); handler.addServletWithMapping(errorServletHolder, ERROR_PAGE_PATH); ErrorPageErrorHandler errorPageErrorHandler = new ErrorPageErrorHandler(); errorPageErrorHandler.setErrorPages(errorCodesMap); httpServiceContext.setErrorHandler(errorPageErrorHandler); }
Source:
public String encryptValue(String unwrappedPlaintext) { if (unwrappedPlaintext == null) { return null; } if (unwrappedPlaintext.equals("")) { return ""; } return String.format(ENC_TEMPLATE, encrypt(unwrappedPlaintext)); }

Target:
public String encryptValue(String unwrappedPlaintext) { if (StringUtils.isEmpty(unwrappedPlaintext)) { return unwrappedPlaintext; } return String.format(ENC_TEMPLATE, encrypt(unwrappedPlaintext)); }
Source:
public void onBind() { super.onBind(); registerHandler(((ViewDef) getView()).getCloseButton().addClickHandler(e -> { AbstractOverlayPresenter.this.removeFromParentSlot(); })); }

Target:
public void onBind() { super.onBind(); registerHandler(((ViewDef) getView()).getCloseButton().addClickHandler(e -> AbstractOverlayPresenter.this.removeFromParentSlot() )); }
Source:
public List<ApController> findAll() { Request request = new Request.Builder().url(host + "/r/controllers").build(); Response response = client.newCall(request); try { return gson.fromJson(new InputStreamReader(response.body().byteStream(), "UTF-8"), new TypeToken<List<ApController>>() {}.getType()); } catch (IOException ioe) { LOGGER.info("Problem with the communication has occurred", ioe); throw new CommunicationException(); } }

Target:
public List<ApController> findAll() { Request request = new Request.Builder().url(host + "/r/controllers").build(); Response response = client.newCall(request); return json.fromJson(response.body().byteStream(), new TypeToken<List<ApController>>(){}.getType()); }
Source:
public static <Solution_> SolverFactory<Solution_> create(SolverConfig solverConfig) { return new DefaultSolverFactory<>(solverConfig); }

Target:
public static <Solution_> SolverFactory<Solution_> create(SolverConfig solverConfig) { solverConfig = new SolverConfig(solverConfig); return new DefaultSolverFactory<>(solverConfig); }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } VDSGroup cluster = getVdsGroup(); if (cluster == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID); return false; } if (!cluster.supportsGlusterService()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_DOES_NOT_SUPPORT_GLUSTER); return false; } GlusterVolumeEntity volume = getGlusterVolumeDao().getById(volumeId); if (volume != null && volume.getStatus() == GlusterStatus.DOWN) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); } if (!isVolumeThinlyProvisioned(volume)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_NOT_THINLY_PROVISIONED); } return true; }

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } VDSGroup cluster = getVdsGroup(); if (cluster == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID); return false; } if (!cluster.supportsGlusterService()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_DOES_NOT_SUPPORT_GLUSTER); return false; } if (!GlusterFeatureSupported.glusterSnapshot(cluster.getcompatibility_version())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VOLUME_SNAPSHOT_NOT_SUPPORTED); return false; } GlusterVolumeEntity volume = getGlusterVolume(); if (volume == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_INVALID); } else if (volume.getStatus() == GlusterStatus.DOWN) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); } if (!isVolumeThinlyProvisioned(volume)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_NOT_THINLY_PROVISIONED); } return true; }
Source:
private static void startApi(CommandLineArgs args, Client esNodeClient) { port(args.getListenPort()); ipAddress(args.getListenIp()); if (args.isCors()) { CorsFilter.enableCORS("*", "get", "*"); } else { before((request, response) -> { response.type("application/json"); }); } get("api", new SearchRequestHandler("api", esNodeClient, args.getLanguages())); get("api/", new SearchRequestHandler("api/", esNodeClient, args.getLanguages())); get("reverse", new ReverseSearchRequestHandler("reverse", esNodeClient, args.getLanguages())); get("reverse/", new ReverseSearchRequestHandler("reverse/", esNodeClient, args.getLanguages())); final NominatimUpdater nominatimUpdater = new NominatimUpdater(args.getHost(), args.getPort(), args.getDatabase(), args.getUser(), args.getPassword()); Updater updater = new de.komoot.photon.elasticsearch.Updater(esNodeClient, args.getLanguages()); nominatimUpdater.setUpdater(updater); get("/nominatim-update", (Request request, Response response) -> { new Thread(() -> nominatimUpdater.update()).start(); return "nominatim update started (more information in console output) ..."; }); }

Target:
private static void startApi(CommandLineArgs args, Client esNodeClient) { port(args.getListenPort()); ipAddress(args.getListenIp()); String allowedOrigin = args.isCorsAnyOrigin() ? "*" : args.getCorsOrigin(); if (allowedOrigin != null) { CorsFilter.enableCORS(allowedOrigin, "get", "*"); } else { before((request, response) -> { response.type("application/json"); }); } get("api", new SearchRequestHandler("api", esNodeClient, args.getLanguages())); get("api/", new SearchRequestHandler("api/", esNodeClient, args.getLanguages())); get("reverse", new ReverseSearchRequestHandler("reverse", esNodeClient, args.getLanguages())); get("reverse/", new ReverseSearchRequestHandler("reverse/", esNodeClient, args.getLanguages())); final NominatimUpdater nominatimUpdater = new NominatimUpdater(args.getHost(), args.getPort(), args.getDatabase(), args.getUser(), args.getPassword()); Updater updater = new de.komoot.photon.elasticsearch.Updater(esNodeClient, args.getLanguages()); nominatimUpdater.setUpdater(updater); get("/nominatim-update", (Request request, Response response) -> { new Thread(() -> nominatimUpdater.update()).start(); return "nominatim update started (more information in console output) ..."; }); }
Source:
public DIR.ServiceSet.Builder getOSDs(DIR.ServiceSet.Builder allOSDs, InetAddress clientIP, GlobalTypes.VivaldiCoordinates clientCoords, XLocList currentXLoc, int numOSDs) { System.out.println("getOSDs parameters:"); System.out.println("clientIP: " + clientIP.toString()); System.out.println("clientCoords: " + clientCoords.toString()); System.out.println(": getOSDs parameters."); return getOSDs(allOSDs); }

Target:
public DIR.ServiceSet.Builder getOSDs(DIR.ServiceSet.Builder allOSDs, InetAddress clientIP, GlobalTypes.VivaldiCoordinates clientCoords, XLocList currentXLoc, int numOSDs) { return getOSDs(allOSDs); }
Source:
public void provision(Pod pod) { List<LocalObjectReference> imagePullSecrets = pod.getSpec().getImagePullSecrets(); pod.getSpec() .setImagePullSecrets( ImmutableList.<LocalObjectReference>builder() .add(new LocalObjectReferenceBuilder().withName(SECRET_NAME).build()) .addAll(imagePullSecrets) .build()); }

Target:
private void provision(Pod pod) { List<LocalObjectReference> imagePullSecrets = pod.getSpec().getImagePullSecrets(); pod.getSpec() .setImagePullSecrets( ImmutableList.<LocalObjectReference>builder() .add(new LocalObjectReferenceBuilder().withName(SECRET_NAME).build()) .addAll(imagePullSecrets) .build()); }
Source:
public void getUrlsSuccess() { final CountDownLatch signal = new CountDownLatch(1); a.getOrchestraClient().getUrls("XX", null).enqueue(new Callback<UrlList>() { @Override public void onResponse(Call<UrlList> call, Response<UrlList> response) { if (!response.isSuccessful()) Assert.fail(); signal.countDown(); } @Override public void onFailure(Call<UrlList> call, Throwable t) { Assert.fail(); signal.countDown(); } }); try { signal.await(1, TimeUnit.MINUTES); } catch (InterruptedException e) { e.printStackTrace(); } }

Target:
public void getUrlsSuccess() { final CountDownLatch signal = new CountDownLatch(1); a.getOrchestraClient().getUrls("XX", null).enqueue(new Callback<UrlList>() { @Override public void onResponse(Call<UrlList> call, Response<UrlList> response) { Assert.assertTrue(response.isSuccessful()); signal.countDown(); } @Override public void onFailure(Call<UrlList> call, Throwable t) { Assert.fail(); signal.countDown(); } }); try { signal.await(1, TimeUnit.MINUTES); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(); } }
Source:
public void reset() { event.emit(ResetStart.class); decisionBlock = 0; synchronized (concepts) { concepts.clear(); } synchronized (newTasks) { newTasks.clear(); novelTasks.clear(); } synchronized(this.seq_current) { this.seq_current.clear(); } cycle = 0; emotion.resetEmotions(); this.lastDecision = null; resetStatic(); event.emit(ResetEnd.class); }

Target:
public void reset() { event.emit(ResetStart.class); decisionBlock = 0; synchronized (concepts) { concepts.clear(); } synchronized (tasksMutex) { newTasks.clear(); novelTasks.clear(); } synchronized(this.seq_current) { this.seq_current.clear(); } cycle = 0; emotion.resetEmotions(); this.lastDecision = null; resetStatic(); event.emit(ResetEnd.class); }
Source:
public void logInvalidStatuses(List<CloudVmInstanceStatus> instances, InstanceStatus targetStatus) { if (instances == null || instances.size() < 1) { return; } StringBuilder warnMessage = new StringBuilder("Unable to reboot "); warnMessage.append(instances.stream().map(instance -> String.format("instance %s because of invalid status %s", instance.getCloudInstance().getInstanceId(), instance.getStatus().toString())).collect(Collectors.joining(", "))); warnMessage.append(String.format(". Instances should be in %s state.", targetStatus.toString())); LOGGER.warn(warnMessage.toString()); }

Target:
public void logInvalidStatuses(List<CloudVmInstanceStatus> instances, InstanceStatus targetStatus) { if (CollectionUtils.isNotEmpty(instances)) { StringBuilder warnMessage = new StringBuilder("Unable to reboot "); warnMessage.append(instances.stream().map(instance -> String.format("instance %s because of invalid status %s", instance.getCloudInstance().getInstanceId(), instance.getStatus().toString())).collect(Collectors.joining(", "))); warnMessage.append(String.format(". Instances should be in %s state.", targetStatus.toString())); LOGGER.warn(warnMessage.toString()); } }
Source:
protected boolean set(Entity entity, Map<Key<?>, Object> keyValues) { float scale = (Float) keyValues.get(Keys.SCALE); entity.height = ((Float) keyValues.get(Keys.HEIGHT)) * scale; entity.width = ((Float) keyValues.get(Keys.BASE_SIZE)) * scale; return true; }

Target:
protected boolean set(Entity entity, Map<Key<?>, Object> keyValues) { float width = (Float) keyValues.get(Keys.BASE_SIZE); float height = (Float) keyValues.get(Keys.HEIGHT); float scale = (Float) keyValues.get(Keys.SCALE); IMixinEntity mixinEntity = (IMixinEntity) entity; mixinEntity.setSpongeSize(width, height, scale); return true; }
Source:
public void calculateHash(int mDepth) { int maxDepth = coders.size() + 1; if (!isRoot()) { throw new InvalidParameterException("Can only be called on the root VertexCoder!"); } String lastHash = "XXX"; calculateCodes(maxDepth, false); int expansionDepth = 1; while (!lastHash.equals(labellessCode) && expansionDepth <= mDepth) { lastHash = labellessCode; expand(expansionDepth++); calculateCodes(maxDepth, false); } calculateCodes(maxDepth, true); }

Target:
public void calculateHash(int mDepth) { int maxDepth = coders.size() + 1; if (!isRoot()) { throw new InvalidParameterException("Can only be called on the root VertexCoder!"); } String lastHash = null; calculateCodes(maxDepth, false); int expansionDepth = 1; while (!lastHash.equals(labellessCode) && expansionDepth <= mDepth) { lastHash = labellessCode; expand(expansionDepth++); calculateCodes(maxDepth, false); } calculateCodes(maxDepth, true); }
Source:
private List<String> myAdvertisedAddresses() { if (advertisedAddrs != null) return advertisedAddrs; else { List<InetSocketAddress> addrs = myAddresses(); List<String> str_addrs = new ArrayList<String>(addrs.size()); for (final InetSocketAddress addr : addrs) { str_addrs.add(SocketUtil.format(addr, IANA_SSH_PORT)); } return str_addrs; } }

Target:
private List<String> myAdvertisedAddresses() { if (advertisedAddress != null) { return advertisedAddress; } else { List<InetSocketAddress> addrs = myAddresses(); List<String> strAddrs = new ArrayList<String>(addrs.size()); for (final InetSocketAddress addr : addrs) { strAddrs.add(SocketUtil.format(addr, IANA_SSH_PORT)); } return strAddrs; } }
Source:
public RawAndDeserializedValue<V> getWithBinary(final K key) { try { final byte[] serializedValue = wrapped().get(keyBytes(key)); return new RawAndDeserializedValue<V>(serializedValue, maybeMeasureLatency(() -> outerValue(serializedValue), time, getSensor)); } catch (final ProcessorStateException e) { final String message = String.format(e.getMessage(), key); throw new ProcessorStateException(message, e); } }

Target:
public RawAndDeserializedValue<V> getWithBinary(final K key) { try { return maybeMeasureLatency(() -> { final byte[] serializedValue = wrapped().get(keyBytes(key)); return new RawAndDeserializedValue<V>(serializedValue, outerValue(serializedValue)); }, time, getSensor); } catch (final ProcessorStateException e) { final String message = String.format(e.getMessage(), key); throw new ProcessorStateException(message, e); } }
Source:
public void setOnCameraChangeListener(OnCameraChangeListener onCameraChangeListener) { if (isInitialized()) { mMapInterface.setOnCameraChangeListener(onCameraChangeListener); } }

Target:
public void setOnCameraChangeListener(OnCameraChangeListener onCameraChangeListener) { mOnCameraChangeListener = onCameraChangeListener; }
Source:
public void onReceive(final Object message) throws Exception { final Class<?> klass = message.getClass(); final ActorRef self = self(); final ActorRef sender = sender(); if (message instanceof SipServletRequest) { final SipServletRequest request = (SipServletRequest) message; final String method = request.getMethod(); if ("INVITE".equalsIgnoreCase(method)) { check(request); if (request.getContentType().equals("application/vnd.3gpp.ussd+xml")) { invite(request); } else { final SipServletResponse response = request.createResponse(SC_NOT_FOUND); response.send(); } } else if ("INFO".equalsIgnoreCase(method)) { processRequest(request); } else if ("ACK".equalsIgnoreCase(method)) { processRequest(request); } else if ("BYE".equalsIgnoreCase(method)) { processRequest(request); } else if ("CANCEL".equalsIgnoreCase(method)) { processRequest(request); } } else if (message instanceof SipServletResponse) { response(message); } else if (CreateCall.class.equals(klass)) { try { this.createCallRequest = (CreateCall) message; sender.tell(new CallManagerResponse<ActorRef>(outbound(message)), self); } catch (final Exception exception) { sender.tell(new CallManagerResponse<ActorRef>(exception), self); } } else if (ExecuteCallScript.class.equals(klass)) { execute(message); } }

Target:
public void onReceive(final Object message) throws Exception { final Class<?> klass = message.getClass(); final ActorRef self = self(); final ActorRef sender = sender(); if (message instanceof SipServletRequest) { final SipServletRequest request = (SipServletRequest) message; final String method = request.getMethod(); if ("INVITE".equalsIgnoreCase(method)) { check(request); invite(request); } else if ("INFO".equalsIgnoreCase(method)) { processRequest(request); } else if ("ACK".equalsIgnoreCase(method)) { processRequest(request); } else if ("BYE".equalsIgnoreCase(method)) { processRequest(request); } else if ("CANCEL".equalsIgnoreCase(method)) { processRequest(request); } } else if (message instanceof SipServletResponse) { response(message); } else if (CreateCall.class.equals(klass)) { try { this.createCallRequest = (CreateCall) message; sender.tell(new CallManagerResponse<ActorRef>(outbound(message)), self); } catch (final Exception exception) { sender.tell(new CallManagerResponse<ActorRef>(exception), self); } } else if (ExecuteCallScript.class.equals(klass)) { execute(message); } }
Source:
public static SimpleReact lazy(ExecutorService executor){ return new SimpleReact(false); }

Target:
public static SimpleReact lazy(ExecutorService executor){ return new SimpleReact(executor,false); }
Source:
public void deleteSuccess() throws Exception { context.turnOffAuthorisationSystem(); MetadataSchema metadataSchema = MetadataSchemaBuilder.createMetadataSchema(context, "ATest", "A namespace") .build(); getClient().perform(get("/api/core/metadataschemas/" + metadataSchema.getID())) .andExpect(status().isOk()); getClient(getAuthToken(admin.getEmail(), password)) .perform(delete("/api/core/metadataschemas/" + metadataSchema.getID())) .andExpect(status().isNoContent()); getClient().perform(get("/api/core/metadataschemas/" + metadataSchema.getID())) .andExpect(status().isNotFound()); }

Target:
public void deleteSuccess() throws Exception { context.turnOffAuthorisationSystem(); MetadataSchema metadataSchema = MetadataSchemaBuilder.createMetadataSchema(context, "ATest", "A namespace") .build(); context.restoreAuthSystemState(); getClient().perform(get("/api/core/metadataschemas/" + metadataSchema.getID())) .andExpect(status().isOk()); getClient(getAuthToken(admin.getEmail(), password)) .perform(delete("/api/core/metadataschemas/" + metadataSchema.getID())) .andExpect(status().isNoContent()); getClient().perform(get("/api/core/metadataschemas/" + metadataSchema.getID())) .andExpect(status().isNotFound()); }
Source:
public Cluster() { migrateOnError = MigrateOnErrorOptions.YES; name = ""; virtService = true; optimizationType = OptimizationType.NONE; additionalRngSources = new HashSet<>(); fencingPolicy = new FencingPolicy(); addtionalFeaturesSupported = new HashSet<>(); ksmMergeAcrossNumaNodes = true; migrationBandwidthLimitType = MigrationBandwidthLimitType.DEFAULT; requiredSwitchTypeForCluster = SwitchType.LEGACY; logMaxMemoryUsedThresholdType = LogMaxMemoryUsedThresholdType.PERCENTAGE; description = ""; comment = ""; cpuName = ""; vncEncryptionEnabled = true; maintenanceReasonRequired = true; optionalReasonRequired = true; }

Target:
public Cluster() { migrateOnError = MigrateOnErrorOptions.YES; name = ""; virtService = true; optimizationType = OptimizationType.NONE; additionalRngSources = new HashSet<>(); fencingPolicy = new FencingPolicy(); addtionalFeaturesSupported = new HashSet<>(); ksmMergeAcrossNumaNodes = true; migrationBandwidthLimitType = MigrationBandwidthLimitType.DEFAULT; requiredSwitchTypeForCluster = SwitchType.LEGACY; logMaxMemoryUsedThresholdType = LogMaxMemoryUsedThresholdType.PERCENTAGE; description = ""; comment = ""; cpuName = ""; vncEncryptionEnabled = true; }
Source:
public void should_generate_next_date_correctly_on_the_day_when_time_changes_to_standard() { LocalDate currentDate = LocalDate.of(2020, 3, 29); LocalDate nextDay = currentDate.plusDays(1); assertThat(new Daily(ROME, HOUR_2).getNextExecutionTime(complete(instant(currentDate, HOUR_0, UTC))), is(instant(currentDate, HOUR_1, UTC))); assertThat(new Daily(ROME, HOUR_3).getNextExecutionTime(complete(instant(currentDate, HOUR_0, UTC))), is(instant(currentDate, HOUR_1, UTC))); }

Target:
public void should_generate_next_date_correctly_on_the_day_when_time_changes_to_standard() { LocalDate currentDate = LocalDate.of(2020, 10, 25); LocalDate previousDay = currentDate.minusDays(1); assertThat(new Daily(ROME, HOUR_2).getNextExecutionTime(complete(instant(previousDay, HOUR_23, UTC))), is(instant(currentDate, HOUR_0, UTC))); assertThat(new Daily(ROME, HOUR_3).getNextExecutionTime(complete(instant(currentDate, HOUR_0, UTC))), is(instant(currentDate, HOUR_2, UTC))); }
Source:
public void verify(PublicKey key, Provider sigProvider) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, SignatureException { verifyInternal(key, sigProvider); }

Target:
public void verify(PublicKey key, Provider sigProvider) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, SignatureException { if (key instanceof OpenSSLKeyHolder && sigProvider instanceof OpenSSLProvider) { OpenSSLKey pkey = ((OpenSSLKeyHolder) key).getOpenSSLKey(); verifyOpenSSL(pkey); return; } final Signature sig; if (sigProvider == null) { sig = Signature.getInstance(getSigAlgName()); } else { sig = Signature.getInstance(getSigAlgName(), sigProvider); } sig.initVerify(key); sig.update(getTBSCertificate()); if (!sig.verify(getSignature())) { throw new SignatureException("signature did not verify"); } }
Source:
public synchronized Set<RemoteTask> scheduleSplits(Node node, Multimap<PlanNodeId, Split> splits, Multimap<PlanNodeId, Lifespan> noMoreSplitsNotification) { requireNonNull(node, "node is null"); requireNonNull(splits, "splits is null"); splitsScheduled.set(true); checkArgument(stateMachine.getFragment().getPartitionedSources().containsAll(splits.keySet()), "Invalid splits"); ImmutableSet.Builder<RemoteTask> newTasks = ImmutableSet.builder(); Collection<RemoteTask> tasks = this.tasks.get(node); RemoteTask task; if (tasks == null) { TaskId taskId = new TaskId(stateMachine.getStageId(), nextTaskId.getAndIncrement()); task = scheduleTask(node, taskId, splits, -1, -1); newTasks.add(task); } else { task = tasks.iterator().next(); task.addSplits(splits); } if (noMoreSplitsNotification.size() > 1) { throw new UnsupportedOperationException("This assumption no longer holds: noMoreSplitsNotification.size() < 1"); } for (Entry<PlanNodeId, Lifespan> entry : noMoreSplitsNotification.entries()) { task.noMoreSplits(entry.getKey(), entry.getValue()); } return newTasks.build(); }

Target:
public synchronized Set<RemoteTask> scheduleSplits(Node node, Multimap<PlanNodeId, Split> splits, Multimap<PlanNodeId, Lifespan> noMoreSplitsNotification) { requireNonNull(node, "node is null"); requireNonNull(splits, "splits is null"); splitsScheduled.set(true); checkArgument(stateMachine.getFragment().getPartitionedSources().containsAll(splits.keySet()), "Invalid splits"); ImmutableSet.Builder<RemoteTask> newTasks = ImmutableSet.builder(); Collection<RemoteTask> tasks = this.tasks.get(node); RemoteTask task; if (tasks == null) { TaskId taskId = new TaskId(stateMachine.getStageId(), nextTaskId.getAndIncrement()); task = scheduleTask(node, taskId, splits, OptionalInt.empty()); newTasks.add(task); } else { task = tasks.iterator().next(); task.addSplits(splits); } if (noMoreSplitsNotification.size() > 1) { throw new UnsupportedOperationException("This assumption no longer holds: noMoreSplitsNotification.size() < 1"); } for (Entry<PlanNodeId, Lifespan> entry : noMoreSplitsNotification.entries()) { task.noMoreSplits(entry.getKey(), entry.getValue()); } return newTasks.build(); }
Source:
private String parseResultMap(Method method) { Class<?> returnType = getReturnType(method); ConstructorArgs args = method.getAnnotation(ConstructorArgs.class); Arg arg = method.getAnnotation(Arg.class); Results results = method.getAnnotation(Results.class); Result result = method.getAnnotation(Result.class); TypeDiscriminator typeDiscriminator = method.getAnnotation(TypeDiscriminator.class); String resultMapId = generateResultMapName(method); applyResultMap(resultMapId, returnType, argsIf(args, arg, method), resultsIf(results, result, method), typeDiscriminator); return resultMapId; }

Target:
private String parseResultMap(Method method) { Class<?> returnType = getReturnType(method); Arg[] args = method.getAnnotationsByType(Arg.class); Result[] results = method.getAnnotationsByType(Result.class); TypeDiscriminator typeDiscriminator = method.getAnnotation(TypeDiscriminator.class); String resultMapId = generateResultMapName(method); applyResultMap(resultMapId, returnType, args, results, typeDiscriminator); return resultMapId; }
Source:
protected boolean executeAnalysis(IProgressMonitor monitor) throws TmfAnalysisException { IKernelTrace trace = checkNotNull((IKernelTrace) getTrace()); IKernelAnalysisEventLayout layout = trace.getKernelEventLayout(); String dir = TmfTraceManager.getSupplementaryFileDir(trace); final Path file = Paths.get(dir, DATA_FILENAME); if (Files.exists(file)) { System.out.println("re-read existing file!"); try (ObjectInputStream ois = new ObjectInputStream(Files.newInputStream(file))) { @SuppressWarnings("unchecked") ISegmentStore<ISegment> syscalls = (ISegmentStore<ISegment>) ois.readObject(); fSystemCalls = syscalls; System.out.println(syscalls.getNbElements() + " syscalls"); return true; } catch (IOException | ClassNotFoundException | ClassCastException e) { try { Files.delete(file); } catch (IOException e1) { } } } ISegmentStore<ISegment> syscalls = new TreeMapStore<>(); ITmfEventRequest req = new LatencyAnalysisRequest(layout, syscalls); trace.sendRequest(req); try { req.waitForCompletion(); } catch (InterruptedException e) { } fSystemCalls = syscalls; System.out.println(syscalls.getNbElements() + " syscalls"); try (ObjectOutputStream oos = new ObjectOutputStream(Files.newOutputStream(file))) { System.out.println("writing new file!"); oos.writeObject(syscalls); } catch (IOException e) { } for (LatencyAnalysisListener listener : fListeners) { listener.onComplete(syscalls); } return true; }

Target:
protected boolean executeAnalysis(IProgressMonitor monitor) throws TmfAnalysisException { IKernelTrace trace = checkNotNull((IKernelTrace) getTrace()); IKernelAnalysisEventLayout layout = trace.getKernelEventLayout(); String dir = TmfTraceManager.getSupplementaryFileDir(trace); final Path file = Paths.get(dir, DATA_FILENAME); if (Files.exists(file)) { try (ObjectInputStream ois = new ObjectInputStream(Files.newInputStream(file))) { @SuppressWarnings("unchecked") ISegmentStore<ISegment> syscalls = (ISegmentStore<ISegment>) ois.readObject(); fSystemCalls = syscalls; return true; } catch (IOException | ClassNotFoundException | ClassCastException e) { try { Files.delete(file); } catch (IOException e1) { } } } ISegmentStore<ISegment> syscalls = new TreeMapStore<>(); ITmfEventRequest req = new LatencyAnalysisRequest(layout, syscalls); trace.sendRequest(req); try { req.waitForCompletion(); } catch (InterruptedException e) { } fSystemCalls = syscalls; try (ObjectOutputStream oos = new ObjectOutputStream(Files.newOutputStream(file))) { oos.writeObject(syscalls); } catch (IOException e) { } for (LatencyAnalysisListener listener : fListeners) { listener.onComplete(syscalls); } return true; }
Source:
public boolean isDocumentPending(@NonNull String docId) throws CouchbaseLiteException { Preconditions.checkArgNotNull(docId, "document ID"); if (config.getReplicatorType().equals(ReplicatorConfiguration.ReplicatorType.PULL)) { throw new CouchbaseLiteException( "Pending Document IDs are not supported on pull-only replicators.", Log.LOGGING_DOMAINS_TO_C4.get(DOMAIN), CBLError.Code.UNSUPPORTED); } final C4Replicator repl; synchronized (lock) { repl = c4repl; } if (repl == null) { Log.i(DOMAIN, "%s: Call to isDocumentPending with unstarted replicator", this); return false; } try { return c4repl.isDocumentPending(docId); } catch (LiteCoreException e) { Log.w(DOMAIN, "Error while fetching pending documentIds: %d/%d", e.domain, e.code); } return false; }

Target:
public boolean isDocumentPending(@NonNull String docId) throws CouchbaseLiteException { Preconditions.checkArgNotNull(docId, "document ID"); if (config.getReplicatorType().equals(ReplicatorConfiguration.ReplicatorType.PULL)) { throw new CouchbaseLiteException( "Pending Document IDs are not supported on pull-only replicators.", Log.LOGGING_DOMAINS_TO_C4.get(DOMAIN), CBLError.Code.UNSUPPORTED); } final C4Replicator repl; synchronized (lock) { repl = c4repl; } if (repl == null) { Log.i(DOMAIN, "%s: Call to isDocumentPending with unstarted replicator", this); return false; } try { return c4repl.isDocumentPending(docId); } catch (LiteCoreException e) { throw CBLStatus.convertException(e, "Failed getting document pending status"); } }