auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Collection<Object[]> namesParams() { return Arrays.asList(new Object[][] { { null, false, true }, { "a.a.a.a", false, true }, { "255.255.0", false, true }, { "255.255.0.0.0", false, true }, { "255.255.0.0.", false, true }, { "255.255.0.1", false, true }, { "255.0.255.0", false, true }, { "255.0.0.255", false, true }, { "224.0.255.0", false, true }, { "255.255.0.0", true, true }, { "255.255.255.255", true, true }, { "31 ", false, true }, { "33", false, true }, { "31/", false, true }, { "31*", false, true }, { " { "31", true, true }, { "/31", true, true }, { "1", true, true }, { "/1", true, true }, { "31", false, false }, { "1", false, false }, { "/31", false, false }, { "/1", false, false }, { "255.255.0.0", true, false }, { "255.255.255.255", true, false }, }); }

Target:
public static Collection<Object[]> namesParams() { return Arrays.asList(new Object[][] { { null, false, false, true }, { "", false, false, true }, { "a.a.a.a", false, false, true }, { "255.255.0", false, false, true }, { "255.255.0.0.0", false, false, true }, { "255.255.0.0.", false, false, true }, { "31 ", false, false, true }, { "33", false, false, true }, { "31/", false, false, true }, { "31*", false, false, true }, { " { "/31 ", false, false, true }, { "01", false, false, true }, { "01/", false, false, true }, { "33", false, false, true }, { "/33", false, false, true }, { "255.255.0.1", true, false, true }, { "255.0.255.0", true, false, true }, { "255.0.0.255", true, false, true }, { "224.0.255.0", true, false, true }, { "255.255.0.0", true, true, true }, { "255.255.255.255", true, true, true }, { "31", true, true, true }, { "/31", true, true, true }, { "2", true, true, true }, { "/2", true, true, true }, { "31", false, false, false }, { "/31", false, false, false }, { "2", false, false, false }, { "/2", false, false, false }, { "255.255.0.1", true, false, true }, { "255.255.0.1", true, false, false }, { "255.255.0.0", true, true, true }, { "255.255.0.0", true, true, false }, }); }
Source:
void restartSessionIfNeeded() { if (OneSignal.appEntryState.isNotificationClick()) return; OneSignal.Log(OneSignal.LOG_LEVEL.DEBUG, "Session restarted"); cleanSession(); onSessionStarted(); if (sessionListener != null) sessionListener.onSessionRestarted(); }

Target:
void restartSessionIfNeeded() { if (OneSignal.getAppEntryState().isNotificationClick()) return; JSONArray lastNotifications = getLastNotificationsReceivedIds(); if (lastNotifications.length() > 0) setSession(Session.INDIRECT, null, lastNotifications); else setSession(Session.UNATTRIBUTED, null, null); }
Source:
public Member createMember(PerunSession sess, Vo vo, User user, List<Group> groups) throws InternalErrorException, AlreadyMemberException, ExtendMembershipException, WrongAttributeValueException, WrongReferenceAttributeValueException { try { Member member = getMemberByUser(sess, vo, user); throw new AlreadyMemberException(member); } catch(MemberNotExistsException IGNORE) { } Member member = getMembersManagerImpl().createMember(sess, vo, user); getPerunBl().getAuditer().log(sess, "{} created.", member); String memberLoa = null; try { Attribute loa = getPerunBl().getAttributesManagerBl().getAttribute(sess, member, AttributesManager.NS_MEMBER_ATTR_VIRT + ":loa"); memberLoa = (String) loa.getValue(); } catch (AttributeNotExistsException e) { } catch (WrongAttributeAssignmentException e) { throw new InternalErrorException(e); } this.canBeMemberInternal(sess, vo, user, memberLoa, true); this.extendMembership(sess, member); insertToMemberGroup(sess, member, vo); if(groups != null && !groups.isEmpty()) { for(Group group: groups) { try { perunBl.getGroupsManagerBl().addMember(sess, group, member); } catch (NotMemberOfParentGroupException ex) { throw new InternalErrorException("Member " + member + " can't be added to the group " + group + " because he is not member of it's parent group.", ex); } catch (NotGroupMemberException | GroupNotExistsException e) { throw new ConsistencyErrorException(e); } } } return member; }

Target:
public Member createMember(PerunSession sess, Vo vo, User user, List<Group> groups) throws InternalErrorException, AlreadyMemberException, ExtendMembershipException, GroupOperationsException, WrongAttributeValueException, WrongReferenceAttributeValueException { try { Member member = getMemberByUser(sess, vo, user); throw new AlreadyMemberException(member); } catch(MemberNotExistsException IGNORE) { } Member member = getMembersManagerImpl().createMember(sess, vo, user); getPerunBl().getAuditer().log(sess, "{} created.", member); String memberLoa = null; try { Attribute loa = getPerunBl().getAttributesManagerBl().getAttribute(sess, member, AttributesManager.NS_MEMBER_ATTR_VIRT + ":loa"); memberLoa = (String) loa.getValue(); } catch (AttributeNotExistsException e) { } catch (WrongAttributeAssignmentException e) { throw new InternalErrorException(e); } this.canBeMemberInternal(sess, vo, user, memberLoa, true); this.extendMembership(sess, member); insertToMemberGroup(sess, member, vo); if(groups != null && !groups.isEmpty()) { for(Group group: groups) { try { perunBl.getGroupsManagerBl().addMember(sess, group, member); } catch (GroupNotExistsException e) { throw new ConsistencyErrorException(e); } } } return member; }
Source:
public void testOneByte() throws IOException { final TemporaryBuffer b = new TemporaryBuffer.LocalFile(null); final byte test = (byte) new TestRng(getName()).nextInt(); try { b.write(test); b.close(); assertEquals(1, b.length()); { final byte[] r = b.toByteArray(); assertNotNull(r); assertEquals(1, r.length); assertEquals(test, r[0]); } { try (ByteArrayOutputStream o = new ByteArrayOutputStream()) { b.writeTo(o, null); final byte[] r = o.toByteArray(); assertEquals(1, r.length); assertEquals(test, r[0]); } } } finally { b.destroy(); } }

Target:
public void testOneByte() throws IOException { final TemporaryBuffer b = new TemporaryBuffer.LocalFile(null); final byte test = (byte) new TestRng(getName()).nextInt(); try { b.write(test); b.close(); assertEquals(1, b.length()); { final byte[] r = b.toByteArray(); assertNotNull(r); assertEquals(1, r.length); assertEquals(test, r[0]); } try (ByteArrayOutputStream o = new ByteArrayOutputStream()) { b.writeTo(o, null); final byte[] r = o.toByteArray(); assertEquals(1, r.length); assertEquals(test, r[0]); } } finally { b.destroy(); } }
Source:
public void handle(Context context) throws Exception { if (blocks.isEmpty()) { noMatchHandler.handle(context); return; } String acceptHeader = context.getRequest().getHeaders().get(HttpHeaderNames.ACCEPT); if (Strings.isNullOrEmpty(acceptHeader)) { unspecifiedHandler.handle(context); } else { List<String> types = blocks.keySet().stream().collect(Collectors2.toListReversed()); String winner = MimeParse.bestMatch(types, acceptHeader); if (Strings.isNullOrEmpty(winner)) { noMatchHandler.handle(context); } else { context.getResponse().contentType(winner); blocks.get(winner).execute(); } } }

Target:
public void handle(Context context) throws Exception { if (blocks.isEmpty()) { noMatchHandler.handle(context); return; } String acceptHeader = context.getRequest().getHeaders().get(HttpHeaderNames.ACCEPT); if (Strings.isNullOrEmpty(acceptHeader)) { unspecifiedHandler.handle(context); } else { List<String> types = ImmutableList.copyOf(blocks.keySet()).reverse(); String winner = MimeParse.bestMatch(types, acceptHeader); if (Strings.isNullOrEmpty(winner)) { noMatchHandler.handle(context); } else { context.getResponse().contentType(winner); blocks.get(winner).execute(); } } }
Source:
private void startAutoSaving() { logger.info("Auto Saving - Creating game snapshot"); PerformanceMonitor.startActivity("Auto Saving"); ComponentSystemManager componentSystemManager = CoreRegistry.get(ComponentSystemManager.class); for (ComponentSystem sys : componentSystemManager.iterateAll()) { sys.preAutoSave(); } saveTransaction = createSaveTransaction(); saveThreadManager.offer(saveTransaction); saveGamePreviewImage(); for (ComponentSystem sys : componentSystemManager.iterateAll()) { sys.postAutoSave(); } scheduleNextAutoSave(); PerformanceMonitor.endActivity(); entitySetDeltaRecorder = new EntitySetDeltaRecorder(this.entityRefReplacingComponentLibrary); logger.info("Auto Saving - Snapshot created: Writing phase starts"); }

Target:
private void startAutoSaving() { logger.info("Auto Saving - Creating game snapshot"); PerformanceMonitor.startActivity("Auto Saving"); ComponentSystemManager componentSystemManager = CoreRegistry.get(ComponentSystemManager.class); for (ComponentSystem sys : componentSystemManager.iterateAll()) { sys.preAutoSave(); } saveTransaction = createSaveTransaction(); saveThreadManager.offer(saveTransaction); for (ComponentSystem sys : componentSystemManager.iterateAll()) { sys.postAutoSave(); } scheduleNextAutoSave(); PerformanceMonitor.endActivity(); entitySetDeltaRecorder = new EntitySetDeltaRecorder(this.entityRefReplacingComponentLibrary); logger.info("Auto Saving - Snapshot created: Writing phase starts"); }
Source:
public int hashCode() { return new HashCodeBuilder(5, 35) .append(alias) .append(description) .append(progress) .append(referenceGenome.getId()) .append(shortName) .toHashCode(); }

Target:
public int hashCode() { return new HashCodeBuilder(5, 35) .append(alias) .append(description) .append(progress) .append(referenceGenome) .append(shortName) .toHashCode(); }
Source:
private long replayRecoveredEditsForPaths(long minSeqIdForTheRegion, FileSystem fs, final NavigableSet<Path> files, final CancelableProgressable reporter, final Path regionDir) throws IOException { long seqid = minSeqIdForTheRegion; if (LOG.isDebugEnabled()) { LOG.debug("Found " + (files == null ? 0 : files.size()) + " recovered edits file(s) under " + regionDir); } if (files == null || files.isEmpty()) { return minSeqIdForTheRegion; } for (Path edits: files) { if (edits == null || !fs.exists(edits)) { LOG.warn("Null or non-existent edits file: " + edits); continue; } if (isZeroLengthThenDelete(fs, fs.getFileStatus(edits), edits)) { continue; } long maxSeqId; String fileName = edits.getName(); maxSeqId = Math.abs(Long.parseLong(fileName.split("\\.")[0])); if (maxSeqId <= minSeqIdForTheRegion) { if (LOG.isDebugEnabled()) { String msg = "Maximum sequenceid for this wal is " + maxSeqId + " and minimum sequenceid for the region " + this + " is " + minSeqIdForTheRegion + ", skipped the whole file, path=" + edits; LOG.debug(msg); } continue; } try { seqid = Math.max(seqid, replayRecoveredEdits(edits, maxSeqIdInStores, reporter, fs)); } catch (IOException e) { handleException(fs, edits, e); } } return seqid; }

Target:
private long replayRecoveredEditsForPaths(long minSeqIdForTheRegion, FileSystem fs, final NavigableSet<Path> files, final CancelableProgressable reporter, final Path regionDir) throws IOException { long seqid = minSeqIdForTheRegion; if (LOG.isDebugEnabled()) { LOG.debug("Found " + (files == null ? 0 : files.size()) + " recovered edits file(s) under " + regionDir); } if (files == null || files.isEmpty()) { return minSeqIdForTheRegion; } for (Path edits: files) { if (edits == null || !fs.exists(edits)) { LOG.warn("Null or non-existent edits file: " + edits); continue; } if (isZeroLengthThenDelete(fs, fs.getFileStatus(edits), edits)) { continue; } long maxSeqId; String fileName = edits.getName(); maxSeqId = Math.abs(Long.parseLong(fileName)); if (maxSeqId <= minSeqIdForTheRegion) { if (LOG.isDebugEnabled()) { String msg = "Maximum sequenceid for this wal is " + maxSeqId + " and minimum sequenceid for the region " + this + " is " + minSeqIdForTheRegion + ", skipped the whole file, path=" + edits; LOG.debug(msg); } continue; } try { seqid = Math.max(seqid, replayRecoveredEdits(edits, maxSeqIdInStores, reporter, fs)); } catch (IOException e) { handleException(fs, edits, e); } } return seqid; }
Source:
public static Object transformValue(int sqlType, int precision, int scale, ResultSet resultSet, String fieldName) throws SQLException { Object original = resultSet.getObject(fieldName); if (original != null) { switch (sqlType) { case Types.SMALLINT: case Types.TINYINT: return ((Number) original).intValue(); case Types.NUMERIC: case Types.DECIMAL: BigDecimal decimal = (BigDecimal) original; return decimal.unscaledValue().toByteArray(); case Types.DATE: return resultSet.getDate(fieldName); case Types.TIME: return resultSet.getTime(fieldName); case Types.TIMESTAMP: return resultSet.getTimestamp(fieldName); case Types.ROWID: return resultSet.getString(fieldName); case Types.BLOB: Blob blob = (Blob) original; try { return blob.getBytes(1, (int) blob.length()); } finally { blob.free(); } case Types.CLOB: Clob clob = (Clob) original; try { return clob.getSubString(1, (int) clob.length()); } finally { clob.free(); } } } return original; }

Target:
public static Object transformValue(int sqlType, int precision, int scale, ResultSet resultSet, String fieldName) throws SQLException { Object original = resultSet.getObject(fieldName); if (original != null) { switch (sqlType) { case Types.SMALLINT: case Types.TINYINT: return ((Number) original).intValue(); case Types.NUMERIC: BigDecimal decimal = (BigDecimal) original; if (scale != 0) { return decimal.doubleValue(); } else if (precision > 9) { return decimal.longValue(); } else { return decimal.intValue(); } case Types.DECIMAL: return original; case Types.DATE: return resultSet.getDate(fieldName); case Types.TIME: return resultSet.getTime(fieldName); case Types.TIMESTAMP: return resultSet.getTimestamp(fieldName); case Types.ROWID: return resultSet.getString(fieldName); case Types.BLOB: Blob blob = (Blob) original; try { return blob.getBytes(1, (int) blob.length()); } finally { blob.free(); } case Types.CLOB: Clob clob = (Clob) original; try { return clob.getSubString(1, (int) clob.length()); } finally { clob.free(); } } } return original; }
Source:
static LabelTypes getLegacyTypes(ReviewDb db) throws SQLException { Statement stmt = ((JdbcSchema) db).getConnection().createStatement(); List<LabelType> types = Lists.newArrayListWithExpectedSize(2); try { ResultSet rs = stmt.executeQuery( "SELECT approval_categories.category_id," + " approval_categories.name AS category_name, abbreviated_name," + " function_name, copy_min_score, value," + " approval_category_values.name AS text" + " FROM approval_categories" + " JOIN approval_category_values ON approval_categories.category_id" + " = approval_category_values.category_id" + " ORDER BY position, category_name, value"); try { String last = null; LabelType curr = null; List<LabelValue> values = Lists.newArrayListWithCapacity(5); while (rs.next()) { String id = rs.getString("category_id"); if (id != last) { if (curr != null) { types.add(newLabel(curr, values)); values.clear(); } curr = new LabelType(getLabelName(rs.getString("category_name")), ImmutableList.<LabelValue> of()); curr.setId(id); curr.setAbbreviatedName(rs.getString("abbreviated_name")); curr.setFunctionName(rs.getString("function_name")); curr.setCopyMinScore(rs.getBoolean("copy_min_score")); } values.add( new LabelValue(rs.getShort("value"), rs.getString("text"))); last = id; if (rs.isLast()) { types.add(newLabel(curr, values)); } } } finally { rs.close(); } } finally { stmt.close(); } return new LabelTypes(types); }

Target:
static LabelTypes getLegacyTypes(ReviewDb db) throws SQLException { List<LabelType> types = Lists.newArrayListWithCapacity(2); Statement catStmt = null; PreparedStatement valStmt = null; ResultSet catRs = null; try { catStmt = ((JdbcSchema) db).getConnection().createStatement(); catRs = catStmt.executeQuery( "SELECT category_id, name, abbreviated_name, function_name, " + " copy_min_score" + " FROM approval_categories" + " ORDER BY position, name"); valStmt = ((JdbcSchema) db).getConnection().prepareStatement( "SELECT name, value" + " FROM approval_category_values" + " WHERE category_id = ?"); while (catRs.next()) { String id = catRs.getString("category_id"); valStmt.setString(1, id); List<LabelValue> values = Lists.newArrayListWithCapacity(5); ResultSet valRs = valStmt.executeQuery(); try { while (valRs.next()) { values.add(new LabelValue( valRs.getShort("value"), valRs.getString("name"))); } } finally { valRs.close(); } LabelType type = new LabelType(getLabelName(catRs.getString("name")), values); type.setId(id); type.setAbbreviatedName(catRs.getString("abbreviated_name")); type.setFunctionName(catRs.getString("function_name")); type.setCopyMinScore(catRs.getBoolean("copy_min_score")); types.add(type); } } finally { if (valStmt != null) { valStmt.close(); } if (catRs != null) { catRs.close(); } if (catStmt != null) { catStmt.close(); } } return new LabelTypes(types); }
Source:
public static void initializeBeanInstance(Object instance) { Collection<Field> fields = collectInjectedFields(instance.getClass()); for (Field field : fields) { LOG.debug("injecting field {}", field); try { field.setAccessible(true); Object value = BEANS.get(field.getType()); field.set(instance, value); } catch (Exception e) { throw translateException("Exception while injecting field", e); } } Collection<Method> initMethods = collectInjectedMethods(instance.getClass()); for (Method method : initMethods) { LOG.debug("invoking injected method {}", method); try { method.setAccessible(true); method.invoke(instance, BeanInstanceUtil.getInjectionArguments(method.getParameterTypes())); } catch (Exception e) { throw translateException("Exception while invoking @InjectBean method", e); } } Collection<Method> postConstructMethods = collectPostConstructMethods(instance.getClass()); for (Method method : postConstructMethods) { LOG.debug("invoking post-construct method {}", method); try { method.setAccessible(true); method.invoke(instance); } catch (Exception e) { throw translateException("Exception while invoking @PostConstruct method {}", e); } } }

Target:
public static void initializeBeanInstance(Object instance) { Collection<Field> fields = collectInjectedFields(instance.getClass()); for (Field field : fields) { LOG.debug("injecting field {}", field); try { field.setAccessible(true); Object value = BEANS.get(field.getType()); field.set(instance, value); } catch (Exception e) { throw translateException("Exception while injecting field {}", field, e); } } Collection<Method> initMethods = collectInjectedMethods(instance.getClass()); for (Method method : initMethods) { LOG.debug("invoking injected method {}", method); try { method.setAccessible(true); method.invoke(instance, getInjectionArguments(method.getParameterTypes())); } catch (Exception e) { throw translateException("Exception while invoking @InjectBean method {}", method, e); } } Collection<Method> postConstructMethods = collectPostConstructMethods(instance.getClass()); for (Method method : postConstructMethods) { LOG.debug("invoking post-construct method {}", method); try { method.setAccessible(true); method.invoke(instance); } catch (Exception e) { throw translateException("Exception while invoking @PostConstruct method {}", method, e); } } }
Source:
public synchronized MembersOrderPreferenceCache getMemberOrderPreferenceCache() { if (fMembersOrderPreferenceCache == null) { try { fMembersOrderPreferenceCache = fMembersOrderPreferenceCachePromise.getValue(); } catch (InvocationTargetException e) { log(e); } catch (InterruptedException e) { log(e); } } return fMembersOrderPreferenceCache; }

Target:
public synchronized MembersOrderPreferenceCache getMemberOrderPreferenceCache() { if (fMembersOrderPreferenceCache == null) { try { fMembersOrderPreferenceCache= fMembersOrderPreferenceCachePromise.getValue(); } catch (InvocationTargetException | InterruptedException e) { log(e); fMembersOrderPreferenceCache= createMemberOrderPreferenceCache(); } } return fMembersOrderPreferenceCache; }
Source:
public Optional<Entity> createEntity(EntityType type, Vector3d position) { try { net.minecraft.entity.Entity entity = (net.minecraft.entity.Entity) type.getEntityClass().getConstructor(net.minecraft.world.World.class).newInstance(this); entity.setPosition(position.getX(), position.getY(), position.getZ()); if (spawnEntityInWorld(entity)) { return Optional.of((Entity) entity); } } catch (Exception ignored) { } return Optional.absent(); }

Target:
public Optional<Entity> createEntity(EntityType type, Vector3d position) { try { net.minecraft.entity.Entity entity = (net.minecraft.entity.Entity) type.getEntityClass().getConstructor(net.minecraft.world.World.class).newInstance(this); entity.setPosition(position.getX(), position.getY(), position.getZ()); if (this.spawnEntityInWorld(entity)) { return Optional.of((Entity) entity); } } catch (Exception ignored) { } return Optional.absent(); }
Source:
public List<ValueType> peekAll() { try (final Handle handle = rdbi.open()) { final Pipeline pipeline = handle.jedis().pipelined(); List<ValueType> currentList = new ArrayList<ValueType>(); final int size = handle.jedis().llen(key).intValue(); final List<Response<String>> responses = Lists.newArrayListWithCapacity(size); for (int i = 0; i < size; i++) { responses.add(pipeline.lindex(key, i)); } pipeline.sync(); for(final Response<String> res : responses) { ValueType value = serializationHelper.decode(res.get()); currentList.add(value); } return currentList; } }

Target:
public List<ValueType> peekAll() { try (final Handle handle = rdbi.open()) { List<String> strList = handle.jedis().lrange(key, 0, maxSize); List<ValueType> currentList = strList.stream().map(str -> serializationHelper.decode(str)).collect(toList()); return currentList; } }
Source:
private String generateOsgiFilter(String transformerId) { return "(|" + "(" + Constants.SERVICE_SHORTNAME + "=" + transformerId + ")" + "(" + Constants.SERVICE_ID + "=" + transformerId + ")" + ")"; }

Target:
private String generateOsgiFilter(String transformerId) { return String.format( "(|(%s=%s)(%s=%s))", Constants.SERVICE_SHORTNAME, transformerId, Constants.SERVICE_ID, transformerId); }
Source:
Mono<VerifyResult> verifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, Context context, JsonWebKey key) { if (serviceCryptoAvailable()) { return serviceClient.verify(algorithm, digest, signature, context); } else { return Mono.error(new UnsupportedOperationException("Verify operation on Local RSA key is not" + " supported currently.")); } }

Target:
Mono<VerifyResult> verifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, Context context, JsonWebKey key) { if (serviceCryptoAvailable()) { return serviceClient.verify(algorithm, digest, signature, context); } else { return FluxUtil.monoError(logger, new UnsupportedOperationException("Verify operation on Local RSA key is not" + " supported currently.")); } }
Source:
public BucketSplitInfo(int bucketCount, IntPredicate bucketFilter) { this.bucketCount = bucketCount; this.bucketFilter = bucketFilter; }

Target:
private BucketSplitInfo(int bucketCount, IntPredicate bucketFilter) { this.bucketCount = requireNonNull(bucketCount, "bucketCount is null"); this.bucketFilter = requireNonNull(bucketFilter, "bucketFilter is null"); }
Source:
static MarketDataNode buildDependencyTree( MarketDataRequirements requirements, BaseMarketData suppliedData, Map<Class<? extends MarketDataId<?>>, MarketDataBuilder<?, ?>> builders) { return MarketDataNode.root(children(requirements, suppliedData, builders)); }

Target:
static MarketDataNode buildDependencyTree( MarketDataRequirements requirements, BaseMarketData suppliedData, Map<Class<? extends MarketDataId<?>>, MarketDataBuilder<?, ?>> builders) { DependencyTreeBuilder treeBuilder = DependencyTreeBuilder.of(suppliedData, requirements, builders); return MarketDataNode.root(treeBuilder.childNodes()); }
Source:
public void testTargetMinimumSizeFilter(final List<Target> targets, final int minimumTargetSize) throws IOException { final File targetFile = createTargetFile(targets, Collections.emptySet()); final List<Target> leftInTargets = targets.stream() .filter(t -> t.getInterval().size() >= minimumTargetSize) .collect(Collectors.toList()); final List<Target> leftOutTargets = targets.stream() .filter(t -> t.getInterval().size() < minimumTargetSize) .collect(Collectors.toList()); final File outputFile = createTempFile("output", ".tab"); final File rejectionFile = createTempFile("reject", ".tab"); runCommandLine(new String[] { "-" + TargetArgumentCollection.TARGET_FILE_SHORT_NAME, targetFile.getPath(), "-" + StandardArgumentDefinitions.OUTPUT_SHORT_NAME, outputFile.getPath(), "-" + FilterTargets.MINIMUM_TARGET_SIZE_SHORT_NAME, String.valueOf(minimumTargetSize), "-" + FilterTargets.REJECT_OUTPUT_FILE_SHORT_NAME, rejectionFile.getPath(), }); final TargetCollection<Target> outputTargetCollection = TargetArgumentCollection.readTargetCollection(outputFile); final List<Target> outputTargets = outputTargetCollection.targets(); Assert.assertEquals(leftInTargets.size(), outputTargets.size()); for (int i = 0; i < outputTargets.size(); i++) { Assert.assertEquals(outputTargets.get(i), leftInTargets.get(i)); Assert.assertEquals(outputTargets.get(i).getInterval(), leftInTargets.get(i).getInterval()); } checkRejectedTargets(leftOutTargets, rejectionFile, FilterTargets.TargetFilter.MinimumTargetSize); }

Target:
public void testTargetMinimumSizeFilter(final List<Target> targets, final int minimumTargetSize) throws IOException { final File targetFile = createTargetFile(targets, Collections.emptySet()); final List<Target> leftInTargets = targets.stream() .filter(t -> t.getInterval().size() >= minimumTargetSize) .collect(Collectors.toList()); final List<Target> leftOutTargets = targets.stream() .filter(t -> t.getInterval().size() < minimumTargetSize) .collect(Collectors.toList()); final File outputFile = createTempFile("output", ".tab"); final File rejectionFile = createTempFile("reject", ".tab"); runCommandLine(new String[] { "-" + TargetArgumentCollection.TARGET_FILE_SHORT_NAME, targetFile.getPath(), "-" + StandardArgumentDefinitions.OUTPUT_SHORT_NAME, outputFile.getPath(), "-" + FilterTargets.MINIMUM_TARGET_SIZE_SHORT_NAME, String.valueOf(minimumTargetSize), "-" + FilterTargets.REJECT_OUTPUT_FILE_SHORT_NAME, rejectionFile.getPath(), }); checkLeftInTargets(leftInTargets, outputFile); checkRejectedTargets(leftOutTargets, rejectionFile, FilterTargets.TargetFilter.MinimumTargetSize); }
Source:
public void waitSampleByName(String... sampleNames) { asList(sampleNames) .forEach( name -> { String sampleXpath = format(SAMPLE_ITEM_TEMPLATE_XPATH, sampleNames); seleniumWebDriverHelper.waitVisibility(By.xpath(sampleXpath)); }); }

Target:
public void waitSampleByName(String... sampleNames) { asList(sampleNames) .forEach( sampleName -> { String sampleXpath = format(SAMPLE_ITEM_TEMPLATE_XPATH, sampleName); seleniumWebDriverHelper.waitVisibility(By.xpath(sampleXpath)); }); }
Source:
private static void filterCylicDependencies(List<ProjectConfiguratorContribution> configurators) { Map<String, ProjectConfiguratorContribution> idToConfigurator = configurators.stream() .collect(Collectors.toMap(ProjectConfiguratorContribution::getFullyQualifiedId, Function.identity())); MutableGraph<ProjectConfiguratorContribution> graph = GraphBuilder.directed().nodeOrder(ElementOrder.insertion()).build(); configurators.forEach(c -> graph.addNode(c)); for (ProjectConfiguratorContribution configurator : configurators) { Iterator<String> it = configurator.getRunsBefore().iterator(); while (it.hasNext()) { String id = it.next(); ProjectConfiguratorContribution target = idToConfigurator.get(id); graph.putEdge(configurator, target); if (Graphs.hasCycle(graph)) { LOGGER.trace(CoreTraceScopes.PROJECT_CONFIGURATORS, "Configurator dependency (" + configurator.getFullyQualifiedId() + " -> " + id + ") removed because it introduces dependency cycle"); graph.removeEdge(configurator, target); it.remove(); } } it = configurator.getRunsAfter().iterator(); while (it.hasNext()) { String id = it.next(); ProjectConfiguratorContribution target = idToConfigurator.get(id); graph.putEdge(target, configurator); if (Graphs.hasCycle(graph)) { LOGGER.trace(CoreTraceScopes.PROJECT_CONFIGURATORS, "Configurator dependency (" + id + " -> " + configurator.getFullyQualifiedId() + ") removed because it introduces dependency cycle"); graph.removeEdge(target, configurator); it.remove(); } } } }

Target:
private static void filterCylicDependencies(List<ProjectConfiguratorContribution> configurators) { Map<String, ProjectConfiguratorContribution> idToConfigurator = configurators.stream() .collect(Collectors.toMap(ProjectConfiguratorContribution::getFullyQualifiedId, Function.identity())); MutableGraph<ProjectConfiguratorContribution> dependencyGraph = GraphBuilder.directed().nodeOrder(ElementOrder.insertion()).build(); configurators.forEach(c -> dependencyGraph.addNode(c)); for (ProjectConfiguratorContribution configurator : configurators) { filterCylicDependencies(configurator, configurator.getRunsBefore(), idToConfigurator, dependencyGraph, false); filterCylicDependencies(configurator, configurator.getRunsAfter(), idToConfigurator, dependencyGraph, true); } }
Source:
public static Set<ArtifactVersion> ensureDefaultAndPreviousVersionAvailable(final Set<ArtifactVersion> versions) { final ArtifactVersion defaultVersion = parseVersion(NewSwitchYardProjectWizard.DEFAULT_RUNTIME_VERSION); if (!versions.contains(defaultVersion)) { versions.add(defaultVersion); } final ArtifactVersion previousVersion = parseVersion(NewSwitchYardProjectWizard.PREVIOUS_RUNTIME_VERSION); if (!versions.contains(previousVersion)) { versions.add(previousVersion); } return versions; }

Target:
public static Set<ArtifactVersion> ensureDefaultAndPreviousVersionAvailable(final Set<ArtifactVersion> versions) { final ArtifactVersion defaultVersion = parseVersion(NewSwitchYardProjectWizard.DEFAULT_RUNTIME_VERSION); versions.add(defaultVersion); final ArtifactVersion previousVersion = parseVersion(NewSwitchYardProjectWizard.PREVIOUS_RUNTIME_VERSION); versions.add(previousVersion); return versions; }
Source:
private static OMElement loadConfigXML() throws EventBrokerConfigurationException { String carbonConfigHome = CarbonBaseUtils.getCarbonConfigDirPath(); String path = Paths.get(carbonConfigHome, EventBrokerConstants.EB_CONF).toString(); BufferedInputStream inputStream = null; try { inputStream = new BufferedInputStream(new FileInputStream(new File(path))); XMLStreamReader parser = XMLInputFactory.newInstance(). createXMLStreamReader(inputStream); StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement omElement = builder.getDocumentElement(); omElement.build(); return omElement; } catch (FileNotFoundException e) { throw new EventBrokerConfigurationException(EventBrokerConstants.EB_CONF + "cannot be found in the path : " + path, e); } catch (XMLStreamException e) { throw new EventBrokerConfigurationException("Invalid XML for " + EventBrokerConstants.EB_CONF + " located in the path : " + path, e); } finally { try { if (inputStream != null) { inputStream.close(); } } catch (IOException ingored) { throw new EventBrokerConfigurationException("Can not close the input stream"); } } }

Target:
private static OMElement loadConfigXML() throws EventBrokerConfigurationException { String carbonConfigHome = CarbonBaseUtils.getCarbonConfigDirPath(); File confFile = Paths.get(carbonConfigHome, EventBrokerConstants.EB_CONF).toFile(); String path = confFile.toString(); BufferedInputStream inputStream = null; try { inputStream = new BufferedInputStream(new FileInputStream(confFile)); XMLStreamReader parser = XMLInputFactory.newInstance(). createXMLStreamReader(inputStream); StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement omElement = builder.getDocumentElement(); omElement.build(); return omElement; } catch (FileNotFoundException e) { throw new EventBrokerConfigurationException(EventBrokerConstants.EB_CONF + "cannot be found in the path : " + path, e); } catch (XMLStreamException e) { throw new EventBrokerConfigurationException("Invalid XML for " + EventBrokerConstants.EB_CONF + " located in the path : " + path, e); } finally { try { if (inputStream != null) { inputStream.close(); } } catch (IOException ingored) { throw new EventBrokerConfigurationException("Can not close the input stream"); } } }
Source:
public void testIsDrawable_ReusableSubprocess() throws Exception { testIsDrawable(AdHocSubprocess.class, ReusableSubprocess.class, true); }

Target:
public void testIsDrawable_ReusableSubprocess() { testIsDrawable(AdHocSubprocess.class, ReusableSubprocess.class, true); }
Source:
public long writeTo(int index, WritableByteChannel channel, long relativeOffset, long maxSize) throws IOException { validateIndex(index); long written = 0; BlobReadInfo blobReadInfo = blobReadInfoList.get(index); try { if (blobReadInfo.isPrefetched()) { ByteBuffer outputBuffer = blobReadInfo.getPrefetchedBuffer(); outputBuffer.flip(); long sizeToRead = Math.min(maxSize, blobReadInfo.getBlobSize() - relativeOffset); outputBuffer.limit((int) (relativeOffset + sizeToRead)); outputBuffer.position((int) (relativeOffset)); written = channel.write(outputBuffer); } else { blobReadInfo.downloadBlob(blobStore, Channels.newOutputStream(channel)); written = blobReadInfo.getBlobSize(); } } catch (StoreException ex) { throw new IOException("Download of cloud blob " + blobReadInfoList.get(index).getBlobId().getID() + " failed"); } logger.trace("Downloaded bytes to the write channel from the cloud blob : {}", written, blobReadInfo.getBlobId().getID()); return written; }

Target:
public long writeTo(int index, WritableByteChannel channel, long relativeOffset, long maxSize) throws IOException { validateIndex(index); long written = 0; BlobReadInfo blobReadInfo = blobReadInfoList.get(index); try { if (blobReadInfo.isPrefetched()) { ByteBuffer outputBuffer = blobReadInfo.getPrefetchedBuffer(); long sizeToRead = Math.min(maxSize, blobReadInfo.getBlobSize() - relativeOffset); outputBuffer.limit((int) (relativeOffset + sizeToRead)); outputBuffer.position((int) (relativeOffset)); written = channel.write(outputBuffer); } else { blobReadInfo.downloadBlob(blobStore, Channels.newOutputStream(channel)); written = blobReadInfo.getBlobSize(); } } catch (StoreException ex) { throw new IOException("Download of cloud blob " + blobReadInfoList.get(index).getBlobId().getID() + " failed"); } logger.trace("Downloaded bytes to the write channel from the cloud blob : {}", written, blobReadInfo.getBlobId().getID()); return written; }
Source:
private void write(Connection connection, Connection.ResponseCallback responseCallback) throws ConnectionException, BusyConnectionException { connectionHandler = null; while (true) { QueryState previous = queryStateRef.get(); if (previous.isCancelled()) { connection.release(); return; } if (previous.inProgress || queryStateRef.compareAndSet(previous, previous.startNext())) break; } requestSent = true; connectionHandler = connection.write(responseCallback, false); connectionHandler.startTimeout(); if (queryStateRef.get() == QueryState.CANCELLED_WHILE_IN_PROGRESS && connectionHandler.cancelHandler()) connection.release(); }

Target:
private void write(Connection connection, Connection.ResponseCallback responseCallback) throws ConnectionException, BusyConnectionException { connectionHandler = null; while (true) { QueryState previous = queryStateRef.get(); if (previous.isCancelled()) { connection.release(); return; } if (previous.inProgress || queryStateRef.compareAndSet(previous, previous.startNext())) break; } connectionHandler = connection.write(responseCallback, false); connectionHandler.startTimeout(); if (queryStateRef.get() == QueryState.CANCELLED_WHILE_IN_PROGRESS && connectionHandler.cancelHandler()) connection.release(); }
Source:
public void update(SolGame game) { SolShip nearestEnemy = game.getFactionMan().getNearestEnemy(game, this); myPilot.update(game, this, nearestEnemy); myHull.update(game, myItemContainer, myPilot, this, nearestEnemy); game.getPartMan().updateAllHullEmittersOfType(this, "collision", colliding); updateAbility(game); updateIdleTime(game); updateShield(game); if(factionInfo.getDisposition().get(factionID) < -5) getPilot().setFaction("ehar"); else getPilot().setFaction("laani"); if (myArmor != null && !myItemContainer.contains(myArmor)) { myArmor = null; } if (myTradeContainer != null) { myTradeContainer.update(game); } if (isControlsEnabled() && myRepairer != null && myIdleTime > ShipRepairer.REPAIR_AWAIT) { myHull.life += myRepairer.tryRepair(game, myItemContainer, myHull.life, myHull.config); } float ts = game.getTimeStep(); if (myFireAwait > 0) { myFireAwait -= ts; } mySmokeSrc.setWorking(myFireAwait > 0 || myHull.life < SMOKE_PERC * myHull.config.getMaxLife()); boolean onFire = myFireAwait > 0 || myHull.life < FIRE_PERC * myHull.config.getMaxLife(); myFireSrc.setWorking(onFire); if (onFire) { game.getSoundManager().play(game, game.getSpecialSounds().burning, null, this); } if (!isControlsEnabled()) { myControlEnableAwait -= ts; if (isControlsEnabled()) { game.getSoundManager().play(game, game.getSpecialSounds().controlEnabled, null, this); } } myElectricitySrc.setWorking(!isControlsEnabled()); if (myAbility instanceof Teleport) { ((Teleport) myAbility).maybeTeleport(game, this); } colliding = false; }

Target:
public void update(SolGame game) { SolShip nearestEnemy = game.getFactionMan().getNearestEnemy(game, this); myPilot.update(game, this, nearestEnemy); myHull.update(game, myItemContainer, myPilot, this, nearestEnemy); game.getPartMan().updateAllHullEmittersOfType(this, "collision", colliding); updateAbility(game); updateIdleTime(game); updateShield(game); if (FactionInfo.getDisposition().get(factionID) < -5) { getPilot().stringToFaction("ehar"); } else { getPilot().stringToFaction("laani"); } if (myArmor != null && !myItemContainer.contains(myArmor)) { myArmor = null; } if (myTradeContainer != null) { myTradeContainer.update(game); } if (isControlsEnabled() && myRepairer != null && myIdleTime > ShipRepairer.REPAIR_AWAIT) { myHull.life += myRepairer.tryRepair(game, myItemContainer, myHull.life, myHull.config); } float ts = game.getTimeStep(); if (myFireAwait > 0) { myFireAwait -= ts; } mySmokeSrc.setWorking(myFireAwait > 0 || myHull.life < SMOKE_PERC * myHull.config.getMaxLife()); boolean onFire = myFireAwait > 0 || myHull.life < FIRE_PERC * myHull.config.getMaxLife(); myFireSrc.setWorking(onFire); if (onFire) { game.getSoundManager().play(game, game.getSpecialSounds().burning, null, this); } if (!isControlsEnabled()) { myControlEnableAwait -= ts; if (isControlsEnabled()) { game.getSoundManager().play(game, game.getSpecialSounds().controlEnabled, null, this); } } myElectricitySrc.setWorking(!isControlsEnabled()); if (myAbility instanceof Teleport) { ((Teleport) myAbility).maybeTeleport(game, this); } colliding = false; }
Source:
public static void free(ByteBuffer buffer) { try { if (buffer.isDirect()) { clean((DirectBuffer) buffer); } } catch (Exception e) { throw Throwables.propagate(e); } }

Target:
public static void free(ByteBuffer buffer) { if (buffer.isDirect()) { clean((DirectBuffer) buffer); } }
Source:
private boolean pageDenotesContentConsumption(WebrequestData data){ if (data.getRawXAnalyticsHeader().isEmpty()) return true; String special = Utilities.getValueForKey(data.getRawXAnalyticsHeader(), "special").trim(); String preview = Utilities.getValueForKey(data.getRawXAnalyticsHeader(), "preview").trim(); if (preview.isEmpty() && special.isEmpty()){ return true; } else if (preview.equalsIgnoreCase("1")) { return false; } if ( !special.isEmpty() ) { Iterator it = SPECIAL_PAGES_ACCEPTED.iterator(); while (it.hasNext()) { String item = (String) it.next(); if (item.equals(special.toLowerCase())){ return true; } } } return false; }

Target:
private boolean pageDenotesContentConsumption(WebrequestData data){ if (data.getRawXAnalyticsHeader().isEmpty()) return true; String special = Utilities.getValueForKey(data.getRawXAnalyticsHeader(), "special").trim().toLowerCase(); String preview = Utilities.getValueForKey(data.getRawXAnalyticsHeader(), "preview").trim(); if (preview.isEmpty() && special.isEmpty()){ return true; } else if (preview.equals("1")) { return false; } return SPECIAL_PAGES_ACCEPTED.contains(special); }
Source:
private void dumpResults(Result result) { if (result.getFailureCount() > 0) { System.err.println(); dumpList("Failures: ", result.getFailures()); dumpList("Errors: ", result.getFailures()); } if (result.getIgnoreCount() > 0) { System.err.println(); dumpIgnored(); } int failedCount = result.getFailureCount(); System.err.println(); System.err.println(MessageFormat.format("{0} out of {1} tests failed ({2} tests skipped)", new Object[] { failedCount, result.getRunCount() + result.getIgnoreCount(), result.getIgnoreCount() })); }

Target:
private void dumpResults(Result result) { if (result.getFailureCount() > 0) { System.err.println(); dumpFailureList(result.getFailures()); dumpErrorList(result.getFailures()); } if (result.getIgnoreCount() > 0) { System.err.println(); dumpIgnored(); } int failedCount = result.getFailureCount(); System.err.println(); System.err.println(MessageFormat.format("{0} out of {1} tests failed ({2} tests skipped)", result.getFailureCount(), result.getRunCount() + result.getIgnoreCount(), result.getIgnoreCount())); }
Source:
private IClasspathAttribute[] cleanupClasspathAttributes( IClasspathAttribute[] extras ) { boolean clean = true; for( IClasspathAttribute ca : extras ) { if( ca == null ) { clean = false; break; } } if( clean ) { return extras; } return Arrays.stream(extras) .filter( Objects::nonNull ) .toArray( IClasspathAttribute[]::new ); }

Target:
private IClasspathAttribute[] cleanupClasspathAttributes(IClasspathAttribute[] extras) { if(Arrays.stream(extras).allMatch(Objects::nonNull)) { return extras; } return Arrays.stream(extras).filter(Objects::nonNull).toArray(IClasspathAttribute[]::new); }
Source:
public PositionLinks.Factory build() { return new PositionLinks.Factory() { @Override public PositionLinks create(Optional<JoinFilterFunction> joinFilterFunction) { return new ArrayPositionLinks(positionLinks); } @Override public long checksum() { Hasher hasher = Hashing.md5().newHasher(); IntStream.of(positionLinks) .forEach(hasher::putInt); return hasher.hash().asLong(); } }; }

Target:
public PositionLinks.Factory build() { return new PositionLinks.Factory() { @Override public PositionLinks create(Optional<JoinFilterFunction> joinFilterFunction) { return new ArrayPositionLinks(positionLinks); } @Override public long checksum() { return XxHash64.hash(Slices.wrappedIntArray(positionLinks)); } }; }
Source:
public void onBackPressed() { int count = getFragmentManager().getBackStackEntryCount(); if (count == 0) { super.onBackPressed(); } else { getFragmentManager().popBackStack(); } }

Target:
public void onBackPressed() { Fragment currentFragment = fragmentManager .findFragmentById(R.id.fragment_holder); if (currentFragment instanceof About) { fragmentManager.popBackStack(FragmentTags.CARD_LIST, 0); } else { super.onBackPressed(); } }
Source:
public HashSet<AbstractEntity> getEntities(SkillMetadata skillMetadata) { BukkitTagContext tagContext = new BukkitTagContext(null, null, null, false, null); tagContext.contextSource = source; source.contexts.put("entity", new EntityTag(skillMetadata.getCaster().getEntity().getBukkitEntity())); ObjectTag object = TagManager.tagObject(tag, tagContext); List<EntityTag> list = object.asType(ListTag.class, tagContext).filter(EntityTag.class, tagContext); HashSet<AbstractEntity> entities = new HashSet<AbstractEntity>(); for (EntityTag entity : list) { entities.add(BukkitAdapter.adapt(entity.getBukkitEntity())); } return entities; }

Target:
public HashSet<AbstractEntity> getEntities(SkillMetadata skillMetadata) { TagContext tagContext = CoreUtilities.noDebugContext.clone(); tagContext.contextSource = source; source.contexts.put("entity", new EntityTag(skillMetadata.getCaster().getEntity().getBukkitEntity())); ObjectTag object = TagManager.tagObject(tag, tagContext); List<EntityTag> list = object.asType(ListTag.class, tagContext).filter(EntityTag.class, tagContext); HashSet<AbstractEntity> entities = new HashSet<AbstractEntity>(); for (EntityTag entity : list) { entities.add(BukkitAdapter.adapt(entity.getBukkitEntity())); } return entities; }
Source:
public void equal_shouldReturnFalseIfObjectIsNull() { CohortMembership cohortMembership = new CohortMembership(12); boolean result = cohortMembership.equals(null); assertFalse(result); }

Target:
public void equal_shouldReturnFalseIfObjectIsNull() { CohortMembership cohortMembership = new CohortMembership(12); assertFalse(cohortMembership.equals(null)); }
Source:
private void migrateSections() { this.sections = new ConcurrentHashMap<>(); ExecutorService executor = Executors.newFixedThreadPool(THREAD_POOL_SIZE); for(Map.Entry<Long, School> school : this.schools.entrySet()) { Long sourceSystemSchoolId = Long.valueOf(school.getValue().getSourceSystemId()); sections.put(sourceSystemSchoolId, new ConcurrentHashMap<>()); SectionSyncRunnable sectionRunnable = new SectionSyncRunnable( powerSchool, edPanel, school.getValue(), this.courses.get(sourceSystemSchoolId), this.terms.get(sourceSystemSchoolId), staffAssociator, studentAssociator, this.sections.get(sourceSystemSchoolId), results); executor.execute(sectionRunnable); } executor.shutdown(); try { executor.awaitTermination(TOTAL_TTL_MINUTES, TimeUnit.MINUTES); } catch(InterruptedException e) { System.out.println("Executor thread pool interrupted " + e.getMessage()); } }

Target:
private void migrateSections() { this.sections = new ConcurrentHashMap<>(); ExecutorService executor = Executors.newFixedThreadPool(THREAD_POOL_SIZE); for(Map.Entry<Long, School> school : this.schools.entrySet()) { Long sourceSystemSchoolId = Long.valueOf(school.getValue().getSourceSystemId()); sections.put(sourceSystemSchoolId, new ConcurrentHashMap<>()); SectionSyncRunnable sectionRunnable = new SectionSyncRunnable( powerSchool, edPanel, school.getValue(), this.courses.get(sourceSystemSchoolId), this.terms.get(sourceSystemSchoolId), staffAssociator, studentAssociator, this.sections.get(sourceSystemSchoolId), results); executor.execute(sectionRunnable); } executor.shutdown(); try { if (!executor.awaitTermination(TOTAL_TTL_MINUTES, TimeUnit.MINUTES)) { executor.shutdownNow(); } } catch(InterruptedException e) { System.out.println("Executor thread pool interrupted " + e.getMessage()); } }
Source:
protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler context) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) { enableHandlers(true); hidePaletteWidget(false); addDRGEditorToCanvasWidget(); refreshFormPropertiesEvent.fire(new RefreshFormProperties(sessionManager.getCurrentSession(), nodeUUID)); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context) { enableHandlers(false); hidePaletteWidget(true); editor.setExpression(nodeUUID, hasExpression, hasName); editor.setExitCommand(() -> navigateToExpressionEditor(hasExpression, hasName)); addExpressionEditorToCanvasWidget(); return CanvasCommandResultBuilder.SUCCESS; } }; }

Target:
protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler context) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) { enableHandlers(true); hidePaletteWidget(false); addDRGEditorToCanvasWidget(); refreshFormPropertiesEvent.fire(new RefreshFormPropertiesEvent(sessionManager.getCurrentSession(), nodeUUID)); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context) { enableHandlers(false); hidePaletteWidget(true); editor.setExpression(nodeUUID, hasExpression, hasName); editor.setExitCommand(() -> navigateToExpressionEditor(hasExpression, hasName)); addExpressionEditorToCanvasWidget(); return CanvasCommandResultBuilder.SUCCESS; } }; }