auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<NamespaceWithPrefix> getNamespacesAsJSONlist( @ApiParam(value = "if set all namespaces are returned otherwise the list will be filtered by disallowed namespaces", required = false) @QueryParam("all") String allNamespaces) { Collection<Namespace> namespaces = this.getNamespaces(); List<NamespaceWithPrefix> namespacesList = new ArrayList<>(); for (Namespace ns : namespaces) { <START> if (allNamespaces != null) { <END> namespacesList.add(new NamespaceWithPrefix(ns, this.namespaceManager.getPrefix(ns.getDecoded()))); } else { if (!Namespaces.getDisallowedNamespaces().contains(ns.getDecoded())) { namespacesList.add(new NamespaceWithPrefix(ns, this.namespaceManager.getPrefix(ns.getDecoded()))); } } } Collections.sort(namespacesList); return namespacesList; }</code><technical_language>Please exchange if bodies: allNamespaces == null condition</technical_language>

Target:
public List<NamespaceWithPrefix> getNamespacesAsJSONlist( @ApiParam(value = "if set all namespaces are returned otherwise the list will be filtered by disallowed namespaces", required = false) @QueryParam("all") String allNamespaces) { Collection<Namespace> namespaces = this.getNamespaces(); List<NamespaceWithPrefix> namespacesList = new ArrayList<>(); for (Namespace ns : namespaces) { if (allNamespaces == null) { if (!Namespaces.getDisallowedNamespaces().contains(ns.getDecoded())) { namespacesList.add(new NamespaceWithPrefix(ns, this.namespaceManager.getPrefix(ns.getDecoded()))); } } else { namespacesList.add(new NamespaceWithPrefix(ns, this.namespaceManager.getPrefix(ns.getDecoded()))); } } Collections.sort(namespacesList); return namespacesList; }
Source:
<code>} catch (Exception e) { <START> } <END></code><technical_language>redundant, if catch exception error message printed..</technical_language>

Target:
} catch (Exception e) { System.err.print("exception adding property to JsonObject = " + e.getMessage()); }
Source:
<code>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(); <START> KieSession ksession = kbase.newKieSession(); <END> 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)); }</code><technical_language>Please dispose KieSession in a try-finally block in test class</technical_language>

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:
<code>public FileStoredIdentityManager() { <START> userFile = new File("users.properties"); <END> log.infof("Using <%1$s> as user repository", userFile.getAbsolutePath()); }</code><technical_language>location of users.properties configurable</technical_language>

Target:
public FileStoredIdentityManager() { userFile = new File(IDENTITY_FILE); log.infof("Using <%1$s> as user repository", userFile.getAbsolutePath()); }
Source:
<code>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()); }</code><technical_language>testing for symbols in tenant IDs, in case need URL encode if potentially present in tenant ID</technical_language>

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:
<code>public void testTokenRangeWritesLogger() { CassandraKeyValueServiceImpl kvs = (CassandraKeyValueServiceImpl) keyValueService; kvs.tokenRangeWritesLogger = new TokenRangeWritesLogger(ImmutableSet.of( Range.lessThan(getToken("bcd")), Range.openClosed(getToken("bcd"), getToken("ghi")), <START> Range.openClosed(getToken("ghi"), getToken("opq")), <END> 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); }</code><technical_language>Is a gap in Range here? matter for testing</technical_language>

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:
<code>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(); <START> Serializable value = chosenChannel.get(currentKey); <END> 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)); } }</code><technical_language>entry.getValue()? return chosenChannel.get(currentKey)? If yes, I is clearer. remark applies next method</technical_language>

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:
<code>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()); } <START> templateZoneDao.deleteByZoneId(zoneId); <END> 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; } }); }</code><technical_language>@shwstppr absolutely success. I zone is usable if deletion of zoneVO, is right do automatic clean-up of items (templates) in a container (zone) if container is disposed of</technical_language>

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:
<code>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( <START> new FkBout(".*", new TkIndex(base)).route( <END> 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!']" ) ); }</code><technical_language>@erimerturk extract this shares string a private static final variable pertains multiple test methods</technical_language>

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:
<code>private Promise<TemplateStore> loadTemplateStore() { Deferred<TemplateStore> deferred = new Deferred<>(); Promise<TemplateStore> promise = deferred.getPromise(); <START> promise.thenAccept((ts)->{}); <END> 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()); }); }</code><technical_language>is this needed</technical_language>

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:
<code>public static void main(String[] args) { <START> new BisqCliMain("localhost", 8888, args); <END> }</code><technical_language>suggestion new BisqCliMain("localhost", 9998, args); 8888 is a poor number frequently other services. 9998 fits bisq's p2p port of 9999 suit bitcoind's 8333 p2p port 8332 rpc port. I realize introduce this change out of scope for this PR, please anyway. @freimair, please note choice of 9998 overlaps port in monitor/src/main/java/bisq/monitor/metric/TorHiddenServiceStartupTime.java. Please consider changing else if a conflict</technical_language>

Target:
public static void main(String[] args) { new BisqCliMain("localhost", 9998, args); }
Source:
<code>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); <START> return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e).build(); <END> } return Response.ok().build(); }</code><technical_language>I concerned exceptions serialize JSON nicely, 100%</technical_language>

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:
<code>public void set(@NonNull FeaturedArticleCard card) { String articleTitle = card.articleTitle(); String articleSubtitle = card.articleSubtitle(); String extract = card.extract(); <START> Uri imageUri = card.image() != null ? card.image() : null; <END> articleTitle(articleTitle); if (articleSubtitle != null) { articleSubtitle(articleSubtitle); } if (extract != null) { extract(extract); } if (imageUri != null) { image(imageUri); } header(card); footer(); }</code><technical_language>I this card.image() now</technical_language>

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:
<code>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, <START> frcSearchResultBundle.sessions.get(responseEntry.feedbackSessionName).getTimeZone()); <END> rows.add(frcDiv); } return rows; }</code><technical_language>Extract this line a variable for readability</technical_language>

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:
<code>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()); <START> String secText = seconds + " seconds ago"; <END> 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); } }</code><technical_language>This translatable</technical_language>

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:
<code>private RepositorySystemSession newSession( RepositorySystem system ) <START> { <END> DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession(); LocalRepository localRepo = new LocalRepository( ArtifactRepositoryService.GLOBAL_M2_REPO_NAME ); session.setLocalRepositoryManager( system.newLocalRepositoryManager( session, localRepo ) ); return session; }</code><technical_language>wrong code format</technical_language>

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:
<code>public <R> Streamlet<R> newSource(SerializableSupplier<R> supplier) { <START> Preconditions.checkNotNull(supplier, "supplier must not be null."); <END> StreamletImpl<R> retval = StreamletImpl.createSupplierStreamlet(supplier); retval.setNumPartitions(1); sources.add(retval); return retval; }</code><technical_language>Preconditions? require() is enough? hoping get rid of guava library is big. :(</technical_language>

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:
<code>public Builder(ZNRecord record) { <START> _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()); <END> }</code><technical_language>a record internal member</technical_language>

Target:
public Builder(ZNRecord record) { _record = record; }
Source:
<code>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"); <START> if (storage_pool != null && Version.v3_1.compareTo(storage_pool.getcompatibility_version()) <= 0) { <END> 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; }</code><technical_language>Please a config (i.e - AdvancedNFSOptionsEnabled ) boolean is set false in 2.2 3.0 true in 3.1</technical_language>

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:
<code>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; }</code><technical_language>I weak ciphers exclude</technical_language>

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:
<code>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(); } } <START> catch (IgniteIllegalStateException iise) { <END> 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 ); } }</code><technical_language>is this exception thrown</technical_language>

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:
<code>private void drainUntilTimestamp(final Queue<MistEvent> queue, final long timestamp) { <START> while (!queue.isEmpty() && queue.peek().getTimestamp() <= timestamp) { <END> final MistEvent input = queue.poll(); outputEmitter.emit(input); } }</code><technical_language>queue.peek().getTimestamp() -> peekTimeStamp(queue)</technical_language>

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:
<code><START> protected Optional<CommandResult<CanvasViolation>> doDragEnd(final Element element) { <END> 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)); }</code><technical_language>Heh, picky here.. this occasion is of Optional required? Execution of a command **always** result in a non-null result</technical_language>

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:
<code>public Receiver() { super(ADMMessageHandler.class); boolean ADMLatestAvailable = false; <START> try{ <END> Class.forName( "com.amazon.device.messaging.ADMMessageHandlerJobBase" ); ADMLatestAvailable = true ; } catch (ClassNotFoundException e) { } if (ADMLatestAvailable) { registerJobServiceClass(ADMMessageHandlerJob.class, 123891); } }</code><technical_language>reformat code</technical_language>

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:
<code>private void printGitProperties() { if (gitPropertiesPrinted) { return; } gitPropertiesPrinted = true; <START> try (InputStream in = getClass().getResourceAsStream("/git.properties")) { <END> 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()); } }</code><technical_language>clear this is related this PR</technical_language>

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:
<code>final void setExtendedExpiresOn(final Date extendedExpiresOn) { <START> this.mExtendedExpiresOn = extendedExpiresOn; <END> }</code><technical_language>this [](start = 8, length = 4) do this. sense local variable class variable name</technical_language>

Target:
final void setExtendedExpiresOn(final Date extendedExpiresOn) { mExtendedExpiresOn = extendedExpiresOn; }
Source:
<code>public GitHubSCMSource(String repoOwner, String repository, String repositoryUrl, boolean configuredByUrl) { if (!configuredByUrl) { this.apiUri = GITHUB_URL; this.repoOwner = repoOwner; <START> this.repository = removeEnd(repository, ".git");; <END> 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<>(); }</code><technical_language>repository a dropdown, this possible: suggestion this.repository = repository;</technical_language>

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:
<code>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()); } <START> throw new IllegalArgumentException("Unable to parse date time " + dateTime); <END> }</code><technical_language>reason logger here</technical_language>

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:
<code>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() <START> .equals(StatefulUserDefinedAggregator.class.getName())) { <END> 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()); }</code><technical_language>instanceof</technical_language>

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:
<code>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)); } <START> } catch (RuntimeException | AssertionError e) { <END> reducedValues.addAll(constExps); values = new Object[constExps.size()]; } Hook.EXPRESSION_REDUCER.run(Pair.of(code, values)); }</code><technical_language>I catch AssertionError. avoid this</technical_language>

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:
<code>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)); <START> notifyEvent(session, CommentEvents.COMMENT_ADDED, comment); <END> return comment; } }</code><technical_language>handleNotificationAutoSubscriptions notifyEvent Get retrieve need notify event</technical_language>

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:
<code>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()) { <START> case NAMESPACE_NOTFOUND: <END> case NOTFOUND: throw new TableNotFoundException(e); default: throw new AccumuloException(e); } } return result; }</code><technical_language>this case throw NamespaceNotFoundException instead? least, TNFE caused NNFE</technical_language>

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)); }