auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void setProjectName(String projectName) { fProjectName = projectName; if (fSelectedConnection != null && fSelectedConnection.isOpen()) { IRemoteFileService fileSvc = fSelectedConnection.getService(IRemoteFileService.class); if (fileSvc != null) { if(fileSvc.getBaseDirectory().equals(fLocationText.getText())) fRemoteDirSelected = false; } <START> } <END> if(fLocationText.getText().equals(EMPTY_STRING)) { fRemoteDirSelected = false; } if (!fRemoteDirSelected) { fLocationText.setText(getDefaultPathDisplayString()); } }</code><technical_language>This function is called time user types a character project text box. remote operations is a good idea. Also, this solve original problem works if user selects home directory</technical_language>

Target:
public void setProjectName(String projectName) { fProjectName = projectName; if(fLocationText.getText().equals(EMPTY_STRING)) { fRemoteDirSelected = false; } if (!fRemoteDirSelected) { fLocationText.setText(getDefaultPathDisplayString()); } }
Source:
<code>protected BatchDeleteClientsRequest getValidRequest() throws Exception { return BatchDeleteClientsRequest.builder() <START> .clientIdentification(ClientIdentification.builder() <END> .clientId("14pnUs") .build()) .clientIdentification(ClientIdentification.builder() .clientId("qECLyr") .build()) .build(); }</code><technical_language>I this interface-it is wordy a cumbersome for user. is prospect of ClientIdentification class else. work a of simplifying this</technical_language>

Target:
protected BatchDeleteClientsRequest getValidRequest() throws Exception { return BatchDeleteClientsRequest.builder() .clientId("14pnUs", "qECLyr") .build(); }
Source:
<code>@NonNull public static <T> PersistentResource<T> loadRecord( EntityProjection projection, String id, RequestScope requestScope ) throws InvalidObjectIdentifierException { Preconditions.checkNotNull(projection); Preconditions.checkNotNull(id); Preconditions.checkNotNull(requestScope); DataStoreTransaction tx = requestScope.getTransaction(); EntityDictionary dictionary = requestScope.getDictionary(); Class<?> loadClass = projection.getType(); Object obj = requestScope.getObjectById(loadClass, id); <START> QueryDetail qd = null; <END> if (obj == null) { Optional<FilterExpression> permissionFilter = getPermissionFilterExpression(loadClass, requestScope); Class<?> idType = dictionary.getIdType(loadClass); projection = projection .copyOf() .filterExpression(permissionFilter.orElse(null)) .build(); obj = tx.loadObject(projection, (Serializable) CoerceUtil.coerce(id, idType), requestScope); qd = tx.explain(projection, requestScope); queryLoggerProcessQuery(qd, requestScope); if (obj == null) { throw new InvalidObjectIdentifierException(id, dictionary.getJsonAliasFor(loadClass)); } } PersistentResource<T> resource = new PersistentResource<>( (T) obj, null, requestScope.getUUIDFor(obj), requestScope); if (!requestScope.getNewResources().contains(resource)) { resource.checkFieldAwarePermissions(ReadPermission.class); } return resource; }</code><technical_language>Do need define local variable here</technical_language>

Target:
@NonNull public static <T> PersistentResource<T> loadRecord( EntityProjection projection, String id, RequestScope requestScope ) throws InvalidObjectIdentifierException { Preconditions.checkNotNull(projection); Preconditions.checkNotNull(id); Preconditions.checkNotNull(requestScope); DataStoreTransaction tx = requestScope.getTransaction(); EntityDictionary dictionary = requestScope.getDictionary(); Class<?> loadClass = projection.getType(); Object obj = requestScope.getObjectById(loadClass, id); if (obj == null) { Optional<FilterExpression> permissionFilter = getPermissionFilterExpression(loadClass, requestScope); Class<?> idType = dictionary.getIdType(loadClass); projection = projection .copyOf() .filterExpression(permissionFilter.orElse(null)) .build(); obj = tx.loadObject(projection, (Serializable) CoerceUtil.coerce(id, idType), requestScope); QueryDetail qd = tx.explain(projection, requestScope); queryLoggerProcessQuery(qd, requestScope); if (obj == null) { throw new InvalidObjectIdentifierException(id, dictionary.getJsonAliasFor(loadClass)); } } PersistentResource<T> resource = new PersistentResource<>( (T) obj, null, requestScope.getUUIDFor(obj), requestScope); if (!requestScope.getNewResources().contains(resource)) { resource.checkFieldAwarePermissions(ReadPermission.class); } return resource; }
Source:
<code>public void testPeggedToV2SerDe() throws Exception { LedgerMetadataSerDe serDe = new LedgerMetadataSerDe(); LedgerMetadata metadata = LedgerMetadataBuilder.create() .withEnsembleSize(3).withWriteQuorumSize(2).withAckQuorumSize(1) .withPassword("foobar".getBytes(UTF_8)).withDigestType(DigestType.CRC32C) .newEnsembleEntry(0L, Lists.newArrayList(new BookieSocketAddress("192.0.2.1", 3181), new BookieSocketAddress("192.0.2.2", 3181), new BookieSocketAddress("192.0.2.3", 3181))) <START> .withMetadataFormatVersion(LedgerMetadataSerDe.METADATA_FORMAT_VERSION_2) <END> .build(); byte[] encoded = serDe.serialize(metadata); LedgerMetadata decoded = serDe.parseConfig(encoded, Optional.empty()); Assert.assertEquals(2, decoded.getMetadataFormatVersion()); }</code><technical_language>This part related Cc @sijie</technical_language>

Target:
public void testPeggedToV2SerDe() throws Exception { LedgerMetadataSerDe serDe = new LedgerMetadataSerDe(); LedgerMetadata metadata = LedgerMetadataBuilder.create() .withEnsembleSize(3).withWriteQuorumSize(2).withAckQuorumSize(1) .withPassword("foobar".getBytes(UTF_8)).withDigestType(DigestType.CRC32C) .newEnsembleEntry(0L, Lists.newArrayList(new BookieSocketAddress("192.0.2.1", 3181), new BookieSocketAddress("192.0.2.2", 3181), new BookieSocketAddress("192.0.2.3", 3181))) .build(); byte[] encoded = serDe.serialize(metadata); LedgerMetadata decoded = serDe.parseConfig(encoded, Optional.empty()); Assert.assertEquals(2, decoded.getMetadataFormatVersion()); }
Source:
<code>public List<ReplicationSourceInterface> getSources() { <START> return this.sources.values().stream().filter(source -> source.isSourceActive()) <END> .collect(Collectors.toList()); }</code><technical_language>curious this change</technical_language>

Target:
public List<ReplicationSourceInterface> getSources() { return new ArrayList<>(this.sources.values()); }
Source:
<code>String parsePrimeFacesFilter(Map filters) throws IllegalArgumentException { <START> if (Objects.nonNull(filters) && filters.entrySet().size() > 0) { <END> if (filters.entrySet().size() > 1) { throw new IllegalArgumentException("Filter map contains to many entries (only 0 or 1 allowed)!"); } else { List<Object> filterList = new ArrayList<Object>(filters.values()); if (filterList.get(0) instanceof String) { return (String) filterList.get(0); } else { throw new IllegalArgumentException("Given filter is not a String!"); } } } else { return ""; } }</code><technical_language>this method simplified: /** * Parses passed Map returns value. Map Entry. * This method parse a Map passed PrimeFaces' DataTable default filter functionality. * passes currently Entry custom filter input passes complete filter string * input of PrimeFaces' default filter functionality. * This triggers PrimeFaces pass filter string update DataTable automatically. * * @param filters * a Map String * @return * Entry's java.lang.String */ String parsePrimeFacesFilter(Map filters) { if (Objects.nonNull(filters) && filters.entrySet().size() == 1) { Object filter = filters.entrySet().stream().findAny(); if (filter instanceof String) { return (String) filter; } } return ""; } I in cases this method is used, exception is caught next filter is set empty String. This change decrease amount of code needed later. needed catch of exceptions check if filter is null</technical_language>

Target:
String parsePrimeFacesFilter(Map filters) { if (Objects.nonNull(filters) && filters.entrySet().size() == 1) { Map.Entry filter = (Map.Entry) filters.entrySet().stream().findAny().get(); if (filter.getValue() instanceof String) { return (String) filter.getValue(); } else { logger.warn("Given filter is not a String. Ignoring filter."); } } else if (Objects.nonNull(filters) && filters.entrySet().size() > 1) { logger.warn("Filter map contains to many entries (only 0 or 1 allowed). Ignoring filter map."); } return ""; }
Source:
<code>public void visitNode(Tree tree) { if (!hasSemantic()) { return; } BinaryExpressionTree binaryExpression = (BinaryExpressionTree) tree; <START> ExpressionTree leftNoParenth = ExpressionUtils.skipParentheses(binaryExpression.leftOperand()); <END> ExpressionTree rightNoParenth = ExpressionUtils.skipParentheses(binaryExpression.rightOperand()); if (((leftNoParenth.is(Tree.Kind.EQUAL_TO) || rightNoParenth.is(Tree.Kind.EQUAL_TO)) && (expressionMatches(binaryExpression, leftNoParenth, rightNoParenth, Tree.Kind.CONDITIONAL_OR))) || ((leftNoParenth.is(Tree.Kind.NOT_EQUAL_TO) || rightNoParenth.is(Tree.Kind.NOT_EQUAL_TO)) && (expressionMatches(binaryExpression, leftNoParenth, rightNoParenth, Tree.Kind.CONDITIONAL_AND)))) { reportIssue(treeToReport(leftNoParenth, rightNoParenth), "Remove this unnecessary null check; \"instanceof\" returns false for nulls."); } }</code><technical_language>leftOp, rightOp enough</technical_language>

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } BinaryExpressionTree binaryExpression = (BinaryExpressionTree) tree; ExpressionTree leftOp = ExpressionUtils.skipParentheses(binaryExpression.leftOperand()); ExpressionTree rightOp = ExpressionUtils.skipParentheses(binaryExpression.rightOperand()); if ((is(Tree.Kind.EQUAL_TO, leftOp, rightOp) && nullCheckWithInstanceOf(leftOp, rightOp, binaryExpression.kind(), Tree.Kind.CONDITIONAL_OR)) || (is(Tree.Kind.NOT_EQUAL_TO, leftOp, rightOp) && nullCheckWithInstanceOf(leftOp, rightOp, binaryExpression.kind(), Tree.Kind.CONDITIONAL_AND))) { reportIssue(treeToReport(leftOp, rightOp), "Remove this unnecessary null check; \"instanceof\" returns false for nulls."); } }
Source:
<code>private static void initiateRequest(OSCoreCtxDB db, String uri) throws ConnectorException, IOException, OSException { OSCoreCtx ctx = db.getContext(uri); byte[] contextID1 = Bytes.createBytes(random, SEGMENT_LENGTH); OSCoreCtx newCtx = rederiveWithContextID(ctx, contextID1); newCtx.setIncludeContextId(true); newCtx.setContextRederivationPhase(ContextRederivation.PHASE.CLIENT_PHASE_1); db.addContext(uri, newCtx); String resource = "/rederive"; String URI = uri + resource; <START> CoapClient c = new CoapClient(URI); <END> Request r = new Request(Code.GET); r.getOptions().setOscore(Bytes.EMPTY); CoapHandler handler = new CoapHandler() { @Override public void onLoad(CoapResponse response) { LOGGER.info("Successfully received context re-derivation message"); } @Override public void onError() { LOGGER.info("Error while receiving context re-derivation message"); } }; c.advanced(handler, r); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } }</code><technical_language>CoapStack, facade class CoapClient is intended! pain. Send request directly</technical_language>

Target:
private static void initiateRequest(OSCoreCtxDB db, String uri) throws ConnectorException, IOException, OSException { OSCoreCtx ctx = db.getContext(uri); printStateLogging(ctx); byte[] contextID1 = Bytes.createBytes(random, SEGMENT_LENGTH); OSCoreCtx newCtx = rederiveWithContextID(ctx, contextID1); newCtx.setIncludeContextId(true); newCtx.setContextRederivationPhase(ContextRederivation.PHASE.CLIENT_PHASE_1); db.addContext(uri, newCtx); }
Source:
<code>private NULL_CONSTRAINT parseNotNullConstraint() { NULL_CONSTRAINT nullConstraint = NULL_CONSTRAINT.NO_NULL_CONSTRAINT_FOUND; if ((isToken("NOT") || isToken("NULL"))) { if (readIf("NOT")) { read("NULL"); nullConstraint = NULL_CONSTRAINT.NULL_IS_NOT_ALLOWED; } else { read("NULL"); nullConstraint = NULL_CONSTRAINT.NULL_IS_ALLOWED; } <START> if (readIf("ENABLE")) { <END> readIf("VALIDATE"); if (readIf("NOVALIDATE")) { nullConstraint = NULL_CONSTRAINT.NULL_IS_ALLOWED; } } if (readIf("DISABLE")) { nullConstraint = NULL_CONSTRAINT.NULL_IS_ALLOWED; readIf("VALIDATE"); readIf("NOVALIDATE"); } } return nullConstraint; }</code><technical_language>please check in Oracle mode</technical_language>

Target:
private NullConstraintType parseNotNullConstraint() { NullConstraintType nullConstraint = NullConstraintType.NO_NULL_CONSTRAINT_FOUND; if ((isToken("NOT") || isToken("NULL"))) { if (readIf("NOT")) { read("NULL"); nullConstraint = NullConstraintType.NULL_IS_NOT_ALLOWED; } else { read("NULL"); nullConstraint = NullConstraintType.NULL_IS_ALLOWED; } if (database.isDbTypeOneOf(DbTypeEnum.Oracle)) { if (readIf("ENABLE")) { readIf("VALIDATE"); if (readIf("NOVALIDATE")) { nullConstraint = NullConstraintType.NULL_IS_ALLOWED; } } if (readIf("DISABLE")) { nullConstraint = NullConstraintType.NULL_IS_ALLOWED; readIf("VALIDATE"); readIf("NOVALIDATE"); } } } return nullConstraint; }
Source:
<code>public Version minimumCompatibilityVersion() { <START> return V_4_1_1; <END> }</code><technical_language>4.1.0</technical_language>

Target:
public Version minimumCompatibilityVersion() { return V_4_1_0; }
Source:
<code>public ExpressionProfiler() { this.expensiveExpressionThresholdMillis = EXPENSIVE_EXPRESSION_THRESHOLD_MILLIS; <START> this.ticker = systemTicker(); <END> }</code><technical_language>a passthrough constructor call this(systemTicker(), EXPENSIVE_EXPRESSION_THRESHOLD_MILLIS)</technical_language>

Target:
public ExpressionProfiler() { this(systemTicker(), EXPENSIVE_EXPRESSION_THRESHOLD); }
Source:
<code><START> public List<T> init(DataSource<T> source) { <END> loader = new ListComponentLoader<T>(activity, source); return loader.loadData(); }</code><technical_language>init a bad name for this this consistent ListComponent SectionListComponent get async loading for free. this called render. render list for a datasource a List of objects</technical_language>

Target:
public void init(DataSource<T> source) { loader = new ListComponentLoader<T>(activity, source); render(loader.loadData()); }
Source:
<code>protected boolean shouldIgnoreClass(Type type) { if (type instanceof Class) { Class<?> cls = (Class<?>) type; if (cls.getName().equals("javax.ws.rs.Response")) { return true; } } else { if (type instanceof com.fasterxml.jackson.core.type.ResolvedType) { com.fasterxml.jackson.core.type.ResolvedType rt = (com.fasterxml.jackson.core.type.ResolvedType) type; <START> LOGGER.debug("Can't check class " + type + ", " + rt.getRawClass().getName()); <END> if (rt.getRawClass().equals(Class.class)) { return true; } } } return false; }</code><technical_language>LOGGER.debug("Can't check class {}, {}", type, rt.getRawClass().getName())</technical_language>

Target:
protected boolean shouldIgnoreClass(Type type) { if (type instanceof Class) { Class<?> cls = (Class<?>) type; if (cls.getName().equals("javax.ws.rs.Response")) { return true; } } else { if (type instanceof com.fasterxml.jackson.core.type.ResolvedType) { com.fasterxml.jackson.core.type.ResolvedType rt = (com.fasterxml.jackson.core.type.ResolvedType) type; log.debug("Can't check class {}, {}", type, rt.getRawClass().getName()); if (rt.getRawClass().equals(Class.class)) { return true; } } } return false; }
Source:
<code>public String get(String apiKey, String context) throws NoSuchAlgorithmException, KeyManagementException { String output = null; HttpClient client = createClient(); HttpGet request = new HttpGet("https://localhost:9092/"+context); try { request.addHeader("apikey",apiKey); HttpResponse response = client.execute(request); int responseCode = response.getStatusLine().getStatusCode(); <START> System.out.println("Response Code: " + responseCode); <END> System.out.println("Mocked API Content:-"); BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); output = rd.readLine(); System.out.println(output); } catch (IOException ioe) { logger.info("Error occured", ioe); } return output; }</code><technical_language>remove System.out logger library</technical_language>

Target:
public String get(String apiKey, String context) throws NoSuchAlgorithmException, KeyManagementException { String output = null; HttpClient client = createClient(); HttpGet request = new HttpGet("https://localhost:9092/"+context); try { request.addHeader("apikey",apiKey); HttpResponse response = client.execute(request); int responseCode = response.getStatusLine().getStatusCode(); logger.info("Response Code: " + responseCode); logger.info("Mocked API Content:-"); BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); output = rd.readLine(); logger.info(output); } catch (IOException ioe) { logger.error("Error occured", ioe); } return output; }
Source:
<code>private static void start(CommandLine commandLine) throws Exception { ProActiveConfiguration.load(); if (!commandLine.hasOption("no-router")) { startRouter(); } String rmUrl = getRmUrl(commandLine); setCleanDatabaseProperties(commandLine); setCleanNodesourcesProperty(commandLine); rmUrl = connectToOrStartResourceManager(commandLine, rmUrl); if (commandLine.hasOption("rm-only")) { return; } SchedulerAuthenticationInterface sai = startScheduler(commandLine, rmUrl); if (!commandLine.hasOption("no-rest")) { <START> List<String> applicationUrls = (new JettyStarter().deployWebApplications(rmUrl, sai.getHostURL())); <END> if (applicationUrls != null && !applicationUrls.isEmpty()) { System.setProperty("rest.server.url", applicationUrls.get(0)); } } addShutdownMessageHook(); }</code><technical_language>![MINOR](<LINK_1> Remove useless parentheses. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private static void start(CommandLine commandLine) throws Exception { ProActiveConfiguration.load(); if (!commandLine.hasOption("no-router")) { startRouter(); } String rmUrl = getRmUrl(commandLine); setCleanDatabaseProperties(commandLine); setCleanNodesourcesProperty(commandLine); rmUrl = connectToOrStartResourceManager(commandLine, rmUrl); if (commandLine.hasOption("rm-only")) { return; } SchedulerAuthenticationInterface sai = startScheduler(commandLine, rmUrl); if (!commandLine.hasOption("no-rest")) { List<String> applicationUrls = (new JettyStarter().deployWebApplications(rmUrl, sai.getHostURL())); if (applicationUrls != null) { for (String applicationUrl : applicationUrls) { if (applicationUrl.endsWith("/rest")) { if (!PASchedulerProperties.SCHEDULER_REST_URL.isSet()) { PASchedulerProperties.SCHEDULER_REST_URL.updateProperty(applicationUrl); } } } } } addShutdownMessageHook(); }
Source:
<code>public void shouldEncodeUsernameAndPasswordWithTheCorrectFieldSeparator() throws Exception { List<String> someCorrectSeparators = Arrays.asList("-", "|", "/", "\\", "+"); <START> String aCorrectSeparator = someCorrectSeparators.get(new Random().nextInt(someCorrectSeparators.size())); <END> String encodedUsernamePassword = usernamePasswordAuthenticationCredentials.encode(aCorrectSeparator); assertThat(encodedUsernamePassword, notNullValue()); assertThat(encodedUsernamePassword, is("bXlVc2VybmFtZQ==~bXlQYXNzd29yZA==~")); }</code><technical_language>test separators, like: Java for (String correctSeparator : someCorrectSeparators) { // String encodedUsernamePassword = usernamePasswordAuthenticationCredentials.encode(correctSeparator); // assertThat(String.format("Failed encode '%s'", correctSeparator), encodedUsernamePassword, notNullValue()); assertThat( String.format("Failed properly encode '%s'", correctSeparator), encodedUsernamePassword, is("bXlVc2VybmFtZQ==~bXlQYXNzd29yZA==~")); } (In case separator used.) Also, throw exception instead of silently continue encoding "wrong" parent separator is used</technical_language>

Target:
public void shouldEncodeUsernameAndPasswordWithTheCorrectFieldSeparator() { List<String> someCorrectSeparators = Arrays.asList("-", "|", "/", "\\", "+"); for (String correctSeparator : someCorrectSeparators) { String encodedUsernamePassword = usernamePasswordAuthenticationCredentials.encode(correctSeparator); assertThat(String.format("Failed to encode with '%s'", correctSeparator), encodedUsernamePassword, notNullValue()); assertThat( String.format("Failed to properly encode with '%s'", correctSeparator), encodedUsernamePassword, is("bXlVc2Vy~bXlQYXNz~")); } }
Source:
<code>public OpenFolderActionCommand(@Nonnull final String op, @Nonnull final String folderName, @Nonnull final QResyncParameter qResyncParameter) { this.op = op; this.folderName = folderName; this.qResyncParameter = qResyncParameter; <START> this.condStore = false; <END> }</code><technical_language>qRsyncParameter passed while enabling condStore</technical_language>

Target:
public OpenFolderActionCommand(@Nonnull final String op, @Nonnull final String folderName, @Nonnull final QResyncParameter qResyncParameter) { this.op = op; this.folderName = folderName; this.qResyncParameter = qResyncParameter; this.isCondStoreEnabled = false; }
Source:
<code>public void testMetacardTransformWithNullMetacard() throws Exception { BundleContext context = mock(BundleContext.class); Transform transform = mock(Transform.class); when(transform.transform(any(List.class), any(String.class), any(Map.class))) .thenThrow(IllegalArgumentException.class); CatalogFramework framework = this.createDummyCatalogFramework( provider, storageProvider, context, eventAdmin, true, transform); <START> framework.transform((Metacard) null, "NONE", new HashMap<>()); <END> }</code><technical_language>"NONE" a constant</technical_language>

Target:
public void testMetacardTransformWithNullMetacard() throws Exception { BundleContext context = mock(BundleContext.class); Transform transform = mock(Transform.class); when(transform.transform(any(List.class), any(String.class), any(Map.class))) .thenThrow(IllegalArgumentException.class); CatalogFramework framework = this.createDummyCatalogFramework( provider, storageProvider, context, eventAdmin, true, transform); framework.transform((Metacard) null, NO_TRANSFORMER_ID, new HashMap<>()); }
Source:
<code>public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) { if (!playerIn.capabilities.isCreativeMode) { playerIn.addExperienceLevel(-repairContainer.maximumCost); } float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(playerIn, stack, repairContainer.inputSlots.getStackInSlot(0), repairContainer.inputSlots.getStackInSlot(1)); breakChance /= 2.0; repairContainer.inputSlots.setInventorySlotContents(0, null); if (repairContainer.materialCost > 0) { ItemStack itemstack = repairContainer.inputSlots.getStackInSlot(1); if (!InvTools.isEmpty(itemstack) && itemstack.stackSize > repairContainer.materialCost) { itemstack.stackSize -= repairContainer.materialCost; repairContainer.inputSlots.setInventorySlotContents(1, itemstack); } else { repairContainer.inputSlots.setInventorySlotContents(1, InvTools.emptyStack()); } } else { <START> repairContainer.inputSlots.setInventorySlotContents(1, null); <END> } repairContainer.maximumCost = 0; IBlockState iblockstate = worldIn.getBlockState(blockPosIn); if (!playerIn.capabilities.isCreativeMode && !worldIn.isRemote && iblockstate.getBlock() == Blocks.ANVIL && playerIn.getRNG().nextFloat() < breakChance) { int l = iblockstate.getValue(BlockAnvil.DAMAGE); ++l; if (l > 2) { worldIn.setBlockToAir(blockPosIn); worldIn.playEvent(1029, blockPosIn, 0); } else { worldIn.setBlockState(blockPosIn, iblockstate.withProperty(BlockAnvil.DAMAGE, l), 2); worldIn.playEvent(1030, blockPosIn, 0); } } else if (!worldIn.isRemote) { worldIn.playEvent(1030, blockPosIn, 0); } }</code><technical_language>hmm</technical_language>

Target:
public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) { if (!playerIn.capabilities.isCreativeMode) { playerIn.addExperienceLevel(-repairContainer.maximumCost); } float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(playerIn, stack, repairContainer.inputSlots.getStackInSlot(0), repairContainer.inputSlots.getStackInSlot(1)); breakChance /= 2.0; repairContainer.inputSlots.setInventorySlotContents(0, InvTools.emptyStack()); if (repairContainer.materialCost > 0) { ItemStack itemstack = repairContainer.inputSlots.getStackInSlot(1); if (!InvTools.isEmpty(itemstack) && itemstack.stackSize > repairContainer.materialCost) { itemstack.stackSize -= repairContainer.materialCost; repairContainer.inputSlots.setInventorySlotContents(1, itemstack); } else { repairContainer.inputSlots.setInventorySlotContents(1, InvTools.emptyStack()); } } else { repairContainer.inputSlots.setInventorySlotContents(1, InvTools.emptyStack()); } repairContainer.maximumCost = 0; IBlockState iblockstate = worldIn.getBlockState(blockPosIn); if (!playerIn.capabilities.isCreativeMode && !worldIn.isRemote && iblockstate.getBlock() == Blocks.ANVIL && playerIn.getRNG().nextFloat() < breakChance) { int l = iblockstate.getValue(BlockAnvil.DAMAGE); ++l; if (l > 2) { worldIn.setBlockToAir(blockPosIn); worldIn.playEvent(1029, blockPosIn, 0); } else { worldIn.setBlockState(blockPosIn, iblockstate.withProperty(BlockAnvil.DAMAGE, l), 2); worldIn.playEvent(1030, blockPosIn, 0); } } else if (!worldIn.isRemote) { worldIn.playEvent(1030, blockPosIn, 0); } }
Source:
<code>private void performAutosave(Campaign campaign) { try { String fileName = this.getAutosaveFilename(campaign); <START> try (GZIPOutputStream output = new GZIPOutputStream(new FileOutputStream(fileName))) { <END> PrintWriter writer = new PrintWriter(new OutputStreamWriter(output, "UTF-8")); campaign.writeToXml(writer); writer.flush(); writer.close(); } } catch (Exception ex) { this.logger.error(this.getClass(), "performAutosave", ex); } }</code><technical_language>I this fix LGTM alert: suggestion try (FileOutputStream os = new FileOutputStream(fileName); GZIPOutputStream output = new GZIPOutputStream(os)) { Based <LINK_0></technical_language>

Target:
private void performAutosave(Campaign campaign) { try { String fileName = this.getAutosaveFilename(campaign); try (FileOutputStream fos = new FileOutputStream(fileName); GZIPOutputStream output = new GZIPOutputStream(fos)) { PrintWriter writer = new PrintWriter(new OutputStreamWriter(output, "UTF-8")); campaign.writeToXml(writer); writer.flush(); writer.close(); } } catch (Exception ex) { this.logger.error(this.getClass(), "performAutosave", ex); } }
Source:
<code>private String getRemoteComment(AbstractBuild<?, ?> build, PrintStream logger, String commentFile, String maxSize) throws InterruptedException, IOException { if (CommonUtils.isBlank(commentFile)) { logger.println("[comment-file] no comment file configured"); return null; } FilePath workspace = build.getWorkspace(); FilePath[] src = workspace.list(commentFile); if (src.length == 0) { logger.println("[comment-file] no files found by path: '" + commentFile + "'"); return null; } if (src.length > 1) { logger.println("[comment-file] Found multiple matches. Reading first only."); } FilePath source = src[0]; <START> int maxLength = 1000; <END> if (!CommonUtils.isBlank(maxSize)) { maxLength = parseInt(maxSize, 10); } if (source.length() < maxLength) { maxLength = (int)source.length(); } byte[] buffer = new byte[maxLength]; source.read().read(buffer, 0, maxLength); return new String(buffer); }</code><technical_language>1k a private static final int class level</technical_language>

Target:
private String getRemoteComment(AbstractBuild<?, ?> build, PrintStream logger, String commentFile, String maxSize) throws InterruptedException, IOException { if (CommonUtils.isBlank(commentFile)) { logger.println("[comment-file] no comment file configured"); return null; } FilePath workspace = build.getWorkspace(); FilePath[] src = workspace.list(commentFile); if (src.length == 0) { logger.println("[comment-file] no files found by path: '" + commentFile + "'"); return null; } if (src.length > 1) { logger.println("[comment-file] Found multiple matches. Reading first only."); } FilePath source = src[0]; int maxLength = DEFAULT_COMMENT_SIZE; if (!CommonUtils.isBlank(maxSize)) { maxLength = parseInt(maxSize, 10); } if (source.length() < maxLength) { maxLength = (int)source.length(); } byte[] buffer = new byte[maxLength]; source.read().read(buffer, 0, maxLength); return new String(buffer); }
Source:
<code>private void updateRotationTimers() { lastRotate = System.currentTimeMillis(); if(log.isDebugEnabled() && rotateIntervalMs > 0) { log.debug("Update last rotation timer. Next rotation for will be in {}ms", tp, rotateIntervalMs); } if (rotateScheduleIntervalMs > 0) { <START> nextScheduledRotate = DateTimeUtils.getNextTimeAdjustedByDay(System.currentTimeMillis(), rotateScheduleIntervalMs, timeZone); <END> if (log.isDebugEnabled()) { log.debug("Update scheduled rotation timer. Next rotation for will be at {}", tp, new DateTime(nextScheduledRotate).withZone(timeZone).toString()); } } }</code><technical_language>I lastRotate avoid additional system call</technical_language>

Target:
private void updateRotationTimers() { lastRotate = System.currentTimeMillis(); if(log.isDebugEnabled() && rotateIntervalMs > 0) { log.debug("Update last rotation timer. Next rotation for will be in {}ms", tp, rotateIntervalMs); } if (rotateScheduleIntervalMs > 0) { nextScheduledRotate = DateTimeUtils.getNextTimeAdjustedByDay(lastRotate, rotateScheduleIntervalMs, timeZone); if (log.isDebugEnabled()) { log.debug("Update scheduled rotation timer. Next rotation for will be at {}", tp, new DateTime(nextScheduledRotate).withZone(timeZone).toString()); } } }
Source:
<code>private void getClassNamesOfPrimitiveFields(Schema schema, Set<String> result, Set<Schema> seenSchemas) { if (seenSchemas.contains(schema)) { return; } seenSchemas.add(schema); switch (schema.getType()) { case RECORD: for (Schema.Field field : schema.getFields()) { getClassNamesOfPrimitiveFields(field.schema(), result, seenSchemas); } break; case MAP: getClassNamesOfPrimitiveFields(schema.getValueType(), result, seenSchemas); break; case ARRAY: getClassNamesOfPrimitiveFields(schema.getElementType(), result, seenSchemas); break; case UNION: for (Schema s : schema.getTypes()) getClassNamesOfPrimitiveFields(s, result, seenSchemas); break; case ENUM: <START> case FIXED: <END> String convertedLogicalType = getConvertedLogicalType(schema); if (convertedLogicalType != null) { result.add(convertedLogicalType); } break; case NULL: break; case STRING: case BYTES: case INT: case LONG: case FLOAT: case DOUBLE: case BOOLEAN: result.add(javaType(schema, true)); break; default: throw new RuntimeException("Unknown type: " + schema); } }</code><technical_language>ENUM case fall here! This issue, more clear give break;</technical_language>

Target:
private void getClassNamesOfPrimitiveFields(Schema schema, Set<String> result, Set<Schema> seenSchemas) { if (seenSchemas.contains(schema)) { return; } seenSchemas.add(schema); switch (schema.getType()) { case RECORD: for (Schema.Field field : schema.getFields()) { getClassNamesOfPrimitiveFields(field.schema(), result, seenSchemas); } break; case MAP: getClassNamesOfPrimitiveFields(schema.getValueType(), result, seenSchemas); break; case ARRAY: getClassNamesOfPrimitiveFields(schema.getElementType(), result, seenSchemas); break; case UNION: for (Schema s : schema.getTypes()) getClassNamesOfPrimitiveFields(s, result, seenSchemas); break; case NULL: break; case ENUM: case FIXED: case STRING: case BYTES: case INT: case LONG: case FLOAT: case DOUBLE: case BOOLEAN: result.add(javaType(schema, true)); break; default: throw new RuntimeException("Unknown type: " + schema); } }
Source:
<code>public <T extends Modifiable> void update(T container, int delta) throws SlickException { if (input.isKeyPressed(keyCode)) { setChanged(); } <START> notifyObservers(); <END> }</code><technical_language>call notifyObservers() redundant change? put in if statement instead</technical_language>

Target:
public <T extends Modifiable> void update(T container, int delta) throws SlickException { if (input.isKeyPressed(keyCode)) { setChanged(); notifyObservers(); } }
Source:
<code>public void testBraceElisionForAggregateInit2_WithNonAggregate_543038() throws Exception { BindingAssertionHelper bh = getAssertionHelper(); bh.assertNonProblem("foo({level1{{1,2}}})", 3); ICPPConstructor ctor = bh.assertNonProblem("level1(level0 a)", "level1"); <START> ICPPASTSimpleTypeConstructorExpression typeConstructorExpr = bh.assertNode("level1{{1,2}};", "level1{{1,2}}"); <END> IASTImplicitName[] implicitNames = ((IASTImplicitNameOwner) typeConstructorExpr).getImplicitNames(); assertEquals(ctor, implicitNames[0].resolveBinding()); bh.assertImplicitName("level1{1,2};", 6, IProblemBinding.class); bh.assertProblem("foo({{{1,2,3}}}", 3); }</code><technical_language>writing a new patch anyways, change this assertImplicitName() discussed previously</technical_language>

Target:
public void testBraceElisionForAggregateInit2_WithNonAggregate_543038() throws Exception { BindingAssertionHelper bh = getAssertionHelper(); bh.assertNonProblem("foo({level1{{1,2}}})", 3); bh.assertImplicitName("level1{{1,2}};", 6, ICPPConstructor.class); bh.assertImplicitName("level1{1,2};", 6, IProblemBinding.class); bh.assertProblem("foo({{{1,2,3}}}", 3); }
Source:
<code>public synchronized static Workspace getWorkspace() throws Exception { if (instance == null) throw new IllegalStateException("Central has not been initialised"); if (workspace != null) return workspace; Workspace newWorkspace = null; try { Workspace.setDriver(Constants.BNDDRIVER_ECLIPSE); Workspace.addGestalt(Constants.GESTALT_INTERACTIVE, new Attrs()); newWorkspace = Workspace.getWorkspace(getWorkspaceDirectory()); newWorkspace.addBasicPlugin(new WorkspaceListener(newWorkspace)); newWorkspace.addBasicPlugin(instance.repoListenerTracker); newWorkspace.addBasicPlugin(getWorkspaceR5Repository()); Set<Object> progressPlugins = new HashSet<>(); for (Object plugin : newWorkspace.getPlugins()) { if (plugin instanceof ProgressPlugin) { progressPlugins.add(plugin); } } for (Object plugin : progressPlugins) { newWorkspace.removeBasicPlugin(plugin); } <START> <END> newWorkspace.addBasicPlugin(new JobProgress()); newWorkspace.getBuildOrder(); addCnfChangeListener(newWorkspace); workspaceRepositoryChangeDetector = new WorkspaceRepositoryChangeDetector(newWorkspace); synchronized (workspaceInitCallbackQueue) { workspace = newWorkspace; while (!workspaceInitCallbackQueue.isEmpty()) { Function<Workspace,Void> callback = workspaceInitCallbackQueue.remove(0); callback.apply(workspace); } } return workspace; } catch (final Exception e) { if (newWorkspace != null) { newWorkspace.close(); } throw e; } }</code><technical_language>remove BndProgress plugin vs. ProgressPlugins</technical_language>

Target:
public static Workspace getWorkspace() throws Exception { synchronized (Central.class) { if (instance == null) throw new IllegalStateException("Central has not been initialised"); if (workspace != null) return workspace; Workspace newWorkspace = null; try { Workspace.setDriver(Constants.BNDDRIVER_ECLIPSE); Workspace.addGestalt(Constants.GESTALT_INTERACTIVE, new Attrs()); newWorkspace = Workspace.getWorkspace(getWorkspaceDirectory()); newWorkspace.addBasicPlugin(new WorkspaceListener(newWorkspace)); newWorkspace.addBasicPlugin(instance.repoListenerTracker); newWorkspace.addBasicPlugin(getWorkspaceR5Repository()); newWorkspace.addBasicPlugin(new JobProgress()); newWorkspace.getBuildOrder(); addCnfChangeListener(newWorkspace); workspaceRepositoryChangeDetector = new WorkspaceRepositoryChangeDetector(newWorkspace); workspace = newWorkspace; } catch (final Exception e) { if (newWorkspace != null) { newWorkspace.close(); } throw e; } } notifyCallbacks(); return workspace; }
Source:
<code><START> public boolean validateSpinner(Spinner spinner) { <END> return spinner.getAdapter().getCount() == 1 || (spinner.getSelectedItemPosition() >= 0 && spinner.getItemIdAtPosition(spinner.getSelectedItemPosition()) >= 1); }</code><technical_language>This method private for I think. move this method validateNotEmpty similar methods close other. :)</technical_language>

Target:
private static boolean validateSpinner(Spinner spinner) { return spinner.getAdapter().getCount() == 1 || (spinner.getSelectedItemPosition() >= 0 && spinner.getItemIdAtPosition(spinner.getSelectedItemPosition()) >= 1); }
Source:
<code>protected String getTestDataPath() { <START> return "testData/quickfixes/ambiguous/"; <END> }</code><technical_language>ambigous_call maybe</technical_language>

Target:
protected String getTestDataPath() { return "testData/quickfixes/ambiguous_call/"; }
Source:
<code>private SqlConnection getCompactionConnection() { SqlConnection sqlConnection = conns.get(); try { int originalNetworkTimeout = sqlConnection.getUnderlyingConnection().getNetworkTimeout(); <START> int newNetworkMillis = config.compactionConnectionTimeout() > Integer.MAX_VALUE <END> ? (int) config.compactionConnectionTimeout() : Integer.MAX_VALUE; log.info("Increased sql socket read timeout from to {}", SafeArg.of("originalNetworkTimeout", originalNetworkTimeout), SafeArg.of("newNetworkTimeout", newNetworkMillis)); sqlConnection.getUnderlyingConnection().setNetworkTimeout(compactionTimeoutExecutor, newNetworkMillis); } catch (SQLException e) { log.warn("Failed to increase socket read timeout for the connection. Encountered an exception:", e); } return sqlConnection; }</code><technical_language>this is Ints.saturatedCast(config.compactionConnectionTimeout()) I</technical_language>

Target:
private SqlConnection getCompactionConnection() { SqlConnection sqlConnection = conns.get(); try { int originalNetworkTimeout = sqlConnection.getUnderlyingConnection().getNetworkTimeout(); int newNetworkMillis = Ints.saturatedCast(config.compactionConnectionTimeout()); log.info("Increased sql socket read timeout from to {}", SafeArg.of("originalNetworkTimeoutMillis", originalNetworkTimeout), SafeArg.of("newNetworkTimeoutMillis", newNetworkMillis)); sqlConnection.getUnderlyingConnection().setNetworkTimeout(compactionTimeoutExecutor, newNetworkMillis); } catch (SQLException e) { log.warn("Failed to increase socket read timeout for the connection. Encountered an exception:", e); } return sqlConnection; }
Source:
<code>public static <T> T parseJson(Path path, Class<T> javaType) { if (!path.isAbsolute()) { path = path.toAbsolutePath(); } checkArgument(exists(path), "File does not exist: " + path); <START> checkArgument(isReadable(path), "File is not readable: " + path); <END> try { byte[] json = Files.readAllBytes(path); ObjectMapper mapper = new ObjectMapperProvider().get() .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); return mapper.readValue(json, javaType); } catch (IOException e) { throw new IllegalArgumentException(format("Invalid JSON file '%s' for '%s'", path, javaType), e); } }</code><technical_language>%s for formatting exc msg in check*</technical_language>

Target:
public static <T> T parseJson(Path path, Class<T> javaType) { if (!path.isAbsolute()) { path = path.toAbsolutePath(); } checkArgument(exists(path), "File does not exist: %s", path); checkArgument(isReadable(path), "File is not readable: %s", path); try { byte[] json = Files.readAllBytes(path); ObjectMapper mapper = new ObjectMapperProvider().get() .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); return mapper.readValue(json, javaType); } catch (IOException e) { throw new IllegalArgumentException(format("Invalid JSON file '%s' for '%s'", path, javaType), e); } }
Source:
<code>private String getNullTerminatedString(HpccSrcType stype) throws IOException { Charset charset = sbcSet; switch (stype) { case SINGLE_BYTE_CHAR: charset = sbcSet; break; case UTF16BE: charset = utf16beSet; break; case UTF16LE: charset = utf16leSet; break; default: throw new IOException("Unsupported source type for null terminated string: " + stype); } int strByteLen = 0; if (stype.isUTF16()) { int eosLocation = -1; while (eosLocation < 0) { int readSize = this.inputStream.available(); readSize = (readSize / 2) * 2; this.inputStream.mark(readSize); readIntoScratchBuffer(strByteLen, readSize); for (int j = 0; j < readSize-1; j += 2) { if (scratchBuffer[j] == '\0' && scratchBuffer[j + 1] == '\0') { eosLocation = j; break; } } if (eosLocation != -1) { strByteLen += eosLocation; this.inputStream.reset(); this.inputStream.skip(eosLocation + 2); break; } else { strByteLen += readSize; } } } else { <START> int eosLocation = -1; <END> while (eosLocation < 0) { int readSize = this.inputStream.available(); this.inputStream.mark(readSize); readIntoScratchBuffer(strByteLen, readSize); for (int j = 0; j < readSize; j++) { if (scratchBuffer[j] == '\0') { eosLocation = j; break; } } if (eosLocation != -1) { strByteLen += eosLocation; this.inputStream.reset(); this.inputStream.skip(eosLocation + 1); break; } else { strByteLen += readSize; } } } return new String(scratchBuffer,0,strByteLen,charset); }</code><technical_language>move eosLocation declaration initialization of if else block (line 847)</technical_language>

Target:
private String getNullTerminatedString(HpccSrcType stype) throws IOException { Charset charset = sbcSet; switch (stype) { case SINGLE_BYTE_CHAR: charset = sbcSet; break; case UTF16BE: charset = utf16beSet; break; case UTF16LE: charset = utf16leSet; break; default: throw new IOException("Unsupported source type for null terminated string: " + stype); } int eosLocation = -1; int strByteLen = 0; if (stype.isUTF16()) { while (eosLocation < 0) { int readSize = this.inputStream.available(); readSize = (readSize / 2) * 2; this.inputStream.mark(readSize); readIntoScratchBuffer(strByteLen, readSize); for (int j = 0; j < readSize-1; j += 2) { if (scratchBuffer[j] == '\0' && scratchBuffer[j + 1] == '\0') { eosLocation = j; break; } } if (eosLocation != -1) { strByteLen += eosLocation; this.inputStream.reset(); this.inputStream.skip(eosLocation + 2); break; } else { strByteLen += readSize; } } } else { while (eosLocation < 0) { int readSize = this.inputStream.available(); this.inputStream.mark(readSize); readIntoScratchBuffer(strByteLen, readSize); for (int j = 0; j < readSize; j++) { if (scratchBuffer[j] == '\0') { eosLocation = j; break; } } if (eosLocation != -1) { strByteLen += eosLocation; this.inputStream.reset(); this.inputStream.skip(eosLocation + 1); break; } else { strByteLen += readSize; } } } return new String(scratchBuffer,0,strByteLen,charset); }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { LOGGER.debug("Performing doFilter() on CsrfFilter"); HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; String targetContextPath = httpRequest.getRequestURI(); String requestMethod = httpRequest.getMethod(); String userAgentHeader = httpRequest.getHeader(HttpHeaders.USER_AGENT); if (protectedContexts.stream().anyMatch(targetContextPath::startsWith)) { String sourceOrigin = httpRequest.getHeader(ORIGIN_HEADER); String sourceReferer = httpRequest.getHeader(REFERER_HEADER); String csrfHeader = httpRequest.getHeader(CSRF_HEADER); if (sourceOrigin == null && sourceReferer == null) { respondForbidden( httpResponse, "Cross-site check failure: Incoming request did not have an Origin or Referer header."); return; } if (!isTrustedAuthority(sourceOrigin) && !isTrustedAuthority(sourceReferer)) { respondForbidden( httpResponse, "Cross-site check failure: Neither the Origin nor Referer header matched a system internal or external name."); return; } String whitelistKey = getMultivaluedMapKey(BROWSER_PROTECTION_WHITELIST, targetContextPath); if (csrfHeader == null && !(whitelistKey != null && BROWSER_PROTECTION_WHITELIST.get(whitelistKey).contains(requestMethod))) { respondForbidden( httpResponse, "Cross-site check failure: Request did not have required X-Requested-With header."); return; } } if (targetContextPath.startsWith(SERVICE_CONTEXT)) { String whitelistKey = getMultivaluedMapKey(SYSTEM_PROTECTION_WHITELIST, targetContextPath); if (userAgentHeader != null <START> && !userAgentHeader.equals("Apache-CXF/3.2.5") <END> && !userAgentHeader.equals("Google-HTTP-Java-Client/1.22.0 (gzip)") && !(whitelistKey != null && SYSTEM_PROTECTION_WHITELIST.get(whitelistKey).contains(requestMethod))) { respondForbidden( httpResponse, "Cross-site check failure: Request did not have required X-Requested-With header."); return; } } chain.doFilter(request, response); }</code><technical_language>strings constants? version number in worries me. upgrade libraries need remember update this code well</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { LOGGER.debug("Performing doFilter() on CsrfFilter"); HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; String targetContextPath = httpRequest.getRequestURI(); String requestMethod = httpRequest.getMethod(); String userAgentHeader = httpRequest.getHeader(HttpHeaders.USER_AGENT); if (protectedContexts.stream().anyMatch(targetContextPath::startsWith) && doBrowserProtectionFilter(httpRequest, httpResponse, targetContextPath, requestMethod)) { return; } if (targetContextPath.startsWith(SERVICE_CONTEXT) && doSystemProtectionFilter( httpResponse, targetContextPath, requestMethod, userAgentHeader)) { return; } chain.doFilter(request, response); }
Source:
<code>public void sendFeedbackToPeergos() throws Exception { <START> UserContext u1 = PeergosNetworkUtils.ensureSignedUp("peergos", "testpassword", network, crypto); <END> UserContext u2 = PeergosNetworkUtils.ensureSignedUp("w", "w", network, crypto); String feedback = "Here's some constructive feedback!"; CompletableFuture<Boolean> testFeedbackSubmission = u2.submitFeedback(feedback); assertTrue("Feedback submission was successful!", testFeedbackSubmission.get() == true); List<FollowRequestWithCipherText> u1Requests = u1.processFollowRequests().get(); u1.sendReplyFollowRequest(u1Requests.get(0), true, true).get(); Optional<FileWrapper> u2ToU1 = u1.getByPath("/" + u2.username + "/feedback").get(); Set<FileWrapper> feedbackDirectoryContents = u2ToU1.get().getChildren(u2.network).get(); assertTrue("Feedback directory is non-empty", !feedbackDirectoryContents.isEmpty()); for (FileWrapper feedbackFile : feedbackDirectoryContents) { assertTrue("Feedback file is readable", feedbackFile.isReadable()); AsyncReader inputStream = feedbackFile .getInputStream(u1.network, u1.crypto.random, l -> {}) .get(); byte[] fileContents = Serialize.readFully(inputStream, feedbackFile.getFileProperties().size).get(); String reportedFeedback = new String(fileContents); assertTrue("Feedback file contents correct", Objects.equals(feedback, reportedFeedback)); } }</code><technical_language>peergos is a clearer name u1</technical_language>

Target:
public void sendFeedbackToPeergos() throws Exception { UserContext peergos = PeergosNetworkUtils.ensureSignedUp("peergos", "testpassword", network, crypto); UserContext newUser = PeergosNetworkUtils.ensureSignedUp("newUser", "newUserPassword", network, crypto); String feedback = "Here's some constructive feedback!"; CompletableFuture<Boolean> testFeedbackSubmission = newUser.submitFeedback(feedback); assertTrue("Feedback submission was successful!", testFeedbackSubmission.get() == true); List<FollowRequestWithCipherText> peergosRequests = peergos.processFollowRequests().get(); for (FollowRequestWithCipherText request : peergosRequests) { peergos.sendReplyFollowRequest(request, true, true).get(); } Optional<FileWrapper> newUserToPeergos = peergos.getByPath("/" + newUser.username + "/feedback").get(); Set<FileWrapper> feedbackDirectoryContents = newUserToPeergos.get().getChildren(newUser.network).get(); assertTrue("Feedback directory is non-empty", !feedbackDirectoryContents.isEmpty()); for (FileWrapper feedbackFile : feedbackDirectoryContents) { assertTrue("Feedback file is readable", feedbackFile.isReadable()); AsyncReader inputStream = feedbackFile .getInputStream(peergos.network, peergos.crypto.random, l -> {}) .get(); byte[] fileContents = Serialize.readFully(inputStream, feedbackFile.getFileProperties().size).get(); String reportedFeedback = new String(fileContents); assertTrue("Feedback file contents correct", Objects.equals(feedback, reportedFeedback)); } }