Skip to content

Commit

Permalink
missing XML as requireNamespace in thredds/ncml/ncdf handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Oct 12, 2023
1 parent 2ed8230 commit b63670d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions inst/metadata/entity/entity_handler_ncdf.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ handle_entities_ncdf <- function(handler, source, config, handle = TRUE){
if(!requireNamespace("ncdf4", quietly = TRUE)){
stop("The NCDF handler requires the 'ncdf4' package")
}
if(!requireNamespace("XML", quietly = TRUE)){
stop("The NCDF handler requires the 'XML' package")
}

#if(!mime::guess_type(source)=="application/x-netcdf"){
# errMsg <- "Error in 'handle_entities_df': source parameter should be an 'netcdf' file"
Expand Down
4 changes: 4 additions & 0 deletions inst/metadata/entity/entity_handler_ncml.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ handle_entities_ncml <- function(handler, source, config, handle = TRUE){

config$logger.info("NCML Handle")

if(!requireNamespace("XML", quietly = TRUE)){
stop("The NCML handler requires the 'XML' package")
}

getNCML <- function(file){

xml <- XML::xmlParse(httr::content(httr::GET(file),"text"))
Expand Down
5 changes: 4 additions & 1 deletion inst/metadata/entity/entity_handler_thredds.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ handle_entities_thredds <- function(handler, source, config){
stop("The Thredds handler requires the 'thredds' package")
}
if(!requireNamespace("ncdf4", quietly = TRUE)){
stop("The NCDF handler requires the 'ncdf4' package")
stop("The Thredds handler requires the 'ncdf4' package")
}
if(!requireNamespace("XML", quietly = TRUE)){
stop("The Thredds handler requires the 'XML' package")
}

thredds <- config$software$input$thredds
Expand Down

0 comments on commit b63670d

Please sign in to comment.