auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void setOperationParams(int putContentSize, long ttlSecs) { putBlobProperties = new BlobProperties(-1, "serviceId", "memberId", "contentType", false, ttlSecs, Utils.getRandomShort(TestUtils.RANDOM), Utils.getRandomShort(TestUtils.RANDOM), testEncryption); <START> putUserMetadata = new byte[10]; <END> random.nextBytes(putUserMetadata); putContent = new byte[putContentSize]; random.nextBytes(putContent); putChannel = new ByteBufferReadableStreamChannel(ByteBuffer.wrap(putContent)); }</code><technical_language>minor: if useMetadata length is changeable, replace 10 a constant variable</technical_language>

Target:
private void setOperationParams(int putContentSize, long ttlSecs) { putBlobProperties = new BlobProperties(-1, "serviceId", "memberId", "contentType", false, ttlSecs, Utils.getRandomShort(TestUtils.RANDOM), Utils.getRandomShort(TestUtils.RANDOM), testEncryption); putUserMetadata = new byte[USER_METADATA_SIZE]; random.nextBytes(putUserMetadata); putContent = new byte[putContentSize]; random.nextBytes(putContent); putChannel = new ByteBufferReadableStreamChannel(ByteBuffer.wrap(putContent)); }
Source:
<code>public void testCheckPropertyAccessDeniedProperty() { String key = "mockDeniedProperty"; <START> System.setProperty("denied.system.properties", "mockDeniedProperty"); <END> carbonSecurityManager = new CarbonSecurityManager(); carbonSecurityManager.checkPropertyAccess(key); }</code><technical_language>variable in here, 'key' instead of string itself</technical_language>

Target:
public void testCheckPropertyAccessDeniedProperty() { String key = "mockDeniedProperty"; System.setProperty("denied.system.properties", key); carbonSecurityManager = new CarbonSecurityManager(); carbonSecurityManager.checkPropertyAccess(key); }
Source:
<code>private static void checkValidEntityName(String entityName, int maxEntityNameLength, boolean allowSeparator) { if (entityName == null || entityName.isEmpty()) { <START> throw new IllegalArgumentException("Entity name cannot be null."); <END> } String tempName = entityName.replace('\\', '/'); if (tempName.length() > maxEntityNameLength) { throw new IllegalArgumentException("Entity path " + entityName + " exceeds the " + maxEntityNameLength + " character limit"); } if (tempName.startsWith(PATH_DELIMITER) || tempName.endsWith(PATH_DELIMITER)) { throw new IllegalArgumentException("The entity name cannot contain '/' as prefix or suffix."); } if (!allowSeparator && tempName.contains(PATH_DELIMITER)) { throw new IllegalArgumentException("The entity name contains an invalid character '" + PATH_DELIMITER + "'"); } for (char key : ManagementClientConstants.INVALID_ENTITY_PATH_CHARACTERS) { if (entityName.indexOf(key) >= 0) { throw new IllegalArgumentException(entityName + " contains character '" + key + "' which is not allowed" + "because it is reserved in the Uri scheme."); } } }</code><technical_language>Swap Objects.requireNotNull</technical_language>

Target:
private static void checkValidEntityName(String entityName, int maxEntityNameLength, boolean allowSeparator) { if (entityName == null || entityName.isEmpty()) { throw new IllegalArgumentException("Entity name cannot be null"); } String tempName = entityName.replace('\\', '/'); if (tempName.length() > maxEntityNameLength) { throw new IllegalArgumentException("Entity path " + entityName + " exceeds the " + maxEntityNameLength + " character limit"); } if (tempName.startsWith(PATH_DELIMITER) || tempName.endsWith(PATH_DELIMITER)) { throw new IllegalArgumentException("The entity name cannot contain '/' as prefix or suffix."); } if (!allowSeparator && tempName.contains(PATH_DELIMITER)) { throw new IllegalArgumentException("The entity name contains an invalid character '" + PATH_DELIMITER + "'"); } for (char key : ManagementClientConstants.INVALID_ENTITY_PATH_CHARACTERS) { if (entityName.indexOf(key) >= 0) { throw new IllegalArgumentException(entityName + " contains character '" + key + "' which is not allowed" + "because it is reserved in the Uri scheme."); } } }
Source:
<code>private static void updateTimeNotification(String machine, Context context, long timeLeft) { <START> if (notifcationIds == null || self == null) { <END> return; } int id = notifcationIds.get(machine); String countDown; if (timeLeft > 0) { countDown = String.format("%01d minutes left", TimeUnit.MILLISECONDS.toMinutes(timeLeft)); } else { timeLeft = 0; countDown = " is finished!"; } NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); Intent cancelIntent = new Intent(context, NotificationCancelReceiver.class); cancelIntent.putExtra("timeLeft", timeLeft); cancelIntent.putExtra("notificationId", id); cancelIntent.putExtra("machine", machine); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, cancelIntent, PendingIntent.FLAG_UPDATE_CURRENT); android.support.v4.app.NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setContentTitle(machine) .setContentText(countDown) .setSmallIcon(R.drawable.ic_machine_notification) .setColor(ContextCompat.getColor(context, R.color.Available)) .setGroup(GROUP_KEY_EMAILS) .addAction(R.drawable.ic_action_content_clear, "Cancel", pendingIntent) .setOngoing(true) .setPriority(id); if (timeLeft == 0) { builder.setOngoing(false); } if (timeLeft == 0 || (countDown.equals("5:00"))) { AnalyticsHelper.sendEventHit("Reminders", "Passive", "Timer Finished"); builder.setVibrate(new long[]{1000, 1000, 1000}); } notificationManager.notify(id, builder.build()); }</code><technical_language>error is this fixing? I a NPE, do happens</technical_language>

Target:
private static void updateTimeNotification(String machine, Context context, long timeLeft) { if (notifcationIds == null || self == null) { AnalyticsHelper.sendErrorHit(new NullPointerException("notificationIds or service null"), false); return; } int id = notifcationIds.get(machine); String countDown; if (timeLeft > 0) { countDown = String.format("%01d minutes left", TimeUnit.MILLISECONDS.toMinutes(timeLeft)); } else { timeLeft = 0; countDown = " is finished!"; } NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); Intent cancelIntent = new Intent(context, NotificationCancelReceiver.class); cancelIntent.putExtra("timeLeft", timeLeft); cancelIntent.putExtra("notificationId", id); cancelIntent.putExtra("machine", machine); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, cancelIntent, PendingIntent.FLAG_UPDATE_CURRENT); android.support.v4.app.NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setContentTitle(machine) .setContentText(countDown) .setSmallIcon(R.drawable.ic_machine_notification) .setColor(ContextCompat.getColor(context, R.color.Available)) .setGroup(GROUP_KEY_EMAILS) .addAction(R.drawable.ic_action_content_clear, "Cancel", pendingIntent) .setOngoing(true) .setPriority(id); if (timeLeft == 0) { builder.setOngoing(false); } if (timeLeft == 0 || (countDown.equals("5:00"))) { AnalyticsHelper.sendEventHit("Reminders", "Passive", "Timer Finished"); builder.setVibrate(new long[]{1000, 1000, 1000}); } notificationManager.notify(id, builder.build()); }
Source:
<code>public Map marshal(java.util.Map<String, java.lang.Object> input) throws Exception { if (input == null) { return null; } else { Map output = new Map(); <START> for (String key : input.keySet()) { <END> java.lang.Object value = input.get(key); if (value instanceof java.util.Map) { java.util.Map<String, java.lang.Object> nestedMap = new HashMap<>(); ((java.util.Map<?, ?>) value).forEach((k, v) -> nestedMap.put(k.toString(), v)); value = marshal(nestedMap); } output.getEntries().add(new MapEntry().withKey(key).withValue(value)); } return output; } }</code><technical_language>iterate entry set if need access key value</technical_language>

Target:
public Map marshal(java.util.Map<String, java.lang.Object> input) throws Exception { if (input == null) { return null; } else { Map output = new Map(); for (java.util.Map.Entry<String, java.lang.Object> entry : input.entrySet()) { String key = entry.getKey(); java.lang.Object value = entry.getValue(); if (value instanceof java.util.Map) { java.util.Map<String, java.lang.Object> nestedMap = new HashMap<>(); ((java.util.Map<?, ?>) value).forEach((k, v) -> nestedMap.put(k.toString(), v)); value = marshal(nestedMap); } output.getEntries().add(new MapEntry().withKey(key).withValue(value)); } return output; } }
Source:
<code>protected Properties getProperties(File file, Properties defaultProperties) { Properties properties = new Properties(defaultProperties); copySystemProperty(KEY_LIBRA_DOMAIN, properties); copySystemProperty(KEY_LIBRA_SERVER, properties); copySystemProperty(KEY_RHLOGIN, properties); copySystemProperty(KEY_PASSWORD, properties); copySystemProperty(KEY_CLIENT_ID, properties); <START> copySystemProperty(OPENSHIFT_TIMEOUT, properties); <END> return properties; }</code><technical_language>stick common scheme KEY_XXXX</technical_language>

Target:
protected Properties getProperties(File file, Properties defaultProperties) { Properties properties = new Properties(defaultProperties); copySystemProperty(KEY_LIBRA_DOMAIN, properties); copySystemProperty(KEY_LIBRA_SERVER, properties); copySystemProperty(KEY_RHLOGIN, properties); copySystemProperty(KEY_PASSWORD, properties); copySystemProperty(KEY_CLIENT_ID, properties); copySystemProperty(KEY_OPENSHIFT_TIMEOUT, properties); return properties; }
Source:
<code>@Override public String convertToCompilableExpression(String expression, Class<?> objectType, Class<?> returnType) { if (expression.startsWith(".")) { expression = expression.substring(1); } if (expression.isEmpty()) { throw new IllegalArgumentException("The getter expression: \"" + expression + "\" is invalid."); } Pattern entry = Pattern.compile(variablePlaceholderPattern); Matcher matcher = entry.matcher(expression); StringBuffer sb = new StringBuffer(); while (matcher.find()) { if (matcher.groupCount() == 1) { try { matcher.appendReplacement(sb, getObjectJavaExpression(matcher.group(1), objectType)); } catch (NoSuchFieldException e) { throw new RuntimeException("Failed to parse the operand: " + matcher.group(1), e); } } else { throw new RuntimeException("Invalid expression: " + matcher.group()); } } matcher.appendTail(sb); if (sb.toString().equals(expression)) { <START> if (!expression.startsWith("$.")) { <END> expression = "$." + expression; } try { String tempExpr = getObjectJavaExpression(expression, objectType); sb.setLength(0); sb.append(tempExpr.replace("\\$", "$")); } catch (NoSuchFieldException e) { throw new RuntimeException("Failed to create expression.", e); } } return "return ((" + returnType.getName().replace("$", "\\$") + ")" + sb.toString() + ");"; }</code><technical_language>a variable for "$"</technical_language>

Target:
public String convertToCompilableExpression(String expression, Class<?> objectType, Class<?> returnType) { if (expression.startsWith(".")) { expression = expression.substring(1); } if (expression.isEmpty()) { throw new IllegalArgumentException("The getter expression: \"" + expression + "\" is invalid."); } Pattern entry = Pattern.compile(variablePlaceholderPattern); Matcher matcher = entry.matcher(expression); StringBuffer sb = new StringBuffer(); while (matcher.find()) { if (matcher.groupCount() == 1) { matcher.appendReplacement(sb, getObjectJavaExpression(matcher.group(1), objectType)); } else { throw new RuntimeException("Invalid expression: " + matcher.group()); } } matcher.appendTail(sb); if (sb.toString().equals(expression)) { if (!expression.startsWith(this.exprObjPlaceholder + ".")) { expression = this.exprObjPlaceholder + "." + expression; } String tempExpr = getObjectJavaExpression(expression, objectType); sb.setLength(0); sb.append(tempExpr.replace("\\$", "$")); } return "return ((" + returnType.getName().replace("$", "\\$") + ")" + sb.toString() + ");"; }
Source:
<code>private void allocateTimestamp() throws Exception { Stat stat = new Stat(); <START> synchronized (this) { <END> while (!curatorFramework.getState().equals(CuratorFrameworkState.STARTED)) { Thread.sleep(200); } byte[] d = curatorFramework.getData().storingStatIn(stat).forPath(maxTsPath); long newMax = Long.parseLong(new String(d)) + 1000; curatorFramework.setData().withVersion(stat.getVersion()).forPath(maxTsPath, LongUtil.toByteArray(newMax)); maxTs = newMax; } if (!isLeader) { throw new IllegalStateException(); } }</code><technical_language>I adding this synchronized block effect this method is called a synchronized method</technical_language>

Target:
private void allocateTimestamp() throws Exception { Stat stat = new Stat(); while (!curatorFramework.getState().equals(CuratorFrameworkState.STARTED)) { Thread.sleep(200); } byte[] d = curatorFramework.getData().storingStatIn(stat).forPath(maxTsPath); long newMax = Long.parseLong(new String(d)) + 1000; curatorFramework.setData().withVersion(stat.getVersion()).forPath(maxTsPath, LongUtil.toByteArray(newMax)); maxTs = newMax; if (!isLeader) { throw new IllegalStateException(); } }
Source:
<code>public void setMenuItems(@Nullable List<CarMenuItem> items) { mMenuItems = items; List<CarMenuItem> actionItems = new ArrayList<>(); <START> mOverflowMenuItems = new ArrayList<>(); <END> mActionViews.forEach(this::removeView); mActionViews.clear(); if (mMenuItems != null) { mMenuItems.forEach(item -> { if (item.getDisplayBehavior() == CarMenuItem.DisplayBehavior.NEVER) { mOverflowMenuItems.add(item); } else { actionItems.add(item); } }); } mOverflowButtonView.setVisibility(mOverflowMenuItems.isEmpty() ? GONE : VISIBLE); actionItems.forEach(item -> { View view = item.isCheckable() ? createCheckableAction(item) : createAction(item); MarginLayoutParams marginLayoutParams = new MarginLayoutParams(LayoutParams.WRAP_CONTENT, mActionButtonHeight); view.setLayoutParams(marginLayoutParams); mActionViews.add(view); addView(view); }); requestLayout(); }</code><technical_language>call clear() instead</technical_language>

Target:
public void setMenuItems(@Nullable List<CarMenuItem> items) { mMenuItems = items; List<CarMenuItem> actionItems = new ArrayList<>(); mOverflowMenuItems.clear(); mActionViews.forEach(this::removeView); mActionViews.clear(); if (mMenuItems != null) { for (CarMenuItem item : mMenuItems) { if (item.getDisplayBehavior() == CarMenuItem.DisplayBehavior.ALWAYS) { actionItems.add(item); } else { mOverflowMenuItems.add(item); } } } mOverflowButtonView.setVisibility(mOverflowMenuItems.isEmpty() ? GONE : VISIBLE); for (CarMenuItem item : actionItems) { View view = item.isCheckable() ? createCheckableAction(item) : createAction(item); MarginLayoutParams marginLayoutParams = new MarginLayoutParams(LayoutParams.WRAP_CONTENT, mActionButtonHeight); view.setLayoutParams(marginLayoutParams); mActionViews.add(view); addView(view); } requestLayout(); }
Source:
<code>public void testPrintBranch() throws Exception { final DetailAST ast = JavaParser.parseFile( new File(getPath("InputAstTreeStringPrinterPrintBranch.java")), JavaParser.Options.WITHOUT_COMMENTS); final String eol = System.lineSeparator(); final String expected = "CLASS_DEF -> CLASS_DEF [3:0]" + eol + "|--MODIFIERS -> MODIFIERS [3:0]" + eol <START> + "| `--LITERAL_PUBLIC -> public [3:0]" + eol; <END> final DetailAST nodeToPrint = ast.getNextSibling().getFirstChild().getFirstChild(); final String result = AstTreeStringPrinter.printBranch(nodeToPrint); Assert.assertEquals("Branches do not match", expected, result); }</code><technical_language>util method</technical_language>

Target:
public void testPrintBranch() throws Exception { final DetailAST ast = JavaParser.parseFile( new File(getPath("InputAstTreeStringPrinterPrintBranch.java")), JavaParser.Options.WITH_COMMENTS); final String expected = addEndOfLine( "CLASS_DEF -> CLASS_DEF [3:0]", "|--MODIFIERS -> MODIFIERS [3:0]", "| `--LITERAL_PUBLIC -> public [3:0]"); final DetailAST nodeToPrint = ast.getNextSibling().getFirstChild().getFirstChild(); final String result = AstTreeStringPrinter.printBranch(nodeToPrint); assertThat("Branches do not match", result, is(expected)); }
Source:
<code><START> public static <T> Flowable<T> fromOptional(@NonNull Optional<T> optional) { <END> ObjectHelper.requireNonNull(optional, "optional is null"); return optional.map(Flowable::just).orElseGet(Flowable::empty); }</code><technical_language>+NonNull for return type</technical_language>

Target:
public static <T> Flowable<@NonNull T> fromOptional(@NonNull Optional<T> optional) { ObjectHelper.requireNonNull(optional, "optional is null"); return optional.map(Flowable::just).orElseGet(Flowable::empty); }
Source:
<code>public void run() { Class c = null; try { <START> c = Class.forName("org.apache.harmony.jpda.tests.jdwp.ObjectReference.InvokeMethodDefault002Debuggee$TestClass"); <END> } catch (ClassNotFoundException e) { e.printStackTrace(); } synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY); logWriter.println("InvokeMethodDefault002Debuggee"); synchronizer.receiveMessageWithoutException("org.apache.harmony.jpda.tests.jdwp.ObjectReference.InvokeMethodDefault002Debuggee(#1)"); execMethod(); synchronizer.receiveMessageWithoutException("org.apache.harmony.jpda.tests.jdwp.ObjectReference.InvokeMethodDefault002Debuggee(#2)"); }</code><technical_language>Long line</technical_language>

Target:
public void run() { Class c = null; String packageName = "org.apache.harmony.jpda.tests.jdwp."; try { c = Class.forName( packageName + "ObjectReference.InvokeMethodDefault002Debuggee$TestClass"); } catch (ClassNotFoundException e) { e.printStackTrace(); } synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY); logWriter.println("InvokeMethodDefault002Debuggee"); synchronizer.receiveMessageWithoutException( packageName + "ObjectReference.InvokeMethodDefault002Debuggee(#1)"); execMethod(); synchronizer.receiveMessageWithoutException( packageName + "ObjectReference.InvokeMethodDefault002Debuggee(#2)"); }
Source:
<code>public static ViewTypes getViewType(String viewName) { switch (viewName) { case TOKENS: case LEMMA: case POS: return ViewTypes.TOKEN_LABEL_VIEW; case SENTENCE: case PARAGRAPH: <START> case NER_ACE: <END> case NER_CONLL: case NER_ONTONOTES: case SHALLOW_PARSE: case QUANTITIES: case WIKIFIER: case CLAUSES_CHARNIAK: case CLAUSES_STANFORD: case CLAUSES_BERKELEY: case BROWN_CLUSTERS: case GAZETTEER: case TREE_GAZETTEER: case GAZETTEER_NE: return ViewTypes.SPAN_LABEL_VIEW; case DEPENDENCY: case DEPENDENCY_STANFORD: case DEPENDENCY_HEADFINDER: return ViewTypes.DEPENDENCY_VIEW; case PARSE_GOLD: case PARSE_CHARNIAK: case PARSE_CHARNIAK_KBEST: case PSEUDO_PARSE_CHARNIAK: case PARSE_STANFORD: case PARSE_STANFORD_KBEST: case PSEUDO_PARSE_STANFORD: case PARSE_BERKELEY: case PSEUDO_PARSE_BERKELEY: return ViewTypes.PARSE_VIEW; case SRL_VERB: case SRL_NOM: case SRL_PREP: return ViewTypes.PREDICATE_ARGUMENT_VIEW; case COREF: case COREF_HEAD: case COREF_EXTENT: return ViewTypes.COREF_VIEW; } return null; }</code><technical_language>I for clarity call this "MENTION_ACE" non-Named Entity mentions (correct if wrong)</technical_language>

Target:
public static ViewTypes getViewType(String viewName) { switch (viewName) { case TOKENS: case LEMMA: case POS: return ViewTypes.TOKEN_LABEL_VIEW; case SENTENCE: case PARAGRAPH: case MENTION_ACE: case NER_CONLL: case NER_ONTONOTES: case SHALLOW_PARSE: case QUANTITIES: case WIKIFIER: case CLAUSES_CHARNIAK: case CLAUSES_STANFORD: case CLAUSES_BERKELEY: case BROWN_CLUSTERS: case GAZETTEER: case TREE_GAZETTEER: case GAZETTEER_NE: return ViewTypes.SPAN_LABEL_VIEW; case DEPENDENCY: case DEPENDENCY_STANFORD: case DEPENDENCY_HEADFINDER: return ViewTypes.DEPENDENCY_VIEW; case PARSE_GOLD: case PARSE_CHARNIAK: case PARSE_CHARNIAK_KBEST: case PSEUDO_PARSE_CHARNIAK: case PARSE_STANFORD: case PARSE_STANFORD_KBEST: case PSEUDO_PARSE_STANFORD: case PARSE_BERKELEY: case PSEUDO_PARSE_BERKELEY: return ViewTypes.PARSE_VIEW; case SRL_VERB: case SRL_NOM: case SRL_PREP: return ViewTypes.PREDICATE_ARGUMENT_VIEW; case COREF: case COREF_HEAD: case COREF_EXTENT: return ViewTypes.COREF_VIEW; } return null; }
Source:
<code><START> public Cluster getClusterByHostId(Guid hostId) { <END> final String sql = "select cluster.* \n" + "from cluster_view as cluster \n" + "join vds_static on vds_static.cluster_id = cluster.cluster_id \n" + "where vds_static.vds_id = :v_hostId"; final MapSqlParameterSource customMapSqlParameterSource = getCustomMapSqlParameterSource() .addValue("hostId", hostId); final NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(getJdbcTemplate()); return namedParameterJdbcTemplate.queryForObject(sql, customMapSqlParameterSource, clusterRowMapper); }</code><technical_language>1. Please infra team is ok a stored procedure. 2. Consider implementing SearchDao</technical_language>

Target:
public Cluster getClusterByHostId(Guid hostId) { final String sql = "select cluster.* \n" + "from cluster_view as cluster \n" + "join vds_static on vds_static.cluster_id = cluster.cluster_id \n" + "where vds_static.vds_id = :v_hostId"; final MapSqlParameterSource customMapSqlParameterSource = getCustomMapSqlParameterSource() .addValue("hostId", hostId); return getNamedParameterJdbcTemplate().queryForObject(sql, customMapSqlParameterSource, clusterRowMapper); }
Source:
<code>public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { BuildData buildData = build.getAction(BuildData.class); String sha1 = ObjectId.toString(buildData.getLastBuiltRevision().getSha1()); <START> GitHubPushCause cause = build.getCause(GitHubPushCause.class); <END> GitHubTrigger trigger = (GitHubTrigger) build.getProject().getTrigger(GitHubPushTrigger.class); for (GitHubRepositoryName gitHubRepositoryName : trigger.getGitHubRepositories()) { for (GHRepository repository : gitHubRepositoryName.resolve()) { GHCommitState state; String msg; Result result = build.getResult(); if (result.isBetterOrEqualTo(SUCCESS)) { state = GHCommitState.SUCCESS; msg = "Success"; } else if (result.isBetterOrEqualTo(UNSTABLE)) { state = GHCommitState.FAILURE; msg = "Unstable"; } else { state = GHCommitState.ERROR; msg = "Failed"; } listener.getLogger().println("setting commit status on Github for " + repository.getUrl() + "/commit/" + sha1); repository.createCommitStatus(sha1, state, build.getAbsoluteUrl(), msg); } } return true; }</code><technical_language>is</technical_language>

Target:
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { BuildData buildData = build.getAction(BuildData.class); String sha1 = ObjectId.toString(buildData.getLastBuiltRevision().getSha1()); GitHubTrigger trigger = (GitHubTrigger) build.getProject().getTrigger(GitHubPushTrigger.class); for (GitHubRepositoryName gitHubRepositoryName : trigger.getGitHubRepositories()) { for (GHRepository repository : gitHubRepositoryName.resolve()) { GHCommitState state; String msg; Result result = build.getResult(); if (result.isBetterOrEqualTo(SUCCESS)) { state = GHCommitState.SUCCESS; msg = "Success"; } else if (result.isBetterOrEqualTo(UNSTABLE)) { state = GHCommitState.FAILURE; msg = "Unstable"; } else { state = GHCommitState.ERROR; msg = "Failed"; } listener.getLogger().println("setting commit status on Github for " + repository.getUrl() + "/commit/" + sha1); repository.createCommitStatus(sha1, state, build.getAbsoluteUrl(), msg); } } return true; }
Source:
<code>public boolean isStandardHeader(String value) { <START> return STANDARD_HEADERS.contains(value.toUpperCase()); <END> }</code><technical_language>Consider check null parameter</technical_language>

Target:
public boolean isStandardHeader(String value) { return NullChecker.isNotNullish(value) ? STANDARD_HEADERS.contains(value.toUpperCase()) : false; }
Source:
<code><START> public void cancel() <END></code><technical_language>This need public, protected</technical_language>

Target:
protected void cancel()
Source:
<code>private void loadData() { discountFragmentViewModel.getDiscountCodes().observe(this, discountCodes -> { this.discountCodes.clear(); this.discountCodes.addAll(discountCodes); discountCodesListAdapter.notifyDataSetChanged(); handleVisibility(); <START> Timber.d("Total discount codes +"+this.discountCodes.size()); <END> }); }</code><technical_language>Please do this logging ViewModel if possible</technical_language>

Target:
private void loadData() { discountFragmentViewModel.getDiscountCodes().observe(this, discountCodes -> { this.discountCodes.clear(); this.discountCodes.addAll(discountCodes); discountCodesListAdapter.notifyDataSetChanged(); handleVisibility(); }); }
Source:
<code>public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.inMemory() .withClient("my-trusted-client") .authorizedGrantTypes("password", "authorization_code", "refresh_token", "implicit") .authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT") .scopes("read", "write", "trust") .resourceIds("oauth2-resource") .accessTokenValiditySeconds(60) .redirectUris("https://anywhere") .and() .withClient("my-client-with-registered-redirect") .authorizedGrantTypes("authorization_code") .authorities("ROLE_CLIENT") .scopes("read", "trust") .resourceIds("oauth2-resource") .redirectUris("https://anywhere?key=value") .and() .withClient("my-client-with-secret") .authorizedGrantTypes("client_credentials", "password") .authorities("ROLE_CLIENT") .scopes("read") .resourceIds("oauth2-resource") .secret("secret") .and() <START> .withClient("my-client-with-unlimited-scopes") <END> .authorizedGrantTypes("password", "refresh_token"); }</code><technical_language>rename client-id my-client-with-empty-scopes. Please apply instances</technical_language>

Target:
public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.inMemory() .withClient("my-trusted-client") .authorizedGrantTypes("password", "authorization_code", "refresh_token", "implicit") .authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT") .scopes("read", "write", "trust") .resourceIds("oauth2-resource") .accessTokenValiditySeconds(60) .redirectUris("https://anywhere") .and() .withClient("my-client-with-registered-redirect") .authorizedGrantTypes("authorization_code") .authorities("ROLE_CLIENT") .scopes("read", "trust") .resourceIds("oauth2-resource") .redirectUris("https://anywhere?key=value") .and() .withClient("my-client-with-secret") .authorizedGrantTypes("client_credentials", "password") .authorities("ROLE_CLIENT") .scopes("read") .resourceIds("oauth2-resource") .secret("secret") .and() .withClient("my-client-with-empty-scopes") .authorizedGrantTypes("password", "refresh_token"); }
Source:
<code>public ProductResource getProduct(@QueryParam("productId") String productId) throws WebApplicationException { if (productId == null || productId.trim().equals("")) { throw new BadRequestException(ErrorTypes.BAD_REQUEST_EXCEPTION_PRODUCT_RESOURCE.getErrorType()); } try { FileManagerClient client = getContextClient(); Product product = client.getProductById(productId); product.setProductReferences(client.getProductReferences(product)); return new ProductResource(product, client.getMetadata(product), product.getProductReferences(), getContextWorkingDir()); } catch (Exception e) { String message = "Unable to find the requested resource."; <START> LOGGER.log(Level.FINE, message, e); <END> throw new NotFoundException(e.getMessage()); } }</code><technical_language>ok print error log. Fine for now</technical_language>

Target:
public ProductResource getProduct(@QueryParam("productId") String productId) throws WebApplicationException { if (productId == null || productId.trim().equals("")) { throw new BadRequestException( ErrorType.BAD_REQUEST_EXCEPTION_PRODUCT_RESOURCE.getErrorType()); } try { FileManagerClient client = getContextClient(); Product product = client.getProductById(productId); product.setProductReferences(client.getProductReferences(product)); return new ProductResource( product, client.getMetadata(product), product.getProductReferences(), getContextWorkingDir()); } catch (Exception e) { throw new NotFoundException(e.getMessage()); } }
Source:
<code>public Invocations getInvocations() { return new Invocations.Builder() <START> .invocation().methods(GET).path("/v2/logging/loggers").handleWith(this::listLoggers) <END> .invocation().methods(GET).path("/v2/logging/appenders").handleWith(this::listAppenders) .invocation().methods(DELETE).path("/v2/logging/loggers/{loggerName}").handleWith(this::deleteLogger) .invocation().methods(PUT).path("/v2/logging/loggers/{loggerName}").handleWith(this::setLogger) .create(); }</code><technical_language>This resource affect local server, correct? I wondering if mapped /v2/server/logging</technical_language>

Target:
public Invocations getInvocations() { return new Invocations.Builder() .invocation().methods(GET).path("/v2/logging/loggers").handleWith(this::listLoggers) .invocation().methods(GET).path("/v2/logging/appenders").handleWith(this::listAppenders) .invocation().methods(DELETE).path("/v2/logging/loggers/{loggerName}").handleWith(this::deleteLogger) .invocation().methods(PUT).path("/v2/logging/loggers/{loggerName}").handleWith(this::setLogger) .invocation().methods(PUT).path("/v2/logging/loggers").handleWith(this::setLogger) .create(); }
Source:
<code>public String read(AccessRecord record) { <START> if (new UriUpdateTableFilter().matches(record)) { <END> return "Update"; } if (new UriQueryTableFilter().matches(record)) { return "Query"; } if (new UriDownloadTableFilter().matches(record)) { return "Download"; } if (new UriUploadTableFilter().matches(record)) { return "Upload"; } return "Uncategorized"; }</code><technical_language>filters created fly. time a filter is created compiles a regex. is more efficient set final fields of filters reuse them</technical_language>

Target:
public String read(AccessRecord record) { if (UPDATE_FILTER.matches(record)) { return "Update"; } if (QUERY_FILTER.matches(record)) { return "Query"; } if (DOWNLOAD_FILTER.matches(record)) { return "Download"; } if (UPLOAD_FILTER.matches(record)) { return "Upload"; } return "Uncategorized"; }
Source:
<code>public void visitNode(Tree tree) { if(tree.parent().is(Tree.Kind.IF_STATEMENT)) { IfStatementTree parentIf = (IfStatementTree) tree.parent(); if(tree.equals(parentIf.elseStatement())) { return; } } IfStatementTree ifStatementTree = (IfStatementTree) tree; int level = 1; while (ifStatementTree.elseKeyword() != null && ifStatementTree.elseStatement().is(Tree.Kind.IF_STATEMENT)) { level++; if(!sameEqualCondition(ifStatementTree.condition(), ((IfStatementTree) ifStatementTree.elseStatement()).condition())) { level = 0; break; } ifStatementTree = (IfStatementTree) ifStatementTree.elseStatement(); } if(level > 2) { <START> reportIssue(tree, "Convert this \"if/else if\" structure into a \"switch\"."); <END> } }</code><technical_language>I add missing version message end of issue message. reportIssue(tree, "Convert this \"if/else if\" structure a \"switch\"." + context.getJavaVersion().java7CompatibilityMessage());</technical_language>

Target:
public void visitNode(Tree tree) { if(tree.parent().is(Tree.Kind.IF_STATEMENT)) { IfStatementTree parentIf = (IfStatementTree) tree.parent(); if(tree.equals(parentIf.elseStatement())) { return; } } IfStatementTree ifStatementTree = (IfStatementTree) tree; int level = 1; while (ifStatementTree.elseKeyword() != null && ifStatementTree.elseStatement().is(Tree.Kind.IF_STATEMENT)) { level++; if(!sameEqualCondition(ifStatementTree.condition(), ((IfStatementTree) ifStatementTree.elseStatement()).condition())) { level = 0; break; } ifStatementTree = (IfStatementTree) ifStatementTree.elseStatement(); } if(level > 2) { reportIssue(((IfStatementTree) tree).condition(), "Convert this \"if/else if\" structure into a \"switch\"." + context.getJavaVersion().java7CompatibilityMessage()); } }
Source:
<code>void handleCommandLineArg(final MainController ctrl, String arg) { <START> File file = new File(arg); <END> if (!file.exists()) { if (!file.mkdirs()) { return; } } else if (file.isFile()) { if (file.getName().toLowerCase().endsWith(Aes256Cryptor.MASTERKEY_FILE_EXT.toLowerCase())) { file = file.getParentFile(); } else { return; } } File f = file; Platform.runLater(() -> { ctrl.addDirectory(f); ctrl.toFront(); }); }</code><technical_language>Please avoid APIs, NIO here: FileSystems.getDefault().getPath(arg)</technical_language>

Target:
void handleCommandLineArg(final MainController ctrl, String arg) { Path file = FileSystems.getDefault().getPath(arg); if (!Files.exists(file)) { try { if (!Files.isDirectory(Files.createDirectories(file))) { return; } } catch (IOException e) { return; } } else if (Files.isRegularFile(file)) { if (StringUtils.endsWithIgnoreCase(file.getFileName().toString(), Aes256Cryptor.MASTERKEY_FILE_EXT)) { file = file.getParent(); } else { return; } } Path f = file; Platform.runLater(() -> { ctrl.addDirectory(f); ctrl.toFront(); }); }
Source:
<code>public void dispose() { <START> treeViewerManager.dispose(); <END> treeViewerManager = null; super.dispose(); if (getAdapterFactory() instanceof IDisposable) { ((IDisposable) getAdapterFactory()).dispose(); } if (refreshAtOpeningActivator != null) { getSite().getPage().removePartListener(refreshAtOpeningActivator); refreshAtOpeningActivator = null; } }</code><technical_language>If set fields null is generally a good idea dispose() fail if called twice. In this case get NPE here</technical_language>

Target:
public void dispose() { super.dispose(); if (getAdapterFactory() instanceof IDisposable) { ((IDisposable) getAdapterFactory()).dispose(); } if (refreshAtOpeningActivator != null) { getSite().getPage().removePartListener(refreshAtOpeningActivator); refreshAtOpeningActivator = null; } }
Source:
<code>static Spanned enrichText(String text, List<Pair<Integer, Integer>> positions, Context context) { SpannableString enriched = new SpannableString(text); int primaryColor = UIColors.getPrimaryColor(context); for (Pair<Integer, Integer> position : positions) { enriched.setSpan( <START> new ForegroundColorSpan(primaryColor), <END> position.first, position.second, Spannable.SPAN_INCLUSIVE_INCLUSIVE ); } return enriched; }</code><technical_language>do need create a new everytime</technical_language>

Target:
Spanned enrichText(String text, List<Pair<Integer, Integer>> positions, Context context) { SpannableString enriched = new SpannableString(text); int primaryColor = UIColors.getPrimaryColor(context); for (Pair<Integer, Integer> position : positions) { enriched.setSpan( new ForegroundColorSpan(primaryColor), position.first, position.second, Spannable.SPAN_INCLUSIVE_INCLUSIVE ); } return enriched; }
Source:
<code>public static String format(String messageTemplate, Object arg) { if (messageTemplate == null) { return format("", arg); } int placeholderPos = messageTemplate.indexOf("{}", 0); String argStr = String.valueOf(arg); StringBuilder builder = new StringBuilder(messageTemplate.length() + argStr.length()); if (placeholderPos >= 0) { builder .append(messageTemplate.substring(0, placeholderPos)) .append(arg) .append(messageTemplate.substring(placeholderPos + 2)); } else { <START> builder.append(messageTemplate).append(" - [").append(arg).append(']'); <END> } return builder.toString(); }</code><technical_language>this argStr instead of arg match other branch</technical_language>

Target:
public static String format(String messageTemplate, Object arg) { if (messageTemplate == null) { return format("", arg); } int placeholderPos = messageTemplate.indexOf("{}", 0); String argStr = String.valueOf(arg); StringBuilder builder = new StringBuilder(messageTemplate.length() + argStr.length() + 3); if (placeholderPos >= 0) { builder .append(messageTemplate.substring(0, placeholderPos)) .append(argStr) .append(messageTemplate.substring(placeholderPos + 2)); } else { builder.append(messageTemplate).append(" - [").append(argStr).append(']'); } return builder.toString(); }
Source:
<code>public CoupleMbusDeviceAsyncResponse coupleMbusDevice( @OrganisationIdentification final String organisationIdentification, @RequestPayload final CoupleMbusDeviceRequest request, @MessagePriority final String messagePriority, @ScheduleTime final String scheduleTime, @ResponseUrl final String responseUrl) throws OsgpException { final String deviceIdentification = request.getDeviceIdentification(); final String mbusDeviceIdentification = request.getMbusDeviceIdentification(); <START> LOGGER.info("Incoming CoupleMbusDeviceRequest for meter: and mbus device on channel {}.", <END> deviceIdentification, mbusDeviceIdentification); CoupleMbusDeviceAsyncResponse response = null; try { response = new CoupleMbusDeviceAsyncResponse(); final String correlationUid = this.installationService.enqueueCoupleMbusDeviceRequest( organisationIdentification, deviceIdentification, mbusDeviceIdentification, MessagePriorityEnum.getMessagePriority(messagePriority), this.installationMapper.map(scheduleTime, Long.class)); response.setCorrelationUid(correlationUid); response.setDeviceIdentification(deviceIdentification); this.saveResponseUrlIfNeeded(correlationUid, responseUrl); } catch (final Exception e) { LOGGER.error("Exception: while coupling devices: and for organisation {}.", new Object[] { e.getMessage(), deviceIdentification, mbusDeviceIdentification, organisationIdentification }, e); this.handleException(e); } return response; }</code><technical_language>'channel' is in string</technical_language>

Target:
public CoupleMbusDeviceAsyncResponse coupleMbusDevice( @OrganisationIdentification final String organisationIdentification, @RequestPayload final CoupleMbusDeviceRequest request, @MessagePriority final String messagePriority, @ScheduleTime final String scheduleTime, @ResponseUrl final String responseUrl) throws OsgpException { final String deviceIdentification = request.getDeviceIdentification(); final String mbusDeviceIdentification = request.getMbusDeviceIdentification(); LOGGER.info("Incoming CoupleMbusDeviceRequest for meter: and mbus device {}.", deviceIdentification, mbusDeviceIdentification); CoupleMbusDeviceAsyncResponse response = null; try { response = new CoupleMbusDeviceAsyncResponse(); final String correlationUid = this.installationService.enqueueCoupleMbusDeviceRequest( organisationIdentification, deviceIdentification, mbusDeviceIdentification, MessagePriorityEnum.getMessagePriority(messagePriority), this.installationMapper.map(scheduleTime, Long.class)); response.setCorrelationUid(correlationUid); response.setDeviceIdentification(deviceIdentification); this.saveResponseUrlIfNeeded(correlationUid, responseUrl); } catch (final Exception e) { LOGGER.error("Exception while coupling devices: and for organisation {}.", deviceIdentification, mbusDeviceIdentification, organisationIdentification, e); this.handleException(e); } return response; }
Source:
<code>public void accumulateRowSizes(int[] rowSizes) { verify(positionCount > 0); int averageElementSize = Integer.BYTES + Byte.BYTES; for (int i = 0; i < positionCount; i++) { rowSizes[i] += averageElementSize; <START> } <END> ensurePositionOffsetsSize(); System.arraycopy(offsets, 0, positionOffsets, 0, positionCount); rawBlockBuffer.accumulateRowSizes(positionOffsets, positionCount, rowSizes); }</code><technical_language>This copy belong here. move this populateNestedPositions offsets populated</technical_language>

Target:
public void accumulateRowSizes(int[] rowSizes) { for (int i = 0; i < positionCount; i++) { rowSizes[i] += POSITION_SIZE; } ensureOffsetsOffsetsCapacity(); System.arraycopy(offsets, 0, offsetsOffsets, 0, positionCount + 1); elementsBuffers.accumulateRowSizes(offsetsOffsets, positionCount, rowSizes); }
Source:
<code>public void testList() { List<VirtualMachine> list = api().list(); VirtualMachine vm = api().get(getName()); assertTrue(list.size() > 0); boolean found = false; for (VirtualMachine virtualMachine : list) { if (virtualMachine.name().equals(getName())){ found = true; break; } } <START> assertTrue(found); <END> assertTrue(list.contains(vm)); }</code><technical_language>a more idiomatic assertTrue(Iterables.any())</technical_language>

Target:
public void testList() { List<VirtualMachine> list = api().list(); final VirtualMachine vm = api().get(getName()); boolean vmPresent = Iterables.any(list, new Predicate<VirtualMachine>() { public boolean apply(VirtualMachine input) { return input.name().equals(vm.name()); } }); assertTrue(vmPresent); }
Source:
<code>public <T> T executeSQL(String databaseName, String query, ExecuteResultHandler<T> handler) throws SQLiteException { Util.throwIfNull(query); Util.throwIfNull(handler); SQLiteDatabase database = openDatabase(databaseName); try { String firstWordUpperCase = getFirstWord(query).toUpperCase(); <START> if (firstWordUpperCase.equals("UPDATE") || firstWordUpperCase.equals("DELETE")) { <END> return executeUpdateDelete(database, query, handler); } else if (firstWordUpperCase.equals("INSERT")) { return executeInsert(database, query, handler); } else if (QUERY_TYPES_WITH_RESULT.contains(firstWordUpperCase)) { return executeSelect(database, query, handler); } else { return executeRawQuery(database, query, handler); } } finally { database.close(); } }</code><technical_language>java switch (firstWordUpperCase) { case "UPDATE": case "DELETE": ... break; case "INSERT": ... break; case "SELECT": case "PRAGMA": case "EXPLAIN": ... break; }</technical_language>

Target:
public <T> T executeSQL(String databaseName, String query, ExecuteResultHandler<T> handler) throws SQLiteException { Util.throwIfNull(query); Util.throwIfNull(handler); SQLiteDatabase database = openDatabase(databaseName); try { String firstWordUpperCase = getFirstWord(query).toUpperCase(); switch (firstWordUpperCase) { case "UPDATE": case "DELETE": return executeUpdateDelete(database, query, handler); case "INSERT": return executeInsert(database, query, handler); case "SELECT": case "PRAGMA": case "EXPLAIN": return executeSelect(database, query, handler); default: return executeRawQuery(database, query, handler); } } finally { database.close(); } }
Source:
<code>public void testNoCredentials() { <START> assertNull(this.action.createCredentials(requestContext, null, "helloWorld")); <END> }</code><technical_language>This return null, wrap assertNull</technical_language>

Target:
public void testNoCredentials() { this.action.createCredentials(requestContext, null, "helloWorld"); }
Source:
<code>private void checkFieldIndexToWrite() { if (fieldBlockBuilderReturned) { <START> throw new IllegalStateException("field block builder has been returned"); <END> } if (currentFieldIndexToWrite >= numFields) { throw new IllegalStateException("currentFieldIndexToWrite is not valid"); } }</code><technical_language>do sequential write getFieldBlockBuilder is called</technical_language>

Target:
private void checkFieldIndexToWrite() { if (fieldBlockBuilderReturned) { throw new IllegalStateException("cannot do sequential write after getFieldBlockBuilder is called"); } if (currentFieldIndexToWrite >= numFields) { throw new IllegalStateException("currentFieldIndexToWrite is not valid"); } }
Source:
<code>public void onCreateFilePostExecute(@CreateFileRequestCode int requestCode, File file) { if (file == null) { navigator.showSaveErrorDialog(); return; } switch (requestCode) { case CREATE_FILE_DEFAULT: model.setSavedPictureUri(Uri.fromFile(file)); break; case CREATE_FILE_TAKE_PHOTO: Uri uri = view.getFileProviderUriFromFile(file); <START> Log.d("DEBUGGING", "" + uri); <END> model.setCameraImageUri(uri); navigator.startTakePictureActivity(REQUEST_CODE_TAKE_PICTURE, uri); break; default: throw new IllegalArgumentException(); } }</code><technical_language>Please remove debug messages</technical_language>

Target:
public void onCreateFilePostExecute(@CreateFileRequestCode int requestCode, File file) { if (file == null) { navigator.showSaveErrorDialog(); return; } switch (requestCode) { case CREATE_FILE_DEFAULT: model.setSavedPictureUri(view.getUriFromFile(file)); break; case CREATE_FILE_TAKE_PHOTO: Uri uri = view.getFileProviderUriFromFile(file); model.setCameraImageUri(uri); navigator.startTakePictureActivity(REQUEST_CODE_TAKE_PICTURE, uri); break; default: throw new IllegalArgumentException(); } }
Source:
<code>public void setConstructorArguments(Snippet parameters) { <START> this.arguments = Optional.of(parameters); <END> }</code><technical_language>nit: need this</technical_language>

Target:
public void setConstructorArguments(Snippet parameters) { arguments = Optional.of(parameters); }
Source:
<code>abstract public List<Double> dumpTimings(String hostname) throws UnknownHostException; <START> abstract void updateLatencyProbeSequence(List<InetAddressAndPort> sequence); <END> @VisibleForTesting protected void reset() { nextProbeGenerationTime = System.nanoTime(); currentProbePosition = 0; latencyProbeSequence.clear(); }</code><technical_language>this a super class concern</technical_language>

Target:
public List<Double> dumpTimings(String hostname) throws UnknownHostException { List<Double> micros = dumpTimingsMicros(hostname); return micros.stream().map(s -> s / 1000.0).collect(Collectors.toList()); }
Source:
<code>public NettySslHttp2Factory(SSLConfig sslConfig) throws GeneralSecurityException, IOException { nettyServerSslContext = getServerSslContext(sslConfig); nettyClientSslContext = getClientSslContext(sslConfig); <START> jdkSslContext = sslConfig.sslHttp2SelfSign ? null : new JdkSslFactory(sslConfig).getSSLContext(); <END> this.endpointIdentification = sslConfig.sslEndpointIdentificationAlgorithm.isEmpty() ? null : sslConfig.sslEndpointIdentificationAlgorithm; }</code><technical_language>I a valid case for supporting getSSLContext() method for HTTP2, present BlockingChannelConnectionPool blocking SSLSockets instead of SSLEngines, need HTTP2. Instead, getSSLContext() throw UnsupportedOperationException</technical_language>

Target:
public NettySslHttp2Factory(SSLConfig sslConfig) throws GeneralSecurityException, IOException { nettyServerSslContext = getServerSslContext(sslConfig); nettyClientSslContext = getClientSslContext(sslConfig); this.endpointIdentification = sslConfig.sslEndpointIdentificationAlgorithm.isEmpty() ? null : sslConfig.sslEndpointIdentificationAlgorithm; }
Source:
<code>private boolean consumeNonExecutePrefix() throws IOException { int c = nextNonWhitespace(false); if (c == -1) { return true; } else { pos--; } int p = pos; if (p + 5 > limit && !fillBuffer(5)) { return false; } char[] buf = buffer; <START> if(! (buf[p] != ')' || buf[p + 1] != ']' || buf[p + 2] != '}' || buf[p + 3] != '\'' || buf[p + 4] != '\n')) { <END> pos += 5; } return false; }</code><technical_language>good remove doubled negation: suggestion if (buf[p] == ')' && buf[p + 1] == ']' && buf[p + 2] == '}' && buf[p + 3] == '\'' && buf[p + 4] == '\n') {</technical_language>

Target:
private boolean consumeNonExecutePrefix() throws IOException { int c = nextNonWhitespace(false); if (c == -1) { return true; } else { pos--; } int p = pos; if (p + 5 > limit && !fillBuffer(5)) { return false; } char[] buf = buffer; if (buf[p] == ')' && buf[p + 1] == ']' && buf[p + 2] == '}' && buf[p + 3] == '\'' && buf[p + 4] == '\n') { pos += 5; } return false; }
Source:
<code>private static File createOrReuse(Path portLockFilePath) throws IOException { File file; try { try { file = Files.createFile(portLockFilePath, asFileAttribute(PERMISSIONS)).toFile(); <START> } catch (UnsupportedOperationException e) { <END> file = Files.createFile(portLockFilePath).toFile(); } LOGGER.info("Created port lock file: {}", file.getAbsolutePath()); } catch (FileAlreadyExistsException e) { file = portLockFilePath.toFile(); LOGGER.info("Using existing port lock file: {}", file.getAbsolutePath()); } return file; }</code><technical_language>Instead of this, check if setting POSIX permissions is supported</technical_language>

Target:
private static File createOrReuse(Path portLockFilePath) throws IOException { File file; try { try { file = Files.createFile(portLockFilePath, asFileAttribute(PERMISSIONS)).toFile(); } catch (UnsupportedOperationException e) { file = Files.createFile(portLockFilePath).toFile(); } LOGGER.info("Created port lock file: {}", file.getAbsolutePath()); } catch (FileAlreadyExistsException e) { if (!Files.isReadable(portLockFilePath)) { throw new PortLockingException("File is not readable: " + portLockFilePath, e); } if (!Files.isWritable(portLockFilePath)) { throw new PortLockingException("File is not writable: " + portLockFilePath, e); } file = portLockFilePath.toFile(); LOGGER.info("Using existing port lock file: {}", file.getAbsolutePath()); } return file; }