auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void replicaFromStandbyToLeaderTest() throws Exception { MockClusterMap clusterMap = new MockClusterMap(); ClusterMapConfig clusterMapConfig = new ClusterMapConfig(verifiableProperties); MockHelixParticipant mockHelixParticipant = new MockHelixParticipant(clusterMapConfig); Pair<StorageManager, ReplicationManager> managers = createStorageManagerAndReplicationManager(clusterMap, clusterMapConfig, mockHelixParticipant); StorageManager storageManager = managers.getFirst(); MockReplicationManager replicationManager = (MockReplicationManager) managers.getSecond(); PartitionId existingPartition = replicationManager.partitionToPartitionInfo.keySet().iterator().next(); <START> String currentdatacenter = <END> storageManager.getReplica(existingPartition.toString()).getDataNodeId().getDatacenterName(); mockHelixParticipant.onPartitionBecomeLeaderFromStandby(existingPartition.toPathString()); List<ReplicaId> peerLeaderReplicasInReplicationManager = replicationManager.getPeerLeaderReplicasByPartition().get(existingPartition.toString()); List<ReplicaId> peerLeaderReplicasInClusterMap = (List<ReplicaId>) existingPartition.getReplicaIdsByState(ReplicaState.LEADER, null) .stream() .filter(r -> !r.getDataNodeId().getDatacenterName().equals(currentdatacenter)) .collect(Collectors.toList()); assertThat("mismatch in leader peer replicas", peerLeaderReplicasInReplicationManager, is(peerLeaderReplicasInClusterMap)); storageManager.shutdown(); }</code><technical_language>nit: CamelCase currentDataCenter</technical_language>

Target:
public void replicaFromStandbyToLeaderTest() throws Exception { MockClusterMap clusterMap = new MockClusterMap(); ClusterMapConfig clusterMapConfig = new ClusterMapConfig(verifiableProperties); MockHelixParticipant.metricRegistry = new MetricRegistry(); MockHelixParticipant mockHelixParticipant = new MockHelixParticipant(clusterMapConfig); Pair<StorageManager, ReplicationManager> managers = createStorageManagerAndReplicationManager(clusterMap, clusterMapConfig, mockHelixParticipant); StorageManager storageManager = managers.getFirst(); MockReplicationManager replicationManager = (MockReplicationManager) managers.getSecond(); PartitionId existingPartition = replicationManager.partitionToPartitionInfo.keySet().iterator().next(); String currentDataCenter = storageManager.getReplica(existingPartition.toString()).getDataNodeId().getDatacenterName(); mockHelixParticipant.onPartitionBecomeLeaderFromStandby(existingPartition.toPathString()); List<ReplicaId> peerLeaderReplicasInReplicationManager = replicationManager.getPeerLeaderReplicasByPartition().get(existingPartition.toPathString()); List<ReplicaId> peerLeaderReplicasInClusterMap = existingPartition.getReplicaIdsByState(ReplicaState.LEADER, null) .stream() .filter(r -> !r.getDataNodeId().getDatacenterName().equals(currentDataCenter)) .collect(Collectors.toList()); assertThat("Mismatch in list of leader peer replicas stored by partition in replication manager and cluster map", peerLeaderReplicasInReplicationManager, is(peerLeaderReplicasInClusterMap)); storageManager.shutdown(); }
Source:
<code>public void valuesAtLocation_single_assignment() { Name x = (Name) lastExpressionInFunction("x = 42; x"); <START> ReachingDefinitionsAnalysis analysis = new ReachingDefinitionsAnalysis(file); <END> assertThat(analysis.valuesAtLocation(x)).extracting(expression -> ((NumericLiteral) expression).valueAsString()).containsExactly("42"); }</code><technical_language>This line is repeated in test. I able move line 40</technical_language>

Target:
public void valuesAtLocation_single_assignment() { Name x = (Name) lastExpressionInFunction("x = 42; x"); assertThat(analysis.valuesAtLocation(x)).extracting(ReachingDefinitionsAnalysisTest::getValueAsString).containsExactly("42"); }
Source:
<code><START> boolean isRngSupportedByCluster() { <END> VDSGroup cluster = getVdsGroup(); VmRngDevice.Source source = getParameters().getRngDevice().getSource(); return cluster != null && FeatureSupported.virtIoRngSupported(cluster.getcompatibility_version()) && cluster.getRequiredRngSources().contains(source); }</code><technical_language>remove method modifier</technical_language>

Target:
protected boolean isRngSupportedByCluster() { VDSGroup cluster = getVdsGroup(); VmRngDevice.Source source = getParameters().getRngDevice().getSource(); return cluster != null && isFeatureSupported(cluster.getcompatibility_version()) && cluster.getRequiredRngSources().contains(source); }
Source:
<code>public void upgrade(SQLiteDatabase db, int oldVersion, int newVersion) { if (oldVersion == 1) { if (upgradeOneTwo(db, oldVersion, newVersion)) { oldVersion = 2; } } if (oldVersion == 2) { if (upgradeTwoThree(db)) { oldVersion = 3; } } if (oldVersion == 3) { if (upgradeThreeFour(db)) { oldVersion = 4; } } if (oldVersion == 4) { if (upgradeFourFive(db)) { oldVersion = 5; } } if (oldVersion == 5) { <START> upgradeFiveSix(db); <END> } }</code><technical_language>This set oldVersion 6 finishes</technical_language>

Target:
public void upgrade(SQLiteDatabase db, int oldVersion, int newVersion) { if (oldVersion == 1) { if (upgradeOneTwo(db, oldVersion, newVersion)) { oldVersion = 2; } } if (oldVersion == 2) { if (upgradeTwoThree(db)) { oldVersion = 3; } } if (oldVersion == 3) { if (upgradeThreeFour(db)) { oldVersion = 4; } } if (oldVersion == 4) { if (upgradeFourFive(db)) { oldVersion = 5; } } if (oldVersion == 5) { if (upgradeFiveSix(db)) { oldVersion = 6; } } }
Source:
<code>public void shouldRunFlyweightTaskOnProvisionedNodeWhenNodeRestricted() throws Exception { MatrixProject project = r.createMatrixProject(); project.setAxes(new AxisList( new Axis("axis", "a", "b") )); Label label = LabelExpression.get("aws-linux-dummy"); DummyCloudImpl dummyCloud = new DummyCloudImpl(r, 0); dummyCloud.label = label; r.jenkins.clouds.add(dummyCloud); project.setAssignedLabel(label); <START> r.assertBuildStatusSuccess(project.scheduleBuild2(0)); <END> }</code><technical_language>build ti sense ensure FlyWeight task launched cloud</technical_language>

Target:
public void shouldRunFlyweightTaskOnProvisionedNodeWhenNodeRestricted() throws Exception { MatrixProject matrixProject = r.createMatrixProject(); matrixProject.setAxes(new AxisList( new Axis("axis", "a", "b") )); Label label = LabelExpression.get("aws-linux-dummy"); DummyCloudImpl dummyCloud = new DummyCloudImpl(r, 0); dummyCloud.label = label; r.jenkins.clouds.add(dummyCloud); matrixProject.setAssignedLabel(label); r.assertBuildStatusSuccess(matrixProject.scheduleBuild2(0)); assertEquals("aws-linux-dummy", matrixProject.getBuilds().getLastBuild().getBuiltOn().getLabelString()); }
Source:
<code>public void dispose() { cm.unregisterForAvailable(this); cm.unregisterForRadioStateChanged(this); cm.unregisterForNetworkStateChanged(this); cm.unregisterForSIMReady(this); phone.mSIMRecords.unregisterForRecordsLoaded(this); cm.unSetOnSignalStrengthUpdate(this); cm.unSetOnNITZTime(this); <START> this.removeCallbacksAndMessages(null); <END> cr.unregisterContentObserver(this.mAutoTimeObserver); this.phone = null; this.cm = null; this.ss = null; this.newSS = null; this.cellLoc = null; this.newCellLoc = null; this.cr = null; this.mAutoTimeObserver = null; this.gprsAttachedRegistrants = null; this.gprsDetachedRegistrants = null; }</code><technical_language>this.removeCallbacksAndMessages(null) instead. Done in Patch set 2</technical_language>

Target:
public void dispose() { cm.unregisterForAvailable(this); cm.unregisterForRadioStateChanged(this); cm.unregisterForNetworkStateChanged(this); cm.unregisterForSIMReady(this); phone.mSIMRecords.unregisterForRecordsLoaded(this); cm.unSetOnSignalStrengthUpdate(this); cm.unSetOnNITZTime(this); cr.unregisterContentObserver(this.mAutoTimeObserver); }
Source:
<code>private CepInput(final CepInputType cepInputTypeParam, final Map<String, Object> cepInputConfigurationParam, final List<Tuple2<String, CepValueType>> fieldsParam){ <START> this.cepInputType = cepInputTypeParam; <END> this.cepInputConfiguration = cepInputConfigurationParam; this.fields = fieldsParam; this.separator = ","; }</code><technical_language>this(cepInputTypeParam, cepInputConfigurationParam, fieldsParam, DEFAULT_SEPARATOR);</technical_language>

Target:
private CepInput(final CepInputType cepInputTypeParam, final Map<String, Object> cepInputConfigurationParam, final List<Tuple2<String, CepValueType>> fieldsParam) { this(cepInputTypeParam, cepInputConfigurationParam, fieldsParam, DEFAULT_SEPARATOR); }
Source:
<code>public MatrixAggregator createAggregator(MatrixBuild matrixBuild, Launcher launcher, BuildListener buildListener) { return new MatrixAggregator(matrixBuild, launcher, buildListener) { @Override <START> public boolean startBuild() throws InterruptedException, IOException { <END> if (getMatrixTriggerMode().forParent) { return SlackNotifier.this.perform(this.build, this.launcher, this.listener); } return true; } @Override public boolean endBuild() throws InterruptedException, IOException { if (getMatrixTriggerMode().forParent) { return SlackNotifier.this.perform(this.build, this.launcher, this.listener); } return true; } }; }</code><technical_language>IntelliJ exception declarations unneeded? suggestion public boolean startBuild() {</technical_language>

Target:
public MatrixAggregator createAggregator(MatrixBuild matrixBuild, Launcher launcher, BuildListener buildListener) { return new MatrixAggregator(matrixBuild, launcher, buildListener) { @Override public boolean startBuild() { if (getMatrixTriggerMode().forParent) { return SlackNotifier.this.perform(this.build, this.launcher, this.listener); } return true; } @Override public boolean endBuild() { if (getMatrixTriggerMode().forParent) { return SlackNotifier.this.perform(this.build, this.launcher, this.listener); } return true; } }; }
Source:
<code>public Visitor(Session session, Metadata metadata, SqlParser parser, Map<Symbol, Type> types) { <START> this.session = session; <END> this.metadata = metadata; this.parser = parser; this.types = types; }</code><technical_language>require non-null</technical_language>

Target:
Visitor(Session session, Metadata metadata, SqlParser parser, Map<Symbol, Type> types) { this.session = requireNonNull(session, "session is null"); this.metadata = requireNonNull(metadata, "metadata is null"); this.parser = requireNonNull(parser, "parser is null"); this.types = requireNonNull(types, "types is null"); }
Source:
<code>public void open() throws TTransportException { if (conn.getState() != Constants.ConnState.CONNECTED) { throw new TTransportException(TTransportException.NOT_OPEN, "NATS not connected, has status " + conn.getState()); <START> } <END> if (connectionSubject != null) { handshake(); } if (listenTo == null || "".equals(listenTo) || writeTo == null || "".equals(writeTo)) { throw new TTransportException("listenTo and writeTo cannot be empty."); } writeBuffer = ByteBuffer.allocate(NATS_MAX_MESSAGE_SIZE); try { writer = new PipedOutputStream(); reader = new PipedInputStream(writer); } catch (IOException e) { throw new TTransportException(e); } sub = conn.subscribe(listenTo, new MessageHandler() { @Override public void onMessage(Message msg) { if (DISCONNECT.equals(msg.getReplyTo())) { close(); return; } try { writer.write(msg.getData()); writer.flush(); } catch (IOException e) { LOGGER.warning("could not write incoming data to buffer" + e.getMessage()); } } }); if (heartbeatInterval > 0) { startTimer(); heartbeatSub = conn.subscribe(heartbeatListen, new MessageHandler() { @Override public void onMessage(Message message) { receiveHeartbeat(); conn.publish(heartbeatReply, null); } }); } }</code><technical_language>question calling isOpen()</technical_language>

Target:
public synchronized void open() throws TTransportException { if (conn.getState() != Constants.ConnState.CONNECTED) { throw new TTransportException(TTransportException.NOT_OPEN, "NATS not connected, has status " + conn.getState()); } if (isOpen) { throw new TTransportException(TTransportException.ALREADY_OPEN, "NATS transport already open"); } if (connectionSubject != null) { handshake(); } if (listenTo == null || "".equals(listenTo) || writeTo == null || "".equals(writeTo)) { throw new TTransportException("listenTo and writeTo cannot be empty."); } writeBuffer = ByteBuffer.allocate(NATS_MAX_MESSAGE_SIZE); try { writer = new PipedOutputStream(); reader = new PipedInputStream(writer); } catch (IOException e) { throw new TTransportException(e); } sub = conn.subscribe(listenTo, new MessageHandler() { @Override public void onMessage(Message msg) { if (DISCONNECT.equals(msg.getReplyTo())) { close(); return; } try { writer.write(msg.getData()); writer.flush(); } catch (IOException e) { LOGGER.warning("could not write incoming data to buffer" + e.getMessage()); } } }); if (heartbeatInterval > 0) { startTimer(); heartbeatSub = conn.subscribe(heartbeatListen, new MessageHandler() { @Override public void onMessage(Message message) { receiveHeartbeat(); conn.publish(heartbeatReply, null); } }); } isOpen = true; }
Source:
<code>public void updatePartitionKeyAndRowKey() { Schema inputSchema = schema.schema.getValue(); <START> possibleValues = new ArrayList<String>(); <END> for (Field field : inputSchema.getFields()) { Schema fSchema = field.schema(); if (fSchema.getType() == Type.UNION) { for (Schema s : field.schema().getTypes()) { if (s.getType() != Type.NULL) { fSchema = s; break; } } } if (fSchema.getType().equals(Type.STRING)) { possibleValues.add(field.name()); } } partitionKey.setPossibleValues(possibleValues); rowKey.setPossibleValues(possibleValues); }</code><technical_language>this a local variable</technical_language>

Target:
public void updatePartitionKeyAndRowKey() { Schema inputSchema = schema.schema.getValue(); List<String> possibleValues = new ArrayList<String>(); for (Field field : inputSchema.getFields()) { Schema fSchema = field.schema(); if (fSchema.getType() == Type.UNION) { for (Schema s : field.schema().getTypes()) { if (s.getType() != Type.NULL) { fSchema = s; break; } } } if (fSchema.getType().equals(Type.STRING)) { possibleValues.add(field.name()); } } partitionKey.setPossibleValues(possibleValues); rowKey.setPossibleValues(possibleValues); }
Source:
<code>public void writeToXml(PrintWriter pw1, int indent) { writeToXmlBegin(pw1, indent); <START> MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "typeName", MekHqXmlUtil.escape(type.getInternalName())); <END> MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "equipmentNum", equipmentNum); MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "size", size); MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "equipTonnage", equipTonnage); writeToXmlEnd(pw1, indent); }</code><technical_language>suggestion MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "typeName", type.getInternalName());</technical_language>

Target:
public void writeToXml(PrintWriter pw1, int indent) { writeToXmlBegin(pw1, indent); MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "typeName", type.getInternalName()); MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "equipmentNum", equipmentNum); MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "size", size); MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "equipTonnage", equipTonnage); writeToXmlEnd(pw1, indent); }
Source:
<code>public boolean acknowledgeRecord(ConsumerRecord<?, ?> record) throws InterruptedException { lock.readLock().lock(); try { boolean acknowledged; TopicPartition topicPartition = new TopicPartition(record.topic(), record.partition()); if (!assignment.contains(topicPartition)) { <START> acknowledged = false; <END> } else { long commitOffset = record.offset() + 1; OffsetAndMetadata offsetAndMetadata = new OffsetAndMetadata(commitOffset, "Commit From Forklift Server"); pendingOffsets.merge(topicPartition, offsetAndMetadata, this::greaterOffset); acknowledged = true; } return acknowledged; } finally { lock.readLock().unlock(); } }</code><technical_language>return false return true instead of setting intermediate variable</technical_language>

Target:
public boolean acknowledgeRecord(ConsumerRecord<?, ?> record) throws InterruptedException { lock.readLock().lock(); try { TopicPartition topicPartition = new TopicPartition(record.topic(), record.partition()); if (!assignment.contains(topicPartition)) { return false; } long commitOffset = record.offset() + 1; OffsetAndMetadata offsetAndMetadata = new OffsetAndMetadata(commitOffset, "Commit From Forklift Server"); offsets.merge(topicPartition, offsetAndMetadata, this::greaterOffset); return true; } finally { lock.readLock().unlock(); } }
Source:
<code>public double getScaleFactor() { if (method_getScaleFactor != null) { try { <START> return Math.max(0.25f, Math.min((Float)method_getScaleFactor.invoke(realScaleGestureDetector), 1.95f)); END> } catch (Exception e) { e.printStackTrace(); return 1.0; } } return 1.0; }</code><technical_language>Is limit needed? I limit this hardcoded</technical_language>

Target:
public double getScaleFactor() { if (method_getScaleFactor != null) { try { return (Float) method_getScaleFactor.invoke(realScaleGestureDetector); } catch (Exception e) { e.printStackTrace(); return 1.0; } } return 1.0; }
Source:
<code>protected void buildSrcAttribute(final ComponentTag tag, IModel<?> srcModel) { <START> tag.put("src", srcModel.getObject().toString()); <END> }</code><technical_language>good test srcModel.getObject() for null throw a NPE, String.valueOf(). I prefer solution allows deal null (log warning for instance)..</technical_language>

Target:
protected void buildSrcAttribute(final ComponentTag tag, IModel<?> srcModel) { tag.put("src", String.valueOf(srcModel.getObject())); }
Source:
<code>public PageHelper<E> addBooleanFacet(String name, String title) { Objects.requireNonNull(ctx); Facet facet = new Facet(title, name, ctx.get(name).asString(), null); facet.addItem("true", NLS.get("NLS.yes"), -1); facet.addItem("false", NLS.get("NLS.no"), -1); return addFacet(facet, (f, q) -> { Value isUsed = Value.of(f.getValue()); if (isUsed.isFilled()) { <START> q.eqIgnoreNull(Column.named(f.getName()), isUsed.asBoolean()); <END> } }); }</code><technical_language>ignoreNull removed</technical_language>

Target:
public PageHelper<E> addBooleanFacet(String name, String title) { Objects.requireNonNull(ctx); Facet facet = new Facet(title, name, ctx.get(name).asString(), null); facet.addItem("true", NLS.get("NLS.yes"), -1); facet.addItem("false", NLS.get("NLS.no"), -1); return addFacet(facet, (f, q) -> { Value filterValue = Value.of(f.getValue()); if (filterValue.isFilled()) { q.eq(Column.named(f.getName()), filterValue.asBoolean()); } }); }
Source:
<code>public static void skipContent(@Nonnull JayceInternalReaderImpl in) <START> throws IOException { <END> throw new UnsupportedOperationException(); }</code><technical_language>Remove</technical_language>

Target:
public static void skipContent(@Nonnull JayceInternalReaderImpl in) { throw new UnsupportedOperationException(); }
Source:
<code>public SimpleLitTemplateNoShadowRootView() { <START> add(new SimpleLitTemplateNoShadowRoot()); <END> }</code><technical_language>reason SimpleLitTemplateNoShadowRoot a route target</technical_language>

Target:
public SimpleLitTemplateNoShadowRootView() { getElement().setProperty("text", "Client button"); mappedButton.setText("Server button"); mappedButton.addClickListener(e -> { label.setText("Hello from server component event listener"); }); }
Source:
<code>protected void sendLine(String text, Object... parameters) throws IOException { <START> out.format(FORMAT_LOCALE, text.replace(" ", "")+LINEEND(), parameters); <END> System.out.println(String.format(FORMAT_LOCALE, "> "+text+LINEEND(), parameters)); out.flush(); if (isWaitForOKafterEachLine()) { String line = waitForLine(); if (!"ok".equals(line)) { throw new IOException("Lasercutter did not respond 'ok', but '"+line+"'instead."); } } }</code><technical_language>mind overriding this method in GRBL driver, I if other G-Code interpreters need spaces..</technical_language>

Target:
protected void sendLine(String text, Object... parameters) throws IOException { out.format(FORMAT_LOCALE, text+LINEEND(), parameters); System.out.println(String.format(FORMAT_LOCALE, "> "+text+LINEEND(), parameters)); out.flush(); if (isWaitForOKafterEachLine()) { String line = waitForLine(); if (!"ok".equals(line)) { throw new IOException("Lasercutter did not respond 'ok', but '"+line+"'instead."); } } }
Source:
<code>public AbstractSosResponseEncoder(Class<T> type, String operation) { super(type, new OperationEncoderKey(SosConstants.SOS, Sos2Constants.SERVICEVERSION, operation, MediaTypes.APPLICATION_JSON), <START> new OperationEncoderKey(SosConstants.SOS, Sos1Constants.SERVICEVERSION, operation, <END> MediaTypes.APPLICATION_JSON)); }</code><technical_language>JSON de-/encoding implemented for SOS 2.0 O&M 2.0. for JSON schemas. I JSON AbstractSosResponseEncoder support SOS 1.0.0</technical_language>

Target:
public AbstractSosResponseEncoder(Class<T> type, String operation) { super(type, new OperationEncoderKey(SosConstants.SOS, Sos2Constants.SERVICEVERSION, operation, MediaTypes.APPLICATION_JSON)); }
Source:
<code>public String getName() { <START> return name != null ? name : ""; <END> }</code><technical_language>@RomanNikitenko FYI - com.google.common.base.Strings#nullToEmpty</technical_language>

Target:
public String getName() { return firstNonNull(name, ""); }
Source:
<code>public PriceIndexValues priceIndexValues(PriceIndex index) { Curve curve = marketData.getValue(PriceIndexCurveKey.of(index)); <START> if (curve == null) { <END> throw new IllegalArgumentException("Unable to find forward curve: " + index); } if (!(curve instanceof InterpolatedNodalCurve)) { throw new IllegalArgumentException("Curve must be an InterpolatedNodalCurve: " + index); } return ForwardPriceIndexValues.of(index, getValuationDate(), (InterpolatedNodalCurve) curve, timeSeries(index)); }</code><technical_language>MarketData.getValue returns null</technical_language>

Target:
public PriceIndexValues priceIndexValues(PriceIndex index) { Curve curve = marketData.getValue(PriceIndexCurveKey.of(index)); if (!(curve instanceof InterpolatedNodalCurve)) { throw new IllegalArgumentException("Curve must be an InterpolatedNodalCurve: " + index); } return ForwardPriceIndexValues.of(index, getValuationDate(), (InterpolatedNodalCurve) curve, timeSeries(index)); }
Source:
<code>GC100IRConnection(InetAddress ipAddress, String ipAddressString, int port, int module, int connector, <START> String deviceType) throws IOException { <END> this.inetAddress = ipAddress; this.ipAddressString = ipAddressString; this.port = port; this.module = module; this.connector = connector; this.deviceType = deviceType; }</code><technical_language>constructor throw IOException</technical_language>

Target:
GC100IRConnection(InetAddress ipAddress, String ipAddressString, int port, int module, int connector, String deviceType) { this.inetAddress = ipAddress; this.ipAddressString = ipAddressString; this.port = port; this.module = module; this.connector = connector; this.deviceType = deviceType; }
Source:
<code>private void simpleTransactionInAnotherThread() throws Exception { final IgniteCache<String, Integer> cache = jcache(grid(0), cacheConfiguration(null).setName("testCache"), String.class, Integer.class); final IgniteTransactions transactions = transactions(); assertNull(cache.get("key1")); final Transaction tx = transactions.txStart(transactionConcurrency, transactionIsolation); cache.put("key1", 1); cache.put("key2", 2); tx.suspend(); assertNull(cache.get("key1")); IgniteInternalFuture<Boolean> fut = GridTestUtils.runAsync(new Callable<Boolean>() { @Override public Boolean call() throws Exception { Assert.assertNull(transactions.tx()); Assert.assertEquals(TransactionState.SUSPENDED, tx.state()); tx.resume(); Assert.assertEquals(TransactionState.ACTIVE, tx.state()); cache.put("key3", 3); cache.remove("key2"); tx.commit(); return true; } }); try { fut.get(); } catch (IgniteCheckedException e) { <START> e.printStackTrace(); <END> fail("Transaction in another thread failed"); } Assert.assertEquals(TransactionState.COMMITTED, tx.state()); Assert.assertEquals((long)1, (long)cache.get("key1")); Assert.assertEquals((long)3, (long)cache.get("key3")); Assert.assertFalse(cache.containsKey("key2")); cache.removeAll(); }</code><technical_language>rename "e" "ignired" print stack trace this. Do need print it</technical_language>

Target:
private void simpleTransactionInAnotherThread() throws IgniteCheckedException { final IgniteCache<String, Integer> cache = jcache(txInitiatorNodeId); final IgniteTransactions transactions = ignite(txInitiatorNodeId).transactions(); assertNull(cache.get("key1")); final Transaction tx = transactions.txStart(TransactionConcurrency.OPTIMISTIC, transactionIsolation); cache.put("key1", 1); cache.put("key2", 2); tx.suspend(); assertNull(cache.get("key1")); IgniteInternalFuture<Boolean> fut = GridTestUtils.runAsync(new Callable<Boolean>() { @Override public Boolean call() throws Exception { assertNull(transactions.tx()); assertEquals(TransactionState.SUSPENDED, tx.state()); tx.resume(); assertEquals(TransactionState.ACTIVE, tx.state()); cache.put("key3", 3); cache.remove("key2"); tx.commit(); return true; } }); fut.get(5000); assertEquals(TransactionState.COMMITTED, tx.state()); assertEquals((long)1, (long)cache.get("key1")); assertEquals((long)3, (long)cache.get("key3")); assertFalse(cache.containsKey("key2")); cache.removeAll(); }
Source:
<code>public void add(final RyaStatement statement) throws RyaDAOException { try { <START> final boolean canAdd = DocumentVisibilityUtil.doesUserHaveDocumentAccess(auths, statement.getColumnVisibility()); <END> if (canAdd) { coll.insert(storageStrategy.serialize(statement)); for(final RyaSecondaryIndexer index: secondaryIndexers) { index.storeStatement(statement); } } } catch (final IOException e) { log.error("Unable to add: " + statement.toString()); throw new RyaDAOException(e); } catch (final DuplicateKeyException e){ log.error("Attempting to load duplicate triple: " + statement.toString()); } }</code><technical_language>check later, this doesUserHaveCollectionAccess</technical_language>

Target:
public void add(final RyaStatement statement) throws RyaDAOException { try { final boolean canAdd = DocumentVisibilityUtil.doesUserHaveDocumentAccess(auths, statement.getColumnVisibility()); if (canAdd) { coll.insert(storageStrategy.serialize(statement)); for(final RyaSecondaryIndexer index: secondaryIndexers) { index.storeStatement(statement); } } else { throw new RyaDAOException("User does not have the required authorizations to add statement"); } } catch (final IOException e) { log.error("Unable to add: " + statement.toString()); throw new RyaDAOException(e); } catch (final DuplicateKeyException e){ log.error("Attempting to load duplicate triple: " + statement.toString()); } }
Source:
<code>public void stop() { ServiceStateLogic.setExpectedState(this, Lifecycle.STOPPING); <START> StartableMethods.stop(this); <END> ServiceStateLogic.setExpectedState(this, Lifecycle.STOPPED); }</code><technical_language>this wrapped in a try-catch, do ServiceStateLogic.setExpectedState(this, Lifecycle.ON_FIRE);? For example, DynamicClusterImpl.stop() AbstractApplication.stop()</technical_language>

Target:
public void stop() { ServiceStateLogic.setExpectedState(this, Lifecycle.STOPPING); setAttribute(SERVICE_UP, false); try { StartableMethods.stop(this); ServiceStateLogic.setExpectedState(this, Lifecycle.STOPPED); } catch (Exception e) { ServiceStateLogic.setExpectedState(this, Lifecycle.ON_FIRE); throw Exceptions.propagate(e); } }
Source:
<code>public static Trade adaptTrade(LatokenTrade latokenTrade, CurrencyPair pair) { return new Trade( adaptOrderType(latokenTrade.getSide()), BigDecimal.valueOf(latokenTrade.getAmount()), pair, BigDecimal.valueOf(latokenTrade.getPrice()), latokenTrade.getTimestamp(), <START> null); <END> }</code><technical_language>builder</technical_language>

Target:
public static Trade adaptTrade(LatokenTrade latokenTrade, CurrencyPair pair) { return new Trade.Builder() .type(adaptOrderType(latokenTrade.getSide())) .currencyPair(pair) .originalAmount(latokenTrade.getAmount()) .price(latokenTrade.getPrice()) .timestamp(latokenTrade.getTimestamp()) .build(); }
Source:
<code>public void changeDefaultServer(String nameNewServer) { new DefaultHyperlink(new WithTooltipTextMatcher("Change Default Server;")); if (new ShellIsActive("Default server unchanged").test()) { throw new Error("Only 1 server is configured"); } <START> if (new ShellIsActive("Server Selection").test()) { <END> new DefaultCombo().setSelection(nameNewServer); new OkButton().click(); } if (new ShellIsActive("Change of Teiid Version").test()) { new YesButton(new DefaultShell("Change of Teiid Version")).click(); } if (new ShellIsActive("Untested Teiid Version").test()) { new YesButton(new DefaultShell("Untested Teiid Version")).click(); } if (new ShellIsActive("Disconnect Current Default Instance").test()) { new YesButton(new DefaultShell("Disconnect Current Default Instance")).click(); } if (new ShellIsActive("Default Server Changed").test()) { new OkButton(new DefaultShell("Default Server Changed")).click(); } else if (new ShellIsActive("Default server unchanged").test()) { new OkButton(new DefaultShell("Default server unchanged")).click(); } else { throw new Error("Default server not been changed due to an error"); } }</code><technical_language>usage is if (new ShellIsAvailable("Server Selection").test()) { shell = new DefaultShell("Server Selection"); new DefaultCombo(shell).setSelection(...); new OkButton(shell).click(); } code brings stability tests. If wanted more precise condition = new WaitUntil(new ShellIsAvailable("Server Selection"), TimePeriod.DEFAULT, false); // notice 'false' if (condition.getResult() != null) { new DefaultCombo(condition.getResult()).setSelection(...); new OkButton(condition.getResult()).click(); } this a lot of time</technical_language>

Target:
public void changeDefaultServer(String nameNewServer) { new DefaultHyperlink(new WithTooltipTextMatcher("Change Default Server;")); if (new ShellIsAvailable("Default server unchanged").test()) { throw new Error("Only 1 server is configured"); } DefaultShell shell = new DefaultShell("Server Selection"); if (new ShellIsAvailable(shell).test()) { new DefaultCombo().setSelection(nameNewServer); new OkButton().click(); } if (new ShellIsAvailable("Change of Teiid Version").test()) { new YesButton(new DefaultShell("Change of Teiid Version")).click(); } if (new ShellIsAvailable("Untested Teiid Version").test()) { new YesButton(new DefaultShell("Untested Teiid Version")).click(); } if (new ShellIsAvailable("Disconnect Current Default Instance").test()) { new YesButton(new DefaultShell("Disconnect Current Default Instance")).click(); } if (new ShellIsAvailable("Default Server Changed").test()) { new OkButton(new DefaultShell("Default Server Changed")).click(); } else if (new ShellIsAvailable("Default server unchanged").test()) { new OkButton(new DefaultShell("Default server unchanged")).click(); } else { throw new Error("Default server not been changed due to an error"); } }
Source:
<code>public void run() { try { delegate.run(); } catch (Throwable t) { IllegalStateException ie; if (t instanceof OnErrorNotImplementedException) { ie = new IllegalStateException( "Exception thrown on Scheduler. Add `onError` handling.", t); } else { ie = new IllegalStateException("Fatal Exception thrown on Scheduler.", t); } RxJavaPlugins.onError(ie); Thread thread = Thread.currentThread(); thread.getUncaughtExceptionHandler().uncaughtException(thread, ie); return; } if (periodMillis != NO_PERIOD && !disposed) { <START> handler.postDelayed(this, periodMillis); <END> if (disposed) { handler.removeCallbacks(this); } } }</code><technical_language>This exaclty a fixed period repeat (a longer delegate.run() skew it) you</technical_language>

Target:
public void run() { try { delegate.run(); } catch (Throwable t) { IllegalStateException ie; if (t instanceof OnErrorNotImplementedException) { ie = new IllegalStateException( "Exception thrown on Scheduler. Add `onError` handling.", t); } else { ie = new IllegalStateException("Fatal Exception thrown on Scheduler.", t); } RxJavaPlugins.onError(ie); Thread thread = Thread.currentThread(); thread.getUncaughtExceptionHandler().uncaughtException(thread, ie); } }
Source:
<code>public int indexOf(final Object o) { if (o instanceof String) { final String s = (String) o; for (int i = 0; i < table.size(); i++) { if (s.equals(table.getStringValue(col, i))) return i; } } else if (o instanceof Number) { final double d = ((Number) o).doubleValue(); for (int i = 0; i < table.size(); i++) { if (d == table.getValueAsDouble(col, i)) return i; } } return -1; <START> } <END></code><technical_language>Agh code duplication! I a simple it. I thinking some fancy Java 8 streaming thing, trivial</technical_language>

Target:
public int indexOf(final Object o) { return findInRange(o, IntStream.range(0, table.size())); }
Source:
<code>public static Archive<?> createTestArchive() { WebArchive war = TestUtil.prepareArchive(AsyncPostProcessingTest.class.getSimpleName()); war.addClasses(TestUtil.class, PortProviderUtil.class); war.addAsWebInfResource(AsyncPostProcessingTest.class.getPackage(), "AsyncPostProcessingTestWeb.xml", "web.xml"); war.addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( new ReflectPermission("suppressAccessChecks"), new PropertyPermission("arquillian.*", "read"), new PropertyPermission("ipv6", "read"), new PropertyPermission("node", "read"), new PropertyPermission("org.jboss.resteasy.port", "read"), new RuntimePermission("accessDeclaredMembers"), new RuntimePermission("getenv.RESTEASY_PORT"), <START> new RuntimePermission("getClassLoader"), <END> new SocketPermission(PortProviderUtil.getHost(), "connect,resolve") ), "permissions.xml"); return TestUtil.finishContainerPrepare(war, null, AsyncPostProcessingResource.class, AsyncPostProcessingMsgBodyWriterInterceptor.class, AsyncPostProcessingInterceptor.class); }</code><technical_language>a confirmation, is getClassloader permission needed else in this PR of jboss-modules? RESTEasy is needing it</technical_language>

Target:
public static Archive<?> createTestArchive() { WebArchive war = TestUtil.prepareArchive(AsyncPostProcessingTest.class.getSimpleName()); war.addClasses(TestUtil.class, PortProviderUtil.class); war.addAsWebInfResource(AsyncPostProcessingTest.class.getPackage(), "AsyncPostProcessingTestWeb.xml", "web.xml"); war.addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( new ReflectPermission("suppressAccessChecks"), new PropertyPermission("arquillian.*", "read"), new PropertyPermission("ipv6", "read"), new PropertyPermission("node", "read"), new PropertyPermission("org.jboss.resteasy.port", "read"), new RuntimePermission("accessDeclaredMembers"), new RuntimePermission("getenv.RESTEASY_PORT"), new SocketPermission(PortProviderUtil.getHost(), "connect,resolve") ), "permissions.xml"); return TestUtil.finishContainerPrepare(war, null, AsyncPostProcessingResource.class, AsyncPostProcessingMsgBodyWriterInterceptor.class, AsyncPostProcessingInterceptor.class); }
Source:
<code>public static void validateMethodOrThrow(Method method) { Class<?> returnType = method.getReturnType(); if (returnType.equals(Void.TYPE)) { return; } else if (!Publisher.class.isAssignableFrom(returnType)) { throw new UnsupportedOperationException("Service method return type can be Publisher only"); } if (method.getParameterCount() > 1) { int paramsCount = 0; <START> for (Parameter parameter : method.getParameters()) { <END> if (!parameter.isAnnotationPresent(Principal.class) && ++paramsCount > 1) { throw new UnsupportedOperationException( "Service method can accept 0 or 1 parameters only (except @Principal parameter)"); } } } }</code><technical_language>do index loop</technical_language>

Target:
public static void validateMethodOrThrow(Method method) { Class<?> returnType = method.getReturnType(); if (returnType.equals(Void.TYPE)) { return; } else if (!Publisher.class.isAssignableFrom(returnType)) { throw new UnsupportedOperationException("Service method return type can be Publisher only"); } validatePrincipalParameter(method); if (method.getParameterCount() > 2) { throw new UnsupportedOperationException("Service method can accept maximum 2 parameters"); } }
Source:
<code>public static SequencerMetrics getSequencerMetrics(SequencerMetricsMsg msg) { switch(msg.getSequencerStatus()) { case READY: return SequencerMetrics.READY; case NOT_READY: return SequencerMetrics.NOT_READY; case UNKNOWN: return SequencerMetrics.UNKNOWN; default: } <START> return null; <END> }</code><technical_language>want throw InvalidStateException insated in default block</technical_language>

Target:
public static SequencerMetrics getSequencerMetrics(SequencerMetricsMsg msg) { switch (msg.getSequencerStatus()) { case READY: return SequencerMetrics.READY; case NOT_READY: return SequencerMetrics.NOT_READY; case UNKNOWN: return SequencerMetrics.UNKNOWN; default: throw new UnsupportedOperationException("SequencerMetrics message unrecognized: " + "Status=" + msg.getSequencerStatus()); } }
Source:
<code>protected void registerThroughputGauge(String counterName, String throughputName) { MetricsSystem.registerGaugeIfAbsent(throughputName, new Gauge<Object>() { @Override public Object getValue() { long uptime = (mClock.millis() - mMetricsStore.getLastClearTime()) / Constants.MINUTE_MS; long value = MetricsSystem.counter(counterName).getCount(); <START> return uptime == 0 ? value : value / uptime; <END> } }); }</code><technical_language>hmm if uptime is 0 returning value? 0? In chance of some kind of error, if uptime is negative</technical_language>

Target:
protected void registerThroughputGauge(String counterName, String throughputName) { MetricsSystem.registerGaugeIfAbsent(throughputName, new Gauge<Object>() { @Override public Object getValue() { long lastClearTime = mMetricsStore.getLastClearTime(); long uptime = (mClock.millis() - lastClearTime) / Constants.MINUTE_MS; long value = MetricsSystem.counter(counterName).getCount(); return uptime <= 0 ? value : value / uptime; } }); }
Source:
<code><START> static String getSuccessTokenResponseWithFamilyClientId() { <END> final String tokenResponse = "{\"id_token\":\"" + TEST_IDTOKEN + "\",\"access_token\":\"I am a new access token\",\"token_type\":\"Bearer\",\"expires_in\":\"10\",\"expires_on\":\"1368768616\",\"refresh_token\":\"I am a new refresh token\",\"scope\":\"*\""; final StringBuilder tokenResponseBuilder = new StringBuilder(tokenResponse); tokenResponseBuilder.append(",\"resource\":\"resource\""); tokenResponseBuilder.append(",\"foci\":\"1\"}"); return tokenResponseBuilder.toString(); }</code><technical_language>I consider cleaning this JSONObject -- this JSON is currently pretty simple this is test code I this stop ship. said, prefer JSONObject json = new JSONObject(); json.putString("id_token", TEST_IDTOKEN); json.putString("access_token", "blah blah"); ... return json.toString();</technical_language>

Target:
static String getSuccessTokenResponseWithFamilyClientId() throws JSONException { final JSONObject responseJsonObject = getCommonSuccessResponseData(); responseJsonObject.put("refresh_token", "I am a new refresh token"); responseJsonObject.put("resource", "resource"); responseJsonObject.put("foci", "1"); return responseJsonObject.toString(); }
Source:
<code>public Optional<Credentials> retrieveCredentials(HttpServletRequest request) { String authenticationHeader = request.getHeader("Authorization"); if (authenticationHeader == null) { return Optional.empty(); } StringTokenizer tokenizer = new StringTokenizer(authenticationHeader, " "); String authType = tokenizer.nextToken(); if (HttpServletRequest.BASIC_AUTH.equalsIgnoreCase(authType)) { String usernameAndPassword = new String(Base64.getDecoder().decode(tokenizer.nextToken())); <START> tokenizer = new StringTokenizer(usernameAndPassword, ":"); <END> String username = tokenizer.nextToken(); String password = tokenizer.nextToken(); return Optional.of(new UsernamePasswordCredentials(username, password)); } return Optional.empty(); }</code><technical_language>StringTokenizer is deprecated, String.split instead</technical_language>

Target:
public Optional<Credentials> retrieveCredentials(HttpServletRequest request) { String authenticationHeader = request.getHeader("Authorization"); if (authenticationHeader == null) { return Optional.empty(); } String[] tokens = authenticationHeader.split(" "); if (tokens.length == 2) { String authType = tokens[0]; if (HttpServletRequest.BASIC_AUTH.equalsIgnoreCase(authType)) { String usernameAndPassword = new String(Base64.getDecoder().decode(tokens[1])); tokens = usernameAndPassword.split(":"); if (tokens.length == 2) { String username = tokens[0]; String password = tokens[1]; return Optional.of(new UsernamePasswordCredentials(username, password)); } } } return Optional.empty(); }
Source:
<code>public void announce(String path, byte[] bytes, boolean removeParentIfCreated) { synchronized (toAnnounce) { if (!started) { toAnnounce.add(new Announceable(path, bytes, removeParentIfCreated)); return; } } final String parentPath = ZKPathsUtils.getParentPath(path); boolean buildParentPath = false; byte[] value = announcedPaths.get(path); if (value == null) { try { if (curator.checkExists().forPath(parentPath) == null) { buildParentPath = true; } } catch (Exception e) { log.debug(e, "Problem checking if the parent existed, ignoring."); } synchronized (toAnnounce) { if (!listeners.containsKey(path)) { final NodeCache cache = new NodeCache(curator, path, true); cache.getListenable().addListener( () -> { ChildData currentData = cache.getCurrentData(); if (currentData == null) { final byte[] value1 = announcedPaths.get(path); if (value1 != null) { <START> log.info("Node[%s] dropped, reinstating.", path); <END> createAnnouncement(path, value1); } } } ); if (started) { if (buildParentPath) { createPath(parentPath, removeParentIfCreated); } startCache(cache); listeners.put(path, cache); } } } } boolean created = false; synchronized (toAnnounce) { if (started) { byte[] oldBytes = announcedPaths.putIfAbsent(path, bytes); if (oldBytes == null) { created = true; } else if (!Arrays.equals(oldBytes, bytes)) { throw new IAE("Cannot reannounce different values under the same path"); } } } if (created) { try { createAnnouncement(path, bytes); } catch (Exception e) { throw new RuntimeException(e); } } }</code><technical_language>value1 != null means node dropped</technical_language>

Target:
public void announce(String path, byte[] bytes, boolean removeParentIfCreated) { synchronized (toAnnounce) { if (!started) { toAnnounce.add(new Announceable(path, bytes, removeParentIfCreated)); return; } } final String parentPath = ZKPathsUtils.getParentPath(path); boolean buildParentPath = false; byte[] value = announcedPaths.get(path); if (value == null) { try { if (curator.checkExists().forPath(parentPath) == null) { buildParentPath = true; } } catch (Exception e) { log.debug(e, "Problem checking if the parent path doesn't exist, ignoring."); } synchronized (toAnnounce) { if (!listeners.containsKey(path)) { final NodeCache cache = new NodeCache(curator, path, true); cache.getListenable().addListener( () -> { ChildData currentData = cache.getCurrentData(); if (currentData == null) { final byte[] value1 = announcedPaths.get(path); if (value1 != null) { log.info("Node[%s] dropped, reinstating.", path); createAnnouncement(path, value1); } } } ); if (started) { if (buildParentPath) { createPath(parentPath, removeParentIfCreated); } startCache(cache); listeners.put(path, cache); } } } } boolean created = false; synchronized (toAnnounce) { if (started) { byte[] oldBytes = announcedPaths.putIfAbsent(path, bytes); if (oldBytes == null) { created = true; } else if (!Arrays.equals(oldBytes, bytes)) { throw new IAE("Cannot reannounce different values under the same path"); } } } if (created) { try { createAnnouncement(path, bytes); } catch (Exception e) { throw new RuntimeException(e); } } }
Source:
<code>private boolean connectHostToPool() { final VDS vds = getVds(); EventResult result = ((EventQueue) EjbUtils.findBean(BeanType.EVENTQUEUE_MANAGER, BeanProxyType.LOCAL)).submitEventSync(new Event(getStoragePool().getId(), <START> null, vds.getId(), EventType.VDSCONNECTTOPOOL, "Trying to connect the host to the pool "+getStoragePool().getId()), <END> new Callable<EventResult>() { @Override public EventResult call() { return runConnectHostToPoolEvent(getStoragePool().getId(), vds); } }); if (result != null) { return result.isSuccess(); } return false; }</code><technical_language>Consider logging host id/name too. Also, please observe formatting - please replace "+" " + "</technical_language>

Target:
private boolean connectHostToPool() { final VDS vds = getVds(); EventResult result = ((EventQueue) EjbUtils.findBean(BeanType.EVENTQUEUE_MANAGER, BeanProxyType.LOCAL)).submitEventSync(new Event(getStoragePool().getId(), null, vds.getId(), EventType.VDSCONNECTTOPOOL,"Trying to connect host " + vds.getHostName() + " with id "+ vds.getId()+" to the pool " + getStoragePool().getId()), new Callable<EventResult>() { @Override public EventResult call() { return runConnectHostToPoolEvent(getStoragePool().getId(), vds); } }); if (result != null) { return result.isSuccess(); } return false; }
Source:
<code>public ProcessStreamHandler( Process process, boolean quiet, String prefix, StreamExceptionHandler failureHandler, PrintStream out, PrintStream err ) { this.process = process; storedOutput = new PrintStream( byteArrayOutputStream ); storedError = new PrintStream( byteArrayErrorStream ); <START> <END> out = duplexPrintStream( out, storedOutput ); err = duplexPrintStream( err, storedError ); this.out = new Thread( new StreamConsumer( process.getInputStream(), out, quiet, prefix, failureHandler ) ); this.err = new Thread( new StreamConsumer( process.getErrorStream(), err, quiet, prefix, failureHandler ) ); }</code><technical_language>do need print both? needed pass in a print stream this constructor instead</technical_language>

Target:
public ProcessStreamHandler( Process process, boolean quiet, String prefix, StreamExceptionHandler failureHandler, PrintStream out, PrintStream err ) { this.process = process; this.out = new Thread( new StreamConsumer( process.getInputStream(), out, quiet, prefix, failureHandler ) ); this.err = new Thread( new StreamConsumer( process.getErrorStream(), err, quiet, prefix, failureHandler ) ); }
Source:
<code>private List<PhaseConfig> create( final List<PhaseConfigModel> phaseConfigList ) { if ( phaseConfigList == null ) { <START> return null; <END> } else { List<PhaseConfig> result = new ArrayList<>( phaseConfigList.size() ); for ( PhaseConfigModel phaseConfigModel : phaseConfigList ) { if ( phaseConfigModel instanceof ConstructionHeuristicPhaseConfigModel ) { ConstructionHeuristicPhaseConfig phaseConfig = new ConstructionHeuristicPhaseConfig(); ConstructionHeuristicPhaseConfigModel constructionHeuristicPhaseConfigModel = (ConstructionHeuristicPhaseConfigModel) phaseConfigModel; if ( constructionHeuristicPhaseConfigModel.getConstructionHeuristicType() != null ) { phaseConfig.setConstructionHeuristicType( ConstructionHeuristicType.valueOf( ( constructionHeuristicPhaseConfigModel.getConstructionHeuristicType().name() ) ) ); } result.add( phaseConfig ); } } return result; } }</code><technical_language>ToSolverConfigModel.create returns empty list, this returns null. return empty list well</technical_language>

Target:
private List<PhaseConfig> create( final List<PhaseConfigModel> phaseConfigList ) { if ( phaseConfigList == null ) { return new ArrayList<>(); } else { List<PhaseConfig> result = new ArrayList<>( phaseConfigList.size() ); for ( PhaseConfigModel phaseConfigModel : phaseConfigList ) { if ( phaseConfigModel instanceof ConstructionHeuristicPhaseConfigModel ) { ConstructionHeuristicPhaseConfig phaseConfig = new ConstructionHeuristicPhaseConfig(); ConstructionHeuristicPhaseConfigModel constructionHeuristicPhaseConfigModel = (ConstructionHeuristicPhaseConfigModel) phaseConfigModel; if ( constructionHeuristicPhaseConfigModel.getConstructionHeuristicType() != null ) { phaseConfig.setConstructionHeuristicType( ConstructionHeuristicType.valueOf( ( constructionHeuristicPhaseConfigModel.getConstructionHeuristicType().name() ) ) ); } result.add( phaseConfig ); } } return result; } }