auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testAgendaDoNotSerializeObject() throws Exception { String str = "import java.util.Collection\n" + "rule R1 when\n" + " String(this == \"x\" || this == \"y\" || this == \"z\")\n" + "then\n" + "end\n"; KieBase kbase = new KieHelper().addContent(str, ResourceType.DRL).build(); KieSession ksession = kbase.newKieSession(); ksession.insert("x"); ksession.insert("y"); ksession.insert("z"); assertEquals(3, ksession.fireAllRules()); ReadSessionResult serialisedStatefulKnowledgeSession = ProtobufTestMarshaller.getSerialisedStatefulKnowledgeSession(ksession, ksession.getKieBase(), true, true); ksession = serialisedStatefulKnowledgeSession.getSession(); ProtobufMessages.KnowledgeSession deserializedMessage = serialisedStatefulKnowledgeSession.getDeserializedMessage(); assertEquals(0, ksession.fireAllRules()); assertFalse(deserializedMessage.getRuleData().getAgenda().getMatchList().stream().anyMatch(ml -> ml.getObject().size() > 0)); }

Target:
public void testAgendaDoNotSerializeObject() throws Exception { KieSession ksession = null; try { String str = "import java.util.Collection\n" + "rule R1 when\n" + " String(this == \"x\" || this == \"y\" || this == \"z\")\n" + "then\n" + "end\n"; KieBase kbase = new KieHelper().addContent(str, ResourceType.DRL).build(); ksession = kbase.newKieSession(); ksession.insert("x"); ksession.insert("y"); ksession.insert("z"); assertEquals(3, ksession.fireAllRules()); ReadSessionResult serialisedStatefulKnowledgeSession = ProtobufTestMarshaller.getSerialisedStatefulKnowledgeSession(ksession, ksession.getKieBase()); ksession = serialisedStatefulKnowledgeSession.getSession(); ProtobufMessages.KnowledgeSession deserializedMessage = serialisedStatefulKnowledgeSession.getDeserializedMessage(); assertEquals(0, ksession.fireAllRules()); assertFalse(deserializedMessage.getRuleData().getAgenda().getMatchList().stream().anyMatch(ml -> ml.getObject().size() > 0)); } finally { if (ksession != null) { ksession.dispose(); } } }
Source:
public FileStoredIdentityManager() { userFile = new File("users.properties"); log.infof("Using <%1$s> as user repository", userFile.getAbsolutePath()); }

Target:
public FileStoredIdentityManager() { userFile = new File(IDENTITY_FILE); log.infof("Using <%1$s> as user repository", userFile.getAbsolutePath()); }
Source:
public void testNonCrossTenantSearch() throws Exception { Map<String, List<String>> query = new HashMap<>(); query.put(Event.tagsParameterName, Arrays.asList("event")); List<Map<String, Object>> results = searchIO.search(TENANT_1, query); Assert.assertEquals(TENANT_1_EVENTS_NUM, results.size()); results = searchIO.search(TENANT_2, query); Assert.assertEquals(TENANT_2_EVENTS_NUM, results.size()); results = searchIO.search(TENANT_RANGE, query); Assert.assertEquals(TENANT_RANGE_EVENTS_NUM, results.size()); }

Target:
public void testNonCrossTenantSearch() throws Exception { Map<String, List<String>> query = new HashMap<>(); query.put(Event.tagsParameterName, Arrays.asList("event")); List<Map<String, Object>> results = searchIO.search(TENANT_1, query); Assert.assertEquals(TENANT_1_EVENTS_NUM, results.size()); results = searchIO.search(TENANT_2, query); Assert.assertEquals(TENANT_2_EVENTS_NUM, results.size()); results = searchIO.search(TENANT_RANGE, query); Assert.assertEquals(TENANT_RANGE_EVENTS_NUM, results.size()); results = searchIO.search(TENANT_WITH_SYMBOLS, query); Assert.assertEquals(TENANT_WITH_SYMBOLS_NUM, results.size()); }
Source:
public void testTokenRangeWritesLogger() { CassandraKeyValueServiceImpl kvs = (CassandraKeyValueServiceImpl) keyValueService; kvs.tokenRangeWritesLogger = new TokenRangeWritesLogger(ImmutableSet.of( Range.lessThan(getToken("bcd")), Range.openClosed(getToken("bcd"), getToken("ghi")), Range.openClosed(getToken("ghi"), getToken("opq")), Range.greaterThan(getToken("opq")))); kvs.put(TEST_TABLE, ImmutableMap.of(Cell.create(PtBytes.toBytes("a"), column0), PtBytes.toBytes("test")), 100L); kvs.putWithTimestamps(TEST_TABLE, ImmutableMultimap.of( Cell.create(PtBytes.toBytes("g"), column0), Value.create(PtBytes.toBytes("value"), 200L), Cell.create(PtBytes.toBytes("g"), column0), Value.create(PtBytes.toBytes("value"), 300L))); kvs.putUnlessExists(TEST_TABLE, ImmutableMap.of( Cell.create(PtBytes.toBytes("za"), column0), value0_t0, Cell.create(PtBytes.toBytes("zg"), column0), value0_t0, Cell.create(PtBytes.toBytes("zz"), column0), value0_t0)); assertThat(kvs.tokenRangeWritesLogger.writesPerTable.getOrDefault(TEST_TABLE, 0L), equalTo(5L)); assertWritesInRangeDefinedBy(1L, "a", kvs); assertWritesInRangeDefinedBy(1L, "g", kvs); assertWritesInRangeDefinedBy(3L, "z", kvs); }

Target:
public void testTokenRangeWritesLogger() { CassandraKeyValueServiceImpl kvs = (CassandraKeyValueServiceImpl) keyValueService; CassandraClientPoolImpl clientPool = (CassandraClientPoolImpl) kvs.getClientPool(); TokenRangeWritesLogger tokenRangeWritesLogger = clientPool.tokenRangeWritesLogger; tokenRangeWritesLogger.updateTokenRanges(ImmutableSet.of( Range.atMost(getToken("bcd")), Range.openClosed(getToken("bcd"), getToken("ghi")), Range.openClosed(getToken("ghi"), getToken("opq")), Range.greaterThan(getToken("opq")))); kvs.put(TEST_TABLE, ImmutableMap.of(Cell.create(PtBytes.toBytes("a"), column0), PtBytes.toBytes("test")), 100L); kvs.putWithTimestamps(TEST_TABLE, ImmutableMultimap.of( Cell.create(PtBytes.toBytes("g"), column0), Value.create(PtBytes.toBytes("value"), 200L), Cell.create(PtBytes.toBytes("g"), column0), Value.create(PtBytes.toBytes("value"), 300L))); kvs.putUnlessExists(TEST_TABLE, ImmutableMap.of( Cell.create(PtBytes.toBytes("za"), column0), value0_t0, Cell.create(PtBytes.toBytes("zg"), column0), value0_t0, Cell.create(PtBytes.toBytes("zz"), column0), value0_t0)); assertThat(tokenRangeWritesLogger.getNumberOfWritesTotal(TEST_TABLE), equalTo(5L)); assertWritesInRangeDefinedBy(1L, "a", tokenRangeWritesLogger); assertWritesInRangeDefinedBy(1L, "g", tokenRangeWritesLogger); assertWritesInRangeDefinedBy(3L, "z", tokenRangeWritesLogger); }
Source:
public void conditionalReplaceAll(String originator, TaskId taskid, String channel, String predicate, String thenRemappingFunction) throws InvalidChannelException, CompilationException, IOException { String currentKey = null; try { Channel chosenChannel = getChannel(channel); for (Map.Entry<String, Serializable> entry : chosenChannel.entrySet()) { currentKey = entry.getKey(); Serializable value = chosenChannel.get(currentKey); if (evaluateClosure(predicate, BiPredicate.class).test(currentKey, value)) { Serializable answer = chosenChannel.compute(currentKey, evaluateClosure(thenRemappingFunction, BiFunction.class)); logWithContext(taskid, channel, "Run conditionalReplaceAll" + ON_KEY + QUOTE + currentKey + QUOTE + RESULT_IS + answer, Level.DEBUG); } } commitIfNeeded(channel); } catch (InvalidChannelException | CompilationException | IOException e) { throw e; } catch (Exception e) { throw new ClosureEvaluationException(EXCEPTION_WHEN_EVALUATING_CLOSURE + StackTraceUtil.getStackTrace(e)); } }

Target:
public void conditionalReplaceAll(String originator, TaskId taskid, String channel, String predicate, String thenRemappingFunction) throws InvalidChannelException, CompilationException, IOException { String currentKey; try { Channel chosenChannel = getChannel(channel); for (Map.Entry<String, Serializable> entry : chosenChannel.entrySet()) { currentKey = entry.getKey(); if (evaluateClosure(predicate, BiPredicate.class).test(currentKey, entry.getValue())) { chosenChannel.compute(currentKey, evaluateClosure(thenRemappingFunction, BiFunction.class)); } } logWithContextAndPersist(taskid, channel, "Run conditionalReplaceAll, new content is: " + chosenChannel, Level.DEBUG); } catch (InvalidChannelException | CompilationException | IOException e) { throw e; } catch (Exception e) { throw new ClosureEvaluationException(EXCEPTION_WHEN_EVALUATING_CLOSURE + StackTraceUtil.getStackTrace(e)); } }
Source:
public boolean deleteZone(final DeleteZoneCmd cmd) { final Long zoneId = cmd.getId(); if (!validZone(zoneId)) { throw new InvalidParameterValueException("A zone with ID: " + zoneId + " does not exist."); } checkIfZoneIsDeletable(zoneId); return Transaction.execute(new TransactionCallback<Boolean>() { @Override public Boolean doInTransaction(final TransactionStatus status) { final List<VlanVO> vlans = _vlanDao.listByZone(zoneId); for (final VlanVO vlan : vlans) { _vlanDao.remove(vlan.getId()); } templateZoneDao.deleteByZoneId(zoneId); final boolean success = _zoneDao.remove(zoneId); if (success) { _capacityDao.removeBy(null, zoneId, null, null, null); final DedicatedResourceVO dr = _dedicatedDao.findByZoneId(zoneId); if (dr != null) { _dedicatedDao.remove(dr.getId()); final List<DedicatedResourceVO> resourcesInGroup = _dedicatedDao.listByAffinityGroupId(dr.getAffinityGroupId()); if (resourcesInGroup.isEmpty()) { _affinityGroupService.deleteAffinityGroup(dr.getAffinityGroupId(), null, null, null, null); } } } return success; } }); }

Target:
public boolean deleteZone(final DeleteZoneCmd cmd) { final Long zoneId = cmd.getId(); if (!validZone(zoneId)) { throw new InvalidParameterValueException("A zone with ID: " + zoneId + " does not exist."); } checkIfZoneIsDeletable(zoneId); return Transaction.execute(new TransactionCallback<Boolean>() { @Override public Boolean doInTransaction(final TransactionStatus status) { final List<VlanVO> vlans = _vlanDao.listByZone(zoneId); for (final VlanVO vlan : vlans) { _vlanDao.remove(vlan.getId()); } final boolean success = _zoneDao.remove(zoneId); if (success) { templateZoneDao.deleteByZoneId(zoneId); _capacityDao.removeBy(null, zoneId, null, null, null); final DedicatedResourceVO dr = _dedicatedDao.findByZoneId(zoneId); if (dr != null) { _dedicatedDao.remove(dr.getId()); final List<DedicatedResourceVO> resourcesInGroup = _dedicatedDao.listByAffinityGroupId(dr.getAffinityGroupId()); if (resourcesInGroup.isEmpty()) { _affinityGroupService.deleteAffinityGroup(dr.getAffinityGroupId(), null, null, null, null); } } } return success; } }); }
Source:
public void rendersBoutPage() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:1"; final User user = base.user(new URN(urn)); user.aliases().add("jeff"); final Alias alias = user.aliases().iterate().iterator().next(); final Bout bout = alias.inbox().bout(alias.inbox().start()); bout.attachments().create("a1"); bout.messages().post("hello, world!"); bout.friends().invite(alias.name()); MatcherAssert.assertThat( XhtmlMatchers.xhtml( new RsPrint( new FkBout(".*", new TkIndex(base)).route( new RqWithAuth( urn, new RqFake( "GET", String.format("/b/%d", bout.number()) ) ) ).get() ).printBody() ), XhtmlMatchers.hasXPaths( "/page/bout[number=1]", "/page/bout[title='untitled']", "/page/bout[unread=0]", "/page/bout/friends/friend[alias='jeff']", "/page/bout/friends/friend/links/link[@rel='photo']", "/page/bout/friends/friend/links/link[@rel='kick']", "/page/bout/attachments/attachment/links/link[@rel='delete']", "/page/bout/messages/message[text='hello, world!']" ) ); }

Target:
public void rendersBoutPage() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:1"; final User user = base.user(new URN(urn)); user.aliases().add("jeff"); final Alias alias = user.aliases().iterate().iterator().next(); final Bout bout = alias.inbox().bout(alias.inbox().start()); bout.attachments().create("a1"); bout.messages().post("hello, world!"); bout.friends().invite(alias.name()); MatcherAssert.assertThat( XhtmlMatchers.xhtml( new RsPrint( new FkBout(TkIndexTest.REGEX, new TkIndex(base)).route( new RqWithAuth( urn, new RqFake( RqMethod.GET, String.format("/b/%d", bout.number()) ) ) ).get() ).printBody() ), XhtmlMatchers.hasXPaths( "/page/bout[number=1]", "/page/bout[title='untitled']", "/page/bout[unread=0]", "/page/bout/friends/friend[alias='jeff']", "/page/bout/friends/friend/links/link[@rel='photo']", "/page/bout/friends/friend/links/link[@rel='kick']", "/page/bout/attachments/attachment/links/link[@rel='delete']", "/page/bout/messages/message[text='hello, world!']" ) ); }
Source:
private Promise<TemplateStore> loadTemplateStore() { Deferred<TemplateStore> deferred = new Deferred<>(); Promise<TemplateStore> promise = deferred.getPromise(); promise.thenAccept((ts)->{}); Executors.newSingleThreadExecutor().submit(()->{ TemplateStore templateStore = null; IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore(); boolean alreadyMigrated= store.getBoolean(CODE_TEMPLATES_MIGRATION_KEY); if (alreadyMigrated) templateStore= new ContributionTemplateStore(getCodeTemplateContextRegistry(), store, CODE_TEMPLATES_KEY); else { templateStore= new CompatibilityTemplateStore(getCodeTemplateContextRegistry(), store, CODE_TEMPLATES_KEY, getOldCodeTemplateStoreInstance()); store.setValue(CODE_TEMPLATES_MIGRATION_KEY, true); } try { templateStore.load(); } catch (IOException e) { JavaPlugin.log(e); } templateStore.startListeningForPreferenceChanges(); CompatibilityTemplateStore.pruneDuplicates(templateStore, true); deferred.resolve(templateStore); }); return promise.thenAccept((ts)->{ JavaManipulation.setCodeTemplateStore(ts); JavaManipulation.setCodeTemplateContextRegistry(getCodeTemplateContextRegistry()); }); }

Target:
private Promise<TemplateStore> loadTemplateStore() { Deferred<TemplateStore> deferred = new Deferred<>(); Promise<TemplateStore> promise = deferred.getPromise(); Executors.newSingleThreadExecutor().submit(()->{ TemplateStore templateStore = null; IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore(); boolean alreadyMigrated= store.getBoolean(CODE_TEMPLATES_MIGRATION_KEY); if (alreadyMigrated) templateStore= new ContributionTemplateStore(getCodeTemplateContextRegistry(), store, CODE_TEMPLATES_KEY); else { templateStore= new CompatibilityTemplateStore(getCodeTemplateContextRegistry(), store, CODE_TEMPLATES_KEY, getOldCodeTemplateStoreInstance()); store.setValue(CODE_TEMPLATES_MIGRATION_KEY, true); } try { templateStore.load(); } catch (IOException e) { JavaPlugin.log(e); } templateStore.startListeningForPreferenceChanges(); CompatibilityTemplateStore.pruneDuplicates(templateStore, true); deferred.resolve(templateStore); }); return promise.thenAccept((ts)->{ JavaManipulation.setCodeTemplateStore(ts); JavaManipulation.setCodeTemplateContextRegistry(getCodeTemplateContextRegistry()); }); }
Source:
public static void main(String[] args) { new BisqCliMain("localhost", 8888, args); }

Target:
public static void main(String[] args) { new BisqCliMain("localhost", 9998, args); }
Source:
public Response addAgent(@PathParam("clusterName") String clusterName, BaragonAgentMetadata agent) { LOG.info(String.format("Notified of startup for agent %s", agent.getAgentId())); try { if (elbManager.isElbConfigured()) { elbManager.attemptAddAgent(agent, loadBalancerDatastore.getLoadBalancerGroup(clusterName), clusterName); } } catch (Exception e) { LOG.error("Could not register agent startup", e); return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e).build(); } return Response.ok().build(); }

Target:
public Response addAgent(@PathParam("clusterName") String clusterName, BaragonAgentMetadata agent) { LOG.info(String.format("Notified of startup for agent %s", agent.getAgentId())); try { if (elbManager.isElbConfigured()) { elbManager.attemptAddAgent(agent, loadBalancerDatastore.getLoadBalancerGroup(clusterName), clusterName); } } catch (Exception e) { LOG.error("Could not register agent startup", e); return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } return Response.ok().build(); }
Source:
public void set(@NonNull FeaturedArticleCard card) { String articleTitle = card.articleTitle(); String articleSubtitle = card.articleSubtitle(); String extract = card.extract(); Uri imageUri = card.image() != null ? card.image() : null; articleTitle(articleTitle); if (articleSubtitle != null) { articleSubtitle(articleSubtitle); } if (extract != null) { extract(extract); } if (imageUri != null) { image(imageUri); } header(card); footer(); }

Target:
public void set(@NonNull FeaturedArticleCard card) { String articleTitle = card.articleTitle(); String articleSubtitle = card.articleSubtitle(); String extract = card.extract(); Uri imageUri = card.image(); articleTitle(articleTitle); articleSubtitle(articleSubtitle); extract(extract); image(imageUri); header(card); footer(); }
Source:
private List<FeedbackResponseCommentRow> createFeedbackResponseCommentRows( FeedbackResponseAttributes responseEntry, FeedbackResponseCommentSearchResultBundle frcSearchResultBundle) { List<FeedbackResponseCommentRow> rows = new ArrayList<>(); List<FeedbackResponseCommentAttributes> frcList = frcSearchResultBundle .comments.get(responseEntry.getId()); for (FeedbackResponseCommentAttributes frc : frcList) { String frCommentGiver = frcSearchResultBundle .commentGiverTable.get(frc.getId().toString()); if (!"Anonymous".equals(frCommentGiver)) { frCommentGiver = frc.giverEmail; } FeedbackResponseCommentRow frcDiv = new FeedbackResponseCommentRow(frc, frCommentGiver, frcSearchResultBundle.instructorEmailNameTable, frcSearchResultBundle.sessions.get(responseEntry.feedbackSessionName).getTimeZone()); rows.add(frcDiv); } return rows; }

Target:
private List<FeedbackResponseCommentRow> createFeedbackResponseCommentRows( FeedbackResponseAttributes responseEntry, FeedbackResponseCommentSearchResultBundle frcSearchResultBundle) { List<FeedbackResponseCommentRow> rows = new ArrayList<>(); List<FeedbackResponseCommentAttributes> frcList = frcSearchResultBundle .comments.get(responseEntry.getId()); for (FeedbackResponseCommentAttributes frc : frcList) { String frCommentGiver = frcSearchResultBundle .commentGiverTable.get(frc.getId().toString()); if (!"Anonymous".equals(frCommentGiver)) { frCommentGiver = frc.giverEmail; } double sessionTimeZone = frcSearchResultBundle.sessions.get(responseEntry.feedbackSessionName).getTimeZone(); FeedbackResponseCommentRow frcDiv = new FeedbackResponseCommentRow(frc, frCommentGiver, frcSearchResultBundle.instructorEmailNameTable, sessionTimeZone); rows.add(frcDiv); } return rows; }
Source:
public void calcTime(Date date, HistoryScanHolder holder) { Date now = new Date(); long seconds = TimeUnit.MILLISECONDS.toSeconds(now.getTime() - date.getTime()); long minutes = TimeUnit.MILLISECONDS.toMinutes(now.getTime() - date.getTime()); long hours = TimeUnit.MILLISECONDS.toHours(now.getTime() - date.getTime()); long days = TimeUnit.MILLISECONDS.toDays(now.getTime() - date.getTime()); String secText = seconds + " seconds ago"; String hourText = res.getQuantityString(R.plurals.hours, (int) hours, (int) hours); String minText = res.getQuantityString(R.plurals.minutes, (int) minutes,(int) minutes); String dayText = res.getQuantityString(R.plurals.days, (int) days, (int) days); if (seconds < 60) { holder.txtDate.setText(secText); } else if (minutes < 60) { holder.txtDate.setText(minText); } else if (hours < 24) { holder.txtDate.setText(hourText); } else { holder.txtDate.setText(dayText); } }

Target:
private void calcTime(Date date, HistoryScanHolder holder) { Date now = new Date(); long seconds = TimeUnit.MILLISECONDS.toSeconds(now.getTime() - date.getTime()); long minutes = TimeUnit.MILLISECONDS.toMinutes(now.getTime() - date.getTime()); long hours = TimeUnit.MILLISECONDS.toHours(now.getTime() - date.getTime()); long days = TimeUnit.MILLISECONDS.toDays(now.getTime() - date.getTime()); if (seconds < 60) { holder.txtDate.setText(res.getQuantityString(R.plurals.seconds, (int) seconds, (int) seconds)); } else if (minutes < 60) { holder.txtDate.setText(res.getQuantityString(R.plurals.minutes, (int) minutes, (int) minutes)); } else if (hours < 24) { holder.txtDate.setText(res.getQuantityString(R.plurals.hours, (int) hours, (int) hours)); } else { holder.txtDate.setText(res.getQuantityString(R.plurals.days, (int) days, (int) days)); } }
Source:
private RepositorySystemSession newSession( RepositorySystem system ) { DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession(); LocalRepository localRepo = new LocalRepository( ArtifactRepositoryService.GLOBAL_M2_REPO_NAME ); session.setLocalRepositoryManager( system.newLocalRepositoryManager( session, localRepo ) ); return session; }

Target:
private RepositorySystemSession newSession(RepositorySystem system) { DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession(); LocalRepository localRepo = new LocalRepository(ArtifactRepositoryPreference.getGlobalM2RepoDirWithFallback()); session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo)); return session; }
Source:
public <R> Streamlet<R> newSource(SerializableSupplier<R> supplier) { Preconditions.checkNotNull(supplier, "supplier must not be null."); StreamletImpl<R> retval = StreamletImpl.createSupplierStreamlet(supplier); retval.setNumPartitions(1); sources.add(retval); return retval; }

Target:
public <R> Streamlet<R> newSource(SerializableSupplier<R> supplier) { StreamletUtils.require(supplier != null, "supplier must not be null."); StreamletImpl<R> retval = StreamletImpl.createSupplierStreamlet(supplier); retval.setNumPartitions(1); sources.add(retval); return retval; }
Source:
public Builder(ZNRecord record) { _cloudEnabled = record.getBooleanField(CloudConfigProperty.CLOUD_ENABLED.name(), false); _cloudProvider = CloudProvider.valueOf(record.getSimpleField(CloudConfigProperty.CLOUD_PROVIDER.name())); _cloudID = record.getSimpleField(CloudConfigProperty.CLOUD_ID.name()); _cloudInfoSources = record.getListField(CloudConfigProperty.CLOUD_INFO_SOURCE.name()); _cloudInfoProcessorName = record.getSimpleField(CloudConfigProperty.CLOUD_INFO_PROCESSOR_NAME.name()); }

Target:
public Builder(ZNRecord record) { _record = record; }
Source:
public static Map<String, String> CreateStructFromConnection(final storage_server_connections connection, final storage_pool storage_pool) { Map<String, String> con = new HashMap<String, String>(); con.put("id", (connection.getid() != null) ? connection.getid() : Guid.Empty.toString()); addOrEmpty(con, connection.getconnection(), "connection"); addOrEmpty(con, connection.getportal(), "portal"); addOrEmpty(con, connection.getport(), "port"); addOrEmpty(con, connection.getiqn(), "iqn"); addOrEmpty(con, connection.getuser_name(), "user"); addOrEmpty(con, connection.getpassword(), "password"); if (storage_pool != null && Version.v3_1.compareTo(storage_pool.getcompatibility_version()) <= 0) { addIfNotNullOrEmpty(con, connection.getMountOptions(), "mnt_options"); addIfNotNullOrEmpty(con, connection.getVfsType(), "vfs_type"); addIfNotNullOrEmpty(con, connection.getNfsVersion(), "protocol_version"); addIfNotNullOrEmpty(con, connection.getNfsTimeo(), "timeout"); addIfNotNullOrEmpty(con, connection.getNfsRetrans(), "retrans"); } return con; }

Target:
public static Map<String, String> CreateStructFromConnection(final storage_server_connections connection, final storage_pool storage_pool) { Map<String, String> con = new HashMap<String, String>(); con.put("id", (connection.getid() != null) ? connection.getid() : Guid.Empty.toString()); addOrEmpty(con, connection.getconnection(), "connection"); addOrEmpty(con, connection.getportal(), "portal"); addOrEmpty(con, connection.getport(), "port"); addOrEmpty(con, connection.getiqn(), "iqn"); addOrEmpty(con, connection.getuser_name(), "user"); addOrEmpty(con, connection.getpassword(), "password"); if (storage_pool != null && nfsMinimalVersion.compareTo(storage_pool.getcompatibility_version()) <= 0) { addIfNotNullOrEmpty(con, connection.getMountOptions(), "mnt_options"); addIfNotNullOrEmpty(con, connection.getVfsType(), "vfs_type"); addIfNotNullOrEmpty(con, connection.getNfsVersion(), "protocol_version"); addIfNotNullOrEmpty(con, connection.getNfsTimeo(), "timeout"); addIfNotNullOrEmpty(con, connection.getNfsRetrans(), "retrans"); } return con; }
Source:
private ServerConnector getSSLServerConnector(HttpsType httpsType, String intf, int port) throws IOException { SslContextFactory sslContextFactory = new SslContextFactory(); String value = getKeyTrustStoreAttribute("javax.net.ssl.keyStore", httpsType.getKeyStore(), "path", true); sslContextFactory.setKeyStorePath(value); sslContextFactory.setKeyStorePassword(getKeyTrustStoreAttribute("javax.net.ssl.keyStorePassword", httpsType.getKeyStore(), "password", true)); value = getKeyTrustStoreAttribute("javax.net.ssl.trustStore", httpsType.getTrustStore(), "path", false); if (value!=null) { sslContextFactory.setTrustStorePath(value); } value = getKeyTrustStoreAttribute("javax.net.ssl.trustStorePassword", httpsType.getTrustStore(), "password", false); if (value!=null) { sslContextFactory.setTrustStorePassword(value); } HttpConfiguration httpsConfig = new HttpConfiguration(); httpsConfig.setSecureScheme("https"); httpsConfig.setSecurePort(port); ServerConnector connector = new ServerConnector(m_server, new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()), new HttpConnectionFactory(httpsConfig)); if (intf != null && intf.length() > 0) { connector.setHost(intf); } connector.setPort(port); connector.setName("VoltDB-HTTPS"); connector.open(); return connector; }

Target:
private ServerConnector getSSLServerConnector(HttpsType httpsType, String intf, int port) throws IOException { SslContextFactory sslContextFactory = new SslContextFactory(); String value = getKeyTrustStoreAttribute("javax.net.ssl.keyStore", httpsType.getKeyStore(), "path", true); sslContextFactory.setKeyStorePath(value); sslContextFactory.setKeyStorePassword(getKeyTrustStoreAttribute("javax.net.ssl.keyStorePassword", httpsType.getKeyStore(), "password", true)); value = getKeyTrustStoreAttribute("javax.net.ssl.trustStore", httpsType.getTrustStore(), "path", false); if (value!=null) { sslContextFactory.setTrustStorePath(value); } value = getKeyTrustStoreAttribute("javax.net.ssl.trustStorePassword", httpsType.getTrustStore(), "password", false); if (value!=null) { sslContextFactory.setTrustStorePassword(value); } sslContextFactory.setExcludeCipherSuites("SSL_RSA_WITH_DES_CBC_SHA", "SSL_DHE_RSA_WITH_DES_CBC_SHA", "SSL_DHE_DSS_WITH_DES_CBC_SHA", "SSL_RSA_EXPORT_WITH_RC4_40_MD5", "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA"); HttpConfiguration httpsConfig = new HttpConfiguration(); httpsConfig.setSecureScheme("https"); httpsConfig.setSecurePort(port); httpsConfig.addCustomizer(new SecureRequestCustomizer()); HttpConnectionFactory factory = new HttpConnectionFactory(httpsConfig); ServerConnector connector = new ServerConnector(m_server, new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()), factory); if (intf != null && intf.length() > 0) { connector.setHost(intf); } connector.setPort(port); connector.setName("VoltDB-HTTPS"); connector.open(); return connector; }
Source:
public void start() { try { localNode = Thread.currentThread() instanceof IgniteThread; if (localNode) { cacheManager = (IgniteEx) Ignition.localIgnite(); gridName = cacheManager.name(); } else { gridName = createGridName(); try { if (gridName != null) { cacheManager = (IgniteEx) Ignition.ignite( gridName ); } else { cacheManager = (IgniteEx) Ignition.ignite(); } } catch (IgniteIllegalStateException iise) { IgniteConfiguration conf = IgnitionEx.loadConfiguration( config.getUrl() ).get1(); conf.setGridName( gridName ); if (!(jtaPlatform instanceof NoJtaPlatform)) { conf.getTransactionConfiguration().setTxManagerFactory( new IgniteTransactionManagerFactory( jtaPlatform ) ); } cacheManager = (IgniteEx) Ignition.start( conf ); } } } catch (Exception e) { throw log.unableToStartDatastoreProvider( e ); } }

Target:
public void start() { try { localNode = Thread.currentThread() instanceof IgniteThread; if (localNode) { cacheManager = (IgniteEx) Ignition.localIgnite(); gridName = cacheManager.name(); } else { gridName = config.getOrCreateGridName(); try { if (gridName != null) { cacheManager = (IgniteEx) Ignition.ignite( gridName ); } else { cacheManager = (IgniteEx) Ignition.ignite(); } } catch (IgniteIllegalStateException iise) { IgniteConfiguration conf = config.getOrCreateIgniteConfiguration(); conf.setGridName( gridName ); if (!(jtaPlatform instanceof NoJtaPlatform)) { conf.getTransactionConfiguration().setTxManagerFactory( new IgniteTransactionManagerFactory( jtaPlatform ) ); } cacheManager = (IgniteEx) Ignition.start( conf ); stopOnExit = true; } } } catch (ServiceException ex) { throw ex; } catch (Exception ex) { throw log.unableToStartDatastoreProvider( ex ); } }
Source:
private void drainUntilTimestamp(final Queue<MistEvent> queue, final long timestamp) { while (!queue.isEmpty() && queue.peek().getTimestamp() <= timestamp) { final MistEvent input = queue.poll(); outputEmitter.emit(input); } }

Target:
private void drainUntilTimestamp(final Queue<MistEvent> queue, final long timestamp) { while (!queue.isEmpty() && peekTimestamp(queue) <= timestamp) { final MistEvent event = queue.poll(); if (event.isData()) { outputEmitter.emitData((MistDataEvent)event); } else { outputEmitter.emitWatermark((MistWatermarkEvent)event); } } }
Source:
protected Optional<CommandResult<CanvasViolation>> doDragEnd(final Element element) { final AbstractCanvas<?> canvas = canvasHandler.getAbstractCanvas(); final Shape<?> shape = canvas.getShape(element.getUUID()); final double x = shape.getShapeView().getShapeX(); final double y = shape.getShapeView().getShapeY(); return Optional.of(move(element, x, y)); }

Target:
private CommandResult<CanvasViolation> doDragEnd(final Element element) { final AbstractCanvas<?> canvas = canvasHandler.getAbstractCanvas(); final Shape<?> shape = canvas.getShape(element.getUUID()); final double x = shape.getShapeView().getShapeX(); final double y = shape.getShapeView().getShapeY(); return move(element, x, y); }
Source:
public Receiver() { super(ADMMessageHandler.class); boolean ADMLatestAvailable = false; try{ Class.forName( "com.amazon.device.messaging.ADMMessageHandlerJobBase" ); ADMLatestAvailable = true ; } catch (ClassNotFoundException e) { } if (ADMLatestAvailable) { registerJobServiceClass(ADMMessageHandlerJob.class, 123891); } }

Target:
public Receiver() { super(ADMMessageHandler.class); boolean ADMLatestAvailable = false; try { Class.forName( "com.amazon.device.messaging.ADMMessageHandlerJobBase" ); ADMLatestAvailable = true ; } catch (ClassNotFoundException e) { } if (ADMLatestAvailable) { registerJobServiceClass(ADMMessageHandlerJob.class, JOB_ID); } OneSignal.Log(OneSignal.LOG_LEVEL.DEBUG, "ADM latest available: " + ADMLatestAvailable); }
Source:
private void printGitProperties() { if (gitPropertiesPrinted) { return; } gitPropertiesPrinted = true; try (InputStream in = getClass().getResourceAsStream("/git.properties")) { if (in == null) { System.out.println("Did not find resource /git.properties"); return; } try (BufferedReader reader = new BufferedReader(new InputStreamReader(in))) { String line; while ((line = reader.readLine()) != null) { System.out.println(line); } } } catch (IOException e) { System.out.println("IOException while reading git.properties: " + e.getMessage()); } }

Target:
private void printGitProperties() { if (gitPropertiesPrinted) { return; } gitPropertiesPrinted = true; try (InputStream in = getClass().getResourceAsStream("/git.properties"); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); ) { String line; while ((line = reader.readLine()) != null) { System.out.println(line); } } catch (IOException e) { System.out.println("IOException while reading git.properties: " + e.getMessage()); } }
Source:
final void setExtendedExpiresOn(final Date extendedExpiresOn) { this.mExtendedExpiresOn = extendedExpiresOn; }

Target:
final void setExtendedExpiresOn(final Date extendedExpiresOn) { mExtendedExpiresOn = extendedExpiresOn; }
Source:
public GitHubSCMSource(String repoOwner, String repository, String repositoryUrl, boolean configuredByUrl) { if (!configuredByUrl) { this.apiUri = GITHUB_URL; this.repoOwner = repoOwner; this.repository = removeEnd(repository, ".git");; this.repositoryUrl = null; } else { GitHubRepositoryInfo info = GitHubRepositoryInfo.forRepositoryUrl(repositoryUrl); this.apiUri = info.getApiUri(); this.repoOwner = info.getRepoOwner(); this.repository = removeEnd(info.getRepository(), ".git"); this.repositoryUrl = info.getRepositoryUrl(); } pullRequestMetadataCache = new ConcurrentHashMap<>(); pullRequestContributorCache = new ConcurrentHashMap<>(); this.traits = new ArrayList<>(); }

Target:
public GitHubSCMSource(String repoOwner, String repository, String repositoryUrl, boolean configuredByUrl) { if (!configuredByUrl) { this.apiUri = GITHUB_URL; this.repoOwner = repoOwner; this.repository = repository; this.repositoryUrl = null; } else { GitHubRepositoryInfo info = GitHubRepositoryInfo.forRepositoryUrl(repositoryUrl); this.apiUri = info.getApiUri(); this.repoOwner = info.getRepoOwner(); this.repository = info.getRepository(); this.repositoryUrl = info.getRepositoryUrl(); } pullRequestMetadataCache = new ConcurrentHashMap<>(); pullRequestContributorCache = new ConcurrentHashMap<>(); this.traits = new ArrayList<>(); }
Source:
private static Long parseDateToEpochSeconds(String dateTime) { DateTimeFormatter dtf = DateTimeFormatter.ofPattern("MM/dd/yyyy HH:mm:ss XXX"); try { return Long.parseLong(dateTime); } catch (NumberFormatException e) { System.err.println(e.getMessage()); } try { return Instant.from(dtf.parse(dateTime)).toEpochMilli() / 1000L; } catch (DateTimeParseException e) { System.err.println(e.getMessage()); } throw new IllegalArgumentException("Unable to parse date time " + dateTime); }

Target:
private static Long parseDateToEpochSeconds(String dateTime) { ClientLogger logger = new ClientLogger(MSIToken.class); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("MM/dd/yyyy HH:mm:ss XXX"); try { return Long.parseLong(dateTime); } catch (NumberFormatException e) { System.err.println(e.getMessage()); } try { return Instant.from(dtf.parse(dateTime)).toEpochMilli() / 1000L; } catch (DateTimeParseException e) { System.err.println(e.getMessage()); } throw logger.logExceptionAsError(new IllegalArgumentException("Unable to parse date time " + dateTime)); }
Source:
private TupleBatch getResultBatch() throws DbException, IOException { Preconditions.checkState( getChild().eos(), "cannot extract results from an aggregate until child has reached EOS"); if (groupKeyList == null) { groupKeyList = Lists.newLinkedList(groupKeys.finalResult()); groupKeys = null; } if (groupKeyList.isEmpty()) { return null; } TupleBatch curGroupKeys = groupKeyList.remove(0); TupleBatchBuffer curGroupAggs = new TupleBatchBuffer(aggSchema); for (int row = 0; row < curGroupKeys.numTuples(); ++row) { Object[] rowAggs = aggStates.get(row); List<TupleBatch> lt = tbgroupState.get(row); int curCol = 0; for (int agg = 0; agg < aggregators.length; ++agg) { if (aggregators[agg] .getClass() .getName() .equals(StatefulUserDefinedAggregator.class.getName())) { aggregators[agg].add(lt, rowAggs[agg]); aggregators[agg].getResult(curGroupAggs, curCol, rowAggs[agg]); } else { aggregators[agg].getResult(curGroupAggs, curCol, rowAggs[agg]); } curCol += aggregators[agg].getResultSchema().numColumns(); } } TupleBatch aggResults = curGroupAggs.popAny(); Preconditions.checkState( curGroupKeys.numTuples() == aggResults.numTuples(), "curGroupKeys size %s != aggResults size %s", curGroupKeys.numTuples(), aggResults.numTuples()); tbgroupState = tbgroupState.subList(curGroupKeys.numTuples(), tbgroupState.size()); aggStates = aggStates.subList(curGroupKeys.numTuples(), aggStates.size()); return new TupleBatch( getSchema(), ImmutableList.<Column<?>>builder() .addAll(curGroupKeys.getDataColumns()) .addAll(aggResults.getDataColumns()) .build()); }

Target:
private TupleBatch getResultBatch() throws DbException { Preconditions.checkState( getChild().eos(), "cannot extract results from an aggregate until child has reached EOS"); if (groupKeyList == null) { groupKeyList = Lists.newLinkedList(groupKeys.finalResult()); groupKeys = null; } if (groupKeyList.isEmpty()) { return null; } TupleBatch curGroupKeys = groupKeyList.remove(0); TupleBatchBuffer curGroupAggs = new TupleBatchBuffer(aggSchema); for (int row = 0; row < curGroupKeys.numTuples(); ++row) { Object[] rowAggs = aggStates.get(row); List<TupleBatch> lt = tbgroupState.get(row); int curCol = 0; for (int agg = 0; agg < aggregators.length; ++agg) { if ((aggregators[agg] instanceof StatefulUserDefinedAggregator)) { aggregators[agg].add(lt); } aggregators[agg].getResult(curGroupAggs, curCol, rowAggs[agg]); curCol += aggregators[agg].getResultSchema().numColumns(); } } TupleBatch aggResults = curGroupAggs.popAny(); Preconditions.checkState( curGroupKeys.numTuples() == aggResults.numTuples(), "curGroupKeys size %s != aggResults size %s", curGroupKeys.numTuples(), aggResults.numTuples()); tbgroupState = tbgroupState.subList(curGroupKeys.numTuples(), tbgroupState.size()); aggStates = aggStates.subList(curGroupKeys.numTuples(), aggStates.size()); return new TupleBatch( getSchema(), ImmutableList.<Column<?>>builder() .addAll(curGroupKeys.getDataColumns()) .addAll(aggResults.getDataColumns()) .build()); }
Source:
public void reduce(RexBuilder rexBuilder, List<RexNode> constExps, List<RexNode> reducedValues) { Object[] values; try { values = compiledFunction.apply(dataContext); assert values.length == constExps.size(); final List<Object> valueList = Arrays.asList(values); for (Pair<RexNode, Object> value : Pair.zip(constExps, valueList)) { reducedValues.add( rexBuilder.makeLiteral(value.right, value.left.getType(), true)); } } catch (RuntimeException | AssertionError e) { reducedValues.addAll(constExps); values = new Object[constExps.size()]; } Hook.EXPRESSION_REDUCER.run(Pair.of(code, values)); }

Target:
public void reduce(RexBuilder rexBuilder, List<RexNode> constExps, List<RexNode> reducedValues) { Object[] values; try { values = compiledFunction.apply(dataContext); assert values.length == constExps.size(); final List<Object> valueList = Arrays.asList(values); for (Pair<RexNode, Object> value : Pair.zip(constExps, valueList)) { reducedValues.add( rexBuilder.makeLiteral(value.right, value.left.getType(), true)); } } catch (RuntimeException e) { reducedValues.addAll(constExps); values = new Object[constExps.size()]; } Hook.EXPRESSION_REDUCER.run(Pair.of(code, values)); }
Source:
public DocumentModel createComment(DocumentModel docModel, DocumentModel commentModel) throws CommentSecurityException { NuxeoPrincipal principal = commentModel.getCoreSession().getPrincipal(); try (CloseableCoreSession session = CoreInstance.openCoreSessionSystem(docModel.getRepositoryName())) { DocumentRef docRef = getTopLevelCommentAncestor(session, docModel.getRef()); if (!session.hasPermission(principal, docRef, SecurityConstants.READ)) { throw new CommentSecurityException( "The user " + principal.getName() + " can not create comments on document " + docModel.getId()); } String path = getCommentContainerPath(session, docModel.getId()); DocumentModel commentModelToCreate = session.createDocumentModel(path, COMMENT_NAME, commentModel.getType()); commentModelToCreate.copyContent(commentModel); commentModelToCreate.setPropertyValue(COMMENT_ANCESTOR_IDS, (Serializable) computeAncestorIds(session, docModel.getId())); DocumentModel comment = session.createDocument(commentModelToCreate); comment.detach(true); handleNotificationAutoSubscriptions(session, commentModel, session.getDocument(docRef)); notifyEvent(session, CommentEvents.COMMENT_ADDED, comment); return comment; } }

Target:
public DocumentModel createComment(DocumentModel docModel, DocumentModel commentModel) throws CommentSecurityException { NuxeoPrincipal principal = commentModel.getCoreSession().getPrincipal(); try (CloseableCoreSession session = CoreInstance.openCoreSessionSystem(docModel.getRepositoryName())) { DocumentRef docRef = getTopLevelDocumentRef(session, docModel.getRef()); if (!session.hasPermission(principal, docRef, SecurityConstants.READ)) { throw new CommentSecurityException( "The user " + principal.getName() + " can not create comments on document " + docModel.getId()); } String path = getCommentContainerPath(session, docModel.getId()); DocumentModel commentModelToCreate = session.createDocumentModel(path, COMMENT_NAME, commentModel.getType()); commentModelToCreate.copyContent(commentModel); commentModelToCreate.setPropertyValue(COMMENT_PARENT_ID_PROPERTY, docModel.getId()); commentModelToCreate.setPropertyValue(COMMENT_ANCESTOR_IDS_PROPERTY, computeAncestorIds(session, docModel.getId())); DocumentModel comment = session.createDocument(commentModelToCreate); comment.detach(true); notifyEvent(session, CommentEvents.COMMENT_ADDED, docModel, comment); return comment; } }
Source:
protected boolean getMasterDrain(final TInfo tinfo, final TCredentials rpcCreds, final String tableName, final Set<String> wals) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { boolean result; try { result = MasterClient.execute(context, client -> client.drainReplicationTable(tinfo, rpcCreds, tableName, wals)); } catch (ThriftTableOperationException e) { switch (e.getType()) { case NAMESPACE_NOTFOUND: case NOTFOUND: throw new TableNotFoundException(e); default: throw new AccumuloException(e); } } return result; }

Target:
protected boolean getMasterDrain(final TInfo tinfo, final TCredentials rpcCreds, final String tableName, final Set<String> wals) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { return MasterClient.execute(context, client -> client.drainReplicationTable(tinfo, rpcCreds, tableName, wals)); }
Source:
protected void clearField(String structureInode, Field field) throws DotDataException { if(field.getFieldContentlet() == null || ! (field.getFieldContentlet().matches("^.*\\d+$"))){ return; } Queries queries = getQueries(field); List<String> inodesToFlush = new ArrayList<>(); try(Connection conn = DbConnectionFactory.getConnection();PreparedStatement ps = conn.prepareStatement(queries.getSelect())) { ps.setObject(1, structureInode); final int BATCH_SIZE = 200; try(ResultSet rs = ps.executeQuery();PreparedStatement ps2 = conn.prepareStatement(queries.getUpdate())) { for (int i = 1; rs.next(); i++) { String contentInode = rs.getString("inode"); inodesToFlush.add(contentInode); ps2.setString(1, contentInode); ps2.addBatch(); if (i % BATCH_SIZE == 0) { ps2.executeBatch(); } } ps2.executeBatch(); } } catch (SQLException e) { throw new DotDataException(String.format("Error clearing field '%s' for Content Type with ID: %s", field.getVelocityVarName(), structureInode), e); } for (String inodeToFlush : inodesToFlush) { cc.remove(inodeToFlush); } }

Target:
protected void clearField(String structureInode, Field field) throws DotDataException { if(field.getFieldContentlet() == null || ! (field.getFieldContentlet().matches("^.*\\d+$"))){ return; } Queries queries = getQueries(field); List<String> inodesToFlush = new ArrayList<>(); Connection conn = DbConnectionFactory.getConnection(); try(PreparedStatement ps = conn.prepareStatement(queries.getSelect())) { ps.setObject(1, structureInode); final int BATCH_SIZE = 200; try(ResultSet rs = ps.executeQuery();) { PreparedStatement ps2 = conn.prepareStatement(queries.getUpdate()); for (int i = 1; rs.next(); i++) { String contentInode = rs.getString("inode"); inodesToFlush.add(contentInode); ps2.setString(1, contentInode); ps2.addBatch(); if (i % BATCH_SIZE == 0) { ps2.executeBatch(); } } ps2.executeBatch(); } } catch (SQLException e) { throw new DotDataException(String.format("Error clearing field '%s' for Content Type with ID: %s", field.getVelocityVarName(), structureInode), e); } for (String inodeToFlush : inodesToFlush) { cc.remove(inodeToFlush); } }
Source:
public CPPStreamConnectionProvider() { List<String> commands = new ArrayList<>(); if(store.getString(PreferenceConstants.P_SERVER_CHOICE).equals("cquery")) { languageServer = new CqueryLanguageServer(); } else if(store.getString(PreferenceConstants.P_SERVER_CHOICE).equals("clangd")) { languageServer = new ClangdLanguageServer(); } File defaultLSLocation = getDefaultLSLocation(store.getString(PreferenceConstants.P_SERVER_CHOICE)); if(defaultLSLocation != null) { store.setDefault(PreferenceConstants.P_SERVER_PATH, defaultLSLocation.getAbsolutePath()); } File languageServerLocation = getLanguageServerLocation(); String parent = ""; String flags = store.getString(PreferenceConstants.P_SERVER_OPTIONS); if (languageServerLocation != null) { commands.add(languageServerLocation.getAbsolutePath()); if (!flags.isEmpty()) { commands.add(flags); } parent = languageServerLocation.getParent(); } setWorkingDirectory(parent); setCommands(commands); }

Target:
public CPPStreamConnectionProvider() throws UnsupportedOperationException { List<String> commands = new ArrayList<>(); if (store.getString(PreferenceConstants.P_SERVER_CHOICE).equals("cquery")) { languageServer = new CqueryLanguageServer(); } else if (store.getString(PreferenceConstants.P_SERVER_CHOICE).equals("clangd")) { languageServer = new ClangdLanguageServer(); } else { throw new UnsupportedOperationException("Unsupported Language Server"); } File defaultLSLocation = getDefaultLSLocation(store.getString(PreferenceConstants.P_SERVER_CHOICE)); if(defaultLSLocation != null) { store.setDefault(PreferenceConstants.P_SERVER_PATH, defaultLSLocation.getAbsolutePath()); } File languageServerLocation = getLanguageServerLocation(); String parent = ""; String flags = store.getString(PreferenceConstants.P_SERVER_OPTIONS); if (languageServerLocation != null) { commands.add(languageServerLocation.getAbsolutePath()); if (!flags.isEmpty()) { commands.add(flags); } parent = languageServerLocation.getParent(); } setWorkingDirectory(parent); setCommands(commands); }
Source:
public void testCommentsAndWhitespacePersists() throws Exception { InputStream inputStream = FrameworkUtil.getBundle(this.getClass()) .getEntry("testing-files/target-files/PersistTestCaseTarget.txt").openStream(); ITargetPlatformService service = PDECore.getDefault().acquireService(ITargetPlatformService.class); ITargetDefinition targetDefinition = service.newTarget(); TargetDefinitionPersistenceHelper.initFromXML(targetDefinition, inputStream); ByteArrayOutputStream actualOutput = new ByteArrayOutputStream(); TargetDefinitionPersistenceHelper.persistXML(targetDefinition, actualOutput); try (Scanner s = new Scanner(FrameworkUtil.getBundle(this.getClass()) .getEntry("testing-files/target-files/PersistTestCaseTarget.txt").openStream()).useDelimiter("\\A")) { String result = s.hasNext() ? s.next() : ""; assertEquals(result, actualOutput.toString(StandardCharsets.UTF_8.toString())); } catch (Exception e) { } }

Target:
public void testCommentsAndWhitespacePersists() throws Exception { InputStream inputStream = FrameworkUtil.getBundle(this.getClass()) .getEntry("testing-files/target-files/PersistTestCaseTarget.txt").openStream(); ITargetPlatformService service = PDECore.getDefault().acquireService(ITargetPlatformService.class); ITargetDefinition targetDefinition = service.newTarget(); TargetDefinitionPersistenceHelper.initFromXML(targetDefinition, inputStream); ByteArrayOutputStream actualOutput = new ByteArrayOutputStream(); TargetDefinitionPersistenceHelper.persistXML(targetDefinition, actualOutput); try (Scanner s = new Scanner(FrameworkUtil.getBundle(this.getClass()) .getEntry("testing-files/target-files/PersistTestCaseTarget.txt").openStream()).useDelimiter("\\A")) { String result = s.hasNext() ? s.next() : ""; assertEquals(result, actualOutput.toString(StandardCharsets.UTF_8.toString())); } catch (IOException e) { } }
Source:
public DescribeCommand always(boolean always) { this.alwaysFlag = always; mojo.getLog().info("--always = " + always); return this; }

Target:
public DescribeCommand always(boolean always) { this.alwaysFlag = always; log.info("--always = {}", always); return this; }