auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void run() { PlanDefinition<JobConfig, Serializable, Serializable> definition; try { definition = PlanDefinitionRegistry.INSTANCE.getJobDefinition(mJobConfig); } catch (JobDoesNotExistException e) { LOG.error("The job definition for config does not exist.", mJobConfig.getName()); return; } Serializable result; try { result = definition.runTask(mJobConfig, mTaskArgs, mContext); <START> } catch (Throwable t) { <END> if (ServerConfiguration.getBoolean(PropertyKey.DEBUG)) { mTaskExecutorManager.notifyTaskFailure(mJobId, mTaskId, ExceptionUtils.getStackTrace(t)); } else { mTaskExecutorManager.notifyTaskFailure(mJobId, mTaskId, t.getMessage()); } LOG.warn("Exception running task for job {}({}) : {}", mJobConfig.getName(), mTaskArgs.toString(), t.getMessage()); return; } mTaskExecutorManager.notifyTaskCompletion(mJobId, mTaskId, result); }</code><technical_language>Do need handle interrupt still, throwable block</technical_language>

Target:
public void run() { PlanDefinition<JobConfig, Serializable, Serializable> definition; try { definition = PlanDefinitionRegistry.INSTANCE.getJobDefinition(mJobConfig); } catch (JobDoesNotExistException e) { LOG.error("The job definition for config does not exist.", mJobConfig.getName()); return; } Serializable result; try { result = definition.runTask(mJobConfig, mTaskArgs, mContext); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } catch (Throwable t) { if (ServerConfiguration.getBoolean(PropertyKey.DEBUG)) { mTaskExecutorManager.notifyTaskFailure(mJobId, mTaskId, ExceptionUtils.getStackTrace(t)); } else { mTaskExecutorManager.notifyTaskFailure(mJobId, mTaskId, t.getMessage()); } LOG.warn("Exception running task for job {}({}) : {}", mJobConfig.getName(), mTaskArgs.toString(), t.getMessage()); return; } mTaskExecutorManager.notifyTaskCompletion(mJobId, mTaskId, result); }
Source:
<code>public byte[] instrument(final byte[] buffer, final String name) throws IOException { try { if (Java9Support.isPatchRequired(buffer)) { final byte[] result = instrument( new ClassReader(Java9Support.downgrade(buffer))); Java9Support.upgrade(result); return result; } else { return instrument(new ClassReader(buffer)); } } catch (final RuntimeException e) { <START> throw instrumentError("class " + name, e); <END> } }</code><technical_language>@Godin do need "class" prefix here? Typically name file name (Example.class) anyways. In case of classes nested in archives this lead locations "archive.jar@class Example.zip". I prefer adding a prefix in Analyzer</technical_language>

Target:
public byte[] instrument(final byte[] buffer, final String name) throws IOException { try { if (Java9Support.isPatchRequired(buffer)) { final byte[] result = instrument( new ClassReader(Java9Support.downgrade(buffer))); Java9Support.upgrade(result); return result; } else { return instrument(new ClassReader(buffer)); } } catch (final RuntimeException e) { throw instrumentError(name, e); } }
Source:
<code>public NettyHttpService(InetSocketAddress bindAddress, int bossThreadPoolSize, int workerThreadPoolSize, int execThreadPoolSize, long execThreadKeepAliveSecs, Map<String, Object> channelConfigs, RejectedExecutionHandler rejectedExecutionHandler, URLRewriter urlRewriter, Iterable<? extends HttpHandler> httpHandlers, Iterable<? extends HandlerHook> handlerHooks, int httpChunkLimit) { this.bindAddress = bindAddress; this.bossThreadPoolSize = bossThreadPoolSize; this.workerThreadPoolSize = workerThreadPoolSize; this.execThreadPoolSize = execThreadPoolSize; this.execThreadKeepAliveSecs = execThreadKeepAliveSecs; this.channelConfigs = ImmutableMap.copyOf(channelConfigs); <START> this.rejectedExecutionHandler = rejectedExecutionHandler; <END> this.channelGroup = new DefaultChannelGroup(); this.resourceHandler = new HttpResourceHandler(httpHandlers, handlerHooks, urlRewriter, new DefaultExceptionHandler()); this.handlerContext = new BasicHandlerContext(this.resourceHandler); this.httpChunkLimit = httpChunkLimit; this.pipelineModifier = null; this.sslHandlerFactory = null; this.exceptionHandler = new DefaultExceptionHandler(); }</code><technical_language>this constructor call other one</technical_language>

Target:
public NettyHttpService(InetSocketAddress bindAddress, int bossThreadPoolSize, int workerThreadPoolSize, int execThreadPoolSize, long execThreadKeepAliveSecs, Map<String, Object> channelConfigs, RejectedExecutionHandler rejectedExecutionHandler, URLRewriter urlRewriter, Iterable<? extends HttpHandler> httpHandlers, Iterable<? extends HandlerHook> handlerHooks, int httpChunkLimit) { this(bindAddress, bossThreadPoolSize, workerThreadPoolSize, execThreadPoolSize, execThreadKeepAliveSecs, channelConfigs, rejectedExecutionHandler, urlRewriter, httpHandlers, handlerHooks, httpChunkLimit, null, null, new ExceptionHandler()); }
Source:
<code>private static Object[][] propertiesMapProvider() { DataMap properties1 = new DataMap(); properties1.put("empty", new DataMap()); DataMap properties2 = new DataMap(); properties2.put("validate", properties1); DataMap properties3 = new DataMap(); DataMap nestedMap = new DataMap(properties2); nestedMap.putAll(properties1); properties3.put("nested", nestedMap); <START> return new Object[][]{{properties1, "@empty = {}\n"}, {properties2, "@validate.empty = {}\n"} END> }; }</code><technical_language>fine test (for now) root-level property, of branch. Thus, cases test changes. need this a more comprehensive</technical_language>

Target:
private static Object[][] propertiesMapProvider() { DataMap properties1 = new DataMap(); properties1.put("empty", new DataMap()); DataMap properties2 = new DataMap(); properties2.put("validate", properties1); return new Object[][] { { properties1, "@empty = {}\n" }, { properties2, "@validate.empty = {}\n" } }; }
Source:
<code>public String toString() { StringBuilder builder = new StringBuilder(25); <START> builder.append("Is refresh? "); <END> builder.append(refresh); builder.append(", Is filtered? "); builder.append(isFiltered); return builder.toString(); }</code><technical_language>I prefer "refresh" "filtered"</technical_language>

Target:
public String toString() { StringBuilder builder = new StringBuilder(25); builder.append("refresh: "); builder.append(refresh); builder.append(", filtered: "); builder.append(isFiltered); return builder.toString(); }
Source:
<code>public String getThreadName(ITmfEvent event) { ITmfEventField content = event.getContent(); String procName = (String) content.getField(fLayout.contextProcname()).getValue(); int vtid = getThreadId(event); if (procName == null) { <START> throw new IllegalStateException(); <END> } return procName + '-' + Integer.toString(vtid); }</code><technical_language>Add error message</technical_language>

Target:
public String getThreadName(ITmfEvent event) { ITmfEventField content = event.getContent(); String procName = (String) content.getField(fLayout.contextProcname()).getValue(); int vtid = getThreadId(event); return (procName + '-' + Integer.toString(vtid)); }
Source:
<code>public Optional<ConnectorNewTableLayout> getPreferredShuffleLayoutForInsert(ConnectorSession session, ConnectorTableHandle tableHandle) { HiveTableHandle hiveTableHandle = (HiveTableHandle) tableHandle; SchemaTableName tableName = hiveTableHandle.getSchemaTableName(); Table table = metastore.getTable(tableName.getSchemaName(), tableName.getTableName()) .orElseThrow(() -> new TableNotFoundException(tableName)); Optional<HiveBucketHandle> hiveBucketHandle = getHiveBucketHandle(table); if (hiveBucketHandle.isPresent()) { return Optional.empty(); } <START> if (!(isShufflePartitionedColumnsForTableWriteEnabled(session) || table.getPartitionColumns().isEmpty())) { <END> return Optional.empty(); } HivePartitioningHandle partitioningHandle = new HivePartitioningHandle( SHUFFLE_MAX_PARALLELISM_FOR_PARTITIONED_TABLE_WRITE, table.getPartitionColumns().stream() .map(Column::getType) .collect(Collectors.toList()), OptionalInt.empty()); List<String> partitionedBy = table.getPartitionColumns().stream() .map(Column::getName) .collect(Collectors.toList()); return Optional.of(new ConnectorNewTableLayout(partitioningHandle, partitionedBy)); }</code><technical_language>!isShufflePartitionedColumnsForTableWriteEnabled(session) || table.getPartitionColumns().isEmpty()</technical_language>

Target:
public Optional<ConnectorNewTableLayout> getPreferredShuffleLayoutForInsert(ConnectorSession session, ConnectorTableHandle tableHandle) { HiveTableHandle hiveTableHandle = (HiveTableHandle) tableHandle; SchemaTableName tableName = hiveTableHandle.getSchemaTableName(); Table table = metastore.getTable(tableName.getSchemaName(), tableName.getTableName()) .orElseThrow(() -> new TableNotFoundException(tableName)); Optional<HiveBucketHandle> hiveBucketHandle = getHiveBucketHandle(table); if (hiveBucketHandle.isPresent()) { return Optional.empty(); } if (!isShufflePartitionedColumnsForTableWriteEnabled(session) || table.getPartitionColumns().isEmpty()) { return Optional.empty(); } HivePartitioningHandle partitioningHandle = new HivePartitioningHandle( SHUFFLE_MAX_PARALLELISM_FOR_PARTITIONED_TABLE_WRITE, table.getPartitionColumns().stream() .map(Column::getType) .collect(Collectors.toList()), OptionalInt.empty()); List<String> partitionedBy = table.getPartitionColumns().stream() .map(Column::getName) .collect(Collectors.toList()); return Optional.of(new ConnectorNewTableLayout(partitioningHandle, partitionedBy)); }
Source:
<code>public Aggregator[][] getDimExtractionRowSelector(TopNQuery query, TopNParams params, Capabilities capabilities) { <START> if (params.getCardinality() < 0) { <END> return null; } final BaseTopNAlgorithm.AggregatorArrayProvider provider = new BaseTopNAlgorithm.AggregatorArrayProvider( (DimensionSelector) params.getSelectorPlus().getSelector(), query, params.getCardinality(), capabilities ); return provider.build(); }</code><technical_language>changes in this class</technical_language>

Target:
public Aggregator[][] getDimExtractionRowSelector(TopNQuery query, TopNParams params, Capabilities capabilities) { if (params.getCardinality() < 0) { throw new UnsupportedOperationException("Cannot operate on a dimension with unknown cardinality"); } final BaseTopNAlgorithm.AggregatorArrayProvider provider = new BaseTopNAlgorithm.AggregatorArrayProvider( (DimensionSelector) params.getSelectorPlus().getSelector(), query, params.getCardinality(), capabilities ); return provider.build(); }
Source:
<code>public void login(LoginListener listener) { encodeAuthorizationToken(listener.getUsername(), listener.getPassword()); String url = listener.getServerURL() + LOGIN_END_URL; mLogger.i(SENDING_REQUEST + url); Response.ErrorListener errorListener = new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { <START> error.printStackTrace(); <END> } }; JsonObjectRequestWrapper jsObjRequest = new JsonObjectRequestWrapper(Request.Method.GET, url, null, listener, errorListener, DO_GZIP_REQUEST) { @Override public Map<String, String> getHeaders() throws AuthFailureError { HashMap<String, String> params = new HashMap<String, String>(); params.put(ApplicationConstants.AUTHORIZATION_PARAM, mOpenMRS.getAuthorizationToken()); return params; } }; mOpenMRS.addToRequestQueue(jsObjRequest); }</code><technical_language>Handle properly. <LINK_0> error message is displayed user</technical_language>

Target:
public void login(LoginListener listener) { encodeAuthorizationToken(listener.getUsername(), listener.getPassword()); String url = listener.getServerURL() + LOGIN_END_URL; mLogger.i(SENDING_REQUEST + url); Response.ErrorListener errorListener = new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { mLogger.e(error.toString()); } }; JsonObjectRequestWrapper jsObjRequest = new JsonObjectRequestWrapper(Request.Method.GET, url, null, listener, errorListener, DO_GZIP_REQUEST) { @Override public Map<String, String> getHeaders() throws AuthFailureError { HashMap<String, String> params = new HashMap<String, String>(); params.put(ApplicationConstants.AUTHORIZATION_PARAM, mOpenMRS.getAuthorizationToken()); return params; } }; mOpenMRS.addToRequestQueue(jsObjRequest); }
Source:
<code>public void goToTwitter (View view) { <START> String url = "<LINK_0>"; link(url); <END> }</code><technical_language>suggestion link("<LINK_0>");</technical_language>

Target:
public void goToTwitter (View view) { link("<LINK_0>"); }
Source:
<code>private RestEndpointGroup getHttpApiEndpointGroup(String operation, String requestUri) { if (requestUri.startsWith(HttpCommandProcessor.URI_MAPS) || requestUri.startsWith(HttpCommandProcessor.URI_QUEUES)) { return RestEndpointGroup.DATA; } if (requestUri.startsWith(HttpCommandProcessor.URI_HEALTH_URL)) { return RestEndpointGroup.HEALTH_CHECK; } if (requestUri.startsWith(HttpCommandProcessor.URI_WAN_BASE_URL + "/wan/") <START> || requestUri.startsWith("/hazelcast/rest/wan/")) { <END> return RestEndpointGroup.WAN; } if (requestUri.startsWith(HttpCommandProcessor.URI_FORCESTART_CLUSTER_URL) || requestUri.startsWith(HttpCommandProcessor.URI_PARTIALSTART_CLUSTER_URL) || requestUri.startsWith(HttpCommandProcessor.URI_HOT_RESTART_BACKUP_CLUSTER_URL) || requestUri.startsWith(HttpCommandProcessor.URI_HOT_RESTART_BACKUP_INTERRUPT_CLUSTER_URL)) { return RestEndpointGroup.HOT_RESTART; } if (requestUri.startsWith(HttpCommandProcessor.URI_CLUSTER) || requestUri.startsWith(HttpCommandProcessor.URI_CLUSTER_STATE_URL) || requestUri.startsWith(HttpCommandProcessor.URI_CLUSTER_NODES_URL) || ("GET".equals(operation) && requestUri.startsWith(HttpCommandProcessor.URI_LICENSE_INFO)) || ("GET".equals(operation) && requestUri.startsWith(HttpCommandProcessor.URI_CLUSTER_VERSION_URL)) || requestUri.startsWith(HttpCommandProcessor.URI_INSTANCE)) { return RestEndpointGroup.CLUSTER_READ; } if (requestUri.startsWith("/hazelcast/")) { return RestEndpointGroup.CLUSTER_WRITE; } return null; }</code><technical_language>URI_WAN_BASE_URL = /hazelcast/rest/wan this change. I this simplified if (requestUri.startsWith(HttpCommandProcessor.URI_WAN_BASE_URL) {</technical_language>

Target:
private RestEndpointGroup getHttpApiEndpointGroup(String operation, String requestUri) { if (requestUri.startsWith(HttpCommandProcessor.URI_MAPS) || requestUri.startsWith(HttpCommandProcessor.URI_QUEUES)) { return RestEndpointGroup.DATA; } if (requestUri.startsWith(HttpCommandProcessor.URI_HEALTH_URL)) { return RestEndpointGroup.HEALTH_CHECK; } if (requestUri.startsWith(HttpCommandProcessor.URI_WAN_BASE_URL)) { return RestEndpointGroup.WAN; } if (requestUri.startsWith(HttpCommandProcessor.URI_FORCESTART_CLUSTER_URL) || requestUri.startsWith(HttpCommandProcessor.URI_PARTIALSTART_CLUSTER_URL) || requestUri.startsWith(HttpCommandProcessor.URI_HOT_RESTART_BACKUP_CLUSTER_URL) || requestUri.startsWith(HttpCommandProcessor.URI_HOT_RESTART_BACKUP_INTERRUPT_CLUSTER_URL)) { return RestEndpointGroup.HOT_RESTART; } if (requestUri.startsWith(HttpCommandProcessor.URI_CLUSTER) || requestUri.startsWith(HttpCommandProcessor.URI_CLUSTER_STATE_URL) || requestUri.startsWith(HttpCommandProcessor.URI_CLUSTER_NODES_URL) || ("GET".equals(operation) && requestUri.startsWith(HttpCommandProcessor.URI_LICENSE_INFO)) || ("GET".equals(operation) && requestUri.startsWith(HttpCommandProcessor.URI_CLUSTER_VERSION_URL)) || requestUri.startsWith(HttpCommandProcessor.URI_INSTANCE)) { return RestEndpointGroup.CLUSTER_READ; } if (requestUri.startsWith("/hazelcast/")) { return RestEndpointGroup.CLUSTER_WRITE; } return null; }
Source:
<code>public void setInsidePolicyAmount(int amount) throws Throwable { if ((sourceImmutablePolicy == null) || !(sourceImmutablePolicy instanceof ConditionalGeoFencePolicy)) { <START> throw new Throwable("Source Policy is not ConditionalGeoFence type cannot hold inside policies"); <END> } if (((ConditionalGeoFencePolicy) sourceImmutablePolicy).getInPolicy() == null) { throw new Throwable("Source Policy has no inside policy"); } if (!(((ConditionalGeoFencePolicy) sourceImmutablePolicy).getInPolicy() instanceof MethodAmountPolicy)) { throw new Throwable("Source Policy inside policy is not MethodAmountPolicy"); } ConditionalGeoFencePolicy castedCachedPolicy = (ConditionalGeoFencePolicy) sourceImmutablePolicy; MethodAmountPolicy existingInsidePolicy = (MethodAmountPolicy) castedCachedPolicy.getInPolicy(); MethodAmountPolicy newInsidePolicy = new MethodAmountPolicy(existingInsidePolicy.getDenyRootedJailbroken(), existingInsidePolicy.getDenyEmulatorSimulator(), existingInsidePolicy.getFences(), amount); sourceImmutablePolicy = new ConditionalGeoFencePolicy(castedCachedPolicy.getDenyRootedJailbroken(), castedCachedPolicy.getDenyEmulatorSimulator(), castedCachedPolicy.getFences(), newInsidePolicy, castedCachedPolicy.getOutPolicy()); }</code><technical_language>Source Policy is ConditionalGeoFence type, hold policies</technical_language>

Target:
public void setInsidePolicyAmount(int amount) throws Throwable { if ((sourceImmutablePolicy == null) || !(sourceImmutablePolicy instanceof ConditionalGeoFencePolicy)) { throw new Throwable("Source Policy is not ConditionalGeoFence type cannot hold inside policies"); } if (((ConditionalGeoFencePolicy) sourceImmutablePolicy).getInside() == null) { throw new Throwable("Source Policy has no inside policy"); } if (!(((ConditionalGeoFencePolicy) sourceImmutablePolicy).getInside() instanceof MethodAmountPolicy)) { throw new Throwable("Source Policy inside policy is not MethodAmountPolicy"); } ConditionalGeoFencePolicy castedCachedPolicy = (ConditionalGeoFencePolicy) sourceImmutablePolicy; MethodAmountPolicy existingInsidePolicy = (MethodAmountPolicy) castedCachedPolicy.getInside(); MethodAmountPolicy newInsidePolicy = new MethodAmountPolicy(existingInsidePolicy.getDenyRootedJailbroken(), existingInsidePolicy.getDenyEmulatorSimulator(), existingInsidePolicy.getFences(), amount); sourceImmutablePolicy = new ConditionalGeoFencePolicy(castedCachedPolicy.getDenyRootedJailbroken(), castedCachedPolicy.getDenyEmulatorSimulator(), castedCachedPolicy.getFences(), newInsidePolicy, castedCachedPolicy.getOutside()); }
Source:
<code>public void go(final LinkedBlockingQueue<BytesMessageWithOffset> messageQueue) { thread = new Thread() { @Override public void run() { long offset = startOffset; log.info("Start running parition[%s], offset[%s]", partitionId, offset); try { while (!stopped.get()) { try { <START> Iterable<BytesMessageWithOffset> msgs = consumer.fetch(offset, 10000); <END> int count = 0; for (BytesMessageWithOffset msgWithOffset : msgs) { offset = msgWithOffset.offset(); messageQueue.put(msgWithOffset); count++; } log.debug("fetch [%s] msgs for partition [%s] in one time ", count, partitionId); } catch (InterruptedException e) { log.info("Interrupted when fetching data, shutting down."); return; } catch (Exception e) { log.error(e, "Exception happened in fetching data, but will continue consuming"); } } } finally { consumer.stop(); } } }; thread.setDaemon(true); thread.setName(String.format("kafka-%s-%s", topic, partitionId)); thread.start(); }</code><technical_language>this number 10000 meant for, this a constant a meaningful name</technical_language>

Target:
public void go(final LinkedBlockingQueue<BytesMessageWithOffset> messageQueue) { thread = new Thread() { @Override public void run() { long offset = startOffset; log.info("Start running parition[%s], offset[%s]", partitionId, offset); try { while (!stopped.get()) { try { Iterable<BytesMessageWithOffset> msgs = consumer.fetch(offset, CONSUMER_FETCH_TIMEOUT); int count = 0; for (BytesMessageWithOffset msgWithOffset : msgs) { offset = msgWithOffset.offset(); messageQueue.put(msgWithOffset); count++; } log.debug("fetch [%s] msgs for partition [%s] in one time ", count, partitionId); } catch (InterruptedException e) { log.info("Interrupted when fetching data, shutting down."); return; } catch (Exception e) { log.error(e, "Exception happened in fetching data, but will continue consuming"); } } } finally { consumer.stop(); } } }; thread.setDaemon(true); thread.setName(String.format("kafka-%s-%s", topic, partitionId)); thread.start(); }