auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testGetFeatureReaderWithPathAndWrappers(String file, String index, Function<SeekableByteChannel, SeekableByteChannel> wrapper, Function<SeekableByteChannel, SeekableByteChannel> indexWrapper) throws IOException, URISyntaxException { try(FileSystem fs = Jimfs.newFileSystem("test", Configuration.unix())) { <START> final AbstractFeatureReader<VariantContext, ?> featureReader = getFeatureReader(file, index, wrapper, <END> indexWrapper, new VCFCodec(), fs); Assert.assertTrue(featureReader.hasIndex()); Assert.assertEquals(featureReader.iterator().toList().size(), 26); Assert.assertEquals(featureReader.query("1", 190, 210).toList().size(), 3); Assert.assertEquals(featureReader.query("2", 190, 210).toList().size(), 1); } }</code><technical_language>Close featureReader done try-with-resources</technical_language>

Target:
public void testGetFeatureReaderWithPathAndWrappers(String file, String index, Function<SeekableByteChannel, SeekableByteChannel> wrapper, Function<SeekableByteChannel, SeekableByteChannel> indexWrapper) throws IOException, URISyntaxException { try(FileSystem fs = Jimfs.newFileSystem("test", Configuration.unix()); final AbstractFeatureReader<VariantContext, ?> featureReader = getFeatureReader(file, index, wrapper, indexWrapper, new VCFCodec(), fs)){ Assert.assertTrue(featureReader.hasIndex()); Assert.assertEquals(featureReader.iterator().toList().size(), 26); Assert.assertEquals(featureReader.query("1", 190, 210).toList().size(), 3); Assert.assertEquals(featureReader.query("2", 190, 210).toList().size(), 1); } }
Source:
<code>public int run() throws Exception { mustHaveValidSite(); <START> dbInjector = createDbInjector(MULTI_USER); <END> if (IndexModule.getIndexType(dbInjector) == IndexType.SQL) { throw die("index.type must be configured (or not SQL)"); } limitThreads(); if (version == null) { version = ChangeSchemas.getLatest().getVersion(); } LifecycleManager dbManager = new LifecycleManager(); dbManager.add(dbInjector); dbManager.start(); sysInjector = createSysInjector(); LifecycleManager sysManager = new LifecycleManager(); sysManager.add(sysInjector); sysManager.start(); index = sysInjector.getInstance(IndexCollection.class).getSearchIndex(); index.markReady(false); index.deleteAll(); int result = indexAll(); index.markReady(true); sysManager.stop(); dbManager.stop(); return result; }</code><technical_language>simpler: advantage of fact Configs mutable, @GerritServerConfig is a singleton. Get injector (see limitThreads for example) set value</technical_language>

Target:
public int run() throws Exception { mustHaveValidSite(); dbInjector = createDbInjector(MULTI_USER); if (IndexModule.getIndexType(dbInjector) == IndexType.SQL) { throw die("index.type must be configured (or not SQL)"); } limitThreads(); disableLuceneAutomaticCommit(); if (version == null) { version = ChangeSchemas.getLatest().getVersion(); } LifecycleManager dbManager = new LifecycleManager(); dbManager.add(dbInjector); dbManager.start(); sysInjector = createSysInjector(); LifecycleManager sysManager = new LifecycleManager(); sysManager.add(sysInjector); sysManager.start(); index = sysInjector.getInstance(IndexCollection.class).getSearchIndex(); index.markReady(false); index.deleteAll(); int result = indexAll(); index.markReady(true); sysManager.stop(); dbManager.stop(); return result; }
Source:
<code>public synchronized void recordWarningCode(int code) { <START> Integer Icode = code; <END> if(!warningCodes.containsKey(Icode)) { int[] val = new int[1]; val[0] = 0; warningCodes.put(Icode, val); } warningCodes.get(Icode)[0]++; }</code><technical_language>Nipick: follow Java conventions of beginning variable names a case? typically prefix variables type information, I guess a big deal if want leave is</technical_language>

Target:
public synchronized void recordWarningCode(int code) { Integer key = code; if(!warningCodes.containsKey(key)) { int[] val = new int[1]; val[0] = 0; warningCodes.put(key, val); } warningCodes.get(key)[0]++; }
Source:
<code><START> public void smokeTestOfNetexLoadData() { <END> GraphBuilderParameters builderParameters = createBuilderParameters(); NetexBundle netexBundle = createNetexBundle(builderParameters); netexBundle.checkInputs(); OtpTransitServiceBuilder transitBuilder = netexBundle.loadBundle(new Deduplicator()); OtpTransitService otpModel = transitBuilder.build(); assertAgencies(otpModel.getAllAgencies()); assertStops(otpModel.getAllStops()); assertTripPatterns(otpModel.getTripPatterns()); assertTrips(otpModel.getAllTrips()); assertServiceIds(otpModel.getAllServiceIds()); assertNoticeAssignments(otpModel.getNoticeAssignments()); assetServiceCalendar(transitBuilder.buildCalendarServiceData()); }</code><technical_language>I changed this test do proper assertions (not size of collections)</technical_language>

Target:
public void smokeTestOfNetexLoadData() { NetexBundle netexBundle = ConstantsForTests.createMinimalNetexBundle(); netexBundle.checkInputs(); OtpTransitServiceBuilder transitBuilder = netexBundle.loadBundle(new Deduplicator()); OtpTransitService otpModel = transitBuilder.build(); assertAgencies(otpModel.getAllAgencies()); assertStops(otpModel.getAllStops()); assertTripPatterns(otpModel.getTripPatterns()); assertTrips(otpModel.getAllTrips()); assertServiceIds(otpModel.getAllServiceIds()); assertNoticeAssignments(otpModel.getNoticeAssignments()); assetServiceCalendar(transitBuilder.buildCalendarServiceData()); }
Source:
<code><START> private void initializeChannelHandlers(NettyMetrics nettyMetrics, NettyConfig nettyConfig, <END> RestRequestHandler requestHandler, PublicAccessLogger publicAccessLogger, RestServerState restServerState) { channelHandlerInfoList = new LinkedHashMap<>(); channelHandlerInfoList.put("codec", new HttpServerCodec()); channelHandlerInfoList.put("HealthCheckHandler", new HealthCheckHandler(restServerState, nettyMetrics)); channelHandlerInfoList .put("PublicAccessLogHandler", new PublicAccessLogRequestHandler(publicAccessLogger, nettyMetrics)); channelHandlerInfoList.put("idleStateHandler", new IdleStateHandler(0, 0, nettyConfig.nettyServerIdleTimeSeconds)); channelHandlerInfoList.put("chunker", new ChunkedWriteHandler()); channelHandlerInfoList.put("processor", new NettyMessageProcessor(nettyMetrics, nettyConfig, requestHandler)); }</code><technical_language>purpose of this patch is introduce flexibility creating pipeline. in NettyServer constructor, however, need this method hard coded. supply a list of handles this initializer fixing parameters</technical_language>

Target:
private void initializeChannelHandlers(NettyMetrics nettyMetrics, NettyConfig nettyConfig, RestRequestHandler requestHandler, PublicAccessLogger publicAccessLogger, RestServerState restServerState) { channelHandlerInfoList.put("codec", new HttpServerCodec()); channelHandlerInfoList.put("HealthCheckHandler", new HealthCheckHandler(restServerState, nettyMetrics)); channelHandlerInfoList .put("PublicAccessLogHandler", new PublicAccessLogRequestHandler(publicAccessLogger, nettyMetrics)); channelHandlerInfoList.put("idleStateHandler", new IdleStateHandler(0, 0, nettyConfig.nettyServerIdleTimeSeconds)); channelHandlerInfoList.put("chunker", new ChunkedWriteHandler()); channelHandlerInfoList.put("processor", new NettyMessageProcessor(nettyMetrics, nettyConfig, requestHandler)); }
Source:
<code>protected void updateSubscriptionProductMappings(Subscription sdata) { if (sdata == null) { throw new IllegalArgumentException("sdata is null"); } <START> if (sdata.getId() == null || sdata.getId().matches("\\A\\s*\\z")) { <END> throw new IllegalArgumentException("subscription lacks identifying information: " + sdata); } Set<String> pids = new HashSet<>(); if (sdata.getProduct() != null && sdata.getProduct().getId() != null) { pids.add(sdata.getProduct().getId()); } if (sdata.getProvidedProducts() != null) { for (ProductData pdata : sdata.getProvidedProducts()) { if (pdata != null && pdata.getId() != null) { pids.add(pdata.getId()); } } } if (sdata.getDerivedProduct() != null && sdata.getDerivedProduct().getId() != null) { pids.add(sdata.getDerivedProduct().getId()); } if (sdata.getDerivedProvidedProducts() != null) { for (ProductData pdata : sdata.getDerivedProvidedProducts()) { if (pdata != null && pdata.getId() != null) { pids.add(pdata.getId()); } } } for (String pid : pids) { if (!this.productMap.containsKey(pid)) { throw new IllegalStateException("unknown/unexpected product id: " + pid); } if (!this.productSubscriptionMap.containsKey(pid)) { throw new IllegalStateException("product=>subscription map lacks table for product: " + pid); } } for (Map.Entry<String, Set<String>> entry : this.productSubscriptionMap.entrySet()) { String pid = entry.getKey(); Set<String> sids = entry.getValue(); if (pids.contains(pid)) { sids.add(sdata.getId()); } else { sids.remove(sdata.getId()); } } }</code><technical_language>StringUtils.isBlank</technical_language>

Target:
protected void updateSubscriptionProductMappings(Subscription sdata) { if (sdata == null) { throw new IllegalArgumentException("sdata is null"); } if (StringUtils.isBlank(sdata.getId())) { throw new IllegalArgumentException("subscription lacks identifying information: " + sdata); } Set<String> pids = new HashSet<>(); if (sdata.getProduct() != null && sdata.getProduct().getId() != null) { pids.add(sdata.getProduct().getId()); } if (sdata.getProvidedProducts() != null) { for (ProductData pdata : sdata.getProvidedProducts()) { if (pdata != null && pdata.getId() != null) { pids.add(pdata.getId()); } } } if (sdata.getDerivedProduct() != null && sdata.getDerivedProduct().getId() != null) { pids.add(sdata.getDerivedProduct().getId()); } if (sdata.getDerivedProvidedProducts() != null) { for (ProductData pdata : sdata.getDerivedProvidedProducts()) { if (pdata != null && pdata.getId() != null) { pids.add(pdata.getId()); } } } for (String pid : pids) { if (!this.productMap.containsKey(pid)) { throw new IllegalStateException("unknown/unexpected product id: " + pid); } if (!this.productSubscriptionMap.containsKey(pid)) { throw new IllegalStateException("product=>subscription map lacks table for product: " + pid); } } for (Map.Entry<String, Set<String>> entry : this.productSubscriptionMap.entrySet()) { String pid = entry.getKey(); Set<String> sids = entry.getValue(); if (pids.contains(pid)) { sids.add(sdata.getId()); } else { sids.remove(sdata.getId()); } } }
Source:
<code>public void run() { try { <START> Thread.currentThread().setName("consumer-" + subscriptionName); <END> start(); while (running) { consumer.consume(() -> processSignals()); } stop(); } finally { Thread.currentThread().setName("consumer-released-thread"); } }</code><technical_language>I add some randomized part thread name end stale consumer differentiate newly created process. rename stale process some suffix</technical_language>

Target:
public void run() { try { Thread.currentThread().setName("consumer-" + subscriptionName); start(); while (running) { consumer.consume(() -> processSignals()); } stop(); } finally { refreshHealthcheck(); Thread.currentThread().setName("consumer-released-thread"); } }
Source:
<code>private String stripGitCloneCommand(String input) { <START> if (input.startsWith(GIT_CLONE_COMMAND_PREFIX)) { <END> return input.substring(GIT_CLONE_COMMAND_PREFIX.length()).trim(); } return input.trim(); }</code><technical_language>need trim input this match if input starts whitespace</technical_language>

Target:
private String stripGitCloneCommand(String input) { input = input.trim(); if (input.startsWith(GIT_CLONE_COMMAND_PREFIX)) { return input.substring(GIT_CLONE_COMMAND_PREFIX.length()).trim(); } return input.trim(); }
Source:
<code>public static XMLGregorianCalendar create(org.joda.time.DateTime dateTime) { return dateTime!=null <START> ? withTypeFactoryDo($->$.newXMLGregorianCalendar(dateTime.toGregorianCalendar())) <END> : null; }</code><technical_language>"$" a variable</technical_language>

Target:
public static XMLGregorianCalendar create(org.joda.time.DateTime dateTime) { return dateTime!=null ? withTypeFactoryDo(factory->factory.newXMLGregorianCalendar(dateTime.toGregorianCalendar())) : null; }
Source:
<code>protected void done() { loadingNoticePanel.setVisible(false); runJobNowButton.setEnabled(true); if(jobStatus == null) { <START> System.out.println("null jobStatus?!"); <END> } else if(jobStatus.isError()) { JOptionPane.showMessageDialog(frame, "Job completed with errors: " + jobStatus.getMessage()); } else { if (jobTabToRun.getClass().equals(PortJobTab.class)) { PortJobTab selectedPortJobTab = (PortJobTab) jobTabToRun; Object[] options = {"Yes", "No"}; int n = JOptionPane.showOptionDialog(frame, "Port job completed successfully. Would you like to open the destination dataset?\n", "Port Job Successful", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if (n == JOptionPane.YES_OPTION) { Utils.openWebpage(selectedPortJobTab.getURIToSinkDataset()); } } else { JOptionPane.showMessageDialog(frame, "Job completed successfully. " + jobStatus.getMessage()); } } }</code><technical_language>this a debugging thing? a more serious message</technical_language>

Target:
protected void done() { loadingNoticePanel.setVisible(false); progressPanel.setVisible(false); runJobNowButton.setEnabled(true); if(jobStatus == null) { System.out.println("null jobStatus?!"); } else if(jobStatus.isError()) { JOptionPane.showMessageDialog(frame, "Job completed with errors: " + jobStatus.getMessage()); } else { if (jobTabToRun.getClass().equals(PortJobTab.class)) { PortJobTab selectedPortJobTab = (PortJobTab) jobTabToRun; Object[] options = {"Yes", "No"}; int n = JOptionPane.showOptionDialog(frame, "Port job completed successfully. Would you like to open the destination dataset?\n", "Port Job Successful", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if (n == JOptionPane.YES_OPTION) { Utils.openWebpage(selectedPortJobTab.getURIToSinkDataset()); } } else { JOptionPane.showMessageDialog(frame, "Job completed successfully. " + jobStatus.getMessage()); } } }
Source:
<code>public Object[][] argumentCombinationsdata() { return new Object[][]{ {null, null, null, 1}, <START> {new String[]{"UR,CR", "CR,UR"}, null, null, 0}, <END> {new String[]{"UR,CR", "CR,UR"}, new String[]{"UY"}, null, 1}, {new String[]{"UR,CR", "CR,UR"}, null, new String[]{"AAAAA"}, 1}, {new String[]{"UR,CR", "CR,UR"}, new String[]{"CY", "CY,UY"}, null, 0}, {new String[]{"UR,CR", "CR,UR"}, null, new String[]{"AAA", "AAAAA"}, 0}, {new String[]{"UR,CR", "CR,UR"}, new String[]{"CY", "CY,UY"}, new String[]{"AAA", "AAAAA"}, 0}, }; }</code><technical_language>This array is for cases, a static final constant avoid creating array multiple times</technical_language>

Target:
public Object[][] argumentCombinationsdata() { return new Object[][]{ {null, null, null, 1}, {STG_ARRAY, null, null, 0}, {STG_ARRAY, new String[]{"UY"}, null, 1}, {STG_ARRAY, null, new String[]{"AAAAA"}, 1}, {new String[]{"UR,CR"}, new String[]{"CY,UY"}, null, 0}, {STG_ARRAY, null, new String[]{"AAA", "AAAAA"}, 0}, {STG_ARRAY, new String[]{"CY", "CY,UY"}, new String[]{"AAA", "AAAAA"}, 0}, }; }
Source:
<code><START> public JsonElement toJson(VideoRequest src) { <END> JsonObject json = new JsonObject(); JsonObject requestHeader = new JsonObject(); requestHeader.addProperty("Token", src.getToken()); JsonObject query = new JsonObject(); query.addProperty("SearchPhrase", src.getSearchPhrase()); JsonObject resultOptions = new JsonObject(); resultOptions.addProperty("ItemCount", src.getItemCount()); resultOptions.addProperty("ItemStartNumber", src.getItemStartNumber()); JsonObject searchForVideosRequestBody = new JsonObject(); searchForVideosRequestBody.add("Query", query); searchForVideosRequestBody.add("ResultOptions", resultOptions); json.add("RequestHeader", requestHeader); json.add("SearchForVideosRequestBody", searchForVideosRequestBody); return json; }</code><technical_language>static helper class</technical_language>

Target:
public static JsonElement toJson(VideoRequest src) { JsonObject json = new JsonObject(); JsonObject requestHeader = new JsonObject(); requestHeader.addProperty("Token", src.getToken()); JsonObject query = new JsonObject(); query.addProperty("SearchPhrase", src.getSearchPhrase()); JsonObject resultOptions = new JsonObject(); resultOptions.addProperty("ItemCount", src.getItemCount()); resultOptions.addProperty("ItemStartNumber", src.getItemStartNumber()); JsonObject searchForVideosRequestBody = new JsonObject(); searchForVideosRequestBody.add("Query", query); searchForVideosRequestBody.add("ResultOptions", resultOptions); json.add("RequestHeader", requestHeader); json.add("SearchForVideosRequestBody", searchForVideosRequestBody); return json; }
Source:
<code>public void testPrfSha256() { byte[] secret = Hex.decode("9b be 43 6b a9 40 f0 17 b1 76 52 84 9a 71 db 35".trim()); <START> byte[] seed = Hex.decode("a0 ba 9f 93 6c da 31 18 27 a6 f7 96 ff d5 19 8c".trim()); <END> byte[] label = "test label".getBytes(StandardCharsets.US_ASCII); byte[] expected = Hex.decode( ("e3 f2 29 ba 72 7b e1 7b" + "8d 12 26 20 55 7c d4 53" + "c2 aa b2 1d 07 c3 d4 95" + "32 9b 52 d4 e6 1e db 5a" + "6b 30 17 91 e9 0d 35 c9" + "c9 a4 6b 4e 14 ba f9 af" + "0f a0 22 f7 07 7d ef 17" + "ab fd 37 97 c0 56 4b ab" + "4f bc 91 66 6e 9d ef 9b" + "97 fc e3 4f 79 67 89 ba" + "a4 80 82 d1 22 ee 42 c5" + "a7 2e 5a 51 10 ff f7 01" + "87 34 7b 66").trim() ); byte[] actual = PseudoRandomFunction.hash(secret, label, seed, expected.length, "HmacSha256"); assertArrayEquals(expected, actual); }</code><technical_language>nit: remove trim lines above</technical_language>

Target:
public void testPrfSha256() { byte[] secret = Hex.decode("9b be 43 6b a9 40 f0 17 b1 76 52 84 9a 71 db 35"); byte[] seed = Hex.decode("a0 ba 9f 93 6c da 31 18 27 a6 f7 96 ff d5 19 8c"); byte[] label = "test label".getBytes(CharsetUtil.US_ASCII); byte[] expected = Hex.decode( "e3 f2 29 ba 72 7b e1 7b" + "8d 12 26 20 55 7c d4 53" + "c2 aa b2 1d 07 c3 d4 95" + "32 9b 52 d4 e6 1e db 5a" + "6b 30 17 91 e9 0d 35 c9" + "c9 a4 6b 4e 14 ba f9 af" + "0f a0 22 f7 07 7d ef 17" + "ab fd 37 97 c0 56 4b ab" + "4f bc 91 66 6e 9d ef 9b" + "97 fc e3 4f 79 67 89 ba" + "a4 80 82 d1 22 ee 42 c5" + "a7 2e 5a 51 10 ff f7 01" + "87 34 7b 66"); byte[] actual = PseudoRandomFunction.hash(secret, label, seed, expected.length, "HmacSha256"); assertArrayEquals(expected, actual); }
Source:
<code>public M deserialize(final JsonParser parser, final DeserializationContext context) throws IOException { BigDecimal amount = null; CurrencyUnit currency = null; while (parser.nextToken() != JsonToken.END_OBJECT) { final String field = parser.getCurrentName(); parser.nextToken(); if (field.equals(names.getAmount())) { amount = parser.getDecimalValue(); } else if (field.equals(names.getCurrency())) { currency = context.readValue(parser, CurrencyUnit.class); <START> } <END> } if (amount == null) { throw new JsonParseException(parser, format("Missing '%s' property", names.getAmount())); } if (currency == null) { throw new JsonParseException(parser, format("Missing '%s' property", names.getCurrency())); } return factory.create(amount, currency); }</code><technical_language>is else branch allow unknown/unexpected fields. Is this allowed (i.e. setting mapper/parser)</technical_language>

Target:
public M deserialize(final JsonParser parser, final DeserializationContext context) throws IOException { BigDecimal amount = null; CurrencyUnit currency = null; while (parser.nextToken() != JsonToken.END_OBJECT) { final String field = parser.getCurrentName(); parser.nextToken(); if (field.equals(names.getAmount())) { amount = parser.getDecimalValue(); } else if (field.equals(names.getCurrency())) { currency = context.readValue(parser, CurrencyUnit.class); } else if (field.equals(names.getFormatted())) { continue; } else if (context.isEnabled(FAIL_ON_UNKNOWN_PROPERTIES)) { throw UnrecognizedPropertyException.from(parser, MonetaryAmount.class, field, Arrays.<Object>asList(names.getAmount(), names.getCurrency(), names.getFormatted())); } else { parser.skipChildren(); } } checkPresent(parser, amount, names.getAmount()); checkPresent(parser, currency, names.getCurrency()); return factory.create(amount, currency); }
Source:
<code>private void configureStreamGraph(final StreamGraph graph) { checkNotNull(graph); graph.setChaining(chaining); graph.setUserArtifacts(userArtifacts); graph.setTimeCharacteristic(timeCharacteristic); graph.setJobName(jobName); if (shouldExecuteInBatchMode) { if (checkpointConfig.isCheckpointingEnabled()) { LOG.info("Disabled Checkpointing. Checkpointing is not supported and not needed when executing jobs in BATCH mode."); checkpointConfig.disableCheckpointing(); } graph.setGlobalDataExchangeMode(GlobalDataExchangeMode.POINTWISE_EDGES_PIPELINED); graph.setScheduleMode(ScheduleMode.LAZY_FROM_SOURCES_WITH_BATCH_SLOT_REQUEST); setDefaultBufferTimeout(-1); setBatchStateBackendAndTimerService(graph); } else { graph.setStateBackend(stateBackend); graph.setGlobalDataExchangeMode(GlobalDataExchangeMode.ALL_EDGES_PIPELINED); <START> graph.setAllVerticesInSameSlotSharingGroupByDefault(true); <END> graph.setScheduleMode(ScheduleMode.EAGER); if (checkpointConfig.isApproximateLocalRecoveryEnabled()) { checkApproximateLocalRecoveryCompatibility(); graph.setGlobalDataExchangeMode(GlobalDataExchangeMode.ALL_EDGES_PIPELINED_APPROXIMATE); } else { graph.setGlobalDataExchangeMode(GlobalDataExchangeMode.ALL_EDGES_PIPELINED); } } }</code><technical_language>is this change necessary</technical_language>

Target:
private void configureStreamGraph(final StreamGraph graph) { checkNotNull(graph); graph.setChaining(chaining); graph.setUserArtifacts(userArtifacts); graph.setTimeCharacteristic(timeCharacteristic); graph.setJobName(jobName); if (shouldExecuteInBatchMode) { if (checkpointConfig.isCheckpointingEnabled()) { LOG.info("Disabled Checkpointing. Checkpointing is not supported and not needed when executing jobs in BATCH mode."); checkpointConfig.disableCheckpointing(); } graph.setGlobalDataExchangeMode(GlobalDataExchangeMode.POINTWISE_EDGES_PIPELINED); graph.setScheduleMode(ScheduleMode.LAZY_FROM_SOURCES_WITH_BATCH_SLOT_REQUEST); setDefaultBufferTimeout(-1); setBatchStateBackendAndTimerService(graph); } else { graph.setStateBackend(stateBackend); graph.setScheduleMode(ScheduleMode.EAGER); if (checkpointConfig.isApproximateLocalRecoveryEnabled()) { checkApproximateLocalRecoveryCompatibility(); graph.setGlobalDataExchangeMode(GlobalDataExchangeMode.ALL_EDGES_PIPELINED_APPROXIMATE); } else { graph.setGlobalDataExchangeMode(GlobalDataExchangeMode.ALL_EDGES_PIPELINED); } } }
Source:
<code>public Value atomize() throws XPathException { if (value == null) { <START> final Object v = attribute.getValue(); <END> value = SaxonXPathRuleQuery.getAtomicRepresentation(v); } return value; }</code><technical_language>inline variable</technical_language>

Target:
public Value atomize() { if (value == null) { value = SaxonXPathRuleQuery.getAtomicRepresentation(attribute.getValue()); } return value; }
Source:
<code>public static SchedulingPolicy map(VDSGroup entity, SchedulingPolicy template) { SchedulingPolicy model = template != null ? template : new SchedulingPolicy(); <START> if (entity.getClusterPolicyName() != null && !entity.getClusterPolicyName().toLowerCase().equals(NONE)) { <END> model.setPolicy(entity.getClusterPolicyName()); if (entity.getClusterPolicyProperties() != null) { model.setThresholds(new SchedulingPolicyThresholds()); String lowUtilization = entity.getClusterPolicyProperties().get(LOW_UTILIZATION); String highUtilization = entity.getClusterPolicyProperties().get(HIGH_UTILIZATION); String cpuOverCommitDurationMinutes = entity.getClusterPolicyProperties().get(CPU_OVER_COMMIT_DURATION_MINUTES); if (lowUtilization != null) { model.getThresholds().setLow(Integer.parseInt(lowUtilization)); } if (highUtilization != null) { model.getThresholds().setHigh(Integer.parseInt(highUtilization)); } if (cpuOverCommitDurationMinutes != null) { int duration = Integer.parseInt(cpuOverCommitDurationMinutes) * 60; model.getThresholds().setDuration(duration); } } } return model; }</code><technical_language>opportunity improve a bad existing situation, is for non-existing policy user see: <scheduling_policy/> removing part of 'if' statement, user see: <scheduling_policy> <type>none</type> </scheduling_policy> is better</technical_language>

Target:
public static SchedulingPolicy map(VDSGroup entity, SchedulingPolicy template) { SchedulingPolicy model = template != null ? template : new SchedulingPolicy(); if (entity.getClusterPolicyName() != null) { model.setPolicy(entity.getClusterPolicyName()); if (entity.getClusterPolicyProperties() != null && !entity.getClusterPolicyProperties().isEmpty()) { model.setThresholds(new SchedulingPolicyThresholds()); String lowUtilization = entity.getClusterPolicyProperties().get(LOW_UTILIZATION); String highUtilization = entity.getClusterPolicyProperties().get(HIGH_UTILIZATION); String cpuOverCommitDurationMinutes = entity.getClusterPolicyProperties().get(CPU_OVER_COMMIT_DURATION_MINUTES); if (lowUtilization != null) { model.getThresholds().setLow(Integer.parseInt(lowUtilization)); } if (highUtilization != null) { model.getThresholds().setHigh(Integer.parseInt(highUtilization)); } if (cpuOverCommitDurationMinutes != null) { int duration = Integer.parseInt(cpuOverCommitDurationMinutes) * 60; model.getThresholds().setDuration(duration); } } } return model; }
Source:
<code>public void handleRequest(final DataInput input, final ActiveOperation.ResultHandler<Void> resultHandler, final ManagementRequestContext<ServerInventory> context) throws IOException { final byte param = input.readByte(); <START> context.executeAsync(new ManagementRequestContext.AsyncTask<ServerInventory>() { <END> @Override public void execute(ManagementRequestContext<ServerInventory> serverInventoryManagementRequestContext) throws Exception { try { final ServerInventory inventory = context.getAttachment(); if(param == DomainServerProtocol.PARAM_OK) { inventory.serverStarted(serverProcessName); } else { inventory.serverStartFailed(serverProcessName); } } finally { resultHandler.done(null); } } }); }</code><technical_language>1. This means input get read</technical_language>

Target:
public void handleRequest(final DataInput input, final ActiveOperation.ResultHandler<Void> resultHandler, final ManagementRequestContext<ServerInventory> context) throws IOException { final byte param = input.readByte(); final String message = input.readUTF(); context.executeAsync(new ManagementRequestContext.AsyncTask<ServerInventory>() { @Override public void execute(ManagementRequestContext<ServerInventory> serverInventoryManagementRequestContext) throws Exception { try { final ServerInventory inventory = context.getAttachment(); if(param == DomainServerProtocol.PARAM_OK) { inventory.serverStarted(serverProcessName); } else { inventory.serverStartFailed(serverProcessName); } } finally { resultHandler.done(null); } } }); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if ((obj == null) || (getClass() != obj.getClass())) { return false; } ElasticsearchColumnHandle other = (ElasticsearchColumnHandle) obj; return Objects.equals(this.getColumnName(), other.getColumnName()) && <START> Objects.equals(this.getOrdinalPosition(), other.getOrdinalPosition()) && <END> Objects.equals(this.getColumnType(), other.getColumnType()) && Objects.equals(this.getColumnJsonPath(), other.getColumnJsonPath()) && Objects.equals(this.getColumnJsonType(), other.getColumnJsonType()) && Objects.equals(this.getIsList(), other.getIsList()); }</code><technical_language>nit: move ordinal position isList, is case for other usages in this class</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if ((obj == null) || (getClass() != obj.getClass())) { return false; } ElasticsearchColumnHandle other = (ElasticsearchColumnHandle) obj; return Objects.equals(this.getColumnName(), other.getColumnName()) && Objects.equals(this.getColumnType(), other.getColumnType()) && Objects.equals(this.getColumnJsonPath(), other.getColumnJsonPath()) && Objects.equals(this.getColumnJsonType(), other.getColumnJsonType()) && Objects.equals(this.getOrdinalPosition(), other.getOrdinalPosition()) && Objects.equals(this.getIsList(), other.getIsList()); }
Source:
<code>public boolean equals(Object o) { <START> if (o == null) { <END> return false; } else if ((o instanceof FabricWorld)) { FabricWorld other = ((FabricWorld) o); World otherWorld = other.worldRef.get(); World thisWorld = worldRef.get(); return otherWorld != null && otherWorld.equals(thisWorld); } else if (o instanceof com.sk89q.worldedit.world.World) { return ((com.sk89q.worldedit.world.World) o).getName().equals(getName()); } else { return false; } }</code><technical_language>This check excessive. caught else</technical_language>

Target:
public boolean equals(Object o) { if ((o instanceof FabricWorld)) { FabricWorld other = ((FabricWorld) o); World otherWorld = other.worldRef.get(); World thisWorld = worldRef.get(); return otherWorld != null && otherWorld.equals(thisWorld); } else if (o instanceof com.sk89q.worldedit.world.World) { return ((com.sk89q.worldedit.world.World) o).getName().equals(getName()); } else { return false; } }
Source:
<code>public Response<Set<String>> apply(ChangeResource req, Input input) throws AuthException, OrmException, IOException, BadRequestException { if (input == null || Strings.isNullOrEmpty(input.hashtags)) { throw new BadRequestException("Hashtags are required"); } ChangeControl control = req.getControl(); if (!control.canEditHashtags()) { throw new <START> AuthException("Edit hashtags <END> not permitted"); } ChangeUpdate update = updateFactory.create(control); ChangeNotes notes = control.getNotes().load(); Set<String> hashtags = new HashSet<String>(); Set<String> oldHashtags = notes.getHashtags(); if (oldHashtags != null) { hashtags.addAll(oldHashtags); } hashtags.removeAll(Arrays.asList(input.hashtags.split(","))); update.setHashtags(hashtags); update.commit(); return Response.ok(hashtags); }</code><technical_language>"Delete"</technical_language>

Target:
public Response<Set<String>> apply(ChangeResource req, Input input) throws AuthException, OrmException, IOException, BadRequestException { if (input == null || Strings.isNullOrEmpty(input.hashtags)) { throw new BadRequestException("Hashtags are required"); } ChangeControl control = req.getControl(); if (!control.canEditHashtags()) { throw new AuthException("Edit hashtags not permitted"); } ChangeUpdate update = updateFactory.create(control); ChangeNotes notes = control.getNotes().load(); Set<String> hashtags = new HashSet<String>(); Set<String> oldHashtags = notes.getHashtags(); if (oldHashtags != null) { hashtags.addAll(oldHashtags); } hashtags.removeAll(Arrays.asList(input.hashtags.split(","))); update.setHashtags(hashtags); update.commit(); ChangeUtil.bumpRowVersionNotLastUpdatedOn(req.getChange().getId(), db.get()); return Response.ok(hashtags); }
Source:
<code>@Override public Iterable<K> loadAllKeys() { logger.info( "Starting load all keys for Edge Mapstore" ); Stream<K> keys; try ( Connection connection = hds.getConnection(); Statement stmt = connection.createStatement() ) { connection.setAutoCommit( false ); stmt.setFetchSize( 50000 ); final ResultSet rs = stmt.executeQuery( selectAllKeysQuery ); return StreamUtil <START> .stream( Lists.newArrayList( new KeyIterator<K>( rs, <END> new CountdownConnectionCloser( connection, 1 ), this::mapToKey ) ) ) .peek( key -> logger.debug( "Key to load: {}", key ) ) ::iterator; } catch ( SQLException e ) { logger.error( "Unable to acquire connection load all keys" ); return null; } }</code><technical_language>This forces a read of data instead of streaming database. reasoning this change</technical_language>

Target:
@Override public Iterable<K> loadAllKeys() { logger.info( "Starting load all keys for Edge Mapstore" ); try ( Connection connection = hds.getConnection(); Statement stmt = connection.createStatement() ) { connection.setAutoCommit( false ); stmt.setFetchSize( 50000 ); final ResultSet rs = stmt.executeQuery( selectAllKeysQuery ); return StreamUtil .stream( () -> new KeyIterator<K>( rs, new CountdownConnectionCloser( connection, 1 ), this::mapToKey ) ) .peek( key -> logger.debug( "Key to load: {}", key ) ) ::iterator; } catch ( SQLException e ) { logger.error( "Unable to acquire connection load all keys" ); return null; } }
Source:
<code>public void init(Context context) { this.tagToRateLimiterMap = Collections.unmodifiableMap(tagToTargetRateMap.entrySet().stream() .map(e -> { String tag = e.getKey(); JobModel jobModel = ((TaskContextImpl) context.getTaskContext()).getJobModel(); int numTasks = jobModel.getContainers().values().stream() .mapToInt(cm -> cm.getTasks().size()) .sum(); <START> Preconditions.checkArgument(e.getValue() >= numTasks, <END> String.format("rate limit count (%d) must be greater than number of tasks (%d)", e.getValue(), numTasks)); int effectiveRate = e.getValue() / numTasks; TaskName taskName = context.getTaskContext().getTaskModel().getTaskName(); LOGGER.info(String.format("Effective rate limit for task %s and tag %s is %d", taskName, tag, effectiveRate)); return new ImmutablePair<>(tag, com.google.common.util.concurrent.RateLimiter.create(effectiveRate)); }) .collect(Collectors.toMap(ImmutablePair::getKey, ImmutablePair::getValue)) ); initialized = true; }</code><technical_language>warn user instead of throw exception for this case? change line 120 be: double effectiveRate = (double) e.getValue() / numTasks;</technical_language>

Target:
public void init(Context context) { this.tagToRateLimiterMap = Collections.unmodifiableMap(tagToTargetRateMap.entrySet().stream() .map(e -> { String tag = e.getKey(); JobModel jobModel = ((TaskContextImpl) context.getTaskContext()).getJobModel(); int numTasks = jobModel.getContainers().values().stream() .mapToInt(cm -> cm.getTasks().size()) .sum(); double effectiveRate = (double) e.getValue() / numTasks; TaskName taskName = context.getTaskContext().getTaskModel().getTaskName(); LOGGER.info(String.format("Effective rate limit for task %s and tag %s is %f", taskName, tag, effectiveRate)); if (effectiveRate < 1.0) { LOGGER.warn(String.format("Effective limit rate (%f) is very low. " + "Total rate limit is %d while number of tasks is %d. Consider increasing the rate limit.", effectiveRate, e.getValue(), numTasks)); } return new ImmutablePair<>(tag, com.google.common.util.concurrent.RateLimiter.create(effectiveRate)); }) .collect(Collectors.toMap(ImmutablePair::getKey, ImmutablePair::getValue)) ); initialized = true; }
Source:
<code>private void checkForDisableBackgroundWork(JSONObject responseAsJson) { boolean disableBackgroundWork = responseAsJson.optBoolean("disable_background_work", false); <START> HiddenPreferences.setDisableBackgroundWork(disableBackgroundWork); <END> if (disableBackgroundWork) { WorkManager.getInstance(CommCareApplication.instance()).cancelAllWorkByTag( CommCareApplication.instance().getCurrentApp().getUniqueId()); } }</code><technical_language>long this last? flag is reset? I sense for this trigger a "cooldown" (IE: 1-7 day period try) a permanent switch, I working way. harder for HQ maintain state update hooks, rely</technical_language>

Target:
private void checkForDisableBackgroundWork(JSONObject responseAsJson) { boolean disableBackgroundWork = responseAsJson.optBoolean("disable_background_work", false); HiddenPreferences.setDisableBackgroundWorkTime(disableBackgroundWork); if (disableBackgroundWork) { WorkManager.getInstance(CommCareApplication.instance()).cancelAllWorkByTag( CommCareApplication.instance().getCurrentApp().getUniqueId()); } }
Source:
<code>public static String formatLogMessage(String entryKind, String logEntry) throws XMLStreamException, IOException { ByteArrayOutputStream outStream = new ByteArrayOutputStream(); XMLOutputFactory factory = XMLOutputFactory.newInstance(); XMLStreamWriter writer = factory.createXMLStreamWriter(outStream); EwsUtilities.writeTraceStartElement(writer, entryKind, false); <START> writer.writeCharacters(SystemUtils.LINE_SEPARATOR); <END> writer.writeCharacters(logEntry); writer.writeCharacters(SystemUtils.LINE_SEPARATOR); writer.writeEndElement(); writer.writeCharacters(SystemUtils.LINE_SEPARATOR); writer.flush(); writer.close(); outStream.flush(); String formattedLogMessage = outStream.toString(); formattedLogMessage = formattedLogMessage.replaceAll("&apos;", "'"); formattedLogMessage = formattedLogMessage.replaceAll("&quot;", "\""); formattedLogMessage = formattedLogMessage.replaceAll("&gt;", ">"); formattedLogMessage = formattedLogMessage.replaceAll("&lt;", "<"); formattedLogMessage = formattedLogMessage.replaceAll("&amp;", "&"); outStream.close(); return formattedLogMessage; }</code><technical_language>line.separator System Property. Line separator ("\n" UNIX). > Defaults null if runtime security access read this property property exist. > **This is initialized class is loaded.** If System.setProperty(String,String) System.setProperties(java.util.Properties) is called this class is loaded, out of sync System property. this a potential bug if LINE_SEPARATOR is changed afterwards</technical_language>

Target:
public static String formatLogMessage(String entryKind, String logEntry) throws XMLStreamException, IOException { String lineSeparator = System.getProperty("line.separator"); ByteArrayOutputStream outStream = new ByteArrayOutputStream(); XMLOutputFactory factory = XMLOutputFactory.newInstance(); XMLStreamWriter writer = factory.createXMLStreamWriter(outStream); EwsUtilities.writeTraceStartElement(writer, entryKind, false); writer.writeCharacters(lineSeparator); writer.writeCharacters(logEntry); writer.writeCharacters(lineSeparator); writer.writeEndElement(); writer.writeCharacters(lineSeparator); writer.flush(); writer.close(); outStream.flush(); String formattedLogMessage = outStream.toString(); formattedLogMessage = formattedLogMessage.replaceAll("&apos;", "'"); formattedLogMessage = formattedLogMessage.replaceAll("&quot;", "\""); formattedLogMessage = formattedLogMessage.replaceAll("&gt;", ">"); formattedLogMessage = formattedLogMessage.replaceAll("&lt;", "<"); formattedLogMessage = formattedLogMessage.replaceAll("&amp;", "&"); outStream.close(); return formattedLogMessage; }
Source:
<code>private void removeZeroConstraint(SymbolicValue sv) { PMap<Class<? extends Constraint>, Constraint> constraints = programState.getConstraints(sv); if(constraints != null) { <START> programState = programState.addConstraints(sv, constraints.remove(ZeroConstraint.class)); <END> } }</code><technical_language>This counterintuitive, add a remove other side. Logic, replace map a map constraint, requires perfectly data structure of domains. a dedicated method in ProgramState? construction is present multiple places</technical_language>

Target:
private void removeZeroConstraint(SymbolicValue sv) { programState = programState.removeConstraintsOnDomain(sv, ZeroConstraint.class); }
Source:
<code>public String getDescription(Context context, boolean withStartDate) { StringBuilder detailBuilder = new StringBuilder(); if (!TextUtils.isEmpty(org)) { detailBuilder.append(org); } if (!TextUtils.isEmpty(number)) { if (detailBuilder.length() > 0) { detailBuilder.append(" | "); } detailBuilder.append(number); } if (withStartDate) { if (detailBuilder.length() > 0) { detailBuilder.append(" | "); } detailBuilder.append(getFormattedStartDate(context)); } if (detailBuilder.length() > 0) { int secondlastCharIndex = detailBuilder.length() - 2; if (detailBuilder.charAt(secondlastCharIndex) == '|') { <START> detailBuilder.delete(secondlastCharIndex, detailBuilder.length()); <END> } } return detailBuilder.toString(); }</code><technical_language>join some strings pipe characters? simpler build a List<String> TextUtils.join(" | ", list)</technical_language>

Target:
public String getDescription(Context context, boolean withStartDate) { List<CharSequence> sections = new ArrayList<>(); if (!TextUtils.isEmpty(org)) { sections.add(org); } if (!TextUtils.isEmpty(number)) { sections.add(number); } if (withStartDate) { CharSequence formattedDate = getFormattedStartDate(context); if (formattedDate != null) sections.add(formattedDate.toString().toUpperCase()); } return TextUtils.join(" | ", sections); }
Source:
<code>public void stop(StopContext context) { EmbeddedCacheManager container = this.dependencies.getCacheContainer(); CounterManager counterManager = EmbeddedCounterManagerFactory.asCounterManager(container); <START> counterManager.remove(counterConfigurationName); <END> }</code><technical_language>this is of persistent problem. deleting counter persistent storage</technical_language>

Target:
public void stop(StopContext context) { }
Source:
<code>public void visitNode(AstNode node) { Scope currentScope = currentScope(); super.visitNode(node); if (node.is(PythonGrammar.FUNCDEF)) { createScope(node, currentScope); createFunctionParameters(node); } <START> if (node.is(PythonGrammar.CLASSDEF)) { <END> createScope(node, currentScope); } if (node.is(PythonGrammar.EXPRESSION_STMT)) { for (AstNode assignOperator : node.getChildren(PythonPunctuator.ASSIGN, PythonGrammar.AUGASSIGN)) { if (currentScopeRootTree().is(PythonGrammar.CLASSDEF)) { new ClassVariableAssignmentVisitor(currentScopeRootTree()).scanNode(assignOperator.getNextSibling()); } AstNode target = assignOperator.getPreviousSibling(); if (target.getTokens().size() == 1) { addWriteUsage(target.getFirstDescendant(PythonGrammar.NAME)); } } } if (node.is(PythonGrammar.GLOBAL_STMT)) { node.getChildren(PythonGrammar.NAME).forEach(name -> currentScope().addGlobalName(name.getTokenValue())); } if (node.is(PythonGrammar.NONLOCAL_STMT)) { node.getChildren(PythonGrammar.NAME).forEach(name -> currentScope().addNonlocalName(name.getTokenValue())); } }</code><technical_language>@pynicolas "if" replaced "else if" enhance readability. Ditto for other "if"s in this method</technical_language>

Target:
public void visitNode(AstNode node) { Scope currentScope = currentScope(); super.visitNode(node); if (node.is(PythonGrammar.FUNCDEF)) { createScope(node, currentScope); createFunctionParameters(node); } else if (node.is(PythonGrammar.CLASSDEF)) { createScope(node, currentScope); } else if (node.is(PythonGrammar.EXPRESSION_STMT)) { for (AstNode assignOperator : node.getChildren(PythonPunctuator.ASSIGN, PythonGrammar.AUGASSIGN)) { if (currentScopeRootTree().is(PythonGrammar.CLASSDEF)) { new ClassVariableAssignmentVisitor(currentScopeRootTree()).scanNode(assignOperator.getNextSibling()); } AstNode target = assignOperator.getPreviousSibling(); if (target.getTokens().size() == 1) { addWriteUsage(target.getFirstDescendant(PythonGrammar.NAME)); } } } else if (node.is(PythonGrammar.GLOBAL_STMT)) { node.getChildren(PythonGrammar.NAME).forEach(name -> currentScope().addGlobalName(name.getTokenValue())); } else if (node.is(PythonGrammar.NONLOCAL_STMT)) { node.getChildren(PythonGrammar.NAME).forEach(name -> currentScope().addNonlocalName(name.getTokenValue())); } }
Source:
<code>private void restoreFrom(Uri inputUri) { File currentDB = getDatabasePath(PodDBAdapter.DATABASE_NAME); try { InputStream inputStream = getContentResolver().openInputStream(inputUri); copyInputStreamToFile(inputStream, currentDB); <START> inputStream.close(); <END> displayImportSuccessDialog(); } catch (Exception e) { e.printStackTrace(); Snackbar.make(findViewById(R.id.import_export_layout), e.getMessage(), Snackbar.LENGTH_SHORT).show(); } }</code><technical_language>this belong in a finally block</technical_language>

Target:
private void restoreFrom(Uri inputUri) { File currentDB = getDatabasePath(PodDBAdapter.DATABASE_NAME); InputStream inputStream = null; try { inputStream = getContentResolver().openInputStream(inputUri); FileUtils.copyInputStreamToFile(inputStream, currentDB); displayImportSuccessDialog(); } catch (IOException e) { Log.e(TAG, Log.getStackTraceString(e)); Snackbar.make(findViewById(R.id.import_export_layout), e.getLocalizedMessage(), Snackbar.LENGTH_SHORT).show(); } finally { IOUtils.closeQuietly(inputStream); } }
Source:
<code>public static Archive<?> deploy() { EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, EAR_DEPLOYMENT_NAME); JavaArchive earLib = ShrinkWrap.create(JavaArchive.class); earLib.addClass(DeploymentModulesListTestCase.class); earLib.addAsManifestResource(EmptyAsset.INSTANCE, "emptyJarLibResource.properties"); earLib.addAsManifestResource(EmptyAsset.INSTANCE, "properties/nestedJarLib.properties"); ear.addAsLibraries(earLib); WebArchive war = ShrinkWrap.create(WebArchive.class, INNER_WAR_ARCHIVE_NAME); war.addClass(DeploymentModulesListTestCase.class); war.add(EmptyAsset.INSTANCE, "META-INF/example.txt"); war.add(EmptyAsset.INSTANCE, "META-INF/properties/nested.properties"); <START> war.addAsWebInfResource(DeploymentModulesListTestCase.class.getPackage(), "web.xml", "web.xml"); <END> JavaArchive libJar = ShrinkWrap.create(JavaArchive.class, INNER_JAR_ARCHIVE_NAME); libJar.addClass(DeploymentModulesListTestCase.class); war.addAsLibraries(libJar); ear.addAsModules(libJar, war); ear.add(new StringAsset(prepareJBossEarDeploymentStructure()),"/META-INF/jboss-deployment-structure.xml"); ear.addAsResource(EmptyAsset.INSTANCE, "emptyEarResource"); ear.addAsManifestResource(DeploymentModulesListTestCase.class.getPackage(), "application.xml", "application.xml"); return ear; }</code><technical_language>@zhantemirov , changing test Arquillian, test fails. Arquillian is complaining this missing file in classloader, please mind reviewing test? is easier latest wildfly required wildfly-core version</technical_language>

Target:
public static Archive<?> deploy() { EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, EAR_DEPLOYMENT_NAME); JavaArchive earLib = ShrinkWrap.create(JavaArchive.class); earLib.addClass(DeploymentModulesListTestCase.class); earLib.addAsManifestResource(EmptyAsset.INSTANCE, "emptyJarLibResource.properties"); earLib.addAsManifestResource(EmptyAsset.INSTANCE, "properties/nestedJarLib.properties"); ear.addAsLibraries(earLib); WebArchive war = ShrinkWrap.create(WebArchive.class, INNER_WAR_ARCHIVE_NAME); war.addClass(DeploymentModulesListTestCase.class); war.add(EmptyAsset.INSTANCE, "META-INF/example.txt"); war.add(EmptyAsset.INSTANCE, "META-INF/properties/nested.properties"); JavaArchive libJar = ShrinkWrap.create(JavaArchive.class, INNER_JAR_ARCHIVE_NAME); libJar.addClass(DeploymentModulesListTestCase.class); war.addAsLibraries(libJar); ear.addAsModules(libJar, war); ear.add(new StringAsset(prepareJBossEarDeploymentStructure()),"/META-INF/jboss-deployment-structure.xml"); ear.addAsResource(EmptyAsset.INSTANCE, "emptyEarResource"); return ear; }
Source:
<code>private static SweepResults getCumulativeSweepResults(TableToSweep tableToSweep, SweepResults currentIteration) { long staleValuesDeleted = tableToSweep.getStaleValuesDeletedPreviously() + currentIteration.getStaleValuesDeleted(); long cellsExamined = tableToSweep.getCellsExaminedPreviously() + currentIteration.getCellTsPairsExamined(); long minimumSweptTimestamp = Math.min( tableToSweep.getPreviousMinimumSweptTimestamp().orElse(Long.MAX_VALUE), currentIteration.getSweptTimestamp()); <START> long timeInMillis = tableToSweep.getTimeInMillisPreviously() + currentIteration.getTimeInMillis(); <END> return SweepResults.builder() .staleValuesDeleted(staleValuesDeleted) .cellTsPairsExamined(cellsExamined) .sweptTimestamp(minimumSweptTimestamp) .nextStartRow(currentIteration.getNextStartRow()) .timeInMillis(timeInMillis) .build(); }</code><technical_language>I this is work right - need write out cumulative time in millis newProgress in saveIntermediateSweepResults. need check SweepProgress read fine this field in DB (when roll this out</technical_language>

Target:
private static SweepResults getCumulativeSweepResults(TableToSweep tableToSweep, SweepResults currentIteration) { return tableToSweep.getPreviousSweepResults().accumulateWith(currentIteration); }
Source:
<code>private void runUpdate() { if (!initUpdate()) { <START> logger.error("Failed to initialize update"); <END> } downloadUpdateData(); downloadUpdateForApplication(); }</code><technical_language>return here</technical_language>

Target:
private void runUpdate() { if (!initUpdate()) { logger.error(ERROR_INIT_UPDATE); return; } if (!downloadUpdateData()) { logger.error(ERROR_DOWNLOAD_UPDATE_DATA); return; } if (!downloadUpdateForApplication()) { logger.error(ERROR_DOWNLOAD_UPDATE_APP); return; } }