auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void validate(Schema schema) { schema.validate(); Set<String> transformedColumns = new HashSet<>(); Set<String> argumentColumns = new HashSet<>(); for (FieldSpec fieldSpec : schema.getAllFieldSpecs()) { if (!fieldSpec.isVirtualColumn()) { String column = fieldSpec.getName(); String transformFunction = fieldSpec.getTransformFunction(); if (transformFunction != null) { try { List<String> arguments = FunctionEvaluatorFactory.getExpressionEvaluator(fieldSpec).getArguments(); <START> if (arguments.contains(column)) { throw new IllegalStateException("The arguments of transform function '" + transformFunction + "' should not contain the destination column '" + column + "'"); } <END> transformedColumns.add(column); argumentColumns.addAll(arguments); } catch (Exception e) { throw new IllegalStateException( "Exception in getting arguments for transform function '" + transformFunction + "' for column '" + column + "'", e); } } if (fieldSpec.getFieldType().equals(FieldSpec.FieldType.TIME)) { validateTimeFieldSpec(fieldSpec); } if (fieldSpec.getFieldType().equals(FieldSpec.FieldType.DATE_TIME)) { validateDateTimeFieldSpec(fieldSpec); } } } if (!Collections.disjoint(transformedColumns, argumentColumns)) { throw new IllegalStateException("Columns:" + transformedColumns.retainAll(argumentColumns) + ", are a result of transformations, and cannot be used as arguments to other transform functions"); } }</code><technical_language>For readability. for other checks suggestion Preconditions.checkState(arguments.contains(column), "The arguments of transform function '%s' destination column '%s'", transformFunction, column);</technical_language>

Target:
public static void validate(Schema schema) { schema.validate(); Set<String> transformedColumns = new HashSet<>(); Set<String> argumentColumns = new HashSet<>(); for (FieldSpec fieldSpec : schema.getAllFieldSpecs()) { if (!fieldSpec.isVirtualColumn()) { String column = fieldSpec.getName(); String transformFunction = fieldSpec.getTransformFunction(); if (transformFunction != null) { try { List<String> arguments = FunctionEvaluatorFactory.getExpressionEvaluator(fieldSpec).getArguments(); Preconditions.checkState(!arguments.contains(column), "The arguments of transform function %s should not contain the destination column %s", transformFunction, column); transformedColumns.add(column); argumentColumns.addAll(arguments); } catch (Exception e) { throw new IllegalStateException( "Exception in getting arguments for transform function '" + transformFunction + "' for column '" + column + "'", e); } } if (fieldSpec.getFieldType().equals(FieldSpec.FieldType.TIME)) { validateTimeFieldSpec(fieldSpec); } if (fieldSpec.getFieldType().equals(FieldSpec.FieldType.DATE_TIME)) { validateDateTimeFieldSpec(fieldSpec); } } } Preconditions.checkState(Collections.disjoint(transformedColumns, argumentColumns), "Columns: %s are a result of transformations, and cannot be used as arguments to other transform functions", transformedColumns.retainAll(argumentColumns)); }
Source:
<code>private LineData generateKetonesData() { List<String> xVals = new ArrayList<>(); List<Entry> yVals = new ArrayList<>(); int k = 0; for (int i = presenter.getKetonesReadings().size() - 1; i >= 0; i--) { float val = Float.parseFloat(presenter.getKetonesReadings().get(i).toString()); yVals.add(new Entry(k, val)); k++; } for (int i = presenter.getKetonesReadingsDateTime().size() - 1; i >= 0; i--) { String date = presenter.convertDate(presenter.getKetonesReadingsDateTime().get(i)); <START> xVals.add(date + ""); <END> } xValues = xVals; return new LineData(generateLineDataSet(yVals, getResources().getColor(R.color.glucosio_fab_ketones))); }</code><technical_language>add empty string</technical_language>

Target:
private LineData generateKetonesData() { List<String> xVals = new ArrayList<>(); List<Entry> yVals = new ArrayList<>(); int k = 0; for (int i = presenter.getKetonesReadings().size() - 1; i >= 0; i--) { float val = Float.parseFloat(presenter.getKetonesReadings().get(i).toString()); yVals.add(new Entry(k, val)); k++; } for (int i = presenter.getKetonesReadingsDateTime().size() - 1; i >= 0; i--) { String date = presenter.convertDate(presenter.getKetonesReadingsDateTime().get(i)); xVals.add(date); } xValues = xVals; return new LineData(generateLineDataSet(yVals, getResources().getColor(R.color.glucosio_fab_ketones))); }
Source:
<code>private static File convertSamToBam(final String sam) throws IOException { try { final MergeSamFiles msf = new MergeSamFiles(); final File bam = new File(bamOutDir, sam.replaceAll("sam$", "bam")); final int returnCode = msf.instanceMain( new String[]{ "INPUT=" + (new File(testdir, sam).getAbsolutePath()), "CREATE_INDEX=true", "OUTPUT=" + bam.getAbsolutePath()}); Assert.assertEquals(returnCode, 0); return bam; } finally { <START> SAMFileWriterFactory.setDefaultCreateIndexWhileWriting(false); <END> } }</code><technical_language>hmmm. this is insidious....how happen again</technical_language>

Target:
private static File convertSamToBam(final String sam) throws IOException { final MergeSamFiles msf = new MergeSamFiles(); final File bam = new File(bamOutDir, sam.replaceAll("sam$", "bam")); final int returnCode = msf.instanceMain( new String[]{ "INPUT=" + (new File(testdir, sam).getAbsolutePath()), "CREATE_INDEX=true", "OUTPUT=" + bam.getAbsolutePath()}); Assert.assertEquals(returnCode, 0); return bam; }
Source:
<code>public static void main(String[] args) throws Exception { EncoderConfig config = new EncoderConfig(); JCommander jCommander = new JCommander(config, args); jCommander.setProgramName(CommandLineEncoder.class.getSimpleName()); if (config.help) { jCommander.usage(); return; } String outFileString = config.outputFileBase; if (EncoderConfig.DEFAULT_OUTPUT_FILE_BASE.equals(outFileString)) { outFileString += '.' + config.imageFormat.toLowerCase(Locale.ENGLISH); } <START> HashMap<EncodeHintType,String> hints = new HashMap<EncodeHintType,String>(); <END> if (config.errorCorrectionLevel != "") { hints.put(EncodeHintType.ERROR_CORRECTION,config.errorCorrectionLevel); } BitMatrix matrix = new MultiFormatWriter().encode( config.contents.get(0), config.barcodeFormat, config.width, config.height,hints); MatrixToImageWriter.writeToPath(matrix, config.imageFormat, Paths.get(outFileString)); }</code><technical_language>Nits: Map variable type, omit generic types HashMap. missing spaces arguments in ",hints)" instead of ", hints)"</technical_language>

Target:
public static void main(String[] args) throws Exception { EncoderConfig config = new EncoderConfig(); JCommander jCommander = new JCommander(config, args); jCommander.setProgramName(CommandLineEncoder.class.getSimpleName()); if (config.help) { jCommander.usage(); return; } String outFileString = config.outputFileBase; if (EncoderConfig.DEFAULT_OUTPUT_FILE_BASE.equals(outFileString)) { outFileString += '.' + config.imageFormat.toLowerCase(Locale.ENGLISH); } Map<EncodeHintType, Object> hints = new HashMap<>(); if (config.errorCorrectionLevel != null) { hints.put(EncodeHintType.ERROR_CORRECTION, config.errorCorrectionLevel); } BitMatrix matrix = new MultiFormatWriter().encode( config.contents.get(0), config.barcodeFormat, config.width, config.height, hints); MatrixToImageWriter.writeToPath(matrix, config.imageFormat, Paths.get(outFileString)); }
Source:
<code>private BootstrapConfigurationImpl() { this.defaultProviderClassName = null; this.constraintValidatorFactoryClassName = null; this.messageInterpolatorClassName = null; this.traversableResolverClassName = null; this.parameterNameProviderClassName = null; this.clockProviderClassName = null; <START> this.valueExtractorClassNames = new HashSet<>( 0 ); <END> this.validatedExecutableTypes = DEFAULT_VALIDATED_EXECUTABLE_TYPES; this.isExecutableValidationEnabled = true; this.constraintMappingResourcePaths = newHashSet(); this.properties = newHashMap(); }</code><technical_language>minor consistent initialize set map in way? I check if a specific reason initialize this compared others</technical_language>

Target:
private BootstrapConfigurationImpl() { this.defaultProviderClassName = null; this.constraintValidatorFactoryClassName = null; this.messageInterpolatorClassName = null; this.traversableResolverClassName = null; this.parameterNameProviderClassName = null; this.clockProviderClassName = null; this.valueExtractorClassNames = new HashSet<>(); this.validatedExecutableTypes = DEFAULT_VALIDATED_EXECUTABLE_TYPES; this.isExecutableValidationEnabled = true; this.constraintMappingResourcePaths = new HashSet<>(); this.properties = new HashMap<>(); }
Source:
<code>public JsonJourney getLatestJourney(String dgw) { long endTime = System.currentTimeMillis(); long startTime = endTime - 30 * 1000; List<JsonJourneyInfo> journeyInfoList = getJourneyInfo(dgw, startTime, endTime); Collections.sort(journeyInfoList, new Comparator<JsonJourneyInfo>() { @Override <START> public int compare(JsonJourneyInfo lhs, JsonJourneyInfo rhs) { <END> if (rhs.getTimestamp() > lhs.getTimestamp()) { return 1; } else { return rhs.getTimestamp() == lhs.getTimestamp() ? 0 : -1; } } }); String destination = ""; String journeyId = ""; for (JsonJourneyInfo journeyInfo : journeyInfoList) { if (journeyInfo.getResourceSpec().equals(RESOURCE_SPEC_DESTINATION)) { destination = journeyInfo.getValue(); break; } } for (JsonJourneyInfo journeyInfo : journeyInfoList) { if (journeyInfo.getResourceSpec().equals(RESOURCE_SPEC_JOURNEY_ID)) { journeyId = journeyInfo.getValue(); break; } } return new JsonJourney(destination, journeyId); }</code><technical_language>Naming of variables? I understand</technical_language>

Target:
public JsonJourney getLatestJourney(String dgw) { long endTime = System.currentTimeMillis(); long startTime = endTime - 30 * 1000; List<JsonJourneyInfo> journeyInfoList = getJourneyInfo(dgw, startTime, endTime); Collections.sort(journeyInfoList, new Comparator<JsonJourneyInfo>() { @Override public int compare(JsonJourneyInfo first, JsonJourneyInfo second) { if (second.getTimestamp() > first.getTimestamp()) { return 1; } else { return second.getTimestamp() == first.getTimestamp() ? 0 : -1; } } }); String destination = ""; String journeyId = ""; for (JsonJourneyInfo journeyInfo : journeyInfoList) { if (journeyInfo.getResourceSpec().equals(RESOURCE_SPEC_DESTINATION)) { destination = journeyInfo.getValue(); break; } } for (JsonJourneyInfo journeyInfo : journeyInfoList) { if (journeyInfo.getResourceSpec().equals(RESOURCE_SPEC_JOURNEY_ID)) { journeyId = journeyInfo.getValue(); break; } } return new JsonJourney(destination, journeyId); }
Source:
<code>public Object invoke(Method methodToCall, Object instance, Object[] args) throws Throwable { <START> if (suspendedDeclaredMethod && !suspendedBaseClassMethod && reactiveBaseClassMethod) { <END> return invokeReactiveToSuspend(methodToCall, instance, args); } return methodToCall.invoke(instance, args); }</code><technical_language>Ternary if</technical_language>

Target:
public Object invoke(Method methodToCall, Object instance, Object[] args) throws Throwable { return shouldAdaptReactiveToSuspended() ? invokeReactiveToSuspend(methodToCall, instance, args) : methodToCall.invoke(instance, args); }
Source:
<code>public void filter(ClientRequestContext requestContext) throws IOException { int size = 0; for (Map.Entry<String, String> entry : RpcContext.getContext().getAttachments().entrySet()) { String key = entry.getKey(); String value = entry.getValue(); if (StringUtils.isNotEmpty(key)) { if (illegalForRest(key)) { throw new IllegalArgumentException("The attachments of " + RpcContext.class.getSimpleName() + " must not contain ',' or '=' when using rest protocol"); } } if (StringUtils.isNotEmpty(value)) { if (illegalForRest(value)) { throw new IllegalArgumentException("The attachments of " + RpcContext.class.getSimpleName() + " must not contain ',' or '=' when using rest protocol"); <START> } <END> } size += entry.getValue().getBytes("UTF-8").length; if (size > MAX_HEADER_SIZE) { throw new IllegalArgumentException("The attachments of " + RpcContext.class.getSimpleName() + " is too big"); } String attachments = entry.getKey() + "=" + entry.getValue(); requestContext.getHeaders().add(DUBBO_ATTACHMENT_HEADER, attachments); } }</code><technical_language>if ( (StringUtils.isNotEmpty(key) && illegalForRest(key)) || (StringUtils.isNotEmpty(value) && illegalForRest(value)) ) { throw new IllegalArgumentException("The attachments of " + RpcContext.class.getSimpleName() + " ',' '=' rest protocol"); } Is code</technical_language>

Target:
public void filter(ClientRequestContext requestContext) throws IOException { int size = 0; for (Map.Entry<String, String> entry : RpcContext.getContext().getAttachments().entrySet()) { String key = entry.getKey(); String value = entry.getKey(); if (illegalForRest(key) || illegalForRest(value)) { throw new IllegalArgumentException("The attachments of " + RpcContext.class.getSimpleName() + " must not contain ',' or '=' when using rest protocol"); } if (value != null) { size += value.getBytes("UTF-8").length; } if (size > MAX_HEADER_SIZE) { throw new IllegalArgumentException("The attachments of " + RpcContext.class.getSimpleName() + " is too big"); } String attachments = key + "=" + value; requestContext.getHeaders().add(DUBBO_ATTACHMENT_HEADER, attachments); } }
Source:
<code>public boolean removeAttributeWithoutCheck(PerunSession sess, String key, AttributeDefinition attribute) throws InternalErrorException, WrongAttributeAssignmentException { getAttributesManagerImpl().checkNamespace(sess, attribute, AttributesManager.NS_ENTITYLESS_ATTR); boolean changed = getAttributesManagerImpl().removeAttribute(sess, key, attribute); if (changed) { try { getAttributesManagerImpl().changedAttributeHook(sess, key, new Attribute(attribute)); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } <START> log.info("{} removed attribute: by key = {}",sess.getPerunClient().getId(), attribute.getName(), key); <END> getPerunBl().getAuditer().log(sess, "{} removed for {}.", new AttributeDefinition(attribute), key); } return changed; }</code><technical_language>PerunClient is valid for OAUTH2 clients. empty object, especially client ID is present. I prefer logging PerunSession, I understand, this message short. PerunSession PerunPrincipal a short toString(). Please add method in PerunSession like: getLogId() return of actor property, user identity. If sufficient in a future, safely change method return extSourceName other properties. Thank you</technical_language>

Target:
public boolean removeAttributeWithoutCheck(PerunSession sess, String key, AttributeDefinition attribute) throws InternalErrorException, WrongAttributeAssignmentException { getAttributesManagerImpl().checkNamespace(sess, attribute, AttributesManager.NS_ENTITYLESS_ATTR); boolean changed = getAttributesManagerImpl().removeAttribute(sess, key, attribute); if (changed) { try { getAttributesManagerImpl().changedAttributeHook(sess, key, new Attribute(attribute)); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } log.info("{} removed attribute: by key {}.",sess.getLogId(), attribute.getName(), key); getPerunBl().getAuditer().log(sess, "{} removed for {}.", new AttributeDefinition(attribute), key); } return changed; }
Source:
<code>Control _getChildren () { <START> NSClipView nsClipView = contentView(); <END> if (nsClipView == null) return new Control [0]; NSArray views = nsClipView.subviews(); int count = (int)views.count(); Control children = new Control [count]; if (count == 0) return children; int j = 0; for (int i=0; i<count; i++){ Widget widget = display.getWidget (views.objectAtIndex (count - i - 1).id); if (widget != null && widget != this && widget instanceof Control) { children [j++] = (Control) widget; } } if (j == count) return children; Control newChildren = new Control [j]; System.arraycopy (children, 0, newChildren, 0, j); return newChildren; }</code><technical_language>Return type of contentView is NSView, this compile. Changing NSView leads a NPE Exception in thread "main" java.lang.NullPointerException org.eclipse.swt.widgets.Decorations.releaseChildren(Decorations.java:407) org.eclipse.swt.widgets.Shell.releaseChildren(Shell.java:1420) org.eclipse.swt.widgets.Widget.release(Widget.java:1356) org.eclipse.swt.widgets.Control.release(Control.java:2974) org.eclipse.swt.widgets.Widget.dispose(Widget.java:694)</technical_language>

Target:
Control _getChildren () { NSView nsClipView = contentView(); if (nsClipView == null) return new Control [0]; NSArray views = nsClipView.subviews(); int count = (int)views.count(); Control children = new Control [count]; if (count == 0) return children; int j = 0; for (int i=0; i<count; i++){ Widget widget = display.getWidget (views.objectAtIndex (count - i - 1).id); if (widget != null && widget != this && widget instanceof Control) { children [j++] = (Control) widget; } } if (j == count) return children; Control newChildren = new Control [j]; System.arraycopy (children, 0, newChildren, 0, j); return newChildren; }
Source:
<code>public Response toResponse(Exception exception) { IndyRestMapperResponse irmpr = new IndyRestMapperResponse(exception.getMessage(), LocalDateTime.now()); Optional .ofNullable(exception.getCause()) .ifPresent((exc) -> { irmpr.setCause(exc.getCause()); } ); <START> return Response.ok(irmpr, MediaType.APPLICATION_JSON).build(); <END> }</code><technical_language>a 200 response here, IMO. This big problems, Sonatype Nexus, returns 200 OK returns errors, results in Indy storing error output intended artifact download file</technical_language>

Target:
public Response toResponse(Exception exception) { IndyRestMapperResponse irmpr = new IndyRestMapperResponse(exception.getMessage(), LocalDateTime.now()); Optional .ofNullable(exception.getCause()) .ifPresent((exc) -> { irmpr.setCause(exc.getCause()); } ); if(exception instanceof IndyWorkflowException || exception instanceof IOException) { return Response.status(Response.Status.BAD_REQUEST).entity(irmpr).type(MediaType.APPLICATION_JSON).build(); } else if(exception instanceof ServiceUnavailableException ) { return Response.status(Response.Status.SERVICE_UNAVAILABLE).entity(irmpr).type(MediaType.APPLICATION_JSON).build(); } else if(exception instanceof NotFoundException) { return Response.status(Response.Status.NOT_FOUND).entity(irmpr).type(MediaType.APPLICATION_JSON).build(); } else { return Response.status(Response.Status.NOT_FOUND).entity(null).build(); } }
Source:
<code><START> private void setPollInterval(final long pollInterval, final TimeUnit pollIntervalTimeUnit) { <END> this.pollInterval = pollInterval; this.pollIntervalTimeUnit = pollIntervalTimeUnit; }</code><technical_language>need this method. roll this setPollIntervalMinutes</technical_language>

Target:
private void setPollInterval(final long pollInterval, final TimeUnit pollIntervalTimeUnit) { this.pollInterval = pollInterval; this.pollIntervalTimeUnit = pollIntervalTimeUnit; pollAllSourcesFuture.cancel(false); pollAllSourcesFuture = pollAllSourcesThreadPool.scheduleAtFixedRate( this::pollAllSources, pollInterval, pollInterval, pollIntervalTimeUnit); }
Source:
<code>private static Map<RateCurveId, Curve> mapCurves( Map<RateCurveId, LoadedCurveKey> curveGroups, Map<LoadedCurveKey, Curve> curves) { <START> return curveGroups.entrySet().stream() <END> .filter(e -> curves.containsKey(e.getValue())) .collect(Collector.of( ImmutableMap.Builder<RateCurveId, Curve>::new, (b, e) -> b.put(e.getKey(), curves.get(e.getValue())), (b1, b2) -> b1.putAll(b2.build()), Characteristics.UNORDERED)) .build(); }</code><technical_language>Prefer a blank line { parameters multiple lines</technical_language>

Target:
private static Map<RateCurveId, Curve> mapCurves( Map<RateCurveId, LoadedCurveKey> curveGroups, Map<LoadedCurveKey, Curve> curves) { return curveGroups.entrySet().stream() .filter(e -> curves.containsKey(e.getValue())) .collect(toImmutableMap(e -> e.getKey(), e -> curves.get(e.getValue()))); }
Source:
<code>private static List<Variable> removeDuplicates(List<Variable> typeMatches) { <START> HashSet<Variable> set <END> = new HashSet<>(); set.addAll(typeMatches); return Arrays.asList(set.toArray(new Variable[set.size()])); }</code><technical_language>Simpler: return new ArrayList<>(new HashSet<>(typeMatches));</technical_language>

Target:
private static List<Variable> removeDuplicates(List<Variable> typeMatches) { return new ArrayList<>(new HashSet<>(typeMatches)); }
Source:
<code>public static boolean verifyAvailability(List<? extends URI> locations, boolean one, IProgressMonitor monitor) <START> throws IOException, CoreException { <END> if (locations.isEmpty() || locations.size() > 5) { throw new IllegalArgumentException(); } int countFound = 0; for (URI location : locations) { try { getLastModified(location, monitor); if (one) { return true; } ++countFound; } catch (IOException | CoreException e) { if (!one) { return false; } continue; } } return countFound == locations.size(); }</code><technical_language>throw declarations wrong now</technical_language>

Target:
public static boolean verifyAvailability(List<? extends URI> locations, boolean one, IProgressMonitor monitor) { if (locations.isEmpty() || locations.size() > 5) { throw new IllegalArgumentException(); } int countFound = 0; MultiStatus status = new MultiStatus(DiscoveryCore.ID_PLUGIN, 0, "Verifying resource availability failed", new Exception()); try { for (URI location : locations) { try { getLastModified(location, monitor); if (one) { return true; } ++countFound; } catch (IOException | CoreException e) { status.add(getStatus(e)); if (!one) { return false; } continue; } } } finally { if (!status.isOK()) { StatusHandler.log(status); } } return countFound == locations.size(); }
Source:
<code>public SpringContextFactory(Config config, Class<?> c, Set<Class<?>> classes) { PersistentSet<Class> s = config.getClasses(); <START> for(Class next : classes){ <END> s = s.plus(next); } s= s.plus(c); Microserver microserver = c.getAnnotation(Microserver.class); final PersistentSet<Class> immutableS = s; s = Optional.ofNullable(microserver) .flatMap(ms -> Optional.ofNullable(ms.blacklistedClasses())) .map(bl -> { Set<Class> blacklistedClasses = Arrays.stream(bl) .collect(Collectors.toSet()); return (PersistentSet<Class>)immutableS.stream() .filter(clazz -> !blacklistedClasses.contains(clazz)).hashSet(); }) .orElse(immutableS); this.classes = s; this.config = config; springBuilder = ReactiveSeq.fromStream(PluginLoader.INSTANCE.plugins.get() .stream()) .filter(m -> m.springBuilder() != null) .map(Plugin::springBuilder) .findFirst() .orElse(new SpringApplicationConfigurator()); }</code><technical_language>replace loop s.plusAll(classes) some similar code</technical_language>

Target:
public SpringContextFactory(Config config, Class<?> c, Set<Class<?>> classes) { PersistentSet<Class> s = config.getClasses() .plusAll(classes); s= s.plus(c); Microserver microserver = c.getAnnotation(Microserver.class); final PersistentSet<Class> immutableS = s; s = Optional.ofNullable(microserver) .flatMap(ms -> Optional.ofNullable(ms.blacklistedClasses())) .map(bl -> { Set<Class> blacklistedClasses = Arrays.stream(bl) .collect(Collectors.toSet()); return (PersistentSet<Class>)immutableS.stream() .filter(clazz -> !blacklistedClasses.contains(clazz)).hashSet(); }) .orElse(immutableS); this.classes = s; this.config = config; springBuilder = ReactiveSeq.fromStream(PluginLoader.INSTANCE.plugins.get() .stream()) .filter(m -> m.springBuilder() != null) .map(Plugin::springBuilder) .findFirst() .orElse(new SpringApplicationConfigurator()); }
Source:
<code>public void testGetAvailableCollectionTypes() throws Exception { assertEquals(3, oracle.getAvailableCollectionTypes().size()); <START> <END> assertTrue(oracle.getAvailableCollectionTypes().contains("List")); assertTrue(oracle.getAvailableCollectionTypes().contains("HashSet")); assertTrue(oracle.getAvailableCollectionTypes().contains("CustomCollection")); }</code><technical_language>@jomarko a test for entry in "Project Collection Types" of false</technical_language>

Target:
public void testGetAvailableCollectionTypes() throws Exception { assertEquals(3, oracle.getAvailableCollectionTypes().size()); assertTrue(oracle.getAvailableCollectionTypes().contains("List")); assertTrue(oracle.getAvailableCollectionTypes().contains("HashSet")); assertTrue(oracle.getAvailableCollectionTypes().contains("CustomCollectionOne")); assertFalse(oracle.getAvailableCollectionTypes().contains("SeemsAsCollection")); }
Source:
<code>public int getCompletedPositions() { <START> return 0; <END> }</code><technical_language>completedPositions</technical_language>

Target:
public long getCompletedPositions() { return completedPositions; }
Source:
<code>public DockerTemplateOptions volumes(Map<String, String> volumes) { for (Map.Entry<String, String> entry : checkNotNull(volumes, "volumes").entrySet()) { checkNotNull(entry.getKey(), "host paths must not be null"); checkNotNull(entry.getValue(), "container paths must not be null"); <START> } <END> this.volumes = Optional.<Map<String, String>>of(ImmutableMap.copyOf(volumes)); return this; }</code><technical_language>In general for PR, checks needed? Guava's immutable collections allow null values checking null input in map list options redundant</technical_language>

Target:
public DockerTemplateOptions volumes(Map<String, String> volumes) { this.volumes = Optional.<Map<String, String>>of(ImmutableMap.copyOf(checkNotNull(volumes, "volumes"))); return this; }
Source:
<code>protected void processAnnotatedDiscovery(BeanArchiveBuilder builder) { <START> List<String> builderClasses = new ArrayList<String>(builder.getClasses()); <END> for (String className : builderClasses) { ClassInfo cinfo = cindex.getClassByName(DotName.createSimple(className)); if (!containsBeanDefiningAnnotation(cinfo.annotations().keySet())) { builder.removeClass(className); } } WeldSEBeanDeploymentArchive bda = builder.build(); addToArchives(bda); }</code><technical_language>I need create a new list here. builder expose Iterator remove classes a bean defining annotation iterate</technical_language>

Target:
protected BeanDeploymentArchive processAnnotatedDiscovery(BeanArchiveBuilder builder) { Iterator<String> classIterator = builder.getClassIterator(); while (classIterator.hasNext()) { String className = classIterator.next(); ClassInfo cinfo = cindex.getClassByName(DotName.createSimple(className)); if (!containsBeanDefiningAnnotation(cinfo.annotations().keySet())) { classIterator.remove(); } } WeldSEBeanDeploymentArchive bda = builder.build(); return bda; }
Source:
<code>public Set<SecurityGroup> listSecurityGroupsForNode(String name) { checkNotNull(name, "name"); <START> final String virtualNetworkName; <END> Deployment deployment = api.getDeploymentApiForService(name).get(name); virtualNetworkName = deployment.virtualNetworkName(); List<String> subnetNames = FluentIterable.from(deployment.roles()) .transformAndConcat(new Function<Role, Iterable<Role.ConfigurationSet>>() { @Override public Iterable<Role.ConfigurationSet> apply(Role input) { return input.configurationSets(); } }) .transformAndConcat(new Function<Role.ConfigurationSet, Iterable<Role.ConfigurationSet.SubnetName>>() { @Override public Iterable<Role.ConfigurationSet.SubnetName> apply(Role.ConfigurationSet input) { return input.subnetNames(); } }) .transform(new Function<Role.ConfigurationSet.SubnetName, String>() { @Override public String apply(Role.ConfigurationSet.SubnetName input) { return input.name(); } }) .toList(); return FluentIterable.from(subnetNames) .transform(new Function<String, NetworkSecurityGroup>() { @Override public NetworkSecurityGroup apply(String input) { return api.getNetworkSecurityGroupApi().getNetworkSecurityGroupAppliedToSubnet(virtualNetworkName, input); } }) .transform(new NetworkSecurityGroupSecurityGroupFunction()) .toSet(); }</code><technical_language>Create variable below. create uninitialized</technical_language>

Target:
public Set<SecurityGroup> listSecurityGroupsForNode(String name) { checkNotNull(name, "name"); Deployment deployment = api.getDeploymentApiForService(name).get(name); final String virtualNetworkName = deployment.virtualNetworkName(); List<String> subnetNames = FluentIterable.from(deployment.roles()) .transformAndConcat(new Function<Role, Iterable<Role.ConfigurationSet>>() { @Override public Iterable<Role.ConfigurationSet> apply(Role input) { return input.configurationSets(); } }) .transformAndConcat(new Function<Role.ConfigurationSet, Iterable<Role.ConfigurationSet.SubnetName>>() { @Override public Iterable<Role.ConfigurationSet.SubnetName> apply(Role.ConfigurationSet input) { return input.subnetNames(); } }) .transform(new Function<Role.ConfigurationSet.SubnetName, String>() { @Override public String apply(Role.ConfigurationSet.SubnetName input) { return input.name(); } }) .toList(); return FluentIterable.from(subnetNames) .transform(new Function<String, NetworkSecurityGroup>() { @Override public NetworkSecurityGroup apply(String input) { return api.getNetworkSecurityGroupApi().getNetworkSecurityGroupAppliedToSubnet(virtualNetworkName, input); } }) .transform(new NetworkSecurityGroupSecurityGroupFunction()) .toSet(); }
Source:
<code>private void startConfigurationProviders(List<Object> components) { components.stream() <START> .filter(component -> ConfigurationProvider.class.isAssignableFrom(component.getClass())) <END> .forEach(configurationProviders -> { try { getMuleRegistry().applyLifecycle(configurationProviders, Initialisable.PHASE_NAME, Startable.PHASE_NAME); } catch (MuleException e) { throw new RuntimeException(e); } }); }</code><technical_language>a plain instanceof</technical_language>

Target:
private void startConfigurationProviders(List<Object> components) { components.stream() .filter(component -> component instanceof ConfigurationProvider) .forEach(configurationProviders -> { try { getMuleRegistry().applyLifecycle(configurationProviders, Initialisable.PHASE_NAME, Startable.PHASE_NAME); } catch (MuleException e) { throw new RuntimeException(e); } }); }
Source:
<code>public void refresh() { runOnMainThread(new Runnable() { @Override public void run() { <START> mImageReader = mImageReaderCreator.create(mResolution); <END> } }); }</code><technical_language>previous mImageReader instance ? closed detached</technical_language>

Target:
public void refresh() { runOnMainThread(new Runnable() { @Override public void run() { if (mImageReader != null) { mImageReaderToReleaseList.add(mImageReader); } mImageReader = mImageReaderCreator.create(mResolution); } }); }
Source:
<code>public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { try { fConfigDir = null; SubMonitor subMonitor = SubMonitor.convert(monitor, 4); try { preLaunchCheck(configuration, launch, subMonitor.newChild(2)); } catch (CoreException e) { if (e.getStatus().getSeverity() == IStatus.CANCEL) { <START> monitor.setCanceled(true); <END> return; } throw e; } VMRunnerConfiguration runnerConfig = new VMRunnerConfiguration(getMainClass(), getClasspath(configuration)); runnerConfig.setVMArguments(getVMArguments(configuration)); runnerConfig.setProgramArguments(getProgramArguments(configuration)); runnerConfig.setWorkingDirectory(getWorkingDirectory(configuration).getAbsolutePath()); runnerConfig.setEnvironment(getEnvironment(configuration)); runnerConfig.setVMSpecificAttributesMap(getVMSpecificAttributesMap(configuration)); monitor.worked(1); setDefaultSourceLocator(configuration); manageLaunch(launch); IVMRunner runner = getVMRunner(configuration, mode); if (runner != null) runner.run(runnerConfig, launch, monitor); else monitor.setCanceled(true); monitor.done(); } catch (final CoreException e) { monitor.setCanceled(true); throw e; } }</code><technical_language>subMonitor</technical_language>

Target:
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { try { fConfigDir = null; SubMonitor subMonitor = SubMonitor.convert(monitor, 4); try { preLaunchCheck(configuration, launch, subMonitor.newChild(2)); } catch (CoreException e) { if (e.getStatus().getSeverity() == IStatus.CANCEL) { monitor.setCanceled(true); return; } throw e; } VMRunnerConfiguration runnerConfig = new VMRunnerConfiguration(getMainClass(), getClasspath(configuration)); runnerConfig.setVMArguments(getVMArguments(configuration)); runnerConfig.setProgramArguments(getProgramArguments(configuration)); runnerConfig.setWorkingDirectory(getWorkingDirectory(configuration).getAbsolutePath()); runnerConfig.setEnvironment(getEnvironment(configuration)); runnerConfig.setVMSpecificAttributesMap(getVMSpecificAttributesMap(configuration)); subMonitor.worked(1); setDefaultSourceLocator(configuration); manageLaunch(launch); IVMRunner runner = getVMRunner(configuration, mode); if (runner != null) runner.run(runnerConfig, launch, subMonitor); else subMonitor.setCanceled(true); } catch (final CoreException e) { throw e; } }
Source:
<code>public int unresponsiveHostBackoffTimeSeconds() { <START> return MoreObjects.firstNonNull( <END> ifRuntimeConfigPresent(CassandraKeyValueServiceRuntimeConfig::unresponsiveHostBackoffTimeSeconds), config.unresponsiveHostBackoffTimeSeconds()); }</code><technical_language>simplify methods passing a single function else decide config object invoke on</technical_language>

Target:
public int unresponsiveHostBackoffTimeSeconds() { return chooseConfig(CassandraKeyValueServiceRuntimeConfig::unresponsiveHostBackoffTimeSeconds, config.unresponsiveHostBackoffTimeSeconds()); }
Source:
<code>public void testCreateEmptyBucketedPartition() { <START> testCreateEmptyBucketedPartition(HiveStorageFormat.RCBINARY); <END> }</code><technical_language>Loop storage formats do for other tests</technical_language>

Target:
public void testCreateEmptyBucketedPartition() { for (TestingHiveStorageFormat storageFormat : getAllTestingHiveStorageFormat()) { testCreateEmptyBucketedPartition(storageFormat.getFormat()); } }
Source:
<code>public OnErrorNotImplementedException(@NonNull Throwable e) { <START> this("The onError handler in the subscribe() method is not provided. Please specify it to avoid this type of exception. Further reading: <LINK_0> | " + (e != null ? e.getMessage() : ""), e); <END> }</code><technical_language>Oh, I Well, mentioning subscribe() long "set this error handler avoid this exception" mention onErrorXXX, a bit overwhelming tho</technical_language>

Target:
public OnErrorNotImplementedException(@NonNull Throwable e) { this("The exception was not handled due to missing onError handler in the subscribe() method call. Further reading: <LINK_1> | " + (e != null ? e.getMessage() : ""), e); }
Source:
<code>void waitForLoadCompletion() { waitForCriteria(LOAD_TIMEOUT, <START> () -> { return isLoaded(); <END> }); clearLoad(); }</code><technical_language>simplify () -> isLoaded()? this::isLoaded? interchangeability of bound method references lambdas is like</technical_language>

Target:
void waitForLoadCompletion() { waitForCriteria(LOAD_TIMEOUT, () -> isLoaded()); clearLoad(); }
Source:
<code>public void setGroups(List<Group> groups) { Group group1 = Group.nobody(); for (Group group2 : groups) { group1 = group1.or(group2); <START> } <END> setGroup(group1); }</code><technical_language>convert this Stream's reduce method :)</technical_language>

Target:
public void setGroups(List<Group> groups) { this.groups = groups; }
Source:
<code>private static TimeUnit valueOfTimeUnit(String timeUnitString) { try { return Duration.valueOfTimeUnit(timeUnitString); } catch (IllegalArgumentException e) { <START> throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "TimeUnit string must be one of [ns, us, ms, s, m, h, d]"); <END> } }</code><technical_language>TimeUnit string -> Time unit</technical_language>

Target:
private static TimeUnit valueOfTimeUnit(String timeUnitString) { try { return Duration.valueOfTimeUnit(timeUnitString); } catch (IllegalArgumentException e) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Time unit must be one of [ns, us, ms, s, m, h, d]", e); } }
Source:
<code>public final synchronized Runnable getDelegatedTask() { if (isDestroyed()) { return null; } final Runnable task = SSL.getTask(ssl); if (task == null) { <START> return task; <END> } return new Runnable() { @Override public void run() { try { if (isDestroyed()) { return; } task.run(); } finally { needTask = false; } } }; }</code><technical_language>return null</technical_language>

Target:
public final synchronized Runnable getDelegatedTask() { if (isDestroyed()) { return null; } final Runnable task = SSL.getTask(ssl); if (task == null) { return null; } return new Runnable() { @Override public void run() { try { if (isDestroyed()) { return; } task.run(); } finally { needTask = false; } } }; }
Source:
<code>public void write(JsonGenerator generator) throws IOException { generator.writeStartObject(); generator.writeStringField("type", type); <START> switch ("type") { <END> case "NOT": writeField(generator, "field", fields.get(0)); break; default: writeField(generator, "fields", fields); } generator.writeEndObject(); }</code><technical_language>switch (type)</technical_language>

Target:
public void write(JsonGenerator generator) throws IOException { generator.writeStartObject(); generator.writeStringField("type", type); switch (type) { case "NOT": writeField(generator, "field", fields.get(0)); break; default: writeField(generator, "fields", fields); } generator.writeEndObject(); }
Source:
<code>public void htmlUsage(final PrintStream stream, final String programName, final boolean printCommon) { stream.println("<a id=\"" + programName + "\"/>"); stream.println("<h3>" + programName + "</h3>"); stream.println("<section>"); <START> stream.println("<p>" + htmlEscape(getUsagePreamble()) + "</p>"); <END> boolean hasOptions = false; for (final OptionDefinition optionDefinition : optionDefinitions) { if (!optionDefinition.isCommon || printCommon) { hasOptions = true; break; } } if (hasOptions) { htmlPrintOptions(stream, printCommon); } stream.println("</section>"); }</code><technical_language>Nice, I thought of that</technical_language>

Target:
public void htmlUsage(final PrintStream stream, final String programName, final boolean printCommon) { stream.println("<h3 id=\"" + programName + "\">" + programName + "</h3>"); stream.println("<section>"); stream.println("<p>" + getUsagePreamble() + "</p>"); boolean hasOptions = false; for (final OptionDefinition optionDefinition : optionDefinitions) { if (!optionDefinition.isCommon || printCommon) { hasOptions = true; break; } } if (hasOptions) { htmlPrintOptions(stream, printCommon); } stream.println("</section>"); }
Source:
<code>public AbstractPostgresKeyValueStore(DataSource dataSource) { Objects.requireNonNull(dataSource); try { <START> Connection connection = dataSource.getConnection(); <END> selectStatement = connection.prepareStatement(String.format("SELECT %s, %s FROM %s WHERE %s = ? AND %s = ?", VALUE_COLUMN, EXPIRES_AT_COLUMN, getTableName(), KEY_COLUMN, CONTEXT_COLUMN)); upsertStatement = connection.prepareStatement(String.format( "INSERT INTO %s (%s, %s, %s, %s, %s) VALUES (?, ?, ?, ?, " + getValueStatementPlaceholder() + ") " + "ON CONFLICT ON CONSTRAINT " + getPkConstraintName() + " DO " + "UPDATE SET %s = ?, %s = ?, %s = " + getValueStatementPlaceholder(), getTableName(), KEY_COLUMN, CONTEXT_COLUMN, LAST_UPDATED_COLUMN, EXPIRES_AT_COLUMN, VALUE_COLUMN, LAST_UPDATED_COLUMN, EXPIRES_AT_COLUMN, VALUE_COLUMN )); lastUpdatedStatement = connection.prepareStatement(String.format("SELECT %s, %s FROM %s WHERE %s = ? AND " + "%s =" + " ?", LAST_UPDATED_COLUMN, EXPIRES_AT_COLUMN, getTableName(), KEY_COLUMN, CONTEXT_COLUMN)); } catch (SQLException e) { throw new RuntimeException(e); } }</code><technical_language>This connection eventually closed. a chance of "stale", need do some connection management here</technical_language>

Target:
public AbstractPostgresKeyValueStore(DataSource dataSource) { this.dataSource = Objects.requireNonNull(dataSource); }
Source:
<code>NonBlockingRouter(RouterConfig routerConfig, NonBlockingRouterMetrics routerMetrics, NetworkConfig networkConfig, NetworkMetrics networkMetrics, SSLFactory sslFactory, NotificationSystem notificationSystem, ClusterMap clusterMap, Time time) <START> throws Exception { <END> this.routerConfig = routerConfig; this.routerMetrics = routerMetrics; this.time = time; ocList = new ArrayList<OperationController>(routerConfig.routerScalingUnitCount); for (int i = 0; i < routerConfig.routerScalingUnitCount; i++) { ocList.add( new OperationController(this, routerConfig, networkConfig, networkMetrics, sslFactory, notificationSystem, clusterMap, time)); } }</code><technical_language>I this is IOException right</technical_language>

Target:
NonBlockingRouter(RouterConfig routerConfig, NonBlockingRouterMetrics routerMetrics, NetworkConfig networkConfig, NetworkMetrics networkMetrics, SSLFactory sslFactory, NotificationSystem notificationSystem, ClusterMap clusterMap, Time time) throws IOException { this.routerConfig = routerConfig; this.routerMetrics = routerMetrics; this.networkConfig = networkConfig; this.networkMetrics = networkMetrics; this.sslFactory = sslFactory; this.notificationSystem = notificationSystem; this.clusterMap = clusterMap; this.time = time; ocList = new ArrayList<OperationController>(routerConfig.routerScalingUnitCount); for (int i = 0; i < routerConfig.routerScalingUnitCount; i++) { ocList.add(new OperationController()); } }
Source:
<code>public void onPluginDirectoryFetched(PluginStore.OnPluginDirectoryFetched event) { if (isFinishing()) { return; } if (event.isError()) { AppLog.e(AppLog.T.PLUGINS, "An error occurred while fetching the plugin directory: " + event.type); } else { switch (event.type) { case POPULAR: refreshPlugins(PluginListType.POPULAR); break; case NEW: refreshPlugins(PluginListType.NEW); break; } } PluginListType listType = event.type == PluginDirectoryType.POPULAR ? PluginListType.POPULAR : PluginListType.NEW; PluginListFragment fragment = getListFragment(); if (fragment != null && fragment.getListType() == listType) { <START> fragment.onLoadedMore(event.canLoadMore); <END> } }</code><technical_language>I this is a previous PR, I get a chance review that, I want mention I forget it. I feel this section else, I handling error success cases together. Concretely, I plugin directory fetch fail temporarily in case passing event.canLoadMore stop asking for more data. want in case, feels weird a consequence instead of a direct decision. idea if this explanation sense all. I big deal of a deal, feel free ignore if sense</technical_language>

Target:
public void onPluginDirectoryFetched(PluginStore.OnPluginDirectoryFetched event) { if (isFinishing()) { return; } if (event.isError()) { AppLog.e(AppLog.T.PLUGINS, "An error occurred while fetching the plugin directory: " + event.type); return; } switch (event.type) { case POPULAR: reloadPlugins(PluginListType.POPULAR); break; case NEW: reloadPlugins(PluginListType.NEW); break; } PluginListType listType = event.type == PluginDirectoryType.POPULAR ? PluginListType.POPULAR : PluginListType.NEW; PluginListFragment fragment = getListFragment(); if (fragment != null && fragment.getListType() == listType) { fragment.onLoadedMore(event.canLoadMore); } }
Source:
<code>public void testProxyAuthFail() throws Exception { startProxy(0, "user"); CountDownLatch latch = new CountDownLatch(1); final HttpClientOptions options = new HttpClientOptions() .setProxyOptions(new ProxyOptions() .setType(ProxyType.HTTP) .setHost("localhost") .setPort(proxy.getPort())); HttpClient client = vertx.createHttpClient(options); client.getAbs("https://localhost/", resp -> { log.info("this request is supposed to fail"); fail(); }) .exceptionHandler(e -> { <START> log.warn("Exception", e); <END> latch.countDown(); }) .end(); latch.await(); }</code><technical_language>please logging</technical_language>

Target:
public void testProxyAuthFail() throws Exception { startProxy(0, "user"); final HttpClientOptions options = new HttpClientOptions() .setProxyOptions(new ProxyOptions() .setType(ProxyType.HTTP) .setHost("localhost") .setPort(proxy.getPort())); HttpClient client = vertx.createHttpClient(options); client.getAbs("https://localhost/", resp -> { fail(); }) .exceptionHandler(e -> testComplete()) .end(); await(); }
Source:
<code>public void sendDocumentFinalizedMessage(IWantDocument iWantDocument) { BodyMailMessage message = buildDocumentFinalizedMessage(iWantDocument); try { emailService.sendMessage(message, false); } catch (Exception e) { <START> String errorMessage = new String("sendDocumentFinalizedMessage, Email could not be sent for IWNT edoc# " + iWantDocument.getDocumentNumber()); <END> LOG.error(errorMessage, e); } }</code><technical_language>Redundant String constructor</technical_language>

Target:
public void sendDocumentFinalizedMessage(IWantDocument iWantDocument) { BodyMailMessage message = buildDocumentFinalizedMessage(iWantDocument); try { emailService.sendMessage(message, false); } catch (Exception e) { LOG.error(("sendDocumentFinalizedMessage, Email could not be sent for IWNT edoc# " + iWantDocument.getDocumentNumber()), e); } }
Source:
<code>public JsonObject renderFragment(HttpRequest request, HttpResponse response) { String uriWithoutContextPath = request.getUriWithoutContextPath(); String uriPart = uriWithoutContextPath.substring(UriUtils.FRAGMENTS_URI_PREFIX.length()); String fragmentName = NameUtils.getFullyQualifiedName(rootComponent.getName(), uriPart); Fragment fragment = lookup.getAllFragments().get(fragmentName); if (fragment == null) { throw new FragmentNotFoundException("Requested fragment '" + fragmentName + "' does not exists."); } Model model = new MapModel(request.getFormParams()); RequestLookup requestLookup = createRequestLookup(request, response); API api = new API(sessionRegistry, requestLookup); <START> JsonObject renderedFragment = new JsonObject(); <END> renderedFragment.addProperty("html", fragment.render(model, lookup, requestLookup, api)); renderedFragment.addProperty(Placeholder.headJs.name(), requestLookup.getPlaceholderContent(Placeholder.headJs).orElse(null)); renderedFragment.addProperty(Placeholder.js.name(), requestLookup.getPlaceholderContent(Placeholder.js).orElse(null)); renderedFragment.addProperty(Placeholder.css.name(), requestLookup.getPlaceholderContent(Placeholder.css).orElse(null)); return renderedFragment; }</code><technical_language>rename renderedFragment variable? output</technical_language>

Target:
public JsonObject renderFragment(HttpRequest request, HttpResponse response) { String uriWithoutContextPath = request.getUriWithoutContextPath(); String uriPart = uriWithoutContextPath.substring(UriUtils.FRAGMENTS_URI_PREFIX.length()); String fragmentName = NameUtils.getFullyQualifiedName(rootComponent.getName(), uriPart); Fragment fragment = lookup.getAllFragments().get(fragmentName); if (fragment == null) { throw new FragmentNotFoundException("Requested fragment '" + fragmentName + "' does not exists."); } Model model = new MapModel(request.getFormParams()); RequestLookup requestLookup = createRequestLookup(request, response); API api = new API(sessionRegistry, requestLookup); JsonObject output = new JsonObject(); output.addProperty("html", fragment.render(model, lookup, requestLookup, api)); output.addProperty(Placeholder.headJs.name(), requestLookup.getPlaceholderContent(Placeholder.headJs).orElse(null)); output.addProperty(Placeholder.js.name(), requestLookup.getPlaceholderContent(Placeholder.js).orElse(null)); output.addProperty(Placeholder.css.name(), requestLookup.getPlaceholderContent(Placeholder.css).orElse(null)); return output; }
Source:
<code>private boolean nfsPing(String hostname) { <START> return (RPC.ping(hostname, RPC.TCP, NFS_PROGRAM, 2) == 0) || <END> (RPC.ping(hostname, RPC.UDP, NFS_PROGRAM, 2) == 0) || (RPC.ping(hostname, RPC.TCP, NFS_PROGRAM, 3) == 0) || (RPC.ping(hostname, RPC.UDP, NFS_PROGRAM, 3) == 0); }</code><technical_language>attempt version 3 is common now? worth adding version 4 a final attempt? So, TCP v3, UDP v3, TCP v2, UDP v2, TCP v4, UDP v4</technical_language>

Target:
private boolean nfsPing(String hostname) { return (RPC.ping(hostname, RPC.TCP, NFS_PROGRAM, 3) == 0) || (RPC.ping(hostname, RPC.UDP, NFS_PROGRAM, 3) == 0) || (RPC.ping(hostname, RPC.TCP, NFS_PROGRAM, 2) == 0) || (RPC.ping(hostname, RPC.UDP, NFS_PROGRAM, 2) == 0) || (RPC.ping(hostname, RPC.TCP, NFS_PROGRAM, 4) == 0) || (RPC.ping(hostname, RPC.UDP, NFS_PROGRAM, 4) == 0); }