auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected boolean canDoAction() { if (getVdsId() == null || getVdsId().equals(Guid.Empty)) { return validate(new ValidationResult(VdcBllMessages.VDS_INVALID_SERVER_ID)); } if (getVds() == null) { return validate(new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_HOST_NOT_EXIST)); } if (isOvirtReInstallOrUpgrade()) { if (getVds().getStatus() == VDSStatus.NonOperational) { return validate(new ValidationResult(VdcBllMessages.VDS_CANNOT_INSTALL_STATUS_ILLEGAL)); } File iso = resolveISO(getParameters().getoVirtIsoFile()); if (iso == null) { return validate(new ValidationResult(VdcBllMessages.VDS_CANNOT_INSTALL_MISSING_IMAGE_FILE)); } RpmVersion ovirtHostOsVersion = VdsHandler.getOvirtHostOsVersion(getVds()); if (!isISOCompatible(iso, ovirtHostOsVersion)) { return validate(new ValidationResult( VdcBllMessages.VDS_CANNOT_UPGRADE_BETWEEN_MAJOR_VERSION, String.format("$IsoVersion %1$s", ovirtHostOsVersion.getMajor()) )); } _iso = iso; } return validate(ValidationResult.VALID); }

Target:
protected boolean canDoAction() { if (getVdsId() == null || getVdsId().equals(Guid.Empty)) { return failCanDoAction(VdcBllMessages.VDS_INVALID_SERVER_ID); } if (getVds() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_HOST_NOT_EXIST); } if (isOvirtReInstallOrUpgrade()) { if (getVds().getStatus() == VDSStatus.NonOperational) { return failCanDoAction(VdcBllMessages.VDS_CANNOT_INSTALL_STATUS_ILLEGAL); } File iso = resolveISO(getParameters().getoVirtIsoFile()); if (iso == null) { return failCanDoAction(VdcBllMessages.VDS_CANNOT_INSTALL_MISSING_IMAGE_FILE); } RpmVersion ovirtHostOsVersion = VdsHandler.getOvirtHostOsVersion(getVds()); if (!isISOCompatible(iso, ovirtHostOsVersion)) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_UPGRADE_BETWEEN_MAJOR_VERSION); addCanDoActionMessage(String.format("$IsoVersion %1$s", ovirtHostOsVersion.getMajor())); return false; } _iso = iso; } return true; }
Source:
public Study getStudy(String identifier) { checkNotNull(identifier); String redisKey = RedisKey.STUDY.getRedisKey(identifier); return getObject(redisKey, Study.class); }

Target:
public Study getStudy(String identifier) { checkNotNull(identifier); String redisKey = RedisKey.STUDY.getRedisKey(identifier); return getObject(redisKey, Study.class, BridgeConstants.BRIDGE_SESSION_EXPIRE_IN_SECONDS); }
Source:
public void setAnnotationLayers(List<AnnotationLayer> aAnnotationLayers) { annotationLayers = unmodifiableList(new ArrayList<>(aAnnotationLayers)); if (!annotationLayers.contains(selectedAnnotationLayer)) { if (!annotationLayers.isEmpty()) { for (AnnotationLayer layer : annotationLayers) { if (layer.getType().equals(WebAnnoConst.SPAN_TYPE)) { selectedAnnotationLayer = layer; break; } } } else { selectedAnnotationLayer = null; } defaultAnnotationLayer = selectedAnnotationLayer; } }

Target:
public void setAnnotationLayers(List<AnnotationLayer> aAnnotationLayers) { annotationLayers = unmodifiableList(new ArrayList<>(aAnnotationLayers)); if (!annotationLayers.contains(selectedAnnotationLayer)) { selectedAnnotationLayer = annotationLayers.stream() .filter(layer -> layer.getType().equals(WebAnnoConst.SPAN_TYPE)) .findFirst() .orElse(null); defaultAnnotationLayer = selectedAnnotationLayer; } }
Source:
public SubnetSelectionResult chooseSubnets(Collection<CloudSubnet> subnetMetas, SubnetSelectionParameters subnetSelectionParameters) { LOGGER.debug("Trying to choose subnets from: {}.", subnetMetas); SubnetSelectionResult subnetSelectionResult = filterSubnets(subnetMetas, subnetSelectionParameters); if (subnetSelectionResult.hasResult()) { LOGGER.debug("There are subnets in the subnet selection: {}.", subnetSelectionResult); if (subnetSelectionParameters.isHa()) { return selectForHAScenario(subnetSelectionResult.getResult()); } else { return selectForNonHAScenario(subnetSelectionResult.getResult()); } } else { LOGGER.debug("There is no result in the subnet selection: {}.", subnetSelectionResult); return subnetSelectionResult; } }

Target:
public SubnetSelectionResult chooseSubnets(Collection<CloudSubnet> subnetMetas, SubnetSelectionParameters subnetSelectionParameters) { LOGGER.debug("Trying to choose subnets from: {}.", subnetMetas); SubnetSelectionResult subnetSelectionResult = filterSubnets(subnetMetas, subnetSelectionParameters); if (subnetSelectionResult.hasResult()) { LOGGER.debug("There are subnets in the subnet selection: {}.", subnetSelectionResult); if (subnetSelectionParameters.isHa()) { subnetSelectionResult = selectForHAScenario(subnetSelectionResult.getResult()); } else { subnetSelectionResult = selectForNonHAScenario(subnetSelectionResult.getResult()); } } LOGGER.info("The subnet selection is: {}.", subnetSelectionResult); return subnetSelectionResult; }
Source:
public void testSimpleStoreFlushFrequencyWithoutCoalescing() throws Exception { initStore(1, false); long writeBehindFlushFrequencyNanos = FLUSH_FREQUENCY * 1000 * 1000; int threshold = store.getWriteBehindStoreBatchSize() / 10; try { long start = System.nanoTime(); for (int i =0; i < threshold / 2; i++) store.write(new CacheEntryImpl<>(i, "v" + i)); U.sleep(FLUSH_FREQUENCY + 300); for (int i = threshold / 2; i < threshold; i++) store.write(new CacheEntryImpl<>(i, "v" + i)); long elapsed = System.nanoTime() - start; U.sleep(FLUSH_FREQUENCY + 300); int expectedFlushOps = (int)(1 + elapsed / writeBehindFlushFrequencyNanos); assertTrue(delegate.getPutAllCount() <= expectedFlushOps); } finally { shutdownStore(); } }

Target:
public void testSimpleStoreFlushFrequencyWithoutCoalescing() throws Exception { initStore(1, false); long writeBehindFlushFreqNanos = FLUSH_FREQUENCY * 1000 * 1000; int threshold = store.getWriteBehindStoreBatchSize() / 10; try { long start = System.nanoTime(); for (int i = 0; i < threshold / 2; i++) store.write(new CacheEntryImpl<>(i, "v" + i)); U.sleep(FLUSH_FREQUENCY + 300); for (int i = threshold / 2; i < threshold; i++) store.write(new CacheEntryImpl<>(i, "v" + i)); long elapsed = System.nanoTime() - start; U.sleep(FLUSH_FREQUENCY + 300); int expFlushOps = (int)(1 + elapsed / writeBehindFlushFreqNanos); assertTrue(delegate.getPutAllCount() <= expFlushOps); } finally { shutdownStore(); } }
Source:
public ChangeDetail call() throws OrmException, NoSuchEntityException, IllegalStateException, InvalidChangeOperationException, PatchSetInfoNotAvailableException, NoSuchChangeException { final ReviewResult result = submitFactory.create(patchSetId).call(); if (result.getErrors().size() > 0) { throw new IllegalStateException("Cannot submit " + result.getErrors().get(0)); } return changeDetailFactory.create(result.getChangeId()).call(); }

Target:
public ChangeDetail call() throws OrmException, NoSuchEntityException, IllegalStateException, InvalidChangeOperationException, PatchSetInfoNotAvailableException, NoSuchChangeException { final ReviewResult result = submitFactory.create(patchSetId).call(); if (result.getErrors().size() > 0) { throw new IllegalStateException( "Cannot submit " + result.getErrors().get(0).getMessageOrType()); } return changeDetailFactory.create(result.getChangeId()).call(); }
Source:
private void enforceMinReportingInterval(TreeSet<Data> orderedData) { Data prev = null; for (Iterator<Data> i = orderedData.iterator(); i.hasNext();) { Data d = i.next(); if (null == prev || !(prev.getId().equals(d.getId()) && prev.getTenantId().equals(d.getTenantId()))) { prev = d; } else { if ((d.getTimestamp() - prev.getTimestamp()) < minReportingInterval) { i.remove(); } } } }

Target:
private void enforceMinReportingInterval(TreeSet<Data> orderedData) { int beforeSize = orderedData.size(); Data prev = null; for (Iterator<Data> i = orderedData.iterator(); i.hasNext();) { Data d = i.next(); if (!d.same(prev)) { prev = d; } else { if ((d.getTimestamp() - prev.getTimestamp()) < minReportingInterval) { log.tracef("MinReportingInterval violation, prev: %s, removed: %s", prev, d); i.remove(); } } } if (log.isDebugEnabled() && beforeSize != orderedData.size()) { log.debugf("MinReportingInterval Data violations: [%d]", beforeSize - orderedData.size()); } }
Source:
private static MethodHandle reorderArguments(Method method, MethodHandle handle, String[] argumentNames) { if (method.isAnnotationPresent(GoloFunction.class)) { String[] parameterNames = method.getAnnotation(GoloFunction.class).parameters(); int[] argumentsOrder = new int[parameterNames.length]; for (int i = 0; i < argumentNames.length; i++) { int actualPosition = -1; for (int j = 0; j < parameterNames.length; j++) { if (parameterNames[j].equals(argumentNames[i])) { actualPosition = j; } } if (actualPosition == -1) { throw new IllegalArgumentException("Argument name " + argumentNames[i] + " not in parameter names used in declaration: " + method.getName() + Arrays.toString(parameterNames)); } argumentsOrder[actualPosition] = i; } return permuteArguments(handle, handle.type(), argumentsOrder); } return handle; }

Target:
public static MethodHandle reorderArguments(Method method, MethodHandle handle, String[] argumentNames) { if (Arrays.stream(method.getParameters()).allMatch(p -> p.isNamePresent())) { String[] parameterNames = Arrays.stream(method.getParameters()).map(Parameter::getName).toArray(String[]::new); int[] argumentsOrder = new int[parameterNames.length]; for (int i = 0; i < argumentNames.length; i++) { int actualPosition = -1; for (int j = 0; j < parameterNames.length; j++) { if (parameterNames[j].equals(argumentNames[i])) { actualPosition = j; } } if (actualPosition == -1) { throw new IllegalArgumentException("Argument name " + argumentNames[i] + " not in parameter names used in declaration: " + method.getName() + Arrays.toString(parameterNames)); } argumentsOrder[actualPosition] = i; } return permuteArguments(handle, handle.type(), argumentsOrder); } return handle; }
Source:
protected void internalReceiveCommand(String itemName, Command command) { for (EdimaxBindingProvider provider : providers) { EdimaxBindingConfiguration config = ((EdimaxGenericBindingProvider) provider) .getConfig(itemName); String deviceIP = getDeviceIP(config.getMacAddress()); if (deviceIP == null) { logger.debug("No real device for item: " + itemName + " found."); continue; } changeValue(itemName, deviceIP, config, command); break; } }

Target:
protected void internalReceiveCommand(String itemName, Command command) { for (EdimaxBindingProvider provider : providers) { EdimaxBindingConfiguration config = ((EdimaxGenericBindingProvider) provider).getConfig(itemName); String deviceIP = getDeviceIP(config.getMacAddress()); if (deviceIP == null) { logger.debug("No real device for item: found.", itemName); continue; } changeValue(itemName, deviceIP, config, command); break; } }
Source:
private DbParameterAccessor[] getAccessors( Parse headerCells) throws SQLException{ String givenParams = ""; Parse headerCellsAux = headerCells; if (headerCells == null) return EMPTY; DbParameterAccessor accessors[]=new DbParameterAccessor[headerCells.size()]; for (int k = 0; headerCellsAux != null; k++, headerCellsAux = headerCellsAux.more) { if (! isOutput(headerCellsAux.text())) { if (k == 0) { givenParams += "'" + headerCellsAux.text() + "'"; } else { givenParams += ", " + "'" + headerCellsAux.text() + "'"; } } } for (int i = 0; headerCells != null; i++, headerCells = headerCells.more) { String name=headerCells.text(); accessors[i]=dbObject.getDbParameterAccessor(name, isOutput(name)? OUTPUT:INPUT, givenParams); if (accessors[i]==null) { exception (headerCells,new IllegalArgumentException("Parameter/column "+name+" not found")); return null; } } return accessors; }

Target:
private DbParameterAccessor[] getAccessors(Parse headerCells) throws SQLException { String givenParams = ""; Parse headerCellsAux = headerCells; if (headerCells == null) return EMPTY; DbParameterAccessor accessors[] = new DbParameterAccessor[headerCells .size()]; for (int k = 0; headerCellsAux != null; k++, headerCellsAux = headerCellsAux.more) { if (k == 0) { if (headerCellsAux.text() == "?") { givenParams += "NVL('" + headerCellsAux.text() + "', 'RETURN_NAME')"; } else { givenParams += "upper('" + headerCellsAux.text() + "')"; } } else { givenParams += ", " + "upper('" + headerCellsAux.text() + "')"; } } givenParams = givenParams.replace("?", ""); for (int i = 0; headerCells != null; i++, headerCells = headerCells.more) { String name = headerCells.text(); accessors[i] = dbObject.getDbParameterAccessor(name, isOutput(name) ? OUTPUT : INPUT, givenParams); if (accessors[i] == null) { exception(headerCells, new IllegalArgumentException( "Parameter/column " + name + " not found")); return null; } } return accessors; }
Source:
public Schema getDefaultSchema(FormatContext context) throws IOException { final String format = getProperties().getProperties().getOrDefault(FORMAT, "delimited"); String delimiter = getProperties().getProperties().get(DELIMITER); if (format.equals("delimited") && Strings.isNullOrEmpty(delimiter)) { throw new IllegalArgumentException("Delimiter is required when format is set to 'delimited'"); } List<Schema.Field> fields = new ArrayList<>(); String path = getProperties().getProperties().getOrDefault( "path", "" ); Job job = JobUtils.createInstance(); Configuration conf = job.getConfiguration(); final Path file = getFilePathForSchemaGeneration(path, format.equals("delimited") ? null : format, conf); final FileSystem fileSystem = FileSystem.get(file.toUri(), conf); FSDataInputStream input = fileSystem.open(file); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(input)); String line = bufferedReader.readLine(); if (line == null) { return null; } bufferedReader.close(); String[] columns = line.split(getDefaultDelimiter()); int count = 1; for (String column : columns) { if (getSkipHeader()) { fields.add(Schema.Field.of(column, Schema.of(Schema.Type.STRING))); continue; } fields.add( Schema.Field.of( String.format("%s_%s", "body", count), Schema.of(Schema.Type.STRING) ) ); count++; } return Schema.recordOf("text", fields); }

Target:
public Schema getDefaultSchema(FormatContext context) throws IOException { final String format = getProperties().getProperties().getOrDefault(FORMAT, "delimited"); String delimiter = getProperties().getProperties().get(DELIMITER); if (format.equals("delimited") && Strings.isNullOrEmpty(delimiter)) { throw new IllegalArgumentException("Delimiter is required when format is set to 'delimited'."); } List<Schema.Field> fields = new ArrayList<>(); String path = getProperties().getProperties().getOrDefault( "path", "" ); Job job = JobUtils.createInstance(); Configuration conf = job.getConfiguration(); for (Map.Entry<String, String> entry : getFileSystemProperties().entrySet()) { conf.set(entry.getKey(), entry.getValue()); } FSDataInputStream input = null; BufferedReader bufferedReader = null; String line = null; try { final Path file = getFilePathForSchemaGeneration(path, format.equals("delimited") ? null : format, conf); final FileSystem fileSystem = FileSystem.get(file.toUri(), conf); input = fileSystem.open(file); bufferedReader = new BufferedReader(new InputStreamReader(input)); line = bufferedReader.readLine(); if (line == null) { return null; } } finally { if (bufferedReader != null) { bufferedReader.close(); } if (input != null) { input.close(); } } String[] columns = line.split(getDefaultDelimiter()); int count = 1; for (String column : columns) { if (getSkipHeader()) { fields.add(Schema.Field.of(column, Schema.of(Schema.Type.STRING))); continue; } fields.add( Schema.Field.of( String.format("%s_%s", "body", count), Schema.of(Schema.Type.STRING) ) ); count++; } return Schema.recordOf("text", fields); }
Source:
public void setTimer(final String version, final long timeout, final Stat currentStatOfBarrierDone) { debounceTimer.scheduleAfterDebounceTime("VersionUpgradeTimeout", timeout, ()->timerOff(version, currentStatOfBarrierDone)); }

Target:
private void setTimer(final String version, final long timeout, final Stat currentStatOfBarrierDone) { debounceTimer.scheduleAfterDebounceTime(VERSION_UPGRADE_TIMEOUT_TIMER, timeout, ()->timerOff(version, currentStatOfBarrierDone)); }
Source:
public AuditReplayCommand parse(Text inputLine, Function<Long, Long> relativeToAbsolute) throws IOException { Matcher m = logLineParseRegex.matcher(inputLine.toString()); if (!m.find()) { throw new IOException( "Unable to find valid message pattern from audit log line: `" + inputLine + "` using regex `" + logLineParseRegex + "`"); } long relativeTimestamp; try { relativeTimestamp = dateFormat.parse(m.group("timestamp")).getTime() - startTimestamp; } catch (ParseException p) { throw new IOException( "Exception while parsing timestamp from audit log line: `" + inputLine, p); } String auditMessageSanitized = m.group("message").replace("(options=", "(options:"); Map<String, String> parameterMap = new HashMap<String, String>(); String[] auditMessageSanitizedList = auditMessageSanitized.split("\t"); for (String auditMessage : auditMessageSanitizedList) { String[] splitMessage = auditMessage.split("=", 2); try { parameterMap.put(splitMessage[0], splitMessage[1]); } catch (ArrayIndexOutOfBoundsException e) { throw new IOException( "Exception while parsing a message from audit log line: " + inputLine, e); } } return new AuditReplayCommand(relativeToAbsolute.apply(relativeTimestamp), SPACE_SPLITTER.split(parameterMap.get("ugi")).iterator().next(), parameterMap.get("cmd").replace("(options:", "(options="), parameterMap.get("src"), parameterMap.get("dst"), parameterMap.get("ip")); }

Target:
public AuditReplayCommand parse(Text inputLine, Function<Long, Long> relativeToAbsolute) throws IOException { Matcher m = logLineParseRegex.matcher(inputLine.toString()); if (!m.find()) { throw new IOException( "Unable to find valid message pattern from audit log line: `" + inputLine + "` using regex `" + logLineParseRegex + "`"); } long relativeTimestamp; try { relativeTimestamp = dateFormat.parse(m.group("timestamp")).getTime() - startTimestamp; } catch (ParseException p) { throw new IOException( "Exception while parsing timestamp from audit log line: `" + inputLine + "`", p); } String auditMessageSanitized = m.group("message").replace("(options=", "(options:"); Map<String, String> parameterMap = new HashMap<String, String>(); String[] auditMessageSanitizedList = auditMessageSanitized.split("\t"); for (String auditMessage : auditMessageSanitizedList) { String[] splitMessage = auditMessage.split("=", 2); try { parameterMap.put(splitMessage[0], splitMessage[1]); } catch (ArrayIndexOutOfBoundsException e) { throw new IOException( "Exception while parsing a message from audit log line: `" + inputLine + "`", e); } } return new AuditReplayCommand(relativeToAbsolute.apply(relativeTimestamp), SPACE_SPLITTER.split(parameterMap.get("ugi")).iterator().next(), parameterMap.get("cmd").replace("(options:", "(options="), parameterMap.get("src"), parameterMap.get("dst"), parameterMap.get("ip")); }
Source:
public boolean hasManagedResource(final CIString orgId) { final int orgObjectId = jdbcTemplate.queryForObject( "select object_id from organisation where organisation = ?", new Object[] { orgId }, Integer.class ); return executeStreaming( jdbcTemplate, "select l.object " + "from last l inner join org o on l.object_id = o.object_id " + "where o.org_id = ? " + "and o.object_type in (?, ?, ?) " + "and l.sequence_id > 0", pstmt -> { pstmt.setInt(1, orgObjectId); pstmt.setInt(2, ObjectTypeIds.getId(ObjectType.INETNUM)); pstmt.setInt(3, ObjectTypeIds.getId(ObjectType.INET6NUM)); pstmt.setInt(4, ObjectTypeIds.getId(ObjectType.AUT_NUM)); }, resultSet -> { while (resultSet.next()) { if (hasRipeNccMntner(RpslObject.parse(resultSet.getString("object")))) { return true; } } return false; } ); }

Target:
public boolean hasManagedResource(final CIString orgId) { final int orgObjectId = jdbcTemplate.queryForObject( "SELECT object_id FROM organisation WHERE organisation = ?", new Object[] { orgId }, Integer.class ); return executeStreaming( jdbcTemplate, "SELECT l.object " + "FROM last l INNER JOIN org o ON l.object_id = o.object_id " + "WHERE o.org_id = ? " + "AND o.object_type in (?, ?, ?) " + "AND l.sequence_id > 0", pstmt -> { pstmt.setInt(1, orgObjectId); pstmt.setInt(2, ObjectTypeIds.getId(ObjectType.INETNUM)); pstmt.setInt(3, ObjectTypeIds.getId(ObjectType.INET6NUM)); pstmt.setInt(4, ObjectTypeIds.getId(ObjectType.AUT_NUM)); }, resultSet -> { while (resultSet.next()) { if (hasRipeNccMntner(RpslObject.parse(resultSet.getString("object")))) { return true; } } return false; } ); }
Source:
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_camera_controller_aeroplane: mSceneView.setCameraController(mOrbitAeroplaneCameraController); break; case R.id.action_camera_controller_crater: mSceneView.setCameraController(mOrbitLocationCameraController); break; case R.id.action_camera_controller_globe: mSceneView.setCameraController(new GlobeCameraController()); break; default: return super.onOptionsItemSelected(item); } return true; }

Target:
@Override public boolean onOptionsItemSelected(MenuItem item) { int itemid = item.getItemId(); if (itemid == R.id.action_camera_controller_plane) { mSceneView.setCameraController(mOrbitPlaneCameraController); return true; } else if (itemid == R.id.action_camera_controller_crater) { mSceneView.setCameraController(mOrbitLocationCameraController); return true; } else if (itemid == R.id.action_camera_controller_globe) { mSceneView.setCameraController(new GlobeCameraController()); return true; } return super.onOptionsItemSelected(item); }
Source:
public String doBulkFateOperation(List<ByteBuffer> args, String tableName) throws AccumuloSecurityException, AccumuloException, TableNotFoundException { while (true) { try { return doFateOperation(FateOperation.TABLE_BULK_IMPORT2, args, Collections.emptyMap(), tableName); } catch (TableExistsException | NamespaceExistsException e) { throw new AssertionError(e); } catch (NamespaceNotFoundException ne) { throw new TableNotFoundException(null, tableName, "Namespace not found", ne); } catch (AccumuloException ae) { BulkImport.checkExceptionForMerge(ae, tableName); } } }

Target:
public String doBulkFateOperation(List<ByteBuffer> args, String tableName) throws AccumuloSecurityException, AccumuloException, TableNotFoundException { try { return doFateOperation(FateOperation.TABLE_BULK_IMPORT2, args, Collections.emptyMap(), tableName); } catch (TableExistsException | NamespaceExistsException e) { throw new AssertionError(e); } catch (NamespaceNotFoundException ne) { throw new TableNotFoundException(null, tableName, "Namespace not found", ne); } }
Source:
public void test009_readNamesInSection() throws ConfigInvalidException { String configString = "[core]\n" + "repositoryFormatVersion = 0\n" + "filemode = false\n" + "logAllRefUpdates = true\n"; final Config c = parse(configString); Set<String> names = c.getNames("core"); assertEquals("Core section size", 3, names.size()); assertTrue("Core section should contain \"filemode\"", names .contains("filemode")); assertTrue("Core section should contain \"repositoryFormatVersion\"", names.contains("repositoryFormatVersion")); assertTrue("Core section should contain \"logallrefupdates\"", names.contains("logAllRefUpdates")); Iterator<String> itr = names.iterator(); assertEquals("filemode", itr.next()); assertEquals("logAllRefUpdates", itr.next()); assertEquals("repositoryFormatVersion", itr.next()); assertFalse(itr.hasNext()); }

Target:
public void test009_readNamesInSection() throws ConfigInvalidException { String configString = "[core]\n" + "repositoryFormatVersion = 0\n" + "filemode = false\n" + "logAllRefUpdates = true\n"; final Config c = parse(configString); Set<String> names = c.getNames("core"); assertEquals("Core section size", 3, names.size()); assertTrue("Core section should contain \"filemode\"", names .contains("filemode")); assertTrue("Core section should contain \"repositoryFormatVersion\"", names.contains("repositoryFormatVersion")); assertTrue("Core section should contain \"repositoryformatversion\"", names.contains("repositoryformatversion")); Iterator<String> itr = names.iterator(); assertEquals("filemode", itr.next()); assertEquals("logAllRefUpdates", itr.next()); assertEquals("repositoryFormatVersion", itr.next()); assertFalse(itr.hasNext()); }
Source:
public void etlOutputAsNtriples2Filesystem() { final FileOpener opener = new FileOpener(); final Triples2RdfModel triple2model = new Triples2RdfModel(); RdfModelFileWriter rdfModelFileWriter = new RdfModelFileWriter(); rdfModelFileWriter.setProperty("<LINK_0>"); rdfModelFileWriter.setStartIndex(2); rdfModelFileWriter.setEndIndex(7); rdfModelFileWriter.setTarget(NTRIPLES_DEBUG_FILES); triple2model.setInput(N_TRIPLE); opener.setReceiver(new TarReader()).setReceiver(new XmlDecoder()) .setReceiver(new AlephMabXmlHandler()) .setReceiver( new Metamorph("src/main/resources/morph-hbz01-to-lobid.xml")) .setReceiver(new PipeEncodeTriples()) .setReceiver(new SimpleStringSubstituter( "endTime> \"\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d\"", "endTime> \"0001-01-01T00:00:00\"")) .setReceiver(triple2model).setReceiver(rdfModelFileWriter); opener.process(new File(TEST_FILENAME_ALEPHXMLCLOBS).getAbsolutePath()); opener.closeStream(); }

Target:
public void etlOutputAsNtriples2Filesystem() { final FileOpener opener = new FileOpener(); final Triples2RdfModel triple2model = new Triples2RdfModel(); RdfModelFileWriter rdfModelFileWriter = new RdfModelFileWriter(); rdfModelFileWriter.setProperty("<LINK_0>"); rdfModelFileWriter.setStartIndex(2); rdfModelFileWriter.setEndIndex(7); rdfModelFileWriter.setTarget(NTRIPLES_DEBUG_FILES); triple2model.setInput(N_TRIPLE); opener.setReceiver(new TarReader()).setReceiver(new XmlDecoder()) .setReceiver(new AlephMabXmlHandler()) .setReceiver( new Metamorph("src/main/resources/morph-hbz01-to-lobid.xml")) .setReceiver(new PipeEncodeTriples()) .setReceiver(new SimpleStringSubstituter( "endTime> \"\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\"", "endTime> \"0001-01-01T00:00:00\"")) .setReceiver(triple2model).setReceiver(rdfModelFileWriter); opener.process(new File(TEST_FILENAME_ALEPHXMLCLOBS).getAbsolutePath()); opener.closeStream(); }
Source:
protected synchronized void setStorageService(StorageService storageService) { if (_storageServiceDoNotUseDirectly == null) { _storageServiceDoNotUseDirectly = storageService; _storeDoNotUseDirectly = storageService.getStorage(STORE_NAME); storageFacade = new StorageFacade(this._storeDoNotUseDirectly); } }

Target:
protected synchronized void setStorageService(StorageService storageService) { Storage storage = storageService.getStorage(STORE_NAME); storageFacade = new StorageFacade(storage); }
Source:
private static boolean hasNoPathVariableAnnotation(VariableTree variableTree) { return variableTree.modifiers().annotations().stream().noneMatch(a -> a.symbolType().is(PATH_VARIABLE_ANNOTATION)); }

Target:
private static boolean hasNoPathVariableAnnotation(VariableTree variableTree) { return !variableTree.symbol().metadata().isAnnotatedWith(PATH_VARIABLE_ANNOTATION); }
Source:
public boolean lock(K... keys) { return cacheImplementation.lock(Arrays.asList(keys), flags, null); }

Target:
public boolean lock(K... keys) { return cacheImplementation.lock(Arrays.asList(keys), flags); }
Source:
protected Event createSelectionEvent(int stateMask) { int stateMaskSelection = SWT.getPlatform().equals("gtk") ? stateMask : stateMask | SWT.BUTTON1; Event event = super.createSelectionEvent(stateMaskSelection); event.item = widget; return event; }

Target:
protected Event createSelectionEvent(int stateMask) { int stateMaskSelection = Util.isGtk() ? stateMask : stateMask | SWT.BUTTON1; Event event = super.createSelectionEvent(stateMaskSelection); event.item = widget; return event; }
Source:
public static boolean doesColumnExist(SQLiteDatabase db, String tableName, String columnName) { try (Cursor cursor = db.rawQuery("SELECT * FROM " + tableName + " LIMIT 0", null)) { if (cursor != null) { return cursor.getColumnIndex(columnName) != -1; } } return false; }

Target:
public static boolean doesColumnExist(SQLiteDatabase db, String tableName, String columnName) { return getColumnNames(db, tableName).contains(columnName); }
Source:
public void testAsyncTaskWithMultiplePartition() throws Exception { Map<Integer, List<KV>> input = new HashMap<>(); Map<Integer, List<Integer>> output = new HashMap<>(); List<Integer> partition = Arrays.asList(1, 2, 3, 4, 5); List<Integer> outputPartition = partition.stream().map(x -> x * 10).collect(Collectors.toList()); for (int i = 0; i < 5; i++) { List<KV> keyedPartition = new ArrayList<>(); for (Integer val : partition) { keyedPartition.add(KV.of(i, val)); } input.put(i, keyedPartition); output.put(i, new ArrayList<Integer>(outputPartition)); } CollectionStream<KV> inputStream = CollectionStream.of("async-test", "ints", input); CollectionStream outputStream = CollectionStream.empty("async-test", "ints-out", 5); TestRunner .of(MyAsyncStreamTask.class) .addInputStream(inputStream) .addOutputStream(outputStream) .run(Duration.ofSeconds(2)); StreamAssert.that(outputStream).contains(output, Duration.ofMillis(1000)); }

Target:
public void testAsyncTaskWithMultiplePartition() throws Exception { Map<Integer, List<KV>> inputPartitionData = new HashMap<>(); Map<Integer, List<Integer>> expectedOutputPartitionData = new HashMap<>(); List<Integer> partition = Arrays.asList(1, 2, 3, 4, 5); List<Integer> outputPartition = partition.stream().map(x -> x * 10).collect(Collectors.toList()); for (int i = 0; i < 5; i++) { List<KV> keyedPartition = new ArrayList<>(); for (Integer val : partition) { keyedPartition.add(KV.of(i, val)); } inputPartitionData.put(i, keyedPartition); expectedOutputPartitionData.put(i, new ArrayList<Integer>(outputPartition)); } CollectionStream<KV> inputStream = CollectionStream.of("async-test", "ints", inputPartitionData); CollectionStream outputStream = CollectionStream.empty("async-test", "ints-out", 5); TestRunner .of(MyAsyncStreamTask.class) .addInputStream(inputStream) .addOutputStream(outputStream) .run(Duration.ofSeconds(2)); StreamAssert.containsInOrder(outputStream, expectedOutputPartitionData, Duration.ofMillis(1000)); }
Source:
public boolean equals(Object obj) { if ( this == obj ) { return true; } if ( obj == null ) { return false; } if ( getClass() != obj.getClass() ) { return false; } Key other = (Key) obj; if ( sourceType == null ) { if ( other.sourceType != null ) { return false; } } else if ( !sourceType.erasure().equals( other.sourceType.erasure() ) ) { return false; } if ( targetType == null ) { if ( other.targetType != null ) { return false; } } else if ( !targetType.erasure().equals( other.targetType.erasure() ) ) { return false; } return true; }

Target:
public boolean equals(Object obj) { if ( this == obj ) { return true; } if ( obj == null ) { return false; } if ( getClass() != obj.getClass() ) { return false; } Key other = (Key) obj; if ( sourceType == null ) { if ( other.sourceType != null ) { return false; } } else if ( !sourceType.equals( other.sourceType ) ) { return false; } if ( targetType == null ) { if ( other.targetType != null ) { return false; } } else if ( !targetType.equals( other.targetType ) ) { return false; } return true; }
Source:
AesDecryptor(Mode mode, byte[] keyBytes, byte[] aad, byte[] ivPrefix) throws IllegalArgumentException, IOException { if (null == keyBytes) { throw new IllegalArgumentException("Null key bytes"); } this.aesMode = mode; aesKey = new SecretKeySpec(keyBytes, "AES"); AAD = aad; this.ivPrefix = ivPrefix; if (Mode.GCM == mode) { nonceLength = GCM_NONCE_LENGTH; tagLength = GCM_TAG_LENGTH; try { aesCipher = Cipher.getInstance("AES/GCM/NoPadding"); } catch (GeneralSecurityException e) { throw new IOException("Failed to create decryptor", e); } } else { nonceLength = CTR_NONCE_LENGTH; tagLength = 0; try { aesCipher = Cipher.getInstance("AES/CTR/NoPadding"); } catch (GeneralSecurityException e) { throw new IOException("Failed to create decryptor", e); } } if (null != ivPrefix && ivPrefix.length > nonceLength) { throw new IllegalArgumentException("IV prefix length (" + ivPrefix.length + ") should be shorter than nonce length (" + nonceLength + ")"); } }

Target:
AesDecryptor(Mode mode, byte[] keyBytes, byte[] aad, byte[] ivPrefix) throws IllegalArgumentException, IOException { if (null == keyBytes) { throw new IllegalArgumentException("Null key bytes"); } this.aesMode = mode; aesKey = new SecretKeySpec(keyBytes, "AES"); AAD = aad; this.ivPrefix = ivPrefix; if (Mode.GCM == mode) { nonceLength = GCM_NONCE_LENGTH; tagLength = GCM_TAG_LENGTH; try { aesCipher = Cipher.getInstance("AES/GCM/NoPadding"); } catch (GeneralSecurityException e) { throw new IOException("Failed to create GCM cipher", e); } } else { nonceLength = CTR_NONCE_LENGTH; tagLength = 0; try { aesCipher = Cipher.getInstance("AES/CTR/NoPadding"); } catch (GeneralSecurityException e) { throw new IOException("Failed to create CTR cipher", e); } } if (null != ivPrefix && ivPrefix.length > nonceLength) { throw new IllegalArgumentException("IV prefix length (" + ivPrefix.length + ") should be shorter than nonce length (" + nonceLength + ")"); } }
Source:
public void showGroups(List<Group> groups) { mGroupList = groups; Collections.sort(mGroupList, new Comparator<Group>() { @Override public int compare(Group o1, Group o2) { return o1.getName().compareTo(o2.getName()); } }); mGroupListAdapter.setGroups(groups); }

Target:
public void showGroups(List<Group> groups) { mGroupList = groups; Collections.sort(mGroupList, new Comparator<Group>() { @Override public int compare(Group grp1, Group grp2) { return grp1.getName().compareTo(grp2.getName()); } }); mGroupListAdapter.setGroups(groups); }
Source:
public UnsavedFileAttachment(File file, String type) { this.name = file.getName(); try { this.inputStream = new FileInputStream(file); } catch (IOException ioe) { System.out.println("problem setting inputstream "+ioe); inputStreamException = ioe; } this.type = type; }

Target:
public UnsavedFileAttachment(File file, String type) { this.file = file; this.name = file.getName(); this.type = type; }
Source:
public void deactiveCurrentRevision() { if (fRevisionInContext == null) { return; } fRevisionInContext.eAdapters().remove(listener); deleteAllMarkers(); if (hasDrafts()) { final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); UIUtils.replyToChange(shell, fRevisionInContext, Messages.ActiveWorkspaceRevision_0 + fRevisionInContext.getChangeInfo().getSubject() + "\"\n\n", fGerritClient, false); } fRevisionInContext = null; firePropertyChange("activeRevision", null, null); fIsQuickDiffOn = Platform.getPreferencesService().getBoolean("org.eclipse.ui.editors", "quickdiff.quickDiff", false, null); fIsAdditionIndicationInOverviewRule = Platform.getPreferencesService().getBoolean("org.eclipse.ui.editors", "additionIndicationInOverviewRule", false, null); fIsChangeIndicationInOverviewRuler = Platform.getPreferencesService().getBoolean("org.eclipse.ui.editors", "changeIndicationInOverviewRuler", false, null); fIsDeletionIndicationInOverviewRuler = Platform.getPreferencesService().getBoolean("org.eclipse.ui.editors", "deletionIndicationInOverviewRuler", false, null); Preferences preferences = InstanceScope.INSTANCE.getNode("org.eclipse.ui.editors"); preferences.put("quickdiff.quickDiff", new Boolean(fIsQuickDiffOn).toString()); preferences.put("additionIndicationInOverviewRule", new Boolean(fIsQuickDiffOn).toString()); preferences.put("changeIndicationInOverviewRuler", new Boolean(fIsChangeIndicationInOverviewRuler).toString()); preferences.put("deletionIndicationInOverviewRuler", new Boolean(fIsDeletionIndicationInOverviewRuler).toString()); try { preferences.flush(); } catch (BackingStoreException e1) { EGerritCorePlugin.logError(fGerritClient.getRepository().formatGerritVersion() + e1.getMessage()); } }

Target:
public void deactiveCurrentRevision() { if (fRevisionInContext == null) { return; } fRevisionInContext.eAdapters().remove(listener); deleteAllMarkers(); if (hasDrafts()) { final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); UIUtils.replyToChange(shell, fRevisionInContext, Messages.ActiveWorkspaceRevision_0 + fRevisionInContext.getChangeInfo().getSubject() + "\"\n\n", fGerritClient, false); } fRevisionInContext = null; firePropertyChange("activeRevision", null, null); restoreQuickDiffValues(); }
Source:
public int hashCode() { int result = 17; result = 31 * result + Integer.hashCode(super.getBatchSize()); result = 31 * result + Objects.hashCode(span); result = 31 * result + Objects.hashCode(super.getColumn()); result = 31 * result + Objects.hashCode(super.getTask()); return result; }

Target:
public int hashCode() { return Objects.hash(super.getBatchSize(), span, super.getColumn(), super.getTask()); }
Source:
public BlazeCommandResult exec(CommandEnvironment env, OptionsParsingResult options) { BlazeRuntime runtime = env.getRuntime(); List<String> targets = options.getResidue(); BuildRequestOptions buildRequestOptions = options.getOptions(BuildRequestOptions.class); if (!targets.isEmpty()) { if (!buildRequestOptions.buildFile.isEmpty()) { env.getReporter() .handle(Event.error("Command-line target pattern and --build_file cannot both be specified")); return BlazeCommandResult.exitCode(ExitCode.COMMAND_LINE_ERROR); } try (SilentCloseable closeable = Profiler.instance().profile("ProjectFileSupport.getTargets")) { targets = ProjectFileSupport.getTargets(runtime.getProjectFileProvider(), options); } } else if (!buildRequestOptions.buildFile.isEmpty()) { Path residuePath = env.getWorkingDirectory().getRelative(buildRequestOptions.buildFile); try { targets = Lists.newArrayList(FileSystemUtils.readLines(residuePath, StandardCharsets.UTF_8)); } catch (IOException e) { env.getReporter() .handle(Event.error("I/O error reading from " + residuePath.getPathString())); return BlazeCommandResult.exitCode(ExitCode.COMMAND_LINE_ERROR); } } else { env.getReporter() .handle( Event.warn( "Usage: " + runtime.getProductName() + " build <options> <targets>." + "\nInvoke `" + runtime.getProductName() + " help build` for full description of usage and options." + "\nYour request is correct, but requested an empty set of targets." + " Nothing will be built.")); } BuildRequest request; try (SilentCloseable closeable = Profiler.instance().profile("BuildRequest.create")) { request = BuildRequest.create( getClass().getAnnotation(Command.class).name(), options, runtime.getStartupOptionsProvider(), targets, env.getReporter().getOutErr(), env.getCommandId(), env.getCommandStartTime()); } ExitCode exitCode = new BuildTool(env).processRequest(request, null).getExitCondition(); return BlazeCommandResult.exitCode(exitCode); }

Target:
public BlazeCommandResult exec(CommandEnvironment env, OptionsParsingResult options) { BlazeRuntime runtime = env.getRuntime(); List<String> targets; try { targets = TargetPatternsHelper.readFrom(env, options); } catch (TargetPatternsHelper.TargetPatternsHelperException e) { env.getReporter() .handle(Event.error(e.getMessage())); return BlazeCommandResult.exitCode(ExitCode.COMMAND_LINE_ERROR); } if (targets.isEmpty()) { env.getReporter() .handle( Event.warn( "Usage: " + runtime.getProductName() + " build <options> <targets>." + "\nInvoke `" + runtime.getProductName() + " help build` for full description of usage and options." + "\nYour request is correct, but requested an empty set of targets." + " Nothing will be built.")); } BuildRequest request; try (SilentCloseable closeable = Profiler.instance().profile("BuildRequest.create")) { request = BuildRequest.create( getClass().getAnnotation(Command.class).name(), options, runtime.getStartupOptionsProvider(), targets, env.getReporter().getOutErr(), env.getCommandId(), env.getCommandStartTime()); } DetailedExitCode detailedExitCode = new BuildTool(env).processRequest(request, null).getDetailedExitCode(); return BlazeCommandResult.detailedExitCode(detailedExitCode); }
Source:
protected void onDestroy() { super.onDestroy(); mapView.onDestroy(); }

Target:
protected void onDestroy() { super.onDestroy(); if (handler != null && runnable != null) { handler.removeCallbacks(runnable); } mapView.onDestroy(); }
Source:
public MongoDbMetadataStore(MongoDbFactory factory, String collectionName) { template = new MongoTemplate(factory); this.collectionName = (StringUtils.hasText(collectionName)) ? collectionName : DEFAULT_COLLECTION_NAME; }

Target:
public MongoDbMetadataStore(MongoDbFactory factory, String collectionName) { this(new MongoTemplate(factory), collectionName); }
Source:
public void testSetOnlineForNonQueueMode() throws Exception { Registration registration = givenASimpleClient(); final CountDownLatch countDown = new CountDownLatch(2); instance.addListener(new PresenceListener() { @Override public void onOnline(Registration endpoint) { countDown.countDown(); } @Override public void onOffline(Registration endpoint) { countDown.countDown(); } }); instance.setOnline(registration); assertFalse(countDown.await(2, TimeUnit.SECONDS)); }

Target:
public void testSetOnlineForNonQueueMode() throws Exception { Registration registration = givenASimpleClient(); instance.addListener(new PresenceListener() { @Override public void onOnline(Registration registration) { fail("No invocation was expected"); } @Override public void onOffline(Registration registration) { fail("No invocation was expected"); } }); instance.setOnline(registration); }
Source:
public String toString() { return "creationTime=" + creationTime + ", sequence=" + sequence + ", uuid=" + uuid + ", expirationTime=" + expirationTime + ", lastAccessTime=" + lastAccessTime + ", hits=" + hits + ", recordState=" + reservationId + ", value=" + value; }

Target:
public String toString() { return "AbstractNearCacheRecord{" + "creationTime=" + creationTime + ", value=" + value + ", uuid=" + uuid + ", cachedAsNull=" + cachedAsNull + ", hits=" + hits + ", partitionId=" + partitionId + ", lastAccessTime=" + lastAccessTime + ", expirationTime=" + expirationTime + ", invalidationSequence=" + invalidationSequence + ", reservationId=" + reservationId + '}'; }
Source:
public List<OrganizationMembershipShowDto> findUserAdminOrganizations(String username) { User user = userRepository.findByUsernameOrEmail(username, username); if (user.getOrganizationMemberships() == null || user.getOrganizationMemberships().size() == 0) { return null; } return user.getOrganizationMemberships().stream().map(OrganizationMembershipShowDto::new).collect(Collectors.toList()); }

Target:
public List<OrganizationMembershipShowDto> findUserAdminOrganizations(String username) { User user = userRepository.findByUsernameOrEmail(username, username); if (user.getOrganizationMemberships() == null) { return Collections.emptyList(); } return user.getOrganizationMemberships().stream().map(OrganizationMembershipShowDto::new).collect(Collectors.toList()); }
Source:
Mono<AmqpTransaction> createTransaction() { final Message message = Proton.message(); Declare declare = new Declare(); message.setBody(new AmqpValue(declare)); final int payloadSize = messageSerializer.getSize(message); final int allocationSize = payloadSize + MAX_AMQP_HEADER_SIZE_BYTES; final byte[] bytes = new byte[allocationSize]; final int encodedSize = message.encode(bytes, 0, allocationSize); return sendLink.send(bytes, encodedSize, DeliveryImpl.DEFAULT_MESSAGE_FORMAT, null) .handle((outcome, sink) -> { if (!(outcome instanceof Declared)) { sink.error(new IllegalArgumentException("Expected a Declared, received: " + outcome)); return; } final Declared state = (Declared) outcome; final DeliveryState.DeliveryStateType stateType = state.getType(); switch (stateType) { case Accepted: break; case Rejected: break; case Declared: Binary txnId; Declared declared = (Declared) outcome; txnId = declared.getTxnId(); logger.verbose("Created new TX started: {}", txnId); sink.next(new AmqpTransaction(txnId.asByteBuffer())); break; default: } }); }

Target:
Mono<AmqpTransaction> createTransaction() { final Message message = Proton.message(); Declare declare = new Declare(); message.setBody(new AmqpValue(declare)); final int payloadSize = messageSerializer.getSize(message); final int allocationSize = payloadSize + MAX_AMQP_HEADER_SIZE_BYTES; final byte[] bytes = new byte[allocationSize]; final int encodedSize = message.encode(bytes, 0, allocationSize); return sendLink.send(bytes, encodedSize, DeliveryImpl.DEFAULT_MESSAGE_FORMAT, null) .handle((outcome, sink) -> { final DeliveryState.DeliveryStateType stateType = outcome.getType(); switch (stateType) { case Declared: Binary transactionId; Declared declared = (Declared) outcome; transactionId = declared.getTxnId(); sink.next(new AmqpTransaction(transactionId.asByteBuffer())); break; default: sink.error(new IllegalArgumentException("Expected a Declared, received: " + outcome)); logger.warning("Unknown DeliveryState type: {}", stateType); } }); }
Source:
public SubscriptionHealth getSubscriptionHealth(TopicName topicName, String subscriptionName) { Subscription subscription = getSubscriptionDetails(topicName, subscriptionName); TopicMetrics topicMetrics = topicService.getTopicMetrics(topicName); SubscriptionMetrics subscriptionMetrics = getSubscriptionMetrics(topicName, subscriptionName); return subscriptionHealthCalculator.calculateHealth(subscription, topicMetrics, subscriptionMetrics); }

Target:
public SubscriptionHealth getSubscriptionHealth(TopicName topicName, String subscriptionName) { Subscription subscription = getSubscriptionDetails(topicName, subscriptionName); TopicMetrics topicMetrics = topicService.getTopicMetrics(topicName); SubscriptionMetrics subscriptionMetrics = getSubscriptionMetrics(topicName, subscriptionName); return subscriptionHealthChecker.checkHealth(subscription, topicMetrics, subscriptionMetrics); }
Source:
private void initialize() { if (getBatchSize() <= 0) { withBatchSize(1); logger.warn("batchSize should be 1 or greater -- setting batchSize to 1"); } if (getThreadCount() <= 0) { int threadCount = clients.size(); withThreadCount(threadCount); logger.warn("threadCount should be 1 or greater -- setting threadCount to number of hosts: " + threadCount); } if (initialized.getAndSet(true)) return; threadPool = new CallingThreadPoolExecutor(this, getThreadCount()); jobStartTime = Calendar.getInstance(); started.set(true); if(callArgsGenerator != null) { Forest[] forests; String[] forestNames = null; if(forestParamName!=null) { forests = super.getForestConfig().listForests(); forestNames = new String[forests.length]; int j=0; for(Forest i:forests) { forestNames[j] = i.getForestName(); j++; } } for (int i=0;i<getThreadCount(); i++) { CallArgs newInput = callArgsGenerator.apply(null); if(forestNames!=null && forestNames[i]!=null) { newInput.param(forestParamName, forestNames[i]); } if(newInput != null) { if(!(newInput instanceof CallArgsImpl)) throw new MarkLogicInternalException("Unsupported implementation of call arguments."); submitCall((CallArgsImpl) newInput); } } } }

Target:
private void initialize() { if (getBatchSize() <= 0) { withBatchSize(1); logger.warn("batchSize should be 1 or greater -- setting batchSize to 1"); } if (getThreadCount() <= 0) { int threadCount = clients.size(); withThreadCount(threadCount); logger.warn("threadCount should be 1 or greater -- setting threadCount to number of hosts: " + threadCount); } if (initialized.getAndSet(true)) return; threadPool = new CallingThreadPoolExecutor(this, getThreadCount()); jobStartTime = Calendar.getInstance(); started.set(true); if(callArgsGenerator != null) { String[] forestNames = null; if(forestParamName!=null) { Forest[] forests; forests = super.getForestConfig().listForests(); forestNames = new String[forests.length]; int j=0; for(Forest i:forests) { forestNames[j] = i.getForestName(); j++; } } for (int i=0;i<getThreadCount(); i++) { CallArgs newInput = callArgsGenerator.apply(null); if(forestNames!=null && forestNames[i]!=null) { newInput.param(forestParamName, forestNames[i]); } if(newInput != null) { if(!(newInput instanceof CallArgsImpl)) throw new MarkLogicInternalException("Unsupported implementation of call arguments."); submitCall((CallArgsImpl) newInput); } } } }