auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testMultipleAcceptEncodingHeaders() { FullHttpRequest request = newRequest(); request.headers().set(HttpHeaderNames.ACCEPT_ENCODING, "unknown") .add(HttpHeaderNames.ACCEPT_ENCODING, "gzip") .add(HttpHeaderNames.ACCEPT_ENCODING, "deflate"); EmbeddedChannel ch = new EmbeddedChannel(new HttpContentCompressor()); <START> ch.writeInbound(request); <END> FullHttpResponse res = new DefaultFullHttpResponse( HttpVersion.HTTP_1_1, HttpResponseStatus.OK, Unpooled.copiedBuffer("Gzip Win", CharsetUtil.US_ASCII)); ch.writeOutbound(res); assertEncodedResponse(ch); HttpContent c = ch.readOutbound(); assertThat(ByteBufUtil.hexDump(c.content()), is("1f8b080000000000000072afca2c5008cfcc03000000ffff")); c.release(); c = ch.readOutbound(); assertThat(ByteBufUtil.hexDump(c.content()), is("03001f2ebf0f08000000")); c.release(); LastHttpContent last = ch.readOutbound(); assertThat(last.content().readableBytes(), is(0)); last.release(); assertThat(ch.readOutbound(), is(nullValue())); assertTrue(ch.finishAndReleaseAll()); }</code><technical_language>assert return</technical_language>

Target:
public void testMultipleAcceptEncodingHeaders() { FullHttpRequest request = newRequest(); request.headers().set(HttpHeaderNames.ACCEPT_ENCODING, "unknown; q=1.0") .add(HttpHeaderNames.ACCEPT_ENCODING, "gzip; q=0.5") .add(HttpHeaderNames.ACCEPT_ENCODING, "deflate; q=0"); EmbeddedChannel ch = new EmbeddedChannel(new HttpContentCompressor()); assertTrue(ch.writeInbound(request)); FullHttpResponse res = new DefaultFullHttpResponse( HttpVersion.HTTP_1_1, HttpResponseStatus.OK, Unpooled.copiedBuffer("Gzip Win", CharsetUtil.US_ASCII)); assertTrue(ch.writeOutbound(res)); assertEncodedResponse(ch); HttpContent c = ch.readOutbound(); assertThat(ByteBufUtil.hexDump(c.content()), is("1f8b080000000000000072afca2c5008cfcc03000000ffff")); c.release(); c = ch.readOutbound(); assertThat(ByteBufUtil.hexDump(c.content()), is("03001f2ebf0f08000000")); c.release(); LastHttpContent last = ch.readOutbound(); assertThat(last.content().readableBytes(), is(0)); last.release(); assertThat(ch.readOutbound(), is(nullValue())); assertTrue(ch.finishAndReleaseAll()); }
Source:
<code>public Optional<ItemType> getRepairItemType() { <START> switch (name) { <END> case "diamond": return Optional.of(ItemTypes.DIAMOND); case "gold": return Optional.of(ItemTypes.GOLD_INGOT); case "leather": return Optional.of(ItemTypes.LEATHER); case "iron": return Optional.of(ItemTypes.IRON_INGOT); default: return Optional.empty(); } }</code><technical_language>Instead of a switch, lazy evaluating fields</technical_language>

Target:
public Optional<ItemType> getRepairItemType() { if (this.repairItemType == null) { this.repairItemType = Optional.ofNullable((ItemType) shadow$getRepairItem()); } return this.repairItemType; }
Source:
<code>private void restoreMetaData(final String objectName, final Metadata metadata) { final String osName = System.getProperty("os.name"); final MetaDataRestore metaDataRestore = new MetaDataRestoreFactory().getOSSpecificMetadataRestore(metadata, objectName, osName,metaDataRestoreListener); metaDataRestore.restoreOSName(); metaDataRestore.restoreUserAndOwner(); metaDataRestore.restoreFileTimes(); metaDataRestore.restorePermissions(); <START> if (metaDataRestore instanceof WindowsMetaDataRestore) { <END> ((WindowsMetaDataRestore) metaDataRestore).restoreFlags(); } }</code><technical_language>If OS-specific restorer, need cast a specific subclass</technical_language>

Target:
private void restoreMetaData(final String objectName, final Metadata metadata) { final String osName = System.getProperty("os.name"); final MetadataRestore metadataRestore = new MetadataRestoreFactory().getOSSpecificMetadataRestore(metadata, objectName, osName, metadataRestoreListener); metadataRestore.restoreOSName(); metadataRestore.restoreUserAndOwner(); metadataRestore.restoreFileTimes(); metadataRestore.restorePermissions(); }
Source:
<code>public void meshProxy_exactlyOneUri() throws Exception { <START> ServiceConfiguration invalidServiceConfig = ServiceConfiguration.builder() <END> .uris(ImmutableList.of("uri1", "uri2")) .security(SslConfiguration.of(Paths.get("src/test/resources/trustStore.jks"))) .proxy(ProxyConfiguration.mesh("localhost:1234")) .maxNumRetries(0) .build(); assertThatThrownBy(() -> ClientConfigurations.of(invalidServiceConfig)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("If meshProxy is configured then uris must contain exactly 1 URI"); }</code><technical_language>fine making a test-local factory method tests shorter. (didn't want bloat public API main/ another factory)</technical_language>

Target:
public void meshProxy_exactlyOneUri() throws Exception { assertThatThrownBy(() -> ClientConfigurations.of(meshProxyServiceConfig(ImmutableList.of("uri1", "uri2"), 0))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("If meshProxy is configured then uris must contain exactly 1 URI"); }
Source:
<code>public void rebuildDB() { Set<Long> staleDataSources = getStaleDataSourceIds(); <START> if (!staleDataSources.isEmpty()) { <END> staleDataSources.forEach((id) -> { queueDBTask(new CopyAnalyzedFiles(id, instance, db, sleuthKitCase)); }); } }</code><technical_language>this is a no-op if stateDataSources is empty. I skip explicit test self..</technical_language>

Target:
public void rebuildDB() { getStaleDataSourceIds().forEach((dataSourceObjId) -> { queueDBTask(new CopyAnalyzedFiles(dataSourceObjId, instance, db, sleuthKitCase)); }); }
Source:
<code><START> void testRemoveFields(boolean addToAvailable, <END> boolean definitionHasFields) { if (definitionHasFields) { when(formDefinition.getFields()).thenReturn(new ArrayList<>(employeeFields)); content.setDefinition(formDefinition); } int prevAvailableSize = formEditorHelper.getAvailableFields().size(); FieldDefinition removedField = formEditorHelper.removeField(nameField.getId(), addToAvailable); assertEquals("It should " + (addToAvailable ? " " : "not ") + "add the field to the available fields", formEditorHelper.getAvailableFields().size(), prevAvailableSize + (addToAvailable && definitionHasFields ? 1 : 0)); assertFalse("Removed field should " + (definitionHasFields ? "not " : " ") + "be null", (removedField == null) == definitionHasFields); }</code><technical_language>for new methods</technical_language>

Target:
private void testRemoveFields(boolean addToAvailable, boolean definitionHasFields) { if (definitionHasFields) { when(formDefinition.getFields()).thenReturn(new ArrayList<>(employeeFields)); content.setDefinition(formDefinition); } int prevAvailableSize = formEditorHelper.getAvailableFields().size(); FieldDefinition removedField = formEditorHelper.removeField(nameField.getId(), addToAvailable); assertEquals("It should " + (addToAvailable ? " " : "not ") + "add the field to the available fields", formEditorHelper.getAvailableFields().size(), prevAvailableSize + (addToAvailable && definitionHasFields ? 1 : 0)); assertFalse("Removed field should " + (definitionHasFields ? "not " : " ") + "be null", (removedField == null) == definitionHasFields); }
Source:
<code>public Opt<Identity> enter(final Request req) throws IOException { final Iterator<String> headers = new RqHeaders.Base(req) .header(this.header).iterator(); Opt<Identity> user = new Opt.Empty<>(); String head = ""; while (headers.hasNext()) { final String nexthead = headers.next(); <START> final UncheckedText trimmed = new UncheckedText( <END> new Trimmed(new TextOf(nexthead)) ); if (trimmed.asString().startsWith("Bearer")) { head = nexthead; break; } } final String dot = "\\."; if (!head.isEmpty()) { final String jwt = new UncheckedText( new Trimmed(new TextOf(head.split(" ", 2)[1])) ).asString(); final String[] parts = jwt.split(dot); final byte[] jwtheader = parts[0].getBytes( Charset.defaultCharset() ); final byte[] jwtpayload = parts[1].getBytes( Charset.defaultCharset() ); final byte[] jwtsign = parts[2].getBytes(Charset.defaultCharset()); final ByteBuffer tocheck = ByteBuffer.allocate( jwtheader.length + jwtpayload.length + 1 ); tocheck.put(jwtheader).put(".".getBytes(Charset.defaultCharset())) .put(jwtpayload); final byte[] checked = this.signature.sign(tocheck.array()); if (Arrays.equals(jwtsign, checked)) { try (JsonReader rdr = Json.createReader( new StringReader( new String( Base64.getDecoder().decode(jwtpayload), Charset.defaultCharset() ) ) )) { user = new Opt.Single<>( new Identity.Simple( rdr.readObject().getString(Token.Jwt.SUBJECT) ) ); } } } return user; }</code><technical_language>@fanifieiev Please try Text instead of String here. inline this code PrefixOf decorator</technical_language>

Target:
public Opt<Identity> enter(final Request req) throws IOException { Opt<Identity> user = new Opt.Empty<>(); final UncheckedText head = new Unchecked<>( new FirstOf<>( text -> new Trimmed(text).asString().startsWith("Bearer"), new Mapped<>( UncheckedText::new, new RqHeaders.Base(req).header(this.header) ), new Constant<>(new UncheckedText("")) ) ).value(); if (new Unchecked<>(new Not(new IsBlank(head))).value()) { final String jwt = new UncheckedText( new Trimmed(new TextOf(head.asString().split(" ", 2)[1])) ).asString(); final String[] parts = jwt.split("\\."); final byte[] jwtheader = parts[0].getBytes( Charset.defaultCharset() ); final byte[] jwtpayload = parts[1].getBytes( Charset.defaultCharset() ); final byte[] jwtsign = parts[2].getBytes(Charset.defaultCharset()); final ByteBuffer tocheck = ByteBuffer.allocate( jwtheader.length + jwtpayload.length + 1 ); tocheck.put(jwtheader).put(".".getBytes(Charset.defaultCharset())) .put(jwtpayload); final byte[] checked = this.signature.sign(tocheck.array()); if (Arrays.equals(jwtsign, checked)) { try (JsonReader rdr = Json.createReader( new StringReader( new String( Base64.getDecoder().decode(jwtpayload), Charset.defaultCharset() ) ) )) { user = new Opt.Single<>( new Identity.Simple( rdr.readObject().getString(Token.Jwt.SUBJECT) ) ); } } } return user; }
Source:
<code>public static QName valueOf(final String qNameAsString) { if (qNameAsString == null) { throw new IllegalArgumentException( <START> "cannot create QName from \"null\" or \"\" String"); <END> } if (qNameAsString.length() == 0) { return new javax.xml.namespace.QName(XMLConstants.NULL_NS_URI, qNameAsString, XMLConstants.DEFAULT_NS_PREFIX); } if (qNameAsString.charAt(0) != '{') { return new javax.xml.namespace.QName(XMLConstants.NULL_NS_URI, qNameAsString, XMLConstants.DEFAULT_NS_PREFIX); } if (qNameAsString.startsWith("{" + XMLConstants.NULL_NS_URI + "}")) { throw new IllegalArgumentException( "Namespace URI .equals(XMLConstants.NULL_NS_URI), " + ".equals(\"" + XMLConstants.NULL_NS_URI + "\"), " + "only the local part, " + "\"" + qNameAsString.substring(2 + XMLConstants.NULL_NS_URI.length()) + "\", " + "should be provided."); } int endOfNamespaceURI = qNameAsString.indexOf('}'); if (endOfNamespaceURI == -1) { throw new IllegalArgumentException( "cannot create QName from \"" + qNameAsString + "\", missing closing \"}\""); } return new javax.xml.namespace.QName(qNameAsString.substring(1, endOfNamespaceURI), qNameAsString.substring(endOfNamespaceURI + 1), XMLConstants.DEFAULT_NS_PREFIX); }</code><technical_language>line? create QName \"\" String in if block</technical_language>

Target:
public static QName valueOf(final String qNameAsString) { if (Objects.isNull(qNameAsString)) { throw new IllegalArgumentException("cannot create QName from \"null\""); } if (qNameAsString.length() == 0) { return new javax.xml.namespace.QName(XMLConstants.NULL_NS_URI, qNameAsString, XMLConstants.DEFAULT_NS_PREFIX); } if (qNameAsString.charAt(0) != '{') { return new javax.xml.namespace.QName(XMLConstants.NULL_NS_URI, qNameAsString, XMLConstants.DEFAULT_NS_PREFIX); } if (qNameAsString.startsWith("{" + XMLConstants.NULL_NS_URI + "}")) { throw new IllegalArgumentException("Namespace URI .equals(XMLConstants.NULL_NS_URI), " + ".equals(\"" + XMLConstants.NULL_NS_URI + "\"), " + "only the local part, " + "\"" + qNameAsString.substring(2 + XMLConstants.NULL_NS_URI.length()) + "\", " + "should be provided."); } final int endOfNamespaceURI = qNameAsString.indexOf('}'); if (endOfNamespaceURI == -1) { throw new IllegalArgumentException("cannot create QName from \"" + qNameAsString + "\", missing closing \"}\""); } return new javax.xml.namespace.QName(qNameAsString.substring(1, endOfNamespaceURI), qNameAsString.substring(endOfNamespaceURI + 1), XMLConstants.DEFAULT_NS_PREFIX); }
Source:
<code>public static Ds3ClientHelpers.Job getLoadJob(final Ds3Client client, final String bucketName, final String resourceBaseName) throws IOException, SignatureException, XmlProcessingException, URISyntaxException { final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(client); final List<Ds3Object> objects = new ArrayList<>(); for(final String book : BOOKS) { <START> final Path objFile = ResourceUtils.loadFileResource(resourceBaseName + book); <END> final Ds3Object obj = new Ds3Object(book, Files.size(objFile)); objects.add(obj); } return helpers .startWriteJob(bucketName, objects); }</code><technical_language>Is a reason this is called objFile is a Path object</technical_language>

Target:
public static Ds3ClientHelpers.Job getLoadJob(final Ds3Client client, final String bucketName, final String resourceBaseName) throws IOException, SignatureException, XmlProcessingException, URISyntaxException { final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(client); final List<Ds3Object> objects = new ArrayList<>(); for(final String book : BOOKS) { final Path objPath = ResourceUtils.loadFileResource(resourceBaseName + book); final Ds3Object obj = new Ds3Object(book, Files.size(objPath)); objects.add(obj); } return helpers .startWriteJob(bucketName, objects); }
Source:
<code>public String toString() { return "SampleTissueDto [bioBankId=" + bioBankId + ", cellularity=" + cellularity + ", createdById=" + createdById + ", createdByUrl=" + createdByUrl + ", creationDate=" + creationDate + ", id=" + id + ", labUrl=" + labUrl + ", instituteTissueName=" + instituteTissueName + ", lastUpdated=" + lastUpdated + ", updatedById=" + updatedById + ", updatedByUrl=" + updatedByUrl + ", url=" + url + "]"; <START> } <END></code><technical_language>labUrl needs out well, added in SampleAdditionalInfoDto</technical_language>

Target:
public String toString() { return "SampleTissueDto [bioBankId=" + bioBankId + ", cellularity=" + cellularity + ", createdById=" + createdById + ", createdByUrl=" + createdByUrl + ", creationDate=" + creationDate + ", id=" + id + ", instituteTissueName=" + instituteTissueName + ", lastUpdated=" + lastUpdated + ", updatedById=" + updatedById + ", updatedByUrl=" + updatedByUrl + ", url=" + url + "]"; }
Source:
<code>public boolean writeOutbound(Object... msgs) { ensureOpen(); if (msgs.length == 0) { return isNotEmpty(outboundMessages); } RecyclableArrayList futures = RecyclableArrayList.newInstance(msgs.length); try { for (Object m: msgs) { if (m == null) { break; } futures.add(write(m)); } flushOutbound0(); for (Object o : futures) { <START> ChannelFuture future = (ChannelFuture) o; <END> if (future.isDone()) { recordException(future); } else { future.addListener(recordExceptionListener); } } checkException(); return isNotEmpty(outboundMessages); } finally { futures.recycle(); } }</code><technical_language>please revert this change</technical_language>

Target:
public boolean writeOutbound(Object... msgs) { ensureOpen(); if (msgs.length == 0) { return isNotEmpty(outboundMessages); } RecyclableArrayList futures = RecyclableArrayList.newInstance(msgs.length); try { for (Object m: msgs) { if (m == null) { break; } futures.add(write(m)); } flushOutbound0(); int size = futures.size(); for (int i = 0; i < size; i++) { ChannelFuture future = (ChannelFuture) futures.get(i); if (future.isDone()) { recordException(future); } else { future.addListener(recordExceptionListener); } } checkException(); return isNotEmpty(outboundMessages); } finally { futures.recycle(); } }
Source:
<code>public RuleChain around(TestRule enclosedRule) { if (enclosedRule == null) { <START> throw new IllegalArgumentException("The enclosed rule should not be null"); <END> } List<TestRule> rulesOfNewChain = new ArrayList<TestRule>(); rulesOfNewChain.add(enclosedRule); rulesOfNewChain.addAll(rulesStartingWithInnerMost); return new RuleChain(rulesOfNewChain); }</code><technical_language>generally throw NullPointerException if passes in a null for a parameter null (this is Java Collections library Effective Java recommends)</technical_language>

Target:
public RuleChain around(TestRule enclosedRule) { if (enclosedRule == null) { throw new NullPointerException("The enclosed rule must not be null"); } List<TestRule> rulesOfNewChain = new ArrayList<TestRule>(); rulesOfNewChain.add(enclosedRule); rulesOfNewChain.addAll(rulesStartingWithInnerMost); return new RuleChain(rulesOfNewChain); }
Source:
<code>protected Object getOutputValueForAccessor(String field, Object input) { if (field != null && (field.equals("Result") || field.equals("Standalone")) && input == null) { return false; <START> } <END> return input; }</code><technical_language>leftovers StatusDTOTest. return input; is enough this DTO primitives</technical_language>

Target:
protected Object getOutputValueForAccessor(String field, Object input) { return input; }
Source:
<code>public void testRemoveSite(String opHost, String redirectUrl) throws Exception { final DevelopersApi api = Tester.api(); RegisterSiteResponseData response = RegisterSiteTest.registerSite(api, opHost, redirectUrl); String oxdId = response.getOxdId(); RemoveSiteParams params = new RemoveSiteParams(); params.setOxdId(oxdId); ApiResponse<UpdateSiteResponse> apiResponse = <START> api.removeSiteWithHttpInfo(Tester.getAuthorization(), params); <END> assertTrue(apiResponse.getStatusCode() == 200); assertNotNull(apiResponse); assertNotNull(apiResponse.getData()); UpdateSiteResponse removeSiteResponse = apiResponse.getData(); final UpdateSiteResponseData responseData = removeSiteResponse.getData(); assertNotNull(responseData); assertTrue(StringUtils.isNotEmpty(responseData.getOxdId())); }</code><technical_language>Is reason api.removeSiteWithHttpInfo(), if call api.removeSite() need check line bellow status code is 200, swagger client automatically throw exception if is 200, no</technical_language>

Target:
public void testRemoveSite(String opHost, String redirectUrl) throws Exception { final DevelopersApi api = Tester.api(); RegisterSiteResponseData response = RegisterSiteTest.registerSite(api, opHost, redirectUrl); String oxdId = response.getOxdId(); RemoveSiteParams params = new RemoveSiteParams(); params.setOxdId(oxdId); RemoveSiteResponse removeSiteResp = api.removeSite(Tester.getAuthorization(), params); assertNotNull(removeSiteResp); final RemoveSiteResponseData responseData = removeSiteResp.getData(); assertNotNull(responseData); assertTrue(StringUtils.isNotEmpty(responseData.getOxdId())); }
Source:
<code>public FindDialog(Window parent, boolean modal) throws HeadlessException { super(parent, modal); <START> initialize(parent.toString()); <END> }</code><technical_language>toString() is reliable, for example, if parent window is resized a "name" (thus opening another find dialogue)</technical_language>

Target:
public FindDialog(Window parent, boolean modal) throws HeadlessException { super(parent, modal); initialize(); }
Source:
<code>private static OAuth2Error invalidIdToken(Map<String, Object> invalidClaims) { <START> StringBuilder claimsDetail = new StringBuilder(); <END> int i = 0; for (Map.Entry<String, Object> entry : invalidClaims.entrySet()) { claimsDetail.append(entry.getKey()).append(" (").append(entry.getValue()).append(")"); if (i != invalidClaims.size() - 1) { claimsDetail.append(", "); } i++; } return new OAuth2Error("invalid_id_token", "The ID Token contains invalid claims: " + claimsDetail, "<LINK_0>"); }</code><technical_language>Actually, this is simply error message, simply rely toString method. code easier read maintain: java return new OAuth2Error("invalid_id_token", "The ID Token contains invalid claims: " + invalidClaims, // ... Also, unit test need update</technical_language>

Target:
private static OAuth2Error invalidIdToken(Map<String, Object> invalidClaims) { return new OAuth2Error("invalid_id_token", "The ID Token contains invalid claims: " + invalidClaims, "<LINK_0>"); }
Source:
<code>public void deserializeNBT(NBTTagCompound nbt) throws InvalidInputDataException { super.deserializeNBT(nbt); palette.clear(); for (NBTTagCompound schematicBlockTag : NBTUtilBC.readCompoundList(nbt.getTagList("palette", Constants.NBT.TAG_COMPOUND)).collect(Collectors.toList())) { palette.add(SchematicBlockManager.readFromNBT(schematicBlockTag)); } data = new int[size.getX()][size.getY()][size.getZ()]; NBTTagList list = nbt.hasKey("data", Constants.NBT.TAG_LIST) ? nbt.getTagList("data", Constants.NBT.TAG_INT) : null; int[] serializedData = nbt.hasKey("data", Constants.NBT.TAG_INT_ARRAY) ? nbt.getIntArray("data") : new int[0]; int len = list == null ? serializedData.length : list.tagCount(); <START> if (len != size.getX() * size.getY() * size.getZ()) { <END> throw new InvalidInputDataException("Pallette has length of " + len + ", but we expected " + size.getX() * size.getY() * size.getZ() + size.toString()); } int i = 0; for (int z = 0; z < size.getZ(); z++) { for (int y = 0; y < size.getY(); y++) { for (int x = 0; x < size.getX(); x++) { data[x][y][z] = list == null ? serializedData[i] : list.getIntAt(i); i++; } } } for (NBTTagCompound schematicEntityTag : NBTUtilBC.readCompoundList(nbt.getTagList("entities", Constants.NBT.TAG_COMPOUND)).collect(Collectors.toList())) { entities.add(SchematicEntityManager.readFromNBT(schematicEntityTag)); } }</code><technical_language>..Don't remove this. catch handle IOException line, handle NullPointerExceptions however</technical_language>

Target:
public void deserializeNBT(NBTTagCompound nbt) throws InvalidInputDataException { super.deserializeNBT(nbt); palette.clear(); for (NBTTagCompound schematicBlockTag : NBTUtilBC.readCompoundList(nbt.getTagList("palette", Constants.NBT.TAG_COMPOUND)).collect(Collectors.toList())) { palette.add(SchematicBlockManager.readFromNBT(schematicBlockTag)); } data = new int[size.getX()][size.getY()][size.getZ()]; NBTTagList list = nbt.hasKey("data", Constants.NBT.TAG_LIST) ? nbt.getTagList("data", Constants.NBT.TAG_INT) : null; int[] serializedData = nbt.hasKey("data", Constants.NBT.TAG_INT_ARRAY) ? nbt.getIntArray("data") : new int[0]; if (serializedData.length == 0) { throw new InvalidInputDataException("Can't read a blueprint with no data!"); } int len = list == null ? serializedData.length : list.tagCount(); if (len != size.getX() * size.getY() * size.getZ()) { throw new InvalidInputDataException("Pallette has length of " + len + ", but we expected " + size.getX() * size.getY() * size.getZ() + size.toString()); } int i = 0; for (int z = 0; z < size.getZ(); z++) { for (int y = 0; y < size.getY(); y++) { for (int x = 0; x < size.getX(); x++) { data[x][y][z] = list == null ? serializedData[i] : list.getIntAt(i); i++; } } } for (NBTTagCompound schematicEntityTag : NBTUtilBC.readCompoundList(nbt.getTagList("entities", Constants.NBT.TAG_COMPOUND)).collect(Collectors.toList())) { entities.add(SchematicEntityManager.readFromNBT(schematicEntityTag)); } }
Source:
<code><START> public FtSecure(final Back bck, final ServerSocket skt) { <END> this.front = new FtBasic(bck, skt); }</code><technical_language>@bdragan do need this constructor public? I sense necessarily creating a secure front</technical_language>

Target:
FtSecure(final Back bck, final ServerSocket skt) { this.front = new FtBasic(bck, skt); }
Source:
<code>public int compareTableRows(ITableRow r1, ITableRow r2) { VALUE o1 = getValue(r1); VALUE o2 = getValue(r2); if (o1 == null && o2 == null) { return 0; } if (o1 == null) { return -1; } if (o2 == null) { return 1; } if ((o1 instanceof Comparable) && (o2 instanceof Comparable)) { return ((Comparable) o1).compareTo(o2); } String plainText1 = getPlainText(r1); String plainText2 = getPlainText(r2); <START> if (!StringUtility.isNullOrEmpty(plainText1) && !StringUtility.isNullOrEmpty(plainText2)) { <END> return StringUtility.compareIgnoreCase(plainText1, plainText2); } if (StringUtility.isNullOrEmpty(plainText1)) { return -1; } if (StringUtility.isNullOrEmpty(plainText2)) { return 1; } return super.compareTableRows(r1, r2); }</code><technical_language>This simplified a bit, I if (it requires isNullOrEmpty checks): int c = StringUtility.compareIgnoreCase(plainText1, plainText2); if (c != 0) { return c; } return super.compareTableRows(r1, r2);</technical_language>

Target:
public int compareTableRows(ITableRow r1, ITableRow r2) { VALUE o1 = getValue(r1); VALUE o2 = getValue(r2); if (o1 == null && o2 == null) { return 0; } if (o1 == null) { return -1; } if (o2 == null) { return 1; } if ((o1 instanceof Comparable) && (o2 instanceof Comparable)) { return ((Comparable) o1).compareTo(o2); } String plainText1 = getPlainText(r1); String plainText2 = getPlainText(r2); int c = StringUtility.compareIgnoreCase(plainText1, plainText2); if (c != 0) { return c; } return super.compareTableRows(r1, r2); }
Source:
<code>public void singleQueue() throws IOException, InterruptedException { final Queue queue = this.client.getQueues().get(SerialWorkerTest.DEFAULT_QUEUE_NAME); queue.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); final SerialWorker worker = new SerialWorker( <START> Arrays.asList(new String[] {SerialWorkerTest.DEFAULT_QUEUE_NAME}), <END> this.client, null, 10); IntegrationTestJob.runningHistory.clear(); final Thread signal = new Thread() { @Override public void run() { try { Thread.sleep(2000); worker.shutDown(); } catch (final InterruptedException v) { System.out.println(v); } } }; signal.start(); worker.run(); assertThat(IntegrationTestJob.runningHistory.get(0), equalTo(SerialWorkerTest.DEFAULT_JOB_NAME + ".test")); }</code><technical_language>Arrays.<String>asList(...). Collections.singletonList instead, worth other invocations</technical_language>

Target:
public void singleQueue() throws IOException, InterruptedException { final Queue queue = this.client.getQueue(SerialWorkerTest.DEFAULT_QUEUE_NAME); queue.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); final SerialWorker worker = new SerialWorker( Arrays.asList(SerialWorkerTest.DEFAULT_QUEUE_NAME), this.client, null, 10); IntegrationTestJob.runningHistory.clear(); final Thread signal = this.getWorkerThread(worker, 2); signal.start(); worker.run(); assertThat(IntegrationTestJob.runningHistory.get(0), equalTo(SerialWorkerTest.DEFAULT_JOB_NAME + ".test")); }
Source:
<code>public void testListProjects() throws Exception { setConfigSettings(); data.add(new NameValuePair("text", "jenkins list projects")); WebResponse response = makeRequest(data); assertThat(getSlackMessage(response).getText(), is("*Projects:*\n>_No projects found_")); FreeStyleProject project = jenkinsRule.createFreeStyleProject(LONG_PROJECT_NAME); Thread.sleep(30); response = makeRequest(data); assertThat(getSlackMessage(response).getText(), is("*Projects:*\n>*"+LONG_PROJECT_NAME+"*\n>*Last Build:* #TBD\n>*Status:* TBD\n\n\n")); project.scheduleBuild2(0); <START> Thread.sleep(200); <END> response = makeRequest(data); assertThat(getSlackMessage(response).getText(), is("*Projects:*\n>*"+LONG_PROJECT_NAME+"*\n>*Last Build:* #1\n>*Status:* SUCCESS\n\n\n")); }</code><technical_language>I able remove sleeps in tests, scheduling builds project.scheduleBuild2(0).get(), is passing for me. shaved 9 seconds build time machine</technical_language>

Target:
public void testListProjects() throws Exception { setConfigSettings(); data.add(new NameValuePair("text", "jenkins list projects")); WebResponse response = makeRequest(data); assertThat(getSlackMessage(response).getText(), is("*Projects:*\n>_No projects found_")); FreeStyleProject project = jenkinsRule.createFreeStyleProject(LONG_PROJECT_NAME); response = makeRequest(data); assertThat(getSlackMessage(response).getText(), is("*Projects:*\n>*"+LONG_PROJECT_NAME+"*\n>*Last Build:* #TBD\n>*Status:* TBD\n\n\n")); project.scheduleBuild2(0).get(); response = makeRequest(data); assertThat(getSlackMessage(response).getText(), is("*Projects:*\n>*"+LONG_PROJECT_NAME+"*\n>*Last Build:* #1\n>*Status:* SUCCESS\n\n\n")); }
Source:
<code>public void start(RuleContext ctx) { closeTargets.clear(); simpleTypes.clear(); types.clear(); if (getProperty(CLOSE_TARGETS_DESCRIPTOR) != null) { closeTargets.addAll(getProperty(CLOSE_TARGETS_DESCRIPTOR)); } if (getProperty(USE_CLOSE_AS_DEFAULT_TARGET) && !closeTargets.contains("close")) { closeTargets.add("close"); } if (getProperty(TYPES_DESCRIPTOR) != null) { types.addAll(getProperty(TYPES_DESCRIPTOR)); } <START> if (getProperty(TYPES_DESCRIPTOR) != null) { <END> for (String type : getProperty(TYPES_DESCRIPTOR)) { simpleTypes.add(toSimpleType(type)); } } }</code><technical_language>this merged prior block</technical_language>

Target:
public void start(RuleContext ctx) { closeTargets.clear(); simpleTypes.clear(); types.clear(); if (getProperty(CLOSE_TARGETS_DESCRIPTOR) != null) { closeTargets.addAll(getProperty(CLOSE_TARGETS_DESCRIPTOR)); } if (getProperty(USE_CLOSE_AS_DEFAULT_TARGET) && !closeTargets.contains("close")) { closeTargets.add("close"); } if (getProperty(TYPES_DESCRIPTOR) != null) { types.addAll(getProperty(TYPES_DESCRIPTOR)); for (String type : getProperty(TYPES_DESCRIPTOR)) { simpleTypes.add(toSimpleType(type)); } } }
Source:
<code>private void updatePackageAccessProperty() { String packAccess = Security.getProperty("package.access"); if (packAccess != null && !packAccess.isEmpty()) { if (!packAccess.contains(IGNITE_INTERNAL_PACKAGE)) <START> Security.setProperty("package.access", packAccess + ',' + IGNITE_INTERNAL_PACKAGE); <END> } else Security.setProperty("package.access", IGNITE_INTERNAL_PACKAGE); }</code><technical_language>if some code enables sandbox, starts Ignite, stops it, disables sandbox starts Ignite in JVM? I clear package.access processor stop (perhaps count started sandbox nodes, clear property counter equals 0 some synchronization static field)</technical_language>

Target:
private void updatePackageAccessProperty() { synchronized (SANDBOXED_NODES_COUNTER) { if (SANDBOXED_NODES_COUNTER.getAndIncrement() == 0) { String packAccess = Security.getProperty("package.access"); if (!F.isEmpty(packAccess)) { if (!packAccess.contains(IGNITE_INTERNAL_PACKAGE)) Security.setProperty("package.access", packAccess + ',' + IGNITE_INTERNAL_PACKAGE); } else Security.setProperty("package.access", IGNITE_INTERNAL_PACKAGE); } } }
Source:
<code>public Session findSession(String id) throws IOException { log.debug("Datastore manager is loading session: " + id); <START> Tracer tracer = Trace.getTracer(); <END> Session session = null; try { TraceContext context = tracer.startSpan("Loading session"); session = this.getStore().load(id); tracer.endSpan(context); } catch (ClassNotFoundException ex) { log.warn("An error occurred during session deserialization", ex); } return session; }</code><technical_language>I thought tracing is optional, user able opt-out of StackDriver trace, if want to. gcp.distributed-sessions.enableTrace is for</technical_language>

Target:
public Session findSession(String id) throws IOException { log.debug("Datastore manager is loading session: " + id); Session session = null; try { session = this.getStore().load(id); } catch (ClassNotFoundException ex) { log.warn("An error occurred during session deserialization", ex); } return session; }
Source:
<code>public Optional<T> getPreviousItem(T item) { int index = getItemIndex(item); <START> if (index <= 0) return Optional.empty(); return getItems().skip(index - 1).findFirst(); <END> }</code><technical_language>Missing Braces for if</technical_language>

Target:
public Optional<T> getPreviousItem(T item) { int index = getItemIndex(item); if (index <= 0) { return Optional.empty(); } return getItems().skip(index - 1).findFirst(); }
Source:
<code>public void visit(NodeTraversal t, Node n, Node parent) { if (n.isCall() && !NodeUtil.isExpressionResultUsed(n) && (n.getFirstChild().isName() || n.getFirstChild().isString())) { JSType targetType = n.getFirstChild().getJSType(); if (targetType != null && targetType.isFunctionType()) { targetType = targetType.restrictByNotNullOrUndefined(); FunctionType functionType = targetType.toMaybeFunctionType(); JSDocInfo functionJSDocInfo = functionType.getJSDocInfo(); if (functionJSDocInfo != null && functionJSDocInfo.isNoSideEffects() && functionJSDocInfo.getAssociatedNode() != null && <START> functionJSDocInfo.getAssociatedNode().isFromExterns()) { <END> t.getCompiler().report(t.makeError(n, level, USELESS_CODE_ERROR, n.getFirstChild().getString())); problemNodes.add(n); } } } }</code><technical_language>I thought @nosideeffects allowed in externs, this check is redundant</technical_language>

Target:
public void visit(NodeTraversal t, Node n, Node parent) { if (n.isCall() && !NodeUtil.isExpressionResultUsed(n) && (n.getFirstChild().isName() || n.getFirstChild().isString() || n.getFirstChild().isGetProp())) { JSType targetType = n.getFirstChild().getJSType(); if (targetType != null && targetType.isFunctionType()) { targetType = targetType.restrictByNotNullOrUndefined(); FunctionType functionType = targetType.toMaybeFunctionType(); JSDocInfo functionJSDocInfo = functionType.getJSDocInfo(); if (functionJSDocInfo != null && functionJSDocInfo.isNoSideEffects() && functionJSDocInfo.getAssociatedNode() != null && functionJSDocInfo.getAssociatedNode().isFromExterns()) { t.getCompiler().report(t.makeError(n, level, USELESS_CODE_ERROR, n.getFirstChild().getQualifiedName())); problemNodes.add(n); } } } }
Source:
<code>public void setStateBackend(StateBackend backend) { if (backend != null) { try { InstantiationUtil.writeObjectToConfig(backend, this.config, STATE_BACKEND); <START> this.config.setBoolean(STATE_BACKEND_USE_MANAGED_MEMORY, backend.useManagedMemory()); <END> } catch (Exception e) { throw new StreamTaskException("Could not serialize stateHandle provider.", e); } } }</code><technical_language>For purpose test method, I setStateBackendUsesManagedMemory(backend.useManagedMemory());</technical_language>

Target:
public void setStateBackend(StateBackend backend) { if (backend != null) { try { InstantiationUtil.writeObjectToConfig(backend, this.config, STATE_BACKEND); setStateBackendUsesManagedMemory(backend.useManagedMemory()); } catch (Exception e) { throw new StreamTaskException("Could not serialize stateHandle provider.", e); } } }
Source:
<code>public static boolean equal(KeyPair k1, KeyPair k2) { <START> return Objects.equal(k2.getPrivate(), k1.getPrivate()) && Objects.equal(k2.getPrivate(), k1.getPrivate()); <END> }</code><technical_language>wrong. for of Objects.equal compare getPublic()</technical_language>

Target:
public static boolean equal(KeyPair k1, KeyPair k2) { return Objects.equal(k2.getPrivate(), k1.getPrivate()) && Objects.equal(k2.getPublic(), k1.getPublic()); }
Source:
<code>private String getVarcharValue(Type type, Object value) { if (type instanceof VarcharType) { return ((Slice) value).toStringUtf8(); } if (type instanceof TinyintType || type instanceof SmallintType || type instanceof IntegerType || type instanceof BigintType) { return ((Long) value).toString(); } if (type instanceof BooleanType) { return ((Boolean) value).toString(); } <START> <END> return null; }</code><technical_language>need throw exception changing existing behavior</technical_language>

Target:
private String getVarcharValue(Type type, Object value) { if (type instanceof VarcharType) { return ((Slice) value).toStringUtf8(); } if (type instanceof TinyintType || type instanceof SmallintType || type instanceof IntegerType || type instanceof BigintType) { return ((Long) value).toString(); } if (type instanceof BooleanType) { return ((Boolean) value).toString(); } throw new PrestoException(NOT_SUPPORTED, format("Unsupported data type in EXPLAIN (TYPE IO): %s", type.getDisplayName())); }
Source:
<code>public void testFuzzyWithIntKeys() throws Exception { Table table = getDefaultTable(); List<byte[]> keys = Collections.unmodifiableList( Arrays.asList( createKey(5, 10, 126, 5), createKey(5, 10, 127, 5), createKey(5, 10, 128, 5), createKey(5, 10, 129, 5), createKey(5, 11, 126, 7), createKey(5, 11, 127, 7), createKey(5, 11, 128, 7), createKey(5, 11, 129, 7))); List<Put> puts = new ArrayList<>(); for(byte[] key : keys) { puts.add(new Put(key).addColumn(SharedTestEnvRule.COLUMN_FAMILY, Bytes.toBytes(0), Bytes.toBytes(0))); } table.put(puts); FuzzyRowFilter filter = new FuzzyRowFilter(ImmutableList.of( Pair.newPair(createKey(5, 0, 126, 0), createFuzzyMask(0, 1, 0, 1)), Pair.newPair(createKey(5, 0, 127, 0), createFuzzyMask(0, 1, 0, 1)), Pair.newPair(createKey(5, 0, 128, 0), createFuzzyMask(0, 1, 0, 1)), Pair.newPair(createKey(5, 0, 129, 0), createFuzzyMask(0, 1, 0, 1)))); Scan scan = new Scan().setFilter(filter); Set<String> expectedKeys = keys.stream().map(k ->toFuzzyKeyString(k)).collect(Collectors.toSet()); Set<String> actualKeys = new HashSet(); try (ResultScanner scanner = table.getScanner(scan)) { scanner.forEach(r -> { actualKeys.add(toFuzzyKeyString(CellUtil.cloneRow(r.rawCells()[0]))); }); } <START> assertEquals(expectedKeys,actualKeys); <END> }</code><technical_language>Please a space ,</technical_language>

Target:
public void testFuzzyWithIntKeys() throws Exception { Table table = getDefaultTable(); List<byte[]> keys = Collections.unmodifiableList( Arrays.asList( createKey(5, 10, 126, 5), createKey(5, 10, 127, 5), createKey(5, 10, 128, 5), createKey(5, 10, 129, 5), createKey(5, 11, 126, 7), createKey(5, 11, 127, 7), createKey(5, 11, 128, 7), createKey(5, 11, 129, 7))); List<Put> puts = new ArrayList<>(); for(byte[] key : keys) { puts.add(new Put(key).addColumn(SharedTestEnvRule.COLUMN_FAMILY, Bytes.toBytes(0), Bytes.toBytes(0))); } table.put(puts); FuzzyRowFilter filter = new FuzzyRowFilter(ImmutableList.of( Pair.newPair(createKey(5, 0, 126, 0), createFuzzyMask(0, 1, 0, 1)), Pair.newPair(createKey(5, 0, 127, 0), createFuzzyMask(0, 1, 0, 1)), Pair.newPair(createKey(5, 0, 128, 0), createFuzzyMask(0, 1, 0, 1)), Pair.newPair(createKey(5, 0, 129, 0), createFuzzyMask(0, 1, 0, 1)))); Scan scan = new Scan().setFilter(filter); Set<String> expectedKeys = new HashSet<>(keys.size()); for(byte[] key : keys) { expectedKeys.add(toFuzzyKeyString(key)); } Set<String> actualKeys = new HashSet(keys.size()); try (ResultScanner scanner = table.getScanner(scan)) { for(Result result : scanner) { actualKeys.add(toFuzzyKeyString(CellUtil.cloneRow(result.rawCells()[0]))); } } assertEquals(expectedKeys, actualKeys); }
Source:
<code>public List<CorfuQueueRecord<E>> entryList(int maxEntries) { if (maxEntries == -1) { maxEntries = Integer.MAX_VALUE; } List<CorfuQueueRecord<E>> copy = new ArrayList<>(Math.min(mainMap.size(), maxEntries)); for (Map.Entry<UUID, E> entry : mainMap.entrySet()) { copy.add(new CorfuQueueRecord<>(entry.getKey(), <START> entry.getValue())); <END> if (--maxEntries == 0) { break; } } return copy; }</code><technical_language>I need break line</technical_language>

Target:
public List<CorfuQueueRecord<E>> entryList(int maxEntries) { if (maxEntries <= 0) { throw new IllegalArgumentException("entryList given negative maxEntries"); } if (maxEntries > MAX_INDEX_ENTRIES) { throw new IllegalArgumentException( "entryList can't return more than "+MAX_INDEX_ENTRIES+" entries" ); } long snapshotVersion; boolean startedNewTransaction = false; if (TransactionalContext.isInTransaction()) { snapshotVersion = TransactionalContext.getCurrentContext() .getSnapshotTimestamp().getSequence(); } else { runtime.getObjectsView().TXBuild().type(TransactionType.WRITE_AFTER_WRITE) .build() .begin(); snapshotVersion = TransactionalContext.getCurrentContext() .getSnapshotTimestamp().getSequence(); startedNewTransaction = true; } List<CorfuQueueRecord<E>> copy = new ArrayList<>( Math.min(corfuTable.size(), maxEntries) ); int index = 0; for (Map.Entry<Long, E> entry : corfuTable.entrySet()) { if (++index >= maxEntries) { break; } long ordering = (snapshotVersion << MAX_BITS_FOR_INDEX) | index; long entryId = entry.getKey(); CorfuQueueRecord<E> record = new CorfuQueueRecord<>( ordering, entryId, entry.getValue() ); copy.add(record); } if (startedNewTransaction) { runtime.getObjectsView().TXEnd(); } return copy; }
Source:
<code>public static void recursivelyDelete(Path path, boolean deleteRoot, boolean retry) throws IOException { if (Files.isDirectory(path)) { <START> for (Path child : Files.newDirectoryStream(path)) { <END> recursivelyDelete(child, true, true); } } else if (deleteRoot) { try { Files.deleteIfExists(path); } catch (DirectoryNotEmptyException e) { if (!retry) { throw new IOException( "Directory not empty " + path + ": " + Files.list(path).collect(Collectors.toList())); } recursivelyDelete(path, true, false); } } }</code><technical_language>This delete root, if deleteRoot is set true</technical_language>

Target:
public static void recursivelyDelete(Path path, boolean deleteRoot, boolean retry) throws IOException { if (Files.isDirectory(path)) { for (Path child : Files.newDirectoryStream(path)) { recursivelyDelete(child, true, true); } } if (deleteRoot) { try { Files.deleteIfExists(path); } catch (DirectoryNotEmptyException e) { if (!retry) { throw new IOException( "Directory not empty " + path + ": " + Files.list(path).collect(Collectors.toList())); } recursivelyDelete(path, true, false); } } }
Source:
<code>protected boolean updateCinderDisksConnections() { if (getVm().getDiskMap().isEmpty()) { VmHandler.updateDisksFromDb(getVm()); } List<CinderDisk> cinderDisks = ImagesHandler.filterDisksBasedOnCinder(getVm().getDiskMap().values(), true); for (CinderDisk cinderDisk : cinderDisks) { try { CinderBroker cinderBroker = new CinderBroker(cinderDisk.getStorageIds().get(0), getReturnValue().getExecuteFailedMessages()); CinderConnectionInfo connectionInfo = cinderBroker.initializeConnectionForDisk(cinderDisk); CinderVolumeDriver cinderVolumeDriver = CinderVolumeDriver.forValue(connectionInfo.getDriverVolumeType()); <START> if (cinderVolumeDriver == null) { <END> addCustomValue("DiskAlias", cinderDisk.getDiskAlias()); auditLogDirector.log(this, AuditLogType.CINDER_DISK_CONNECTION_VOLUME_DRIVER_UNSUPPORTED); return false; } cinderDisk.setCinderConnectionInfo(connectionInfo); } catch (OpenStackResponseException ex) { addCustomValue("DiskAlias", cinderDisk.getDiskAlias()); auditLogDirector.log(this, AuditLogType.CINDER_DISK_CONNECTION_FAILURE); return false; } } return true; }</code><technical_language>I understand this. do need cinderVolumeDrive? instead of checking existence</technical_language>

Target:
protected boolean updateCinderDisksConnections() { if (getVm().getDiskMap().isEmpty()) { VmHandler.updateDisksFromDb(getVm()); } List<CinderDisk> cinderDisks = ImagesHandler.filterDisksBasedOnCinder(getVm().getDiskMap().values(), true); for (CinderDisk cinderDisk : cinderDisks) { try { CinderBroker cinderBroker = new CinderBroker(cinderDisk.getStorageIds().get(0), getReturnValue().getExecuteFailedMessages()); CinderConnectionInfo connectionInfo = cinderBroker.initializeConnectionForDisk(cinderDisk); if (CinderVolumeDriver.forValue(connectionInfo.getDriverVolumeType()) == null) { addCustomValue("DiskAlias", cinderDisk.getDiskAlias()); auditLogDirector.log(this, AuditLogType.CINDER_DISK_CONNECTION_VOLUME_DRIVER_UNSUPPORTED); return false; } cinderDisk.setCinderConnectionInfo(connectionInfo); } catch (OpenStackResponseException ex) { addCustomValue("DiskAlias", cinderDisk.getDiskAlias()); auditLogDirector.log(this, AuditLogType.CINDER_DISK_CONNECTION_FAILURE); return false; } } return true; }
Source:
<code>public OmemoBundleElement(int signedPreKeyId, byte[] signedPreKey, byte[] signedPreKeySig, byte[] identityKey, HashMap<Integer, byte[]> preKeys) { <START> if (signedPreKeyId <= 0) { <END> throw new IllegalArgumentException("signedPreKeyId MUST be greater than 0."); } this.signedPreKeyId = signedPreKeyId; this.signedPreKeyB64 = Base64.encodeToString(signedPreKey); if (StringUtils.isNullOrEmpty(this.signedPreKeyB64)) { throw new IllegalArgumentException("signedPreKeyB64 MUST NOT be null nor empty."); } this.signedPreKey = signedPreKey; this.signedPreKeySignatureB64 = Base64.encodeToString(signedPreKeySig); if (StringUtils.isNullOrEmpty(this.signedPreKeySignatureB64)) { throw new IllegalArgumentException("signedPreKeySigB64 MUST NOT be null nor empty."); } this.signedPreKeySignature = signedPreKeySig; this.identityKeyB64 = Base64.encodeToString(identityKey); if (StringUtils.isNullOrEmpty(identityKeyB64)) { throw new IllegalArgumentException("identityKeyB64 MUST NOT be null nor empty."); } this.identityKey = identityKey; this.preKeys = preKeys; if (preKeys.isEmpty()) { throw new IllegalArgumentException("PreKeys MUST NOT be empty."); } this.preKeysB64 = new HashMap<>(); for (int id : preKeys.keySet()) { preKeysB64.put(id, Base64.encodeToString(preKeys.get(id))); } }</code><technical_language>is kind of code duplication want avoid. usual solution is change this constructor a static constructor method: public static OmemoBundleElement newOmemoBundleElement(int signedPreKeyId, byte[] signedPreKey, byte[] signedPreKeySig, byte[] identityKey, HashMap<Integer, byte[]> preKeys) internally constructor above</technical_language>

Target:
public OmemoBundleElement(int signedPreKeyId, byte[] signedPreKey, byte[] signedPreKeySig, byte[] identityKey, HashMap<Integer, byte[]> preKeys) { this(signedPreKeyId, signedPreKey != null ? Base64.encodeToString(signedPreKey) : null, signedPreKeySig != null ? Base64.encodeToString(signedPreKeySig) : null, identityKey != null ? Base64.encodeToString(identityKey) : null, base64EncodePreKeys(preKeys)); this.signedPreKey = signedPreKey; this.signedPreKeySignature = signedPreKeySig; this.identityKey = identityKey; this.preKeys = preKeys; }
Source:
<code>public void visitMethodInvocation(MethodInvocationTree mit) { if (KEY_GEN_INIT.matches(mit) || KEY_PAIR_GEN_INITIALIZE.matches(mit)) { Integer minKeySize = algorithmKeySizeMap.get(algorithm); if (minKeySize != null) { checkAlgorithmParameterToReport(mit.arguments().get(0), minKeySize) <START> .ifPresent(argValue -> reportString = argValue); <END> this.treeToReport = mit; } } }</code><technical_language>* consistent this keyword - reportString is instance field * message argValue (the argument is integer)</technical_language>

Target:
public void visitMethodInvocation(MethodInvocationTree mit) { if (keyGenInit.matches(mit) || keyPairGenInitialize.matches(mit)) { Integer minKeySize = algorithmKeySizeMap.get(this.algorithm); if (minKeySize != null) { Integer keySize = LiteralUtils.intLiteralValue(mit.arguments().get(0)); if (keySize != null && keySize < minKeySize) { reportIssue(mit, "Use a key length of at least " + minKeySize + " bits."); } } } }
Source:
<code>private Value resolveDynamicAttribute(String attributeValue, OMElement elem) { try { String valueExpression = attributeValue.substring(1, attributeValue.length() - 1); if (valueExpression.startsWith("json-eval(")) { new SynapseJsonPath(valueExpression.substring(10, valueExpression.length() - 1)); } else { new SynapseXPath(valueExpression); } } catch (JaxenException e) { handleException("Invalid expression for attribute 'name' : " + attributeValue); } ValueFactory nameValueFactory = new ValueFactory(); <START> return nameValueFactory.createValue("iterations", elem); <END> }</code><technical_language>a const for "iterations", in places</technical_language>

Target:
private Value resolveDynamicAttribute(String attributeValue, OMElement elem) { try { String valueExpression = attributeValue.substring(1, attributeValue.length() - 1); if (valueExpression.startsWith("json-eval(")) { new SynapseJsonPath(valueExpression.substring(10, valueExpression.length() - 1)); } else { new SynapseXPath(valueExpression); } } catch (JaxenException e) { handleException("Invalid expression for attribute 'name' : " + attributeValue); } ValueFactory nameValueFactory = new ValueFactory(); return nameValueFactory.createValue(ITERATIONS, elem); }