auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void write(Record record) throws StageException { try { Date recordTime = getRecordTime(record); RecordWriter writer = getCurrentWriters().get(getBatchTime(), recordTime, record); if (writer != null) { toHdfsRecordsCounter.inc(); toHdfsRecordsMeter.mark(); writer.write(record); getCurrentWriters().release(writer); } else { lateRecordsCounter.inc(); lateRecordsMeter.mark(); switch (lateRecordsAction) { case SEND_TO_ERROR: getContext().toError(record, Errors.HADOOPFS_12, record.getHeader().getSourceId()); break; case SEND_TO_LATE_RECORDS_FILE: RecordWriter lateWriter = getLateWriters().get(getBatchTime(), getBatchTime(), record); lateWriter.write(record); getLateWriters().release(lateWriter); break; default: <START> throw new RuntimeException(Utils.format("Unknown late records action: {}")); <END> } } } catch (IOException ex) { throw new StageException(Errors.HADOOPFS_14, ex.toString(), ex); } catch (StageException ex) { throw new OnRecordErrorException(ex.getErrorCode(), ex.getParams()); } }</code><technical_language>need pass argument utils.format here, lateRecordsAction</technical_language>

Target:
protected void write(Record record) throws StageException { try { Date recordTime = getRecordTime(record); RecordWriter writer = getCurrentWriters().get(getBatchTime(), recordTime, record); if (writer != null) { toHdfsRecordsCounter.inc(); toHdfsRecordsMeter.mark(); writer.write(record); getCurrentWriters().release(writer); } else { lateRecordsCounter.inc(); lateRecordsMeter.mark(); switch (lateRecordsAction) { case SEND_TO_ERROR: getContext().toError(record, Errors.HADOOPFS_12, record.getHeader().getSourceId()); break; case SEND_TO_LATE_RECORDS_FILE: RecordWriter lateWriter = getLateWriters().get(getBatchTime(), getBatchTime(), record); lateWriter.write(record); getLateWriters().release(lateWriter); break; default: throw new RuntimeException(Utils.format("Unknown late records action: {}", lateRecordsAction)); } } } catch (IOException ex) { throw new StageException(Errors.HADOOPFS_14, ex.toString(), ex); } catch (StageException ex) { throw new OnRecordErrorException(ex.getErrorCode(), ex.getParams()); } }
Source:
<code>public void createPartControl(final Composite parent) { super.createPartControl(parent); setGlobalActionBarsToPage((IPageBookViewPage)getDefaultPage()); getSite().getSelectionProvider().addSelectionChangedListener(this); ((IPageBookViewPage)getDefaultPage()).getSite().setSelectionProvider(getViewer()); partActivated(new BreadcrumbWorkbenchPart(getSite())); fContextProviderProxy = new ContextProviderProxy( new IDebugContextProvider[] {fTreeViewerDebugContextProvider, fBreadcrumbPage.getContextProvider()}); DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).addDebugContextProvider(fContextProviderProxy); createViewModeActions(parent); IPreferenceStore prefStore = DebugUIPlugin.getDefault().getPreferenceStore(); String mode = prefStore.getString(IDebugPreferenceConstants.DEBUG_VIEW_MODE); setViewMode(mode, parent); for (DebugViewModeAction <START> fDebugViewModeAction : <END> fDebugViewModeActions) { fDebugViewModeAction.setChecked(fDebugViewModeAction.getMode().equals(mode)); } createDebugToolBarInViewActions(parent); parent.addControlListener(new ControlListener() { @Override public void controlMoved(ControlEvent e) { } @Override public void controlResized(ControlEvent e) { if (parent.isDisposed()) { return; } if (IDebugPreferenceConstants.DEBUG_VIEW_MODE_AUTO.equals(fCurrentViewMode)) { autoSelectViewPage(parent); } } }); fContextService.addContextManagerListener(this); }</code><technical_language>rename action</technical_language>

Target:
public void createPartControl(final Composite parent) { super.createPartControl(parent); setGlobalActionBarsToPage((IPageBookViewPage)getDefaultPage()); getSite().getSelectionProvider().addSelectionChangedListener(this); ((IPageBookViewPage)getDefaultPage()).getSite().setSelectionProvider(getViewer()); partActivated(new BreadcrumbWorkbenchPart(getSite())); fContextProviderProxy = new ContextProviderProxy( new IDebugContextProvider[] {fTreeViewerDebugContextProvider, fBreadcrumbPage.getContextProvider()}); DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).addDebugContextProvider(fContextProviderProxy); createViewModeActions(parent); IPreferenceStore prefStore = DebugUIPlugin.getDefault().getPreferenceStore(); String mode = prefStore.getString(IDebugPreferenceConstants.DEBUG_VIEW_MODE); setViewMode(mode, parent); for (DebugViewModeAction action : fDebugViewModeActions) { action.setChecked(action.getMode().equals(mode)); } createDebugToolBarInViewActions(parent); parent.addControlListener(new ControlListener() { @Override public void controlMoved(ControlEvent e) { } @Override public void controlResized(ControlEvent e) { if (parent.isDisposed()) { return; } if (IDebugPreferenceConstants.DEBUG_VIEW_MODE_AUTO.equals(fCurrentViewMode)) { autoSelectViewPage(parent); } } }); fContextService.addContextManagerListener(this); }
Source:
<code>private String formatValue(Object value) { synchronized ( DateTimeColumnDef.class ) { if ( value instanceof Long && getType().equals("datetime") ) { return formatLong(( Long ) value); } else if ( value instanceof Timestamp ) { int nanos = (( Timestamp ) value).getNanos(); if ( nanos > 0 ) { StringBuilder result = new StringBuilder(); result.append(getDateTimeFormatter().format(( Date ) value)); result.append("."); <START> result.append(String.format("%06d", nanos/1000)); <END> return result.toString(); } else { return getDateTimeFormatter().format(( Timestamp ) value); } } else if ( value instanceof Date ) { return getDateTimeFormatter().format(( Date ) value); } else { return ""; } } }</code><technical_language>is capture resolution user table-creation time? I out capturing a CREATE TABLE statement, wondering if capture INFORMATION_SCHEMA</technical_language>

Target:
protected String formatValue(Object value) { synchronized ( DateTimeColumnDef.class ) { if ( value instanceof Long && getType().equals("datetime") ) { return formatLong(( Long ) value); } else if ( value instanceof Timestamp ) { Timestamp ts = (Timestamp) value; String datetimeAsStr = getDateTimeFormatter().format(ts); return objectWithPrecisionToString(datetimeAsStr, ts, this.columnLength); } else if ( value instanceof Date ) { Timestamp ts = new Timestamp((( Date ) value).getTime()); String dateAsStr = getDateTimeFormatter().format(ts); return objectWithPrecisionToString(dateAsStr, ts, this.columnLength); } else { return ""; } } }
Source:
<code>public void addCommand(String rawLine) { <START> received = true; <END> commands.add(parseCommand(chomp(rawLine))); rawCommands.append(rawLine); }</code><technical_language>No, for addCommand. caller runs this if push cert is enabled, client send a push cert</technical_language>

Target:
public void addCommand(String rawLine) { commands.add(parseCommand(chomp(rawLine))); rawCommands.append(rawLine); }
Source:
<code>private void packageAndAttachDSym(String sdk, String config) throws IOException, NoSuchArchiverException, ArchiverException, XCodeException, MojoExecutionException { final String productName = getProductName(config, sdk); final String fixedProductName = getFixedProductName(productName); <START> final File dsymRoot = new File(XCodeBuildLayout.getAppFolder(getXCodeCompileDirectory(), config, sdk), productName + ".app.dSYM"); <END> if (dsymRoot.canRead()) { final File root = XCodeBuildLayout.getAppFolder(getXCodeCompileDirectory(), config, sdk); Archiver archiver = archiverManager.getArchiver("zip"); File destination = new File(new File(new File(project.getBuild().getDirectory()), config + "-" + sdk), fixedProductName + ".app.dSYM.zip"); archiver.addDirectory(root, new String[] { productName + ".app.dSYM *" }, null); archiver.setDestFile(destination); archiver.createArchive(); getLog().info("dSYM packaged (" + destination + ")"); prepareDSymFileForDeployment(project, config, sdk, destination); } else { getLog().info("dSYM packaging skipped. " + productName + ".app.dSYM does not exists for configuration '" + config + "' and sdk ' " + sdk + "' ."); } }</code><technical_language>Remark - I would... final File root = XCodeBuildLayout.getAppFolder(getXCodeCompileDirectory(), config, sdk);}} final File dsymRoot = new File(root, productName + ".app.dSYM");</technical_language>

Target:
private void packageAndAttachDSym(String sdk, String config) throws IOException, NoSuchArchiverException, ArchiverException, XCodeException, MojoExecutionException { final String productName = getProductName(config, sdk); final String fixedProductName = getFixedProductName(productName); final File root = XCodeBuildLayout.getAppFolder(getXCodeCompileDirectory(), config, sdk); final File dsymRoot = new File(root, productName + ".app.dSYM"); if (dsymRoot.canRead()) { Archiver archiver = archiverManager.getArchiver("zip"); File destination = new File(new File(new File(project.getBuild().getDirectory()), config + "-" + sdk), fixedProductName + ".app.dSYM.zip"); archiver.addDirectory(root, new String[] { productName + ".app.dSYM *" }, null); archiver.setDestFile(destination); archiver.createArchive(); getLog().info("dSYM packaged (" + destination + ")"); prepareDSymFileForDeployment(project, config, sdk, destination); } else { if (shouldExistDSym(sdk, config)) { throw new XCodeException( "DSym file should be created but could not be found at the expected location: '" + dsymRoot + "'. In case you prefere not to have dSym files set Xcode properties '" + EffectiveBuildSettings.GCC_GENERATE_DEBUGGING_SYMBOLS + "' and '" + EffectiveBuildSettings.DEBUG_INFORMATION_FORMAT + "' accordingly."); } } }
Source:
<code><START> public Map<Class<? extends Annotation>, List<FrameworkField>> getAnnotationToFields() { <END> return Collections.unmodifiableMap(fFieldsForAnnotations); }</code><technical_language>..and change this getAnnotatedFields(Class<? extends Annotation> annotation)</technical_language>

Target:
public Map<Class<? extends Annotation>, List<FrameworkField>> getAnnotationToFields() { return fFieldsForAnnotations; }
Source:
<code>public ProbeStatus run() { Map<String, BlobProvider> providers = Framework.getService(BlobManager.class).getBlobProviders(); for (Map.Entry<String, BlobProvider> en : providers.entrySet()) { String id = en.getKey(); BlobProvider blobProvider = en.getValue(); BinaryManager bm = blobProvider.getBinaryManager(); if (bm instanceof S3BinaryManager && !((S3BinaryManager) bm).canAccessBucket()) { return ProbeStatus.newFailure("S3BinaryManager cannot access the configured bucket: " + id); } } <START> return ProbeStatus.newSuccess("S3BinaryManager can access the configured buckets"); <END> }</code><technical_language>weird "S3BinaryManager access configured buckets" status message if is S3BinaryManager all</technical_language>

Target:
public ProbeStatus run() { Map<String, BlobProvider> providers = Framework.getService(BlobManager.class).getBlobProviders(); boolean someSuccess = false; for (Map.Entry<String, BlobProvider> en : providers.entrySet()) { String id = en.getKey(); BlobProvider blobProvider = en.getValue(); BinaryManager bm = blobProvider.getBinaryManager(); if (bm == null || !(bm instanceof S3BinaryManager)) { continue; } if (!((S3BinaryManager) bm).canAccessBucket()) { return ProbeStatus.newFailure("S3BinaryManager cannot access the configured bucket: " + id); } someSuccess = true; } if (someSuccess) { return ProbeStatus.newSuccess("S3BinaryManager can access the configured buckets"); } else { return ProbeStatus.newSuccess("No S3BinaryManager bucket configured"); } }
Source:
<code>public CompletableSource apply(Completable upstream) { <START> return Completable.amb( <END> Arrays.asList( upstream, lifecycle .flatMap(Functions.CANCEL_COMPLETABLE) .ignoreElements() ) ); }</code><technical_language>consider Completable.ambArray</technical_language>

Target:
public CompletableSource apply(Completable upstream) { return Completable.ambArray( upstream, lifecycle .flatMap(Functions.CANCEL_COMPLETABLE) .ignoreElements() ); }
Source:
<code>private void invokeForKey(AggregationRepository repo, String key, Method method, Object[] args) { try { invokeForKeyOrDie(repo, key, method, args); } catch (RepositoryLockWaitException e) { logger.warn("Failed to process the plugin's '{}' method '{}' invocation: {}!", plugin.getId(), method.getName(), e.getMessage()); repo.confirm(camelContext, key); <START> } catch (RepositoryUnreachableException | RepositoryDirtyWriteAttemptException e) { <END> logger.warn("Failed to process the plugin's '{}' method '{}' invocation: {}!", plugin.getId(), method.getName(), e.getMessage()); } catch (InvocationTargetException e) { logger.trace("Sonar cheat", e); logger.error("Failed to process the plugin's '{}' method '{}' invocation!", plugin.getId(), method.getName(), e.getTargetException()); } catch (Exception e) { logger.error("Failed to process the plugin's '{}' method '{}' invocation!", plugin.getId(), method.getName(), e); } finally { unlockQuietly(repo, key); } }</code><technical_language>![CRITICAL](<LINK_0> log rethrow this exception. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private void invokeForKey(AggregationRepository repo, String key, Method method, Object[] args) { try { invokeForKeyOrDie(repo, key, method, args); } catch (RepositoryLockWaitException e) { logger.warn("Failed to process the plugin's '{}' method '{}' invocation: {}!", plugin.getId(), method.getName(), e.getMessage()); repo.confirm(camelContext, key); } catch (RepositoryUnreachableException | RepositoryDirtyWriteAttemptException e) { logger.warn("Failed to process the plugin's '{}' method '{}' invocation: {}!", plugin.getId(), method.getName(), e.getMessage()); } catch (InvocationTargetException e) { logger.error("Failed to process the plugin's '{}' method '{}' invocation!", plugin.getId(), method.getName(), e.getTargetException()); } catch (Exception e) { logger.error("Failed to process the plugin's '{}' method '{}' invocation!", plugin.getId(), method.getName(), e); } finally { unlockQuietly(repo, key); } }
Source:
<code>private static void handleAssignmentStatement(AssignmentStatement assignmentStatement, SubscriptionContext ctx) { <START> if (assignmentStatement.lhsExpressions().get(0).expressions().get(0) instanceof HasSymbol) { <END> Symbol symbol = ((HasSymbol) assignmentStatement.lhsExpressions().get(0).expressions().get(0)).symbol(); if (symbol == null) { return; } String symbolTypeName = SymbolUtils.getTypeName(symbol); if (symbolTypeName != null && symbolTypeName.equals("smtplib.SMTP")) { boolean usesEncryption = symbol.usages().stream().anyMatch(u -> { Tree tree = TreeUtils.firstAncestorOfKind(u.tree(), Tree.Kind.CALL_EXPR); if (tree != null) { Symbol calleeSymbol = ((CallExpression) tree).calleeSymbol(); return calleeSymbol != null && "smtplib.SMTP.starttls".equals(calleeSymbol.fullyQualifiedName()); } return false; }); if (!usesEncryption) { ctx.addIssue(assignmentStatement.assignedValue(), "Make sure STARTTLS is used to upgrade to a secure connection using SSL/TLS."); } } } }</code><technical_language>I FP in cases: python smtp1 = smtp2 = smtplib.SMTP("smtp.gmail.com", port=587) # FP smtp2.starttls(context=context) python smtp1 = smtplib.SMTP("smtp.gmail.com", port=587) # FP smtp2 = smtp1 smtp2.starttls(context=context) python smtp1 = smtplib.SMTP("smtp.gmail.com", port=587) # FP start_tls(stmp1) def start_tls(x): x.starttls(context=context) implement this properly, need a points-to analysis, is out of scope for this MMF</technical_language>

Target:
private static void handleAssignmentStatement(AssignmentStatement assignmentStatement, SubscriptionContext ctx) { if (assignmentStatement.lhsExpressions().size() > 1) { return; } if (assignmentStatement.lhsExpressions().get(0).expressions().get(0) instanceof HasSymbol) { Symbol symbol = ((HasSymbol) assignmentStatement.lhsExpressions().get(0).expressions().get(0)).symbol(); if (symbol == null) { return; } String symbolTypeName = SymbolUtils.getTypeName(symbol); if (symbolTypeName != null && symbolTypeName.equals("smtplib.SMTP")) { boolean usesEncryption = symbol.usages().stream().anyMatch(u -> { Tree tree = TreeUtils.firstAncestorOfKind(u.tree(), Tree.Kind.CALL_EXPR); if (tree != null) { Symbol calleeSymbol = ((CallExpression) tree).calleeSymbol(); return calleeSymbol != null && "smtplib.SMTP.starttls".equals(calleeSymbol.fullyQualifiedName()); } return false; }); if (!usesEncryption) { ctx.addIssue(assignmentStatement.assignedValue(), "Make sure STARTTLS is used to upgrade to a secure connection using SSL/TLS."); } } } }
Source:
<code>public ValidationResult validate(HostSetupNetworksParameters params, List<VdsNetworkInterface> existingInterfaces, BusinessEntityMap<VdsNetworkInterface> existingInterfacesMap){ <START> List<VdsNetworkInterface> nicWithUnmanagedNetworks = filterNicsWithUnmanagedNetworks( <END> existingInterfaces, params.getRemovedUnmanagedNetworks()); try{ for (VdsNetworkInterface unmgmtNic : nicWithUnmanagedNetworks){ validateAttachements(unmgmtNic, params.getNetworkAttachments()); validateLabels(unmgmtNic, params.getLabels()); validateBonds(unmgmtNic, params.getBonds(), existingInterfacesMap); validateRemovedLabels(unmgmtNic, params.getRemovedLabels()); } }catch(ValidationException validationException){ return validationException.getValidationResult(); } return ValidationResult.VALID; }</code><technical_language>s/nicWithUnmanagedNetworks/nicsWithUnmanagedNetwork</technical_language>

Target:
public ValidationResult validate(HostSetupNetworksParameters params, List<VdsNetworkInterface> existingInterfaces, BusinessEntityMap<VdsNetworkInterface> existingInterfacesMap){ List<VdsNetworkInterface> nicsWithUnmanagedNetworks = filterNicsWithUnmanagedNetworks( existingInterfaces, params.getRemovedUnmanagedNetworks()); for (VdsNetworkInterface unmgmtNic : nicsWithUnmanagedNetworks){ ValidationResult result = validateAttachements(unmgmtNic, params.getNetworkAttachments()); if (!result.isValid()) { return result; } result = validateLabels(unmgmtNic, params.getLabels()); if (!result.isValid()) { return result; } result = validateBonds(unmgmtNic, params.getBonds(), existingInterfacesMap); if (!result.isValid()) { return result; } } return ValidationResult.VALID; }
Source:
<code>PyClassDefTree getParentClassDef(Tree current) { if(current == null) { return null; <START> } else if (current.is(Tree.Kind.CLASSDEF)) { <END> return (PyClassDefTree) current; } else { return getParentClassDef(current.parent()); } }</code><technical_language>I choose a while loop implement this a recursive call (call stack grow big unecessarily of this call depending level of nesting of file) moreover, I a while loop more readable</technical_language>

Target:
private static PyClassDefTree getParentClassDef(Tree current) { while (current != null) { if (current.is(Tree.Kind.CLASSDEF)) { return (PyClassDefTree) current; } current = current.parent(); } return null; }
Source:
<code>private void signJar(File outputFile) { SecurityLogger.audit("Signing exported data. file: [{}]", outputFile.getName()); console.println("Signing zip file..."); Instant start = Instant.now(); try { String alias = System.getProperty(SystemBaseUrl.EXTERNAL_HOST); String password = System.getProperty("javax.net.ssl.keyStorePassword"); byte[] signature = <START> signer.createDigitalSignature(new FileInputStream(outputFile), alias, password); <END> if (signature != null) { String signatureFilepath = Paths.get(System.getProperty("ddf.home"), FILE_NAMER.apply("sig")).toString(); FileUtils.writeByteArrayToFile(new File(signatureFilepath), signature); console.println("zip file signed in: " + getFormattedDuration(start)); } else { console.println("An error occurred while signing export"); } } catch (CatalogCommandRuntimeException | IOException e) { String message = "Unable to sign export of data"; LOGGER.debug(message, e); console.println(message); } }</code><technical_language>inputstream closed</technical_language>

Target:
private void signJar(File outputFile) { SecurityLogger.audit("Signing exported data. file: [{}]", outputFile.getName()); console.println("Signing zip file..."); Instant start = Instant.now(); try (InputStream inputStream = new FileInputStream(outputFile)) { String alias = AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(SystemBaseUrl.EXTERNAL_HOST)); String password = AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStorePassword")); byte[] signature = signer.createDigitalSignature(inputStream, alias, password); if (signature != null) { String signatureFilepath = Paths.get(System.getProperty("ddf.home"), FILE_NAMER.apply("sig")).toString(); FileUtils.writeByteArrayToFile(new File(signatureFilepath), signature); console.println("zip file signed in: " + getFormattedDuration(start)); } else { console.println("An error occurred while signing export"); } } catch (CatalogCommandRuntimeException | IOException e) { String message = "Unable to sign export of data"; LOGGER.debug(message, e); console.println(message); } }
Source:
<code>public List<Tree.Kind> nodesToVisit() { <START> return Collections.singletonList(Tree.Kind.METHOD); <END> }</code><technical_language>register CONSTRUCTOR, "special" methods. more sense target kinds of methods</technical_language>

Target:
public List<Tree.Kind> nodesToVisit() { return ImmutableList.of(Tree.Kind.METHOD, Tree.Kind.CONSTRUCTOR); }
Source:
<code>public void start(ComponentContext context) { Collection<AvroReplacementDescriptor> replacements = replacementDescriptors.getDescriptors(); Collection<AvroSchemaFactoryDescriptor> descriptors = schemaFactoryDescriptors.getDescriptors(); AvroSchemaFactoryServiceImpl schemaFactoryService = new AvroSchemaFactoryServiceImpl(replacements); AvroSchemaFactoryContext avroContext = schemaFactoryService.createContext(); Map<Class<?>, Class<AvroSchemaFactory<?>>> factories = new HashMap<>(descriptors.size()); for (AvroSchemaFactoryDescriptor d : descriptors) { try { Class<Object> type = (Class<Object>) Class.forName(d.type); Class<AvroSchemaFactory<?>> factory = (Class<AvroSchemaFactory<?>>) Class.forName(d.clazz); Constructor<AvroSchemaFactory<?>> constructor = factory.getConstructor(AvroSchemaFactoryContext.class); constructor.newInstance(avroContext); factories.put(type, factory); } catch (ReflectiveOperationException | SecurityException e) { <START> log.error(e); <END> } } schemaFactoryService.setFactories(factories); this.schemaFactoryService = schemaFactoryService; schemaStoreService = new AvroSchemaStoreServiceImpl(); for (AvroSchemaDescriptor descriptor : schemaDescriptors.getDescriptors()) { URL url = context.getRuntimeContext().getResource(descriptor.file); try (InputStream stream = url == null ? null : url.openStream()) { if (stream == null) { log.error(String.format("Could not load stream for file %s.", descriptor.file)); return; } schemaStoreService.addSchema(new Schema.Parser().parse(stream)); } catch (IOException e) { log.error(e); } } }</code><technical_language>Throw exception instead</technical_language>

Target:
public void start(ComponentContext context) { buildSchemaFactoryService(); buildSchemaStoreService(context); }
Source:
<code>Definitions toDefinitions(final InputStream inputStream) { try (InputStreamReader reader = toInputStreamReader(inputStream)) { return marshaller.unmarshal(reader); } catch (IOException ioe) { } finally { try { inputStream.close(); <START> } catch (IOException ioe) { <END> } } return null; }</code><technical_language>this simplified? java Definitions toDefinitions(final InputStream inputStream) { try (InputStream inputStreamAutoclosable = inputStream; InputStreamReader reader = toInputStreamReader(inputStreamAutoclosable)) { return marshaller.unmarshal(reader); } catch (IOException ioe) { //Swallow. null is returned default. } return null; }</technical_language>

Target:
Definitions toDefinitions(final InputStream inputStream) { try (InputStream inputStreamAutoClosable = inputStream; InputStreamReader reader = toInputStreamReader(inputStreamAutoClosable)) { return marshaller.unmarshal(reader); } catch (IOException ioe) { } return null; }
Source:
<code>CommandExecutor(CommandCoordinatorImpl coco) { this.coco = coco; SchedulerUtil scheduler = Injector.get(SchedulerUtilQuartzImpl.class); scheduler.scheduleAFixedDelayJob(this, "invokeCallbackMethods", new Class[]{}, <START> new Object[]{}, 1, 1, TimeUnit.SECONDS); <END> }</code><technical_language>replace POLLING_RATE is a constant private static final int POLLING_RATE = 1; statement scheduler.scheduleAFixedDelayJob(this, "invokeCallbackMethods", new Class[]{}, new Object[]{}, POLLING_RATE, POLLING_RATE, TimeUnit.SECONDS);</technical_language>

Target:
CommandExecutor(CommandCoordinatorImpl coco) { this.coco = coco; SchedulerUtil scheduler = Injector.get(SchedulerUtilQuartzImpl.class); scheduler.scheduleAFixedDelayJob(this, "invokeCallbackMethods", new Class[]{}, new Object[]{}, POLLING_RATE, POLLING_RATE, TimeUnit.SECONDS); }
Source:
<code>protected LogLag getLagForPartition(String name, int partition, String group) { long pos; <START> File path = new File(basePath.toFile(), name); <END> try (ChronicleLogOffsetTracker offsetTracker = new ChronicleLogOffsetTracker(path.toString(), partition, group)) { pos = offsetTracker.readLastCommittedOffset(); } ChronicleLogAppender appender = (ChronicleLogAppender) getAppender(name); if (pos == 0) { pos = appender.firstOffset(partition); } long end = appender.endOffset(partition); long lag = appender.countMessages(partition, pos, end); long firstOffset = appender.firstOffset(partition); long endMessages = appender.countMessages(partition, firstOffset, end); return new LogLag(pos, end, lag, endMessages); }</code><technical_language>replace basePath.resolve(name) it, conversion String is easier</technical_language>

Target:
protected LogLag getLagForPartition(String name, int partition, String group) { long pos; Path path = basePath.resolve(name); try (ChronicleLogOffsetTracker offsetTracker = new ChronicleLogOffsetTracker(path.toString(), partition, group)) { pos = offsetTracker.readLastCommittedOffset(); } ChronicleLogAppender appender = (ChronicleLogAppender) getAppender(name); if (pos == 0) { pos = appender.firstOffset(partition); } long end = appender.endOffset(partition); long lag = appender.countMessages(partition, pos, end); long firstOffset = appender.firstOffset(partition); long endMessages = appender.countMessages(partition, firstOffset, end); return new LogLag(pos, end, lag, endMessages); }
Source:
<code>protected void trackString(GrammarAST t) { if ( currentRuleName==null && grammar.type==Grammar.LEXER ) { ErrorManager.grammarError(ErrorManager.MSG_CANNOT_ALIAS_TOKENS_IN_LEXER, grammar, t.token, t.getText()); return; } if ( grammar.getGrammarIsRoot() && grammar.type==Grammar.PARSER && grammar.getTokenType(t.getText())== Label.INVALID ) { ErrorManager.grammarError(ErrorManager.MSG_LITERAL_NOT_ASSOCIATED_WITH_LEXER_RULE, grammar, t.token, t.getText()); } if ( grammar.type==Grammar.LEXER ) { return; } String tokenVocab = (String) grammar.getOption("tokenVocab"); boolean hasTokenVocabAndIsParserOrCombined = tokenVocab != null && (grammar.type == Grammar.PARSER || grammar.type == Grammar.COMBINED); if ( (currentRuleName==null || Character.isLowerCase(currentRuleName.charAt(0))) && (hasTokenVocabAndIsParserOrCombined || <START> grammar.getTokenType(t.getText())==Label.INVALID )) <END> { stringLiterals.put(t.getText(), UNASSIGNED_IN_PARSER_RULE); } }</code><technical_language>convinced this is completely correct. 1. do change behavior for parser grammars? A parser grammar a tokenVocab = LexerGrammarName, lexer grammar name a tokenVocab = CustomTokensFile. appears combined grammars impacted scenario describing. 2. condition assume imported tokenVocab defines tokens referenced in parser? if referenced tokenVocab file is empty, define a literal is referenced in a parser rule</technical_language>

Target:
protected void trackString(GrammarAST t) { if ( currentRuleName==null && grammar.type==Grammar.LEXER ) { ErrorManager.grammarError(ErrorManager.MSG_CANNOT_ALIAS_TOKENS_IN_LEXER, grammar, t.token, t.getText()); return; } if ( grammar.getGrammarIsRoot() && grammar.type==Grammar.PARSER && grammar.getTokenType(t.getText())== Label.INVALID ) { ErrorManager.grammarError(ErrorManager.MSG_LITERAL_NOT_ASSOCIATED_WITH_LEXER_RULE, grammar, t.token, t.getText()); } if ( grammar.type==Grammar.LEXER ) { return; } String tokenVocab = (String) grammar.getOption("tokenVocab"); boolean hasTokenVocabAndIsCombinedParser = tokenVocab != null && grammar.type == Grammar.COMBINED; if ( (currentRuleName==null || Character.isLowerCase(currentRuleName.charAt(0))) && (hasTokenVocabAndIsCombinedParser || grammar.getTokenType(t.getText())==Label.INVALID )) { stringLiterals.put(t.getText(), UNASSIGNED_IN_PARSER_RULE); } }
Source:
<code>public boolean isReviewer(ReviewDb db, @Nullable ChangeData cd) throws OrmException { if (getCurrentUser().isIdentifiedUser()) { <START> Collection<Account.Id> results; if (cd != null) { results = cd.reviewers(Providers.of(db)).values(); } else { results = approvalsUtil.getReviewers(db, change.getId()).values(); } IdentifiedUser user = (IdentifiedUser) getCurrentUser(); <END> return results.contains(user.getAccountId()); } return false; }</code><technical_language>nit: do ternary form Collection<Account.Id> results = (cd != null) ? cd.reviewers(Providers.of(db)).values() : approvalsUtil.getReviewers(db, change.getId()).values();</technical_language>

Target:
public boolean isReviewer(ReviewDb db, @Nullable ChangeData cd) throws OrmException { if (getCurrentUser().isIdentifiedUser()) { Collection<Account.Id> results = cd != null ? cd.reviewers(Providers.of(db)).values() : approvalsUtil.getReviewers(db, change.getId()).values(); IdentifiedUser user = (IdentifiedUser) getCurrentUser(); return results.contains(user.getAccountId()); } return false; }
Source:
<code>private void scheduleJobs(long regularInterval, long initialInterval) { <START> executor.scheduleWithFixedDelay(() -> refresh(), <END> initialInterval, regularInterval, TimeUnit.MINUTES); }</code><technical_language>this::refresh</technical_language>

Target:
private void scheduleJobs(long regularInterval, long initialInterval) { executor.scheduleWithFixedDelay(this::refresh, initialInterval, regularInterval, TimeUnit.MINUTES); }
Source:
<code>private Direction getOpposite(){ <START> return opposite; <END> }</code><technical_language>missing field qualifier</technical_language>

Target:
public Direction getOpposite() { return this.opposite; }
Source:
<code>public void testPartialSpecializationResolution_525288() throws Exception { CPPASTNameBase.sAllowNameComputation = true; String code = getAboveComment(); IFile file = importFile("testBug525288.cpp", code); int offset = code.indexOf("a0") - 5; IASTNode target = testF3(file, offset); assertInstance(target, IASTName.class); assertEquals("A<0>", ((IASTName) target).toString()); offset = code.indexOf("a1") - 5; target = testF3(file, offset); assertInstance(target, IASTName.class); assertEquals("A", ((IASTName) target).toString()); offset = code.indexOf("a1") - 7; <START> target = testF3(file, offset); <END> }</code><technical_language>I sense put this a separate test, "testEmptySpace"</technical_language>

Target:
public void testPartialSpecializationResolution_525288() throws Exception { CPPASTNameBase.sAllowNameComputation = true; String code = getAboveComment(); IFile file = importFile("testBug525288.cpp", code); int offset = code.indexOf("a0") - 5; IASTNode target = testF3(file, offset); assertInstance(target, IASTName.class); assertEquals("A<0>", ((IASTName) target).toString()); offset = code.indexOf("a1") - 5; target = testF3(file, offset); assertInstance(target, IASTName.class); assertEquals("A", ((IASTName) target).toString()); }
Source:
<code>public SecretClientBuilder vaultUrl(String vaultUrl) { try { this.vaultUrl = new URL(vaultUrl); } catch (MalformedURLException e) { <START> throw logger.logExceptionAsError(new IllegalArgumentException( <END> "The Azure Key Vault endpoint url is malformed.")); } return this; }</code><technical_language>Need pass exception object</technical_language>

Target:
public SecretClientBuilder vaultUrl(String vaultUrl) { try { this.vaultUrl = new URL(vaultUrl); } catch (MalformedURLException e) { throw logger.logExceptionAsError(new IllegalArgumentException( "The Azure Key Vault url is malformed.", e)); } return this; }
Source:
<code>public Map<?, ?> merge(Map<?, ?>... items) { if (ArrayUtils.isEmpty(items)) { return Collections.emptyMap(); } Map<Object, Object> result = new HashMap<Object, Object>(); <START> Arrays.stream(items).filter(Objects::nonNull).forEach(item -> result.putAll(item)); <END> return result; }</code><technical_language>forEach is designed for side effect, a chained stream me</technical_language>

Target:
public Map<?, ?> merge(Map<?, ?>... items) { if (ArrayUtils.isEmpty(items)) { return Collections.emptyMap(); } Map<Object, Object> result = Arrays.stream(items).filter(Objects::nonNull).map(Map::entrySet) .flatMap(Set::stream).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); return result; }
Source:
<code>protected BufferedMergeJoinIterator(Iterator<ExecRow> sourceIterator) throws StandardException { <START> this.sourceIterator = Iterators.peekingIterator(sourceIterator);; <END> joinOperation = getOperation(); initialized = true; fillBuffer(); if (bufferedRowList.isEmpty()) { mergeJoinIterator = Collections.emptyIterator(); } }</code><technical_language>Please remove extra semi-column</technical_language>

Target:
protected BufferedMergeJoinIterator(Iterator<ExecRow> sourceIterator) throws StandardException { this.sourceIterator = Iterators.peekingIterator(sourceIterator); joinOperation = getOperation(); initialized = true; fillBuffer(); if (bufferedRowList.isEmpty()) { mergeJoinIterator = Collections.emptyIterator(); } }
Source:
<code>public void test_FhirResourceGetHistory() throws Exception { FhirResourcePatch.fhirResourcePatch( fhirResourceName, <START> "[{\"op\": \"add\", \"path\": \"/active\", \"value\": false}]"); String versionId; Matcher idMatcher = Pattern.compile("\"versionId\": \"(.*)\"").matcher(bout.toString()); <END> assertTrue(idMatcher.find()); versionId = idMatcher.group(1); FhirResourceGetHistory.fhirResourceGetHistory(fhirResourceName, versionId); String output = bout.toString(); assertThat(output, containsString("FHIR resource history list retrieved:")); }</code><technical_language>This is fine for tests, in samples, prefer json objects Guava's GSON, Jackson, org.json JAVA-Json</technical_language>

Target:
public void test_FhirResourceGetHistory() throws Exception { JsonObject json = new JsonObject(); json.add("op", new JsonPrimitive("add")); json.add("path", new JsonPrimitive("/active")); json.add("value", new JsonPrimitive(false)); JsonArray jarray = new JsonArray(); jarray.add(json); FhirResourcePatch.fhirResourcePatch(fhirResourceName, jarray.toString()); String versionId; Matcher idMatcher = Pattern.compile("\"versionId\": \"(.*)\"").matcher(bout.toString()); assertTrue(idMatcher.find()); versionId = idMatcher.group(1); FhirResourceGetHistory.fhirResourceGetHistory(fhirResourceName, versionId); String output = bout.toString(); assertThat(output, containsString("FHIR resource history list retrieved:")); }
Source:
<code>void prepare() throws IOException { <START> } <END></code><technical_language>empty function? qualifier (public,private)</technical_language>

Target:
public void prepare() throws IOException { }
Source:
<code>public Map<RowColumn, Bytes> get(Collection<RowColumn> rowColumns) { checkIfOpen(); if (rowColumns.size() == 0) { return Collections.emptyMap(); } ParallelSnapshotScanner pss = new ParallelSnapshotScanner(rowColumns, env, startTs, stats); Map<Bytes, Map<Column, Bytes>> ret = pss.scan(); Map<RowColumn, Bytes> bet = new HashMap<>(); for (Entry<Bytes, Map<Column, Bytes>> entry : ret.entrySet()) { updateColumnsRead(entry.getKey(), entry.getValue().keySet()); for (Entry<Column, Bytes> cols : entry.getValue().entrySet()) { <START> bet.put(new RowColumn(cols.getValue()), cols.getValue()); <END> } } return bet; }</code><technical_language>cols called colVal. need row col. entry in outer loop row. entry in loop col value. java for (Entry<Bytes, Map<Column, Bytes>> entry : ret.entrySet()) { updateColumnsRead(entry.getKey(), entry.getValue().keySet()); for (Entry<Column, Bytes> colVal : entry.getValue().entrySet()) { Bytes row = entry.getKey(); Column col = colVal.getKey(); Bytes val = colVal.getValue(); bet.put(new RowColumn(row, col), val);</technical_language>

Target:
public Map<RowColumn, Bytes> get(Collection<RowColumn> rowColumns) { checkIfOpen(); if (rowColumns.size() == 0) { return Collections.emptyMap(); } ParallelSnapshotScanner pss = new ParallelSnapshotScanner(rowColumns, env, startTs, stats); Map<Bytes, Map<Column, Bytes>> scan = pss.scan(); Map<RowColumn, Bytes> ret = new HashMap<>(); for (Entry<Bytes, Map<Column, Bytes>> entry : scan.entrySet()) { updateColumnsRead(entry.getKey(), entry.getValue().keySet()); for (Entry<Column, Bytes> colVal : entry.getValue().entrySet()) { ret.put(new RowColumn(entry.getKey(), colVal.getKey()), colVal.getValue()); } } return ret; }
Source:
<code>protected VirtualMachineMO findVmOnDatacenter(VmwareContext context, VmwareHypervisorHost hyperHost, VolumeTO vol) throws Exception { DatacenterMO dcMo = new DatacenterMO(context, hyperHost.getHyperHostDatacenter()); if (dcMo.getMor() == null) { String msg = "Unable to find VMware DC"; s_logger.error(msg); throw new CloudRuntimeException(msg); } <START> VirtualMachineMO vmMo = dcMo.findVm(vol.getPath()); <END> return vmMo; }</code><technical_language>here: return dcMo.findVm(vol.getPath()); then, save 1 line of code ;)</technical_language>

Target:
protected VirtualMachineMO findVmOnDatacenter(VmwareContext context, VmwareHypervisorHost hyperHost, VolumeTO vol) throws Exception { DatacenterMO dcMo = new DatacenterMO(context, hyperHost.getHyperHostDatacenter()); if (dcMo.getMor() == null) { String msg = "Unable to find VMware DC"; s_logger.error(msg); throw new CloudRuntimeException(msg); } return dcMo.findVm(vol.getPath()); }
Source:
<code>protected Map<String, ServerImpl> resolveExternalServers(String machineName) { Map<String, ServerImpl> serverMap = new HashMap<>(); <START> serverMap.putAll(nativeServerResolver.resolveExternalServers(machineName)); <END> serverMap.putAll( configMaps .get(machineName) .stream() .map(this::fillGatewayServers) .flatMap(m -> m.entrySet().stream()) .collect(Collectors.toMap(Entry::getKey, Entry::getValue, (s1, s2) -> s2))); return serverMap; }</code><technical_language>making resolveExternalServers(String) part of ServerResolver contract need depend native server resolver a subclass of AbstractServerResolver</technical_language>

Target:
public Map<String, ServerImpl> resolveExternalServers(String machineName) { Map<String, ServerImpl> serverMap = new HashMap<>(); serverMap.putAll(nativeServerResolver.resolveExternalServers(machineName)); serverMap.putAll( configMaps .get(machineName) .stream() .map(this::fillGatewayServers) .flatMap(m -> m.entrySet().stream()) .collect(Collectors.toMap(Entry::getKey, Entry::getValue, (s1, s2) -> s2))); return serverMap; }
Source:
<code>public String getNamespaceString() { if (namespace().isPresent()) { String namespace = namespace().get(); keyValueService().namespace().ifPresent(kvsNamespace -> Preconditions.checkState(kvsNamespace.equals(namespace), "If present, keyspace/dbName/sid config should be the same as the" + " atlas root-level namespace config.")); timelock().ifPresent(timelock -> timelock.client().ifPresent(client -> Preconditions.checkState(client.equals(namespace), "If present, the TimeLock client config should be the same as the" + " atlas root-level namespace config."))); return namespace; } else if (!(keyValueService() instanceof InMemoryAtlasDbConfig)) { Preconditions.checkState(keyValueService().namespace().isPresent(), "Either the atlas root-level namespace" + " or the keyspace/dbName/sid config needs to be set."); String keyValueServiceNamespace = keyValueService().namespace().get(); if (timelock().isPresent()) { TimeLockClientConfig timeLockConfig = timelock().get(); Preconditions.checkState(timeLockConfig.client().isPresent(), "Either the atlas root-level namespace config or the TimeLock client config" + " should be present."); Preconditions.checkState(timeLockConfig.client().equals(Optional.of(keyValueServiceNamespace)), "AtlasDB refused to start, in order to avoid potential data corruption." + " Please contact AtlasDB support to remediate this. Specific steps are required;" + " DO NOT ATTEMPT TO FIX THIS YOURSELF."); } return keyValueServiceNamespace; } else if (timelock().isPresent()) { Preconditions.checkState(timelock().get().client().isPresent(), "For InMemoryKVS, the TimeLock client should not be empty"); <START> return timelock().get().client().get(); <END> } return UNSPECIFIED_NAMESPACE; }</code><technical_language>nit: This if block written return timelock().get().client().orThrow(() -> new IllegalStateException("For InMemoryKVS..."));</technical_language>

Target:
public String getNamespaceString() { if (namespace == null) { namespace = checkNamespaceConfigAndGetNamespace(); } return namespace; }
Source:
<code>public void listModifyingBatchEnsureOnlyModifying() { Date startDate = createDate(2010, 1, 1); Date endDate = createDate(2050, 1, 1); Entitlement ent = setUpModifyingEntitlements(startDate, endDate, 3, "1"); Date startDate1 = createDate(2010, 1, 1); Date endDate1 = createDate(2050, 1, 1); Entitlement ent1 = setUpModifyingEntitlements(startDate1, endDate1, 2, "2"); Date startDate2 = createDate(2030, 1, 1); Date endDate2 = createDate(2040, 1, 1); Entitlement ent2 = setUpModifyingEntitlements(startDate2, endDate2, 2, "3"); Set<Entitlement> ents = entitlementCurator.listModifying(Arrays.asList(ent, ent1)); assertEquals(5, ents.size()); assertTrue(!ents.contains(ent)); assertTrue(!ents.contains(ent1)); assertTrue(!ents.contains(ent2)); <START> <END> }</code><technical_language>Extraneous whitespace</technical_language>

Target:
public void listModifyingBatchEnsureOnlyModifying() { Date startDate = createDate(2010, 1, 1); Date endDate = createDate(2050, 1, 1); Entitlement ent = setUpModifyingEntitlements(startDate, endDate, 3, "1"); Date startDate1 = createDate(2010, 1, 1); Date endDate1 = createDate(2050, 1, 1); Entitlement ent1 = setUpModifyingEntitlements(startDate1, endDate1, 2, "2"); Date startDate2 = createDate(2030, 1, 1); Date endDate2 = createDate(2040, 1, 1); Entitlement ent2 = setUpModifyingEntitlements(startDate2, endDate2, 2, "3"); Set<Entitlement> ents = entitlementCurator.listModifying(Arrays.asList(ent, ent1)); assertEquals(5, ents.size()); assertThat(ents, not(hasItems(ent))); assertThat(ents, not(hasItems(ent1))); assertThat(ents, not(hasItems(ent2))); }
Source:
<code>public Configuration getConfiguration(RuleLoaderContext ruleLoaderContext) { return ConfigurationBuilder .begin() .addRule() .when(FileContent.matches("{ip}").inFileNamed("{*}.{type}")) .perform(new AbstractIterationOperation<FileLocationModel>() { public void perform(GraphRewrite event, EvaluationContext context, FileLocationModel payload) { if (InetAddressValidator.getInstance().isValid(payload.getSourceSnippit())) { if (ignoreLine(event.getGraphContext(), payload)) { return; } if (payload.getFile() instanceof SourceFileModel) ((SourceFileModel) payload.getFile()).setGenerateSourceReport(true); HardcodedIPLocationModel location = GraphService.addTypeToModel(event.getGraphContext(), payload, HardcodedIPLocationModel.class); location.setRuleID(((Rule) context.get(Rule.class)).getId()); location.setTitle("Hard-coded IP Address Detected"); StringBuilder hintBody = new StringBuilder("**Hard-coded IP: "); hintBody.append(payload.getSourceSnippit()); hintBody.append("**"); hintBody.append("\n\n"); hintBody.append("When migrating environments, hard-coded IP addresses may need to be modified or eliminated."); location.setHint(hintBody.toString()); <START> location.setIssueCategory(IssueCategoryRegistry.loadFromGraph(context, "cloud-mandatory"); <END> location.setEffort(0); } } }) .where("ip").matches(IP_PATTERN) .where("type").matches("java|properties|xml") .withId(getClass().getSimpleName()); }</code><technical_language>Please add entry issuecategoryregistry instead of a string literal here</technical_language>

Target:
public Configuration getConfiguration(RuleLoaderContext ruleLoaderContext) { return ConfigurationBuilder .begin() .addRule() .when(FileContent.matches("{ip}").inFileNamed("{*}.{type}")) .perform(new AbstractIterationOperation<FileLocationModel>() { public void perform(GraphRewrite event, EvaluationContext context, FileLocationModel payload) { if (InetAddressValidator.getInstance().isValid(payload.getSourceSnippit())) { if (ignoreLine(event.getGraphContext(), payload)) { return; } if (payload.getFile() instanceof SourceFileModel) ((SourceFileModel) payload.getFile()).setGenerateSourceReport(true); HardcodedIPLocationModel location = GraphService.addTypeToModel(event.getGraphContext(), payload, HardcodedIPLocationModel.class); location.setRuleID(((Rule) context.get(Rule.class)).getId()); location.setTitle("Hard-coded IP Address Detected"); StringBuilder hintBody = new StringBuilder("**Hard-coded IP: "); hintBody.append(payload.getSourceSnippit()); hintBody.append("**"); hintBody.append("\n\n"); hintBody.append("When migrating environments, hard-coded IP addresses may need to be modified or eliminated."); location.setHint(hintBody.toString()); location.setIssueCategory(IssueCategoryRegistry.loadFromGraph(event.getGraphContext(), IssueCategoryRegistry.CLOUD_MANDATORY)); location.setEffort(1); } } }) .where("ip").matches(IP_PATTERN) .where("type").matches("java|properties|xml") .withId(getClass().getSimpleName()); }
Source:
<code>protected void displayViewStateText(EnumSet<LayerViewStatus> layerViewStatus) { List<String> stringList = new ArrayList<String>(); if (layerViewStatus.contains(LayerViewStatus.ACTIVE)) { stringList.add(getString(R.string.activeStateTextViewString)); } if (layerViewStatus.contains(LayerViewStatus.ERROR)) { <START> stringList.add(getString(R.string.errorStateTextViewString)); <END> } if (layerViewStatus.contains(LayerViewStatus.LOADING)) { stringList.add(getString(R.string.loadingStateTextViewString)); } if (layerViewStatus.contains(LayerViewStatus.NOT_VISIBLE)) { stringList.add(getString(R.string.notVisibleStateTextViewString)); } if (layerViewStatus.contains(LayerViewStatus.OUT_OF_SCALE)) { stringList.add(getString(R.string.outOfScaleStateTextViewString)); } if (layerViewStatus.contains(LayerViewStatus.WARNING)) { stringList.add(getString(R.string.warningStateTextViewString)); } activeStateTextView.setText(TextUtils.join(", ", stringList)); }</code><technical_language>suggestion stringList.add(getString(R.string.error_state_text _view_message));</technical_language>

Target:
protected void displayViewStateText(EnumSet<LayerViewStatus> layerViewStatus) { List<String> stringList = new ArrayList<String>(); if (layerViewStatus.contains(LayerViewStatus.ACTIVE)) { stringList.add(getString(R.string.active_state)); } if (layerViewStatus.contains(LayerViewStatus.ERROR)) { stringList.add(getString(R.string.error_state)); } if (layerViewStatus.contains(LayerViewStatus.LOADING)) { stringList.add(getString(R.string.loading_state)); } if (layerViewStatus.contains(LayerViewStatus.NOT_VISIBLE)) { stringList.add(getString(R.string.not_visible_state)); } if (layerViewStatus.contains(LayerViewStatus.OUT_OF_SCALE)) { stringList.add(getString(R.string.out_of_scale_state)); } if (layerViewStatus.contains(LayerViewStatus.WARNING)) { stringList.add(getString(R.string.warning_state)); } activeStateTextView.setText(TextUtils.join(", ", stringList)); }