auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public final void addInternalTopic(final String topicName, <END> final InternalTopicProperties internalTopicProperties) { addInternalTopic(topicName); if (internalTopicProperties != null) { internalTopicNamesWithProperties.put(topicName, internalTopicProperties); } }</code><technical_language>extend existing addInternalTopic instead of method</technical_language>

Target:
public final void addInternalTopic(final String topicName, final InternalTopicProperties internalTopicProperties) { Objects.requireNonNull(topicName, "topicName can't be null"); Objects.requireNonNull(internalTopicProperties, "internalTopicProperties can't be null"); internalTopicNamesWithProperties.put(topicName, internalTopicProperties); }
Source:
<code>public void doGC() { BlobProvider bp = getBlobProvider(); BinaryGarbageCollector gc = bp.getBinaryManager().getGarbageCollector(); gc.start(); <START> keyStream().map(this::getBlobKeys) END> .flatMap(Collection::stream) .forEach(gc::mark); gc.stop(true); computeStorageSize(); }</code><technical_language>Consider invoking gc.stop(true) in finally block ensure gc is stopped. Also, handle potential concurrent blobKey removal this.getBlobKeys() gc.mark()</technical_language>

Target:
public void doGC() { BlobProvider bp = getBlobProvider(); BinaryGarbageCollector gc = bp.getBinaryManager().getGarbageCollector(); boolean delete = false; gc.start(); try { keyStream().map(this::getBlobKeys) .flatMap(Collection::stream) .forEach(gc::mark); delete = true; } finally { gc.stop(delete); } computeStorageSize(); }
Source:
<code>public void setup(TestContext testContext) throws Exception { if (writePercentage < 0) { throw new IllegalArgumentException("Write percentage can't be smaller than 0"); } if (writePercentage > 100) { throw new IllegalArgumentException("Write percentage can't be larger than 100"); } this.testContext = testContext; targetInstance = testContext.getTargetInstance(); CacheManager cacheManager; if (TestUtils.isMemberNode(targetInstance)) { HazelcastServerCachingProvider hcp = new HazelcastServerCachingProvider(); cacheManager = new HazelcastServerCacheManager( hcp, targetInstance, hcp.getDefaultURI(), hcp.getDefaultClassLoader(), null); } else { HazelcastClientCachingProvider hcp = new HazelcastClientCachingProvider(); cacheManager = new HazelcastClientCacheManager( hcp, targetInstance, hcp.getDefaultURI(), hcp.getDefaultClassLoader(), null); } CacheConfig<Integer, Integer> config = new CacheConfig<Integer, Integer>(); config.setName(basename); try { cacheManager.createCache(basename, config); } catch (CacheException hack) { <START> log.severe(hack); <END> } cache = (ICache<Object, Object>) cacheManager.getCache(basename); selector.addOperation(Operation.PUT, ((double)writePercentage) / 100) .empty(Operation.GET); }</code><technical_language>This is true more, call getCache(), created do creating if necessary. this try catch block removed</technical_language>

Target:
public void setup(TestContext testContext) throws Exception { this.testContext = testContext; targetInstance = testContext.getTargetInstance(); CacheManager cacheManager; if (TestUtils.isMemberNode(targetInstance)) { HazelcastServerCachingProvider hcp = new HazelcastServerCachingProvider(); cacheManager = new HazelcastServerCacheManager( hcp, targetInstance, hcp.getDefaultURI(), hcp.getDefaultClassLoader(), null); } else { HazelcastClientCachingProvider hcp = new HazelcastClientCachingProvider(); cacheManager = new HazelcastClientCacheManager( hcp, targetInstance, hcp.getDefaultURI(), hcp.getDefaultClassLoader(), null); } CacheConfig<Integer, Integer> config = new CacheConfig<Integer, Integer>(); config.setName(basename); try { cacheManager.createCache(basename, config); } catch (CacheException hack) { log.severe(hack); } cache = (ICache<Object, Object>) cacheManager.getCache(basename); selector.addOperation(Operation.PUT, writeProbability) .empty(Operation.GET); }
Source:
<code>private boolean searchValue(Object value, CloseableIteratorSet<Map.Entry<K, V>> iterator, Function<K, MetadataValue<V>> remoteValueSupplier) { try (CloseableIterator<Map.Entry<K, V>> it = iterator.iterator()) { while (it.hasNext()) { Map.Entry<K, V> entry = it.next(); if (!entries.containsKey(wrap(entry.getKey())) && Objects.deepEquals(entry.getValue(), value)) { <START> ByRef<Boolean> result = new ByRef<>(false); <END> entries.computeIfAbsent(wrap(entry.getKey()), wrappedKey -> { MetadataValue<V> remoteValue = remoteValueSupplier.apply(wrappedKey.key); if (Objects.deepEquals(remoteValue.getValue(), value)) { result.set(true); return TransactionEntry.read(wrappedKey.key, remoteValue); } else { return null; } }); if (result.get()) { return true; } } } } return false; }</code><technical_language>ByRef.Boolean instead</technical_language>

Target:
private boolean searchValue(Object value, CloseableIteratorSet<Map.Entry<K, V>> iterator, Function<K, MetadataValue<V>> remoteValueSupplier) { try (CloseableIterator<Map.Entry<K, V>> it = iterator.iterator()) { while (it.hasNext()) { Map.Entry<K, V> entry = it.next(); if (!entries.containsKey(wrap(entry.getKey())) && Objects.deepEquals(entry.getValue(), value)) { ByRef.Boolean result = new ByRef.Boolean(false); entries.computeIfAbsent(wrap(entry.getKey()), wrappedKey -> { MetadataValue<V> remoteValue = remoteValueSupplier.apply(wrappedKey.key); if (Objects.deepEquals(remoteValue.getValue(), value)) { result.set(true); return TransactionEntry.read(wrappedKey.key, remoteValue); } else { return null; } }); if (result.get()) { return true; } } } } return false; }
Source:
<code>public void start() { try { this.scheduler.start(); } catch (final SchedulerException e) { <START> logger.warn("Error starting Quartz scheduler: ", e); <END> } logger.info("Quartz Scheduler started."); }</code><technical_language>warn relaxing for this kind of exception. error</technical_language>

Target:
public void start() { try { this.scheduler.start(); } catch (final SchedulerException e) { logger.error("Error starting Quartz scheduler: ", e); } logger.info("Quartz Scheduler started."); }
Source:
<code>private static Optional<Node> getChildElementByName(String name, List<Node> children) { <START> for (Node child : children) { <END> if (child.getNodeType() == Node.ELEMENT_NODE && ((Element) child).getTagName().equals(name)) { return Optional.of(child); } } return Optional.empty(); }</code><technical_language>write this a stream? java return children.stream() .filter(child -> child.getNodeType() == Node.ELEMENT_NODE) .map(Element.class::cast) .filter(element -> element.getTagName().equals(name)) .findFirst();</technical_language>

Target:
private static Optional<Element> getChildElementByName(String name, List<Node> children) { return children.stream() .filter(child -> child.getNodeType() == Node.ELEMENT_NODE) .map(Element.class::cast) .filter(element -> element.getTagName().equals(name)) .findFirst(); }
Source:
<code>private int read(WritableByteChannel channel) throws IOException { int waitTime = 0; int bytesRead; while (true) { bytesRead = readableStreamChannel.read(channel); if (bytesRead == 0) { try { Thread.sleep(10); waitTime += 10; <START> logger.warn("ReadableStreamChannelInputStream has been waiting for " + waitTime + "ms for data"); <END> } catch (InterruptedException e) { throw new IOException("Wait for data interrupted", e); } } else { break; } } return bytesRead; }</code><technical_language>warn always</technical_language>

Target:
private int read(WritableByteChannel channel) throws IOException { int SINGLE_WAIT_TIME = 10; int WARN_INTERVAL = 50; int totalWaitTime = 0; int bytesRead; while (true) { bytesRead = readableStreamChannel.read(channel); if (bytesRead == 0) { try { Thread.sleep(SINGLE_WAIT_TIME); totalWaitTime += SINGLE_WAIT_TIME; if (totalWaitTime % WARN_INTERVAL == 0) { logger.warn("ReadableStreamChannelInputStream has been waiting for " + totalWaitTime + "ms for data"); } } catch (InterruptedException e) { throw new IOException("Wait for data interrupted", e); } } else { break; } } return bytesRead; }
Source:
<code>private ProcessDefinition findDefinitionByName(String name) throws ReflectiveOperationException { Class clazz; try { <START> clazz = Class.forName(name); <END> } catch (ClassNotFoundException ex) { clazz = processDefinitions.stream().map(Object::getClass).filter(c -> c.getName().equals(name)).findFirst().orElseThrow(() -> ex); } final Class defClass = clazz; ProcessDefinition definition = (ProcessDefinition) defClass.newInstance(); processDefinitions.stream().filter(d -> d.getClass().equals(defClass)).findFirst().ifPresent(svc -> copyReferences(svc, definition)); return definition; }</code><technical_language>I recognize Class.forName() here, this a separate issue, but... is a reason this vs. processDefinition list? IIOW, code in catch block *only* code path? problem is Class.forName() work if class is of bundle. deal Dynamic-Package-Import, a pretty heavy weight solution</technical_language>

Target:
private ProcessDefinition findDefinitionByName(String name) throws ReflectiveOperationException { ProcessDefinitionFactory factory = processDefinitionFactories.stream(). filter(f -> name.equals(f.getName())).findFirst() .orElseThrow(()->new IllegalArgumentException("Unable to find process " + name)); return factory.createProcessDefinition(); }
Source:
<code>public void wrongValueTypeThrowsException() throws IllegalAccessException, InstantiationException, LegalSPITesterException { kvStore2 = factory.newStore(); K key = factory.createKey(1); try { if (this.factory.getValueType() == String.class) { kvStore2.putIfAbsent(key, 1.0f); } else { kvStore2.putIfAbsent(key, "value"); } throw new AssertionError("Expected ClassCastException because the value is of the wrong type"); } catch (CacheAccessException cae) { <START> assertThat(cae.getCause(), instanceOf(ClassCastException.class)); <END> throw new LegalSPITesterException("Warning, an exception is thrown due to the SPI test"); } }</code><technical_language>Wait, changes test semantics. do if is a ClassCastException throw otherwise</technical_language>

Target:
public void wrongValueTypeThrowsException() throws IllegalAccessException, InstantiationException, LegalSPITesterException { kvStore2 = factory.newStore(); K key = factory.createKey(1); try { if (this.factory.getValueType() == String.class) { kvStore2.putIfAbsent(key, 1.0f); } else { kvStore2.putIfAbsent(key, "value"); } throw new AssertionError("Expected ClassCastException because the value is of the wrong type"); } catch (ClassCastException e) { } catch (CacheAccessException e) { throw new LegalSPITesterException("Warning, an exception is thrown due to the SPI test"); } }
Source:
<code>private int getEstimatedColumnSizeInBytes(DataSchema.ColumnDataType dataType) { if (dataType.isNumber()) { switch (dataType) { case LONG: return Long.BYTES; case FLOAT: return Float.BYTES; case DOUBLE: return Double.BYTES; case INT: default: return Integer.BYTES; } } <START> else { <END> return pinotConfig.getEstimatedSizeInBytesForNonNumericColumn(); } }</code><technical_language>else is redundant</technical_language>

Target:
private int getEstimatedColumnSizeInBytes(DataSchema.ColumnDataType dataType) { if (dataType.isNumber()) { switch (dataType) { case LONG: return Long.BYTES; case FLOAT: return Float.BYTES; case DOUBLE: return Double.BYTES; case INT: default: return Integer.BYTES; } } return pinotConfig.getEstimatedSizeInBytesForNonNumericColumn(); }
Source:
<code>private void desanitizeAndUpdateProfile(StudentProfileAttributes profile) throws InvalidParametersException, EntityDoesNotExistException { profile.shortName = desanitizeIfHtmlSanitized(profile.shortName); profile.email = desanitizeIfHtmlSanitized(profile.email); profile.institute = desanitizeIfHtmlSanitized(profile.institute); profile.nationality = desanitizeIfHtmlSanitized(profile.nationality); <START> profile.gender = GenderType.valueOf(desanitizeIfHtmlSanitized(profile.gender.toString())); <END> profile.moreInfo = desanitizeIfHtmlSanitized(profile.moreInfo); if (!profile.isValid()) { throw new InvalidParametersException(profile.getInvalidityInfo()); } if (isPreview) { return; } profilesLogic.updateStudentProfile(profile); }</code><technical_language>enum, is need desanitize safely remove this line</technical_language>

Target:
private void desanitizeAndUpdateProfile(StudentProfileAttributes profile) throws InvalidParametersException, EntityDoesNotExistException { profile.shortName = desanitizeIfHtmlSanitized(profile.shortName); profile.email = desanitizeIfHtmlSanitized(profile.email); profile.institute = desanitizeIfHtmlSanitized(profile.institute); profile.nationality = desanitizeIfHtmlSanitized(profile.nationality); profile.moreInfo = desanitizeIfHtmlSanitized(profile.moreInfo); if (!profile.isValid()) { throw new InvalidParametersException(profile.getInvalidityInfo()); } if (isPreview) { return; } profilesLogic.updateStudentProfile(profile); }
Source:
<code>private RangePartitionFunc(@Parameter(PartitionSizeBits.class) final int partitionSizeBits) { if (partitionSizeBits <= 0 || partitionSizeBits > 32) { <START> throw new RuntimeException("PartitionSizeBits should be positive value and its maximum value is 32"); <END> } this.partitionSizeBits = partitionSizeBits; }</code><technical_language>Perhaps, "PartitionSizeBits a positive greater 32?"</technical_language>

Target:
private RangePartitionFunc(@Parameter(PartitionSizeBits.class) final int partitionSizeBits) { if (partitionSizeBits <= 0 || partitionSizeBits > 32) { throw new RuntimeException("PartitionSizeBits should be a positive value no greater than 32"); } this.partitionSizeBits = partitionSizeBits; }
Source:
<code>private Metadata getMetadata(String owner, String sequenceNumber, String offset) { <START> Metadata metadata = new Metadata(); <END> metadata.put("ownerId", owner); metadata.put("sequenceNumber", sequenceNumber); metadata.put("offset", offset); return metadata; }</code><technical_language>sure, is metadata case sensitive? @chradek mentioning some bug it.. nice interop language libraries</technical_language>

Target:
private Metadata getMetadata(String owner, String sequenceNumber, String offset) { Metadata metadata = new Metadata(); metadata.put("OwnerId", owner); metadata.put("SequenceNumber", sequenceNumber); metadata.put("Offset", offset); return metadata; }
Source:
<code>public String getEntryTitle(Run entry) { <START> return entry.getFullDisplayName(); <END> }</code><technical_language>Comparing #2845 RSS feed project name build status. This is enough. need project name (for rss multiple projects, #2845 broke), build name build status before</technical_language>

Target:
public String getEntryTitle(Run entry) { return entry.getFullDisplayName()+" ("+entry.getBuildStatusSummary().message+")"; }
Source:
<code>protected GlusterGeoRepSessionDetails getSessionDetails(Map<String, Object> innerMap) { <START> GlusterGeoRepSessionDetails details = super.getSessionDetails(innerMap); <END> if (details != null) { Long filesSynced = innerMap.containsKey(FILES_SYNCED) ? Long.parseLong(innerMap.get(FILES_SYNCED).toString()) : null; Long filesPending = innerMap.containsKey(FILES_PENDING) ? Long.parseLong(innerMap.get(FILES_PENDING).toString()) : null; Long bytesPending = innerMap.containsKey(BYTES_PENDING) ? Long.parseLong(innerMap.get(BYTES_PENDING).toString()) : null; Long deletesPending = innerMap.containsKey(DELETES_PENDING) ? Long.parseLong(innerMap.get(DELETES_PENDING).toString()) : null; Long filesSkipped = innerMap.containsKey(FILES_SKIPPED) ? Long.parseLong(innerMap.get(FILES_SKIPPED).toString()) : null; details.setFilesPending(filesPending); details.setFilesSkipped(filesSkipped); details.setFilesSynced(filesSynced); details.setBytesPending(bytesPending); details.setDeletesPending(deletesPending); } return details; }</code><technical_language>assign instance variable</technical_language>

Target:
protected GlusterGeoRepSessionDetails getSessionDetails(Map<String, Object> innerMap) { GlusterGeoRepSessionDetails details = super.getSessionDetails(innerMap); if (details != null) { Long filesSynced = innerMap.containsKey(FILES_SYNCED) ? parseExceptionSafeLong(innerMap.get(FILES_SYNCED).toString()) : null; Long filesPending = innerMap.containsKey(FILES_PENDING) ? parseExceptionSafeLong(innerMap.get(FILES_PENDING).toString()) : null; Long bytesPending = innerMap.containsKey(BYTES_PENDING) ? parseExceptionSafeLong(innerMap.get(BYTES_PENDING).toString()) : null; Long deletesPending = innerMap.containsKey(DELETES_PENDING) ? parseExceptionSafeLong(innerMap.get(DELETES_PENDING).toString()) : null; Long filesSkipped = innerMap.containsKey(FILES_SKIPPED) ? parseExceptionSafeLong(innerMap.get(FILES_SKIPPED).toString()) : null; details.setFilesPending(filesPending); details.setFilesSkipped(filesSkipped); details.setFilesSynced(filesSynced); details.setBytesPending(bytesPending); details.setDeletesPending(deletesPending); } geoRepDetails.add(details); return details; }
Source:
<code>public void deleteTiffHeaderFile(List<Process> processes) { for (Process process : processes) { try { File tiffHeaderFile = new File( serviceManager.getFileService().getImagesDirectory(process) + "tiffwriter.conf"); if (tiffHeaderFile.exists()) { tiffHeaderFile.delete(); } Helper.setMeldung(KITODO_SCRIPT_FIELD, "TiffHeaderFile deleted: ", process.getTitle()); } catch (Exception e) { <START> logger.error(e.getMessage(), e); <END> Helper.setFehlerMeldung(KITODO_SCRIPT_FIELD, "Error while deleting TiffHeader", e); } } Helper.setMeldung(KITODO_SCRIPT_FIELD, "", "deleteTiffHeaderFile finished"); }</code><technical_language>Please replace this log call Helper.setFehlermeldung Helper.setErrorMessage bundles calls</technical_language>

Target:
public void deleteTiffHeaderFile(List<Process> processes) { for (Process process : processes) { try { File tiffHeaderFile = new File( serviceManager.getFileService().getImagesDirectory(process) + "tiffwriter.conf"); if (tiffHeaderFile.exists()) { tiffHeaderFile.delete(); } Helper.setMeldung(KITODO_SCRIPT_FIELD, "TiffHeaderFile deleted: ", process.getTitle()); } catch (RuntimeException e) { Helper.setErrorMessage(KITODO_SCRIPT_FIELD, "Error while deleting TiffHeader", logger, e); } } Helper.setMeldung(KITODO_SCRIPT_FIELD, "", "deleteTiffHeaderFile finished"); }
Source:
<code><START> public void setPWMDutyCycle(IOLine ioLine, double dutyCycle) throws InvalidOperatingModeException, XBeeException { <END> if (!connectionInterface.isOpen()) throw new XBeeException(XBeeException.CONNECTION_NOT_OPEN); if (ioLine == null) throw new NullPointerException("IO line cannot be null."); if (!ioLine.hasPWMCapability()) throw new IllegalArgumentException("Provided IO line does not have PWM capability."); if (dutyCycle < 0 || dutyCycle > 100) throw new IllegalArgumentException("Duty Cycle must be between 0% and 100%."); int finaldutyCycle = (int)(dutyCycle * 1023.0/100.0); String atCommand = ioLine.getPWMATCommand(); ATCommandResponse response = sendATCommand(new ATCommand(atCommand, ByteUtils.intToByteArray(finaldutyCycle))); if (response == null || response.getResponseStatus() != ATCommandStatus.OK) throw new XBeeException(XBeeException.INVALID_OPERATION); }</code><technical_language>This need revisited throw proper exceptions</technical_language>

Target:
public void setPWMDutyCycle(IOLine ioLine, double dutyCycle) throws InvalidOperatingModeException, XBeeException { if (!connectionInterface.isOpen()) throw new XBeeException(XBeeException.CONNECTION_NOT_OPEN); if (ioLine == null) throw new NullPointerException("IO line cannot be null."); if (!ioLine.hasPWMCapability()) throw new IllegalArgumentException("Provided IO line does not have PWM capability."); if (dutyCycle < 0 || dutyCycle > 100) throw new IllegalArgumentException("Duty Cycle must be between 0% and 100%."); int finaldutyCycle = (int)(dutyCycle * 1023.0/100.0); String atCommand = ioLine.getPWMDutyCycleATCommand(); ATCommandResponse response = sendATCommand(new ATCommand(atCommand, ByteUtils.intToByteArray(finaldutyCycle))); if (response == null || response.getResponseStatus() != ATCommandStatus.OK) throw new XBeeException(XBeeException.INVALID_OPERATION); }
Source:
<code>public static Set<Path> getIncludedFieldsOfRootEntityForSort(CompositeMetadata root, Sort rootSort) { <START> Set<Path> ret=new HashSet<Path>(); <END> if(rootSort!=null) { SortFieldInfo[] sfi=SortFieldInfo.buildSortFields(rootSort,root.getFieldTreeRoot()); for(SortFieldInfo fi:sfi) ret.add(fi.getName()); } return ret; }</code><technical_language>necessarily need type info in right hand assignment anymore. mention ways throughout</technical_language>

Target:
public static Set<Path> getIncludedFieldsOfRootEntityForSort(CompositeMetadata root, Sort rootSort) { Set<Path> ret=new HashSet<>(); if(rootSort!=null) { SortFieldInfo[] sfi=SortFieldInfo.buildSortFields(rootSort,root.getFieldTreeRoot()); for(SortFieldInfo fi:sfi) ret.add(fi.getName()); } return ret; }
Source:
<code>private void logReceivedMessages(final List<BasicMessage> receivedMessages) { if (isLogReceivedMessages()) { for (final BasicMessage message : receivedMessages) { try { <START> LOGGER.debug("MSG-RECV [{}]", message.getClass().getSimpleName(), message.getBody()); <END> } catch (final MessageParseException e) { LOGGER.debug("MSG-RECV [{}]", e.getMessage()); } } } }</code><technical_language>BasicMessages type property, empty string for logging message type (the parameter in this method call)</technical_language>

Target:
private void logReceivedMessages(final List<BasicMessage> receivedMessages) { if (isLogReceivedMessages()) { for (final BasicMessage message : receivedMessages) { try { LOGGER.debug("MSG-RECV [{}]", "", message.getBody()); } catch (final MessageParseException e) { LOGGER.debug("MSG-RECV [{}]", e.getMessage()); } } } }
Source:
<code><START> public long getLockTimeout() { <END> Setting setting = findSetting( SetTypes.getTypeName(SetTypes.DEFAULT_LOCK_TIMEOUT)); return setting == null ? Constants.INITIAL_LOCK_TIMEOUT : setting.getIntValue(); }</code><technical_language>this return long</technical_language>

Target:
public int getLockTimeout() { Setting setting = findSetting( SetTypes.getTypeName(SetTypes.DEFAULT_LOCK_TIMEOUT)); return setting == null ? Constants.INITIAL_LOCK_TIMEOUT : setting.getIntValue(); }
Source:
<code>private void useAppFor2minThenBackground() throws Exception { <START> advanceSystemAndElapsedTimeBy(time,0); <END> OneSignalInit(); threadAndTaskWait(); advanceSystemAndElapsedTimeBy(time, 2 * 60); blankActivityController.pause(); OneSignalPackagePrivateHelper.runFocusRunnables(); threadAndTaskWait(); }</code><technical_language>Add a space advanceSystemAndElapsedTimeBy(time, 0);</technical_language>

Target:
private void useAppFor2minThenBackground() throws Exception { time.advanceSystemAndElapsedTimeBy(0); OneSignalInit(); threadAndTaskWait(); time.advanceSystemAndElapsedTimeBy(2 * 60); blankActivityController.pause(); OneSignalPackagePrivateHelper.runFocusRunnables(); threadAndTaskWait(); }
Source:
<code>public int getInt(int length, boolean signed) { int val = 0; if (!canRead(length)) { throw new BufferOverflowException(); } if (length > BIT_INT) { throw new IllegalArgumentException("Maximum size of value is 32 requested size" + length); } if (length < 0) { throw new IllegalArgumentException("Cannot handle negative reads"); } <START> if (length == 0) { <END> return 0; } boolean gotIt = false; if (this.pos % BitBuffer.BIT_CHAR == 0) { switch (length) { case BitBuffer.BIT_CHAR: if (signed) { val = this.buf.get((int) (this.pos / 8)); } else { val = (this.buf.get((int) (this.pos / 8))) & 0xff; } gotIt = true; break; case BitBuffer.BIT_SHORT: if (signed) { val = this.buf.getShort((int) (this.pos / 8)); } else { short a = this.buf.getShort((int) (this.pos / 8)); val = a & 0xffff; } gotIt = true; break; case BitBuffer.BIT_INT: val = this.buf.getInt((int) (this.pos / 8)); gotIt = true; break; default: break; } } if (!gotIt) { if (this.byteOrder == ByteOrder.LITTLE_ENDIAN) { val = getIntLE(this.pos, length, signed); } else { val = getIntBE(this.pos, length, signed); } } this.pos += length; return val; }</code><technical_language>This fixed of patch-set? integrated it. Anyway, lengh == 0 can_read. is valid read a struct of zero bits end of a stream. More unittests CTF</technical_language>

Target:
public int getInt(int length, boolean signed) { if (length == 0) { return 0; } if (!canRead(length)) { throw new BufferOverflowException(); } if (length > BIT_INT) { throw new IllegalArgumentException("Maximum size of value is 32 requested size" + length); } if (length < 0) { throw new IllegalArgumentException("Cannot handle negative reads"); } int val = 0; if (!canRead(length)) { throw new BufferOverflowException(); } boolean gotIt = false; if (this.pos % BitBuffer.BIT_CHAR == 0) { switch (length) { case BitBuffer.BIT_CHAR: val = this.buf.get((int) (this.pos / 8)); if (!signed) { val = val & 0xff; } gotIt = true; break; case BitBuffer.BIT_SHORT: val = this.buf.getShort((int) (this.pos / 8)); if (!signed) { val = val & 0xffff; } gotIt = true; break; case BitBuffer.BIT_INT: val = this.buf.getInt((int) (this.pos / 8)); gotIt = true; break; default: break; } } if (!gotIt) { if (this.byteOrder == ByteOrder.LITTLE_ENDIAN) { val = getIntLE(this.pos, length, signed); } else { val = getIntBE(this.pos, length, signed); } } this.pos += length; return val; }
Source:
<code>public ParallelExecutor(ConfigurationParameters parameters) { ConfigurationParameters prefixedParameters = new PrefixedConfigurationParameters(parameters, PARALLEL_CONFIG); String strategyName = prefixedParameters.get("strategy").orElse("dynamic"); ParallelExecutionConfigurationStrategy executionStrategy = DefaultParallelExecutionConfigurationStrategy.valueOf( strategyName.toUpperCase()); ParallelExecutionConfiguration executionConfiguration = executionStrategy.createConfiguration( prefixedParameters); <START> executorService = new ForkJoinPoolFactory().apply(executionConfiguration); <END> }</code><technical_language>suggestion executorService = ForkJoinPoolFactory.create(executionConfiguration);</technical_language>

Target:
public ParallelExecutor(ConfigurationParameters parameters) { ConfigurationParameters prefixedParameters = new PrefixedConfigurationParameters(parameters, PARALLEL_CONFIG); String strategyName = prefixedParameters.get("strategy").orElse("dynamic"); ParallelExecutionConfigurationStrategy executionStrategy = DefaultParallelExecutionConfigurationStrategy.valueOf( strategyName.toUpperCase()); ParallelExecutionConfiguration executionConfiguration = executionStrategy.createConfiguration( prefixedParameters); executorService = ForkJoinPoolFactory.create(executionConfiguration); }
Source:
<code>public HideAttributesWizardPage(AbstractTaskEditorPage page, String listVar) { super("HideAttributes"); <START> setTitle("Hide Attributes"); END> setDescription( "The attributes in the left list will be displayed and the attributes in the right list will be hidden."); TaskData data = page.getModel().getTaskData(); this.attributes = data.getRoot().getAttributes(); this.currentList = listVar; optionAttributes = new ArrayList<>(); chosenAttributes = new ArrayList<>(); }</code><technical_language>Configure Attribute Visibility This externalized</technical_language>

Target:
public HideAttributesWizardPage(AbstractTaskEditorPage page, String listVar) { super("HideAttributes"); setTitle(Messages.HideAttributesWizardPage_ConfigureAttributeVisibility); setDescription(Messages.HideAttributesWizardPage_Description); TaskData data = page.getModel().getTaskData(); this.attributes = data.getRoot().getAttributes(); this.currentList = listVar; optionAttributes = new ArrayList<>(); chosenAttributes = new ArrayList<>(); }
Source:
<code>public LiveData<List<Object>> getBookmarkedSessions() { if (filterableRealmLiveData == null) filterableRealmLiveData = RealmDataRepository.asFilterableLiveData(realmRepo.getSessions()); Predicate<Session> predicate = Session::getIsBookmarked; filterableRealmLiveData.filter(predicate); <START> return Transformations.map(filterableRealmLiveData, this::getSessionsList); <END> }</code><technical_language>Pulling in sessions filtering is inefficuent</technical_language>

Target:
public LiveData<List<Object>> getBookmarkedSessions() { if (filterableRealmLiveData == null) filterableRealmLiveData = RealmDataRepository.asFilterableLiveData(realmRepo.getBookMarkedSessions()); Predicate<Session> predicate = Session::getIsBookmarked; filterableRealmLiveData.filter(predicate); return Transformations.map(filterableRealmLiveData, this::getSessionsList); }
Source:
<code>public List<ServerTemplate> load() { synchronized (store) { return store.values().stream().map(e -> cloneServerTemplate(e)).collect(Collectors.toList()); <START> } <END> }</code><technical_language>I guess longer need store of ConcurrentHashMap implementation if fully locking it</technical_language>

Target:
public List<ServerTemplate> load() { synchronized (store) { return store.values().stream().map(this::cloneServerTemplate).collect(Collectors.toList()); } }
Source:
<code>public static void initializeDefaultPreferences(IEclipsePreferences defaultPreferences) { Preferences prefs= defaultPreferences.node(INDEXER_NODE); prefs.put(KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER); prefs.putBoolean(KEY_INDEX_ALL_FILES, true); prefs.putBoolean(KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, true); <START> prefs.putBoolean(KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG, true); <END> prefs.putBoolean(KEY_INDEX_ON_OPEN, false); prefs.putBoolean(KEY_INCLUDE_HEURISTICS, true); prefs.putInt(KEY_SKIP_FILES_LARGER_THAN_MB, DEFAULT_FILE_SIZE_LIMIT); prefs.putBoolean(KEY_SKIP_ALL_REFERENCES, false); prefs.putBoolean(KEY_SKIP_IMPLICIT_REFERENCES, false); prefs.putBoolean(KEY_SKIP_TYPE_REFERENCES, false); prefs.putBoolean(KEY_SKIP_MACRO_REFERENCES, false); prefs.put(KEY_INDEX_IMPORT_LOCATION, DEFAULT_INDEX_IMPORT_LOCATION); }</code><technical_language>This setting enabled default headers C++-specific protected #ifdef __cplusplus</technical_language>

Target:
public static void initializeDefaultPreferences(IEclipsePreferences defaultPreferences) { Preferences prefs= defaultPreferences.node(INDEXER_NODE); prefs.put(KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER); prefs.putBoolean(KEY_INDEX_ALL_FILES, true); prefs.putBoolean(KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, true); prefs.putBoolean(KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG, false); prefs.putBoolean(KEY_INDEX_ON_OPEN, false); prefs.putBoolean(KEY_INCLUDE_HEURISTICS, true); prefs.putInt(KEY_SKIP_FILES_LARGER_THAN_MB, DEFAULT_FILE_SIZE_LIMIT); prefs.putBoolean(KEY_SKIP_ALL_REFERENCES, false); prefs.putBoolean(KEY_SKIP_IMPLICIT_REFERENCES, false); prefs.putBoolean(KEY_SKIP_TYPE_REFERENCES, false); prefs.putBoolean(KEY_SKIP_MACRO_REFERENCES, false); prefs.put(KEY_INDEX_IMPORT_LOCATION, DEFAULT_INDEX_IMPORT_LOCATION); }
Source:
<code>public DefaultEquivalenceResultBuilder( ScoreCombiner<T> combiner, EquivalenceFilter<T> filter, List<EquivalenceExtractor<T>> extractors ) { this.combiner = combiner; this.filter = filter; this.extractors = extractors; <START> this.multipleCandidateExtractor = MultipleCandidateExtractor.create(); <END> }</code><technical_language>longer used! rip this field out</technical_language>

Target:
public DefaultEquivalenceResultBuilder( ScoreCombiner<T> combiner, EquivalenceFilter<T> filter, List<EquivalenceExtractor<T>> extractors ) { this.combiner = combiner; this.filter = filter; this.extractors = extractors; }
Source:
<code>public void shouldConvertToAvroWhenReceivedJSONOnAvroTopic() throws IOException { <START> AvroMessage message = new AvroMessage("1", avroMessage.asJson().getBytes(), 1234, schema); <END> Message enforcedMessage = enforcer.enforceAvro("application/json", message); assertThat(enforcedMessage.getData()).isEqualTo(avroMessage.asBytes()); }</code><technical_language>fact AvroMessage contains json bytes is super confusing</technical_language>

Target:
public void shouldConvertToAvroWhenReceivedJSONOnAvroTopic() throws IOException { byte[] enforcedMessage = enforcer.enforceAvro("application/json", avroMessage.asJson().getBytes(), schema.getSchema()); assertThat(enforcedMessage).isEqualTo(avroMessage.asBytes()); }
Source:
<code>public boolean containsValue(final TransactionLocal transactionLocal, final Transaction transaction) { com.arjuna.ats.jta.transaction.Transaction transactionImple = (com.arjuna.ats.jta.transaction.Transaction) transaction; if(transactionImple.isAlive()) { <START> return (transactionImple.getTxLocalResource(transactionLocal) != null); <END> } else { return false; } }</code><technical_language>this do listeners :) (maybe split a separate commit if absolutely must)</technical_language>

Target:
public boolean containsValue(final TransactionLocal transactionLocal, final Transaction transaction) { com.arjuna.ats.jta.transaction.Transaction transactionImple = (com.arjuna.ats.jta.transaction.Transaction) transaction; if(transactionImple.isAlive()) { return (transactionImple.getTxLocalResource(transactionLocal) != null ? true : false); } else { return false; } }
Source:
<code><START> private void setNetInterfaceAddressConfigs(String interfaceName, boolean dhcp, List<NetConfig> netConfigs, <END> NetInterfaceAddressConfig netInterfaceAddressConfig) { if (netInterfaceAddressConfig instanceof NetInterfaceAddressConfigImpl) { ((NetInterfaceAddressConfigImpl) netInterfaceAddressConfig).setNetConfigs(netConfigs); if (dhcp) { List<? extends IPAddress> dhcpRouters = getDhcpRouters(interfaceName, netInterfaceAddressConfig.getAddress()); if (!dhcpRouters.isEmpty()) { ((NetInterfaceAddressConfigImpl) netInterfaceAddressConfig).setGateway(dhcpRouters.get(0)); } List<? extends IPAddress> dhcpDnsServers = getDhcpDnsServers(interfaceName, netInterfaceAddressConfig.getAddress()); if (!dhcpDnsServers.isEmpty()) { ((NetInterfaceAddressConfigImpl) netInterfaceAddressConfig).setDnsServers(dhcpDnsServers); } } } else if (netInterfaceAddressConfig instanceof WifiInterfaceAddressConfigImpl) { ((WifiInterfaceAddressConfigImpl) netInterfaceAddressConfig).setNetConfigs(netConfigs); if (dhcp) { List<? extends IPAddress> dhcpRouters = getDhcpRouters(interfaceName, netInterfaceAddressConfig.getAddress()); if (!dhcpRouters.isEmpty()) { ((WifiInterfaceAddressConfigImpl) netInterfaceAddressConfig).setGateway(dhcpRouters.get(0)); } List<? extends IPAddress> dhcpDnsServers = getDhcpDnsServers(interfaceName, netInterfaceAddressConfig.getAddress()); if (!dhcpDnsServers.isEmpty()) { ((WifiInterfaceAddressConfigImpl) netInterfaceAddressConfig).setDnsServers(dhcpDnsServers); } } } }</code><technical_language>Is extract methods branches of condition simplify code</technical_language>

Target:
private void setNetInterfaceAddressConfigs(String interfaceName, boolean dhcp, List<NetConfig> netConfigs, NetInterfaceAddressConfig netInterfaceAddressConfig) { if (netInterfaceAddressConfig instanceof NetInterfaceAddressConfigImpl) { setNetInterfaceAddressConfigs(interfaceName, netConfigs, netInterfaceAddressConfig, dhcp); } else if (netInterfaceAddressConfig instanceof WifiInterfaceAddressConfigImpl) { setWifiNetInterfaceAddressConfigs(interfaceName, netConfigs, netInterfaceAddressConfig, dhcp); } }
Source:
<code>public void setTerminator(String terminator) { if (terminator.length() != 1 || !StatementFinder.isValidTerminator(terminator.charAt(0))) { out.println(langUtil.getTextMessage("IJ_TerminatorInvalid", terminator)); } <START> this.terminator = terminator.charAt(0); <END> commandGrabber[currCE].setTerminator(this.terminator); }</code><technical_language>return missing</technical_language>

Target:
public void setTerminator(String terminator) { if (terminator.length() != 1 || !StatementFinder.isValidTerminator(terminator.charAt(0))) { out.println(langUtil.getTextMessage("IJ_TerminatorInvalid", terminator)); return; } this.terminator = terminator.charAt(0); commandGrabber[currCE].setTerminator(this.terminator); }
Source:
<code>public Date getCreationDate() { <START> return creationDate; <END> }</code><technical_language>return creationDate.clone Date is mutable</technical_language>

Target:
public Date getCreationDate() { return (Date) creationDate.clone(); }
Source:
<code>public boolean configure(StaplerRequest req, JSONObject json) throws FormException { BulkChange b = new BulkChange(this); SMTPAuthentication current = this.authentication; try { this.authentication = null; req.bindJSON(this, json); b.commit(); } catch (IOException e) { <START> this.authentication = current; <END> b.abort(); throw new FormException("Failed to apply configuration", e, null); } return true; }</code><technical_language>in finally in case</technical_language>

Target:
public boolean configure(StaplerRequest req, JSONObject json) throws FormException { BulkChange b = new BulkChange(this); SMTPAuthentication current = this.authentication; try { this.authentication = null; req.bindJSON(this, json); b.commit(); } catch (IOException e) { b.abort(); throw new FormException("Failed to apply configuration", e, null); } finally { this.authentication = current; } return true; }
Source:
<code>private ReconnectionManager(AbstractXMPPConnection connection) { weakRefConnection = new WeakReference<AbstractXMPPConnection>(connection); reconnectionRunnable = new Thread() { private int attempts = 0; private int timeDelay() { attempts++; <START> int delay = -1; <END> switch(reconnectionPolicy) { case FIXED_DELAY: delay = fixedDelay; break; case RANDOM_INCREASING_DELAY: if (attempts > 13) { delay = randomBase * 6 * 5; } if (attempts > 7) { delay = randomBase * 6; } delay = randomBase; break; } return delay; } public void run() { final AbstractXMPPConnection connection = weakRefConnection.get(); if (connection == null) { return; } while (isReconnectionPossible(connection)) { int remainingSeconds = timeDelay(); while (isReconnectionPossible(connection) && remainingSeconds > 0) { try { Thread.sleep(1000); remainingSeconds--; for (ConnectionListener listener : connection.connectionListeners) { listener.reconnectingIn(remainingSeconds); } } catch (InterruptedException e) { LOGGER.log(Level.FINE, "waiting for reconnection interrupted", e); break; } } for (ConnectionListener listener : connection.connectionListeners) { listener.reconnectingIn(0); } try { if (isReconnectionPossible(connection)) { connection.connect(); } } catch (Exception e) { for (ConnectionListener listener : connection.connectionListeners) { listener.reconnectionFailed(e); } } } } }; if (getEnabledByDefault()) { enableAutomaticReconnection(); } }</code><technical_language>this need initialized</technical_language>

Target:
private ReconnectionManager(AbstractXMPPConnection connection) { weakRefConnection = new WeakReference<AbstractXMPPConnection>(connection); reconnectionRunnable = new Thread() { private int attempts = 0; private int timeDelay() { attempts++; int delay; switch(reconnectionPolicy) { case FIXED_DELAY: delay = fixedDelay; break; case RANDOM_INCREASING_DELAY: if (attempts > 13) { delay = randomBase * 6 * 5; } if (attempts > 7) { delay = randomBase * 6; } delay = randomBase; break; default: throw new AssertionError("Unknown reconnection policy " + reconnectionPolicy); } return delay; } public void run() { final AbstractXMPPConnection connection = weakRefConnection.get(); if (connection == null) { return; } while (isReconnectionPossible(connection)) { int remainingSeconds = timeDelay(); while (isReconnectionPossible(connection) && remainingSeconds > 0) { try { Thread.sleep(1000); remainingSeconds--; for (ConnectionListener listener : connection.connectionListeners) { listener.reconnectingIn(remainingSeconds); } } catch (InterruptedException e) { LOGGER.log(Level.FINE, "waiting for reconnection interrupted", e); break; } } for (ConnectionListener listener : connection.connectionListeners) { listener.reconnectingIn(0); } try { if (isReconnectionPossible(connection)) { connection.connect(); } } catch (Exception e) { for (ConnectionListener listener : connection.connectionListeners) { listener.reconnectionFailed(e); } } } } }; if (getEnabledPerDefault()) { enableAutomaticReconnection(); } }
Source:
<code>public BehaviorState modify(Actor oreon, BehaviorState result) { TaskComponent oreonTaskComponent = oreon.getComponent(TaskComponent.class); EntityRef building = entityManager.getEntity(oreonTaskComponent.task.requiredBuildingEntityID); ConstructedBuildingComponent buildingComponent = building.getComponent(ConstructedBuildingComponent.class); int minX = Integer.MAX_VALUE; int maxX = Integer.MIN_VALUE; int minZ = Integer.MAX_VALUE; int maxZ = Integer.MIN_VALUE; int y = oreonTaskComponent.taskRegion.minY(); <START> for (BlockRegion region : buildingComponent.boundingRegions) { <END> minX = Math.min(minX, region.minX()); maxX = Math.max(maxX, region.maxX()); minZ = Math.min(minZ, region.minZ()); maxZ = Math.max(maxZ, region.maxZ()); } Vector3i min = new Vector3i(minX - 1, y, minZ - 1); Vector3i max = new Vector3i(maxX + 1, y, maxZ + 1); oreonTaskComponent.taskRegion = new BlockRegion(min, max); oreon.save(oreonTaskComponent); if (oreonTaskComponent.taskCompletionTime < time.getGameTime()) { return BehaviorState.SUCCESS; } setTargetToNearbyBoundaryBlock(oreon, oreonTaskComponent); return BehaviorState.RUNNING; }</code><technical_language>this is computing union, I simplify this code</technical_language>

Target:
public BehaviorState modify(Actor oreon, BehaviorState result) { TaskComponent oreonTaskComponent = oreon.getComponent(TaskComponent.class); EntityRef building = entityManager.getEntity(oreonTaskComponent.task.requiredBuildingEntityID); ConstructedBuildingComponent buildingComponent = building.getComponent(ConstructedBuildingComponent.class); int y = oreonTaskComponent.taskRegion.minY(); final BlockRegion taskRegion = buildingComponent.boundingRegions.stream() .reduce(new BlockRegion(BlockRegion.INVALID), BlockRegion::union, BlockRegion::union) .minY(y).maxY(y) .addToMin(-1, 0, -1) .addToMax(1, 0, 1); oreonTaskComponent.taskRegion = taskRegion; oreon.save(oreonTaskComponent); if (oreonTaskComponent.taskCompletionTime < time.getGameTime()) { return BehaviorState.SUCCESS; } setTargetToNearbyBoundaryBlock(oreon, oreonTaskComponent); return BehaviorState.RUNNING; }
Source:
<code>private void logTransactionDetails(CorporateBilledCorporatePaidTransactionDetail transactionDetail) { if (LOG.isDebugEnabled()) { StringBuilder sb = new StringBuilder("logTransactionDetails, "); if (ObjectUtils.isNotNull(transactionDetail)) { sb.append("ProcurementCardTransactionDetail: "); <START> sb.append("document number = ").append(transactionDetail.getDocumentNumber()); <END> sb.append(" transaction reference number - ").append(transactionDetail.getTransactionReferenceNumber()); sb.append(" financial line number - ").append(transactionDetail.getFinancialDocumentTransactionLineNumber()); sb.append(" Source Lines - "); logAccountingLineBaseList(transactionDetail.getSourceAccountingLines(), sb); sb.append(" Target lines - "); logAccountingLineBaseList(transactionDetail.getTargetAccountingLines(), sb); } else { sb.append("transaction detail is NULL"); } LOG.debug(sb.toString()); } }</code><technical_language>I suggest changing "=" a "-" for consistency rest of log message below</technical_language>

Target:
private void logTransactionDetails(CorporateBilledCorporatePaidTransactionDetail transactionDetail) { if (LOG.isDebugEnabled()) { StringBuilder sb = new StringBuilder("logTransactionDetails, "); if (ObjectUtils.isNotNull(transactionDetail)) { sb.append("ProcurementCardTransactionDetail: "); sb.append("document number - ").append(transactionDetail.getDocumentNumber()); sb.append(" transaction reference number - ").append(transactionDetail.getTransactionReferenceNumber()); sb.append(" financial line number - ").append(transactionDetail.getFinancialDocumentTransactionLineNumber()); sb.append(" Source Lines - "); logAccountingLineBaseList(transactionDetail.getSourceAccountingLines(), sb); sb.append(" Target lines - "); logAccountingLineBaseList(transactionDetail.getTargetAccountingLines(), sb); } else { sb.append("transaction detail is NULL"); } LOG.debug(sb.toString()); } }
Source:
<code>public void testViolationsByGoogleAndXpathSuppressions(@SysErr Capturable systemErr, @SysOut Capturable systemOut) throws Exception { System.setProperty("org.checkstyle.google.suppressionxpathfilter.config", "src/test/resources/com/puppycrawl/tools/checkstyle/main/" <START> + "InputMainViolationsForGoogleXpathSuppressions.xml"); <END> Main.main("-c", "/google_checks.xml", getPath("InputMainViolationsForGoogle.java")); assertThat("Unexpected output log", systemOut.getCapturedData(), is(noViolationsOutput)); assertThat("Unexpected system error log", systemErr.getCapturedData(), is("")); }</code><technical_language>getPath instead</technical_language>

Target:
public void testViolationsByGoogleAndXpathSuppressions(@SysErr Capturable systemErr, @SysOut Capturable systemOut) throws Exception { System.setProperty("org.checkstyle.google.suppressionxpathfilter.config", getPath("InputMainViolationsForGoogleXpathSuppressions.xml")); Main.main("-c", "/google_checks.xml", getPath("InputMainViolationsForGoogle.java")); assertThat("Unexpected output log", systemOut.getCapturedData(), is(noViolationsOutput)); assertThat("Unexpected system error log", systemErr.getCapturedData(), is("")); }
Source:
<code>private void checkPendingAndContinue() { initializeIfRequired(); if (queueFile.size() > 0) { try { peekedBatch = (queueFile.size() == cachedQueue.size()) ? cachedQueue.peek() : queueFile.peek(); if (peekedBatch != null) { callPersistSuccess(peekedBatch); } } catch (IOException e) { <START> e.printStackTrace(); <END> } } else { callQueueEnd(); } }</code><technical_language>do if (log.isErrorEnabled()) { - log.error(e.getLocalizedMessage()); - }</technical_language>

Target:
private void checkPendingAndContinue() { initializeIfRequired(); if (queueFile.size() > 0) { try { peekedBatch = (queueFile.size() == cachedQueue.size()) ? cachedQueue.peek() : queueFile.peek(); if (peekedBatch != null) { callPersistSuccess(peekedBatch); } } catch (IOException e) { if (log.isErrorEnabled()) { log.error(e.getLocalizedMessage()); } } } else { callQueueEnd(); } }
Source:
<code>public CreateServerOptions networks(String... networks) { <START> return networks(ImmutableSet.copyOf(checkNotNull(networks, "network should not be empty"))); <END> }</code><technical_language>"standard" jclouds pattern checkNotNull(networks, "networks"), in this case expected a varargs argument null, empty array instead. If want enforce this check, be: checkArgument(networks.length > 0, "networks empty"); return networks(ImmutableSet.copyOf(networks)); networks(Iterable<String> networks) checks I need check here</technical_language>

Target:
public CreateServerOptions networks(String... networks) { return networks(ImmutableSet.copyOf(networks)); }