auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private synchronized void initialize() { if (threadPool == null || commonHttpClient == null) { try { AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { @Override public Void run() { if (threadPool == null) { threadPool = createThreadPool("common", minThreadsShared, maxThreadsShared, keepAliveTimeoutShared); } if (commonHttpClient == null) { commonHttpClient = createHttpClientInternal("common", null, true); logger.info("jetty shared http client created"); } return null; } }); } catch (PrivilegedActionException e) { Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else { throw new IllegalStateException(cause); } } } }

Target:
private synchronized void initialize() { if (threadPool == null || commonHttpClient == null) { try { AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { @Override public Void run() { if (threadPool == null) { threadPool = createThreadPool("common", minThreadsShared, maxThreadsShared, keepAliveTimeoutShared); } if (commonHttpClient == null) { commonHttpClient = createHttpClientInternal("common", null, true); logger.info("jetty shared http client created"); } return null; } }); } catch (PrivilegedActionException e) { Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else { throw new RuntimeException(cause); } } } }
Source:
private void addLabels(String title, Set<String> set, String filter) { if (set.size() > 0) { add(title); } Iterator<String> iterator = set.iterator(); int i = 0; while (iterator.hasNext()) { String nextString = iterator.next(); if (filter != null && filter.equals(nextString)) { filter = null; if (i >= 5) { add(nextString); i++; break; } } if (i < 5) { add(nextString); i++; } } if (i < set.size()) { add("..."); } }

Target:
private void addLabels(String title, Set<String> set, String filter) { if (set.size() > 0) { add(title); } Iterator<String> iterator = set.iterator(); int i = 0; while (iterator.hasNext()) { String nextString = iterator.next(); if (filter != null && filter.equals(nextString)) { filter = null; if (i >= MAX_ROWS) { add(nextString); i++; break; } } if (i < MAX_ROWS) { add(nextString); i++; } } if (i < set.size()) { add("..."); } }
Source:
public SSLContext get() { try { SSLContext sc; sc = SSLContext.getInstance("SSL"); sc.init(null, new TrustManager[] { trustAllCerts }, new SecureRandom()); sc.getDefaultSSLParameters().setProtocols(new String[] { "TLSv1", "TLSv1.1", "TLSv1.2" }); return sc; } catch (Exception e) { throw Throwables.propagate(e); } }

Target:
public SSLContext get() { try { SSLContext sc; sc = SSLContext.getInstance("TLS"); sc.init(null, new TrustManager[] { trustAllCerts }, new SecureRandom()); sc.getDefaultSSLParameters().setProtocols(new String[] { "TLSv1", "TLSv1.1", "TLSv1.2" }); return sc; } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
private void processNestedFields(TreeMap<String, Type> fieldsMap, List<ElasticsearchColumn> columns, List<String> arrays) { if (fieldsMap.size() == 0) { return; } Entry<String, Type> first = fieldsMap.firstEntry(); String field = first.getKey(); Type type = first.getValue(); if (field.contains(".")) { String prefix = field.substring(0, field.lastIndexOf('.')); ImmutableList.Builder<RowType.Field> fieldsBuilder = ImmutableList.builder(); int size = field.split("\\.").length; Iterator<String> iterator = fieldsMap.navigableKeySet().iterator(); while (iterator.hasNext()) { String name = iterator.next(); if (name.split("\\.").length == size && name.startsWith(prefix)) { fieldsBuilder.add(new RowType.Field(Optional.of(name.substring(name.lastIndexOf('.') + 1)), fieldsMap.get(name))); iterator.remove(); continue; } break; } fieldsMap.put(prefix, RowType.from(fieldsBuilder.build())); } else { boolean newFlattenColumn = columns.stream().noneMatch(column -> column.getName().equalsIgnoreCase(field)); if (newFlattenColumn) { columns.add(new ElasticsearchColumn(field, type, field, type.getDisplayName(), arrays.contains(field), -1)); } fieldsMap.remove(field); } processNestedFields(fieldsMap, columns, arrays); }

Target:
private void processNestedFields(TreeMap<String, Type> fieldsMap, List<ElasticsearchColumn> columns, List<String> arrays) { if (fieldsMap.size() == 0) { return; } Entry<String, Type> first = fieldsMap.firstEntry(); String field = first.getKey(); Type type = first.getValue(); if (field.contains(".")) { String prefix = field.substring(0, field.lastIndexOf('.')); ImmutableList.Builder<Field> fieldsBuilder = ImmutableList.builder(); int size = field.split("\\.").length; Iterator<String> iterator = fieldsMap.navigableKeySet().iterator(); while (iterator.hasNext()) { String name = iterator.next(); if (name.split("\\.").length == size && name.startsWith(prefix)) { Optional<String> columnName = Optional.of(name.substring(name.lastIndexOf('.') + 1)); Type columnType = fieldsMap.get(name); Field column = new Field(columnName, columnType); fieldsBuilder.add(column); iterator.remove(); } } fieldsMap.put(prefix, RowType.from(fieldsBuilder.build())); } else { boolean isFlattenColumn = columns.stream() .noneMatch(column -> column.getName().equalsIgnoreCase(field)); if (isFlattenColumn) { columns.add(new ElasticsearchColumn(field, type, field, type.getDisplayName(), arrays.contains(field), -1)); } fieldsMap.remove(field); } processNestedFields(fieldsMap, columns, arrays); }
Source:
public MergeViewerItemProviderConfiguration(AdapterFactory adapterFactory, IDifferenceGroupProvider groupProvider, Predicate<? super EObject> predicate, Comparison comparison, MergeViewerSide side) { this.adapterFactory = adapterFactory; this.groupProvider = groupProvider; this.predicate = predicate; this.comparison = comparison; this.side = side; }

Target:
public MergeViewerItemProviderConfiguration(AdapterFactory adapterFactory, IDifferenceGroupProvider groupProvider, Predicate<? super EObject> predicate, Comparison comparison, MergeViewerSide side) { this.adapterFactory = checkNotNull(adapterFactory); this.groupProvider = checkNotNull(groupProvider); this.predicate = checkNotNull(predicate); this.comparison = checkNotNull(comparison); this.side = checkNotNull(side); }
Source:
public boolean insertInStore(long bucketId, long timeBucket, Slice keySlice, Slice valueSlice) { long timeBucketId = store.getTimeBucketAssigner().getTimeBucketFor(timeBucket); if (timeBucketId != -1) { store.putInBucket(bucketId, timeBucketId, keySlice, valueSlice); return true; } return false; }

Target:
private boolean insertInStore(long bucketId, long timeBucket, Slice keySlice, Slice valueSlice) { long timeBucketId = store.getTimeBucketAssigner().getTimeBucketAndAdjustBoundaries(timeBucket); if (timeBucketId != -1) { store.putInBucket(bucketId, timeBucketId, keySlice, valueSlice); return true; } return false; }
Source:
public PageWithPositionComparator compilePageWithPositionComparator(List<Type> sortTypes, List<Integer> sortChannels, List<SortOrder> sortOrders) { requireNonNull(sortTypes, "sortTypes is null"); requireNonNull(sortChannels, "sortChannels is null"); requireNonNull(sortOrders, "sortOrders is null"); try { return pageWithPositionComparators.get(new PagesIndexComparatorCacheKey(sortTypes, sortChannels, sortOrders)); } catch (ExecutionException e) { throw new RuntimeException(e.getCause()); } }

Target:
public PageWithPositionComparator compilePageWithPositionComparator(List<Type> sortTypes, List<Integer> sortChannels, List<SortOrder> sortOrders) { requireNonNull(sortTypes, "sortTypes is null"); requireNonNull(sortChannels, "sortChannels is null"); requireNonNull(sortOrders, "sortOrders is null"); return pageWithPositionComparators.getUnchecked(new PagesIndexComparatorCacheKey(sortTypes, sortChannels, sortOrders)); }
Source:
public void directSchedulePeriodicallyInputValidation() { try { scheduler.schedulePeriodicallyDirect(null, 1, 1, MINUTES); fail(); } catch (NullPointerException e) { assertEquals("run == null", e.getMessage()); } try { scheduler.schedulePeriodicallyDirect(new CountingRunnable(), 1, 1, null); fail(); } catch (NullPointerException e) { assertEquals("unit == null", e.getMessage()); } }

Target:
public void directSchedulePeriodicallyInputValidation() { try { scheduler.schedulePeriodicallyDirect(null, 1, 1, MINUTES); fail(); } catch (NullPointerException e) { assertEquals("run == null", e.getMessage()); } try { scheduler.schedulePeriodicallyDirect(new CountingRunnable(), 1, -1, MINUTES); fail(); } catch (IllegalArgumentException e) { assertEquals("period < 0: -1", e.getMessage()); } try { scheduler.schedulePeriodicallyDirect(new CountingRunnable(), 1, 1, null); fail(); } catch (NullPointerException e) { assertEquals("unit == null", e.getMessage()); } }
Source:
public void testByteDirect() throws Exception { List<Byte> byteValues = ImmutableList.of(1, 3, 5, 7, 11, 13, 17) .stream() .map(Integer::byteValue) .collect(toList()); List<Map<Integer, TupleDomainFilter>> filters = ImmutableList.of( ImmutableMap.of(0, TupleDomainFilter.BytesValues.of(new byte[][] {{1}, {17}}, false)), ImmutableMap.of(0, TupleDomainFilter.IS_NULL)); tester.testRoundTrip(TINYINT, byteValues, ImmutableList.of(ImmutableMap.of(0, TupleDomainFilter.BytesValues.of(new byte[][] {{1}, {17}}, false)))); tester.testRoundTripTypes(ImmutableList.of(TINYINT, TINYINT), ImmutableList.of(byteValues, reverse(byteValues)), filters); }

Target:
public void testByteDirect() throws Exception { List<Byte> byteValues = ImmutableList.of(1, 3, 5, 7, 11, 13, 17) .stream() .map(Integer::byteValue) .collect(toList()); List<Map<Integer, TupleDomainFilter>> filters = ImmutableList.of( ImmutableMap.of(0, BytesValues.of(new byte[][] {{1}, {17}}, false)), ImmutableMap.of(0, TupleDomainFilter.IS_NULL)); tester.testRoundTrip(TINYINT, byteValues, ImmutableList.of(ImmutableMap.of(0, BytesValues.of(new byte[][] {{1}, {17}}, false)))); tester.testRoundTripTypes(ImmutableList.of(TINYINT, TINYINT), ImmutableList.of(byteValues, reverse(byteValues)), filters); }
Source:
public ReadyCheckResult ready(Cluster cluster, long nowMs) { Map<Node, List<TopicPartition>> readyNodes = new HashMap<>(); long nextReadyCheckDelayMs = Long.MAX_VALUE; Set<String> unknownLeaderTopics = new HashSet<>(); boolean exhausted = this.free.queued() > 0; for (Map.Entry<TopicPartition, Deque<ProducerBatch>> entry : this.batches.entrySet()) { Deque<ProducerBatch> deque = entry.getValue(); synchronized (deque) { ProducerBatch batch = deque.peekFirst(); if (batch != null) { TopicPartition part = entry.getKey(); Node leader = cluster.leaderFor(part); if (leader == null) { unknownLeaderTopics.add(part.topic()); } else if (!isMuted(part, nowMs)) { if (readyNodes.containsKey(leader)) { readyNodes.get(leader).add(entry.getKey()); continue; } long waitedTimeMs = batch.waitedTimeMs(nowMs); boolean backingOff = batch.attempts() > 0 && waitedTimeMs < retryBackoffMs; long timeToWaitMs = backingOff ? retryBackoffMs : lingerMs; boolean full = deque.size() > 1 || batch.isFull(); boolean expired = waitedTimeMs >= timeToWaitMs; boolean sendable = full || expired || exhausted || closed || flushInProgress(); if (sendable && !backingOff) { List<TopicPartition> topicPartitions = new ArrayList<>(); topicPartitions.add(entry.getKey()); readyNodes.put(leader, topicPartitions); } else { long timeLeftMs = Math.max(timeToWaitMs - waitedTimeMs, 0); nextReadyCheckDelayMs = Math.min(timeLeftMs, nextReadyCheckDelayMs); } } } } } return new ReadyCheckResult(readyNodes, nextReadyCheckDelayMs, unknownLeaderTopics); }

Target:
public ReadyCheckResult ready(Cluster cluster, long nowMs) { Map<Node, List<TopicPartition>> readyNodes = new HashMap<>(); long nextReadyCheckDelayMs = Long.MAX_VALUE; Set<String> unknownLeaderTopics = new HashSet<>(); boolean exhausted = this.free.queued() > 0; for (Map.Entry<TopicPartition, Deque<ProducerBatch>> entry : this.batches.entrySet()) { Deque<ProducerBatch> deque = entry.getValue(); synchronized (deque) { ProducerBatch batch = deque.peekFirst(); if (batch != null) { TopicPartition part = entry.getKey(); Node leader = cluster.leaderFor(part); if (leader == null) { unknownLeaderTopics.add(part.topic()); } else if (!isMuted(part, nowMs)) { long waitedTimeMs = batch.waitedTimeMs(nowMs); boolean backingOff = batch.attempts() > 0 && waitedTimeMs < retryBackoffMs; long timeToWaitMs = backingOff ? retryBackoffMs : lingerMs; boolean full = deque.size() > 1 || batch.isFull(); boolean expired = waitedTimeMs >= timeToWaitMs; boolean sendable = full || expired || exhausted || closed || flushInProgress(); if (sendable && !backingOff) { List<TopicPartition> topicPartitions = readyNodes.computeIfAbsent(leader, l -> new ArrayList<>()); topicPartitions.add(entry.getKey()); } else { long timeLeftMs = Math.max(timeToWaitMs - waitedTimeMs, 0); nextReadyCheckDelayMs = Math.min(timeLeftMs, nextReadyCheckDelayMs); } } } } } return new ReadyCheckResult(readyNodes, nextReadyCheckDelayMs, unknownLeaderTopics); }
Source:
public synchronized boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { long now = System.nanoTime(); long end = now + unit.toNanos(timeout); while (count!=0) { long d = end - now; if (d<0) { return false; } wait(d / 1000L); now = System.nanoTime(); } return true; }

Target:
public synchronized boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { long now = System.nanoTime(); long end = now + unit.toNanos(timeout); while (count!=0) { long d = end - now; if (d<0) { return false; } wait(TimeUnit.NANOSECONDS.toMillis(d)); now = System.nanoTime(); } return true; }
Source:
static String createKey(Request data, StringBuilder builder) { if (!TextUtils.isEmpty(data.key)) { String path = data.key; builder.ensureCapacity(path.length() + KEY_PADDING); builder.append(path); } else if (data.uri != null) { String path = data.uri.toString(); builder.ensureCapacity(path.length() + KEY_PADDING); builder.append(path); } else { builder.ensureCapacity(KEY_PADDING); builder.append(data.resourceId); } builder.append('\n'); if (data.rotationDegrees != 0) { builder.append("rotation:").append(data.rotationDegrees); if (data.hasRotationPivot) { builder.append('@').append(data.rotationPivotX).append('x').append(data.rotationPivotY); } builder.append('\n'); } if (data.targetWidth != 0) { builder.append("resize:").append(data.targetWidth).append('x').append(data.targetHeight); builder.append('\n'); } if (data.centerCrop) { builder.append("centerCrop\n"); } else if (data.centerInside) { builder.append("centerInside\n"); } if (data.transformations != null) { for (int i = 0, count = data.transformations.size(); i < count; i++) { builder.append(data.transformations.get(i).key()); builder.append('\n'); } } return builder.toString(); }

Target:
static String createKey(Request data, StringBuilder builder) { if (data.stableKey != null) { String stableKey = data.stableKey; builder.ensureCapacity(stableKey.length() + KEY_PADDING); builder.append(stableKey); } else if (data.uri != null) { String path = data.uri.toString(); builder.ensureCapacity(path.length() + KEY_PADDING); builder.append(path); } else { builder.ensureCapacity(KEY_PADDING); builder.append(data.resourceId); } builder.append('\n'); if (data.rotationDegrees != 0) { builder.append("rotation:").append(data.rotationDegrees); if (data.hasRotationPivot) { builder.append('@').append(data.rotationPivotX).append('x').append(data.rotationPivotY); } builder.append('\n'); } if (data.targetWidth != 0) { builder.append("resize:").append(data.targetWidth).append('x').append(data.targetHeight); builder.append('\n'); } if (data.centerCrop) { builder.append("centerCrop\n"); } else if (data.centerInside) { builder.append("centerInside\n"); } if (data.transformations != null) { for (int i = 0, count = data.transformations.size(); i < count; i++) { builder.append(data.transformations.get(i).key()); builder.append('\n'); } } return builder.toString(); }
Source:
private void readChunk() throws IOException { int hlen = din.readInt(); byte chunkType = din.readByte(); long readTime = System.currentTimeMillis(); long intervalMillis = readTime - lastReadTime.getAndSet(readTime); switch (chunkType) { case NGConstants.CHUNKTYPE_STDIN: InputStream chunkStream = readPayload(in, hlen); synchronized (this) { if (remaining != 0) { throw new IOException("Data received before stdin stream was emptied"); } LOG.log(Level.FINEST, "Got stdin chunk, len {0}", hlen); stdin = chunkStream; remaining = hlen; notifyAll(); } break; case NGConstants.CHUNKTYPE_STDIN_EOF: LOG.log(Level.FINEST, "Got stdin closed chunk"); setEof(); break; case NGConstants.CHUNKTYPE_HEARTBEAT: LOG.log(Level.FINEST, "Got client heartbeat"); ArrayList<NGHeartbeatListener> listeners; synchronized (this) { listeners = new ArrayList<>(heartbeatListeners); } for (NGHeartbeatListener listener : listeners) { listener.heartbeatReceived(intervalMillis); } break; default: LOG.log(Level.WARNING, "Unknown chunk type: {0}", (char) chunkType); throw new IOException("Unknown stream type: " + (char) chunkType); } }

Target:
private void readChunk() throws IOException { int chunkLen = din.readInt(); byte chunkType = din.readByte(); long readTime = System.currentTimeMillis(); switch (chunkType) { case NGConstants.CHUNKTYPE_STDIN: InputStream chunkStream = readPayload(in, chunkLen); synchronized (this) { if (remaining != 0) { throw new IOException("Data received before stdin stream was emptied"); } LOG.log(Level.FINEST, "Got stdin chunk, len {0}", chunkLen); stdin = chunkStream; remaining = chunkLen; notifyAll(); } break; case NGConstants.CHUNKTYPE_STDIN_EOF: LOG.log(Level.FINEST, "Got stdin closed chunk"); setEof(); break; case NGConstants.CHUNKTYPE_HEARTBEAT: LOG.log(Level.FINEST, "Got client heartbeat"); ArrayList<NGHeartbeatListener> listeners; synchronized (this) { listeners = new ArrayList<>(heartbeatListeners); } for (NGHeartbeatListener listener : listeners) { listener.heartbeatReceived(); } break; default: LOG.log(Level.WARNING, "Unknown chunk type: {0}", (char) chunkType); throw new IOException("Unknown stream type: " + (char) chunkType); } }
Source:
public boolean runReruns(HttpRequestProcessorSelector selector) { boolean useful = false; while (true) { RetryHolder retryHolder = getNextRerun(); if (retryHolder != null) { useful = true; if (!retryHolder.retry.tryRerun(selector)) { reschedule(retryHolder.retry, retryHolder.retry.getAttemptDetails().attempt + 1, retryHolder.retry.getAttemptDetails().waitStartTimestamp); } } else { return useful; } } }

Target:
public boolean runReruns(HttpRequestProcessorSelector selector) { boolean useful = false; while (true) { Retry retry = getNextRerun(); if (retry != null) { useful = true; if (!retry.tryRerun(selector, this)) { try { reschedule(retry, retry.getAttemptDetails().attempt + 1, retry.getAttemptDetails().waitStartTimestamp); } catch (RetryFailedOperationException e) { retry.fail(selector, e); } } } else { return useful; } } }
Source:
private void fireOrdered(Set<StoreEventListener<K, V>> listeners, Deque<FireableStoreEventHolder<K, V>> events) { for (FireableStoreEventHolder<K, V> fireableEvent : events) { fireableEvent.markFireable(); BlockingQueue<FireableStoreEventHolder<K, V>> orderedQueue = getOrderedQueue(fireableEvent); FireableStoreEventHolder<K, V> head = orderedQueue.peek(); if (head == fireableEvent) { if (head.markFired()) { for (StoreEventListener<K, V> listener : listeners) { head.fireOn(listener); } orderedQueue.poll(); } else { fireableEvent.waitTillFired(); } fireWaiters(listeners, orderedQueue); } else { try { fireableEvent.waitTillFired(); } catch (RuntimeException e) { throw new RuntimeException("can't wait anymore\nqueue = " + orderedQueue + "\n events = " + events, e); } } } }

Target:
private void fireOrdered(Set<StoreEventListener<K, V>> listeners, Deque<FireableStoreEventHolder<K, V>> events) { for (FireableStoreEventHolder<K, V> fireableEvent : events) { fireableEvent.markFireable(); BlockingQueue<FireableStoreEventHolder<K, V>> orderedQueue = getOrderedQueue(fireableEvent); FireableStoreEventHolder<K, V> head = orderedQueue.peek(); if (head == fireableEvent) { if (head.markFired()) { for (StoreEventListener<K, V> listener : listeners) { head.fireOn(listener); } orderedQueue.poll(); } else { fireableEvent.waitTillFired(); } fireWaiters(listeners, orderedQueue); } else { fireableEvent.waitTillFired(); } } }
Source:
@Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); if (mQuickStartAdapter != null) { outState.putBoolean(KEY_COMPLETED_TASKS_LIST_EXPANDED, mQuickStartAdapter.isCompletedTasksListExpanded()); } }

Target:
public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); if (mQuickStartAdapter != null) { outState.putBoolean(KEY_COMPLETED_TASKS_LIST_EXPANDED, mQuickStartAdapter.isCompletedTasksListExpanded()); } }
Source:
private void startGridAndPopulateCache(int nodes) throws Exception { startGrids(NODE_CNT - 1); startClientGrid(NODE_CNT - 1); IgniteCache<Long, String> cache = grid(0).cache(CACHE_NAME); for (int i = 0; i < KEY_CNT; i++) cache.put((long)i, String.valueOf(i)); }

Target:
private void startGridAndPopulateCache(int nodes) throws Exception { startGrid(0); startClientGridsMultiThreaded(1, NODE_CNT - 1); IgniteCache<Long, String> cache = grid(0).cache(CACHE_NAME); for (int i = 0; i < KEY_CNT; i++) cache.put((long)i, String.valueOf(i)); }
Source:
public void log_when_sonarqube_is_joining_a_cluster () throws IOException, InterruptedException, IllegalAccessException, NoSuchFieldException { TestAppSettings settings = new TestAppSettings(); settings.set(ProcessProperties.CLUSTER_ENABLED, "true"); settings.set(ProcessProperties.CLUSTER_NAME, "sonarqube"); Logger logger = mock(Logger.class); AppStateClusterImpl.setLogger(logger); try (AppStateClusterImpl appStateCluster = new AppStateClusterImpl(settings)) { verify(logger, times(1)) .info(eq("Joined the cluster that contains the following hosts : [{}]"), eq("sonarqube"), anyString()); } }

Target:
public void log_when_sonarqube_is_joining_a_cluster () throws IOException, InterruptedException, IllegalAccessException, NoSuchFieldException { TestAppSettings settings = newClusterSettings(); Logger logger = mock(Logger.class); AppStateClusterImpl.setLogger(logger); try (AppStateClusterImpl appStateCluster = new AppStateClusterImpl(settings)) { verify(logger).info( eq("Joined the cluster that contains the following hosts : [{}]"), eq("sonarqube"), anyString() ); } }
Source:
private static Session getSession(EntityManager em) { Object delegate = em.getDelegate(); if ( delegate == null ) { throw new SearchException( "Trying to use Hibernate Search without an Hibernate EntityManager (no delegate)" ); } else if ( Session.class.isAssignableFrom( delegate.getClass() ) ) { return (Session) delegate; } else if ( EntityManager.class.isAssignableFrom( delegate.getClass() ) ) { delegate = ( (EntityManager) delegate ).getDelegate(); if ( delegate == null ) { throw new SearchException( "Trying to use Hibernate Search without an Hibernate EntityManager (no delegate)" ); } else if ( Session.class.isAssignableFrom( delegate.getClass() ) ) { return (Session) delegate; } else { throw new SearchException( "Trying to use Hibernate Search without an Hibernate EntityManager: " + delegate.getClass() ); } } else { throw new SearchException( "Trying to use Hibernate Search without an Hibernate EntityManager: " + delegate.getClass() ); } }

Target:
private static Session getSession(EntityManager em) { try { return em.unwrap( Session.class ); } catch (PersistenceException e) { throw new SearchException( "Trying to use Hibernate Search with a non-Hibernate EntityManager", e ); } }
Source:
public void init(OverridableConf context, FunctionEval.ParamType types) { if (!hasTimeZone()) { setTimeZone(context.getConf().getSystemTimezone()); } }

Target:
public void init(OverridableConf context, FunctionEval.ParamType types) { setTimeZone(TimeZone.getTimeZone(context.get(SessionVars.TIMEZONE))); }
Source:
default String getDefaultDialect() { return "MYSQL"; }

Target:
default String getDefaultDialect() { return "Hive"; }
Source:
private void generateAddMethod(Method method) { Parameter mainParameter = method.getParameters().stream() .filter(x -> x.getType() instanceof StructType || x.getType() instanceof ListType) .findFirst() .orElse(null); if (mainParameter == null) { System.err.println("Method \"" + method + "\" doesn't have any struct parameter"); return; } Type mainType = mainParameter.getType(); JavaTypeReference mainTypeReference = schemaNames.getXjcTypeReference(mainType); javaBuffer.addImport(Consumes.class); javaBuffer.addImport(POST.class); javaBuffer.addImport(Response.class); javaBuffer.addImports(mainTypeReference.getImports()); generateDoc(method); javaBuffer.addLine("@POST"); javaBuffer.addLine("@Consumes({ %s })", generateMediaTypes()); javaBuffer.addLine(generateResponseReturnMethodSignature("add(%s %s)", mainTypeReference.getText(), javaNames.getJavaMemberStyleName(mainParameter.getName())) ); javaBuffer.addLine(); }

Target:
private void generateAddMethod(Method method) { Parameter mainParameter = method.getParameters().stream() .filter(x -> x.getType() instanceof StructType || x.getType() instanceof ListType) .findFirst() .orElse(null); if (mainParameter == null) { System.err.println("Method \"" + method + "\" doesn't have any struct parameter"); return; } Type mainType = mainParameter.getType(); JavaTypeReference mainTypeReference = schemaNames.getXjcTypeReference(mainType); javaBuffer.addImport(Consumes.class); javaBuffer.addImport(POST.class); javaBuffer.addImport(Response.class); javaBuffer.addImports(mainTypeReference.getImports()); generateDoc(method); javaBuffer.addLine("@POST"); javaBuffer.addLine("@Consumes({ %s })", generateMediaTypes()); generateResponseReturnMethod("add(%s %s)", mainTypeReference.getText(), javaNames.getJavaMemberStyleName(mainParameter.getName())); javaBuffer.addLine(); }
Source:
public DynamicMBeanProvider register() throws JMException { Collection<DynamicMetric<?, ?>> dynamicMetrics = new HashSet<>(); _metricMap.values().forEach(metric -> dynamicMetrics.add(metric.getDynamicMetric())); String mbeanName = String.format("%s=%s, %s=%s", CLUSTER_NAME_KEY, _clusterName, ENTITY_NAME_KEY, _entityName); doRegister(dynamicMetrics, new ObjectName(String.format("%s:%s", MonitorDomainNames.Rebalancer.name(), mbeanName))); return this; }

Target:
public DynamicMBeanProvider register() throws JMException { Collection<DynamicMetric<?, ?>> dynamicMetrics = new HashSet<>(); _metricMap.values().forEach(metric -> dynamicMetrics.add(metric.getDynamicMetric())); String mbeanName = String.format("%s=%s, %s=%s", CLUSTER_NAME_KEY, _clusterName, ENTITY_NAME_KEY, _entityName); doRegister(dynamicMetrics, new ObjectName(String.format("%s:%s", _monitorDomainName, mbeanName))); return this; }
Source:
public Mono<RedisCache> updateResourceAsync() { updateParameters.withTags(this.inner().tags()); return this.manager().inner().getRedis().updateAsync(resourceGroupName(), name(), updateParameters) .map(innerToFluentMap(this)) .filter(redisCache -> !redisCache.provisioningState().equalsIgnoreCase(ProvisioningState.SUCCEEDED.toString())) .flatMap(redisCache -> { SdkContext.sleep(30 * 1000); this.patchScheduleAdded = false; return this.manager().inner().getRedis().getByResourceGroupAsync(resourceGroupName(), name()) .doOnNext( this::setInner) .filter(redisResourceInner -> redisResourceInner.provisioningState().toString() .equalsIgnoreCase(ProvisioningState.SUCCEEDED.toString())) .repeatWhenEmpty( longFlux -> longFlux.flatMap( index -> Mono.delay(SdkContext.getDelayDuration(Duration.ofSeconds(30))) ) ); } ) .then(this.patchSchedules.commitAndGetAllAsync()) .then(this.firewallRules.commitAndGetAllAsync()) .then(Mono.just(this)); }

Target:
public Mono<RedisCache> updateResourceAsync() { updateParameters.withTags(this.inner().tags()); this.patchScheduleAdded = false; return this .manager() .inner() .getRedis() .updateAsync(resourceGroupName(), name(), updateParameters) .map(innerToFluentMap(this)) .filter( redisCache -> !redisCache.provisioningState().equalsIgnoreCase(ProvisioningState.SUCCEEDED.toString())) .flatMapMany( redisCache -> Mono .delay(SdkContext.getDelayDuration(Duration.ofSeconds(30))) .flatMap(o -> manager().inner().getRedis().getByResourceGroupAsync(resourceGroupName(), name())) .doOnNext(this::setInner) .repeat() .takeUntil( redisResourceInner -> redisResourceInner .provisioningState() .toString() .equalsIgnoreCase(ProvisioningState.SUCCEEDED.toString()))) .then(this.patchSchedules.commitAndGetAllAsync()) .then(this.firewallRules.commitAndGetAllAsync()) .then(Mono.just(this)); }
Source:
protected void openConnection() { if (!this.thing.getStatus().equals(ThingStatus.ONLINE)) { for (IpNode receiverNode : receiverNodes.keySet()) { Socket socket = receiverNodes.get(receiverNode); if (socket == null) { try { socket = new Socket(receiverNode.getAddressString(), receiverNode.getPort()); } catch (IOException e) { logger.debug("Could not connect to in {}: ", receiverNode, this.thing.getUID(), e); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "could not connect to " + receiverNode.toString()); return; } } if (socket.isConnected()) { receiverNodes.put(receiverNode, socket); } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); receiverNodes.put(receiverNode, null); return; } } updateStatus(ThingStatus.ONLINE); } }

Target:
protected void openConnection() { if (!this.thing.getStatus().equals(ThingStatus.ONLINE)) { for (IpNode receiverNode : receiverNodes.keySet()) { Socket socket = receiverNodes.get(receiverNode); if (socket == null) { try { socket = new Socket(receiverNode.getAddressString(), receiverNode.getPort()); } catch (IOException e) { logger.debug("Could not connect to in {}: {}", receiverNode, this.thing.getUID(), e.getMessage()); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "could not connect to " + receiverNode.toString()); return; } } if (socket.isConnected()) { receiverNodes.put(receiverNode, socket); } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); receiverNodes.put(receiverNode, null); return; } } updateStatus(ThingStatus.ONLINE); } }
Source:
private void readFileData() throws IOException { final int version = parseInt(); if (version > VALID_GENTRAIN_DATA_TYPE) { throw new IOException("Error. Cannot read file - unknown version " + version + " for gentrain data type"); } manifestName = parseString(); numCodes = parseInt(); initializeArrays(numCodes); for (int i = 0; i < numCodes; i++) { for (InfiniumVcfFields.GENOTYPE_VALUES gtValue : InfiniumVcfFields.GENOTYPE_VALUES.values()) { n[i][gtValue.ordinal()] = parseInt(); } for (InfiniumVcfFields.GENOTYPE_VALUES gtValue : InfiniumVcfFields.GENOTYPE_VALUES.values()) { devR[i][gtValue.ordinal()] = parseFloat(); } for (InfiniumVcfFields.GENOTYPE_VALUES gtValue : InfiniumVcfFields.GENOTYPE_VALUES.values()) { meanR[i][gtValue.ordinal()] = parseFloat(); } for (InfiniumVcfFields.GENOTYPE_VALUES gtValue : InfiniumVcfFields.GENOTYPE_VALUES.values()) { devTheta[i][gtValue.ordinal()] = parseFloat(); } for (InfiniumVcfFields.GENOTYPE_VALUES gtValue : InfiniumVcfFields.GENOTYPE_VALUES.values()) { meanTheta[i][gtValue.ordinal()] = parseFloat(); } skipFloats(15); } for (int i = 0; i < numCodes; i++) { skipFloat(); totalScore[i] = parseFloat(); skipFloat(); skipBoolean(); } for (int i = 0; i < numCodes; i++) { skipString(); } for (int i = 0; i < numCodes; i++) { rsNames[i] = parseString(); if (rsNameToIndex.put(rsNames[i], i) != null) { throw new PicardException("Non-unique rsName '" + rsNames[i] + "' found in cluster file"); } } }

Target:
private void readFileData() throws IOException { final int version = parseInt(); if (version > VALID_GENTRAIN_DATA_TYPE) { throw new IOException("Error. Cannot read file - unknown version " + version + " for gentrain data type"); } manifestName = parseString(); numCodes = parseInt(); initializeArrays(numCodes); for (int i = 0; i < numCodes; i++) { parseInts(n[i]); parseFloats(devR[i]); parseFloats(meanR[i]); parseFloats(devTheta[i]); parseFloats(meanTheta[i]); skipFloats(15); } for (int i = 0; i < numCodes; i++) { skipFloat(); totalScore[i] = parseFloat(); skipFloat(); skipBoolean(); } for (int i = 0; i < numCodes; i++) { skipString(); } for (int i = 0; i < numCodes; i++) { rsNames[i] = parseString(); if (rsNameToIndex.put(rsNames[i], i) != null) { throw new PicardException("Non-unique rsName '" + rsNames[i] + "' found in cluster file"); } } }
Source:
private void handleValue(ObjectInput in) throws IOException { try { Type[] returnType = RpcUtils.getReturnTypes(invocation); setValue(returnType == null || returnType.length == 0 ? in.readObject() : (returnType.length == 1 ? in.readObject((Class<?>) returnType[0]) : in.readObject((Class<?>) returnType[0], returnType[1]))); } catch (ClassNotFoundException e) { rethrow(e); } }

Target:
private void handleValue(ObjectInput in) throws IOException { try { Type[] returnTypes = RpcUtils.getReturnTypes(invocation); Object value = null; if (ArrayUtils.isEmpty(returnTypes)) { value = in.readObject(); } else if (returnTypes.length == 1) { value = in.readObject((Class<?>) returnTypes[0]); } else { value = in.readObject((Class<?>) returnTypes[0], returnTypes[1]); } setValue(value); } catch (ClassNotFoundException e) { rethrow(e); } }
Source:
private void testResultForAbortedParentProcessAndChildProcessInProcessInstanceList(Long parentProcessInstanceId){ Collection<ProcessInstanceDesc> instances = runtimeDataService.getProcessInstancesByParent(parentProcessInstanceId, Arrays.asList(ProcessInstance.STATE_ACTIVE), new QueryContext()); assertNotNull(instances); assertEquals(2, instances.size()); List<Long> processInstanceList = instances.stream().map(p -> p.getId()).collect(Collectors.toList()); processInstanceList.add(0, parentProcessInstanceId); processService.abortProcessInstances(processInstanceList); processService.abortProcessInstances(processInstanceList); ProcessInstance parent = processService.getProcessInstance(parentProcessInstanceId); assertNull(parent); instances = runtimeDataService.getProcessInstancesByParent(parentProcessInstanceId, Arrays.asList(ProcessInstance.STATE_ABORTED), new QueryContext()); assertNotNull(instances); assertEquals(2, instances.size()); }

Target:
private void testResultForAbortedParentProcessAndChildProcessInProcessInstanceList(Long parentProcessInstanceId){ Collection<ProcessInstanceDesc> instances = runtimeDataService.getProcessInstancesByParent(parentProcessInstanceId, Arrays.asList(ProcessInstance.STATE_ACTIVE), new QueryContext()); assertNotNull(instances); assertEquals(2, instances.size()); List<Long> processInstanceList = instances.stream().map(p -> p.getId()).collect(Collectors.toList()); processInstanceList.add(0, parentProcessInstanceId); processService.abortProcessInstances(processInstanceList); ProcessInstance parent = processService.getProcessInstance(parentProcessInstanceId); assertNull(parent); instances = runtimeDataService.getProcessInstancesByParent(parentProcessInstanceId, Arrays.asList(ProcessInstance.STATE_ABORTED), new QueryContext()); assertNotNull(instances); assertEquals(2, instances.size()); }
Source:
public void testModelSerialization() throws IOException { Map<String, String> trainParams = new HashMap<String, String>(); trainParams.put(AbstractTrainer.ALGORITHM_PARAM, PerceptronTrainer.PERCEPTRON_VALUE); trainParams.put(AbstractTrainer.CUTOFF_PARAM, Integer.toString(1)); trainParams.put("UseSkippedAveraging", Boolean.toString(true)); EventTrainer trainer = TrainerFactory.getEventTrainer(trainParams, null); AbstractModel model = (AbstractModel) trainer.train(createTrainingStream()); testModel(model, 0.773706362961129); ByteArrayOutputStream modelBytes = new ByteArrayOutputStream(); BinaryPerceptronModelWriter writer = new BinaryPerceptronModelWriter(model, new DataOutputStream(modelBytes)); writer.persist(); writer.close(); MaxentModel restoredModelA = new BinaryPerceptronModelReader( new DataInputStream(new ByteArrayInputStream(modelBytes.toByteArray()))).getModel(); testModel(restoredModelA, 0.773706362961129); MaxentModel restoredModelB = new BinaryPerceptronModelReader( new DataInputStream(new ByteArrayInputStream(modelBytes.toByteArray()))).getModel(); Assert.assertEquals(restoredModelA, restoredModelB); }

Target:
public void testModelSerialization() throws IOException { Map<String, String> trainParams = new HashMap<>(); trainParams.put(AbstractTrainer.ALGORITHM_PARAM, PerceptronTrainer.PERCEPTRON_VALUE); trainParams.put(AbstractTrainer.CUTOFF_PARAM, Integer.toString(1)); trainParams.put("UseSkippedAveraging", Boolean.toString(true)); EventTrainer trainer = TrainerFactory.getEventTrainer(trainParams, null); AbstractModel model = (AbstractModel) trainer.train(createTrainingStream()); testModel(model, 0.773706362961129); ByteArrayOutputStream modelBytes = new ByteArrayOutputStream(); BinaryPerceptronModelWriter writer = new BinaryPerceptronModelWriter(model, new DataOutputStream(modelBytes)); writer.persist(); writer.close(); MaxentModel restoredModel = new BinaryPerceptronModelReader( new DataInputStream(new ByteArrayInputStream(modelBytes.toByteArray()))).getModel(); testModel(restoredModel, 0.773706362961129); }
Source:
protected ScheduledExecutorService createDefaultRetryExecutor() { return Executors.newScheduledThreadPool( RETRY_THREAD_COUNT, new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat(RETRY_THREADPOOL_NAME + "-%d") .build()); }

Target:
protected static ScheduledExecutorService createDefaultRetryExecutor() { return Executors.newScheduledThreadPool( RETRY_THREAD_COUNT, new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat(RETRY_THREADPOOL_NAME + "-%d") .build()); }
Source:
public Iterator<ITimeEvent> getTimeEventsIterator(long startTime, long stopTime, long visibleDuration) { return new EventIterator(fEventList, fZoomedEventList, startTime, stopTime); }

Target:
public Iterator<ITimeEvent> getTimeEventsIterator(long startTime, long stopTime, long visibleDuration) { if (!hasTimeEvents()) { return null; } return new EventIterator(fEventList, fZoomedEventList, startTime, stopTime); }
Source:
public void setupRoutes() { path(controllerBasePath(), () -> { before("", mimeType, this::setContentType); before("/*", mimeType, this::setContentType); before("", mimeType, this.apiAuthenticationHelper::checkAdminUserOrGroupAdminUserAnd403); get("", mimeType, this::index); post("", mimeType, this::createOrUpdate); put("", mimeType, this::createOrUpdate); exception(RuntimeException.class, (RuntimeException exception, Request request, Response response) -> { response.status(HttpStatus.UNPROCESSABLE_ENTITY.value()); response.body(MessageJson.create(exception.getMessage())); }); }); }

Target:
public void setupRoutes() { path(controllerBasePath(), () -> { before("", mimeType, this::setContentType); before("", mimeType, this.apiAuthenticationHelper::checkAdminUserOrGroupAdminUserAnd403); get("", mimeType, this::index); post("", mimeType, this::createOrUpdate); put("", mimeType, this::createOrUpdate); exception(RuntimeException.class, (RuntimeException exception, Request request, Response response) -> { response.status(HttpStatus.UNPROCESSABLE_ENTITY.value()); response.body(MessageJson.create(exception.getMessage())); }); }); }
Source:
private void _setupUI() { removeAllComponents(); QLBuilder proQB=_facultyMemberDao.getAllFacultyQB(); proQB.appendCriteria("id", PropertyConstraint.Operator.eq,_id); List<FacultyMemberProfile> facultyMemberProfileList=proQB.getQueryResolver().list(); Container con=new FacultyMemberEditorUI(facultyMemberProfileList.get(0),false); PushButton backBtn = new PushButton(); backBtn.setLabel(TextSources.create("BACK")); backBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { Response response = Event.getResponse(); response.redirect(response.createURL(_contentBuilder.getListFacultyPage())); } }); add(backBtn); add(con); }

Target:
private void _setupUI() { removeAllComponents(); QLBuilder proQB=_facultyMemberDao.getAllFacultyQB(); proQB.appendCriteria("slug", PropertyConstraint.Operator.eq,_slug); List<FacultyMemberProfile> facultyMemberProfileList=proQB.getQueryResolver().list(); Container con=new FacultyMemberViewerUI(facultyMemberProfileList.get(0)); PushButton backBtn = new PushButton(); backBtn.setLabel(TextSources.create("BACK")); backBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { Response response = Event.getResponse(); response.redirect(response.createURL(_contentBuilder.getListFacultyPage())); } }); add(backBtn); add(con); }
Source:
private TaskContext prepareContext() { TaskContext context = new TaskContext(); if (parameters != null) context.parameters(parameters); if (cache != null) context.cache(cache); Marshaller marshaller = componentRegistry.getComponent(Marshaller.class); if (marshaller != null) context.marshaller(marshaller); return context; }

Target:
private TaskContext prepareContext() { TaskContext context = new TaskContext(); if (parameters.isPresent()) context.parameters(parameters.get()); if (cache != null) context.cache(cache); if (marshaller != null) context.marshaller(marshaller); return context; }
Source:
public Status insert(String table, String key, Map<String, ByteIterator> values) { try { final XContentBuilder doc = jsonBuilder(); doc.startObject(); for (final Entry<String, String> entry : StringByteIterator.getStringMap(values).entrySet()) { doc.field(entry.getKey(), entry.getValue()); } doc.field(KEY, key); doc.endObject(); final IndexResponse indexResponse = client.prepareIndex(indexKey, table).setSource(doc).get(); if (indexResponse.getResult() != DocWriteResponse.Result.CREATED) { return Status.ERROR; } if (!isRefreshNeeded) { synchronized (this) { isRefreshNeeded = true; } } return Status.OK; } catch (final Exception e) { e.printStackTrace(); return Status.ERROR; } }

Target:
public Status insert(String table, String key, Map<String, ByteIterator> values) { try (XContentBuilder doc = jsonBuilder()) { doc.startObject(); for (final Entry<String, String> entry : StringByteIterator.getStringMap(values).entrySet()) { doc.field(entry.getKey(), entry.getValue()); } doc.field(KEY, key); doc.endObject(); final IndexResponse indexResponse = client.prepareIndex(indexKey, table).setSource(doc).get(); if (indexResponse.getResult() != DocWriteResponse.Result.CREATED) { return Status.ERROR; } if (!isRefreshNeeded) { synchronized (this) { isRefreshNeeded = true; } } return Status.OK; } catch (final Exception e) { e.printStackTrace(); return Status.ERROR; } }
Source:
public RestartVdsReturnValue getReturnValue() { return (RestartVdsReturnValue)(super.getReturnValue()); }

Target:
public RestartVdsReturnValue getReturnValue() { return (RestartVdsReturnValue) super.getReturnValue(); }
Source:
public void visitIfStatement(IfStatementTree tree) { ExpressionTree condition = tree.condition().expression(); if (condition.is(Kind.BOOLEAN_LITERAL)) { context().newIssue(this.KEY, MESSAGE).tree(condition); } super.visitIfStatement(tree); }

Target:
public void visitIfStatement(IfStatementTree tree) { ExpressionTree condition = tree.condition().expression(); if (condition.is(Kind.BOOLEAN_LITERAL)) { context().newIssue(KEY, MESSAGE).tree(condition); } super.visitIfStatement(tree); }
Source:
public void enableAccelerometer(byte[] config) { BluetoothLeGattCharacteristic accEnableChar; if (this.cc2650) { try { accEnableChar = this.gattServices.get(MOVEMENT) .findCharacteristic(TiSensorTagGatt.UUID_MOV_SENSOR_ENABLE); byte[] oldConfig = accEnableChar.readValue(); Integer newConfig = ByteBuffer.wrap(config).getShort() | ByteBuffer.wrap(oldConfig).getShort(); ByteBuffer bb = ByteBuffer.allocate(2); bb.putShort(newConfig.shortValue()); accEnableChar.writeValue(bb.array()); } catch (KuraException e) { logger.error(MOV_ERROR_MESSAGE, e); } } else { try { accEnableChar = this.gattServices.get(ACCELEROMETER) .findCharacteristic(TiSensorTagGatt.UUID_ACC_SENSOR_ENABLE); accEnableChar.writeValue(config); } catch (KuraException e) { logger.error("Accelerometer enable failed", e); } } }

Target:
public void enableAccelerometer(byte[] config) { BluetoothLeGattCharacteristic enableChar; if (this.cc2650) { try { enableChar = this.gattServices.get(MOVEMENT).findCharacteristic(TiSensorTagGatt.UUID_MOV_SENSOR_ENABLE); writeOnCharacteristic(config, enableChar); } catch (KuraException e) { logger.error(MOV_ERROR_MESSAGE, e); } } else { try { enableChar = this.gattServices.get(ACCELEROMETER) .findCharacteristic(TiSensorTagGatt.UUID_ACC_SENSOR_ENABLE); enableChar.writeValue(config); } catch (KuraException e) { logger.error("Accelerometer enable failed", e); } } }
Source:
protected void startProcess(Feed inputFeed, Feed outputFeed, String engineType, String scriptPath) throws FalconException { LOG.info("submitting input feed: {}", inputFeed.getName()); jobManager.submitJob(EntityType.FEED.name(), inputFeed.getEntityxml()); LOG.info("submitting output feed: {}", outputFeed.getName()); jobManager.submitJob(EntityType.FEED.name(), outputFeed.getEntityxml()); String processRequest = new Process.Builder().withProcessName(jobEntityName()).withFrequency(frequency) .withStartTime(startTime).withEndTime(endTime).withClusterName(getClusterNameToRunProcessOn()) .withInputFeedName(inputFeed.getName()).withOutputFeedName(outputFeed.getName()) .withEngineType(engineType).withWFPath(scriptPath).withAclOwner(proxyUser) .build().getEntityxml(); LOG.info("submitting/scheduling process: {}", processRequest); submitAndScheduleJob(EntityType.PROCESS.name(), processRequest); LOG.info("submitted and scheduled process: {}", jobEntityName()); }

Target:
protected void startProcess(Feed inputFeed, Feed outputFeed, String engineType, String scriptPath) throws FalconException { LOG.info("submitting input feed for process", inputFeed.getName(), engineType); jobManager.submitJob(EntityType.FEED.name(), inputFeed.getEntityxml()); LOG.info("submitting output feed for process", outputFeed.getName(), engineType); jobManager.submitJob(EntityType.FEED.name(), outputFeed.getEntityxml()); String processRequest = new Process.Builder().withProcessName(jobEntityName()).withFrequency(frequency) .withStartTime(startTime).withEndTime(endTime).withClusterName(getClusterNameToRunProcessOn()) .withInputFeedName(inputFeed.getName()).withOutputFeedName(outputFeed.getName()) .withEngineType(engineType).withWFPath(scriptPath).withAclOwner(proxyUser) .build().getEntityxml(); LOG.info("submitting/scheduling process: {}", engineType, processRequest); submitAndScheduleJob(EntityType.PROCESS.name(), processRequest); LOG.info("submitted and scheduled process: {}", engineType, jobEntityName()); }
Source:
static void attach(Log log) { on(ExportProgressEvent.class, (ExportProgressEvent event) -> { if (event.getText().contains("Cause:")) { log.warn(event.getText()); System.err.println(event.getText()); } else { log.info(event.getText()); System.out.println(event.getText()); } }); on(ExportSucceededEvent.class, (ExportSucceededEvent event) -> { log.info("Succeeded."); System.out.println("Succeeded."); }); on(TransferSucceededEvent.class, (TransferSucceededEvent event) -> { log.info("Transfer Succeeded"); System.out.println("Transfer Succeeded"); }); on(FormStatusEvent.class, (FormStatusEvent fse) -> { log.info(fse.getStatusString()); System.out.println(fse.getStatusString()); }); on(StartPullEvent.class, (StartPullEvent event) -> { log.info("Start pull form " + event.form.getFormName()); System.out.println("Start pull form " + event.form.getFormName()); }); }

Target:
static void attach(Log log) { on(ExportProgressEvent.class, event -> { if (event.getText().contains("Cause:")) { log.warn(event.getText()); System.err.println(event.getText()); } else { log.info(event.getText()); System.out.println(event.getText()); } }); on(ExportSucceededEvent.class, event -> { log.info("Succeeded."); System.out.println("Succeeded."); }); on(TransferSucceededEvent.class, event -> { log.info("Transfer Succeeded"); System.out.println("Transfer Succeeded"); }); on(FormStatusEvent.class, fse -> { log.info(fse.getStatusString()); System.out.println(fse.getStatusString()); }); on(StartPullEvent.class, event -> { log.info("Start pull form " + event.form.getFormName()); System.out.println("Start pull form " + event.form.getFormName()); }); }