Skip to content

Commit

Permalink
fix Fatal error: length > 1 in coercion to logical
Browse files Browse the repository at this point in the history
  • Loading branch information
marekjagielski committed Mar 9, 2019
1 parent 6d8c8d3 commit 9546379
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
@@ -1,8 +1,8 @@
Package: thriftr
Type: Package
Title: Apache Thrift Client Server
Version: 1.1.3
Date: 2019-03-08
Version: 1.1.4
Date: 2019-03-09
Authors@R: c(person("Marek", "Jagielski",
role = c("aut", "cre", "cph"),
email = "marek.jagielski@gmail.com"),
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
@@ -1,3 +1,9 @@
### Changes in v1.1.4

#### BUG FIXES

1. Fix 'length > 1 in coercion to logical'

### Changes in v1.1.1

#### BUG FIXES
Expand Down
8 changes: 4 additions & 4 deletions R/parser.R
Expand Up @@ -36,7 +36,7 @@
#' @export
t_load <- function(path, module_name=NA, include_dirs=NA) {
thrift <- parse(path, module_name, include_dirs = include_dirs)
if (length(ls(incomplete_type$dict)) > 0) {
if (length(names(incomplete_type$dict)) > 0) {
fill_incomplete_ttype(thrift, thrift)
}

Expand All @@ -50,7 +50,7 @@ fill_incomplete_ttype <- function(tmodule, definition) {
# fill incomplete ttype
if (type == "list") {
# fill const value
if (definition[[1]] == 'UNKNOWN_CONST') {
if (typeof(definition[[1]]) == "character" && definition[[1]] == 'UNKNOWN_CONST') {
ttype <- get_definition(
tmodule, incomplete_type$dict[[as.character(definition[[2]])]][[1]], definition[[4]])
return(Parser$new()$cast(ttype)(definition[[3]]))
Expand All @@ -61,7 +61,7 @@ fill_incomplete_ttype <- function(tmodule, definition) {
return(list(definition[[1]], get_definition(tmodule, it[[1]], it[[2]])))
}
# fill service method which has incomplete arg, return ttype
else if (definition[[1]] %in% names(incomplete_type$dict)) {
else if (typeof(definition[[1]]) == "character" && definition[[1]] %in% names(incomplete_type$dict)) {
it <- incomplete_type$dict[[as.character(definition[[1]])]]
real_type <- get_definition(tmodule, it[[1]], it[[2]])
return(list(real_type[[1]], definition[[2]], real_type[[2]], definition[[3]]))
Expand Down Expand Up @@ -386,7 +386,7 @@ Lexer <- R6::R6Class("Lexer",
i <- i + 1
if (substr(s, i, i) %in% maps) val <- val + maps[[substr(s, i, i)]]
else {
msg <- sprintf("Unexcepted escaping characher: %s", substr(s, i, i))
msg <- sprintf("Unexcepted escaping character: %s", substr(s, i, i))
stop("[ThriftLexerError]", msg)
}
} else val <- paste(val, substr(s, i, i), sep = "")
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -4,7 +4,7 @@

<groupId>thriftr</groupId>
<artifactId>thriftr</artifactId>
<version>1.1.3</version>
<version>1.1.4</version>
<packaging>pom</packaging>
<name>Apache Thrift Client Server</name>

Expand Down

0 comments on commit 9546379

Please sign in to comment.