auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void addInputClauseRequirement(final QName typeRef, final Definitions definitions, final List<InputClauseRequirement> inputClauseRequirements, final String text) { for (BuiltInType bi : BuiltInType.values()) { for (String biName : bi.getNames()) { if (biName.equals(typeRef.getLocalPart())) { inputClauseRequirements.add(new InputClauseRequirement(text, typeRef)); return; } } } final Optional<ItemDefinition> oItemDefinition = definitions.getItemDefinition() .stream() .filter(itemDef -> itemDef.getName().getValue().equals(typeRef.getLocalPart())) .findFirst(); oItemDefinition.ifPresent(itemDefinition -> { if (itemDefinition.getItemComponent().size() == 0) { inputClauseRequirements.add(new InputClauseRequirement(text, itemDefinition.getTypeRef())); } else { itemDefinition.getItemComponent() .forEach(itemDefinitionComponent -> addInputClauseRequirement(itemDefinitionComponent.getTypeRef(), definitions, inputClauseRequirements, text + "." + itemDefinitionComponent.getName().getValue())); } }); }

Target:
private void addInputClauseRequirement(final QName typeRef, final Definitions definitions, final List<InputClauseRequirement> inputClauseRequirements, final String text) { for (BuiltInType bi : BuiltInType.values()) { for (String biName : bi.getNames()) { if (Objects.equals(biName, typeRef.getLocalPart())) { inputClauseRequirements.add(new InputClauseRequirement(text, typeRef)); return; } } } definitions.getItemDefinition() .stream() .filter(itemDef -> itemDef.getName().getValue().equals(typeRef.getLocalPart())) .findFirst() .ifPresent(itemDefinition -> { if (itemDefinition.getItemComponent().size() == 0) { inputClauseRequirements.add(new InputClauseRequirement(text, itemDefinition.getTypeRef())); } else { itemDefinition.getItemComponent() .forEach(itemComponent -> { if (!Objects.equals(itemDefinition.getName().getValue(), itemComponent.getTypeRef().getLocalPart())) { addInputClauseRequirement(itemComponent.getTypeRef(), definitions, inputClauseRequirements, text + "." + itemComponent.getName().getValue()); } else { inputClauseRequirements.add(new InputClauseRequirement(text + "." + itemComponent.getName().getValue(), itemComponent.getTypeRef())); } }); } }); }
Source:
public ListenableFuture<?> execute( SetPath statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Session session = stateMachine.getSession(); SqlPath sqlPath = new SqlPath(Optional.of(statement.getPathSpecification().toString())); List<SqlPathElement> path = sqlPath.getParsedPath(); for (SqlPathElement element : path) { if (!element.getCatalog().isPresent() && !session.getCatalog().isPresent()) { throw new SemanticException(CATALOG_NOT_SPECIFIED, statement, "Catalog must be specified for each path element when session catalog is not set"); } element.getCatalog().ifPresent(catalog -> { String catalogName = catalog.getValue().toLowerCase(ENGLISH); if (!metadata.getCatalogHandle(session, catalogName).isPresent()) { throw new PrestoException(NOT_FOUND, "Catalog does not exist: " + catalogName); } }); } stateMachine.setSetPath(sqlPath.toString()); return immediateFuture(null); }

Target:
public ListenableFuture<?> execute( SetPath statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Session session = stateMachine.getSession(); if (!session.getClientCapabilities().contains(ClientCapabilities.PATH.toString())) { throw new PrestoException(NOT_SUPPORTED, "SET PATH not supported by client"); } SqlPath sqlPath = new SqlPath(Optional.of(statement.getPathSpecification().toString())); for (SqlPathElement element : sqlPath.getParsedPath()) { if (!element.getCatalog().isPresent() && !session.getCatalog().isPresent()) { throw new SemanticException(CATALOG_NOT_SPECIFIED, statement, "Catalog must be specified for each path element when session catalog is not set"); } element.getCatalog().ifPresent(catalog -> { String catalogName = catalog.getValue().toLowerCase(ENGLISH); if (!metadata.getCatalogHandle(session, catalogName).isPresent()) { throw new PrestoException(NOT_FOUND, "Catalog does not exist: " + catalogName); } }); } stateMachine.setSetPath(sqlPath.toString()); return immediateFuture(null); }
Source:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { removeTimedOutStreams(); String streamId = StringUtils.substringBefore(StringUtils.substringAfterLast(req.getRequestURI(), "/"), "."); boolean multiAccess = false; AudioStream stream = oneTimeStreams.remove(streamId); if (stream == null) { stream = multiTimeStreams.get(streamId); if (stream != null) { multiAccess = true; } } if (stream == null) { logger.debug("Received request for invalid stream id at {}", req.getRequestURI()); resp.sendError(HttpServletResponse.SC_NOT_FOUND); } else { logger.debug("Stream to serve is {}", streamId); String mimeType = null; if (stream.getFormat().getCodec() == AudioFormat.CODEC_MP3) { mimeType = "audio/mpeg"; } else if (stream.getFormat().getContainer() == AudioFormat.CONTAINER_WAVE) { mimeType = "audio/wav"; } else if (stream.getFormat().getContainer() == AudioFormat.CONTAINER_OGG) { mimeType = "audio/ogg"; } if (mimeType != null) { resp.setContentType(mimeType); } if (stream instanceof FixedLengthAudioStream) { Long size = ((FixedLengthAudioStream) stream).length(); if (size != null) { resp.setContentLength(size.intValue()); } } ServletOutputStream os = resp.getOutputStream(); InputStream is = null; if (multiAccess) { try { is = ((FixedLengthAudioStream) stream).getClonedStream(); } catch (AudioException e) { resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); } } else { is = stream; } IOUtils.copy(is, os); resp.flushBuffer(); IOUtils.closeQuietly(stream); } }

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { removeTimedOutStreams(); String streamId = StringUtils.substringBefore(StringUtils.substringAfterLast(req.getRequestURI(), "/"), "."); boolean multiAccess = false; AudioStream stream = oneTimeStreams.remove(streamId); if (stream == null) { stream = multiTimeStreams.get(streamId); if (stream != null) { multiAccess = true; } } if (stream == null) { logger.debug("Received request for invalid stream id at {}", req.getRequestURI()); resp.sendError(HttpServletResponse.SC_NOT_FOUND); } else { logger.debug("Stream to serve is {}", streamId); String mimeType = null; if (stream.getFormat().getCodec() == AudioFormat.CODEC_MP3) { mimeType = "audio/mpeg"; } else if (stream.getFormat().getContainer() == AudioFormat.CONTAINER_WAVE) { mimeType = "audio/wav"; } else if (stream.getFormat().getContainer() == AudioFormat.CONTAINER_OGG) { mimeType = "audio/ogg"; } if (mimeType != null) { resp.setContentType(mimeType); } if (stream instanceof FixedLengthAudioStream) { Long size = ((FixedLengthAudioStream) stream).length(); if (size != null) { resp.setContentLength(size.intValue()); } } ServletOutputStream os = resp.getOutputStream(); InputStream is = null; if (multiAccess) { try { is = ((FixedLengthAudioStream) stream).getClonedStream(); } catch (AudioException e) { resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); } } else { is = stream; } IOUtils.copy(is, os); resp.flushBuffer(); IOUtils.closeQuietly(is); } }
Source:
private ExportResult exportToClipboard(Exporter exporter) throws Exception { Globals.prefs.fileDirForDatabase = panel.getBibDatabaseContext().getFileDirectoriesAsPaths(Globals.prefs.getFilePreferences()).stream().map(Path::toString).collect(Collectors.toList()); Globals.prefs.put(JabRefPreferences.LAST_USED_EXPORT, exporter.getName()); Path tmp = null; try { tmp = Files.createTempFile("jabrefCb", ".tmp"); entries.addAll(panel.getSelectedEntries()); exporter.export(panel.getBibDatabaseContext(), tmp, panel.getBibDatabaseContext() .getMetaData() .getEncoding() .orElse(Globals.prefs.getDefaultEncoding()), entries); return new ExportResult(readFileToString(tmp), exporter.getFileType()); } catch (Exception e) { LOGGER.error("Error exporting to clipboard", e); } finally { if ((tmp != null) && Files.exists(tmp)) { try { Files.delete(tmp); } catch (IOException e) { LOGGER.info("Cannot delete temporary clipboard file", e); } } } throw new Exception("export failed."); }

Target:
private ExportResult exportToClipboard(Exporter exporter) throws Exception { Globals.prefs.fileDirForDatabase = panel.getBibDatabaseContext().getFileDirectoriesAsPaths(Globals.prefs.getFilePreferences()).stream().map(Path::toString).collect(Collectors.toList()); Globals.prefs.put(JabRefPreferences.LAST_USED_EXPORT, exporter.getName()); Path tmp = null; try { tmp = Files.createTempFile("jabrefCb", ".tmp"); entries.addAll(panel.getSelectedEntries()); exporter.export(panel.getBibDatabaseContext(), tmp, panel.getBibDatabaseContext() .getMetaData() .getEncoding() .orElse(Globals.prefs.getDefaultEncoding()), entries); return new ExportResult(readFileToString(tmp), exporter.getFileType()); } catch (Exception e) { LOGGER.error("Error exporting to clipboard", e); throw new Exception("Rethrow ", e); } finally { if ((tmp != null) && Files.exists(tmp)) { try { Files.delete(tmp); } catch (IOException e) { LOGGER.info("Cannot delete temporary clipboard file", e); } } } }
Source:
public void run() { dataLakeFileClient.uploadFromFile(TEMP_FILE.toString(), true); }

Target:
public void run() { dataLakeFileClient.uploadFromFile(TEMP_FILE_PATH, true); }
Source:
private static void refreshPolicy(Policy policy) throws IOException { String policyString = "grant { permission java.security.AllPermission; };"; File policyFile = File.createTempFile("oxy_policy", ".txt"); try { try (OutputStream fos = java.nio.file.Files.newOutputStream(policyFile.toPath())) { fos.write(policyString.getBytes("UTF-8")); } System.setProperty("java.security.policy", policyFile.toURI().toURL().toString()); policy.refresh(); } finally { try { java.nio.file.Files.delete(policyFile.toPath()); } catch (IOException e) { e.printStackTrace(); } } }

Target:
private static void refreshPolicy(Policy policy) throws IOException { String policyString = "grant { permission java.security.AllPermission; };"; File policyFile = File.createTempFile("oxy_policy", ".txt"); try (OutputStream fos = java.nio.file.Files .newOutputStream(policyFile.toPath())) { fos.write(policyString.getBytes("UTF-8")); } System.setProperty("java.security.policy", policyFile.toURI().toURL().toString()); policy.refresh(); }
Source:
public ResultInterface executeQuery(int maxrows, boolean scrollable) { startTimeNanos = 0; long start = 0; Database database = session.getDatabase(); Object sync = database.isMultiThreaded() || database.getMvStore() != null ? session : database; session.waitIfExclusiveModeEnabled(); boolean callStop = true; boolean writing = !isReadOnly(); if (writing) { while (!database.beforeWriting()) { } } session.startStatementWithinTransaction(); session.setCurrentCommand(this, false); try { while (true) { database.checkPowerOff(); try { ResultInterface result; synchronized (sync) { result = query(maxrows); } callStop = !result.isLazy(); return result; } catch (DbException e) { start = filterConcurrentUpdate(e, start); } catch (OutOfMemoryError e) { callStop = false; database.shutdownImmediately(); throw DbException.convert(e); } catch (Throwable e) { throw DbException.convert(e); } } } catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql); if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) { callStop = false; database.shutdownImmediately(); throw e; } database.checkPowerOff(); throw e; } finally { if (callStop) { stop(); } if (writing) { database.afterWriting(); } } }

Target:
public ResultInterface executeQuery(int maxrows, boolean scrollable) { startTimeNanos = 0; long start = 0; Database database = session.getDatabase(); Object sync = database.isMultiThreaded() || database.getMvStore() != null ? session : database; session.waitIfExclusiveModeEnabled(); boolean callStop = true; boolean writing = !isReadOnly(); if (writing) { while (!database.beforeWriting()) { } } synchronized (sync) { session.startStatementWithinTransaction(); session.setCurrentCommand(this, false); try { while (true) { database.checkPowerOff(); try { ResultInterface result = query(maxrows); callStop = !result.isLazy(); return result; } catch (DbException e) { start = filterConcurrentUpdate(e, start); } catch (OutOfMemoryError e) { callStop = false; database.shutdownImmediately(); throw DbException.convert(e); } catch (Throwable e) { throw DbException.convert(e); } } } catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql); if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) { callStop = false; database.shutdownImmediately(); throw e; } database.checkPowerOff(); throw e; } finally { if (callStop) { stop(); } if (writing) { database.afterWriting(); } } } }
Source:
private static TupleDomain<ColumnHandle> fixedValueTupleDomain(TpchMetadata tpchMetadata, TpchColumn<?> column1, Object value1, TpchColumn<?> column2, Object value2) { requireNonNull(column1, "column1 is null"); requireNonNull(column2, "column2 is null"); requireNonNull(value1, "value1 is null"); requireNonNull(value2, "value2 is null"); return TupleDomain.fromFixedValues( ImmutableMap.of( tpchMetadata.toColumnHandle(column1), new NullableValue(getPrestoType(column1), value1), tpchMetadata.toColumnHandle(column2), new NullableValue(getPrestoType(column2), value2))); }

Target:
private static TupleDomain<ColumnHandle> fixedValueTupleDomain(TpchMetadata tpchMetadata, TpchColumn<?> column1, Object value1, TpchColumn<?> column2, Object value2) { return TupleDomain.fromFixedValues( ImmutableMap.of( tpchMetadata.toColumnHandle(column1), new NullableValue(getPrestoType(column1), value1), tpchMetadata.toColumnHandle(column2), new NullableValue(getPrestoType(column2), value2))); }
Source:
protected static boolean canAttachPrestartedVmToUser(Guid vmId) { boolean returnValue = !vmAssignedToUser(vmId, new java.util.ArrayList<String>()); returnValue = returnValue && vmIsRunningStateless(vmId); return returnValue; }

Target:
protected static boolean canAttachPrestartedVmToUser(Guid vmId) { return !vmAssignedToUser(vmId, new ArrayList<String>()) && vmIsRunningStateless(vmId); }
Source:
private void openHelp() { final String helpWeb = (String) getText(R.string.url_help); if (helpWeb != null && helpWeb.length() > 0) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(helpWeb)); startActivity(intent); } }

Target:
private void openHelp() { final String helpWeb = (String) getText(R.string.url_help); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(helpWeb)); startActivity(intent); }
Source:
public void doQuery(List<ITmfStateInterval> stateInfo, long t) throws TimeRangeException, StateSystemDisposedException { checkValidTime(t); LinkedList<HTNode> queue = new LinkedList<>(); queue.add(fSht.getRootNode()); try { while (!queue.isEmpty()) { HTNode currentNode = queue.pop(); if ((currentNode.getNodeType() == HTNode.NodeType.CORE)) { queue.addAll(fSht.selectNextChildren((CoreNode) currentNode, t)); } currentNode.writeInfoFromNode(stateInfo, t); } } catch (ClosedChannelException e) { throw new StateSystemDisposedException(e); } }

Target:
public void doQuery(List<ITmfStateInterval> stateInfo, long t) throws TimeRangeException, StateSystemDisposedException { checkValidTime(t); Deque<HTNode> queue = new LinkedList<>(); queue.add(fSht.getRootNode()); try { while (!queue.isEmpty()) { HTNode currentNode = queue.pop(); if ((currentNode.getNodeType() == HTNode.NodeType.CORE)) { queue.addAll(fSht.selectNextChildren((CoreNode) currentNode, t)); } currentNode.writeInfoFromNode(stateInfo, t); } } catch (ClosedChannelException e) { throw new StateSystemDisposedException(e); } }
Source:
private URI addCookieInterceptorIfRequired(URI uri) { String uriProtocol = uri.getScheme(); String uriHost = uri.getHost(); String uriPath = uri.getRawPath(); int uriPort = uri.getPort(); if ("http".equals(uriProtocol)) { uriPort = uriPort < 0 ? 80 : uriPort; } else if ("https".equals(uriProtocol)) { uriPort = uriPort < 0 ? 443 : uriPort; } else { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "Protocol %s not supported", uriProtocol)); } if (uri.getUserInfo() != null && this.username == null && this.password == null) { String[] parts = uri.getUserInfo().split(":"); this.username = parts[0]; this.password = parts[1]; } if(this.username == null && this.password == null){ return uri; } try { String path = uriPath == null ? "" : uriPath; if(path.length() > 0) { int index = path.lastIndexOf("/"); if (index == path.length() - 1) { path = path.substring(0, index); index = path.lastIndexOf("/"); } path = path.substring(0, index); } URI baseURI = new URI(uriProtocol, null, uriHost, uriPort, path, null, null); CookieInterceptor ci = new CookieInterceptor(username, password, baseURI.toString()); requestInterceptors.add(ci); responseInterceptors.add(ci); } catch (URISyntaxException e) { throw new RuntimeException(e); } try { return new URI(uriProtocol + "://" + uriHost + ":" + uriPort + (uriPath != null ? uriPath : "")); } catch (URISyntaxException use) { throw new RuntimeException("Failed to construct URI", use); } }

Target:
private URI addCookieInterceptorIfRequired(URI uri) { String uriProtocol = uri.getScheme(); String uriHost = uri.getHost(); String uriPath = uri.getRawPath(); int uriPort = uri.getPort(); if ("http".equals(uriProtocol)) { uriPort = uriPort < 0 ? 80 : uriPort; } else if ("https".equals(uriProtocol)) { uriPort = uriPort < 0 ? 443 : uriPort; } else { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "Protocol %s not supported", uriProtocol)); } if (uri.getUserInfo() != null && this.username == null && this.password == null) { String[] parts = uri.getUserInfo().split(":"); if (parts.length == 2) { this.username = parts[0]; this.password = parts[1]; } } if(this.username == null && this.password == null){ return uri; } try { String path = uriPath == null ? "" : uriPath; if(path.length() > 0) { int index = path.lastIndexOf("/"); if (index == path.length() - 1) { path = path.substring(0, index); index = path.lastIndexOf("/"); } path = path.substring(0, index); } URI baseURI = new URI(uriProtocol, null, uriHost, uriPort, path, null, null); CookieInterceptor ci = new CookieInterceptor(username, password, baseURI.toString()); requestInterceptors.add(ci); responseInterceptors.add(ci); } catch (URISyntaxException e) { throw new RuntimeException(e); } try { return new URI(uriProtocol + "://" + uriHost + ":" + uriPort + (uriPath != null ? uriPath : "")); } catch (URISyntaxException use) { throw new RuntimeException("Failed to construct URI", use); } }
Source:
public void testHetSensTargeted(final double expected, final File metricsFile) throws Exception { final double tolerance = 0.000_000_01; final MetricsFile Metrics = new MetricsFile(); Metrics.read(new FileReader(metricsFile)); final List<Histogram<Integer>> histograms = Metrics.getAllHistograms(); final Histogram<Integer> depthHistogram = histograms.get(0); final Histogram<Integer> qualityHistogram = histograms.get(1); final double[] depthDistribution = TheoreticalSensitivity.normalizeHistogram(depthHistogram); final double[] qualityDistribution = TheoreticalSensitivity.normalizeHistogram(qualityHistogram); final int sampleSize = 1_000; final double logOddsThreshold = 3.0; final double result = TheoreticalSensitivity.hetSNPSensitivity(depthDistribution, qualityDistribution, sampleSize, logOddsThreshold); Assert.assertEquals(result, expected, tolerance); }

Target:
public void testHetSensTargeted(final double expected, final File metricsFile) throws Exception { final double tolerance = 0.000_000_01; final MetricsFile metrics = new MetricsFile(); try (final FileReader metricsFileReader = new FileReader(metricsFile)) { metrics.read(metricsFileReader); } final List<Histogram<Integer>> histograms = metrics.getAllHistograms(); final Histogram<Integer> depthHistogram = histograms.get(0); final Histogram<Integer> qualityHistogram = histograms.get(1); final double[] depthDistribution = TheoreticalSensitivity.normalizeHistogram(depthHistogram); final double[] qualityDistribution = TheoreticalSensitivity.normalizeHistogram(qualityHistogram); final int sampleSize = 1_000; final double logOddsThreshold = 3.0; final double result = TheoreticalSensitivity.hetSNPSensitivity(depthDistribution, qualityDistribution, sampleSize, logOddsThreshold); Assert.assertEquals(result, expected, tolerance); }
Source:
private void handleErrors() throws StageException { for (ServerException e : serverErrors) { throw new StageException(Errors.MYSQL_006, e.getMessage(), e); } }

Target:
private void handleErrors() throws StageException { for (ServerException e : serverErrors) { LOG.error("BinaryLogClient server error: {}", e.getMessage(), e); } ServerException e = serverErrors.poll(); if (e != null) { throw new StageException(Errors.MYSQL_006, e.getMessage(), e); } }
Source:
TestTemplateInvocationTestDescriptor(UniqueId uniqueId, Class<?> testClass, Method templateMethod, TestTemplateInvocationContext invocationContext, int index, JupiterConfiguration configuration) { super(uniqueId, invocationContext.getDisplayName(index), testClass, templateMethod, configuration, INTERCEPTOR_CALL); this.invocationContext = invocationContext; this.index = index; }

Target:
TestTemplateInvocationTestDescriptor(UniqueId uniqueId, Class<?> testClass, Method templateMethod, TestTemplateInvocationContext invocationContext, int index, JupiterConfiguration configuration) { super(uniqueId, invocationContext.getDisplayName(index), testClass, templateMethod, configuration, interceptorCall); this.invocationContext = invocationContext; this.index = index; }
Source:
public JSONObject listProjectsDataTable(HttpSession session, JSONObject json) { try { final JSONObject j = new JSONObject(); final JSONArray jsonArray = new JSONArray(); for (Project project : requestManager.listAllProjects()) { JSONArray inner = new JSONArray(); inner.add(TableHelper.hyperLinkify("/miso/project" + project.getId(), project.getName())); inner.add(TableHelper.hyperLinkify("/miso/project" + project.getId(), project.getAlias())); inner.add(project.getDescription()); inner.add(project.getProgress().getKey()); inner.add(project.getProjectId()); jsonArray.add(inner); } j.put("projectsArray", jsonArray); return j; } catch (final IOException e) { log.debug("Failed", e); return JSONUtils.SimpleJSONError("Failed: " + e.getMessage()); } }

Target:
public JSONObject listProjectsDataTable(HttpSession session, JSONObject json) { try { final JSONObject j = new JSONObject(); final JSONArray jsonArray = new JSONArray(); for (Project project : requestManager.listAllProjects()) { JSONArray inner = new JSONArray(); inner.add(TableHelper.hyperLinkify("/miso/project/" + project.getId(), project.getName())); inner.add(TableHelper.hyperLinkify("/miso/project/" + project.getId(), project.getAlias())); inner.add(project.getDescription()); inner.add(project.getProgress().getKey()); inner.add(project.getProjectId()); jsonArray.add(inner); } j.put("projectsArray", jsonArray); return j; } catch (final IOException e) { log.debug("Failed", e); return JSONUtils.SimpleJSONError("Failed: " + e.getMessage()); } }
Source:
private String getRemoteBranch() { if (params.branch == null) { return GitCloneTemplateParams.DEFAULT_BRANCH; } if (params.branch.indexOf('/') == -1) { return "origin/" + params.branch; } return params.branch; }

Target:
private String getRemoteBranch() { if (params.branch == null) { return GitCloneTemplateParams.DEFAULT_BRANCH; } if (!params.branch.startsWith("origin/")) { return "origin/" + params.branch; } return params.branch; }
Source:
private static List<DatasetStatus> datasetStatusListHelper(final SQLiteStatement statement, final SQLiteConnection connection) throws CatalogException { try { ImmutableList.Builder<DatasetStatus> result = ImmutableList.builder(); while (statement.step()) { RelationKey relationKey = RelationKey.of(statement.columnString(0), statement.columnString(1), statement.columnString(2)); long numTuples = statement.columnLong(3); long queryId = statement.columnLong(4); String created = statement.columnString(5); PartitionFunction howPartitioned; try { howPartitioned = MyriaJsonMapperProvider.getMapper().readValue(statement.columnString(6), PartitionFunction.class); } catch (final IOException e) { LOGGER.debug("Error deserializing howPartitioned for dataset #{}", relationKey.toString(), e); howPartitioned = new UnknownPartitionFunction(null); } result.add(new DatasetStatus(relationKey, getDatasetSchema(connection, relationKey), numTuples, queryId, created, howPartitioned)); } statement.dispose(); return result.build(); } catch (final SQLiteException e) { throw new CatalogException(e); } }

Target:
private static List<DatasetStatus> datasetStatusListHelper(final SQLiteStatement statement, final SQLiteConnection connection) throws CatalogException { try { ImmutableList.Builder<DatasetStatus> result = ImmutableList.builder(); while (statement.step()) { RelationKey relationKey = RelationKey.of(statement.columnString(0), statement.columnString(1), statement.columnString(2)); long numTuples = statement.columnLong(3); long queryId = statement.columnLong(4); String created = statement.columnString(5); HowPartitioned howPartitioned; try { howPartitioned = MyriaJsonMapperProvider.getMapper().readValue(statement.columnString(6), HowPartitioned.class); } catch (final IOException e) { LOGGER.debug("Error deserializing howPartitioned for dataset #{}", relationKey, e); howPartitioned = new HowPartitioned(null, null); } result.add(new DatasetStatus(relationKey, getDatasetSchema(connection, relationKey), numTuples, queryId, created, howPartitioned)); } statement.dispose(); return result.build(); } catch (final SQLiteException e) { throw new CatalogException(e); } }
Source:
public void before_shouldCallHandlerOnSaveMethodNameWithCollectionArgument() throws Throwable { Method m = WithAppropriatelyNamedMethod.class.getMethod("saveSomeOpenmrsDatas", List.class); List<SomeOpenmrsData> openmrsObjects = Arrays.asList(new SomeOpenmrsData(), new SomeOpenmrsData()); requiredDataAdvice.before(m, new Object[] { openmrsObjects }, new WithAppropriatelyNamedMethod()); verify(saveHandler, times(2)).handle(Matchers.<SomeOpenmrsData> anyObject(), Matchers.anyObject(), Matchers.anyObject(), anyString()); }

Target:
public void before_shouldCallHandlerOnSaveMethodNameWithCollectionArgument() throws Throwable { Method m = WithAppropriatelyNamedMethod.class.getMethod("saveSomeOpenmrsDatas", List.class); List<SomeOpenmrsData> openmrsObjects = Arrays.asList(new SomeOpenmrsData(), new SomeOpenmrsData()); requiredDataAdvice.before(m, new Object[] { openmrsObjects }, new WithAppropriatelyNamedMethod()); verify(saveHandler, times(2)).handle(Matchers.anyObject(), Matchers.anyObject(), Matchers.anyObject(), anyString()); }
Source:
public RedisRunner randomDir() { this.randomDir = true; options.remove(REDIS_OPTIONS.DIR); makeRandomDefaultDir(); addConfigOption(REDIS_OPTIONS.DIR, defaultDir); return this; }

Target:
public RedisRunner randomDir() { this.randomDir = true; options.remove(REDIS_OPTIONS.DIR); makeRandomDefaultDir(); addConfigOption(REDIS_OPTIONS.DIR, "\"" + defaultDir + "\""); return this; }
Source:
public Result createSession(HttpClient client, Command command) throws IOException { Capabilities desired = (Capabilities) command.getParameters().get("desiredCapabilities"); desired = desired == null ? new DesiredCapabilities() : desired; Capabilities required = (Capabilities) command.getParameters().get("requiredCapabilities"); required = required == null ? new DesiredCapabilities() : required; String des = new BeanToJsonConverter().convert(desired); String req = new BeanToJsonConverter().convert(required); StringBuilder parameters = new StringBuilder("{"); amendW3CParameters(parameters, des, req); parameters.append(","); amendOssParamters(parameters, des, req); parameters.append("}"); Optional<Result> result = createSession(client, parameters); if (!result.isPresent()) { parameters = new StringBuilder("{"); amendOssParamters(parameters, des, req); parameters.append("}"); result = createSession(client, parameters); } if (!result.isPresent()) { parameters = new StringBuilder("{"); amendW3CParameters(parameters, des, req); parameters.append("}"); result = createSession(client, parameters); } if (result.isPresent()) { Result toReturn = result.get(); return toReturn; } throw new SessionNotCreatedException( String.format( "Unable to create new remote session. " + "desired capabilities = %s, required capabilities = %s", desired, required)); }

Target:
public Result createSession(HttpClient client, Command command) throws IOException, WebDriverException { Capabilities desired = ofNullable((Capabilities) command.getParameters().get("desiredCapabilities")) .orElseGet(DesiredCapabilities::new); Capabilities required = ofNullable((Capabilities) command.getParameters().get("requiredCapabilities")) .orElseGet(DesiredCapabilities::new); JsonParser parser = new JsonParser(); JsonElement des = parser.parse(new BeanToJsonConverter().convert(desired)); JsonElement req = parser.parse(new BeanToJsonConverter().convert(required)); JsonObject jsonObject = new JsonObject(); amendW3CParameters(jsonObject, des, req); amendOssParamters(jsonObject, des, req); Optional<Result> result = createSession(client, jsonObject); return ofNullable(result.orElseGet(() -> { JsonObject jsonObject1 = new JsonObject(); amendOssParamters(jsonObject1, des, req); try { return createSession(client, jsonObject1).orElseGet(() -> { JsonObject jsonObject2 = new JsonObject(); amendW3CParameters(jsonObject2, des, req); try { return createSession(client, jsonObject2).orElse(null); } catch (IOException e) { throw new WebDriverException(e); } }); } catch (IOException e) { throw new WebDriverException(e); } })).orElseThrow(() -> new SessionNotCreatedException( String.format( "Unable to create new remote session. " + "desired capabilities = %s, required capabilities = %s", desired, required))); }
Source:
public static void onRequestPermissionsResult(Activity activity, AirMapInterface airMapInterface, int requestCode, String[] permissions, int[] grantResults) { switch (requestCode) { case LOCATION_PERMISSION_REQUEST_CODE: if (!isRequestedPermission(permissions)) { break; } if (verifyPermissions(grantResults)) { airMapInterface.onLocationPermissionsGranted(); } else if (!shouldShowRequestPermissionRationale(activity, LOCATION_PERMISSIONS)) { airMapInterface.onLocationPermissionsNeverAskAgain(); } else { airMapInterface.onLocationPermissionsDenied(); } break; default: break; } }

Target:
static void onRequestPermissionsResult(Activity activity, AirMapInterface airMapInterface, int requestCode, String[] permissions, int[] grantResults) { switch (requestCode) { case LOCATION_PERMISSION_REQUEST_CODE: if (!isRequestedPermission(permissions)) { break; } if (verifyPermissions(grantResults)) { airMapInterface.onLocationPermissionsGranted(); } else if (!shouldShowRequestPermissionRationale(activity, LOCATION_PERMISSIONS)) { airMapInterface.onLocationPermissionsNeverAskAgain(); } else { airMapInterface.onLocationPermissionsDenied(); } break; default: break; } }
Source:
public PodTemplate(PodTemplate from) throws IOException { this.setAnnotations(from.getAnnotations()); this.setContainers(from.getContainers()); this.setImagePullSecrets(from.getImagePullSecrets()); this.setInstanceCap(from.getInstanceCap()); this.setLabel(from.getLabel()); this.setName(from.getName()); this.setNamespace(from.getNamespace()); this.setInheritFrom(from.getInheritFrom()); this.setNodeSelector(from.getNodeSelector()); this.setNodeUsageMode(from.getNodeUsageMode()); this.setServiceAccount(from.getServiceAccount()); this.setSlaveConnectTimeout(from.getSlaveConnectTimeout()); this.setActiveDeadlineSeconds(from.getActiveDeadlineSeconds()); this.setVolumes(from.getVolumes()); this.setWorkspaceVolume(from.getWorkspaceVolume()); this.setYaml(from.getYaml()); this.setNodeProperties(from.getNodeProperties()); }

Target:
public PodTemplate(PodTemplate from) { this.setAnnotations(from.getAnnotations()); this.setContainers(from.getContainers()); this.setImagePullSecrets(from.getImagePullSecrets()); this.setInstanceCap(from.getInstanceCap()); this.setLabel(from.getLabel()); this.setName(from.getName()); this.setNamespace(from.getNamespace()); this.setInheritFrom(from.getInheritFrom()); this.setNodeSelector(from.getNodeSelector()); this.setNodeUsageMode(from.getNodeUsageMode()); this.setServiceAccount(from.getServiceAccount()); this.setSlaveConnectTimeout(from.getSlaveConnectTimeout()); this.setActiveDeadlineSeconds(from.getActiveDeadlineSeconds()); this.setVolumes(from.getVolumes()); this.setWorkspaceVolume(from.getWorkspaceVolume()); this.setYaml(from.getYaml()); this.setNodeProperties(from.getNodeProperties()); }
Source:
private void distributeDbDownEvent() { firstMatchSimpleFilter.clearFilterEntries(); firstMatchSimpleFilter.addFilterEntries( FirstMatchSimpleFilter.parse(prop.getProperty(NotificationProperties.FILTER)) ); if (failedQueries == 0) { try { firstMatchSimpleFilter.processEvent(eventsManager.createDBDownEvent()); } catch (Exception e) { log.error( String.format("Failed to dispatch %s event", EventsManager.DATABASE_UNREACHABLE), e); } } int failedQueriesNotificationThreshold = prop.getInteger(NotificationProperties.FAILED_QUERIES_NOTIFICATION_THRESHOLD); if (failedQueriesNotificationThreshold == 0) { failedQueriesNotificationThreshold = 1; } failedQueries = (failedQueries + 1) % failedQueriesNotificationThreshold; }

Target:
private void distributeDbDownEvent() { firstMatchSimpleFilter.clearFilterEntries(); firstMatchSimpleFilter.addFilterEntries( configurationFilters ); if (failedQueries == 0) { try { firstMatchSimpleFilter.processEvent(eventsManager.createDBDownEvent()); } catch (Exception e) { log.error( String.format("Failed to dispatch %s event", EventsManager.DATABASE_UNREACHABLE), e); } } int failedQueriesNotificationThreshold = prop.getInteger(NotificationProperties.FAILED_QUERIES_NOTIFICATION_THRESHOLD); if (failedQueriesNotificationThreshold == 0) { failedQueriesNotificationThreshold = 1; } failedQueries = (failedQueries + 1) % failedQueriesNotificationThreshold; }
Source:
public IndexDescProto getIndexByName(String databaseName, final String indexName) throws UndefinedDatabaseException, UndefinedIndexException { ResultSet res = null; IndexDescProto proto = null; String sql = GET_INDEXES_SQL + " WHERE " + COL_DATABASES_PK + "=? AND INDEX_NAME=?"; if (LOG.isDebugEnabled()) { LOG.debug(sql); } try (Connection conn = getConnection(); PreparedStatement pstmt = conn.prepareStatement(sql)) { int databaseId = getDatabaseId(databaseName); pstmt.setInt(1, databaseId); pstmt.setString(2, indexName); res = pstmt.executeQuery(); if (!res.next()) { throw new UndefinedIndexException(indexName); } IndexDescProto.Builder builder = IndexDescProto.newBuilder(); String tableName = getTableName(conn, res.getInt(COL_TABLES_PK)); builder.setTableIdentifier(CatalogUtil.buildTableIdentifier(databaseName, tableName)); resultToIndexDescProtoBuilder(CatalogUtil.buildFQName(databaseName, tableName), builder, res); try { builder.setTargetRelationSchema(getTable(databaseName, tableName).getSchema()); } catch (UndefinedTableException e) { throw new TajoInternalError( "Inconsistent table and index information: table " + tableName + " does not exists."); } proto = builder.build(); } catch (SQLException se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(res); } return proto; }

Target:
public IndexDescProto getIndexByName(String databaseName, final String indexName) throws UndefinedDatabaseException, UndefinedIndexException { Connection conn = null; ResultSet res = null; PreparedStatement pstmt = null; IndexDescProto proto = null; try { int databaseId = getDatabaseId(databaseName); String sql = GET_INDEXES_SQL + " WHERE " + COL_DATABASES_PK + "=? AND INDEX_NAME=?"; if (LOG.isDebugEnabled()) { LOG.debug(sql); } conn = getConnection(); pstmt = conn.prepareStatement(sql); pstmt.setInt(1, databaseId); pstmt.setString(2, indexName); res = pstmt.executeQuery(); if (!res.next()) { throw new UndefinedIndexException(indexName); } IndexDescProto.Builder builder = IndexDescProto.newBuilder(); String tableName = getTableName(conn, res.getInt(COL_TABLES_PK)); builder.setTableIdentifier(CatalogUtil.buildTableIdentifier(databaseName, tableName)); resultToIndexDescProtoBuilder(CatalogUtil.buildFQName(databaseName, tableName), builder, res); try { builder.setTargetRelationSchema(getTable(databaseName, tableName).getSchema()); } catch (UndefinedTableException e) { throw new TajoInternalError( "Inconsistent table and index information: table " + tableName + " does not exists."); } proto = builder.build(); } catch (SQLException se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(pstmt, res); } return proto; }
Source:
private FormDef loadFormFromFile(File formXmlFile) { FileInputStream fis; Log.i(TAG, "Attempting to load from: " + formXmlFile.getAbsolutePath()); try { fis = new FileInputStream(formXmlFile); } catch (FileNotFoundException e) { throw new RuntimeException("Error reading XForm file"); } XFormParser.registerHandler("intent", new IntentExtensionParser()); XFormParser.registerActionHandler("pollsensor", new PollSensorExtensionParser()); FormDef fd = XFormExtensionUtils.getFormFromInputStream(fis); if (fd == null) { throw new RuntimeException("Error reading XForm file"); } return fd; }

Target:
private FormDef loadFormFromFile(File formXmlFile) { FileInputStream fis; Log.i(TAG, "Attempting to load from: " + formXmlFile.getAbsolutePath()); try { fis = new FileInputStream(formXmlFile); } catch (FileNotFoundException e) { throw new RuntimeException("Error reading XForm file"); } XFormParser.registerHandler("intent", new IntentExtensionParser()); XFormParser.registerActionHandler(PollSensorAction.ELEMENT_NAME, new PollSensorExtensionParser()); FormDef fd = XFormExtensionUtils.getFormFromInputStream(fis); if (fd == null) { throw new RuntimeException("Error reading XForm file"); } return fd; }
Source:
public static void init(AndroidAnnotationsEnvironment environment) { classSuffix = environment.getOptionValue(OPTION_CLASS_SUFFIX).trim(); if (classSuffix.isEmpty()) { throw new IllegalArgumentException("'" + classSuffix + "' may not be an empty string."); } if (!SourceVersion.isName("validName" + classSuffix) || classSuffix.contains(".")) { throw new IllegalArgumentException("'" + classSuffix + "' may not be a valid Java identifier."); } }

Target:
public static void init(AndroidAnnotationsEnvironment environment) { classSuffix = environment.getOptionValue(OPTION_CLASS_SUFFIX).trim(); if (classSuffix.isEmpty()) { throw new IllegalArgumentException("'" + classSuffix + "' may not be an empty string."); } if (!SourceVersion.isName("ValidName" + classSuffix) || classSuffix.contains(".")) { throw new IllegalArgumentException("'" + classSuffix + "' may not be a valid Java identifier."); } }
Source:
public void testGlobStatusPathExpansionAndFilter() throws IOException { Path testRoot = new Path("/parent"); ghfs.mkdirs(testRoot); ghfs.mkdirs(new Path("/parent/date")); ghfs.mkdirs(new Path("/parent/date/2020")); ghfs.mkdirs(new Path("/parent/date/2020/07")); ghfs.mkdirs(new Path("/parent/date/2020/07/17")); ghfs.mkdirs(new Path("/parent/date/2020/07/18")); ghfs.mkdirs(new Path("/parent/date/2020/07/19")); ghfs.mkdirs(new Path("/parent/date/2020/07/17/0")); ghfs.mkdirs(new Path("/parent/date/2020/07/18/0")); ghfs.mkdirs(new Path("/parent/date/2020/07/19/0")); byte[] data = "data".getBytes(StandardCharsets.UTF_8); PathFilter FILE_FILTER = path -> path.getName().endsWith(".json"); createFile(new Path("/parent/date/2020/07/17/0/file1.xml"), data); createFile(new Path("/parent/date/2020/07/17/0/file1.json"), data); createFile(new Path("/parent/date/2020/07/18/0/file2.xml"), data); createFile(new Path("/parent/date/2020/07/18/0/file2.json"), data); createFile(new Path("/parent/date/2020/07/19/0/file3.xml"), data); createFile(new Path("/parent/date/2020/07/19/0/file3.json"), data); FileStatus[] files = ghfs.globStatus(new Path("/parent *"), FILE_FILTER); assertThat(files).hasLength(3); assertThat(files[0].getPath().getName()).isEqualTo("file1.json"); assertThat(files[1].getPath().getName()).isEqualTo("file2.json"); assertThat(files[2].getPath().getName()).isEqualTo("file3.json"); assertThat(ghfs.delete(testRoot, true)).isTrue(); }

Target:
public void testGlobStatusPathExpansionAndFilter() throws IOException { Path testRoot = new Path("/testGlobStatusPathExpansionAndFilter"); byte[] data = "testGlobStatusPathExpansionAndFilter_data".getBytes(UTF_8); createFile(testRoot.suffix("/date/2020/07/17/0/file1.xml"), data); createFile(testRoot.suffix("/date/2020/07/17/0/file1.json"), data); createFile(testRoot.suffix("/date/2020/07/18/0/file2.xml"), data); createFile(testRoot.suffix("/date/2020/07/18/0/file2.json"), data); createFile(testRoot.suffix("/date/2020/07/19/0/file3.xml"), data); createFile(testRoot.suffix("/date/2020/07/19/0/file3.json"), data); createFile(testRoot.suffix("/date/2020/07/20/0/file4.xml"), data); createFile(testRoot.suffix("/date/2020/07/20/0/file4.json"), data); FileStatus[] files = ghfs.globStatus( testRoot.suffix(" *"), path -> path.getName().endsWith(".json")); Path workingDirRoot = new Path(ghfs.getWorkingDirectory(), testRoot); assertThat(Arrays.stream(files).map(FileStatus::getPath).collect(toImmutableList())) .containsExactly( workingDirRoot.suffix("/date/2020/07/17/0/file1.json"), workingDirRoot.suffix("/date/2020/07/18/0/file2.json"), workingDirRoot.suffix("/date/2020/07/19/0/file3.json")); assertThat(ghfs.delete(testRoot, true)).isTrue(); }
Source:
public DynamicLifespanScheduler(BucketNodeMap bucketNodeMap, List<Node> allNodes, List<ConnectorPartitionHandle> partitionHandles, OptionalInt concurrentLifespansPerTask) { this.bucketNodeMap = bucketNodeMap; this.allNodes = allNodes; this.partitionHandles = requireNonNull(partitionHandles, "partitionHandles is null"); if (concurrentLifespansPerTask.isPresent()) { checkArgument(concurrentLifespansPerTask.getAsInt() >= 1, "concurrentLifespansPerTask must be great or equal to 1 if present"); } this.concurrentLifespansPerTask = requireNonNull(concurrentLifespansPerTask, "concurrentLifespansPerTask is null"); int bucketCount = partitionHandles.size(); this.driverGroups = new IntArrayList(IntStream.range(0, bucketCount).toArray()).iterator(); }

Target:
public DynamicLifespanScheduler(BucketNodeMap bucketNodeMap, List<Node> allNodes, List<ConnectorPartitionHandle> partitionHandles, OptionalInt concurrentLifespansPerTask) { this.bucketNodeMap = requireNonNull(bucketNodeMap, "bucketNodeMap is null"); this.allNodes = requireNonNull(allNodes, "allNodes is null"); this.partitionHandles = unmodifiableList(new ArrayList<>( requireNonNull(partitionHandles, "partitionHandles is null"))); this.concurrentLifespansPerTask = requireNonNull(concurrentLifespansPerTask, "concurrentLifespansPerTask is null"); concurrentLifespansPerTask.ifPresent(lifespansPerTask -> checkArgument(lifespansPerTask >= 1, "concurrentLifespansPerTask must be great or equal to 1 if present")); int bucketCount = partitionHandles.size(); verify(bucketCount > 0); this.driverGroups = new IntArrayList(IntStream.range(0, bucketCount).toArray()).iterator(); }
Source:
public void testPutIfAbsentNoStoreEntryCacheAccessExceptionNoCacheWriterEntry() throws Exception { final FakeStore realStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(realStore); doThrow(new CacheAccessException("")).when(this.store).computeIfAbsent(eq("key"), getAnyFunction()); final FakeCacheWriter realCache = new FakeCacheWriter(Collections.<String, String>emptyMap()); this.cacheWriter = spy(realCache); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheWriter); final InOrder ordered = inOrder(this.cacheWriter, this.spiedResilienceStrategy); ehcache.putIfAbsent("key", "value"); verify(this.store).computeIfAbsent(eq("key"), getAnyFunction()); ordered.verify(this.cacheWriter).write(eq("key"), eq("value")); ordered.verify(this.spiedResilienceStrategy) .putIfAbsentFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(true)); assertThat(realCache.getEntryMap().get("key"), equalTo("value")); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.PutIfAbsentOutcome.FAILURE)); }

Target:
public void testPutIfAbsentNoStoreEntryCacheAccessExceptionNoCacheWriterEntry() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(fakeStore); doThrow(new CacheAccessException("")).when(this.store).computeIfAbsent(eq("key"), getAnyFunction()); final FakeCacheWriter fakeWriter = new FakeCacheWriter(Collections.<String, String>emptyMap()); this.cacheWriter = spy(fakeWriter); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheWriter); final InOrder ordered = inOrder(this.cacheWriter, this.spiedResilienceStrategy); ehcache.putIfAbsent("key", "value"); verify(this.store).computeIfAbsent(eq("key"), getAnyFunction()); ordered.verify(this.cacheWriter).write(eq("key"), eq("value")); ordered.verify(this.spiedResilienceStrategy) .putIfAbsentFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(true)); assertThat(fakeWriter.getEntryMap().get("key"), equalTo("value")); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.PutIfAbsentOutcome.FAILURE)); }
Source:
public void removeBuddyAfterConnectRejection(UUID idOfRequestingUser, UUID buddyId) { userService.getValidatedUserById(idOfRequestingUser); Buddy buddy = buddyRepository.findOne(buddyId); if (buddy != null) { removeBuddy(idOfRequestingUser, buddy); } }

Target:
public void removeBuddyAfterConnectRejection(UUID idOfRequestingUser, UUID buddyId) { userService.assertValidatedUser(userService.getUserEntityById(idOfRequestingUser)); Buddy buddy = buddyRepository.findOne(buddyId); if (buddy != null) { removeBuddy(idOfRequestingUser, buddy); } }
Source:
Mono<Response<Boolean>> existsWithResponse(Context context) { return this.getPropertiesWithResponse(context) .map(cp -> (Response<Boolean>) new SimpleResponse<>(cp, true)) .onErrorResume(t -> t instanceof ShareStorageException && ((ShareStorageException) t).getStatusCode() == 404, t -> { HttpResponse response = ((ShareStorageException) t).getResponse(); return Mono.just(new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), false)); }); }

Target:
Mono<Response<Boolean>> existsWithResponse(Context context) { return this.getPropertiesWithResponse(context) .map(cp -> (Response<Boolean>) new SimpleResponse<>(cp, true)) .onErrorResume(t -> t instanceof ShareStorageException && ((ShareStorageException) t).getStatusCode() == 404 && ((ShareStorageException) t).getErrorCode() == ShareErrorCode.SHARE_NOT_FOUND, t -> { HttpResponse response = ((ShareStorageException) t).getResponse(); return Mono.just(new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), false)); }); }
Source:
public void write(List<? extends List<IBaseResource>> theList) throws Exception { for (List<IBaseResource> resourceList : theList) { for (IBaseResource nextFileResource : resourceList) { myParser.encodeResourceToWriter(nextFileResource, myWriter); myWriter.append("\n"); } } Optional<IIdType> createdId = flushToFiles(); createdId.ifPresent(theIIdType -> ourLog.warn("Created resources for bulk export file containing resources of type ", theIIdType.toUnqualifiedVersionless().getValue())); }

Target:
public void write(List<? extends List<IBaseResource>> theList) throws Exception { int count = 0; for (List<IBaseResource> resourceList : theList) { for (IBaseResource nextFileResource : resourceList) { myParser.encodeResourceToWriter(nextFileResource, myWriter); myWriter.append("\n"); count++; } } Optional<IIdType> createdId = flushToFiles(); if (createdId.isPresent()) { ourLog.info("Created resources for bulk export file containing resources of type ", count, createdId.get().toUnqualifiedVersionless().getValue(), myReosurceType); } }