auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static boolean checkImageConfiguration(storage_domain_static storageDomain, DiskImageBase diskInfo, List<String> messages, boolean isCopyCollapse) { boolean result = true; if ((diskInfo.getvolume_type() == VolumeType.Preallocated && diskInfo.getvolume_format() == VolumeFormat.COW) <START> || (!isCopyCollapse && isStorageBlockDevice(storageDomain) && isVolumeSparseRaw(diskInfo)) <END> || diskInfo.getvolume_format() == VolumeFormat.Unassigned || diskInfo.getvolume_type() == VolumeType.Unassigned) { result = false; messages.add(VdcBllMessages.ACTION_TYPE_FAILED_DISK_CONFIGURATION_NOT_SUPPORTED.toString()); } return result; }</code><technical_language>isVolTypeAndFormatSupportedByBlockDevice() great :-)</technical_language>

Target:
public static boolean checkImageConfiguration(storage_domain_static storageDomain, DiskImageBase diskInfo, List<String> messages, boolean isCopyCollapse) { boolean result = true; if ((diskInfo.getvolume_type() == VolumeType.Preallocated && diskInfo.getvolume_format() == VolumeFormat.COW) || (!isCopyCollapse && isStorageBlockDevice(storageDomain) && volumeNotSupportedForBlockDevice(diskInfo)) || diskInfo.getvolume_format() == VolumeFormat.Unassigned || diskInfo.getvolume_type() == VolumeType.Unassigned) { result = false; messages.add(VdcBllMessages.ACTION_TYPE_FAILED_DISK_CONFIGURATION_NOT_SUPPORTED.toString()); } return result; }
Source:
<code>public static Configuration newMetastoreConf() { Configuration conf = new Configuration(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader == null) { classLoader = MetastoreConf.class.getClassLoader(); } hiveDefaultURL = classLoader.getResource("hive-default.xml"); hiveSiteURL = findConfigFile(classLoader, "hive-site.xml"); if (hiveSiteURL != null) conf.addResource(hiveSiteURL); hiveMetastoreSiteURL = findConfigFile(classLoader, "hivemetastore-site.xml"); if (hiveMetastoreSiteURL != null) conf.addResource(hiveMetastoreSiteURL); metastoreSiteURL = findConfigFile(classLoader, "metastore-site.xml"); if (metastoreSiteURL != null) conf.addResource(metastoreSiteURL); for (ConfVars var : ConfVars.values()) { if (System.getProperty(var.varname) != null) { LOG.debug("Setting conf value " + var.varname + " using value " + System.getProperty(var.varname)); conf.set(var.varname, System.getProperty(var.varname)); } else if (System.getProperty(var.hiveName) != null) { conf.set(var.hiveName, System.getProperty(var.hiveName)); } } if (getBoolVar(conf, ConfVars.SCHEMA_VERIFICATION)) { setBoolVar(conf, ConfVars.AUTO_CREATE_ALL, false); } <START> if (getBoolVar(conf, ConfVars.DUMP_CONFIG_ON_CREATION) && LOG.isInfoEnabled()) { <END> LOG.info(dumpConfig(conf)); } return conf; }</code><technical_language>print this JVM? I config file is re-read this avoid flooding log</technical_language>

Target:
public static Configuration newMetastoreConf() { Configuration conf = new Configuration(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader == null) { classLoader = MetastoreConf.class.getClassLoader(); } hiveDefaultURL = classLoader.getResource("hive-default.xml"); hiveSiteURL = findConfigFile(classLoader, "hive-site.xml"); if (hiveSiteURL != null) conf.addResource(hiveSiteURL); hiveMetastoreSiteURL = findConfigFile(classLoader, "hivemetastore-site.xml"); if (hiveMetastoreSiteURL != null) conf.addResource(hiveMetastoreSiteURL); metastoreSiteURL = findConfigFile(classLoader, "metastore-site.xml"); if (metastoreSiteURL != null) conf.addResource(metastoreSiteURL); for (ConfVars var : ConfVars.values()) { if (System.getProperty(var.varname) != null) { LOG.debug("Setting conf value " + var.varname + " using value " + System.getProperty(var.varname)); conf.set(var.varname, System.getProperty(var.varname)); } else if (System.getProperty(var.hiveName) != null) { conf.set(var.hiveName, System.getProperty(var.hiveName)); } } if (getBoolVar(conf, ConfVars.SCHEMA_VERIFICATION)) { setBoolVar(conf, ConfVars.AUTO_CREATE_ALL, false); } if (!beenDumped.getAndSet(true) && getBoolVar(conf, ConfVars.DUMP_CONFIG_ON_CREATION) && LOG.isInfoEnabled()) { LOG.info(dumpConfig(conf)); } return conf; }
Source:
<code>public final <START> Object clone() <END> { try { FieldData clone = (FieldData) super.clone(); if (unknownFieldData != null) { clone.unknownFieldData = new ArrayList<UnknownFieldData>(unknownFieldData); } if (value instanceof ExtendableMessageNano) { clone.value = ((ExtendableMessageNano) value).clone(); } else if (value instanceof byte[]) { clone.value = ((byte[]) value).clone(); } else if (value instanceof byte[][]) { clone.value = ((byte[][]) value).clone(); } else if (value instanceof boolean[]) { clone.value = ((boolean[]) value).clone(); } else if (value instanceof int[]) { clone.value = ((int[]) value).clone(); } else if (value instanceof long[]) { clone.value = ((long[]) value).clone(); } else if (value instanceof float[]) { clone.value = ((float[]) value).clone(); } else if (value instanceof double[]) { clone.value = ((double[]) value).clone(); } else if (value instanceof short[]) { clone.value = ((short[]) value).clone(); } else if (value instanceof char[]) { clone.value = ((char[]) value).clone(); } else if (value instanceof ExtendableMessageNano[]) { ExtendableMessageNano[] valueArray = (ExtendableMessageNano[]) value; ExtendableMessageNano[] cloneArray = (ExtendableMessageNano[]) clone.value; for (int i = 0; i < valueArray.length; i++) { cloneArray[i] = (ExtendableMessageNano) valueArray[i].clone(); } } return clone; } catch (CloneNotSupportedException e) { throw new AssertionError(e); } }</code><technical_language>FieldData</technical_language>

Target:
public final FieldData clone() { FieldData clone = new FieldData(); try { clone.cachedExtension = cachedExtension; if (unknownFieldData == null) { clone.unknownFieldData = null; } else { clone.unknownFieldData.addAll(unknownFieldData); } if (value instanceof MessageNano) { clone.value = ((MessageNano) value).clone(); } else if (value instanceof byte[]) { clone.value = ((byte[]) value).clone(); } else if (value instanceof byte[][]) { clone.value = ((byte[][]) value).clone(); } else if (value instanceof boolean[]) { clone.value = ((boolean[]) value).clone(); } else if (value instanceof int[]) { clone.value = ((int[]) value).clone(); } else if (value instanceof long[]) { clone.value = ((long[]) value).clone(); } else if (value instanceof float[]) { clone.value = ((float[]) value).clone(); } else if (value instanceof double[]) { clone.value = ((double[]) value).clone(); } else if (value instanceof MessageNano[]) { MessageNano[] valueArray = (MessageNano[]) value; MessageNano[] cloneArray = new MessageNano[valueArray.length]; clone.value = cloneArray; for (int i = 0; i < valueArray.length; i++) { cloneArray[i] = valueArray[i].clone(); } } return clone; } catch (CloneNotSupportedException e) { throw new AssertionError(e); } }
Source:
<code>public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { ModelNode names = operation.require(CacheContainerResource.PROTO_NAMES.getName()); ModelNode contents = operation.require(CacheContainerResource.PROTO_CONTENTS.getName()); final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR)); final String cacheContainerName = address.getElement(address.size() - 1).getValue(); final ServiceController<?> controller = context.getServiceRegistry(false).getService( EmbeddedCacheManagerService.getServiceName(cacheContainerName)); EmbeddedCacheManager cacheManager = (EmbeddedCacheManager) controller.getValue(); ProtobufMetadataManager protoManager = cacheManager.getGlobalComponentRegistry().getComponent(ProtobufMetadataManager.class); if (protoManager != null) { try { <START> List<ModelNode> descriptorsNames = names.asList(); <END> List<ModelNode> descriptorsContents = contents.asList(); String[] nameArray = new String[descriptorsNames.size()]; String[] contentArray = new String[descriptorsNames.size()]; int i = 0; for(ModelNode modelNode : descriptorsNames) { nameArray[i] = modelNode.asString(); contentArray[i] = descriptorsContents.get(i).asString(); i++; } protoManager.registerProtofiles(nameArray,contentArray); } catch (Exception e) { throw new OperationFailedException(new ModelNode().set(MESSAGES.failedToInvokeOperation(e.getLocalizedMessage()))); } } context.stepCompleted(); }</code><technical_language>verify sizes names contents</technical_language>

Target:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR)); final String cacheContainerName = address.getElement(address.size() - 1).getValue(); final ServiceController<?> controller = context.getServiceRegistry(false).getService( EmbeddedCacheManagerService.getServiceName(cacheContainerName)); EmbeddedCacheManager cacheManager = (EmbeddedCacheManager) controller.getValue(); ProtobufMetadataManager protoManager = cacheManager.getGlobalComponentRegistry().getComponent(ProtobufMetadataManager.class); if (protoManager != null) { try { String nameParameter = CacheContainerResource.PROTO_NAMES.getName(); String contentParameter = CacheContainerResource.PROTO_CONTENTS.getName(); ModelNode names = operation.require(nameParameter); ModelNode contents = operation.require(contentParameter); validateParameters(names, contents); List<ModelNode> descriptorsNames = names.asList(); List<ModelNode> descriptorsContents = contents.asList(); String[] nameArray = new String[descriptorsNames.size()]; String[] contentArray = new String[descriptorsNames.size()]; int i = 0; for (ModelNode modelNode : descriptorsNames) { nameArray[i] = modelNode.asString(); contentArray[i] = descriptorsContents.get(i).asString(); i++; } protoManager.registerProtofiles(nameArray, contentArray); } catch (Exception e) { throw new OperationFailedException(new ModelNode().set(MESSAGES.failedToInvokeOperation(e.getLocalizedMessage()))); } } context.stepCompleted(); }
Source:
<code>public static void checkMapConfig(MapConfig mapConfig, NativeMemoryConfig nativeMemoryConfig, SplitBrainMergePolicyProvider mergePolicyProvider, HazelcastProperties properties) { if (getBuildInfo().isEnterprise()) { <START> checkMapNativeConfig(mapConfig, nativeMemoryConfig); <END> checkHotRestartSpecificConfig(mapConfig, properties); } checkMapEvictionConfig(mapConfig.getEvictionConfig()); checkMapMaxSizePolicyPerInMemoryFormat(mapConfig); if (mergePolicyProvider != null) { checkMapMergePolicy(mapConfig, mergePolicyProvider); } }</code><technical_language>check this anymore config is parsed MemberDomConfigProcessor</technical_language>

Target:
public static void checkMapConfig(MapConfig mapConfig, NativeMemoryConfig nativeMemoryConfig, SplitBrainMergePolicyProvider mergePolicyProvider, HazelcastProperties properties) { checkNotNativeWhenOpenSource(mapConfig.getInMemoryFormat()); if (getBuildInfo().isEnterprise()) { checkMapNativeConfig(mapConfig, nativeMemoryConfig); checkHotRestartSpecificConfig(mapConfig, properties); } checkMapEvictionConfig(mapConfig.getEvictionConfig()); checkMapMaxSizePolicyPerInMemoryFormat(mapConfig); if (mergePolicyProvider != null) { checkMapMergePolicy(mapConfig, mergePolicyProvider); } for (QueryCacheConfig queryCacheConfig : mapConfig.getQueryCacheConfigs()) { checkCacheEvictionConfig(queryCacheConfig.getEvictionConfig()); } }
Source:
<code><START> public Container(Project project, String message) { <END> this.project = project; this.bsn = "<unknown>"; this.version = "<unknown>"; this.warning = message; this.type = TYPE.ERROR; this.path = "unknown"; }</code><technical_language>this private people static method</technical_language>

Target:
private Container(Project project, String message) { this.project = project; this.bsn = "<unknown>"; this.version = "<unknown>"; this.warning = message; this.type = TYPE.ERROR; this.path = "unknown"; }
Source:
<code><START> public boolean checkNetwork() { <END> AsyncFileEntry rootParent = parent; while (rootParent != null && rootParent.getParent().isPresent()) { rootParent = rootParent.getParent().get(); } if (rootParent == null) { return snapExist(); } return rootParent.getFile().exists(); }</code><technical_language>this is called AsyncFileAlterationObserver class root node, put this method class instead of "walk tree"</technical_language>

Target:
public boolean checkNetwork() { AsyncFileEntry rootParent = parent; if (rootParent == null) { return snapExist(); } while (rootParent.getParent().isPresent()) { rootParent = rootParent.getParent().get(); } return rootParent.getFile().exists(); }
Source:
<code>private static Iterable<ImmutableBitmap> makePredicateQualifyingBitmapIterable( final BitmapIndex bitmapIndex, final Predicate<String> predicate, final Indexed<String> dimValues ) { return new Iterable<ImmutableBitmap>() { @Override public Iterator<ImmutableBitmap> iterator() { <START> return new Iterator<ImmutableBitmap>() <END> { final Iterator<Integer> indexIterator = makePredicateQualifyingIndexIterable( bitmapIndex, predicate, dimValues ).iterator(); @Override public void remove() { throw new UnsupportedOperationException(); } @Override public boolean hasNext() { return indexIterator.hasNext(); } @Override public ImmutableBitmap next() { return bitmapIndex.getBitmap(indexIterator.next()); } }; } }; }</code><technical_language>Replaceable Iterators.transform()</technical_language>

Target:
private static Iterable<ImmutableBitmap> makePredicateQualifyingBitmapIterable( final BitmapIndex bitmapIndex, final Predicate<String> predicate, final Indexed<String> dimValues ) { return bitmapsFromIndexes(makePredicateQualifyingIndexIterable(bitmapIndex, predicate, dimValues), bitmapIndex); }
Source:
<code><START> public void update(ViewerCell cell) { <END> Object element = cell.getElement(); int columnNumber = cell.getColumnIndex(); if (columnNumber == 0) { cell.setImage(getColumnImage(element, cell.getColumnIndex())); cell.setText(getColumnText(element, cell.getColumnIndex())); } else { if (columnNumber == 3) { cell.setText(getColumnText(element, cell.getColumnIndex())); } else { cell.setImage(getColumnImage(element, cell.getColumnIndex())); } } }</code><technical_language>need override this, work for columns</technical_language>

Target:
public void update(ViewerCell cell) { Object element = cell.getElement(); int columnNumber = cell.getColumnIndex(); if (columnNumber == 0) { cell.setImage(getColumnImage(element, columnNumber)); cell.setText(getColumnText(element, columnNumber)); } else { if (columnNumber == 3) { cell.setText(getColumnText(element, columnNumber)); } else { cell.setImage(getColumnImage(element, columnNumber)); } } }
Source:
<code>public Multipart(String requestURL, String charset) throws IOException { this.charset = charset; boundary = createBoundary(); URL url = new URL(requestURL); httpConn = (HttpURLConnection) url.openConnection(); httpConn.setUseCaches(false); httpConn.setDoOutput(true); httpConn.setDoInput(true); httpConn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary); <START> httpConn.setRequestProperty("User-Agent", "Java IPFS CLient"); <END> out = httpConn.getOutputStream(); writer = new PrintWriter(new OutputStreamWriter(out, charset), true); }</code><technical_language>typo</technical_language>

Target:
public Multipart(String requestURL, String charset) throws IOException { this.charset = charset; boundary = createBoundary(); URL url = new URL(requestURL); httpConn = (HttpURLConnection) url.openConnection(); httpConn.setUseCaches(false); httpConn.setDoOutput(true); httpConn.setDoInput(true); httpConn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary); httpConn.setRequestProperty("User-Agent", "Java IPFS Client"); out = httpConn.getOutputStream(); writer = new PrintWriter(new OutputStreamWriter(out, charset), true); }
Source:
<code><START> public ExpressionTree EXPRESSION() { <END> return b.<ExpressionTree>nonterminal(PHPLexicalGrammar.EXPRESSION) .is(f.expression(b.token(PHPGrammar.IDENTIFIER))); }</code><technical_language>![MAJOR](<LINK_1> Rename this method name match regular expression '^[a-z][a-zA-Z0-9]*$'. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public ExpressionTree EXPRESSION() { return b.<ExpressionTree>nonterminal(PHPLexicalGrammar.EXPRESSION) .is(f.expression(b.token(PHPLexicalGrammar.VARIABLE_IDENTIFIER))); }
Source:
<code>public int compareTo(SamzaResourceRequest o) { <START> if (!isInFuture() && o.isInFuture()) { <END> return -1; } if (isInFuture() && !o.isInFuture()) { return 1; } if (!StandbyTaskUtil.isStandbyContainer(processorId) && StandbyTaskUtil.isStandbyContainer(o.processorId)) { return -1; } if (StandbyTaskUtil.isStandbyContainer(processorId) && !StandbyTaskUtil.isStandbyContainer(o.processorId)) { return 1; } if (requestTimestampMs < o.requestTimestampMs) return -1; if (requestTimestampMs > o.requestTimestampMs) return 1; return 0; }</code><technical_language>Couple of a. isInFuture() check is redundant is timestamp based check below. b. this check here, check for standby vs. active is problematic. Imagine a scenario, containers active (e.g., container 1) standby container (e.g., container 2-0) fail concurrently. If failure-callback for standby arrives callback of active, timestamp for standby timestamp for active. some point in time, standby's request in future, while for active in future. This scenario violate priority-queue assumption active containers precedence standby containers</technical_language>

Target:
public int compareTo(SamzaResourceRequest o) { if (!StandbyTaskUtil.isStandbyContainer(processorId) && StandbyTaskUtil.isStandbyContainer(o.processorId)) { return -1; } if (StandbyTaskUtil.isStandbyContainer(processorId) && !StandbyTaskUtil.isStandbyContainer(o.processorId)) { return 1; } if (requestTimestamp.isBefore(o.requestTimestamp)) { return -1; } if (requestTimestamp.isAfter(o.requestTimestamp)) { return 1; } return 0; }
Source:
<code>public boolean doesThemeNeedRestart(Theme theme) { try (Stream<Path> stream = Files.list(getThemeDirectory(theme))) { <START> return stream.anyMatch(path -> Files.isRegularFile(path) && !path.endsWith(".css")); <END> } }</code><technical_language>This return theme.properties file</technical_language>

Target:
public boolean doesThemeNeedRestart(Theme theme) { try (Stream<Path> stream = Files.list(getThemeDirectory(theme))) { return stream.anyMatch(path -> Files.isRegularFile(path) && !path.endsWith(".css") && !path.endsWith(".properties")); } }
Source:
<code>public void update(Observable o, Object arg) { <START> numTimesUpdated++; <END> lastUpdateEdgeType = (Latch.EdgeType) arg; }</code><technical_language>assert arg is EdgeType? throw a ClassCastException anyway, easier track assertion failure a CCE</technical_language>

Target:
public void update(Observable o, Object arg) { assertTrue("Latch is the only class that should be observed", o instanceof Latch); assertTrue("Latch must provide an argument of type EdgeType", arg instanceof Latch.EdgeType); numTimesUpdated++; lastUpdateEdgeType = (Latch.EdgeType) arg; }
Source:
<code>public Result<EventTypeSchema> getSchemaVersion(final String name, final String version) { final Matcher versionMatcher = VERSION_PATTERN.matcher(version); if (!versionMatcher.matches()) { return Result.problem(Problem.valueOf(Response.Status.BAD_REQUEST, "Invalid version number")); } try { final EventTypeSchema schema = schemaRepository.getSchemaVersion(name, version); return Result.ok(schema); } catch (final NoSuchSchemaException e) { LOG.debug("Could not find EventTypeSchema version: for EventType: {}", version, name); <START> return Result.problem(Problem.valueOf(Response.Status.NOT_FOUND, <END> "Could not find schema version " + version + " for event type " + name)); } }</code><technical_language>e.asProblem NoSuchSchemaException defines status code details message</technical_language>

Target:
public Result<EventTypeSchema> getSchemaVersion(final String name, final String version) { final Matcher versionMatcher = VERSION_PATTERN.matcher(version); if (!versionMatcher.matches()) { return Result.problem(Problem.valueOf(Response.Status.BAD_REQUEST, "Invalid version number")); } try { final EventTypeSchema schema = schemaRepository.getSchemaVersion(name, version); return Result.ok(schema); } catch (final NoSuchSchemaException e) { LOG.debug("Could not find EventTypeSchema version: for EventType: {}", version, name); return Result.problem(e.asProblem()); } }
Source:
<code>public void theGetAssociationLnObjectsRequestIsReceivedAsPartOfABundledRequest() throws Throwable { this.setDeviceAndOrganisationProperties(); <START> this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, "526 Retrieve association objectlist bundle", <END> TEST_SUITE_XML); }</code><technical_language>I suggest put "526 Retrieve association objectlist bundle" in a parameter following: private static final String TEST_CASE_XML_526 = "526 Retrieve association objectlist bundle";</technical_language>

Target:
public void theGetAssociationLnObjectsRequestIsReceivedAsPartOfABundledRequest() throws Throwable { this.setDeviceAndOrganisationProperties(); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML_526, TEST_SUITE_XML); }
Source:
<code>void initializeInstantiationMetric(final boolean instantiated) { <START> helixClusterManagerInstantiationFailed = new Gauge<Boolean>() { <END> @Override public Boolean getValue() { return !instantiated; } }; registry.register(MetricRegistry.name(HelixClusterManager.class, "helixClusterManagerInstantiationFailed"), helixClusterManagerInstantiationFailed); }</code><technical_language>is this a gauge? a is set, this change right? Counter better</technical_language>

Target:
void initializeInstantiationMetric(final boolean instantiated) { helixClusterManagerInstantiationFailed = new Gauge<Boolean>() { @Override public Boolean getValue() { return !instantiated; } }; registry.register(MetricRegistry.name(HelixClusterManager.class, "instantiationFailed"), helixClusterManagerInstantiationFailed); }
Source:
<code>public Optional<List<String>> getPartitionNamesByParts(String databaseName, String tableName, List<String> parts) { try { List<PartitionInfo> partitionInfos = ProtoUtils.toPartitionInfoList( <START> client.readTable(databaseName, tableName, Constraint.getDefaultInstance())); <END> partitionInfos = partitionInfos.stream().filter(p -> p.getTableName().equals(tableName)) .filter(partition -> { List<String> values = partition.getValuesList(); if (values.size() != parts.size()) { return false; } for (int i = 0; i < values.size(); i++) { String constraintPart = parts.get(i); if (!constraintPart.isEmpty() && !values.get(i).equals(constraintPart)) { return false; } } return true; }) .collect(Collectors.toList()); List<String> partitionNames = partitionInfos.stream().map(PartitionInfo::getPartitionName).collect(Collectors.toList()); return Optional.of(partitionNames); } catch (AlluxioStatusException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }</code><technical_language>put this previous line</technical_language>

Target:
public Optional<List<String>> getPartitionNamesByParts(String databaseName, String tableName, List<String> parts) { try { List<PartitionInfo> partitionInfos = AlluxioProtoUtils.toPartitionInfoList(client.readTable(databaseName, tableName, Constraint.getDefaultInstance())); partitionInfos = partitionInfos.stream().filter(p -> p.getTableName().equals(tableName)) .filter(partition -> { List<String> values = partition.getValuesList(); if (values.size() != parts.size()) { return false; } for (int i = 0; i < values.size(); i++) { String constraintPart = parts.get(i); if (!constraintPart.isEmpty() && !values.get(i).equals(constraintPart)) { return false; } } return true; }) .collect(toImmutableList()); List<String> partitionNames = partitionInfos.stream().map(PartitionInfo::getPartitionName).collect(toImmutableList()); return Optional.of(partitionNames); } catch (AlluxioStatusException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }
Source:
<code>public void clientFailed(HttpPageBufferClient client, Throwable cause) { requireNonNull(client, "client is null"); requireNonNull(cause, "cause is null"); <START> if (cancelledClients.contains(client)) { <END> return; } ExchangeClient.this.clientFailed(cause); }</code><technical_language>move this check ExchangeClient.this.clientFailed is lock</technical_language>

Target:
public void clientFailed(HttpPageBufferClient client, Throwable cause) { requireNonNull(client, "client is null"); requireNonNull(cause, "cause is null"); ExchangeClient.this.clientFailed(client, cause); }
Source:
<code>private void stopNodeRecycleThread() { <START> if (nodeRecycleThread != null) { <END> try { proxyLogger.fine("Shutting down NodeRecycleThread for " + getId()); nodeRecycleThread.shutdown(); nodeRecycleThread.join(2000); } catch (InterruptedException e) { } } }</code><technical_language>this test if thread is alive? I nodeRecycleThread is null</technical_language>

Target:
private void stopNodeRecycleThread() { if (nodeRecycleThread.isAlive()) { try { nodeRecycleThread.shutdown(); nodeRecycleThread.join(2000); } catch (InterruptedException e) { } } }
Source:
<code>public Iterable<Request> part(final CharSequence name) { final List<Request> values = this.map .get(name.toString().toLowerCase(Locale.ENGLISH)); final Iterable<Request> iter; if (values == null) { iter = new VerboseIterable<>( Collections.<Request>emptyList(), <START> String.format( <END> "there are no parts by name \"%s\" among %d others: %s", name, this.map.size(), this.map.keySet() ) ); } else { iter = new VerboseIterable<>( values, String.format( "there are just %d parts by name \"%s\"", values.size(), name ) ); } return iter; }</code><technical_language>@essobedo is reason for this change</technical_language>

Target:
public Iterable<Request> part(final CharSequence name) { final List<Request> values = this.map .get(name.toString().toLowerCase(Locale.ENGLISH)); final Iterable<Request> iter; if (values == null) { iter = new VerboseIterable<>( Collections.<Request>emptyList(), new Sprintf( "there are no parts by name \"%s\" among %d others: %s", name, this.map.size(), this.map.keySet() ) ); } else { iter = new VerboseIterable<>( values, new Sprintf( "there are just %d parts by name \"%s\"", values.size(), name ) ); } return iter; }
Source:
<code>private void deleteContent(String spaceId, String contentId, ContentStore store) { try { store.deleteContent(spaceId, contentId); <START> log.info("Deleted content ({}/{})", spaceId, contentId); <END> } catch (Exception ex) { final String message = MessageFormat.format( "Failed to delete content ({0}/{1}) due to {2}. As this is a non-critical failure, processing will " + "continue on.", spaceId, contentId, ex.getMessage()); log.error(message, ex); } }</code><technical_language>Is this log needed if above? this moves debug level? I want "delete" log messages showing in log some context</technical_language>

Target:
private void deleteContent(String spaceId, String contentId, ContentStore store) { try { store.deleteContent(spaceId, contentId); log.debug("Deleted content ({}/{})", spaceId, contentId); } catch (Exception ex) { final String message = format("Failed to delete content ({0}/{1}) due to {2}." + " As this is a non-critical failure, processing will " + "continue on.", spaceId, contentId, ex.getMessage()); log.error(message, ex); } }
Source:
<code>public static byte[] getResource(String path, String type, String name) { Kernel32 kernel32 = Kernel32.INSTANCE; final HMODULE target = kernel32.LoadLibraryEx(path, null, Kernel32.LOAD_LIBRARY_AS_DATAFILE); Pointer t = null; try { t = new Pointer(Long.parseLong(type)); } catch (Exception e) { t = new Memory(Native.WCHAR_SIZE * (type.length() + 1)); t.setWideString(0, type); } Pointer n = null; try { n = new Pointer(Long.parseLong(name)); } catch (Exception e) { n = new Memory(Native.WCHAR_SIZE * (name.length() + 1)); n.setWideString(0, name); } HRSRC hRsrc = kernel32.FindResource(target, n, t); <START> <END> if (hRsrc == null) { return null; } HANDLE loaded = kernel32.LoadResource(target, hRsrc); DWORD length = kernel32.SizeofResource(target, hRsrc); Pointer start = kernel32.LockResource(loaded); byte[] buf = start.getByteArray(0, length.intValue()); return buf; }</code><technical_language>extra blank lines - group relevant statements together..</technical_language>

Target:
public static byte[] getResource(String path, String type, String name) { final HMODULE target = Kernel32.INSTANCE.LoadLibraryEx(path, null, Kernel32.LOAD_LIBRARY_AS_DATAFILE); Pointer t = null; try { t = new Pointer(Long.parseLong(type)); } catch (Exception e) { t = new Memory(Native.WCHAR_SIZE * (type.length() + 1)); t.setWideString(0, type); } Pointer n = null; try { n = new Pointer(Long.parseLong(name)); } catch (Exception e) { n = new Memory(Native.WCHAR_SIZE * (name.length() + 1)); n.setWideString(0, name); } HRSRC hRsrc = Kernel32.INSTANCE.FindResource(target, n, t); if (hRsrc == null) { return null; } HANDLE loaded = Kernel32.INSTANCE.LoadResource(target, hRsrc); int length = Kernel32.INSTANCE.SizeofResource(target, hRsrc); Pointer start = Kernel32.INSTANCE.LockResource(loaded); return start.getByteArray(0, length); }
Source:
<code>private Optional<Pattern> joinWordsToPattern(EscapeMode escapeMode) { List<String> words = getSearchWords(); if ((words == null) || words.isEmpty() || words.get(0).isEmpty()) { return Optional.empty(); } StringJoiner joiner = new StringJoiner(")|(", "(", ")"); for (String word : words) { if (regularExpression) { joiner.add(word); } <START> else { <END> switch (escapeMode) { case JAVA: joiner.add(Pattern.quote(word)); break; case JAVASCRIPT: joiner.add(JAVASCRIPT_ESCAPED_CHARS_PATTERN.matcher(word).replaceAll("\\\\$0")); break; default: throw new IllegalArgumentException("Unknown special characters escape method: " + escapeMode); } } } String searchPattern = joiner.toString(); if (caseSensitive) { return Optional.of(Pattern.compile(searchPattern)); } else { return Optional.of(Pattern.compile(searchPattern, Pattern.CASE_INSENSITIVE)); } }</code><technical_language>checkstyle complaining putting this in lines? effect, odd..</technical_language>

Target:
private Optional<Pattern> joinWordsToPattern(EscapeMode escapeMode) { List<String> words = getSearchWords(); if ((words == null) || words.isEmpty() || words.get(0).isEmpty()) { return Optional.empty(); } StringJoiner joiner = new StringJoiner(")|(", "(", ")"); for (String word : words) { if (regularExpression) { joiner.add(word); } else { switch (escapeMode) { case JAVA: joiner.add(Pattern.quote(word)); break; case JAVASCRIPT: joiner.add(JAVASCRIPT_ESCAPED_CHARS_PATTERN.matcher(word).replaceAll("\\\\$0")); break; default: throw new IllegalArgumentException("Unknown special characters escape mode: " + escapeMode); } } } String searchPattern = joiner.toString(); if (caseSensitive) { return Optional.of(Pattern.compile(searchPattern)); } else { return Optional.of(Pattern.compile(searchPattern, Pattern.CASE_INSENSITIVE)); } }
Source:
<code>public void saveGame() { <START> if (mGameEngine.isThreadRunnging() && mGameEngine.isThreadChangeNeeded()) { <END> mGameEngine.post(new Message() { @Override public void execute() { saveGame(); } }); return; } saveGame("", false); }</code><technical_language>is this necessary, in case is game thread running</technical_language>

Target:
public void saveGame() { if (mGameEngine.isThreadRunning() && mGameEngine.isThreadChangeNeeded()) { mGameEngine.post(new Message() { @Override public void execute() { saveGame(); } }); return; } saveGame("", false); }
Source:
<code>public boolean ceationCommandClassExists(DiagnosticChain diagnostics, Map<Object, Object> context) { if (creationCommandClass != null) { Class<?> theClass = ClassLoaderHelper.loadClass(creationCommandClass); if (theClass == null) { if (diagnostics != null) { diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, ArchitectureValidator.DIAGNOSTIC_SOURCE, ArchitectureValidator.ARCHITECTURE_CONTEXT__CEATION_COMMAND_CLASS_EXISTS, EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { <START> "ceationCommandClassExists " <END> + creationCommandClass + " cannot be loaded", EObjectValidator.getObjectLabel(this, context) }), new Object[] { this })); } return false; } } return true; }</code><technical_language>missing r in creation</technical_language>

Target:
public boolean ceationCommandClassExists(DiagnosticChain diagnostics, Map<Object, Object> context) { if (creationCommandClass != null) { Class<?> theClass = ClassLoaderHelper.loadClass(creationCommandClass); if (theClass == null) { if (diagnostics != null) { diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, ArchitectureValidator.DIAGNOSTIC_SOURCE, ArchitectureValidator.ARCHITECTURE_CONTEXT__CEATION_COMMAND_CLASS_EXISTS, EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "creationCommandClassExists " + creationCommandClass + " cannot be loaded", EObjectValidator.getObjectLabel(this, context) }), new Object[] { this })); } return false; } } return true; }
Source:
<code>public String getVoltDBRootPath(PathsType.Voltdbroot path) { if (isRunningWithOldVerbs()) { return path.getPath(); } <START> try { <END> return m_nodeSettings.getVoltDBRoot().getCanonicalPath(); } catch (IOException e) { throw new SettingsException("failed to canonicalize voltdbroot"); } }</code><technical_language>include path for failed canonicalize. Java File root = m_nodeSettings.getVoltDBRoot(); String path = voltdbRoot.getPath(); try { return root.getCanonicalPath(); } catch (IOException e) { throw new SettingsException("failed canonicalize voltdbroot " + path + ". Reason: " + e.getMessage()); } Similar recommendation for other paths - command log, snapshot, dr/export overflow forth</technical_language>

Target:
public String getVoltDBRootPath(PathsType.Voltdbroot path) { if (isRunningWithOldVerbs()) { return path.getPath(); } return getVoltDBRootPath(); }
Source:
<code>public TableScanNode tableScan(List<Symbol> symbols, Map<Symbol, ColumnHandle> assignments) { <START> TableHandle tableHandle = new TableHandle(new ConnectorId("testConnector"), new TestingMetadata.TestingTableHandle()); <END> return tableScan(tableHandle, symbols, assignments); }</code><technical_language>static import</technical_language>

Target:
public TableScanNode tableScan(List<Symbol> symbols, Map<Symbol, ColumnHandle> assignments) { TableHandle tableHandle = new TableHandle(new ConnectorId("testConnector"), new TestingTableHandle()); return tableScan(tableHandle, symbols, assignments); }
Source:
<code>public static void setup() { Properties p = new Properties(); String servers = p.getProperty("voltdb.servers", "localhost"); String user = p.getProperty("voltdb.user", ""); String password = p.getProperty("voltdb.password", ""); String strLimit = p.getProperty("voltdb.ratelimit", "70000"); p.setProperty("voltdb.servers", servers); p.setProperty("voltdb.user", user); p.setProperty("voltdb.password", password); p.setProperty("voltdb.ratelimit", strLimit); try { voltClient = new VoltClient4(); voltClient.setProperties(p); if (ConnectionHelper.checkDBServers(servers)) { voltClient.init(); haveDb = true; removeExistingData(); } <START> } catch (Exception e) { <END> e.printStackTrace(); fail("Could not create Database Client"); } }</code><technical_language>This needs wrapped in assumeNoException instead of a try/catch test runs a local VoltDB instance</technical_language>

Target:
public static void setup() { Properties p = new Properties(); String servers = p.getProperty("voltdb.servers", "localhost"); String user = p.getProperty("voltdb.user", ""); String password = p.getProperty("voltdb.password", ""); String strLimit = p.getProperty("voltdb.ratelimit", "70000"); p.setProperty("voltdb.servers", servers); p.setProperty("voltdb.user", user); p.setProperty("voltdb.password", password); p.setProperty("voltdb.ratelimit", strLimit); try { voltClient = new VoltClient4(); voltClient.setProperties(p); if (ConnectionHelper.checkDBServers(servers)) { voltClient.init(); haveDb = true; removeExistingData(); } } catch (Exception e) { assumeNoException("Something was running on VoltDB's port but it wasn't a usable copy of VoltDB", e); } }
Source:
<code>public void run() { while (!testContext.isStopped()) { double chance = random.nextDouble(); if ((chance -= mapReduceProb) < 0) { IMap<Integer, Employee> map = targetInstance.getMap(basename); JobTracker tracker = targetInstance.getJobTracker(Thread.currentThread().getName() + basename); Job<Integer, Employee> job = tracker.newJob(KeyValueSource.fromMap(map)); ICompletableFuture< Map< Integer, Set<Employee>> > future = job .mapper( new ModIdMapper(2) ) .combiner(new RangeIdCombinerFactory(10, 30)) .reducer(new IdReducerFactory(10,20,30)) .submit(); try { Map<Integer, Set<Employee>> result = future.get(); for(Set<Employee> s : result.values() ){ if(s!=null){ System.out.println(s); for(Employee e : s ){ assertTrue(e.getId()%2 == 0); assertTrue(e.getId() >= 10 && e.getId() <= 30); assertTrue(e.getId() != 10); assertTrue(e.getId() != 20); assertTrue(e.getId() != 30); } } } <START> } catch (Exception e) { throw new RuntimeException(e);} <END> counter.mapReduce++; } else if ((chance -= getMapEntryProb) < 0) { IMap<Integer, Employee> map = targetInstance.getMap(basename); map.get(random.nextInt(keyCount)); counter.getMapEntry++; } else if ((chance -= modifyEntryProb) < 0) { IMap<Integer, Employee> map = targetInstance.getMap(basename); Employee e = map.get(random.nextInt(keyCount)); e.randomizeProperties(); map.put(e.getId(), e); counter.modifyMapEntry++; } } targetInstance.getList(basename).add(counter); }</code><technical_language>catching exception? Is a checked exception catching</technical_language>

Target:
public void run() { while (!testContext.isStopped()) { double chance = random.nextDouble(); if ((chance -= mapReduceProb) < 0) { IMap<Integer, Employee> map = targetInstance.getMap(baseName); JobTracker tracker = targetInstance.getJobTracker(Thread.currentThread().getName() + baseName); Job<Integer, Employee> job = tracker.newJob(KeyValueSource.fromMap(map)); ICompletableFuture< Map< Integer, Set<Employee>> > future = job .mapper( new ModIdMapper(2) ) .combiner(new RangeIdCombinerFactory(10, 30)) .reducer(new IdReducerFactory(10,20,30)) .submit(); try { Map<Integer, Set<Employee>> result = future.get(); for(Set<Employee> s : result.values() ){ for(Employee e : s ){ assertTrue(e.getId()%2 == 0); assertTrue(e.getId() >= 10 && e.getId() <= 30); assertTrue(e.getId() != 10); assertTrue(e.getId() != 20); assertTrue(e.getId() != 30); } } } catch (Exception e) { throw new RuntimeException(e);} counter.mapReduce++; } else if ((chance -= getMapEntryProb) < 0) { IMap<Integer, Employee> map = targetInstance.getMap(baseName); map.get(random.nextInt(keyCount)); counter.getMapEntry++; } else if ((chance -= modifyEntryProb) < 0) { IMap<Integer, Employee> map = targetInstance.getMap(baseName); Employee e = map.get(random.nextInt(keyCount)); e.randomizeProperties(); map.put(e.getId(), e); counter.modifyMapEntry++; } } targetInstance.getList(baseName).add(counter); }
Source:
<code>public void onThumbClick(@Nullable ReadingListPage item) { <START> beginMultiSelect(); <END> }</code><technical_language>a click thumbnail ActionMode navigating page surprising me. run this Rita</technical_language>

Target:
public void onThumbClick(@Nullable ReadingListPage item) { onClick(item); }
Source:
<code>public int countTuples(IInputKey key, TupleMask seedMask, ITuple seed) { <START> return countTuples(key, seedMask.transform(seed)); <END> }</code><technical_language>this fallback others incorrect. suggestion: create a "wide" modifiable tuple of width key.arity, write contents of 'seed' seedMask.set() /*there a helper for this in TupleMask probably*/, finally call toImmutable() pass reuslting wide tuple legacy method</technical_language>

Target:
public int countTuples(IInputKey key, TupleMask seedMask, ITuple seed) { return countTuples(key, seedMask.transform(seed, key.getArity())); }
Source:
<code>public Response remove(Action action) { get(); boolean forceRemove = action != null && action.isSetForce() ? action.isForce() : false; <START> RemoveVmParameters params = new RemoveVmParameters(asGuid(id), forceRemove); <END> if (action != null && action.isSetVm() && action.getVm().isSetDisks() && action.getVm().getDisks().isSetDetachOnly()) { params.setRemoveDisks(false); } return performAction(VdcActionType.RemoveVm, params); }</code><technical_language>"guid" instead of "asGuid(id)"</technical_language>

Target:
public Response remove(Action action) { get(); boolean forceRemove = action != null && action.isSetForce() ? action.isForce() : false; RemoveVmParameters params = new RemoveVmParameters(guid, forceRemove); if (action != null && action.isSetVm() && action.getVm().isSetDisks() && action.getVm().getDisks().isSetDetachOnly()) { params.setRemoveDisks(false); } return performAction(VdcActionType.RemoveVm, params); }
Source:
<code>public FilterExpression visit(ComparisonNode node, Class entityType) { ComparisonOperator op = node.getOperator(); String relationship = node.getSelector(); List<String> arguments = node.getArguments(); Path path = buildPath(entityType, relationship); if (FilterPredicate.toManyInPath(dictionary, path) && !allowNestedToManyAssociations) { throw new RSQLParseException(String.format("Invalid association %s", relationship)); } if (op.equals(ISNULL_OP)) { return buildIsNullOperator(path, arguments); } Class<?> relationshipType = path.lastElement() .map(Path.PathElement::getFieldType) .orElseThrow(() -> new IllegalStateException("Path must not be empty")); if (Number.class.isAssignableFrom(relationshipType)) { for (int i = 0; i < arguments.size(); i++) { <START> arguments.set(i, arguments.get(i).replace("*", "")); <END> } } List<Object> values = arguments.stream() .map((argument) -> (Object) CoerceUtil.coerce(argument, relationshipType)) .collect(Collectors.toList()); if (op.equals(RSQLOperators.EQUAL) || op.equals(RSQLOperators.IN)) { return equalityExpression(arguments.get(0), path, values); } if (op.equals(RSQLOperators.NOT_EQUAL) || op.equals(RSQLOperators.NOT_IN)) { return new NotFilterExpression(equalityExpression(arguments.get(0), path, values)); } if (OPERATOR_MAP.containsKey(op)) { return new FilterPredicate(path, OPERATOR_MAP.get(op), values); } throw new RSQLParseException(String.format("Invalid Operator %s", op.getSymbol())); }</code><technical_language>Stripping this means lose context of operator is applied. need if this is startsWith, endsWith, contains, equals. position of asterisk (beginning, end, beginning end) defines operator applies</technical_language>

Target:
public FilterExpression visit(ComparisonNode node, Class entityType) { ComparisonOperator op = node.getOperator(); String relationship = node.getSelector(); List<String> arguments = node.getArguments(); Path path = buildPath(entityType, relationship); if (FilterPredicate.toManyInPath(dictionary, path) && !allowNestedToManyAssociations) { throw new RSQLParseException(String.format("Invalid association %s", relationship)); } if (op.equals(ISNULL_OP)) { return buildIsNullOperator(path, arguments); } Class<?> relationshipType = path.lastElement() .map(Path.PathElement::getFieldType) .orElseThrow(() -> new IllegalStateException("Path must not be empty")); List<Object> values = arguments.stream() .map(argument -> Number.class.isAssignableFrom(relationshipType) ? argument.replace("*", "") : argument ) .map((argument) -> (Object) CoerceUtil.coerce(argument, relationshipType)) .collect(Collectors.toList()); if (op.equals(RSQLOperators.EQUAL) || op.equals(RSQLOperators.IN)) { return equalityExpression(arguments.get(0), path, values); } if (op.equals(RSQLOperators.NOT_EQUAL) || op.equals(RSQLOperators.NOT_IN)) { return new NotFilterExpression(equalityExpression(arguments.get(0), path, values)); } if (OPERATOR_MAP.containsKey(op)) { return new FilterPredicate(path, OPERATOR_MAP.get(op), values); } throw new RSQLParseException(String.format("Invalid Operator %s", op.getSymbol())); }
Source:
<code>private Optional<String> createJsonQueryPlan(QueryInfo queryInfo) { try { if (queryInfo.getOutputStage().isPresent()) { JsonCodec<JsonRenderer.JsonRenderedNode> planCodec = JsonCodec.jsonCodec(JsonRenderer.JsonRenderedNode.class); JsonCodec<Map<PlanFragmentId, JsonRenderer.JsonRenderedNode>> mapCodec = JsonCodec.mapJsonCodec(PlanFragmentId.class, JsonRenderer.JsonRenderedNode.class); ImmutableMap.Builder<PlanFragmentId, JsonRenderer.JsonRenderedNode> fragmentJsonMap = ImmutableMap.builder(); <START> for (StageInfo stage : getAllStages(queryInfo.getOutputStage())) { <END> PlanFragmentId fragmentId = stage.getPlan().getId(); if (!stage.getPlan().getJsonRepresentation().isPresent()) { log.warn("Error creating json plan for query %s: json representation is not present for fragment %s", queryInfo.getQueryId(), fragmentId); return Optional.empty(); } String jsonRepresentation = stage.getPlan().getJsonRepresentation().get(); JsonRenderer.JsonRenderedNode node = planCodec.fromJson(jsonRepresentation); fragmentJsonMap.put(fragmentId, node); } return Optional.of(mapCodec.toJson(fragmentJsonMap.build())); } } catch (Exception e) { log.warn(e, "Error creating json plan for query %s: %s", queryInfo.getQueryId(), e); } return Optional.empty(); }</code><technical_language>confused this block of code.. simply serialized string directly</technical_language>

Target:
private Optional<String> createJsonQueryPlan(QueryInfo queryInfo) { try { if (queryInfo.getOutputStage().isPresent()) { ImmutableSortedMap.Builder<PlanFragmentId, JsonPlanFragment> fragmentJsonMap = ImmutableSortedMap.naturalOrder(); for (StageInfo stage : getAllStages(queryInfo.getOutputStage())) { PlanFragmentId fragmentId = stage.getPlan().getId(); JsonPlanFragment jsonPlanFragment = new JsonPlanFragment(stage.getPlan().getJsonRepresentation().get()); fragmentJsonMap.put(fragmentId, jsonPlanFragment); } return Optional.of(PLAN_MAP_CODEC.toJson(fragmentJsonMap.build())); } } catch (Exception e) { log.warn(e, "Error creating json plan for query %s: %s", queryInfo.getQueryId(), e); } return Optional.empty(); }
Source:
<code>public Response getViews(@BeanParam PaginationParam paginationParam) { <START> Set<ApiEntity> apis = apiService.findPublishedByUser(getAuthenticatedUserOrNull()); <END> List<View> viewsList = viewService.findAll() .stream() .filter(v -> !ALL_ID.equals(v.getId())) .filter(v -> !v.isHidden()) .sorted(Comparator.comparingInt(ViewEntity::getOrder)) .map(v-> viewMapper.convert(v, uriInfo.getBaseUriBuilder())) .collect(Collectors.toList()); return createListResponse(viewsList, paginationParam); }</code><technical_language>deleted apis ViewEnhancer</technical_language>

Target:
public Response getViews(@BeanParam PaginationParam paginationParam) { final List<View> viewsList = viewService.findAll() .stream() .filter(v -> !ALL_ID.equals(v.getId())) .filter(v -> !v.isHidden()) .sorted(Comparator.comparingInt(ViewEntity::getOrder)) .map(v-> viewMapper.convert(v, uriInfo.getBaseUriBuilder())) .collect(Collectors.toList()); return createListResponse(viewsList, paginationParam); }