auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private HttpClientBuilder lookupHttpClientBuilder(final URL url) { Map<String, HttpClientBuilder> builderMap = this.httpClientBuildersByUri .entrySet().stream().filter(entry -> { String key = entry.getKey(); String spec = getUrlWithPlaceholders(url, key); if (spec.equals(key)) { return true; } int index = spec.lastIndexOf("/"); while (index != -1) { spec = spec.substring(0, index); if (spec.equals(key)) { return true; } index = spec.lastIndexOf("/"); } return false; }).collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); if (builderMap.isEmpty()) { this.log.warn(String.format("No custom http config found for URL: %s", url)); return HttpClients.custom(); } if (builderMap.size() > 1) { List<String> keys = builderMap.keySet().stream().filter( <START> key -> !Pattern.compile(PLACEHOLDER_PATTERN).matcher(key).find()) <END> .collect(Collectors.toList()); if (keys.size() == 1) { return builderMap.get(keys.get(0)); } this.log.error(String.format( "More than one git repo URL template matched URL:" + " %s, proxy and skipSslValidation config won't be applied. Matched templates: %s", url, builderMap.keySet().stream().collect(Collectors.joining(", ")))); return HttpClients.custom(); } return new ArrayList<>(builderMap.values()).get(0); }</code><technical_language>Pattern.compile() moved a constant</technical_language>

Target:
private HttpClientBuilder lookupHttpClientBuilder(final URL url) { Map<String, HttpClientBuilder> builderMap = this.httpClientBuildersByUri .entrySet().stream().filter(entry -> { String key = entry.getKey(); String spec = getUrlWithPlaceholders(url, key); if (spec.equals(key)) { return true; } int index = spec.lastIndexOf("/"); while (index != -1) { spec = spec.substring(0, index); if (spec.equals(key)) { return true; } index = spec.lastIndexOf("/"); } return false; }).collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); if (builderMap.isEmpty()) { this.log.warn(String.format("No custom http config found for URL: %s", url)); return HttpClients.custom(); } if (builderMap.size() > 1) { List<String> keys = builderMap.keySet().stream() .filter(key -> !PLACEHOLDER_PATTERN.matcher(key).find()) .collect(Collectors.toList()); if (keys.size() == 1) { return builderMap.get(keys.get(0)); } this.log.error(String.format( "More than one git repo URL template matched URL:" + " %s, proxy and skipSslValidation config won't be applied. Matched templates: %s", url, builderMap.keySet().stream().collect(Collectors.joining(", ")))); return HttpClients.custom(); } return new ArrayList<>(builderMap.values()).get(0); }
Source:
<code>public void progress() { if (!bPlayer.canBendIgnoreBindsCooldowns(this)) { remove(); return; } getFloor(); if (floorblock == null) { remove(); return; } Vector velocity = player.getEyeLocation().getDirection().clone().normalize(); velocity.setY(0); velocity = velocity.clone().normalize().multiply(speed); if (System.currentTimeMillis() > getStartTime() + interval) { if (player.getVelocity().length() < speed * 0.3) { <START> remove(); <END> return; } spinScooter(); } double distance = player.getLocation().getY() - (double) floorblock.getY(); double dx = Math.abs(distance - 2.4); if (distance > 2.75) { velocity.setY(-.25 * dx * dx); } else if (distance < 2) { velocity.setY(.25 * dx * dx); } Vector v = velocity.clone().setY(0); Block b = floorblock.getLocation().clone().add(v.multiply(1.2)).getBlock(); if (!GeneralMethods.isSolid(b) && !b.isLiquid()) { velocity.add(new Vector(0, -0.6, 0)); } else if (GeneralMethods.isSolid(b.getRelative(BlockFace.UP)) || b.getRelative(BlockFace.UP).isLiquid()) { velocity.add(new Vector(0, 0.6, 0)); } Location loc = player.getLocation(); if (!WaterAbility.isWater(player.getLocation().add(0, 2, 0).getBlock())) { loc.setY((double) floorblock.getY() + 1.5); } else { return; } player.removePotionEffect(PotionEffectType.SPEED); player.setVelocity(velocity); if (random.nextInt(4) == 0) { playAirbendingSound(player.getLocation()); } }</code><technical_language>This is formatted incorrectly. removed a tab needed there</technical_language>

Target:
public void progress() { if (!bPlayer.canBendIgnoreBindsCooldowns(this)) { remove(); return; } getFloor(); if (floorblock == null) { remove(); return; } Vector velocity = player.getEyeLocation().getDirection().clone().normalize(); velocity.setY(0); velocity = velocity.clone().normalize().multiply(speed); if (System.currentTimeMillis() > getStartTime() + interval) { if (player.getVelocity().length() < speed * 0.3) { remove(); return; } spinScooter(); } double distance = player.getLocation().getY() - (double) floorblock.getY(); double dx = Math.abs(distance - 2.4); if (distance > 2.75) { velocity.setY(-.25 * dx * dx); } else if (distance < 2) { velocity.setY(.4 * dx * dx); } Vector v = velocity.clone().setY(0); Block b = floorblock.getLocation().clone().add(v.multiply(1.2)).getBlock(); if (!GeneralMethods.isSolid(b) && !b.isLiquid()) { velocity.add(new Vector(0, -0.6, 0)); } else if (GeneralMethods.isSolid(b.getRelative(BlockFace.UP)) || b.getRelative(BlockFace.UP).isLiquid()) { velocity.add(new Vector(0, 0.6, 0)); } Location loc = player.getLocation(); if (!WaterAbility.isWater(player.getLocation().add(0, 2, 0).getBlock())) { loc.setY((double) floorblock.getY() + 1.5); } else { return; } player.removePotionEffect(PotionEffectType.SPEED); player.setVelocity(velocity); if (random.nextInt(4) == 0) { playAirbendingSound(player.getLocation()); } }
Source:
<code>public static MySqlExecutor createExecutor(Map<String, Object> jdbcProps) { Util.validateJDBCProperties(jdbcProps, Lists.newArrayList("dataSourceClassName", "dataSource.url")); String dataSourceClassName = (String) jdbcProps.get("dataSourceClassName"); log.info("data source class: [{}]", dataSourceClassName); String jdbcUrl = (String) jdbcProps.get("dataSource.url"); log.info("dataSource.url is: ", jdbcUrl); int queryTimeOutInSecs = -1; if(jdbcProps.containsKey("queryTimeoutInSecs")) { int timeout = (Integer) jdbcProps.get("queryTimeoutInSecs"); if(timeout < 0) { throw new IllegalArgumentException("queryTimeoutInSecs property can not be negative"); <START> } <END> } Properties properties = new Properties(); properties.putAll(jdbcProps); HikariConfig hikariConfig = new HikariConfig(properties); HikariCPConnectionBuilder connectionBuilder = new HikariCPConnectionBuilder(hikariConfig); ExecutionConfig executionConfig = new ExecutionConfig(queryTimeOutInSecs); return new MySqlExecutor(executionConfig, connectionBuilder); }</code><technical_language>forgot assign timeout queryTimeOutInSecs validation</technical_language>

Target:
public static MySqlExecutor createExecutor(Map<String, Object> jdbcProps) { Util.validateJDBCProperties(jdbcProps, Lists.newArrayList("dataSourceClassName", "dataSource.url")); String dataSourceClassName = (String) jdbcProps.get("dataSourceClassName"); log.info("data source class: [{}]", dataSourceClassName); String jdbcUrl = (String) jdbcProps.get("dataSource.url"); log.info("dataSource.url is: ", jdbcUrl); int queryTimeOutInSecs = -1; if(jdbcProps.containsKey("queryTimeoutInSecs")) { queryTimeOutInSecs = (Integer) jdbcProps.get("queryTimeoutInSecs"); if(queryTimeOutInSecs < 0) { throw new IllegalArgumentException("queryTimeoutInSecs property can not be negative"); } } Properties properties = new Properties(); properties.putAll(jdbcProps); HikariConfig hikariConfig = new HikariConfig(properties); HikariCPConnectionBuilder connectionBuilder = new HikariCPConnectionBuilder(hikariConfig); ExecutionConfig executionConfig = new ExecutionConfig(queryTimeOutInSecs); return new MySqlExecutor(executionConfig, connectionBuilder); }
Source:
<code>public String getReactorName() { <START> return "SSL Reactor"; <END> }</code><technical_language>move this a constant</technical_language>

Target:
public String getReactorName() { return REACTOR_NAME; }
Source:
<code>public void testRestartServerWhilePutting() throws Exception { RemoteCache<Integer, String> remote = client(0).getCache(); remote.put(1, "v1"); assertEquals("v1", remote.get(1)); PutHammer putHammer = new PutHammer(); Future<Void> putHammerFuture = fork(putHammer); HotRodServer toKillServer = servers.get(0); HotRodClientTestingUtil.killServers(toKillServer); servers.remove(toKillServer); EmbeddedCacheManager toKillCacheManager = cacheManagers.get(0); TestingUtil.killCacheManagers(toKillCacheManager); cacheManagers.remove(toKillCacheManager); TestingUtil.waitForRehashToComplete(cache(0)); EmbeddedCacheManager cm = TestCacheManagerFactory.createClusteredCacheManager(getCacheConfiguration()); registerCacheManager(cm); <START> HotRodServer server = HotRodClientTestingUtil.startHotRodServer(cm); <END> waitForClusterToForm(); TestingUtil.waitForRehashToComplete(cm.getCache(), cache(0)); putHammer.stop = true; putHammerFuture.get(); HotRodClientTestingUtil.killServers(server); TestingUtil.killCacheManagers(cm); }</code><technical_language>wrap this a try finally</technical_language>

Target:
public void testRestartServerWhilePutting() throws Exception { RemoteCache<Integer, String> remote = client(0).getCache(); remote.put(1, "v1"); assertEquals("v1", remote.get(1)); PutHammer putHammer = new PutHammer(); Future<Void> putHammerFuture = fork(putHammer); HotRodServer toKillServer = servers.get(0); HotRodClientTestingUtil.killServers(toKillServer); servers.remove(toKillServer); EmbeddedCacheManager toKillCacheManager = cacheManagers.get(0); TestingUtil.killCacheManagers(toKillCacheManager); cacheManagers.remove(toKillCacheManager); TestingUtil.waitForRehashToComplete(cache(0)); addHotRodServer(getCacheConfiguration()); putHammer.stop = true; putHammerFuture.get(); }
Source:
<code>public Future<Long> write(ByteBuffer src, Callback<Long> callback) { return write(Unpooled.wrappedBuffer(src), new Callback<Long>() { @Override public void onCompletion(Long result, Exception exception) { if (exception == null) { <START> src.position(src.limit()); <END> } else { src.position(result.intValue()); } if (callback != null) { callback.onCompletion(result, exception); } } }); }</code><technical_language>this exception != null result == null</technical_language>

Target:
public Future<Long> write(ByteBuffer src, Callback<Long> callback) { FutureResult<Long> futureResult = new FutureResult<>(); write(Unpooled.wrappedBuffer(src), new Callback<Long>() { @Override public void onCompletion(Long result, Exception exception) { long r = result == null ? src.position() : result.longValue(); src.position((int) r); futureResult.done(r, exception); if (callback != null) { callback.onCompletion(result, exception); } } }); return futureResult; }
Source:
<code>public OffHeapConfigValidator(Function<Element, OffheapResourcesType> resourcesTypeSupplier) { <START> conversionMap.put(MemoryUnit.B, 1L); <END> conversionMap.put(MemoryUnit.K_B, 1024L); conversionMap.put(MemoryUnit.MB, 1024L * 1024L); conversionMap.put(MemoryUnit.GB, 1024L * 1024L * 1024L); conversionMap.put(MemoryUnit.TB, 1024L * 1024L * 1024L * 1024L); conversionMap.put(MemoryUnit.PB, 1024L * 1024L * 1024L * 1024L * 1024L); this.resourcesTypeSupplier = resourcesTypeSupplier; }</code><technical_language>reuse conversions utilities in OffHeapResourcesProvider</technical_language>

Target:
public OffHeapConfigValidator(Function<Element, OffheapResourcesType> resourcesTypeSupplier) { this.resourcesTypeSupplier = resourcesTypeSupplier; }
Source:
<code>public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ClassTree classTree = (ClassTree) tree; Type classType = classTree.symbol().type(); List<Tree> members = classTree.members(); checkStaticVariables(members, classType); <START> checkStaticInitilizers(members, classType); <END> }</code><technical_language>TYPO</technical_language>

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ClassTree classTree = (ClassTree) tree; Type classType = classTree.symbol().type(); List<Tree> members = classTree.members(); checkStaticVariables(members, classType); checkStaticInitializers(members, classType); }
Source:
<code>void add(IOException e) { <START> if (allCacheNotFoundException) { allCacheNotFoundException = e instanceof CacheNotFoundException; } <END> super.addSuppressed(e); }</code><technical_language>suggestion allCacheNotFoundException &= e instanceof CacheNotFoundException;</technical_language>

Target:
void add(IOException e) { allCacheNotFoundException &= e instanceof CacheNotFoundException; super.addSuppressed(e); }
Source:
<code>public void workerMeta() throws IOException, InterruptedException { final Queue queue = this.client.getQueues().get(SerialWorkerTest.DEFAULT_QUEUE_NAME); final String jid = queue.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); final SerialWorker worker = new SerialWorker( Arrays.asList(new String[] {SerialWorkerTest.DEFAULT_QUEUE_NAME}), this.client, null, 10); IntegrationTestJob.runningHistory.clear(); <START> final Thread signal = new Thread() { <END> @Override public void run() { try { Thread.sleep(2000); worker.shutDown(); } catch (final InterruptedException v) { System.out.println(v); } } }; signal.start(); worker.run(); assertThat(worker.getCurrentJid(), equalTo(jid)); assertThat(worker.getWorkerName(), equalTo(this.client.workerName())); }</code><technical_language>inherit Thread. do this instead: java final Thread signal = new Thread(new Runnable() { @Override public void run() { // ... } }); fact Thread is non-final is considered a bug some is a relic of compatibility in language</technical_language>

Target:
public void workerMeta() throws IOException, InterruptedException { final Queue queue = this.client.getQueue(SerialWorkerTest.DEFAULT_QUEUE_NAME); final String jid = 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(worker.getCurrentJid(), equalTo(jid)); assertThat(worker.getWorkerName(), equalTo(this.client.workerName())); }
Source:
<code>public void loadVideoThumbnail(final String url, final Html.VideoThumbnailGetter.Callbacks callbacks, final int maxWidth, final int minWidth) { if (TextUtils.isEmpty(url) || maxWidth <= 0) { callbacks.onThumbnailFailed(); return; } callbacks.onThumbnailLoading(loadingInProgress); new AsyncTask<Void, Void, Bitmap>() { protected Bitmap doInBackground(Void... params) { if (new File(url).exists()) { return ThumbnailUtils.createVideoThumbnail(url, MediaStore.Images.Thumbnails.FULL_SCREEN_KIND); } return ImageUtils.getVideoFrameFromVideo(url, maxWidth); } protected void onPostExecute(Bitmap thumb) { if (thumb == null) { callbacks.onThumbnailFailed(); return; } thumb = ImageUtils.getScaledBitmapAtLongestSide(thumb, maxWidth); <START> if (thumb == null) { <END> callbacks.onThumbnailFailed(); return; } thumb.setDensity(DisplayMetrics.DENSITY_DEFAULT); BitmapDrawable bitmapDrawable = new BitmapDrawable(context.getResources(), thumb); callbacks.onThumbnailLoaded(bitmapDrawable); } }.execute(); }</code><technical_language>above. return statement line 55 is enough fix problem</technical_language>

Target:
public void loadVideoThumbnail(final String url, final Html.VideoThumbnailGetter.Callbacks callbacks, final int maxWidth, final int minWidth) { if (TextUtils.isEmpty(url) || maxWidth <= 0) { callbacks.onThumbnailFailed(); return; } callbacks.onThumbnailLoading(loadingInProgress); new AsyncTask<Void, Void, Bitmap>() { protected Bitmap doInBackground(Void... params) { if (new File(url).exists()) { return ThumbnailUtils.createVideoThumbnail(url, MediaStore.Images.Thumbnails.FULL_SCREEN_KIND); } return ImageUtils.getVideoFrameFromVideo(url, maxWidth); } protected void onPostExecute(Bitmap thumb) { if (thumb == null) { callbacks.onThumbnailFailed(); return; } thumb = ImageUtils.getScaledBitmapAtLongestSide(thumb, maxWidth); thumb.setDensity(DisplayMetrics.DENSITY_DEFAULT); BitmapDrawable bitmapDrawable = new BitmapDrawable(context.getResources(), thumb); callbacks.onThumbnailLoaded(bitmapDrawable); } }.execute(); }
Source:
<code>public List<SchemaIncompatibility> checkConstraints(final Schema schema) { <START> final List<SchemaIncompatibility> incompatibilities = new ArrayList<SchemaIncompatibility>(); <END> recursiveCheckConstraints(schema, new Stack<String>(), incompatibilities); return incompatibilities; }</code><technical_language>diamond new ArrayList<>();</technical_language>

Target:
public List<SchemaIncompatibility> checkConstraints(final Schema schema) { final List<SchemaIncompatibility> incompatibilities = new ArrayList<>(); recursiveCheckConstraints(schema, new Stack<>(), incompatibilities); return incompatibilities; }
Source:
<code>public boolean handlesEntityType(String typeName) { <START> return true; <END> }</code><technical_language>Really? need concrete here</technical_language>

Target:
public boolean handlesEntityType(String typeName) { return "org.ehcache.clustered.client.EhcacheClientEntity".equals(typeName); }
Source:
<code>public Set<T> toTypes(final Long registerValue) { <START> final Set<T> Types = new HashSet<>(); <END> final BitSet bitSet = BitSet.valueOf(new long[] { registerValue }); for (int i = bitSet.nextSetBit(0); i >= 0; i = bitSet.nextSetBit(i + 1)) { Types.add(this.typePerRegisterBitIndex.get(i)); } return Types; }</code><technical_language>Variable names start upper case letter</technical_language>

Target:
public Set<T> toTypes(final Long registerValue) { final Set<T> types = new HashSet<>(); final BitSet bitSet = BitSet.valueOf(new long[] { registerValue }); for (int i = bitSet.nextSetBit(0); i >= 0; i = bitSet.nextSetBit(i + 1)) { types.add(this.typePerRegisterBitIndex.get(i)); } return types; }
Source:
<code>private void sendMergeFail(final Change c, final ChangeMessage msg, final boolean makeNew) { try { db.changeMessages().insert(Collections.singleton(msg)); } catch (OrmException err) { log.warn("Cannot record merge failure message", err); } if (makeNew) { try { db.changes().atomicUpdate(c.getId(), new AtomicUpdate<Change>() { @Override public Change update(Change c) { if (c.getStatus().isOpen()) { c.setStatus(Change.Status.NEW); ChangeUtil.updated(c); } return c; } }); } catch (OrmConcurrencyException err) { } catch (OrmException err) { log.warn("Cannot update change status", err); } } else { try { ChangeUtil.touch(c, db); } catch (OrmException err) { log.warn("Cannot update change timestamp", err); } } try { <START> final PatchSet patchSet = db.patchSets().get(c.currentPatchSetId()); <END> workQueue.getDefaultQueue() .submit(requestScopePropagator.wrap(new Runnable() { @Override public void run() { try { final MergeFailSender cm = mergeFailSenderFactory.create(c); final PatchSetApproval submitter = getSubmitter(c.currentPatchSetId()); if (submitter != null) { cm.setFrom(submitter.getAccountId()); } cm.setPatchSet(patchSet); cm.setChangeMessage(msg); cm.send(); } catch (EmailException e) { log.error("Cannot send email notifications about merge failure", e); } } @Override public String toString() { return "send email for merge failure"; } })); } catch (OrmException e) { log.error("Cannot send email notifications about merge failure", e); } }</code><technical_language>pull this read out of background thread? I thought of reasons background this sort of operation</technical_language>

Target:
private void sendMergeFail(final Change c, final ChangeMessage msg, final boolean makeNew) { try { db.changeMessages().insert(Collections.singleton(msg)); } catch (OrmException err) { log.warn("Cannot record merge failure message", err); } if (makeNew) { try { db.changes().atomicUpdate(c.getId(), new AtomicUpdate<Change>() { @Override public Change update(Change c) { if (c.getStatus().isOpen()) { c.setStatus(Change.Status.NEW); ChangeUtil.updated(c); } return c; } }); } catch (OrmConcurrencyException err) { } catch (OrmException err) { log.warn("Cannot update change status", err); } } else { try { ChangeUtil.touch(c, db); } catch (OrmException err) { log.warn("Cannot update change timestamp", err); } } workQueue.getDefaultQueue() .submit(requestScopePropagator.wrap(new Runnable() { @Override public void run() { PatchSet patchSet; PatchSetApproval submitter; try { ReviewDb reviewDb = schemaFactory.open(); try { patchSet = reviewDb.patchSets().get(c.currentPatchSetId()); submitter = getSubmitter(reviewDb, c.currentPatchSetId()); } finally { reviewDb.close(); } } catch (OrmException e) { log.error("Cannot send email notifications about merge failure", e); return; } try { final MergeFailSender cm = mergeFailSenderFactory.create(c); if (submitter != null) { cm.setFrom(submitter.getAccountId()); } cm.setPatchSet(patchSet); cm.setChangeMessage(msg); cm.send(); } catch (EmailException e) { log.error("Cannot send email notifications about merge failure", e); } } @Override public String toString() { return "send-email merge-failed"; } })); }
Source:
<code>private Node createIdentifierGraphic(Map<Field, String> values) { <START> if (values.size() > 1) { return cellFactory.getTableIcon(StandardField.URLS); } else if (values.size() == 1) { return cellFactory.getTableIcon(StandardField.URL); } else { return null; <END> } }</code><technical_language>suggestion if (values.size() > 1) { return IconTheme.JabRefIcons.MULTIPLE_LINKS.getGraphicNode(); } else if (values.size() == 1) { return IconTheme.JabRefIcons.LINK.getGraphicNode(); } else { return null; } talked in JabCon2020 a bit this load icons instead of introducing a new field URLS in StandardFields in model package for a ui feature</technical_language>

Target:
private Node createIdentifierGraphic(Map<Field, String> values) { if (values.size() > 1) { return IconTheme.JabRefIcons.LINK_VARIANT.getGraphicNode(); } else if (values.size() == 1) { return IconTheme.JabRefIcons.LINK.getGraphicNode(); } else { return null; } }
Source:
<code>public void removeOperators(ID roamingGroupID, List<ID> ids) { for (ID id : ids) { <START> datastore.update(RoamingGroupEntity.class, Filter.where("_id").is(roamingGroupID.value), UpdateStatement.removeFrom("operatorIDs").remove(id.value)); <END> } }</code><technical_language>removeFrom().remove() ? Is for</technical_language>

Target:
public void removeOperators(ID roamingGroupID, List<ID> ids) { RoamingGroupEntity entity = datastore.findById(RoamingGroupEntity.class, roamingGroupID.value); if (entity == null) { throw new NotFoundException("Roaming group is unknown!"); } List<Object> unnecessaryIDs = Lists.newArrayList(); for (ID id : ids) { unnecessaryIDs.add(id.value); } entity.operatorIDs.removeAll(unnecessaryIDs); datastore.update(RoamingGroupEntity.class, Filter.where("_id").is(roamingGroupID.value), UpdateStatement.update("operatorIDs").toBe(entity.operatorIDs)); }
Source:
<code>private static String getActiveConnectorsString() { final IConnector[] activeConnectors = ConnectorFactory.getActiveConnectors(); final StringBuilder activeConnectorsBuilder = new StringBuilder(); for (final IConnector conn : activeConnectors) { try { activeConnectorsBuilder.append(conn.getNameAbbreviated()); activeConnectorsBuilder.append(','); } catch (IllegalStateException ignored) { } } if (activeConnectorsBuilder.length() > 0) { activeConnectorsBuilder.deleteCharAt(activeConnectorsBuilder.length() - 1); } <START> return activeConnectorsBuilder.toString(); <END> }</code><technical_language>This overly complicated me. StringUtils.join() similar instead of reinventing wheel join strings a separator? constructing intermediate list more readable IMO, this method called 30 minutes cgeo-status goes</technical_language>

Target:
private static String getActiveConnectorsString() { final List<IConnector> activeConnectors = ConnectorFactory.getActiveConnectors(); final List<String> activeConnectorsList = new ArrayList<>(); for (final IConnector conn : activeConnectors) { try { activeConnectorsList.add(conn.getNameAbbreviated()); } catch (IllegalStateException ignored) { } } return TextUtils.join(",", activeConnectorsList); }
Source:
<code>private void checkUpdateReportsPanel(final String url, final Map<String, List<String>> params) { try { <START> ReportInit.constructRequestBuilder(buildStatusUrl()).sendRequest(null, new RequestCallback() { <END> @Override public void onError(Request request, Throwable exception) { errorPopupManager.show(applicationConstants.reportsWebAppNotDeployedMsg()); } @Override public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == Response.SC_OK) { reportsWebappDeployed = true; getView().updateReportsPanel(url, params); } else { errorPopupManager.show(applicationConstants.reportsWebAppNotDeployedMsg()); } } }); } catch (RequestException e) { errorPopupManager.show(applicationConstants.reportsWebAppErrorMsg()); } }</code><technical_language>If you"ll change constructServiceRequestBuilder I suggested here- ReportInit.constructServiceRequestBuilder(ReportInit.ReportStatusService). buildStatusUrl() method removed</technical_language>

Target:
private void checkUpdateReportsPanel(final String url, final Map<String, List<String>> params) { try { ReportInit.constructServiceRequestBuilder(ReportInit.ReportStatusService).sendRequest(null, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { errorPopupManager.show(applicationConstants.reportsWebAppNotDeployedMsg()); } @Override public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == Response.SC_OK) { reportsWebappDeployed = true; getView().updateReportsPanel(url, params); } else { errorPopupManager.show(applicationConstants.reportsWebAppNotDeployedMsg()); } } }); } catch (RequestException e) { errorPopupManager.show(applicationConstants.reportsWebAppErrorMsg()); } }
Source:
<code>public void testSpinnerUpdatesRename() { String renamedTag = "tag_renamed"; List<String> spinnerValuesContained = Arrays.asList( getResourcesString(R.string.brick_when_nfc_default_all), getResourcesString(R.string.new_nfc_tag), getResourcesString(R.string.test_tag_name_1), <START> getResourcesString(R.string.test_tag_name_2)); <END> List<String> spinnerValuesNotContained = Arrays.asList(); checkNfcSpinnerContains(nfcBrickPosition, spinnerValuesContained, spinnerValuesNotContained); UiHardwareTestUtils.gotoNfcFragment(nfcBrickPosition); contextMenuActionRename(getResourcesString(R.string.test_tag_name_1), renamedTag); pressBack(); spinnerValuesContained = Arrays.asList( getResourcesString(R.string.brick_when_nfc_default_all), getResourcesString(R.string.new_nfc_tag), getResourcesString(R.string.test_tag_name_2), renamedTag); spinnerValuesNotContained = Arrays.asList( getResourcesString(R.string.test_tag_name_1)); checkNfcSpinnerContains(nfcBrickPosition, spinnerValuesContained, spinnerValuesNotContained); }</code><technical_language>write a checkNfcSpinnerContains accepts stringIds? (to reduce number of getResourcesString calls. currently 39 of in this pr)</technical_language>

Target:
public void testSpinnerUpdatesRename() { String renamedTag = "tag_renamed"; List<String> spinnerValuesContained = getStringsFromResourceIds( R.string.brick_when_nfc_default_all, R.string.new_nfc_tag, R.string.test_tag_name_1, R.string.test_tag_name_2); List<String> spinnerValuesNotContained = Arrays.asList(); checkNfcSpinnerContains(nfcBrickPosition, spinnerValuesContained, spinnerValuesNotContained); UiNFCTestUtils.gotoNfcFragment(nfcBrickPosition); contextMenuActionRename(UiTestUtils.getResourcesString(R.string.test_tag_name_1), renamedTag); pressBack(); spinnerValuesContained = getStringsFromResourceIds( R.string.brick_when_nfc_default_all, R.string.new_nfc_tag, R.string.test_tag_name_2); spinnerValuesContained.add(renamedTag); spinnerValuesNotContained = getStringsFromResourceIds(R.string.test_tag_name_1); checkNfcSpinnerContains(nfcBrickPosition, spinnerValuesContained, spinnerValuesNotContained); }
Source:
<code>private byte newCellState(byte cellSelf, byte neighbourCount) { if (cellSelf == 0) { <START> if (neighbourCount == 3) return (byte) 1; else return (byte) 0; <END> } else { if (neighbourCount == 2 || neighbourCount == 3) return (byte) 1; else return (byte) 0; } }</code><technical_language>braces</technical_language>

Target:
private byte newCellState(byte cellSelf, byte neighbourCount) { if (cellSelf == 0) { if (neighbourCount == 3) { return (byte) 1; } else { return (byte) 0; } } else { if (neighbourCount == 2 || neighbourCount == 3) { return (byte) 1; } else { return (byte) 0; } } }
Source:
<code>public ZkclientZookeeperClient(URL url) { super(url); <START> long timeout = url.getParameter("timeout", 30000L); <END> client = new ZkClientWrapper(url.getBackupAddress(), timeout); client.addListener(new IZkStateListener() { @Override public void handleStateChanged(KeeperState state) throws Exception { ZkclientZookeeperClient.this.state = state; if (state == KeeperState.Disconnected) { stateChanged(StateListener.DISCONNECTED); } else if (state == KeeperState.SyncConnected) { stateChanged(StateListener.CONNECTED); } } @Override public void handleNewSession() throws Exception { stateChanged(StateListener.RECONNECTED); } }); client.start(); }</code><technical_language>30000 a constant org.apache.dubbo.common.Constants#DEFAULT_TIMEOUT is ? do u it. :)</technical_language>

Target:
public ZkclientZookeeperClient(URL url) { super(url); long timeout = url.getParameter(Constants.TIMEOUT_KEY, 30000L); client = new ZkClientWrapper(url.getBackupAddress(), timeout); client.addListener(new IZkStateListener() { @Override public void handleStateChanged(KeeperState state) throws Exception { ZkclientZookeeperClient.this.state = state; if (state == KeeperState.Disconnected) { stateChanged(StateListener.DISCONNECTED); } else if (state == KeeperState.SyncConnected) { stateChanged(StateListener.CONNECTED); } } @Override public void handleNewSession() throws Exception { stateChanged(StateListener.RECONNECTED); } }); client.start(); }
Source:
<code>public Handle open() { try { final long start = System.nanoTime(); Connection conn = connectionFactory.openConnection(); final long stop = System.nanoTime(); StatementBuilder cache = statementBuilderFactory.get().createStatementBuilder(conn); Handle h = new BasicHandle(transactionhandler.get(), statementLocator.get(), cache, statementRewriter.get(), conn, globalStatementAttributes, timingCollector.get(), MappingRegistry.copyOf(mappingRegistry), foreman.createChild(), collectorFactoryRegistry.createChild()); <START> plugins.forEach(p -> p.customizeHandle(h)); <END> LOG.trace("DBI obtain handle in {}ms", this, h, (stop - start) / 1000000L); return h; } catch (SQLException e) { throw new UnableToObtainConnectionException(e); } }</code><technical_language>Minor nit: plugins.forEach(JdbiPlugin::customizeHandle)</technical_language>

Target:
public Handle open() { try { final long start = System.nanoTime(); Connection conn = connectionFactory.openConnection(); final long stop = System.nanoTime(); StatementBuilder cache = statementBuilderFactory.get().createStatementBuilder(conn); Handle h = new BasicHandle(transactionhandler.get(), statementLocator.get(), cache, statementRewriter.get(), conn, globalStatementAttributes, timingCollector.get(), MappingRegistry.copyOf(mappingRegistry), foreman.createChild(), collectorFactoryRegistry.createChild()); for (JdbiPlugin p : plugins) { h = p.customizeHandle(h); } LOG.trace("DBI obtain handle in {}ms", this, h, (stop - start) / 1000000L); return h; } catch (SQLException e) { throw new UnableToObtainConnectionException(e); } }
Source:
<code>public UpdateGlusterHostPubKeyToSlaveParameters(Guid vdsId, List<String> pubKeys) { <START> this(vdsId, pubKeys, "root"); <END> }</code><technical_language>want externalise constants..in a separate patch maybe? call GEOREP_ROOT_USER similar</technical_language>

Target:
public UpdateGlusterHostPubKeyToSlaveParameters(Guid vdsId, List<String> pubKeys) { this(vdsId, pubKeys, null); }
Source:
<code>public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack heldItem = player.getHeldItem(hand); if (!heldItem.isEmpty()) { TileCookingTable tileEntity = (TileCookingTable) world.getTileEntity(pos); if (tileEntity != null) { if (DyeUtils.isDye(heldItem)) { Optional<EnumDyeColor> dyeColor = DyeUtils.colorFromStack(heldItem); if (dyeColor.isPresent() && recolorBlock(world, pos, facing, dyeColor.get())) { <START> if (!player.isCreative()) { <END> heldItem.shrink(1); } } return true; } if (!tileEntity.hasNoFilterBook() && heldItem.getItem() == ModItems.recipeBook && heldItem.getItemDamage() == 0) { tileEntity.setNoFilterBook(heldItem.splitStack(1)); return true; } } } else if (player.isSneaking()) { TileCookingTable tileEntity = (TileCookingTable) world.getTileEntity(pos); if (tileEntity != null) { ItemStack noFilterBook = tileEntity.getNoFilterBook(); if (!noFilterBook.isEmpty()) { if (!player.inventory.addItemStackToInventory(noFilterBook)) { player.dropItem(noFilterBook, false); } tileEntity.setNoFilterBook(ItemStack.EMPTY); return true; } } } if (!world.isRemote) { player.openGui(CookingForBlockheads.instance, GuiHandler.COOKING_TABLE, world, pos.getX(), pos.getY(), pos.getZ()); } return true; }</code><technical_language>isCreative() checks replaced if (!player.capabilities.isCreativeMode) { match Vanilla, item consumption is tied capabilities gamemode itself</technical_language>

Target:
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack heldItem = player.getHeldItem(hand); if (!heldItem.isEmpty()) { TileCookingTable tileEntity = (TileCookingTable) world.getTileEntity(pos); if (tileEntity != null) { if (DyeUtils.isDye(heldItem)) { Optional<EnumDyeColor> dyeColor = DyeUtils.colorFromStack(heldItem); if (dyeColor.isPresent() && recolorBlock(world, pos, facing, dyeColor.get())) { if (!player.capabilities.isCreativeMode) { heldItem.shrink(1); } } return true; } if (!tileEntity.hasNoFilterBook() && heldItem.getItem() == ModItems.recipeBook && heldItem.getItemDamage() == 0) { tileEntity.setNoFilterBook(heldItem.splitStack(1)); return true; } } } else if (player.isSneaking()) { TileCookingTable tileEntity = (TileCookingTable) world.getTileEntity(pos); if (tileEntity != null) { ItemStack noFilterBook = tileEntity.getNoFilterBook(); if (!noFilterBook.isEmpty()) { if (!player.inventory.addItemStackToInventory(noFilterBook)) { player.dropItem(noFilterBook, false); } tileEntity.setNoFilterBook(ItemStack.EMPTY); return true; } } } if (!world.isRemote) { player.openGui(CookingForBlockheads.instance, GuiHandler.COOKING_TABLE, world, pos.getX(), pos.getY(), pos.getZ()); } return true; }
Source:
<code>public static Map<String, DcZkInfo> parseDcJsonAndPopulateDcInfo(String dcInfoJsonString) throws JSONException { Map<String, DcZkInfo> dataCenterToZkAddress = new HashMap<>(); JSONObject root = new JSONObject(dcInfoJsonString); JSONArray all = root.getJSONArray(ZKINFO_STR); for (int i = 0; i < all.length(); i++) { JSONObject entry = all.getJSONObject(i); String name = entry.getString(DATACENTER_STR); byte id = (byte) entry.getInt(DATACENTER_ID_STR); ReplicaType replicaType = entry.optEnum(ReplicaType.class, REPLICA_TYPE_STR, ReplicaType.DISK_BACKED); String[] zkConnectStrs = (replicaType == ReplicaType.DISK_BACKED) ? entry.getString(ZKCONNECTSTR_STR).split(ZKCONNECTSTR_DELIMITER) <START> : entry.optString(ZKCONNECTSTR_STR).split(ZKCONNECTSTR_DELIMITER); <END> DcZkInfo dcZkInfo = new DcZkInfo(name, id, Arrays.asList(zkConnectStrs), replicaType); dataCenterToZkAddress.put(dcZkInfo.dcName, dcZkInfo); } return dataCenterToZkAddress; }</code><technical_language>this result in a NPE, optString for cloud backed replicas. Instead, do Utils.splitString(entry.optString(ZKCONNECT_STR, ""), ZKCONNECTSTR_DELIMITER)</technical_language>

Target:
public static Map<String, DcZkInfo> parseDcJsonAndPopulateDcInfo(String dcInfoJsonString) throws JSONException { Map<String, DcZkInfo> dataCenterToZkAddress = new HashMap<>(); JSONObject root = new JSONObject(dcInfoJsonString); JSONArray all = root.getJSONArray(ZKINFO_STR); for (int i = 0; i < all.length(); i++) { JSONObject entry = all.getJSONObject(i); String name = entry.getString(DATACENTER_STR); byte id = (byte) entry.getInt(DATACENTER_ID_STR); ReplicaType replicaType = entry.optEnum(ReplicaType.class, REPLICA_TYPE_STR, ReplicaType.DISK_BACKED); ArrayList<String> zkConnectStrs = (replicaType == ReplicaType.DISK_BACKED) ? Utils.splitString(entry.getString(ZKCONNECT_STR), ZKCONNECT_STR_DELIMITER) : Utils.splitString(entry.optString(ZKCONNECT_STR), ZKCONNECT_STR_DELIMITER); DcZkInfo dcZkInfo = new DcZkInfo(name, id, zkConnectStrs, replicaType); dataCenterToZkAddress.put(dcZkInfo.dcName, dcZkInfo); } return dataCenterToZkAddress; }
Source:
<code>public void defaultRealm() throws InterruptedException { SyncCredentials credentials = SyncCredentials.nickname("test", true); SyncUser user = SyncUser.login(credentials, Constants.AUTH_URL); SyncConfiguration config = SyncConfiguration.automatic(); Realm realm = Realm.getInstance(config); SyncManager.getSession(config).downloadAllServerChanges(); realm.refresh(); try { <START> assertFalse(realm.isEmpty()); <END> } finally { realm.close(); user.logout(); } }</code><technical_language>I assume false expect Permission schema populated</technical_language>

Target:
public void defaultRealm() throws InterruptedException { SyncCredentials credentials = SyncCredentials.nickname("test", true); SyncUser user = SyncUser.logIn(credentials, Constants.AUTH_URL); SyncConfiguration config = SyncConfiguration.automatic(); Realm realm = Realm.getInstance(config); SyncManager.getSession(config).downloadAllServerChanges(); realm.refresh(); try { assertFalse(realm.isEmpty()); } finally { realm.close(); user.logOut(); } }
Source:
<code>public void process() { Class<?> cls; try { cls = this.getKlass(); } catch (final ClassNotFoundException e) { try { this.fail("missing class", this.klass); } catch (final IOException ex) { throw new QlessException(ex); } throw new QlessException("class not found: " + this.klass, e); } Method method; try { <START> method = cls.getMethod(this.queueName, Job.class); <END> } catch (NoSuchMethodException | SecurityException e) { try { this.fail(e.getMessage(), this.klass + ":" + this.queueName); } catch (final IOException ex) { throw new QlessException(ex); } throw new QlessException("method not found: " + this.queueName, e); } try { if (Modifier.isStatic(method.getModifiers())) { method.invoke(cls, this); } else { method.invoke(cls.newInstance(), this); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException e) { try { this.fail(e.getMessage(), this.klass + ":" + this.queueName); } catch (final IOException ex) { throw new QlessException(ex); } throw new QlessException("fail to invoke " + this.queueName, e); } }</code><technical_language>defer a process method if is function queueName. for instance, support classes this: java class MyJobClass { // This run in 'foo' queue static void foo(final Job job) { ... } // This run in other queues static void process(final Job job) { ... } }</technical_language>

Target:
public void process() throws IOException { Class<?> cls; try { cls = this.getKlass(); } catch (final ClassNotFoundException e) { try { this.fail("missing class", this.klass); } catch (final IOException ex) { throw new QlessException(ex); } throw new QlessException("class not found: " + this.klass, e); } Method method; try { method = cls.getMethod(this.queueName, Job.class); } catch (final NoSuchMethodException e) { try { method = cls.getMethod(ClientHelper.DEFAULT_JOB_METHOD, Job.class); } catch (NoSuchMethodException | SecurityException ex) { this.fail(ex.getMessage(), this.klass + ":" + this.queueName); throw new QlessException("method not found: " + this.queueName, e); } } try { if (Modifier.isStatic(method.getModifiers())) { method.invoke(cls, this); } else { method.invoke(cls.newInstance(), this); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException e) { try { this.fail(e.getMessage(), this.klass + ":" + this.queueName); } catch (final IOException ex) { throw new QlessException(ex); } throw new QlessException("fail to invoke " + this.queueName, e); } }
Source:
<code>public void queueEvent(FacesEvent event) { if (event instanceof FileUploadEvent) { <START> queuedFileUploadEvents += 1; <END> } super.queueEvent(event); }</code><technical_language>Do threading concerns here</technical_language>

Target:
public void queueEvent(FacesEvent event) { if (event instanceof FileUploadEvent) { queuedFileUploadEvents().addAndGet(1); } super.queueEvent(event); }
Source:
<code>public boolean canContinue(CruiseConfig cruiseConfig) { if (!goConfigService.isUserAdmin(user)) { <START> result.unauthorized(LocalizedMessage.string("UNAUTHORIZED_TO_OPERATE"), HealthStateType.unauthorised()); <END> return false; } CaseInsensitiveString environmentName = environmentConfig.name(); if (goConfigService.hasEnvironmentNamed(environmentName)) { result.conflict(LocalizedMessage.string("CANNOT_ADD_ENV_ALREADY_EXISTS", environmentName)); return false; } return true; }</code><technical_language>Kill this constant XML file too</technical_language>

Target:
public boolean canContinue(CruiseConfig cruiseConfig) { if (!goConfigService.isUserAdmin(user)) { result.unauthorized(LocalizedMessage.string("UNAUTHORIZED_TO_OPERATE"), HealthStateType.unauthorised()); return false; } CaseInsensitiveString environmentName = environmentConfig.name(); if (goConfigService.hasEnvironmentNamed(environmentName)) { result.conflict(LocalizedMessage.string("RESOURCE_ALREADY_EXISTS", "environment", environmentName)); return false; } return true; }
Source:
<code>public Optional<Key> authenticate(BasicCredentials credentials) throws AuthenticationException { Key key = new Key(credentials.getUsername(), credentials.getPassword()); <START> if (key == null) { <END> return Optional.absent(); } if (!allKeys.contains(key)) { return Optional.absent(); } return Optional.of(key); }</code><technical_language>need this if, construct a new Key right it, null</technical_language>

Target:
public Optional<Key> authenticate(BasicCredentials credentials) throws AuthenticationException { Key key = new Key(credentials.getUsername(), credentials.getPassword()); if (!allKeys.contains(key)) { return Optional.absent(); } return Optional.of(key); }
Source:
<code>private PostgresDatabase() { try { Class.forName("org.postgresql.Driver"); PostgresDatabase.connectionURL = "jdbc:postgresql:" + getDatabasePath() + File.separator + getDatabaseName(); LOGGER.debug("Database connection URL is: " + PostgresDatabase.connectionURL); <START> storeResponseSerialNumberLock = new Object(); <END> } catch (ClassNotFoundException cnf_ex) { LOGGER.error("Database class could not be loaded", cnf_ex); throw new UnsupportedDatabaseException("The database class could not be loaded."); } }</code><technical_language>This is interesting pattern, I is below</technical_language>

Target:
private PostgresDatabase() { try { Class.forName("org.postgresql.Driver"); PostgresDatabase.connectionURL = "jdbc:postgresql:" + getDatabasePath() + File.separator + getDatabaseName(); LOGGER.debug("Database connection URL is: " + PostgresDatabase.connectionURL); storeResponseSerialNumberLock = new Object(); PropertyUtil propertyUtil = new PropertyUtil(server.getDatabase().getPropertyArray(), KEY_DATABASE_ROOT); if (propertyUtil.extractBoolean(KEY_DATABASE_WIPE_ENABLED, DEFAULT_DATABASE_WIPE_ENABLED)) { long periodMillis = propertyUtil.extractPeriodAsMillis(KEY_DATABASE_WIPE_PERIOD, DEFAULT_DATABASE_WIPE_PERIOD); long thresholdMillis = propertyUtil.extractPeriodAsMillis(KEY_DATABASE_WIPE_THRESHOLD, DEFAULT_DATABASE_WIPE_THRESHOLD); wipeTimer = new Timer(getClass().getSimpleName() + " Postgres Wiper", true); wipeTimer.scheduleAtFixedRate(new PostgresDatabase.WipeTimerTask(thresholdMillis), 0, periodMillis); LOGGER.info("Started Postgres wiper timer; period ms, threshold ms", new Object[]{getDatabaseName(), periodMillis, thresholdMillis}); } else { wipeTimer = null; } } catch (ClassNotFoundException cnf_ex) { LOGGER.error("Database class could not be loaded", cnf_ex); throw new UnsupportedDatabaseException("The database class could not be loaded."); } }
Source:
<code>private void setupDynamicItems() { if (usernameContainer == null) { usernameContainer = getView().findViewById(R.id.nav_item_username); usernamePrimaryText = (TextView) usernameContainer.findViewById(R.id.nav_item_username_primary_text); loginContainer = getView().findViewById(R.id.nav_item_login); } if (app.getUserInfoStorage().isLoggedIn()) { loginContainer.setVisibility(View.GONE); usernameContainer.setVisibility(View.VISIBLE); usernamePrimaryText.setText(app.getUserInfoStorage().getUser().getUsername()); } else { usernameContainer.setVisibility(View.GONE); loginContainer.setVisibility(View.VISIBLE); } if (wikipediaZeroText == null) { <START> wikipediaZeroText = (TextView) getView().findViewById(R.id.nav_item_zero); <END> } if (WikipediaApp.isWikipediaZeroDevmodeOn() && WikipediaApp.getWikipediaZeroDisposition()) { wikipediaZeroText.setText(WikipediaApp.getCarrierMessage()); wikipediaZeroText.setVisibility(View.VISIBLE); } else { wikipediaZeroText.setText(""); wikipediaZeroText.setVisibility(View.GONE); } }</code><technical_language>This rest of findViewByIds</technical_language>

Target:
private void setupDynamicItems() { if (usernameContainer == null) { usernameContainer = getView().findViewById(R.id.nav_item_username); usernamePrimaryText = (TextView) usernameContainer.findViewById(R.id.nav_item_username_primary_text); loginContainer = getView().findViewById(R.id.nav_item_login); } if (app.getUserInfoStorage().isLoggedIn()) { loginContainer.setVisibility(View.GONE); usernameContainer.setVisibility(View.VISIBLE); usernamePrimaryText.setText(app.getUserInfoStorage().getUser().getUsername()); } else { usernameContainer.setVisibility(View.GONE); loginContainer.setVisibility(View.VISIBLE); } if (WikipediaApp.isWikipediaZeroDevmodeOn() && WikipediaApp.getWikipediaZeroDisposition()) { wikipediaZeroText.setText(WikipediaApp.getCarrierMessage()); wikipediaZeroText.setVisibility(View.VISIBLE); } else { wikipediaZeroText.setVisibility(View.GONE); } }
Source:
<code>public SpongePotionBuilder() { <START> super(PotionEffect.class, 2); <END> }</code><technical_language>reference constants</technical_language>

Target:
public SpongePotionBuilder() { super(PotionEffect.class, DataVersions.Potion.CURRENT_VERSION); }
Source:
<code>private static void setPermissions(Path path) throws IOException { if (path.getFileSystem().supportedFileAttributeViews().contains("posix")) { Files.setPosixFilePermissions(path, ONLY_OWNER_FILE_PERMISSIONS); <START> } else { END> path.toFile().setReadable(false, false); path.toFile().setWritable(false, false); path.toFile().setExecutable(false, false); path.toFile().setReadable(true, true); path.toFile().setWritable(true, true); } }</code><technical_language>need else. else case always. Btw I FileUtils operate a Path object directly</technical_language>

Target:
private static void setPermissions(Path path) throws IOException { path.toFile().setReadable(false, false); path.toFile().setWritable(false, false); path.toFile().setExecutable(false, false); path.toFile().setReadable(true, true); path.toFile().setWritable(true, true); }
Source:
<code>public void shouldNotRaiseAlertIfRequestParamsHaveNoValues() throws URIException, NullPointerException { HttpMessage msg = createMessage(); msg.getRequestHeader().setURI(new URI("<LINK_0>", false)); <START> msg.getResponseHeader().setHeader(HttpResponseHeader.SET_COOKIE, "Set-Cookie: aCookie=aValue; Secure"); <END> rule.scanHttpResponseReceive(msg, -1, createSource(msg)); assertThat(alertsRaised.size(), equalTo(0)); }</code><technical_language>Remove</technical_language>

Target:
public void shouldNotRaiseAlertIfRequestParamsHaveNoValues() throws Exception { HttpMessage msg = createMessage(); msg.getRequestHeader().setURI(new URI("<LINK_0>", false)); rule.scanHttpResponseReceive(msg, -1, createSource(msg)); assertThat(alertsRaised.size(), equalTo(0)); }