auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>@Override public MultiEnvironment bind(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { SSHUserPrivateKey sshKey = getCredentials(build); <START> FilePath keyFile = tempDir(workspace).child("ssh-key-" + keyFileVariable); <END> StringWriter stringWriter = new StringWriter(); PrintWriter keysFileStream = new PrintWriter(stringWriter); for (String key : sshKey.getPrivateKeys()) { keysFileStream.println(key); } keysFileStream.close(); keyFile.write(stringWriter.toString(), "UTF-8"); keyFile.chmod(0400); Map<String, String> map = new HashMap<String, String>(); map.put(keyFileVariable, keyFile.getRemote()); Secret passphrase = sshKey.getPassphrase(); if (passphrase != null) { map.put(passphraseVariable, passphrase.getPlainText()); } else { map.put(passphraseVariable, ""); } map.put(usernameVariable, sshKey.getUsername()); return new MultiEnvironment(map, new KeyRemover(keyFile.getRemote())); }</code><technical_language>new API in #25 ready</technical_language>

Target:
@Override public MultiEnvironment bind(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { SSHUserPrivateKey sshKey = getCredentials(build); UnbindableDir keyDir = UnbindableDir.create(workspace); FilePath keyFile = keyDir.getDirPath().child("ssh-key-" + keyFileVariable); StringBuilder contents = new StringBuilder(); for (String key : sshKey.getPrivateKeys()) { contents.append(key); contents.append('\n'); } keyFile.write(contents.toString(), "UTF-8"); keyFile.chmod(0400); Map<String, String> map = new HashMap<String, String>(); map.put(keyFileVariable, keyFile.getRemote()); if (passphraseVariable != null) { Secret passphrase = sshKey.getPassphrase(); if (passphrase != null) { map.put(passphraseVariable, passphrase.getPlainText()); } else { map.put(passphraseVariable, ""); } } if (usernameVariable != null) { map.put(usernameVariable, sshKey.getUsername()); } return new MultiEnvironment(map, keyDir.getUnbinder()); }
Source:
<code>public void writeTo(StreamOutput out) throws IOException { out.writeString(baseTypeName); out.writeVInt(parameters.size()); for (TypeSignature parameter : parameters) { <START> out.writeVInt(parameter.type().ordinal()); <END> parameter.writeTo(out); } }</code><technical_language>For Symbol DataType static methods handle ordinal handling. public static void toStream(DataType type, StreamOutput out) throws IOException { out.writeVInt(type.id()); type.writeTo(out); } Do sense follow pattern too</technical_language>

Target:
public void writeTo(StreamOutput out) throws IOException { out.writeString(baseTypeName); out.writeVInt(parameters.size()); for (TypeSignature parameter : parameters) { toStream(parameter, out); } }
Source:
<code>public ProcessDefinition processDefinition(String processDefinitionId) { org.activiti.engine.repository.ProcessDefinition processDefinition = null; try { processDefinition = repositoryService.getProcessDefinition(processDefinitionId); } catch (Exception internalEx) { } if (processDefinition == null) { <START> List<org.activiti.engine.repository.ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().processDefinitionKey(processDefinitionId).list(); <END> if (!list.isEmpty()) { processDefinition = list.get(0); } else { throw new NotFoundException("Unable to find process definition for the given key:'" + processDefinitionId + "'"); } } return processDefinitionConverter.from(processDefinition); }</code><technical_language>@erdemedeiros do mean? order</technical_language>

Target:
public ProcessDefinition processDefinition(String processDefinitionId) { org.activiti.engine.repository.ProcessDefinition processDefinition; List<org.activiti.engine.repository.ProcessDefinition> list = repositoryService .createProcessDefinitionQuery() .processDefinitionKey(processDefinitionId) .orderByProcessDefinitionVersion() .asc() .list(); if (!list.isEmpty()) { processDefinition = list.get(0); } else { processDefinition = repositoryService.getProcessDefinition(processDefinitionId); } return processDefinitionConverter.from(processDefinition); }
Source:
<code>protected String nameFor(Unit<?> unit) { String label = this.unitToName.get(unit); if (label != null) { return label; } else if (unit instanceof BaseUnit) { return unit.getSymbol(); } else if (unit instanceof AlternateUnit) { return unit.getSymbol(); } else if (!(unit instanceof TransformedUnit)) { return null; } else { TransformedUnit<?> tfmUnit = (TransformedUnit) unit; Unit<?> baseUnit = tfmUnit.getParentUnit(); UnitConverter cvtr = tfmUnit.getConverter(); StringBuilder result = new StringBuilder(); String baseUnitName = format(baseUnit); String prefix = this.prefixFor(cvtr); if (baseUnitName.indexOf(183) < 0 && baseUnitName.indexOf(42) < 0 && baseUnitName.indexOf(47) < 0) { <START> result.append(baseUnitName); <END> } else { result.append('('); result.append(baseUnitName); result.append(')'); } if (prefix != null) { result.insert(0, prefix); } else if (cvtr instanceof AddConverter) { result.append('+'); result.append(((AddConverter) cvtr).getOffset()); } else if (cvtr instanceof RationalConverter) { double dividend = ((RationalConverter) cvtr).getDividend().doubleValue(); if (dividend != 1.0D) { result.append('*'); result.append(dividend); } double divisor = ((RationalConverter) cvtr).getDivisor().doubleValue(); if (divisor != 1.0D) { result.append('/'); result.append(divisor); } } else { if (!(cvtr instanceof MultiplyConverter)) { return "[" + baseUnit + "?]"; } result.append('*'); result.append(((MultiplyConverter) cvtr).getFactor()); } return result.toString(); } }</code><technical_language>Curiosity of mine... required approve PR :) ... numbers</technical_language>

Target:
protected String nameFor(Unit<?> unit) { String label = unitToName.get(unit); if (label != null) return label; if (unit instanceof BaseUnit) return ((BaseUnit<?>) unit).getSymbol(); if (unit instanceof AlternateUnit) return ((AlternateUnit<?>) unit).getSymbol(); if (unit instanceof TransformedUnit) { TransformedUnit<?> tfmUnit = (TransformedUnit<?>) unit; Unit<?> baseUnit = tfmUnit.getParentUnit(); UnitConverter cvtr = tfmUnit.getConverter(); StringBuilder result = new StringBuilder(); String baseUnitName = format(baseUnit); String prefix = prefixFor(cvtr); if ((baseUnitName.indexOf('\u00b7') >= 0) || (baseUnitName.indexOf('*') >= 0) || (baseUnitName.indexOf('/') >= 0)) { result.append('('); result.append(baseUnitName); result.append(')'); } else { result.append(baseUnitName); } if (prefix != null) { result.insert(0, prefix); } else { if (cvtr instanceof AddConverter) { result.append('+'); result.append(((AddConverter) cvtr).getOffset()); } else if (cvtr instanceof RationalConverter) { double dividend = ((RationalConverter) cvtr).getDividend().doubleValue(); if (dividend != 1) { result.append('*'); result.append(dividend); } double divisor = ((RationalConverter) cvtr).getDivisor().doubleValue(); if (divisor != 1) { result.append('/'); result.append(divisor); } } else if (cvtr instanceof MultiplyConverter) { result.append('*'); result.append(((MultiplyConverter) cvtr).getFactor()); } else { return "[" + baseUnit + "?]"; } } return result.toString(); } return null; }
Source:
<code>public WorkunitInfo compileWUFromECL(WorkunitInfo wu ) throws Exception { Integer sleeptime=wu.getSleepMillis(); if (sleeptime == null) { sleeptime = defaultWaitTime; } WorkunitInfo createdWU = createWUFromECL(wu); if (createdWU != null && createdWU.getErrorCount() == 0 && createdWU.getExceptions() == null) { createdWU.setCluster(wu.getCluster()); submitWU(createdWU); this.monitorWUToCompletion(createdWU); <START> WUInfo parameters=new WUInfo(); <END> parameters.setWuid(createdWU.getWuid()); parameters.setIncludeExceptions(true); WUInfoResponse res=wsWorkunitsServiceSoapProxy.WUInfo(parameters); if (createdWU.getExceptions() == null && res.getWorkunit() != null && res.getWorkunit().getExceptions() != null) { this.throwWsWUExceptions(res.getWorkunit().getExceptions(),"Workunit Compile Failed"); } } return createdWU; }</code><technical_language>I wish build this monitorWUToCompletion method is calling WUInfo</technical_language>

Target:
public WorkunitInfo compileWUFromECL(WorkunitInfo wu ) throws Exception { Integer sleeptime=wu.getSleepMillis(); if (sleeptime == null) { sleeptime = defaultWaitTime; } WorkunitInfo createdWU = createWUFromECL(wu); if (createdWU != null && createdWU.getErrorCount() == 0 && createdWU.getExceptions() == null) { createdWU.setCluster(wu.getCluster()); submitWU(createdWU); this.monitorWUToCompletion(createdWU); WUInfoResponse res=this.getWUInfo(createdWU.getWuid(), false, false, false, false, false, true, false, false, false); if (createdWU.getExceptions() == null && res.getWorkunit() != null && res.getWorkunit().getExceptions() != null) { this.throwWUECLExceptions(res.getWorkunit().getExceptions(),"Workunit Compile Failed"); } } return createdWU; }
Source:
<code>private void printSuccessMessage(String domainName, String action) { if (addPermissions) { System.out.println(String.format(SUCCESSFULLY_COMPLETED_ACTION_ON_DOMAIN, "added", domainName)); } else { System.out.println(SERVICE_RESTART_MESSAGE); <START> } <END> }</code><technical_language>addPermissions means added a permission, restart is needed... missing here</technical_language>

Target:
private void printSuccessMessage(String domainName, String action) { if (addPermissions) { System.out.print(String.format(SUCCESS_MESSAGE_FOR_ACTION_WITH_ADD_PERMISSIONS, "added", domainName)); } System.out.println(SERVICE_RESTART_MESSAGE); }
Source:
<code>public Collection<Session> getSessionsByIp(final InetAddress serverIp) { removeClosedSessions(); return sessions.stream() .filter(s -> InetExtractor.extract(s.getUserProperties()).equals(serverIp)) .filter(Session::isOpen) <START> .collect(Collectors.toSet()); <END> }</code><technical_language>thoughts returning Stream<Session> here? non-test usage performs a for-each this anyways, a problem. a nice bonus, closeSessionsByIp re-use logic</technical_language>

Target:
public Collection<Session> getSessionsByIp(final InetAddress serverIp) { return sessions.stream() .filter(Session::isOpen) .filter(s -> InetExtractor.extract(s.getUserProperties()).equals(serverIp)) .collect(Collectors.toSet()); }
Source:
<code>public static Collection<Object[]> params() { return Arrays.asList(new Object[][]{ <START> {INPUT_FADV_RANDOM, Default_JSSE}, <END> {INPUT_FADV_NORMAL, Default_JSSE}, {INPUT_FADV_SEQUENTIAL, Default_JSSE}, {INPUT_FADV_RANDOM, Default_JSSE_with_GCM}, {INPUT_FADV_NORMAL, Default_JSSE_with_GCM}, {INPUT_FADV_SEQUENTIAL, Default_JSSE_with_GCM}, }); }</code><technical_language>While good this coverage, do a test is 4 min, execution time of a non-scale test a runner pool of 12 < 20 mins -this help. I propose random normal seek policies for GCM tests; remove default jsse. Yes, a simpler matrix default_jsse option implicitly tested everywhere,we losing coverage</technical_language>

Target:
public static Collection<Object[]> params() { return Arrays.asList(new Object[][]{ {INPUT_FADV_SEQUENTIAL, Default_JSSE}, {INPUT_FADV_RANDOM, Default_JSSE_with_GCM}, {INPUT_FADV_NORMAL, Default_JSSE_with_GCM}, }); }
Source:
<code>public void setUp() throws Exception { <START> File file = new File(COPEPlugin.getLocalStorage(), "known-projects"); <END> file.createNewFile(); Files.write(file.toPath(), "known1\nknown2\n".getBytes(), StandardOpenOption.WRITE); snapshotManager = new SnapshotManager(); }</code><technical_language>this more testable (not depend COPEPlugin in test) set SnapshotManager in parent directory. test depend other test. perform test cleanup easier (like deleting test files). this SnapshotManager dependency</technical_language>

Target:
public void setUp() throws Exception { File file = new File(COPEPlugin.getLocalStorage(), "known-projects"); file.createNewFile(); Files.write(file.toPath(), "known1\nknown2\n".getBytes(), StandardOpenOption.WRITE); snapshotManager = new SnapshotManager(COPEPlugin.getLocalStorage().getAbsolutePath()); }
Source:
<code>private void loadRemoteEntries() { <START> if (swipeRefresh != null && !swipeRefresh.isRefreshing()) { <END> swipeRefresh.setRefreshing(true); } state.setLoadRemoteEntries(new LoadRemoteEntries(this)); Utils.execute(state.loadRemoteEntries); }</code><technical_language>tabs</technical_language>

Target:
private void loadRemoteEntries() { state.setLoadRemoteEntries(new LoadRemoteEntries(this)); Utils.execute(state.loadRemoteEntries); }
Source:
<code>public UserMetricsTask( final MeterRegistry registry, final JobSearchService jobSearchService, final UserMetricsProperties userMetricsProperties ) { this.registry = registry; this.jobSearchService = jobSearchService; this.userMetricsProperties = userMetricsProperties; this.activeUsersCount = new AtomicLong(0); <START> this.activeUsersCountGauge = Gauge.builder(USER_ACTIVE_USERS_METRIC_NAME, activeUsersCount::get) <END> .register(registry); }</code><technical_language>Pretty do this in line: this.activeUsersCount = this.registry.gauge(USER_ACTIVE_USERS_METRIC_NAME, new AtomicLong(0)); [micrometer docs](<LINK_0></technical_language>

Target:
public UserMetricsTask( final MeterRegistry registry, final JobSearchService jobSearchService, final UserMetricsProperties userMetricsProperties ) { this.registry = registry; this.jobSearchService = jobSearchService; this.userMetricsProperties = userMetricsProperties; this.activeUsersCount = new AtomicLong(0); Gauge.builder(USER_ACTIVE_USERS_METRIC_NAME, () -> this.getUsersCount()) .register(registry); }
Source:
<code>public DimFilter toDruidFilter( final PlannerContext plannerContext, final RowSignature rowSignature, final RexNode rexNode ) { final List<RexNode> operands = ((RexCall) rexNode).getOperands(); final DruidExpression druidExpression = Expressions.toDruidExpression( plannerContext, rowSignature, operands.get(0) ); <START> if (druidExpression == null || !druidExpression.isSimpleExtraction()) { <END> return null; } String base64EncodedBloomKFilter = RexLiteral.stringValue(operands.get(1)); byte[] bytes = StringUtils.toUtf8(base64EncodedBloomKFilter); byte[] decoded = Base64.decodeBase64(bytes); try { BloomKFilter filter = BloomFilterSerializersModule.bloomKFilterFromBytes(decoded); return new BloomDimFilter( druidExpression.getSimpleExtraction().getColumn(), BloomKFilterHolder.fromBloomKFilter(filter), druidExpression.getSimpleExtraction().getExtractionFn() ); } catch (IOException ioe) { return null; } }</code><technical_language>nice support expressions. Is a mechanism in Druid SQL easy do create a virtual expression column, run expression top of column? (Similar do a dimension expression.) If not, nice create that. if create that, update docs argument a direct column reference</technical_language>

Target:
public DimFilter toDruidFilter( final PlannerContext plannerContext, final RowSignature rowSignature, final RexNode rexNode ) { final List<RexNode> operands = ((RexCall) rexNode).getOperands(); final DruidExpression druidExpression = Expressions.toDruidExpression( plannerContext, rowSignature, operands.get(0) ); if (druidExpression == null || !druidExpression.isSimpleExtraction()) { return null; } String base64EncodedBloomKFilter = RexLiteral.stringValue(operands.get(1)); final byte[] decoded = BaseEncoding.base64().decode(base64EncodedBloomKFilter); BloomKFilter filter; BloomKFilterHolder holder; try { filter = BloomFilterSerializersModule.bloomKFilterFromBytes(decoded); holder = BloomKFilterHolder.fromBloomKFilter(filter); } catch (IOException ioe) { throw new RuntimeException("Failed to deserialize bloom filter", ioe); } if (druidExpression.isSimpleExtraction()) { return new BloomDimFilter( druidExpression.getSimpleExtraction().getColumn(), holder, druidExpression.getSimpleExtraction().getExtractionFn() ); } else { return null; } }
Source:
<code><START> private boolean shouldFetchFromSchemaRegistry(String id) { <END> if (!failedFetchHistories.containsKey(id)) { return true; } FailedFetchHistory failedFetchHistory = failedFetchHistories.get(id); boolean maxRetriesNotExceeded = failedFetchHistory.numOfAttempts < getByIdMaxRetries; boolean minRetryIntervalSatisfied = System.nanoTime() - failedFetchHistory.previousAttemptTime >= TimeUnit.SECONDS .toNanos(getByIdMinIntervalSeconds); return maxRetriesNotExceeded && minRetryIntervalSatisfied; }</code><technical_language>Do want synchronize this method</technical_language>

Target:
private synchronized boolean shouldFetchFromSchemaRegistry(String id) { if (!failedFetchHistories.containsKey(id)) { return true; } FailedFetchHistory failedFetchHistory = failedFetchHistories.get(id); boolean maxRetriesNotExceeded = failedFetchHistory.numOfAttempts < getByIdMaxRetries; boolean minRetryIntervalSatisfied = System.nanoTime() - failedFetchHistory.previousAttemptTime >= TimeUnit.SECONDS .toNanos(getByIdMinIntervalSeconds); return maxRetriesNotExceeded && minRetryIntervalSatisfied; }
Source:
<code>public void configure(Binder binder) { Binders.dataSegmentPullerBinder(binder).addBinding("hdfs").to(HdfsDataSegmentPuller.class).in(LazySingleton.class); Binders.dataSegmentPusherBinder(binder).addBinding("hdfs").to(HdfsDataSegmentPusher.class).in(LazySingleton.class); Binders.dataSegmentKillerBinder(binder).addBinding("hdfs").to(HdfsDataSegmentKiller.class).in(LazySingleton.class); final Configuration conf = new Configuration(); <START> conf.set("fs.hdfs.impl", DistributedFileSystem.class.getName()); <END> if (props != null) { for (String propName : System.getProperties().stringPropertyNames()) { if (propName.startsWith("hadoop.")) { conf.set(propName.substring("hadoop.".length()), System.getProperty(propName)); } } } binder.bind(Configuration.class).toInstance(conf); JsonConfigProvider.bind(binder, "druid.storage", HdfsDataSegmentPusherConfig.class); Binders.taskLogsBinder(binder).addBinding("hdfs").to(HdfsTaskLogs.class); JsonConfigProvider.bind(binder, "druid.indexer.logs", HdfsTaskLogsConfig.class); binder.bind(HdfsTaskLogs.class).in(LazySingleton.class); }</code><technical_language>docs for hadoop I find in 2.x configs: <LINK_1> (or similar) a setting in 1.x is valid in 2.x? Also, is reason <LINK_0> impl</technical_language>

Target:
public void configure(Binder binder) { Binders.dataSegmentPullerBinder(binder).addBinding("hdfs").to(HdfsDataSegmentPuller.class).in(LazySingleton.class); Binders.dataSegmentPusherBinder(binder).addBinding("hdfs").to(HdfsDataSegmentPusher.class).in(LazySingleton.class); Binders.dataSegmentKillerBinder(binder).addBinding("hdfs").to(HdfsDataSegmentKiller.class).in(LazySingleton.class); final Configuration conf = new Configuration(); conf.set("fs.hdfs.impl", DistributedFileSystem.class.getName()); conf.set("fs.file.impl", LocalFileSystem.class.getName()); if (props != null) { for (String propName : System.getProperties().stringPropertyNames()) { if (propName.startsWith("hadoop.")) { conf.set(propName.substring("hadoop.".length()), System.getProperty(propName)); } } } binder.bind(Configuration.class).toInstance(conf); JsonConfigProvider.bind(binder, "druid.storage", HdfsDataSegmentPusherConfig.class); Binders.taskLogsBinder(binder).addBinding("hdfs").to(HdfsTaskLogs.class); JsonConfigProvider.bind(binder, "druid.indexer.logs", HdfsTaskLogsConfig.class); binder.bind(HdfsTaskLogs.class).in(LazySingleton.class); }
Source:
<code>public static void recvMsg(ZMQ.Socket socket, int flags, Consumer<ZMsg> handler) { ZMsg msg = null; try { msg = ZMsg.recvMsg(socket, flags); } catch (ZMQException ignore) { <START> } <END> handler.accept(msg); }</code><technical_language>I if exception handler is provided, exceptions happen calling code handle them</technical_language>

Target:
public static void recvMsg(ZMQ.Socket socket, int flags, Consumer<ZMsg> handler) { handler.accept(ZMsg.recvMsg(socket, flags)); }
Source:
<code>public ClientDiscoveryService build() { ArrayList<CandidateClusterContext> contexts = new ArrayList<CandidateClusterContext>(); for (ClientConfig config : configs) { ClientNetworkConfig networkConfig = config.getNetworkConfig(); SocketInterceptor interceptor = initSocketInterceptor(networkConfig.getSocketInterceptorConfig()); ICredentialsFactory credentialsFactory = initCredentialsFactory(config); if (credentialsFactory == null) { credentialsFactory = new StaticCredentialsFactory(new UsernamePasswordCredentials(config.getClientName(), "")); } <START> credentialsFactory.configure(cs -> { }); DiscoveryService discoveryService = initDiscoveryService(config); AddressProvider provider; if (externalAddressProvider != null) { <END> provider = externalAddressProvider; } else { provider = createAddressProvider(config, discoveryService); } final SSLConfig sslConfig = networkConfig.getSSLConfig(); final SocketOptions socketOptions = networkConfig.getSocketOptions(); contexts.add(new CandidateClusterContext(config.getClientName(), provider, discoveryService, credentialsFactory, interceptor, qualifier -> clientExtension.createChannelInitializer(sslConfig, socketOptions))); } return new ClientDiscoveryService(configsTryCount, contexts); }</code><technical_language>Is this necessary? Is idea reset default behavior configure called (because impl depend that)</technical_language>

Target:
public ClientDiscoveryService build() { ArrayList<CandidateClusterContext> contexts = new ArrayList<CandidateClusterContext>(); for (ClientConfig config : configs) { ClientNetworkConfig networkConfig = config.getNetworkConfig(); SocketInterceptor interceptor = initSocketInterceptor(networkConfig.getSocketInterceptorConfig()); ICredentialsFactory credentialsFactory = initCredentialsFactory(config); if (credentialsFactory == null) { credentialsFactory = new StaticCredentialsFactory(new UsernamePasswordCredentials(config.getClientName(), "")); } credentialsFactory.configure(cs -> { throw new UnsupportedCallbackException(cs[0]); }); DiscoveryService discoveryService = initDiscoveryService(config); AddressProvider provider; if (externalAddressProvider != null) { provider = externalAddressProvider; } else { provider = createAddressProvider(config, discoveryService); } final SSLConfig sslConfig = networkConfig.getSSLConfig(); final SocketOptions socketOptions = networkConfig.getSocketOptions(); contexts.add(new CandidateClusterContext(config.getClientName(), provider, discoveryService, credentialsFactory, interceptor, qualifier -> clientExtension.createChannelInitializer(sslConfig, socketOptions))); } return new ClientDiscoveryService(configsTryCount, contexts); }
Source:
<code>private void insertTextIntoPage(String text) { if (this.selectionStart != this.selectionEnd) { this.removeSelectedText(); } String s = this.text; this.selectionEnd = MathHelper.clamp(this.selectionEnd, 0, s.length()); String s1 = (new StringBuilder(s)).insert(this.selectionEnd, text).toString(); <START> int i = this.font.getWordWrappedHeight(s1 + "" + TextFormatting.BLACK + "_", 114); <END> if (i <= 128 && s1.length() < 1024) { this.setText(s1); this.selectionStart = this.selectionEnd = Math.min(this.text.length(), this.selectionEnd + text.length()); } }</code><technical_language>Again, variable names</technical_language>

Target:
private void insertTextIntoPage(String text) { if (this.selectionStart != this.selectionEnd) this.removeSelectedText(); String s = this.text; this.selectionEnd = MathHelper.clamp(this.selectionEnd, 0, s.length()); String s1 = (new StringBuilder(s)).insert(this.selectionEnd, text).toString(); int i = this.font.getWordWrappedHeight(s1 + "" + TextFormatting.BLACK + "_", 114); if (i <= 128 && s1.length() < 1024) { this.setText(s1); this.selectionStart = this.selectionEnd = Math.min(this.text.length(), this.selectionEnd + text.length()); } }
Source:
<code>private void extractCollectionId(Element mods, IndexDocumentBean idb) { <START> List<?> identifiers = mods.getChildren("identifier", JDOMNamespaceUtil.MODS_V3_NS); <END> List<String> collectionId = new ArrayList<>(); if (identifiers != null && identifiers.size() > 0) { for (Object id: identifiers) { Element aid = (Element) id; Attribute type = aid.getAttribute("type"); Attribute collection = aid.getAttribute("displayLabel"); if (type == null || collection == null) { continue; } if (collection.getValue().equals("Collection Number") && type.getValue().equals("local")) { collectionId.add(aid.getValue()); } } } if (collectionId.size() > 0) { idb.setCollectionId(collectionId.get(0)); } else { idb.setCollectionId(null); } }</code><technical_language>I a bunch of processing in this class written older version of jdom. days store List<Element> getChildren cast below. for other extract methods in this class though</technical_language>

Target:
private void extractCollectionId(Element mods, IndexDocumentBean idb) { List<?> identifiers = mods.getChildren("identifier", JDOMNamespaceUtil.MODS_V3_NS); String collectionId = null; if (identifiers != null && identifiers.size() > 0) { for (Object id: identifiers) { Element aid = (Element) id; Attribute type = aid.getAttribute("type"); Attribute collection = aid.getAttribute("displayLabel"); if (type == null || collection == null) { continue; } if (collection.getValue().equals("Collection Number") && type.getValue().equals("local")) { collectionId = aid.getValue(); break; } } } idb.setCollectionId(collectionId); }
Source:
<code>public ImmutablePair validateWorkflowSet(Set<SourceFile> sourcefiles, String primaryDescriptorFilePath) { List<SourceFile.FileType> fileTypes = new ArrayList<>(Arrays.asList(SourceFile.FileType.DOCKSTORE_CWL)); Set<SourceFile> filteredSourcefiles = filterSourcefiles(sourcefiles, fileTypes); Optional<SourceFile> mainDescriptor = filteredSourcefiles.stream().filter((sourceFile -> Objects.equals(sourceFile.getPath(), primaryDescriptorFilePath))).findFirst(); <START> Boolean isValid = true; <END> String validationMessage = null; Map<String, String> validationMessageObject = new HashMap<>(); if (mainDescriptor.isPresent()) { Yaml yaml = new Yaml(); String content = mainDescriptor.get().getContent(); if (content == null || content.isEmpty()) { isValid = false; validationMessage = "Primary descriptor is empty."; } else if (!content.contains("class: Workflow")) { isValid = false; validationMessage = "Requires class: Workflow."; } else if (!this.isValidCwl(content, yaml)) { isValid = false; validationMessage = "Invalid CWL version."; } } else { validationMessage = "Primary CWL descriptor is not present."; isValid = false; } validationMessageObject.put(primaryDescriptorFilePath, validationMessage); return new ImmutablePair<>(isValid, validationMessageObject); }</code><technical_language>want a boolean too, important paths</technical_language>

Target:
public VersionTypeValidation validateWorkflowSet(Set<SourceFile> sourcefiles, String primaryDescriptorFilePath) { List<SourceFile.FileType> fileTypes = new ArrayList<>(Arrays.asList(SourceFile.FileType.DOCKSTORE_CWL)); Set<SourceFile> filteredSourcefiles = filterSourcefiles(sourcefiles, fileTypes); Optional<SourceFile> mainDescriptor = filteredSourcefiles.stream().filter((sourceFile -> Objects.equals(sourceFile.getPath(), primaryDescriptorFilePath))).findFirst(); boolean isValid = true; String validationMessage = null; Map<String, String> validationMessageObject = new HashMap<>(); if (mainDescriptor.isPresent()) { Yaml yaml = new Yaml(); String content = mainDescriptor.get().getContent(); if (content == null || content.isEmpty()) { isValid = false; validationMessage = "Primary descriptor is empty."; } else if (!content.contains("class: Workflow")) { isValid = false; validationMessage = "Requires class: Workflow."; } else if (!this.isValidCwl(content, yaml)) { isValid = false; validationMessage = "Invalid CWL version."; } } else { validationMessage = "Primary CWL descriptor is not present."; isValid = false; } validationMessageObject.put(primaryDescriptorFilePath, validationMessage); return new VersionTypeValidation(isValid, validationMessageObject); }
Source:
<code><START> public boolean equals(Object other) { <END> if (other == null || !(other instanceof ShowSchemasStatement)) return false; ShowSchemasStatement stmt = (ShowSchemasStatement) other; return Objects.equals(schemaPattern, stmt.getSchemaPattern()); }</code><technical_language>overriding equals, I do hashCode(). ShowTablesStatement</technical_language>

Target:
public boolean equals(Object other) { if (!(other instanceof ShowSchemasStatement)) return false; ShowSchemasStatement stmt = (ShowSchemasStatement) other; return Objects.equals(schemaPattern, stmt.getSchemaPattern()); }
Source:
<code>public void waitUntilAllBlocked() { try { _blockersDoneLatch.await(); } <START> catch (Exception ex) { <END> } }</code><technical_language>missing exception. log, rethrow runtime rename exception ignored. Expand Exception</technical_language>

Target:
public void waitUntilAllBlocked() throws InterruptedException { _blockersDoneLatch.await(); }
Source:
<code>public void addBuddy(UserDto user, BuddyDto buddy) { Require.that(user != null && user.getId() != null, InvalidDataException::emptyUserId); Require.that(buddy != null && buddy.getId() != null, InvalidDataException::emptyBuddyId); <START> updateUser(user.getId(), userEntity -> { <END> userRetrievalService.assertValidatedUser(userEntity); Buddy buddyEntity = buddyRepository.findById(buddy.getId()) .orElseThrow(() -> InvalidDataException.missingEntity(Buddy.class, buddy.getId())); userEntity.addBuddy(buddyEntity); UserAnonymized userAnonymizedEntity = userEntity.getAnonymized(); userAnonymizedEntity.addBuddyAnonymized(buddyEntity.getBuddyAnonymized()); userAnonymizedService.updateUserAnonymized(userAnonymizedEntity); }); }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') A "NullPointerException" thrown; "user" is nullable here. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public void addBuddy(UserDto user, BuddyDto buddy) { Require.that(user != null && user.getId() != null, InvalidDataException::emptyUserId); Require.that(buddy != null && buddy.getId() != null, InvalidDataException::emptyBuddyId); updateUser(user.getId(), userEntity -> { userAssertionService.assertValidatedUser(userEntity); Buddy buddyEntity = buddyRepository.findById(buddy.getId()) .orElseThrow(() -> InvalidDataException.missingEntity(Buddy.class, buddy.getId())); userEntity.addBuddy(buddyEntity); UserAnonymized userAnonymizedEntity = userEntity.getAnonymized(); userAnonymizedEntity.addBuddyAnonymized(buddyEntity.getBuddyAnonymized()); userAnonymizedService.updateUserAnonymized(userAnonymizedEntity); }); }
Source:
<code>public static void main(String[] args) { String endpoint = "https://<RESOURCE_NAME>.communication.azure.com"; <START> String accessToken = "SECRET"; <END> HttpClient httpClient = new NettyAsyncHttpClientBuilder().build(); CommunicationClientCredential credential = null; try { credential = new CommunicationClientCredential(accessToken); } catch (NoSuchAlgorithmException e) { System.out.println(e.getMessage()); } catch (InvalidKeyException e) { System.out.println(e.getMessage()); } SmsClientBuilder smsClientBuilder = new SmsClientBuilder(); smsClientBuilder.endpoint(endpoint) .credential(credential) .httpClient(httpClient); SmsClient smsClient = smsClientBuilder.buildClient(); List<PhoneNumber> to = new ArrayList<PhoneNumber>(); to.add(new PhoneNumber("<to-phone-number>")); SendSmsOptions options = new SendSmsOptions(); options.setEnableDeliveryReport(true); SendSmsResponse response = smsClient.sendMessage( new PhoneNumber("<leased-phone-number>"), to, "your message", options ); System.out.println("MessageId: " + response.getMessageId()); }</code><technical_language>rename this accessKey, a token AccessKey portal</technical_language>

Target:
public static void main(String[] args) { String endpoint = "https://<RESOURCE_NAME>.communication.azure.com"; String accessKey = "SECRET"; HttpClient httpClient = new NettyAsyncHttpClientBuilder().build(); CommunicationClientCredential credential = null; try { credential = new CommunicationClientCredential(accessKey); } catch (NoSuchAlgorithmException e) { System.out.println(e.getMessage()); } catch (InvalidKeyException e) { System.out.println(e.getMessage()); } SmsClientBuilder smsClientBuilder = new SmsClientBuilder(); smsClientBuilder.endpoint(endpoint) .credential(credential) .httpClient(httpClient); SmsClient smsClient = smsClientBuilder.buildClient(); List<PhoneNumber> to = new ArrayList<PhoneNumber>(); to.add(new PhoneNumber("<to-phone-number>")); SendSmsOptions options = new SendSmsOptions(); options.setEnableDeliveryReport(true); SendSmsResponse response = smsClient.sendMessage( new PhoneNumber("<leased-phone-number>"), to, "your message", options ); System.out.println("MessageId: " + response.getMessageId()); }
Source:
<code>public void testSetTitleIconStartMargin() throws Throwable { int startMargin = 100; int navIconWidth = 100; mActivityRule.runOnUiThread(() -> { mToolbar.setNavigationIconContainerWidth(navIconWidth); mToolbar.setTitleIcon(android.R.drawable.sym_def_app_icon); mToolbar.setTitleIconStartMargin(startMargin); }); <START> InstrumentationRegistry.getInstrumentation().waitForIdleSync(); <END> onView(withId(R.id.title_icon)).check(matches(withLeft(navIconWidth + startMargin))); }</code><technical_language>need this. onView() wait</technical_language>

Target:
public void testSetTitleIconStartMargin() throws Throwable { int startMargin = 100; int navIconWidth = 100; mActivityRule.runOnUiThread(() -> { mToolbar.setNavigationIconContainerWidth(navIconWidth); mToolbar.setTitleIcon(android.R.drawable.sym_def_app_icon); mToolbar.setTitleIconStartMargin(startMargin); }); onView(withId(R.id.title_icon)).check(matches(withLeft(navIconWidth + startMargin))); }
Source:
<code>public String toString() { <START> return getClass().getName() + "." + getName(); <END> }</code><technical_language>please add GUID is important</technical_language>

Target:
public String toString() { return getClass().getName() + "." + getName() + " Guid = " + guid.toString(); }
Source:
<code>public PatchScript call() throws OrmException, NoSuchChangeException { validatePatchSetId(psa); validatePatchSetId(psb); control = changeControlFactory.validateFor(changeId); change = control.getChange(); <START> ReviewDb db = null; <END> try { db = schemaFactory.open(); patchSet = db.patchSets().get(patchSetId); if (patchSet == null) { throw new NoSuchChangeException(changeId); } projectKey = change.getProject(); aId = psa != null ? toObjectId(db, psa) : null; bId = toObjectId(db, psb); try { git = repoManager.openRepository(projectKey.get()); } catch (RepositoryNotFoundException e) { log.error("Repository " + projectKey + " not found", e); throw new NoSuchChangeException(changeId, e); } final String fileName = patchKey.getFileName(); try { final PatchList list = listFor(keyFor(settings.getWhitespace())); final PatchScriptBuilder b = newBuilder(list); final PatchListEntry contentWS = list.get(fileName); final CommentDetail comments = allComments(db); final PatchListEntry contentActual; if (settings.getWhitespace() == Whitespace.IGNORE_NONE) { contentActual = contentWS; } else { contentActual = listFor(keyFor(Whitespace.IGNORE_NONE)).get(fileName); } try { return b.toPatchScript(contentWS, comments, contentActual); } catch (IOException e) { log.error("File content unavailable", e); throw new NoSuchChangeException(changeId, e); } } finally { git.close(); } } finally { if (db != null) { db.close(); } } }</code><technical_language>Please assign null. I prefer idiom be: ReviewDb db = schemaFactory.open(); try { } finally { db.close(); } Java compiler promise null sites, clear scope of is</technical_language>

Target:
public PatchScript call() throws OrmException, NoSuchChangeException { validatePatchSetId(psa); validatePatchSetId(psb); control = changeControlFactory.validateFor(changeId); change = control.getChange(); ReviewDb db = schemaFactory.open(); try { patchSet = db.patchSets().get(patchSetId); if (patchSet == null) { throw new NoSuchChangeException(changeId); } projectKey = change.getProject(); aId = psa != null ? toObjectId(db, psa) : null; bId = toObjectId(db, psb); try { git = repoManager.openRepository(projectKey.get()); } catch (RepositoryNotFoundException e) { log.error("Repository " + projectKey + " not found", e); throw new NoSuchChangeException(changeId, e); } final String fileName = patchKey.getFileName(); try { final PatchList list = listFor(keyFor(settings.getWhitespace())); final PatchScriptBuilder b = newBuilder(list); final PatchListEntry contentWS = list.get(fileName); final CommentDetail comments = allComments(db); final PatchListEntry contentActual; if (settings.getWhitespace() == Whitespace.IGNORE_NONE) { contentActual = contentWS; } else { contentActual = listFor(keyFor(Whitespace.IGNORE_NONE)).get(fileName); } try { return b.toPatchScript(contentWS, comments, contentActual); } catch (IOException e) { log.error("File content unavailable", e); throw new NoSuchChangeException(changeId, e); } } finally { git.close(); } } finally { db.close(); } }
Source:
<code>public static void main(String[] args) { if (args.length != 3) { println("usage: FunctionalTest <ENDPOINT> <ACCESSKEY> <SECRETKEY>"); return; } endpoint = args[0]; accessKey = args[1]; secretKey = args[2]; try { client = new MinioClient(endpoint, accessKey, secretKey); makeBucket_test1(); if (!endpoint.toLowerCase().contains("minio")) { makeBucket_test2(); makeBucket_test3(); } listBuckets_test(); bucketExists_test(); removeBucket_test(); setup(); putObject_test1(); putObject_test2(); putObject_test3(); putObject_test4(); statObject_test(); getObject_test1(); getObject_test2(); getObject_test3(); getObject_test4(); listObject_test1(); listObject_test2(); listObject_test3(); listObject_test4(); removeObject_test(); listIncompleteUploads_test1(); listIncompleteUploads_test2(); listIncompleteUploads_test3(); removeIncompleteUploads_test(); presignedGetObject_test1(); presignedGetObject_test2(); presignedPutObject_test1(); presignedPutObject_test2(); presignedPostPolicy_test(); copyObject_test1(); <START> copyObject_test2(); <END> threadedPutObject(); teardown(); } catch (Exception e) { e.printStackTrace(); return; } }</code><technical_language>more functions here. 1. testing condition 2. testing condition 3. testing specific condition 4. testing combination of conditions Consideration 1 - If of x-amz-copy-source-if-match x-amz-copy-source-if-unmodified-since headers present in request follows: x-amz-copy-source-if-match condition evaluates true, and; x-amz-copy-source-if-unmodified-since condition evaluates false; then, S3 returns 200 OK copies data. Consideration 2 - If of x-amz-copy-source-if-none-match x-amz-copy-source-if-modified-since headers present in request follows: x-amz-copy-source-if-none-match condition evaluates false, and; x-amz-copy-source-if-modified-since condition evaluates true; then, S3 returns 412 Precondition Failed response code</technical_language>

Target:
public static void main(String[] args) { if (args.length != 3) { println("usage: FunctionalTest <ENDPOINT> <ACCESSKEY> <SECRETKEY>"); return; } endpoint = args[0]; accessKey = args[1]; secretKey = args[2]; try { client = new MinioClient(endpoint, accessKey, secretKey); makeBucket_test1(); if (!endpoint.toLowerCase().contains("minio")) { makeBucket_test2(); makeBucket_test3(); } listBuckets_test(); bucketExists_test(); removeBucket_test(); setup(); putObject_test1(); putObject_test2(); putObject_test3(); putObject_test4(); statObject_test(); getObject_test1(); getObject_test2(); getObject_test3(); getObject_test4(); listObject_test1(); listObject_test2(); listObject_test3(); listObject_test4(); removeObject_test(); listIncompleteUploads_test1(); listIncompleteUploads_test2(); listIncompleteUploads_test3(); removeIncompleteUploads_test(); presignedGetObject_test1(); presignedGetObject_test2(); presignedPutObject_test1(); presignedPutObject_test2(); presignedPostPolicy_test(); copyObject_test1(); copyObject_test2(); copyObject_test3(); copyObject_test4(); copyObject_test5(); threadedPutObject(); teardown(); } catch (Exception e) { e.printStackTrace(); return; } }
Source:
<code>public void parseArguments(List<String> args) throws Exception { args.remove(0); ParametersParser parser = new ParametersParser( getClass().getResourceAsStream("arguments.properties"), "module" ); moduleArgs = parser.parse(args); if(moduleArgs.containsKey("help")) { printUsage(parser); throw new ExitException(); } List<String> actionOthers = (List<String>) moduleArgs.get(ParametersParser.OTHER); String action = actionOthers.remove(0); actionMethod = actions.get(action); if(actionMethod == null) { throw new IllegalArgumentException( String.format("No such action '%1$s' exists for module '%2$s'", action, getName()) ); } parser = new ParametersParser( getClass().getResourceAsStream("arguments.properties"), action ); actionArgs = parser.parse(actionOthers); List<Throwable> actionErrors = (List<Throwable>) actionArgs.get(ParametersParser.ERROR); if(actionArgs.containsKey("help")) { printUsage(parser); throw new ExitException(); } else if(!actionErrors.isEmpty()) { for(Throwable t : actionErrors) { if(t instanceof ExitException) { logger.error(t.getMessage()); throw (ExitException)t; } <START> } <END> } }</code><technical_language>same, throw exit exception error/debug all</technical_language>

Target:
public void parseArguments(List<String> args) throws Exception { args.remove(0); ParametersParser parser = new ParametersParser( getClass().getResourceAsStream("arguments.properties"), "module" ); moduleArgs = parser.parse(args); List<String> actionOthers = (List<String>) moduleArgs.get(ParametersParser.PARAMETER_KEY_OTHER); if(moduleArgs.containsKey("help")) { printUsage(parser); throw new ExitException("Help", 0); } if(actionOthers.size() < 1) { logger.error("Please provide action."); throw new ExitException("Action not provided", 1); } String action = actionOthers.remove(0); actionMethod = actions.get(action); if(actionMethod == null) { throw new IllegalArgumentException( String.format("No such action '%1$s' exists for module '%2$s'", action, getName()) ); } parser = new ParametersParser( getClass().getResourceAsStream("arguments.properties"), action ); actionArgs = parser.parse(actionOthers); List<Throwable> actionErrors = (List<Throwable>) actionArgs.get(ParametersParser.PARAMETER_KEY_ERRORS); if(actionArgs.containsKey("help")) { printUsage(parser); throw new ExitException("Help", 0); } else if(!actionErrors.isEmpty()) { for(Throwable t : actionErrors) { logger.error(t.getMessage()); logger.debug(t.getMessage(), t); } throw new ExitException("Parsing error", 1); } }
Source:
<code>public void recreateImageReaderWhenRefresh() { mDeferredImageReaderSurface.refresh(); mDeferredImageReaderSurface.notifySurfaceAttached(); mDeferredImageReaderSurface.refresh(); mDeferredImageReaderSurface.notifySurfaceAttached(); assertThat(mDeferredImageReaderSurface.mImageReaderToReleaseList.size()) <START> .isEqualTo(2); <END> assertThat(mDeferredImageReaderSurface.getAttachedCount()) .isEqualTo(3); assertThat(mDeferredImageReaderSurface.getSurface()).isNotNull(); }</code><technical_language>need wrap line</technical_language>

Target:
public void recreateImageReaderWhenRefresh() { mDeferredImageReaderSurface.refresh(); mDeferredImageReaderSurface.notifySurfaceAttached(); mDeferredImageReaderSurface.refresh(); mDeferredImageReaderSurface.notifySurfaceAttached(); assertThat(mDeferredImageReaderSurface.mImageReaderToReleaseList.size()) .isEqualTo(2); assertThat(mDeferredImageReaderSurface.getAttachedCount()).isEqualTo(3); assertThat(mDeferredImageReaderSurface.getImageReader()).isNotNull(); }
Source:
<code>public void testGenSecretKeyKeySize() { for(KeyType type: keyTypes){ byte[] key = KeyGenUtils.genSecretKey(type).getEncoded(); <START> assertEquals("KeyType: "+type.name(), type.keySize >> 3, key.length); <END> } }</code><technical_language>type.keySize >> 3 from</technical_language>

Target:
public void testGenSecretKeyKeySize() { for(KeyType type: keyTypes){ byte[] key = KeyGenUtils.genSecretKey(type).getEncoded(); int keySizeBytes = type.keySize >> 3; assertEquals("KeyType: "+type.name(), keySizeBytes, key.length); } }
Source:
<code>@VisibleForTesting ConfigurableResource getMaxResources(String queue) { ConfigurableResource maxQueueResource = maxQueueResources.get(queue); return maxQueueResource == null ? <START> queueMaxResourcesDefault : maxQueueResource; <END> }</code><technical_language>a fan of ternary operator clearer. I point here</technical_language>

Target:
ConfigurableResource getMaxResources(String queue) { ConfigurableResource maxQueueResource = maxQueueResources.get(queue); if (maxQueueResource == null) { maxQueueResource = queueMaxResourcesDefault; } return maxQueueResource; }
Source:
<code>public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { <START> if (block == ItemsAndBlocks.backpackStandGhost) { <END> world.setBlockToAir(x, y, z); if (!world.isRemote) dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); } }</code><technical_language>this issues, if a ghost block is adjecent top of backpackstand triger</technical_language>

Target:
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { if (world.getBlock(x, y + 1, z) != ItemsAndBlocks.backpackStandGhost) { world.setBlockToAir(x, y, z); if (!world.isRemote) dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); } }
Source:
<code>public byte[] call(final byte[] memento) throws InterruptedException { LOG.info("SimpleEMTask commencing..."); <START> LOG.log(Level.INFO, "Before sleep, memory store contains {0} blocks", memoryStore.getAll(DATATYPE)); <END> final Map<Long, Object> initialData = memoryStore.getRange(DATATYPE, ids.get(0), ids.get(NUM_DATA - 1)); assert initialData.keySet().containsAll(ids); assert initialData.values().containsAll(ids); simpleEMTaskReady.setReady(true); heartBeatTriggerManager.triggerHeartBeat(); final long sleepMillis = (iterations + 1) * periodMillis; LOG.info("Sleep for: " + sleepMillis); Thread.sleep(sleepMillis); LOG.log(Level.INFO, "After sleep, memory store contains {0} blocks", memoryStore.getAll(DATATYPE)); final Map<Long, Object> dataAfterMove = memoryStore.getRange(DATATYPE, ids.get(0), ids.get(NUM_DATA - 1)); assert dataAfterMove.keySet().containsAll(ids); assert dataAfterMove.values().containsAll(ids); return null; }</code><technical_language>MemoryStore expose method count number of local blocks. If wanna count number of items in local store, getNumUnits, getAll</technical_language>

Target:
public byte[] call(final byte[] memento) throws InterruptedException { LOG.info("SimpleEMTask commencing..."); final Map<Long, Object> initialData = memoryStore.getRange(DATATYPE, ids.get(0), ids.get(NUM_DATA - 1)); assert initialData.keySet().containsAll(ids); assert initialData.values().containsAll(ids); simpleEMTaskReady.setReady(true); heartBeatTriggerManager.triggerHeartBeat(); final long sleepMillis = (iterations + 1) * periodMillis; LOG.info("Sleep for: " + sleepMillis); Thread.sleep(sleepMillis); final Map<Long, Object> dataAfterMove = memoryStore.getRange(DATATYPE, ids.get(0), ids.get(NUM_DATA - 1)); assert dataAfterMove.keySet().containsAll(ids); assert dataAfterMove.values().containsAll(ids); return null; }
Source:
<code>public boolean canReadCommit(ReviewDb db, RevWalk rw, RevCommit commit) { try { Repository repo = <START> repoManager.openRepository(getProject().getNameKey()); <END> try { return isMergedIntoVisibleRef(repo, db, rw, commit, repo.getAllRefs()); } finally { repo.close(); } } catch (IOException e) { String msg = String.format( "Cannot verify permissions to commit object %s in repository %s", commit.name(), getProject().getNameKey()); log.error(msg, e); return false; } }</code><technical_language>defined openRepository() this. method too</technical_language>

Target:
public boolean canReadCommit(ReviewDb db, RevWalk rw, RevCommit commit) { try { Repository repo = openRepository(); try { return isMergedIntoVisibleRef(repo, db, rw, commit, repo.getAllRefs()); } finally { repo.close(); } } catch (IOException e) { String msg = String.format( "Cannot verify permissions to commit object %s in repository %s", commit.name(), getProject().getNameKey()); log.error(msg, e); return false; } }