auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testIOExplain() { assertUpdate("CREATE TABLE test_orders (LIKE orders INCLUDING PROPERTIES)"); String query = "INSERT INTO test_orders SELECT * FROM orders where orderkey > 5"; MaterializedResult result = computeActual("EXPLAIN (TYPE IO) " + query); TableColumnInfo input = new TableColumnInfo( new QualifiedTablePrefix("hive", "tpch", "orders"), ImmutableList.of( new ColumnConstraint( "orderkey", BIGINT, new FormattedDomain( false, ImmutableList.of( new FormattedRange( new FormattedMarker(Optional.of("5"), ABOVE), new FormattedMarker(Optional.empty(), BELOW)))) ) ) ); assertEquals( getOnlyElement(result.getOnlyColumnAsSet()), jsonCodec(IOPlan.class).toJson(new IOPlan( ImmutableList.of(input), Optional.of(new QualifiedTablePrefix("hive", "tpch", "test_orders"))))); assertUpdate("DROP TABLE test_orders"); }

Target:
public void testIOExplain() { computeActual("CREATE TABLE test_orders WITH (partitioned_by = ARRAY['orderkey']) AS select custkey, orderkey FROM orders where orderkey < 10"); MaterializedResult result = computeActual("EXPLAIN (TYPE IO, FORMAT JSON) INSERT INTO test_orders SELECT custkey, orderkey FROM orders where orderkey > 5 AND custkey <= 10"); TableColumnInfo input = new TableColumnInfo( new CatalogSchemaTableName("hive", "tpch", "orders"), ImmutableSet.of( new ColumnConstraint( "custkey", BIGINT.getTypeSignature(), new FormattedDomain( false, ImmutableSet.of( new FormattedRange( new FormattedMarker(Optional.empty(), ABOVE), new FormattedMarker(Optional.of("10"), EXACTLY))))), new ColumnConstraint( "orderkey", BIGINT.getTypeSignature(), new FormattedDomain( false, ImmutableSet.of( new FormattedRange( new FormattedMarker(Optional.of("5"), ABOVE), new FormattedMarker(Optional.empty(), BELOW))))))); assertEquals( jsonCodec(IOPlan.class).fromJson((String) getOnlyElement(result.getOnlyColumnAsSet())), new IOPlan( ImmutableSet.of(input), Optional.of(new CatalogSchemaTableName("hive", "tpch", "test_orders")))); assertUpdate("DROP TABLE test_orders"); }
Source:
public static int compareOffsets(String offset1, String offset2) { return Long.valueOf(offset1).compareTo(Long.valueOf(offset2)); }

Target:
private static int compareOffsets(String offset1, String offset2) { return Long.valueOf(offset1).compareTo(Long.valueOf(offset2)); }
Source:
private void cleanupWorkspaces(TopLevelItem item) { Jenkins j = Jenkins.getInstance(); List<Node> nodes = new ArrayList<>(); nodes.add(j); nodes.addAll(j.getNodes()); Logger log = Logger.getLogger(Job.class.getName()); for (Node node : nodes) { FilePath ws = node.getWorkspaceFor(item); if (ws != null) { try { ws.deleteRecursive(); } catch (IOException e) { log.log(Level.FINE, "Unable to clean out workspace for deleted job", e); } catch (InterruptedException e) { log.log(Level.FINE, "Unable to clean out workspace for deleted job", e); } } } }

Target:
private void cleanupWorkspaces(TopLevelItem item) { Jenkins j = Jenkins.getInstance(); List<Node> nodes = new ArrayList<>(); nodes.add(j); nodes.addAll(j.getNodes()); for (Node node : nodes) { FilePath ws = node.getWorkspaceFor(item); if (ws != null) { try { ws.deleteRecursive(); WorkspaceList.tempDir(ws).deleteRecursive(); } catch (IOException e) { logger.log(Level.FINE, "Unable to clean out workspace for deleted job", e); } catch (InterruptedException e) { logger.log(Level.FINE, "Unable to clean out workspace for deleted job", e); } } } }
Source:
public static <T> T parse(String itemResponseBodyAsString, Class<T> itemClassType) { try { return getSimpleObjectMapper().readValue(itemResponseBodyAsString, itemClassType); } catch (IOException e) { throw new IllegalStateException("Failed to get POJO.", e); } }

Target:
public static <T> T parse(String itemResponseBodyAsString, Class<T> itemClassType) { if (StringUtils.isEmpty(itemResponseBodyAsString)) { return null; } try { return getSimpleObjectMapper().readValue(itemResponseBodyAsString, itemClassType); } catch (IOException e) { throw new IllegalStateException("Failed to get POJO.", e); } }
Source:
public void setAutoChar(final char currentChar) { char nextChar = currentChar; if (nextChar < 'A') { nextChar = 'A'; } else if (nextChar > 'Z') { nextChar = 'Z'; } switch (getType()) { case INPUT_VAL: buttonData.autoChar = nextChar; break; case AUTO_CHAR: buttonData.autoChar = nextChar++; break; case CUSTOM: buttonData.autoChar = nextChar; if ('A' <= buttonData.customChar && buttonData.customChar <= 'Z') { nextChar = buttonData.customChar; nextChar++; } break; default: } updateButtonText(); if (nextButton != null) { nextButton.setAutoChar(nextChar); } }

Target:
private void setAutoChar(final char currentChar) { char nextChar = currentChar; if (nextChar < 'A') { nextChar = 'A'; } else if (nextChar > 'Z') { nextChar = 'Z'; } nextChar = getType().setAutoChar(getData(), nextChar); updateButtonText(); if (nextButton != null) { nextButton.setAutoChar(nextChar); } }
Source:
public InputStream openFile(String path) { Preconditions.notBlank(path, "File [" + path + "] must not be null or blank"); try { return Files.newInputStream(Paths.get(path)); } catch (IOException e) { throw new UncheckedIOException("File [" + path + "] could not be read", e); } }

Target:
public InputStream openFile(String path) { Preconditions.notBlank(path, () -> "File [" + path + "] must not be null or blank"); try { return Files.newInputStream(Paths.get(path)); } catch (IOException e) { throw new JUnitException("File [" + path + "] could not be read", e); } }
Source:
public QueryIterTopN(QueryIterator qIter, Comparator<Binding> comparator, long numItems, boolean distinct, ExecutionContext context) { super(null, context) ; this.embeddedIterator = qIter ; this.distinct = distinct ; limit = numItems ; if ( limit == Query.NOLIMIT ) limit = Long.MAX_VALUE ; if ( limit < 0 ) throw new QueryExecException("Negative LIMIT: " + limit) ; if ( limit == 0 ) { Iterator<Binding> iter0 = Iter.nullIterator() ; setIterator(iter0) ; qIter.close() ; return ; } this.heap = new PriorityQueue<>((int)numItems, new ReverseComparator<>(comparator)) ; this.setIterator(sortTopN(qIter, comparator)) ; }

Target:
public QueryIterTopN(QueryIterator qIter, Comparator<Binding> comparator, long numItems, boolean distinct, ExecutionContext context) { super(null, context) ; this.embeddedIterator = qIter ; this.distinct = distinct ; limit = numItems ; if ( limit == Query.NOLIMIT ) limit = Long.MAX_VALUE ; if ( limit < 0 ) throw new QueryExecException("Negative LIMIT: " + limit) ; if ( limit == 0 ) { Iterator<Binding> iter0 = Iter.nullIterator() ; setIterator(iter0) ; qIter.close() ; return ; } this.heap = new PriorityQueue<>((int)numItems, comparator.reversed()) ; this.setIterator(sortTopN(qIter, comparator)) ; }
Source:
public void testUnderlyingReaders() throws IOException, FormatException { FakeReader reader = new FakeReader(); FileStitcher fs = new FileStitcher(reader); assertNotNull(fs.getUnderlyingReaders()); fs.setId("test_z<0-2>.fake"); assertNotNull(fs.getUnderlyingReaders()); }

Target:
public void testUnderlyingReaders() throws IOException, FormatException { FakeReader reader = new FakeReader(); FileStitcher fs = new FileStitcher(reader); assertNotNull(fs.getUnderlyingReaders()); fs.setId("test_z<0-2>.fake"); assertNotNull(fs.getUnderlyingReaders()); fs.close(); }
Source:
public BouncyCastleAesBytesEncryptor(String password, CharSequence salt) { this(password, salt, null); }

Target:
BouncyCastleAesBytesEncryptor(String password, CharSequence salt) { this(password, salt, KeyGenerators.secureRandom(16)); }
Source:
public LogInHandler(Logger logger, Authenticator authenticator, UserSessionDao loginCookieDao) { super(LogInAction.class); this.logger = logger; this.authenticator = authenticator; this.loginCookieDao = loginCookieDao; }

Target:
LogInHandler(Logger logger, Authenticator authenticator, UserSessionDao loginCookieDao) { super(LogInAction.class); this.logger = logger; this.authenticator = authenticator; this.loginCookieDao = loginCookieDao; }
Source:
public void onFailed(Guid cmdId, List<Guid> childCmdIds) { super.onFailed(cmdId, childCmdIds); if ((!getDisk().getParentId().equals(Guid.Empty)) && (!getDisk().getParentId().equals(getDisk().getImageTemplateId()))) { DiskImage previousSnapshot = getDiskImageDAO().getSnapshotById(getDisk().getParentId()); previousSnapshot.setActive(true); getImageDao().update(previousSnapshot.getImage()); } onFinish(cmdId); }

Target:
public void onFailed(Guid cmdId, List<Guid> childCmdIds) { super.onFailed(cmdId, childCmdIds); if ((!getDisk().getParentId().equals(Guid.Empty)) && (!getDisk().getParentId().equals(getDisk().getImageTemplateId()))) { DiskImage previousSnapshot = getDiskImageDAO().getSnapshotById(getDisk().getParentId()); previousSnapshot.setActive(true); getImageDao().update(previousSnapshot.getImage()); } getCommand().getParameters().setTaskGroupSuccess(false); onFinish(cmdId); }
Source:
public Response install(Action action) { VDS vds = getEntity(); UpdateVdsActionParameters params = new UpdateVdsActionParameters(vds.getStaticData(), action.getRootPassword(), true); if (action.getSsh().isSetUser()) { params.setPassword(action.getSsh().getUser().getPassword()); params.getvds().setSshUsername(action.getSsh().getUser().getUserName()); } params.getvds().setSshPort(action.getSsh().getPort()); params.getvds().setSshKeyFingerprint(action.getSsh().getFingerprint()); if (vds.getVdsType()==VDSType.oVirtNode) { params.setIsReinstallOrUpgrade(true); if (action.isSetImage()) { params.setoVirtIsoFile(action.getImage()); } } else { validateParameters(action, "rootPassword"); } return doAction(VdcActionType.UpdateVds, params, action); }

Target:
public Response install(Action action) { VDS vds = getEntity(); UpdateVdsActionParameters params = new UpdateVdsActionParameters(vds.getStaticData(), action.getRootPassword(), true); if (action.isSetSsh()) { if (action.getSsh().isSetUser()) { if (action.getSsh().getUser().isSetPassword()) { params.setPassword(action.getSsh().getUser().getPassword()); } } if (action.getSsh().isSetPort()) { params.getvds().setSshPort(action.getSsh().getPort().intValue()); } if (action.getSsh().isSetFingerprint()) { params.getvds().setSshKeyFingerprint(action.getSsh().getFingerprint()); } } if (vds.getVdsType()==VDSType.oVirtNode) { params.setIsReinstallOrUpgrade(true); if (action.isSetImage()) { params.setoVirtIsoFile(action.getImage()); } } else { validateParameters(action, "rootPassword"); } return doAction(VdcActionType.UpdateVds, params, action); }
Source:
public void destroy() throws CrafterException { boolean locked; try { logger.debug("Getting write lock for context {}", this); locked = writeLock.tryLock(shutdownTimeout, TimeUnit.MINUTES); if (!locked) { logger.debug("Time out reached, proceeding to destroy context {}", this); } else { logger.debug("All threads released, proceeding to destroy context {}", this); } state = State.DESTROYED; publishEvent(new SiteContextDestroyedEvent(this)); maintenanceTaskExecutor.shutdownNow(); storeService.destroyContext(context); if (scheduler != null) { try { scheduler.shutdown(); } catch (SchedulerException e) { throw new CrafterException("Unable to shutdown scheduler", e); } } if (applicationContext != null) { try { applicationContext.close(); } catch (Exception e) { throw new CrafterException("Unable to close application context", e); } } if (classLoader != null) { try { classLoader.close(); } catch (Exception e) { throw new CrafterException("Unable to close class loader", e); } } } catch (InterruptedException e) { throw new CrafterException("Unable to destroy context", e); } finally { logger.debug("Releasing write lock for context {}", this); writeLock.unlock(); } }

Target:
public void destroy() throws CrafterException { boolean locked; try { logger.debug("Getting shutdown lock for context {}", this); locked = shutdownLock.tryLock(shutdownTimeout, TimeUnit.MINUTES); try { if (!locked) { logger.debug("Time out reached, proceeding to destroy context {}", this); } else { logger.debug("All threads released, proceeding to destroy context {}", this); } state = State.DESTROYED; publishEvent(new SiteContextDestroyedEvent(this)); maintenanceTaskExecutor.shutdownNow(); storeService.destroyContext(context); if (scheduler != null) { try { scheduler.shutdown(); } catch (SchedulerException e) { throw new CrafterException("Unable to shutdown scheduler", e); } } if (applicationContext != null) { try { applicationContext.close(); } catch (Exception e) { throw new CrafterException("Unable to close application context", e); } } if (classLoader != null) { try { classLoader.close(); } catch (Exception e) { throw new CrafterException("Unable to close class loader", e); } } } catch (Exception e) { logger.error("Error destroying context {}", this, e); } finally { if (locked) { logger.debug("Releasing shutdown lock for context {}", this); shutdownLock.unlock(); } } } catch (InterruptedException e) { throw new CrafterException("Unable to destroy context", e); } }
Source:
private Consumer<String> publish(final MqttMessage message) { return topic -> { try { mqttClient.publish(topic, message).waitForCompletion(); } catch (MqttException e) { e.printStackTrace(); } }; }

Target:
private Consumer<String> publish(final MqttMessage message) { return topic -> { try { mqttClient.publish(topic, message).waitForCompletion(); } catch (MqttException e) { throw new IllegalStateException(e); } }; }
Source:
public int compareTo(GradleDeployDetails that) { if (this.publishArtifact == null) { return -1; } if (that.publishArtifact == null) { return 1; } if (this.deployDetails.compareTo(that.deployDetails) == 0) { return 0; } String thisExtension = this.publishArtifact.getExtension(); String thatExtension = that.publishArtifact.getExtension(); if (thisExtension == null) { return -1; } if (thatExtension == null) { return 1; } thisExtension = thisExtension.toLowerCase(); if ("xml".equals(thisExtension) || "pom".equals(thisExtension)) { return 1; } thatExtension = thatExtension.toLowerCase(); if ("xml".equals(thatExtension) || "pom".equals(thatExtension)) { return -1; } return this.deployDetails.compareTo(that.deployDetails); }

Target:
public int compareTo(GradleDeployDetails that) { if (this.publishArtifact == null) { return -1; } if (that.publishArtifact == null) { return 1; } int compareDeployDetails = this.deployDetails.compareTo(that.deployDetails); if (compareDeployDetails == 0) { return 0; } String thisExtension = this.publishArtifact.getExtension(); String thatExtension = that.publishArtifact.getExtension(); if (thisExtension == null) { return -1; } if (thatExtension == null) { return 1; } thisExtension = thisExtension.toLowerCase(); if ("xml".equals(thisExtension) || "pom".equals(thisExtension)) { return 1; } thatExtension = thatExtension.toLowerCase(); if ("xml".equals(thatExtension) || "pom".equals(thatExtension)) { return -1; } return compareDeployDetails; }
Source:
public synchronized Object evaluate( String xpathExpressionKey, QName returnType, NamespaceContext nsContext) throws XPathExpressionException { XPathCache xpc = new XPathCache(); xpc.getXPath().setNamespaceContext(nsContext); XPathExpression compiledExpression = xpc.getCompiledExpression(xpathExpressionKey); Thread thread = Thread.currentThread(); ClassLoader loader = thread.getContextClassLoader(); thread.setContextClassLoader(this.getClass().getClassLoader()); DocumentBuilder documentBuilder; byte[] array; try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) { documentBuilder = dbf.newDocumentBuilder(); TransformerFactory transformerFactory = XML_UTILS.getSecureXmlTransformerFactory(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(document); StreamResult result = new StreamResult(bos); transformer.transform(source, result); array = bos.toByteArray(); } catch (IOException | ParserConfigurationException | TransformerException e) { throw new XPathExpressionException(e); } try (ByteArrayInputStream bis = new ByteArrayInputStream(array)) { return compiledExpression.evaluate(documentBuilder.parse(bis), returnType); } catch (IOException | SAXException e) { throw new XPathExpressionException(e); } finally { thread.setContextClassLoader(loader); } }

Target:
public synchronized Object evaluate( String xpathExpressionKey, QName returnType, NamespaceContext nsContext) throws XPathExpressionException { XPathCache.getXPath().setNamespaceContext(nsContext); XPathExpression compiledExpression = XPathCache.getCompiledExpression(xpathExpressionKey); Thread thread = Thread.currentThread(); ClassLoader loader = thread.getContextClassLoader(); thread.setContextClassLoader(this.getClass().getClassLoader()); DocumentBuilder documentBuilder; byte[] array; try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) { documentBuilder = dbf.newDocumentBuilder(); TransformerFactory transformerFactory = XML_UTILS.getSecureXmlTransformerFactory(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(document); StreamResult result = new StreamResult(bos); transformer.transform(source, result); array = bos.toByteArray(); } catch (IOException | ParserConfigurationException | TransformerException e) { throw new XPathExpressionException(e); } try (ByteArrayInputStream bis = new ByteArrayInputStream(array)) { return compiledExpression.evaluate(documentBuilder.parse(bis), returnType); } catch (IOException | SAXException e) { throw new XPathExpressionException(e); } finally { thread.setContextClassLoader(loader); } }
Source:
private Object writeReplace() { synchronized (saving) { if (saving.contains(this)) { return this; } else { LOGGER.log(Level.WARNING, "JENKINS-45892: reference to {0} being saved but not at top level", this); return new Replacer(this); } } }

Target:
private Object writeReplace() { return XmlFile.replaceIfNotAtTopLevel(this, () -> new Replacer(this)); }
Source:
public void close() { try { isOpen = false; cache.close(); helixStore.stop(); } catch (Exception e) { logger.error("Exception occurred when closing HelixAccountService.", e); } }

Target:
public void close() { if (isOpen) { try { isOpen = false; helixStore.stop(); } catch (Exception e) { logger.error("Exception occurred when closing HelixAccountService.", e); } } }
Source:
public AuthScheme create(final HttpContext context) { Boolean localStripPort = (Boolean) context.getAttribute(CONTEXT_ATTRIBUTE_STRIP_PORT); return new KerberosScheme(localStripPort != null ? localStripPort : isStripPort(), isUseCanonicalHostname()); }

Target:
public AuthScheme create(final HttpContext context) { Boolean localStripPort = (Boolean) context.getAttribute(CONTEXT_ATTRIBUTE_STRIP_PORT); Boolean stripPort = localStripPort != null ? localStripPort : isStripPort(); return new KerberosScheme(stripPort, isUseCanonicalHostname()); }
Source:
public void getOrderGroupsByEncounter_shouldFailGivenNullEncounter() { OrderGroup orderGroup = new OrderGroup(); Encounter nullEncounter = null; orderGroup.setEncounter(nullEncounter); dao.getOrderGroupsByEncounter(nullEncounter); }

Target:
public void getOrderGroupsByEncounter_shouldFailGivenNullEncounter() { dao.getOrderGroupsByEncounter(null); }
Source:
public void testNotAvailableStartNotExistReplicationSlot() throws Exception { exception.expect(PSQLException.class); exception.expectMessage(CoreMatchers.containsString("does not exist")); exception.reportMissingExceptionWithMessage( "For logical decoding replication slot name it required parameter " + "that should be create on server before start replication" ); PGConnection pgConnection = (PGConnection) replConnection; LogSequenceNumber lsn = getCurrentLSN(); PGReplicationStream stream = pgConnection .replicationStream() .logical() .withSlotName("notExistSlotName") .withStartPosition(lsn) .start(); }

Target:
public void testNotAvailableStartNotExistReplicationSlot() throws Exception { PGConnection pgConnection = (PGConnection) replConnection; LogSequenceNumber lsn = getCurrentLSN(); try { PGReplicationStream stream = pgConnection .getReplicationAPI() .replicationStream() .logical() .withSlotName("notExistSlotName") .withStartPosition(lsn) .start(); fail("For logical decoding replication slot name it required parameter " + "that should be create on server before start replication"); } catch (PSQLException e) { String state = e.getSQLState(); assertThat("When replication slot doesn't exists, server can't start replication " + "and should throw exception about it", state, equalTo(PSQLState.UNDEFINED_OBJECT.getState()) ); } }
Source:
private SearchResultGroup[] getGroupedMatches() { final Map<IResource, List<SearchMatch>> grouped= new HashMap<>(); List<SearchMatch> matches= null; IResource resource= null; SearchMatch match= null; for (final Iterator<?> iterator= getSearchMatches().iterator(); iterator.hasNext();) { match= (SearchMatch) iterator.next(); resource= match.getResource(); if (!grouped.containsKey(resource)) grouped.put(resource, new ArrayList<SearchMatch>(4)); matches= grouped.get(resource); matches.add(match); } if (fBinary) { final Collection<IResource> collection= getCollector().getBinaryResources(); for (final Iterator<IResource> iterator= grouped.keySet().iterator(); iterator.hasNext();) { resource= iterator.next(); if (collection.contains(resource)) iterator.remove(); } } final SearchResultGroup[] result= new SearchResultGroup[grouped.size()]; int index= 0; for (final Iterator<IResource> iterator= grouped.keySet().iterator(); iterator.hasNext();) { resource= iterator.next(); matches= grouped.get(resource); result[index++]= new SearchResultGroup(resource, matches.toArray(new SearchMatch[matches.size()])); } return result; }

Target:
private SearchResultGroup[] getGroupedMatches() { final Map<IResource, List<SearchMatch>> grouped= new HashMap<>(); List<SearchMatch> matches= null; IResource resource= null; SearchMatch match= null; for (final Iterator<?> iterator= getSearchMatches().iterator(); iterator.hasNext();) { match= (SearchMatch) iterator.next(); resource= match.getResource(); if (!grouped.containsKey(resource)) grouped.put(resource, new ArrayList<SearchMatch>(4)); matches= grouped.get(resource); matches.add(match); } if (fBinary) { final Collection<IResource> collection= getCollector().getBinaryResources(); grouped.keySet().removeAll(collection); } final SearchResultGroup[] result= new SearchResultGroup[grouped.size()]; int index= 0; for (final List<SearchMatch> searchMatches : grouped.values()) { result[index++]= new SearchResultGroup(resource, searchMatches.toArray(new SearchMatch[searchMatches.size()])); } return result; }
Source:
private LiveReplicaStatus computeDataReplicationStatus(Map<Domain, Map<Integer, Set<Host>>> domainToPartitionToHostsFullyServing, Set<DomainAndVersion> domainVersions, Host host) throws IOException { Set<Domain> relevantDomains = new HashSet<Domain>(); for (DomainAndVersion domainVersion : domainVersions) { relevantDomains.add(domainVersion.getDomain()); } LiveReplicaStatus worstStatus = LiveReplicaStatus.OVER_REPLICATED; for (HostDomain hostDomain : host.getAssignedDomains()) { Domain domain = hostDomain.getDomain(); if (relevantDomains.contains(domain)) { Map<Integer, Set<Host>> partitionToNumFullyServing = domainToPartitionToHostsFullyServing.get(hostDomain.getDomain()); if (partitionToNumFullyServing == null) { return LiveReplicaStatus.UNDER_REPLICATED; } for (HostDomainPartition partition : hostDomain.getPartitions()) { if (partitionToNumFullyServing.containsKey(partition.getPartitionNumber())) { Set<Host> servingHosts = partitionToNumFullyServing.get(partition.getPartitionNumber()); worstStatus = LiveReplicaStatus.min( worstStatus, statusFor(servingHosts.size(), minServingReplicas) ); if (availablilityBucketKey != null) { worstStatus = LiveReplicaStatus.min( worstStatus, statusFor( (int)servingHosts.stream().filter(input -> sameBucket(host, input)).count(), minServingAvailabilityBucketReplicas ) ); } } } } } return worstStatus; }

Target:
private LiveReplicaStatus computeDataReplicationStatus(Map<Domain, Map<Integer, Set<Host>>> domainToPartitionToHostsFullyServing, Set<DomainAndVersion> domainVersions, Host host) throws IOException { Set<Domain> relevantDomains = new HashSet<Domain>(); for (DomainAndVersion domainVersion : domainVersions) { relevantDomains.add(domainVersion.getDomain()); } Set<LiveReplicaStatus> allStatuses = EnumSet.of(LiveReplicaStatus.OVER_REPLICATED); for (HostDomain hostDomain : host.getAssignedDomains()) { Domain domain = hostDomain.getDomain(); if (relevantDomains.contains(domain)) { Map<Integer, Set<Host>> partitionToNumFullyServing = domainToPartitionToHostsFullyServing.get(hostDomain.getDomain()); if (partitionToNumFullyServing == null) { return LiveReplicaStatus.UNDER_REPLICATED; } for (HostDomainPartition partition : hostDomain.getPartitions()) { if (partitionToNumFullyServing.containsKey(partition.getPartitionNumber())) { Set<Host> servingHosts = partitionToNumFullyServing.get(partition.getPartitionNumber()); allStatuses.add(statusFor(servingHosts.size(), minServingReplicas)); if (availabilityBucketKey != null) { allStatuses.add(statusFor( servingHosts.stream().filter(input -> sameBucket(host, input)).count(), minServingAvailabilityBucketReplicas )); } } } } } return Collections.min(allStatuses); }
Source:
public static native int posix_fadvise(int fd, long offset, long len, int flag) throws LastErrorException; private NativeIO()

Target:
private static native int posix_fadvise(int fd, long offset, long len, int flag) throws LastErrorException; private NativeIO()
Source:
public void handleRequest(HttpServerExchange httpExchange) throws Exception { SecurityIdentity identity = getElytronEndpoint().getElytronComponent().getSecurityDomain().getCurrentSecurityIdentity(); if (identity != null) { Set<String> roles = new HashSet<>(); Roles identityRoles = identity.getRoles(); if (identityRoles != null) { for (String roleName : identityRoles) { roles.add(roleName); } } if (isAllowed(roles, getElytronEndpoint().getAllowedRolesList())) { super.handleRequest(httpExchange); } else { httpExchange.setStatusCode(StatusCodes.FORBIDDEN); } return; } super.handleRequest(httpExchange); }

Target:
public void handleRequest(HttpServerExchange httpExchange) throws Exception { SecurityIdentity identity = getElytronEndpoint().getElytronComponent().getSecurityDomain().getCurrentSecurityIdentity(); if (identity != null) { Set<String> roles = new HashSet<>(); Roles identityRoles = identity.getRoles(); if (identityRoles != null) { for (String roleName : identityRoles) { roles.add(roleName); } } if (isAllowed(roles, getElytronEndpoint().getAllowedRolesList())) { super.handleRequest(httpExchange); } else { httpExchange.setStatusCode(StatusCodes.FORBIDDEN); httpExchange.endExchange(); } return; } super.handleRequest(httpExchange); }
Source:
private void createSelectColumn( CharSequence columnName, ExpressionNode columnAst, QueryModel validatingModel, QueryModel translatingModel, QueryModel innerModel, QueryModel analyticModel, QueryModel groupByModel, QueryModel outerModel, QueryModel distinctModel ) throws SqlException { LowerCaseCharSequenceObjHashMap<CharSequence> translatingAliasMap = translatingModel.getColumnNameToAliasMap(); int index = translatingAliasMap.keyIndex(columnAst.token); if (index < 0) { final CharSequence translatedColumnName = translatingAliasMap.valueAt(index); final CharSequence alias = createColumnAlias(columnName, groupByModel); final QueryColumn translatedColumn = nextColumn(alias, translatedColumnName); innerModel.addBottomUpColumn(translatedColumn); groupByModel.addBottomUpColumn(translatedColumn); analyticModel.addBottomUpColumn(translatedColumn); outerModel.addBottomUpColumn(translatedColumn); distinctModel.addBottomUpColumn(translatedColumn); } else { final CharSequence alias = createColumnAlias(columnName, translatingModel); addColumnToTranslatingModel( queryColumnPool.next().of( alias, columnAst ), translatingModel, validatingModel ); final QueryColumn translatedColumn = nextColumn(alias); innerModel.addBottomUpColumn(translatedColumn); analyticModel.addBottomUpColumn(translatedColumn); groupByModel.addBottomUpColumn(translatedColumn); outerModel.addBottomUpColumn(translatedColumn); distinctModel.addBottomUpColumn(translatedColumn); } }

Target:
private void createSelectColumn( CharSequence columnName, ExpressionNode columnAst, QueryModel validatingModel, QueryModel translatingModel, QueryModel innerModel, QueryModel analyticModel, QueryModel groupByModel, QueryModel outerModel, QueryModel distinctModel ) throws SqlException { LowerCaseCharSequenceObjHashMap<CharSequence> translatingAliasMap = translatingModel.getColumnNameToAliasMap(); int index = translatingAliasMap.keyIndex(columnAst.token); if (index < 0) { final CharSequence translatedColumnName = translatingAliasMap.valueAtQuick(index); final CharSequence alias = createColumnAlias(columnName, groupByModel); final QueryColumn translatedColumn = nextColumn(alias, translatedColumnName); innerModel.addBottomUpColumn(translatedColumn); groupByModel.addBottomUpColumn(translatedColumn); analyticModel.addBottomUpColumn(translatedColumn); outerModel.addBottomUpColumn(translatedColumn); distinctModel.addBottomUpColumn(translatedColumn); } else { final CharSequence alias = createColumnAlias(columnName, translatingModel); addColumnToTranslatingModel( queryColumnPool.next().of( alias, columnAst ), translatingModel, validatingModel ); final QueryColumn translatedColumn = nextColumn(alias); innerModel.addBottomUpColumn(translatedColumn); analyticModel.addBottomUpColumn(translatedColumn); groupByModel.addBottomUpColumn(translatedColumn); outerModel.addBottomUpColumn(translatedColumn); distinctModel.addBottomUpColumn(translatedColumn); } }
Source:
public void testWaffleLong() throws Exception { stmt.setLong(1, 3); replay(stmt); foreman.waffle(Object.class, new Long(3L), null).apply(1, stmt, null); }

Target:
public void testWaffleLong() throws Exception { foreman.waffle(Object.class, new Long(3L), null).apply(1, stmt, null); verify(stmt).setLong(1, 3); }
Source:
public String toString() { return MoreObjects.toStringHelper(this) .add("name", this.name) .toString(); }

Target:
public String toString() { return Objects.toStringHelper(this) .add("name", this.name) .toString(); }
Source:
protected HazelcastInstance testMultiMapPutAllSetup() { MultiMapConfig multiMapConfig1 = new MultiMapConfig() .setName("testMultiMapPutAllMapList") .setValueCollectionType("LIST") .setBinary(false); MultiMapConfig multiMapConfig2 = new MultiMapConfig() .setName("testMultiMapPutAllMapSet") .setValueCollectionType("SET") .setBinary(false); MultiMapConfig multiMapConfig3 = new MultiMapConfig() .setName("expectedMultiMap1") .setValueCollectionType("LIST") .setBinary(false); Config cfg = smallInstanceConfig() .addMultiMapConfig(multiMapConfig1) .addMultiMapConfig(multiMapConfig2) .addMultiMapConfig(multiMapConfig3); HazelcastInstance hz = createHazelcastInstanceFactory(1) .newInstances(cfg)[0]; Accessors.getNode(hz).getClusterService().changeClusterVersion(Version.of(4, 1)); return hz; }

Target:
protected HazelcastInstance testMultiMapPutAllSetup() { MultiMapConfig multiMapConfig1 = new MultiMapConfig() .setName("testMultiMapPutAllMapList") .setValueCollectionType(MultiMapConfig.ValueCollectionType.LIST) .setBinary(false); MultiMapConfig multiMapConfig2 = new MultiMapConfig() .setName("testMultiMapPutAllMapSet") .setValueCollectionType(MultiMapConfig.ValueCollectionType.SET) .setBinary(false); Config cfg = smallInstanceConfig() .addMultiMapConfig(multiMapConfig1) .addMultiMapConfig(multiMapConfig2); HazelcastInstance hz = createHazelcastInstanceFactory(1) .newInstances(cfg)[0]; return hz; }
Source:
default Function1<Integer, Option<T>> lift() { return i -> Option.when(i < length() && i >= 0, () -> apply(i)); }

Target:
default Function1<Integer, Option<T>> lift() { return i -> (i >= 0 && i < length()) ? Option.some(apply(i)) : Option.none(); }
Source:
public int hashCode() { int hash = 17; hash = hash * 31 + Objects.hash(checkType); hash = hash * 31 + maxConcurrentJobs; hash = hash * 31 + Objects.hash(uniqueRuleId); return hash; }

Target:
public int hashCode() { return Objects.hash(checkType, id, maxConcurrentJobs, maxConcurrentExpensiveJobs); }
Source:
protected void enqueueTupleForProcessing(QUEUETUPLE QUEUETUPLE) { WorkItem item = new WorkItem(QUEUETUPLE); waitingTuples.add(item); item.taskHandle = executor.submit(new Processor(item)); item.processState = State.SUBMITTED; }

Target:
protected void enqueueTupleForProcessing(QUEUETUPLE QUEUETUPLE) { WorkItem item = new WorkItem(QUEUETUPLE); item.processState = State.SUBMITTED; waitingTuples.add(item); item.taskHandle = executor.submit(new Processor(item)); }
Source:
public void setUpItem() throws Exception { Response<SandboxPublicTokenCreateResponse> createResponse = client().service().sandboxPublicTokenCreate(new SandboxPublicTokenCreateRequest(setupItemInstitutionId(), setupItemProducts())).execute(); assertSuccessResponse(createResponse); Response<ItemPublicTokenExchangeResponse> response = client().service().itemPublicTokenExchange(new ItemPublicTokenExchangeRequest(createResponse.body().getPublicToken())).execute(); assertSuccessResponse(response); exchangeTokenResponse = response.body(); Response<ItemGetResponse> itemGetResponse = client().service().itemGet(new ItemGetRequest(exchangeTokenResponse.getAccessToken())).execute(); assertSuccessResponse(itemGetResponse); item = itemGetResponse.body().getItem(); }

Target:
public void setUpItem() throws Exception { Response<SandboxPublicTokenCreateResponse> createResponse = client().service().sandboxPublicTokenCreate(new SandboxPublicTokenCreateRequest(setupItemInstitutionId(), setupItemProducts())).execute(); assertSuccessResponse(createResponse); Response<ItemPublicTokenExchangeResponse> response = client().service().itemPublicTokenExchange(new ItemPublicTokenExchangeRequest(createResponse.body().getPublicToken())).execute(); assertSuccessResponse(response); this.exchangeTokenResponse = response.body(); Response<ItemGetResponse> itemGetResponse = client().service().itemGet(new ItemGetRequest(exchangeTokenResponse.getAccessToken())).execute(); assertSuccessResponse(itemGetResponse); item = itemGetResponse.body().getItem(); }
Source:
public List<CourseGroupDAO> findLecturingCourseGroups(final String userId) { return getHibernateTemplate().executeFind(new HibernateCallback(){ public Object doInHibernate(Session session) throws HibernateException, SQLException { Query query = session.createSQLQuery("select distinct " + "cg.muid, cg.courseId, cg.title, cg.dept, cg.departmentName, " + "cg.subunit, cg.subunitName, cg.description, cg.supervisorApproval, " + "cg.administratorApproval, cg.hideGroup, cg.deleted, cg.contactEmail, " + "cg.regulations, cg.visibility, cg.source, cg.prerequisite " + "from course_group cg " + "LEFT JOIN course_group_component cgc on cgc.courseGroupMuid = cg.muid " + "LEFT JOIN course_component cc on cgc.courseComponentMuid = cc.muid " + "where cc.teacherName = :userId").addEntity(CourseGroupDAO.class); query.setString("userId", userId); return query.list(); } }); }

Target:
public List<CourseGroupDAO> findLecturingCourseGroups(final String userId) { return getHibernateTemplate().executeFind(new HibernateCallback(){ public Object doInHibernate(Session session) throws HibernateException, SQLException { Query query = session.createSQLQuery("select distinct cg.* " + "from course_group cg " + "LEFT JOIN course_group_component cgc on cgc.courseGroupMuid = cg.muid " + "LEFT JOIN course_component cc on cgc.courseComponentMuid = cc.muid " + "where cc.teacher = :userId").addEntity(CourseGroupDAO.class); query.setString("userId", userId); return query.list(); } }); }
Source:
public void onLoad(Run<?,?> r) { this.build = r; if( this.projectActions == null ) { this.projectActions = new ArrayList<>(); } this.projectActions.add(new SloccountProjectAction(this.build.getParent(), this.numBuildsInGraph)); }

Target:
public void onLoad(Run<?,?> r) { this.build = r; if( this.projectActions == null ) { this.projectActions = new ArrayList<>(); } this.projectActions.add(new SloccountProjectAction(this.build.getParent(), this.numBuildsInGraph)); this.result.setOwner(r); }
Source:
public AccessResultCode execute(final ClientConnection conn, final List<SpecialDay> specialDays) throws IOException, ProtocolAdapterException { final ArrayList<DataObject> specialDayEntries = new ArrayList<DataObject>(); final int i = 0; for (final SpecialDay specialDay : specialDays) { final ArrayList<DataObject> specDayEntry = new ArrayList<DataObject>(); specDayEntry.add(DataObject.newUInteger32Data(i)); specDayEntry.add(this.dlmsHelperService.dateStringToOctetString(specialDay.getSpecialDayDate())); specDayEntry.add(DataObject.newUInteger8Data((short) i)); final DataObject dayStruct = DataObject.newStructureData(specDayEntry); specialDayEntries.add(dayStruct); } final DataObject arrayData = DataObject.newArrayData(specialDayEntries); final RequestParameterFactory factory = new RequestParameterFactory(CLASS_ID, OBIS_CODE, ATTRIBUTE_ID); final SetRequestParameter request = factory.createSetRequestParameter(arrayData); return conn.set(request).get(0); }

Target:
public AccessResultCode execute(final ClientConnection conn, final List<SpecialDay> specialDays) throws IOException, ProtocolAdapterException { final ArrayList<DataObject> specialDayEntries = new ArrayList<DataObject>(); int i = 0; for (final SpecialDay specialDay : specialDays) { final ArrayList<DataObject> specDayEntry = new ArrayList<DataObject>(); specDayEntry.add(DataObject.newUInteger16Data(i)); specDayEntry.add(this.dlmsHelperService.dateStringToOctetString(specialDay.getSpecialDayDate())); specDayEntry.add(DataObject.newUInteger8Data((short) specialDay.getDayId())); final DataObject dayStruct = DataObject.newStructureData(specDayEntry); specialDayEntries.add(dayStruct); i += 1; } final DataObject arrayData = DataObject.newArrayData(specialDayEntries); final RequestParameterFactory factory = new RequestParameterFactory(CLASS_ID, OBIS_CODE, ATTRIBUTE_ID); final SetRequestParameter request = factory.createSetRequestParameter(arrayData); return conn.set(request).get(0); }
Source:
public int getSmsCapacityOnIcc() { mContext.enforceCallingOrSelfPermission( android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, "getSmsCapacityOnIcc"); int numberOnIcc = 0; if (mPhone.getIccRecordsLoaded()) { final UiccProfile uiccProfile = UiccController.getInstance() .getUiccProfileForPhone(mPhone.getPhoneId()); IccRecords iccRecords = null; if(uiccProfile != null) { iccRecords = uiccProfile.getIccRecords(); } if(uiccProfile != null && iccRecords != null) { numberOnIcc = iccRecords.getSmsCapacityOnIcc(); } else { log("UiccProfile = " + uiccProfile + "IccRecords = " + iccRecords); } } else { log("getSmsCapacityOnIcc - aborting, no icc card present."); } log("getSmsCapacityOnIcc().numberOnIcc = " + numberOnIcc); return numberOnIcc; }

Target:
public int getSmsCapacityOnIcc() { mContext.enforceCallingOrSelfPermission( android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, "getSmsCapacityOnIcc"); int numberOnIcc = 0; if (mPhone.getIccRecordsLoaded()) { final UiccProfile uiccProfile = UiccController.getInstance() .getUiccProfileForPhone(mPhone.getPhoneId()); if(uiccProfile != null) { numberOnIcc = uiccProfile.getIccRecords().getSmsCapacityOnIcc(); } else { loge("uiccProfile is null"); } } else { loge("getSmsCapacityOnIcc - aborting, no icc card present."); } log("getSmsCapacityOnIcc().numberOnIcc = " + numberOnIcc); return numberOnIcc; }
Source:
public List<ApplicationInterfaceDescription> getApplicationInterfaces(Map<String, String> filters) throws AppCatalogException { if(filters.containsKey(DBConstants.ApplicationInterface.APPLICATION_NAME)) { Map<String, Object> queryParameters = new HashMap<>(); queryParameters.put(DBConstants.ApplicationInterface.APPLICATION_NAME, filters.get(DBConstants.ApplicationInterface.APPLICATION_NAME)); List<ApplicationInterfaceDescription> applicationInterfaceDescriptionList = select(QueryConstants.FIND_APPLICATION_INTERFACES_FOR_APPLICATION_NAME, -1,0, queryParameters); return applicationInterfaceDescriptionList; } else { logger.error("Unsupported field name for app interface.", new IllegalArgumentException()); throw new IllegalArgumentException("Unsupported field name for app interface."); } }

Target:
public List<ApplicationInterfaceDescription> getApplicationInterfaces(Map<String, String> filters) throws AppCatalogException { if(filters.containsKey(DBConstants.ApplicationInterface.APPLICATION_NAME)) { logger.debug("Fetching Application Interfaces for given Application Name"); Map<String, Object> queryParameters = new HashMap<>(); queryParameters.put(DBConstants.ApplicationInterface.APPLICATION_NAME, filters.get(DBConstants.ApplicationInterface.APPLICATION_NAME)); List<ApplicationInterfaceDescription> applicationInterfaceDescriptionList = select(QueryConstants.FIND_APPLICATION_INTERFACES_FOR_APPLICATION_NAME, -1,0, queryParameters); return applicationInterfaceDescriptionList; } else { logger.error("Unsupported field name for app interface."); throw new IllegalArgumentException("Unsupported field name for app interface."); } }
Source:
static String getAsNtriples() { return Arrays.asList(getElasticsearchDocuments().getHits().getHits()) .parallelStream() .flatMap( hit -> Stream.of(toRdf(cleanseEndtime(hit.getSourceAsString())))) .collect(Collectors.joining()); }

Target:
private static String getAsNtriples() { return Arrays.asList(getElasticsearchDocuments().getHits().getHits()) .parallelStream() .map(hit -> toRdf(cleanseEndtime(hit.getSourceAsString()))) .collect(Collectors.joining()); }
Source:
private boolean isLeftAddOrRightDelete(ReferenceChange diff) { return (diff.getKind() == DifferenceKind.ADD && diff.getSource() == DifferenceSource.LEFT) || (diff.getKind() == DifferenceKind.DELETE && diff.getSource() == DifferenceSource.RIGHT); }

Target:
private boolean isLeftAddOrRightDelete(ReferenceChange diff) { if (diff.getSource() == DifferenceSource.LEFT) { return diff.getKind() == DifferenceKind.ADD; } else { return diff.getKind() == DifferenceKind.DELETE; } }
Source:
public Optional<String> getGDALWrapperJarVersion() { if (isAvailable()) { Version v = GeoTools.getVersion(gdal.class); if (v == null) { return Optional.empty(); } return Optional.ofNullable(v.toString()); } else { return "unavailable"; } }

Target:
public Optional<String> getGDALWrapperJarVersion() { if (isAvailable()) { Version v = GeoTools.getVersion(gdal.class); if (v == null) { return Optional.empty(); } return Optional.ofNullable(v.toString()); } else { return Optional.ofNullable("unavailable"); } }
Source:
public void setupExecutors() throws ExecutorManagerException { activeExecutors.clear(); if (azkProps.containsKey("executor.port")) { String executorHost = azkProps.getString("executor.host", "localhost"); int executorPort = azkProps.getInt("executor.port"); Executor executor = executorLoader.fetchExecutor(executorHost, executorPort); if (executor == null) { executor = executorLoader.addExecutor(executorHost, executorPort); } else if (!executor.isActive()) { executor.setActive(true); executorLoader.updateExecutor(executor); } activeExecutors.add(new Executor(executor.getId(), executorHost, executorPort, true)); } if (azkProps.getBoolean(AZKABAN_USE_MULTIPLE_EXECUTORS, false)) { activeExecutors.addAll(executorLoader.fetchActiveExecutors()); } if (activeExecutors.isEmpty()) { throw new ExecutorManagerException("No active executor found"); } }

Target:
public void setupExecutors() throws ExecutorManagerException { Set<Executor> newExecutors = new HashSet<Executor>(); if (isMultiExecutorMode()) { logger.info("Initializing multi executors from database"); newExecutors.addAll(executorLoader.fetchActiveExecutors()); } else if (azkProps.containsKey("executor.port")) { String executorHost = azkProps.getString("executor.host", "localhost"); int executorPort = azkProps.getInt("executor.port"); logger.info(String.format("Initializing local executor %s:%d", executorHost, executorPort)); Executor executor = executorLoader.fetchExecutor(executorHost, executorPort); if (executor == null) { executor = executorLoader.addExecutor(executorHost, executorPort); } else if (!executor.isActive()) { executor.setActive(true); executorLoader.updateExecutor(executor); } newExecutors.add(new Executor(executor.getId(), executorHost, executorPort, true)); } if (newExecutors.isEmpty()) { throw new ExecutorManagerException("No active executor found"); } else if(newExecutors.size() > 1 && !isMultiExecutorMode()) { throw new ExecutorManagerException("Multiple local executors specified"); } else { activeExecutors.clear(); activeExecutors.addAll(newExecutors); } }
Source:
public EncounterType saveEncounterType(EncounterType encounterType) throws EncounterTypeLockedException { sessionFactory.getCurrentSession().saveOrUpdate(encounterType); return encounterType; }

Target:
public EncounterType saveEncounterType(EncounterType encounterType) { sessionFactory.getCurrentSession().saveOrUpdate(encounterType); return encounterType; }
Source:
public ExecutorStateEvent(ExecutorService executor, LeaseCoordinator leaseCoordinator) { if (executor instanceof ThreadPoolExecutor) { ThreadPoolExecutor ex = (ThreadPoolExecutor) executor; this.currentQueueSize = ex.getQueue().size(); this.activeThreads = ex.getActiveCount(); this.coreThreads = ex.getCorePoolSize(); this.largestPoolSize = ex.getLargestPoolSize(); this.maximumPoolSize = ex.getMaximumPoolSize(); } this.leasesOwned = leaseCoordinator.getAssignments().size(); }

Target:
ExecutorStateEvent(ExecutorService executor, LeaseCoordinator leaseCoordinator) { if (executor instanceof ThreadPoolExecutor) { this.isThreadPoolExecutor = true; ThreadPoolExecutor ex = (ThreadPoolExecutor) executor; this.executorName = ex.getClass().getSimpleName(); this.currentQueueSize = ex.getQueue().size(); this.activeThreads = ex.getActiveCount(); this.coreThreads = ex.getCorePoolSize(); this.largestPoolSize = ex.getLargestPoolSize(); this.maximumPoolSize = ex.getMaximumPoolSize(); } this.leasesOwned = leaseCoordinator.getAssignments().size(); }
Source:
public void accept(InputStream input) { InputStream output = null; try { queue.put(input); } catch (InterruptedException e) { e.printStackTrace(); } if((queue.size()% getBatchSize()) > 0) return; switch (getPhase()) { case INITIALIZING: setPhase(WorkPhase.RUNNING); break; case RUNNING: break; case INTERRUPTING: throw new MarkLogicInternalException( "cannot accept more input as current phase is " + getPhase().name()); case INTERRUPTED: throw new MarkLogicInternalException( "cannot accept more input as current phase is " + getPhase().name()); case COMPLETED: throw new MarkLogicInternalException( "cannot accept more input as current phase is " + getPhase().name()); default: throw new MarkLogicInternalException( "unexpected state for " + getEndpointPath() + " during loop: " + getPhase().name()); } List<InputStream> inputStreamList = new ArrayList<InputStream>(); queue.drainTo(inputStreamList); SessionState session = allowsSession() ? getEndpoint().getCaller().newSessionState() : null; logger.trace("input endpoint running endpoint={} count={} state={}", getEndpointPath(), getCallCount(), getEndpointState()); output = getEndpoint().getCaller().call( getEndpoint().getClient(), getEndpointState(), session, getWorkUnit(), inputStreamList.stream() ); if (allowsEndpointState()) { setEndpointState(output); } }

Target:
public void accept(InputStream input) { try { queue.put(input); } catch (InterruptedException e) { e.printStackTrace(); throw new IllegalStateException("InputStream was not added to the queue." + e.getMessage()); } if ((queue.size() % getBatchSize()) > 0) return; switch (getPhase()) { case INITIALIZING: setPhase(WorkPhase.RUNNING); break; case RUNNING: break; case INTERRUPTING: case INTERRUPTED: case COMPLETED: throw new IllegalStateException( "cannot accept more input as current phase is " + getPhase().name()); default: throw new MarkLogicInternalException( "unexpected state for " + getEndpointPath() + " during loop: " + getPhase().name()); } List<InputStream> inputStreamList = new ArrayList<InputStream>(); queue.drainTo(inputStreamList); SessionState session = allowsSession() ? getEndpoint().getCaller().newSessionState() : null; logger.trace("input endpoint running endpoint={} count={} state={}", getEndpointPath(), getCallCount(), getEndpointState()); InputStream output = getEndpoint().getCaller().call(getEndpoint().getClient(), getEndpointState(), session, getWorkUnit(), inputStreamList.stream()); if (allowsEndpointState()) { setEndpointState(output); } }