You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Ryan Skraba (Jira)" <ji...@apache.org> on 2019/10/22 14:29:00 UTC

[jira] [Updated] (AVRO-2561) java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2

     [ https://issues.apache.org/jira/browse/AVRO-2561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ryan Skraba updated AVRO-2561:
------------------------------
    Description: 
I had the following exception when running {{avro-tools}}.

These are the steps to reproduce:

{noformat}
brew install avro-tools
avro-tools fromjson --schema-file twitter.avsc twitter.json
{noformat}

{noformat}
Exception in thread "main" java.lang.ExceptionInInitializerError
 at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:80)
 at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:2823)
 at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:2818)
 at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2684)
 at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:373)
 at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:172)
 at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:357)
 at org.apache.hadoop.fs.Path.getFileSystem(Path.java:295)
 at org.apache.avro.tool.Util.openFromFS(Util.java:88)
 at org.apache.avro.tool.Util.parseSchemaFromFS(Util.java:166)
 at org.apache.avro.tool.DataFileWriteTool.run(DataFileWriteTool.java:75)
 at org.apache.avro.tool.Main.run(Main.java:66)
 at org.apache.avro.tool.Main.main(Main.java:55)
Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2
 at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3410)
 at java.base/java.lang.String.substring(String.java:1883)
 at org.apache.hadoop.util.Shell.<clinit>(Shell.java:52)
 ... 13 more
{noformat}

*twitter.avsc*

{code:json}
{
 "type" : "record",
 "name" : "twitter_schema",
 "namespace" : "com.miguno.avro",
 "fields" : [ {
 "name" : "username",
 "type" : "string",
 "doc" : "Name of the user account on Twitter.com"
 }, {
 "name" : "tweet",
 "type" : "string",
 "doc" : "The content of the user's Twitter message"
 }, {
 "name" : "timestamp",
 "type" : "long",
 "doc" : "Unix epoch time in seconds"
 } ],
 "doc:" : "A basic schema for storing Twitter messages"
}
{code}

*twitter.json*

{code:json}
{"username":"miguno","tweet":"Rock: Nerf paper, scissors is fine.","timestamp": 1366150681 }
{"username":"BlizzardCS","tweet":"Works as intended. Terran is IMBA.","timestamp": 1366154481 }
{code}
 

  was:
I had the following exception when running `arvo-tools`.

 

These are the steps to reproduce:

 

```

brew install avro-tools

avro-tools fromjson --schema-file twitter.avsc twitter.json

```

```

Exception in thread "main" java.lang.ExceptionInInitializerError
 at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:80)
 at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:2823)
 at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:2818)
 at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2684)
 at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:373)
 at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:172)
 at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:357)
 at org.apache.hadoop.fs.Path.getFileSystem(Path.java:295)
 at org.apache.avro.tool.Util.openFromFS(Util.java:88)
 at org.apache.avro.tool.Util.parseSchemaFromFS(Util.java:166)
 at org.apache.avro.tool.DataFileWriteTool.run(DataFileWriteTool.java:75)
 at org.apache.avro.tool.Main.run(Main.java:66)
 at org.apache.avro.tool.Main.main(Main.java:55)
Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2
 at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3410)
 at java.base/java.lang.String.substring(String.java:1883)
 at org.apache.hadoop.util.Shell.<clinit>(Shell.java:52)
 ... 13 more

```

 

twitter.avsc

```

{
 "type" : "record",
 "name" : "twitter_schema",
 "namespace" : "com.miguno.avro",
 "fields" : [ {
 "name" : "username",
 "type" : "string",
 "doc" : "Name of the user account on Twitter.com"
 }, {
 "name" : "tweet",
 "type" : "string",
 "doc" : "The content of the user's Twitter message"
 }, {
 "name" : "timestamp",
 "type" : "long",
 "doc" : "Unix epoch time in seconds"
 } ],
 "doc:" : "A basic schema for storing Twitter messages"
}

```

 

twitter.json

```

{"username":"miguno","tweet":"Rock: Nerf paper, scissors is fine.","timestamp": 1366150681 }
{"username":"BlizzardCS","tweet":"Works as intended. Terran is IMBA.","timestamp": 1366154481 }

```

 


> java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2
> -------------------------------------------------------------------
>
>                 Key: AVRO-2561
>                 URL: https://issues.apache.org/jira/browse/AVRO-2561
>             Project: Apache Avro
>          Issue Type: Bug
>            Reporter: Leo
>            Priority: Major
>
> I had the following exception when running {{avro-tools}}.
> These are the steps to reproduce:
> {noformat}
> brew install avro-tools
> avro-tools fromjson --schema-file twitter.avsc twitter.json
> {noformat}
> {noformat}
> Exception in thread "main" java.lang.ExceptionInInitializerError
>  at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:80)
>  at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:2823)
>  at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:2818)
>  at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2684)
>  at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:373)
>  at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:172)
>  at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:357)
>  at org.apache.hadoop.fs.Path.getFileSystem(Path.java:295)
>  at org.apache.avro.tool.Util.openFromFS(Util.java:88)
>  at org.apache.avro.tool.Util.parseSchemaFromFS(Util.java:166)
>  at org.apache.avro.tool.DataFileWriteTool.run(DataFileWriteTool.java:75)
>  at org.apache.avro.tool.Main.run(Main.java:66)
>  at org.apache.avro.tool.Main.main(Main.java:55)
> Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2
>  at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3410)
>  at java.base/java.lang.String.substring(String.java:1883)
>  at org.apache.hadoop.util.Shell.<clinit>(Shell.java:52)
>  ... 13 more
> {noformat}
> *twitter.avsc*
> {code:json}
> {
>  "type" : "record",
>  "name" : "twitter_schema",
>  "namespace" : "com.miguno.avro",
>  "fields" : [ {
>  "name" : "username",
>  "type" : "string",
>  "doc" : "Name of the user account on Twitter.com"
>  }, {
>  "name" : "tweet",
>  "type" : "string",
>  "doc" : "The content of the user's Twitter message"
>  }, {
>  "name" : "timestamp",
>  "type" : "long",
>  "doc" : "Unix epoch time in seconds"
>  } ],
>  "doc:" : "A basic schema for storing Twitter messages"
> }
> {code}
> *twitter.json*
> {code:json}
> {"username":"miguno","tweet":"Rock: Nerf paper, scissors is fine.","timestamp": 1366150681 }
> {"username":"BlizzardCS","tweet":"Works as intended. Terran is IMBA.","timestamp": 1366154481 }
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)