auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testInstallDirAndRunDir() throws Exception { MyService entity = app.createAndManageChild(EntitySpec.create(MyService.class)); ((EntityLocal)entity).setConfig(BrooklynConfigKeys.BROOKLYN_DATA_DIR, "/tmp/brooklyn-foo"); Entities.manage(entity); String installDir = ConfigToAttributes.apply((EntityLocal)entity, SoftwareProcess.INSTALL_DIR); LOG.info("install dir = "+installDir); String runDir = ConfigToAttributes.apply((EntityLocal)entity, SoftwareProcess.RUN_DIR); LOG.info("run dir = "+runDir); Assert.assertEquals(installDir, "/tmp/brooklyn-foo/installs/MyService"); Assert.assertEquals(runDir, "/tmp/brooklyn-foo/apps/"+entity.getApplicationId()+"/entities/MyService_"+entity.getId()); }

Target:
public void testInstallDirAndRunDir() throws Exception { MyService entity = app.createAndManageChild(EntitySpec.create(MyService.class) .configure(BrooklynConfigKeys.BROOKLYN_DATA_DIR, "/tmp/brooklyn-foo")); entity.start(ImmutableList.of(loc)); Assert.assertEquals(entity.getAttribute(SoftwareProcess.INSTALL_DIR), "/tmp/brooklyn-foo/installs/MyService"); Assert.assertEquals(entity.getAttribute(SoftwareProcess.RUN_DIR), "/tmp/brooklyn-foo/apps/"+entity.getApplicationId()+"/entities/MyService_"+entity.getId()); }
Source:
static boolean insertDefaultAccountsTablesContent(Connection conn, CentralRepoPlatforms selectedPlatform) { try (Statement stmt = conn.createStatement();) { for (Account.Type type : Account.Type.PREDEFINED_ACCOUNT_TYPES) { int correlationTypeId = getCorrelationTypeIdForAccountType(conn, type); if (correlationTypeId > 0) { String sqlString = String.format("INSERT INTO account_types (type_name, display_name, correlation_type_id) VALUES ('%s', '%s', %d)" + getOnConflictDoNothingClause(selectedPlatform), type.getTypeName(), type.getDisplayName(), correlationTypeId); stmt.execute(sqlString); } } } catch (SQLException ex) { LOGGER.log(Level.SEVERE, String.format("Failed to populate default data in Persona tables."), ex); return false; } return true; }

Target:
static boolean insertDefaultAccountsTablesContent(Connection conn, CentralRepoPlatforms selectedPlatform) { try (Statement stmt = conn.createStatement();) { for (Account.Type type : Account.Type.PREDEFINED_ACCOUNT_TYPES) { int correlationTypeId = getCorrelationTypeIdForAccountType(conn, type); if (correlationTypeId > 0) { String sqlString = String.format("INSERT INTO account_types (type_name, display_name, correlation_type_id) VALUES ('%s', '%s', %d)" + getOnConflictDoNothingClause(selectedPlatform), type.getTypeName(), type.getDisplayName(), correlationTypeId); stmt.execute(sqlString); } } } catch (SQLException ex) { LOGGER.log(Level.SEVERE, String.format("Failed to populate default data in account_types table."), ex); return false; } return true; }
Source:
private boolean onlyBranchesAreSelected(TreeSelection selection) { Iterator selIterator = selection.iterator(); for (Object sel = selIterator.next(); selIterator.hasNext(); sel = selIterator .next()) { if (sel instanceof RefNode) { RefNode node = (RefNode) sel; String refName = node.getObject().getName(); if (!refName.startsWith(Constants.R_HEADS)) return false; } } return true; }

Target:
private boolean onlyBranchesAreSelected(TreeSelection selection) { Iterator selIterator = selection.iterator(); for (Object sel = selIterator.next(); selIterator.hasNext(); sel = selIterator .next()) { if (sel instanceof RefNode) { RefNode node = (RefNode) sel; String refName = node.getObject().getName(); if (!refName.startsWith(Constants.R_HEADS)) return false; } else return false; } return true; }
Source:
public void spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete() throws Throwable { subscriberTestWithoutSetup(new TestStageTestRun() { @Override public void run(WhiteboxTestStage stage) throws Throwable { final Subscription subs = new Subscription() { @Override public void request(long n) { Throwable thr = new Throwable(); for (StackTraceElement stackElem : thr.getStackTrace()) { if (stackElem.getMethodName().equals("onComplete")) { env.flop(String.format("Subscription::request MUST NOT be called from Subscriber::onComplete (Rule 2.3)! (Caller: %s::%s line %d)", stackElem.getClassName(), stackElem.getMethodName(), stackElem.getLineNumber())); } } } @Override public void cancel() { Throwable thr = new Throwable(); for (StackTraceElement stackElem : thr.getStackTrace()) { if (stackElem.getMethodName().equals("onComplete")) { env.flop(String.format("Subscription::cancel MUST NOT be called from Subscriber::onComplete (Rule 2.3)! (Caller: %s::%s line %d)", stackElem.getClassName(), stackElem.getMethodName(), stackElem.getLineNumber())); } } } }; stage.probe = stage.createWhiteboxSubscriberProbe(env); final Subscriber<T> sub = createSubscriber(stage.probe); sub.onSubscribe(subs); sub.onComplete(); env.verifyNoAsyncErrors(); } }); }

Target:
public void spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete() throws Throwable { subscriberTestWithoutSetup(new TestStageTestRun() { @Override public void run(WhiteboxTestStage stage) throws Throwable { final Subscription subs = new Subscription() { @Override public void request(long n) { final Optional<StackTraceElement> onCompleteStackTraceElement = env.findCallerMethodInStackTrace("onComplete"); if (onCompleteStackTraceElement.isDefined()) { final StackTraceElement stackElem = onCompleteStackTraceElement.get(); env.flop(String.format("Subscription::request MUST NOT be called from Subscriber::onComplete (Rule 2.3)! (Caller: %s::%s line %d)", stackElem.getClassName(), stackElem.getMethodName(), stackElem.getLineNumber())); } } @Override public void cancel() { final Optional<StackTraceElement> onCompleteStackElement = env.findCallerMethodInStackTrace("onComplete"); if (onCompleteStackElement.isDefined()) { final StackTraceElement stackElem = onCompleteStackElement.get(); env.flop(String.format("Subscription::cancel MUST NOT be called from Subscriber::onComplete (Rule 2.3)! (Caller: %s::%s line %d)", stackElem.getClassName(), stackElem.getMethodName(), stackElem.getLineNumber())); } } }; stage.probe = stage.createWhiteboxSubscriberProbe(env); final Subscriber<T> sub = createSubscriber(stage.probe); sub.onSubscribe(subs); sub.onComplete(); env.verifyNoAsyncErrors(); } }); }
Source:
public void testProducerFencedException() throws InterruptedException { final long pid = 13131L; final short epoch = 1; doInitTransactions(pid, epoch); transactionManager.beginTransaction(); transactionManager.maybeAddPartitionToTransaction(tp0); Future<RecordMetadata> responseFuture = accumulator.append(tp0, time.milliseconds(), "key".getBytes(), "value".getBytes(), Record.EMPTY_HEADERS, null, MAX_BLOCK_TIMEOUT).future; assertFalse(responseFuture.isDone()); prepareAddPartitionsToTxnResponse(Errors.NONE, tp0, epoch, pid); prepareProduceResponse(Errors.INVALID_PRODUCER_EPOCH, pid, epoch); sender.runOnce(); sender.runOnce(); assertTrue(responseFuture.isDone()); assertTrue(transactionManager.hasError()); try { responseFuture.get(); fail("Expected to get a ExecutionException from the response"); } catch (ExecutionException e) { assertTrue(e.getCause() instanceof ProducerFencedException); } try { transactionManager.beginTransaction(); fail("Expected to get a ExecutionException from the beginTransaction call"); } catch (RuntimeException e) { assertTrue(e instanceof ProducerFencedException); } try { transactionManager.beginCommit(); fail("Expected to get a ProducerFencedException from the beginCommit call"); } catch (RuntimeException e) { assertTrue(e instanceof ProducerFencedException); } try { transactionManager.beginAbort(); fail("Expected to get a ProducerFencedException from the beginAbort call"); } catch (RuntimeException e) { assertTrue(e instanceof ProducerFencedException); } try { transactionManager.sendOffsetsToTransaction(Collections.emptyMap(), "dummyId"); fail("Expected to get a ProducerFencedException from the sendOffsetsToTransaction call"); } catch (RuntimeException e) { assertTrue(e instanceof ProducerFencedException); } }

Target:
public void testProducerFencedException() throws InterruptedException { final long pid = 13131L; final short epoch = 1; doInitTransactions(pid, epoch); transactionManager.beginTransaction(); transactionManager.maybeAddPartitionToTransaction(tp0); Future<RecordMetadata> responseFuture = accumulator.append(tp0, time.milliseconds(), "key".getBytes(), "value".getBytes(), Record.EMPTY_HEADERS, null, MAX_BLOCK_TIMEOUT).future; assertFalse(responseFuture.isDone()); prepareAddPartitionsToTxnResponse(Errors.NONE, tp0, epoch, pid); prepareProduceResponse(Errors.INVALID_PRODUCER_EPOCH, pid, epoch); sender.runOnce(); sender.runOnce(); assertTrue(responseFuture.isDone()); assertTrue(transactionManager.hasError()); try { responseFuture.get(); fail("Expected to get a ExecutionException from the response"); } catch (ExecutionException e) { assertTrue(e.getCause() instanceof ProducerFencedException); } assertThrows(ProducerFencedException.class, () -> transactionManager.beginTransaction()); assertThrows(ProducerFencedException.class, () -> transactionManager.beginCommit()); assertThrows(ProducerFencedException.class, () -> transactionManager.beginAbort()); assertThrows(ProducerFencedException.class, () -> transactionManager.sendOffsetsToTransaction(Collections.emptyMap(), "dummyId")); }
Source:
public void testXMLEmbedding() throws Exception { String clusterXml = namedCluster.toXmlForEmbed(); System.out.println( clusterXml ); Element node = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse( new ByteArrayInputStream( ( "<NamedCluster>" + clusterXml + "</NamedCluster>" ).getBytes() ) ) .getDocumentElement(); NamedCluster nc = new NamedClusterImpl(); nc = nc.fromXmlForEmbed( node ); assertEquals( namedCluster.getHdfsHost(), nc.getHdfsHost() ); assertEquals( namedCluster.getHdfsPort(), nc.getHdfsPort() ); assertEquals( namedCluster.getHdfsUsername(), nc.getHdfsUsername() ); assertEquals( namedCluster.getHdfsPassword(), nc.getHdfsPassword() ); assertEquals( namedCluster.getName(), nc.getName() ); assertEquals( namedCluster.getShimIdentifier(), nc.getShimIdentifier() ); assertEquals( namedCluster.getStorageScheme(), nc.getStorageScheme() ); assertEquals( namedCluster.getJobTrackerHost(), nc.getJobTrackerHost() ); assertEquals( namedCluster.getJobTrackerPort(), nc.getJobTrackerPort() ); assertEquals( namedCluster.getZooKeeperHost(), nc.getZooKeeperHost() ); assertEquals( namedCluster.getZooKeeperPort(), nc.getZooKeeperPort() ); assertEquals( namedCluster.getOozieUrl(), nc.getOozieUrl() ); assertEquals( namedCluster.getLastModifiedDate(), nc.getLastModifiedDate() ); }

Target:
public void testXMLEmbedding() throws Exception { String clusterXml = namedCluster.toXmlForEmbed( "NamedCluster" ); System.out.println( clusterXml ); Element node = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse( new ByteArrayInputStream( clusterXml.getBytes() ) ) .getDocumentElement(); NamedCluster nc = new NamedClusterImpl(); nc = nc.fromXmlForEmbed( node ); assertEquals( namedCluster.getHdfsHost(), nc.getHdfsHost() ); assertEquals( namedCluster.getHdfsPort(), nc.getHdfsPort() ); assertEquals( namedCluster.getHdfsUsername(), nc.getHdfsUsername() ); assertEquals( namedCluster.getHdfsPassword(), nc.getHdfsPassword() ); assertEquals( namedCluster.getName(), nc.getName() ); assertEquals( namedCluster.getShimIdentifier(), nc.getShimIdentifier() ); assertEquals( namedCluster.getStorageScheme(), nc.getStorageScheme() ); assertEquals( namedCluster.getJobTrackerHost(), nc.getJobTrackerHost() ); assertEquals( namedCluster.getJobTrackerPort(), nc.getJobTrackerPort() ); assertEquals( namedCluster.getZooKeeperHost(), nc.getZooKeeperHost() ); assertEquals( namedCluster.getZooKeeperPort(), nc.getZooKeeperPort() ); assertEquals( namedCluster.getOozieUrl(), nc.getOozieUrl() ); assertEquals( namedCluster.getLastModifiedDate(), nc.getLastModifiedDate() ); }
Source:
public final ResponseType process(SimulatorOperation operation, SimulatorAddress sourceAddress) { OperationType operationType = getOperationType(operation); if (LOGGER.isTraceEnabled()) { LOGGER.trace(getClass().getSimpleName() + ".process(" + operation.getClass().getSimpleName() + ')'); } OperationTypeCounter.received(operationType); try { switch (operationType) { case INTEGRATION_TEST: return processIntegrationTest(operationType, (IntegrationTestOperation) operation, sourceAddress); case LOG: processLog((LogOperation) operation, sourceAddress); break; case CHAOS_MONKEY: processChaosMonkey((ChaosMonkeyOperation) operation); break; default: return processOperation(operationType, operation, sourceAddress); } } catch (Throwable e) { LOGGER.warn(e); return EXCEPTION_DURING_OPERATION_EXECUTION; } return SUCCESS; }

Target:
public final ResponseType process(SimulatorOperation operation, SimulatorAddress sourceAddress) { OperationType operationType = getOperationType(operation); if (LOGGER.isTraceEnabled()) { LOGGER.trace(getClass().getSimpleName() + ".process(" + operation.getClass().getSimpleName() + ')'); } OperationTypeCounter.received(operationType); try { switch (operationType) { case INTEGRATION_TEST: return processIntegrationTest(operationType, (IntegrationTestOperation) operation, sourceAddress); case LOG: processLog((LogOperation) operation, sourceAddress); break; case CHAOS_MONKEY: processChaosMonkey((ChaosMonkeyOperation) operation); break; default: return processOperation(operationType, operation, sourceAddress); } } catch (Throwable e) { onException(e); return EXCEPTION_DURING_OPERATION_EXECUTION; } return SUCCESS; }
Source:
public void onStart() { super.onStart(); if (callback().getReferencesGroup().size() == 1) { pageIndicatorView.setVisibility(View.GONE); ((ViewGroup) pageIndicatorView.getParent()).removeView(pageIndicatorView); pageIndicatorDivider.setVisibility(View.GONE); } else { BottomSheetBehavior<View> behavior = BottomSheetBehavior.from((View) getView().getParent()); behavior.setPeekHeight(DimenUtil.getDisplayHeightPx() / 2); } }

Target:
public void onStart() { super.onStart(); if (callback().getReferencesGroup().size() == 1) { pageIndicatorView.setVisibility(View.GONE); pageIndicatorDivider.setVisibility(View.GONE); } else { BottomSheetBehavior<View> behavior = BottomSheetBehavior.from((View) getView().getParent()); behavior.setPeekHeight(DimenUtil.getDisplayHeightPx() / 2); } }
Source:
private static UnificationRegistry<IBlockState> createBlockStateUnificationRegistry() { Function<IBlockState, ResourceLocation> namer = blockState -> { ResourceLocation registryName = blockState.getBlock().getRegistryName(); Preconditions.checkNotNull(registryName, "registry name must not be null"); return registryName; }; Function<IBlockState, IBlockState> validator = blockState -> { Preconditions.checkNotNull(blockState, "blockState must not be null"); Preconditions.checkNotNull(blockState.getBlock(), "blockState's block must not be null"); return blockState; }; return createRegistry(namer, validator, blockState -> blockState); }

Target:
private static Unifier<IBlockState> createBlockStateUnificationRegistry() { Consumer<IBlockState> validator = blockState -> { Preconditions.checkNotNull(blockState, "blockState must not be null"); Preconditions.checkNotNull(blockState.getBlock(), "blockState's block must not be null"); }; Function<IBlockState, ResourceLocation> namer = blockState -> blockState.getBlock().getRegistryName(); return createUnifier(validator, namer, Function.identity(), true); }
Source:
protected List<?> createOperationSet() { List<?> selection = getSelectedObjects(); if (selection.isEmpty() || !(selection.get(0) instanceof IGraphicalEditPart)) { selection = Collections.EMPTY_LIST; } else { selection = ToolUtilities.getSelectionWithoutDependants(selection); selection = Lists.newArrayList(Iterables.filter(selection, Predicates.not(Predicates.instanceOf(ConnectionEditPart.class)))); if (selection.size() < 3) { selection = Collections.EMPTY_LIST; } else { EditPart parent = ((EditPart) selection.get(0)).getParent(); int sideOfFirstSelection = PositionConstants.NONE; if (selection.get(0) instanceof IBorderItemEditPart) { sideOfFirstSelection = ((IBorderItemEditPart) selection.get(0)).getBorderItemLocator().getCurrentSideOfParent(); if (!isHorizontalAxisAuthorizedForBorderNode(sideOfFirstSelection) && !isVerticalAxisAuthorizedForBorderNode(sideOfFirstSelection)) { selection = Collections.EMPTY_LIST; } } for (int i = 1; i < selection.size(); i++) { EditPart part = (EditPart) selection.get(i); if (part.getParent() != parent) { selection = Collections.EMPTY_LIST; break; } else if (sideOfFirstSelection != PositionConstants.NONE && !isABorderNodeOnSameAxis(part, sideOfFirstSelection)) { selection = Collections.EMPTY_LIST; break; } else if (part instanceof DNodeListElementEditPart) { selection = Collections.EMPTY_LIST; break; } else if (part.getParent() instanceof CompartmentEditPart && !(part instanceof AbstractDiagramNodeEditPart)) { selection = Collections.EMPTY_LIST; break; } } } } return selection; }

Target:
protected List<?> createOperationSet() { List<?> selection = getSelectedObjects(); if (selection.isEmpty() || !(selection.get(0) instanceof IGraphicalEditPart)) { selection = Collections.EMPTY_LIST; } else { selection = ToolUtilities.getSelectionWithoutDependants(selection); selection = Lists.newArrayList(Iterables.filter(selection, Predicates.not(Predicates.instanceOf(ConnectionEditPart.class)))); if (selection.size() < 3) { selection = Collections.EMPTY_LIST; } else { EditPart parent = ((EditPart) selection.get(0)).getParent(); int sideOfFirstSelection = PositionConstants.NONE; if (selection.get(0) instanceof IBorderItemEditPart) { sideOfFirstSelection = ((IBorderItemEditPart) selection.get(0)).getBorderItemLocator().getCurrentSideOfParent(); if (!isHorizontalAxisAuthorizedForBorderNode(sideOfFirstSelection) && !isVerticalAxisAuthorizedForBorderNode(sideOfFirstSelection)) { selection = Collections.EMPTY_LIST; } } for (int i = 1; i < selection.size(); i++) { EditPart part = (EditPart) selection.get(i); if (part.getParent() != parent) { selection = Collections.EMPTY_LIST; break; } else if (sideOfFirstSelection != PositionConstants.NONE && !isABorderNodeOnSameAxis(part, sideOfFirstSelection)) { selection = Collections.EMPTY_LIST; break; } else { if (!isFreeFormContainerChildrenPresentation(selection)) { selection = Collections.EMPTY_LIST; } break; } } } } return selection; }
Source:
private static Collection<CustomEventTableColumn> generateColumns(CustomTraceDefinition definition) { List<CustomEventTableColumn> columns = new LinkedList<>(); List<OutputColumn> outputs = definition.outputs; for (int i = 0; i < outputs.size(); i++) { String name = outputs.get(i).name; if (name != null) { columns.add(new CustomEventTableColumn(name, i)); } } return columns; }

Target:
private static Collection<CustomEventTableColumn> generateColumns(CustomTraceDefinition definition) { ImmutableList.Builder<CustomEventTableColumn> builder = new ImmutableList.Builder<>(); List<OutputColumn> outputs = definition.outputs; for (int i = 0; i < outputs.size(); i++) { String name = outputs.get(i).name; if (name != null) { builder.add(new CustomEventTableColumn(name, i)); } } return builder.build(); }
Source:
public void forbidsNonSimplifiedTernaryOperators() throws Exception { final String file = "SimplifiedTernary.java"; new PMDAssert( file, Matchers.is(false), Matchers.containsString( String.format( PMDValidatorTest.BRACKETS, "SimplifiedTernary" ) ) ).validate(); }

Target:
public void forbidsNonSimplifiedTernaryOperators() throws Exception { new PMDAssert( "SimplifiedTernary.java", Matchers.is(false), Matchers.containsString( String.format( PMDValidatorTest.BRACKETS, "SimplifiedTernary" ) ) ).validate(); }
Source:
public void addContainers(Set<PackingPlan.ContainerPlan> containers) { synchronized (processToContainer) { Set<Integer> containerIds = new HashSet<>(); containerIds.addAll(processToContainer.values()); for (PackingPlan.ContainerPlan container : containers) { if (containerIds.contains(container.getId())) { throw new RuntimeException(String.format("Found active container for %s, " + "cannot launch a duplicate container.", container.getId())); } startExecutor(container.getId()); containerIds.add(container.getId()); } } }

Target:
public void addContainers(Set<PackingPlan.ContainerPlan> containers) { synchronized (processToContainer) { for (PackingPlan.ContainerPlan container : containers) { if (processToContainer.values().contains(container.getId())) { throw new RuntimeException(String.format("Found active container for %s, " + "cannot launch a duplicate container.", container.getId())); } startExecutor(container.getId()); } } }
Source:
public InsertQuery build() { Checks.checkNotEmpty(table, "Please specify table name"); return new InsertQuery( table, nullColumnHack ); }

Target:
public InsertQuery build() { checkNotEmpty(table, "Please specify table name"); return new InsertQuery( table, nullColumnHack ); }
Source:
protected void skipMojo() { final String name = getEffectivePropertyName(); final Properties projectProperties = getProject().getProperties(); final String oldValue = projectProperties.getProperty(name); if (oldValue == null) { getLog().info(name + " set to empty"); projectProperties.setProperty(name, ""); } else { getLog().info(name + " set to " + oldValue); } }

Target:
protected void skipMojo() { final String name = getEffectivePropertyName(); final Properties projectProperties = getProject().getProperties(); final String oldValue = projectProperties.getProperty(name); if (oldValue == null) { getLog().info(name + " set to empty"); projectProperties.setProperty(name, ""); } }
Source:
public void test() { connect(); click(jq("@button")); waitResponse(); getActions() .dragAndDropBy(toElement(jq(".z-window-header-move")), 0, 100) .perform(); assertNoJSError(); }

Target:
public void test() { connect(); click(jq("@button")); waitResponse(); getActions() .dragAndDropBy(toElement(jq(".z-window-header-move")), 0, -100) .perform(); assertNoJSError(); Assert.assertEquals(0, jq("html").scrollTop()); }
Source:
String buildSparkSubmitOptions() { StringBuilder options = new StringBuilder(); options.append(" --master k8s://<LINK_0>"); options.append(" --deploy-mode client"); options.append(" --conf spark.kubernetes.namespace=" + kubectl.getNamespace()); options.append(" --conf spark.executor.instances=1"); options.append(" --conf spark.kubernetes.driver.pod.name=" + getPodName()); options.append(" --conf spark.kubernetes.container.image=" + sparkImage); options.append(" --conf spark.driver.bindAddress=0.0.0.0"); options.append(" --conf spark.driver.host=" + getInterpreterPodDnsName()); options.append(" --conf spark.driver.port=" + String.format("%d", getSparkDriverPort())); options.append(" --conf spark.blockManager.port=" + String.format("%d", getSparkBlockmanagerPort())); return options.toString(); }

Target:
String buildSparkSubmitOptions() { StringBuilder options = new StringBuilder(); options.append(" --master k8s://<LINK_0>"); options.append(" --deploy-mode client"); if (properties.containsKey("spark.driver.memory")) { options.append(" --driver-memory " + properties.get("spark.driver.memory")); } options.append(" --conf spark.kubernetes.namespace=" + kubectl.getNamespace()); options.append(" --conf spark.executor.instances=1"); options.append(" --conf spark.kubernetes.driver.pod.name=" + getPodName()); options.append(" --conf spark.kubernetes.container.image=" + sparkImage); options.append(" --conf spark.driver.bindAddress=0.0.0.0"); options.append(" --conf spark.driver.host=" + getInterpreterPodDnsName()); options.append(" --conf spark.driver.port=" + String.format("%d", getSparkDriverPort())); options.append(" --conf spark.blockManager.port=" + String.format("%d", getSparkBlockmanagerPort())); return options.toString(); }
Source:
private <T extends BaseProtocolResponse> Optional<T> decodeProtocolResponse( TriFunction<StatusCode, String, Integer, T> constructor, ByteBuf in ) { int statusCodeValue = in.readInt(); String identifier = StringMarshal.unmarshal( in ); int version = in.readInt(); Optional<StatusCode> statusCode = StatusCode.fromCodeValue( statusCodeValue ); return statusCode.map( status -> constructor.apply( status, identifier, version ) ); }

Target:
private <T extends BaseProtocolResponse> T decodeProtocolResponse( TriFunction<StatusCode, String, Integer, T> constructor, ByteBuf in ) throws ClientHandshakeException { int statusCodeValue = in.readInt(); String identifier = StringMarshal.unmarshal( in ); int version = in.readInt(); Optional<StatusCode> statusCode = StatusCode.fromCodeValue( statusCodeValue ); return statusCode .map( status -> constructor.apply( status, identifier, version ) ) .orElseThrow( () -> new ClientHandshakeException( String.format( "Unknown status code %s for protocol %s version %d", statusCodeValue, identifier, version ) ) ); }
Source:
static private void validateAlleles(final VariantContext vc) { boolean alreadySeenRef = false; for (final Allele allele : vc.alleles) { if (allele.isReference()) { if (alreadySeenRef) { throw new IllegalArgumentException("BUG: Received two reference tagged alleles in VariantContext " + vc.alleles + " vc=" + vc); } alreadySeenRef = true; } if (allele.isNoCall()) { throw new IllegalArgumentException("BUG: Cannot add a no call allele to a variant context " + vc.alleles + " vc=" + vc); } } if (!alreadySeenRef) { throw new IllegalArgumentException("No reference allele found in VariantContext"); } }

Target:
private static void validateAlleles(final VariantContext vc) { boolean alreadySeenRef = false; for (final Allele allele : vc.alleles) { if (allele.isReference()) { if (alreadySeenRef) { throw new IllegalArgumentException("BUG: Received two reference tagged alleles in VariantContext " + vc.alleles + " vc=" + vc); } alreadySeenRef = true; } if (allele.isNoCall()) { throw new IllegalArgumentException("BUG: Cannot add a no call allele to a variant context " + vc.alleles + " vc=" + vc); } } if (!alreadySeenRef) { throw new IllegalArgumentException("No reference allele found in VariantContext"); } }
Source:
public Type convertReadValueToType(String pvReadValue) { Type lvType = convertReadValueToUnmodifiedType(pvReadValue); for (InterfaceOneWireTypeModifier lvTypeModifier : getTypeModifieryList()) { logger.debug("type of before modifier:{} type={}", getDevicePropertyPath(), lvTypeModifier.getModifierName(), lvType.toString()); lvType = lvTypeModifier.modify4Read(lvType); logger.debug("type of after modifier:{} type={}", getDevicePropertyPath(), lvTypeModifier.getModifierName(), lvType.toString()); } return lvType; }

Target:
public Type convertReadValueToType(String pvReadValue) { Type lvType = convertReadValueToUnmodifiedType(pvReadValue); for (InterfaceOneWireTypeModifier lvTypeModifier : getTypeModifieryList()) { logger.debug("type of before modifier:{} type={}", getDevicePropertyPath(), lvTypeModifier.getModifierName(), lvType); lvType = lvTypeModifier.modify4Read(lvType); logger.debug("type of after modifier:{} type={}", getDevicePropertyPath(), lvTypeModifier.getModifierName(), lvType); } return lvType; }
Source:
public static GridBodyCellEditContext makeCellRenderContext(final GridWidget gridWidget, final BaseGridRendererHelper.RenderingInformation ri, final BaseGridRendererHelper.ColumnInformation ci, final int uiRowIndex) { final GridColumn<?> column = ci.getColumn(); final GridRenderer renderer = gridWidget.getRenderer(); final Group header = gridWidget.getHeader(); final double headerRowsYOffset = ri.getHeaderRowsYOffset(); final double headerMinY = (header == null ? headerRowsYOffset : header.getY() + headerRowsYOffset); final double headerRowHeight = ri.getHeaderRowsHeight() / column.getHeaderMetaData().size(); final double headerRowsHeight = (headerRowHeight * column.getHeaderMetaData().size()); double rowsHeight = 0; for (int i = 0; i < uiRowIndex; i++) { rowsHeight += gridWidget.getModel().getRow(i).getHeight(); } final double cellX = gridWidget.getAbsoluteX() + ci.getOffsetX() + ci.getColumn().getWidth() / 2; final double lastCellYMiddle = gridWidget.getModel().getRow(uiRowIndex).getHeight() / 2; final double cellY = gridWidget.getAbsoluteY() + headerMinY + headerRowsHeight + rowsHeight + lastCellYMiddle; final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = ri.getFloatingBlockInformation(); final double floatingX = floatingBlockInformation.getX(); final double floatingWidth = floatingBlockInformation.getWidth(); final double clipMinX = gridWidget.getAbsoluteX() + floatingX + floatingWidth; final double clipMinY = gridWidget.getAbsoluteY(); final double blockCellWidth = column.getWidth(); return new GridBodyCellEditContext(cellX, cellY, blockCellWidth, headerRowHeight, clipMinY, clipMinX, uiRowIndex, ci.getUiColumnIndex(), floatingBlockInformation.getColumns().contains(column), gridWidget.getViewport().getTransform(), renderer, Optional.empty()); }

Target:
public static GridBodyCellEditContext makeCellRenderContext(final GridWidget gridWidget, final BaseGridRendererHelper.RenderingInformation ri, final BaseGridRendererHelper.ColumnInformation ci, final int uiRowIndex) { final GridColumn<?> column = ci.getColumn(); final GridRenderer renderer = gridWidget.getRenderer(); final GridRow gridRow = gridWidget.getModel().getRow(uiRowIndex); final double headerRowsHeight = ri.getHeaderRowsHeight(); final double rowYOffset = gridWidget.getRendererHelper().getRowOffset(gridRow); final double cellX = getCellX(gridWidget, ci); final double cellY = getHeaderY(gridWidget, ri) + headerRowsHeight + rowYOffset; final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = ri.getFloatingBlockInformation(); final double clipMinX = getClipMinX(gridWidget, floatingBlockInformation); final double clipMinY = getClipMinY(gridWidget); final double blockCellWidth = column.getWidth(); final double blockCellHeight = gridRow.getHeight(); return new GridBodyCellEditContext(cellX, cellY, blockCellWidth, blockCellHeight, clipMinY, clipMinX, uiRowIndex, ci.getUiColumnIndex(), floatingBlockInformation.getColumns().contains(column), gridWidget.getViewport().getTransform(), renderer, Optional.empty()); }
Source:
public Set<FloatingIP> expected() { return ImmutableSet.of( FloatingIP.builder().id("1").instanceId("12").ip("10.0.0.3").fixedIp("11.0.0.1").pool("nova").build(), FloatingIP.builder().id("2").instanceId(null).ip("10.0.0.5").fixedIp(null).pool("nova").build(), FloatingIP.builder().id("3").instanceId("13").ip("10.0.0.13").fixedIp("11.0.0.3").build()); }

Target:
public Set<FloatingIP> expected() { return ImmutableSet.of( FloatingIP.builder().id("1").instanceId("12").ip("10.0.0.3").fixedIp("11.0.0.1").pool("nova").build(), FloatingIP.builder().id("2").instanceId(null).ip("10.0.0.5").fixedIp(null).pool("nova").build(), FloatingIP.builder().id("3").instanceId("13").ip("10.0.0.13").fixedIp("11.0.0.3").build(), FloatingIP.builder().id("4").instanceId("14").ip("10.0.0.14").fixedIp("11.0.0.4").pool(null).build()); }
Source:
public void setLabels(double[] labels) { this.labels = labels; }

Target:
public void setLabels(double[] labels) { if (labels == null) { this.labels = new double[0]; } else { this.labels = Arrays.copyOf(labels, labels.length); } }
Source:
public void clusterDown() { if (cluster != null) { cluster.close(); } if (yarnCluster != null) { yarnCluster.stop(); } }

Target:
public void clusterDown() { if (cluster != null) { cluster.close(); } IOUtils.cleanupWithLogger(LOG, yarnCluster); }
Source:
public void onRemove(Entity entity) throws FalconException{ if (entity.getEntityType() != EntityType.PROCESS){ return; } synchronized (this){ backlogMetricStore.deleteEntityInstance(entity.getName()); entityBacklogs.remove(entity); } }

Target:
public void onRemove(Entity entity) throws FalconException{ if (entity.getEntityType() != EntityType.PROCESS){ return; } synchronized (entityBacklogs){ backlogMetricStore.deleteEntityInstance(entity.getName()); entityBacklogs.remove(entity); } }
Source:
public List<WebElement> apply(By by) { List<WebElement> result = new ArrayList<>(); Throwable shouldBeThrown = null; boolean isRootCauseInvalidSelector; boolean isRootCauseStaleElementReferenceException = false; foundStaleElementReferenceException = null; try { result.addAll(searchContext.findElements(by)); } catch (Throwable e){ isRootCauseInvalidSelector = isInvalidSelectorRootCause(e); if (!isRootCauseInvalidSelector) isRootCauseStaleElementReferenceException = isStaleElementReferenceException(e); if (isRootCauseStaleElementReferenceException) foundStaleElementReferenceException = extractReadableException(e); if (!isRootCauseInvalidSelector & !isRootCauseStaleElementReferenceException) shouldBeThrown = extractReadableException(e); } if (shouldBeThrown != null) { if (RuntimeException.class.isAssignableFrom(shouldBeThrown.getClass())) throw (RuntimeException) shouldBeThrown; throw new RuntimeException(shouldBeThrown); } if (result.size() > 0) { return result; } else { return null; } }

Target:
public List<WebElement> apply(By by) { List<WebElement> result = new ArrayList<>(); Throwable shouldBeThrown = null; boolean isRootCauseInvalidSelector; boolean isRootCauseStaleElementReferenceException = false; foundStaleElementReferenceException = null; try { result.addAll(searchContext.findElements(by)); } catch (Throwable e) { isRootCauseInvalidSelector = isInvalidSelectorRootCause(e); if (!isRootCauseInvalidSelector) { isRootCauseStaleElementReferenceException = isStaleElementReferenceException(e); } if (isRootCauseStaleElementReferenceException) { foundStaleElementReferenceException = extractReadableException(e); } if (!isRootCauseInvalidSelector & !isRootCauseStaleElementReferenceException) { shouldBeThrown = extractReadableException(e); } } if (shouldBeThrown != null) { if (RuntimeException.class.isAssignableFrom(shouldBeThrown.getClass())) { throw (RuntimeException) shouldBeThrown; } throw new RuntimeException(shouldBeThrown); } if (result.size() > 0) { return result; } else { return null; } }
Source:
public synchronized void updateDataCenter(DataCenter dataCenter) { try { storeObject(dataCenter); } catch (RuntimeException e) { log.error("failed to create new dataCenter"); return; } if (!dataCenterMap.containsKey(dataCenter.getId())) { dataCenterMap.put(dataCenter.getId(), dataCenter); } log.info("Data center stored", dataCenter.getId()); }

Target:
public synchronized void updateDataCenter(DataCenter dataCenter) { try { storeObject(dataCenter); } catch (Exception e) { log.error("failed to store object {}", e.getStackTrace()); } dataCenterMap.put(dataCenter.getId(), dataCenter); log.info("Data center restored", dataCenter.getId()); }
Source:
private String nodeToString(Node node) { StringWriter stringWriter = new StringWriter(); try { Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.setOutputProperty(OutputKeys.INDENT, "no"); transformer.transform(new DOMSource(node), new StreamResult(stringWriter)); } catch (TransformerException te) { System.out.println("nodeToString Transformer Exception"); } return stringWriter.toString(); }

Target:
private String nodeToString(Node node) { StringWriter stringWriter = new StringWriter(); try { Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.setOutputProperty(OutputKeys.INDENT, "no"); transformer.transform(new DOMSource(node), new StreamResult(stringWriter)); } catch (TransformerException e) { throw new IllegalArgumentException("Cannot convert node to string. Transformer exception ", e); } return stringWriter.toString(); }
Source:
public void buildBasicImage() throws Exception { final TestResponse response = Mockito.mock(TestResponse.class); Mockito.when(response.xpath(Mockito.anyString())) .thenReturn(Arrays.asList("test")); final ButtonRs res = new ButtonRs( new ButtonRs.BuildInfoRetriever() { @Override public TestResponse info(final UriBuilder builder, final String stand) { return response; } } ); res.setUriInfo(new UriInfoMocker().mock()); res.setHttpHeaders(new HttpHeadersMocker().mock()); res.setStand("stand"); res.setRule("rule"); MatcherAssert.assertThat( URLConnection.guessContentTypeFromStream( new ByteArrayInputStream((byte[]) res.button().getEntity()) ), Matchers.equalTo(MediaType.PNG.toString()) ); }

Target:
public void buildBasicImage() throws Exception { final String rule = "rultor-on-commit"; final ButtonRs res = new ButtonRs( new ButtonRs.Build() { @Override public XmlDocument info(final URI uri, final String stand) { return new SimpleXml( String.format( "<page><widgets><widget class=\"com.rultor.widget.BuildHealth\"><builds><build>" + " <coordinates><rule>%s</rule></coordinates>" + " <duration>1212602</duration>" + " <code>0</code>" + " <health>0.6153846153846154</health>" + "</build></builds></widget></widgets></page>", rule ) ); } } ); res.setUriInfo(new UriInfoMocker().mock()); res.setHttpHeaders(new HttpHeadersMocker().mock()); res.setStand("stand"); res.setRule(rule); MatcherAssert.assertThat( URLConnection.guessContentTypeFromStream( new ByteArrayInputStream((byte[]) res.button().getEntity()) ), Matchers.equalTo(MediaType.PNG.toString()) ); }
Source:
public String toString() { StringBuilder builder = new StringBuilder(); if (_description != null) { builder.append(_description); } if (_exception != null) { builder.append(", StackTrace: "); builder.append(ExceptionUtils.getStackTrace(_exception)); } return builder.toString(); }

Target:
public String toString() { StringBuilder builder = new StringBuilder(); if (_description != null) { builder.append(_description); } if (_exception != null) { builder.append(", Exception StackTrace: "); builder.append(ExceptionUtils.getStackTrace(_exception)); } return builder.toString(); }
Source:
private long doSeek(TopicPartition newTp, OffsetAndMetadata committedOffset) { LOG.trace("Seeking offset for topic-partition with and {}", newTp, firstPollOffsetStrategy, committedOffset); if (committedOffset != null) { if (isOffsetCommittedByThisTopology(newTp, committedOffset)) { kafkaConsumer.seek(newTp, committedOffset.offset()); } else { if (firstPollOffsetStrategy.equals(EARLIEST)) { kafkaConsumer.seekToBeginning(Collections.singleton(newTp)); } else if (firstPollOffsetStrategy.equals(LATEST)) { kafkaConsumer.seekToEnd(Collections.singleton(newTp)); } else { kafkaConsumer.seek(newTp, committedOffset.offset()); } } } else { if (firstPollOffsetStrategy.equals(EARLIEST) || firstPollOffsetStrategy.equals(UNCOMMITTED_EARLIEST)) { kafkaConsumer.seekToBeginning(Collections.singleton(newTp)); } else if (firstPollOffsetStrategy.equals(LATEST) || firstPollOffsetStrategy.equals(UNCOMMITTED_LATEST)) { kafkaConsumer.seekToEnd(Collections.singleton(newTp)); } } return kafkaConsumer.position(newTp); }

Target:
private long doSeek(TopicPartition newTp, OffsetAndMetadata committedOffset) { LOG.trace("Seeking offset for topic-partition with and committed offset [{}]", newTp, firstPollOffsetStrategy, committedOffset); if (committedOffset != null) { if (isOffsetCommittedByThisTopology(newTp, committedOffset)) { kafkaConsumer.seek(newTp, committedOffset.offset()); } else { if (firstPollOffsetStrategy.equals(EARLIEST)) { kafkaConsumer.seekToBeginning(Collections.singleton(newTp)); } else if (firstPollOffsetStrategy.equals(LATEST)) { kafkaConsumer.seekToEnd(Collections.singleton(newTp)); } else { kafkaConsumer.seek(newTp, committedOffset.offset()); } } } else { if (firstPollOffsetStrategy.equals(EARLIEST) || firstPollOffsetStrategy.equals(UNCOMMITTED_EARLIEST)) { kafkaConsumer.seekToBeginning(Collections.singleton(newTp)); } else if (firstPollOffsetStrategy.equals(LATEST) || firstPollOffsetStrategy.equals(UNCOMMITTED_LATEST)) { kafkaConsumer.seekToEnd(Collections.singleton(newTp)); } } return kafkaConsumer.position(newTp); }
Source:
public final void setExtendedExpiresOn(final Date extendedExpiresOn) { this.mExtendedExpiresOn = extendedExpiresOn; }

Target:
public final void setExtendedExpiresOn(final Date extendedExpiresOn) { mExtendedExpiresOn = extendedExpiresOn; }
Source:
public void runTask() { throw new SamzaException("Running StreamTask is not implemented for LocalContainerRunner"); }

Target:
public void runTask() { throw new UnsupportedOperationException("Running StreamTask is not implemented for LocalContainerRunner"); }
Source:
public Serializable execute(TaskResult... results) throws IOException { List<String> filesRelativePathName; FTPClient ftpClient = new FTPClient(); ftpClient.connect(ftpHostname, ftpPort); int reply = ftpClient.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { ftpClient.disconnect(); throw new IOException("Exception in connecting to FTP Server"); } ftpClient.login(ftpUsername, ftpPassword); ftpClient.enterLocalPassiveMode(); getOut().println("Connected"); switch (ftpMode) { case "GET": filesRelativePathName = ftpGet(ftpClient); break; case "PUT": filesRelativePathName = ftpPut(ftpClient); break; default: throw new IllegalArgumentException("FTP MODE can only be PUT or GET."); } ftpClient.logout(); ftpClient.disconnect(); getOut().println("Disconnected"); return (Serializable) filesRelativePathName; }

Target:
public Serializable execute(TaskResult... results) throws IOException { List<String> filesRelativePathName; FTPClient ftpClient = new FTPClient(); try { ftpClient.connect(ftpHostname, ftpPort); int reply = ftpClient.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { ftpClient.disconnect(); throw new IOException("Exception in connecting to FTP Server"); } if (!ftpClient.login(ftpUsername, ftpPassword)) { throw new IOException("Logging refused."); } ftpClient.enterLocalPassiveMode(); getOut().println("Connected"); switch (ftpMode) { case "GET": filesRelativePathName = ftpGet(ftpClient); break; case "PUT": filesRelativePathName = ftpPut(ftpClient); break; default: throw new IllegalArgumentException("FTP MODE can only be PUT or GET."); } } catch (IOException e) { throw new IOException("Connection issues. The hostname and/or ftpPort can be wrong."); } finally { ftpClient.logout(); ftpClient.disconnect(); getOut().println("Disconnected"); } return (Serializable) filesRelativePathName; }
Source:
private void init501() { Builder version = forVersion(VersionEnum.V5_0_1); Builder.BuilderWithTableName spidxDate = version.onTable("HFJ_SPIDX_DATE"); spidxDate.addIndex("20200520.1", "IDX_SP_DATE_HASH_LOW").unique(false).withColumns("HASH_IDENTITY", "SP_VALUE_LOW"); spidxDate.addIndex("20200520.2", "IDX_SP_DATE_ORD_DATE_HASH").unique(false).withColumns("HASH_IDENTITY", "SP_VALUE_LOW_DATE_ORDINAL", "SP_VALUE_HIGH_DATE_ORDINAL"); spidxDate.addIndex("20200520.3", "IDX_SP_DATE_ORD_DATE_HASH_LOW").unique(false).withColumns("HASH_IDENTITY", "SP_VALUE_LOW_DATE_ORDINAL"); }

Target:
private void init501() { Builder version = forVersion(VersionEnum.V5_0_1); Builder.BuilderWithTableName spidxDate = version.onTable("HFJ_SPIDX_DATE"); spidxDate.addIndex("20200514.1", "IDX_SP_DATE_HASH_LOW").unique(false).withColumns("HASH_IDENTITY", "SP_VALUE_LOW"); spidxDate.addIndex("20200514.2", "IDX_SP_DATE_ORD_HASH").unique(false).withColumns("HASH_IDENTITY", "SP_VALUE_LOW_DATE_ORDINAL", "SP_VALUE_HIGH_DATE_ORDINAL"); spidxDate.addIndex("20200514.3", "IDX_SP_DATE_ORD_HASH_LOW").unique(false).withColumns("HASH_IDENTITY", "SP_VALUE_LOW_DATE_ORDINAL"); }
Source:
public static void main(String[] args) throws Exception { Map<String, Object> opts = new Docopt(USAGE) .withVersion(GitRepositoryState.getRepositoryState().describe) .parse(args); String corfuConfigurationString = (String) opts.get("-c"); CorfuRuntime runtime = getRuntimeAndConnect(corfuConfigurationString); CorfuStore corfuStore = new CorfuStore(runtime); String namespace = "aaa"; String tableName = "profile"; corfuStore.openTable(namespace, tableName, Name.class, Car.class, null, TableOptions.builder().build()); corfuStore.tx(namespace) .create(tableName, Name.newBuilder().setFirstName("a").setLastName("x").build(), Car.newBuilder().setColor("red").build(), null) .commit(); CorfuRecord record = corfuStore.query(namespace) .getRecord(tableName, Name.newBuilder().setFirstName("a").setLastName("x").build()); System.out.println("Car = " + record.getPayload()); corfuStore.tx(namespace) .update(tableName, Name.newBuilder().setFirstName("a").setLastName("x").build(), Car.newBuilder().setColor("silver").build(), null) .commit(); record = corfuStore.query(namespace) .getRecord(tableName, Name.newBuilder().setFirstName("a").setLastName("x").build()); System.out.println("Car = " + record.getPayload()); }

Target:
public static void main(String[] args) throws Exception { Map<String, Object> opts = new Docopt(USAGE) .withVersion(GitRepositoryState.getRepositoryState().describe) .parse(args); String corfuConfigurationString = (String) opts.get("-c"); CorfuRuntime runtime = getRuntimeAndConnect(corfuConfigurationString); CorfuStore corfuStore = new CorfuStore(runtime); String namespace = "credentials"; String tableName = "profile"; corfuStore.openTable(namespace, tableName, Name.class, Car.class, null, TableOptions.builder().build()); corfuStore.tx(namespace) .create(tableName, Name.newBuilder().setFirstName("a").setLastName("x").build(), Car.newBuilder().setColor("red").build(), null) .commit(); CorfuRecord record = corfuStore.query(namespace) .getRecord(tableName, Name.newBuilder().setFirstName("a").setLastName("x").build()); System.out.println("Car = " + record.getPayload()); corfuStore.tx(namespace) .update(tableName, Name.newBuilder().setFirstName("a").setLastName("x").build(), Car.newBuilder().setColor("silver").build(), null) .commit(); record = corfuStore.query(namespace) .getRecord(tableName, Name.newBuilder().setFirstName("a").setLastName("x").build()); System.out.println("Car = " + record.getPayload()); }
Source:
public void clearBuffer() { if (trimJob != null) { trimJob.setOffset(-1); trimJob.schedule(); } }

Target:
public void clearBuffer() { trimJob.setOffset(-1); trimJob.schedule(); }
Source:
public void addStream(long id, File streamFile) throws CTFReaderException { if (!fStreams.containsKey(id)) { fStreams.put(id, new Stream(this)); } Stream stream = fStreams.get(id); stream.addInput(new StreamInput(stream, streamFile)); }

Target:
public void addStream(long id, File streamFile) throws CTFReaderException { Stream stream = null; if (fStreams.containsKey(id)) { stream = fStreams.get(id); } else { stream = new Stream(this); fStreams.put(id, stream); } stream.addInput(new StreamInput(stream, streamFile)); }
Source:
public void testSynchronousIgnoreLeaversInvocationToNonMembers() throws Exception { UUID randomUuid = UUID.randomUUID(); Address randomAddress = JGroupsAddressCache.fromJGroupsAddress(randomUuid); JGroupsTransport transport = (JGroupsTransport) manager(0).getTransport(); long initialMessages = transport.getChannel().getSentMessages(); ReplicableCommand command = new ClusteredGetCommand("key", CACHE_NAME, TestingUtil.getSegmentForKey("key", cache(0)), 0); CompletableFuture<Map<Address, Response>> future = transport .invokeRemotelyAsync(Collections.singletonList(randomAddress), command, ResponseMode.SYNCHRONOUS_IGNORE_LEAVERS, 1, null, DeliverOrder.NONE, true); assertEquals(CacheNotFoundResponse.INSTANCE, future.get().get(randomAddress)); assertEquals(initialMessages, transport.getChannel().getSentMessages()); }

Target:
public void testSynchronousIgnoreLeaversInvocationToNonMembers() throws Exception { UUID randomUuid = UUID.randomUUID(); Address randomAddress = JGroupsAddressCache.fromJGroupsAddress(randomUuid); JGroupsTransport transport = (JGroupsTransport) manager(0).getTransport(); long initialMessages = transport.getChannel().getSentMessages(); ReplicableCommand command = new ClusteredGetCommand("key", CACHE_NAME, 0, 0); CompletableFuture<Map<Address, Response>> future = transport .invokeRemotelyAsync(Collections.singletonList(randomAddress), command, ResponseMode.SYNCHRONOUS_IGNORE_LEAVERS, 1, null, DeliverOrder.NONE, true); assertEquals(CacheNotFoundResponse.INSTANCE, future.get().get(randomAddress)); assertEquals(initialMessages, transport.getChannel().getSentMessages()); }
Source:
public SolenoidOff(SolenoidSubsystem system, BooleanSupplier... booleanSuppliers) { super("Turning off " + system.getName(), system, SolenoidState.OFF, booleanSuppliers); }

Target:
public SolenoidOff(SolenoidSubsystem system, BooleanSupplier... booleanSuppliers) { this("Turning off " + system.getName(), system, booleanSuppliers); }