[jira] [Commented] (AVRO-2127) Throwing more specific exception if an avro file has currupted magic

2018-11-08 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/AVRO-2127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16680057#comment-16680057
 ] 

ASF subversion and git services commented on AVRO-2127:
---

Commit c6f772b408046c61b3269d8aecc5f1684bcad6fb in avro's branch 
refs/heads/master from Vladislav
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=c6f772b ]

AVRO-2127: throw more specific exceptions from DataFileStream#initialize (#323)

* AVRO-2127: throw more specific exceptions from DataFileStream#initialize

* AVRO-2127: throw more specific exceptions from DataFileReader12


> Throwing more specific exception if an avro file has currupted magic
> 
>
> Key: AVRO-2127
> URL: https://issues.apache.org/jira/browse/AVRO-2127
> Project: Apache Avro
>  Issue Type: Improvement
>  Components: java
>Affects Versions: 1.8.2
>Reporter: Dmitrii Bundin
>Assignee: Dmitrii Bundin
>Priority: Minor
>
> Curently we have IOException thrown if an avro file has incorrect magic. 
> It seems reasonable to throw a subclass of IOException to be able to handle 
> incorrect magic (in case length are match) in user code.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (AVRO-2127) Throwing more specific exception if an avro file has currupted magic

2018-11-08 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/AVRO-2127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16680064#comment-16680064
 ] 

ASF GitHub Bot commented on AVRO-2127:
--

dkulp closed pull request #273: AVRO-2127 Make InvalidAvroMagicException thrown 
if stream header is corrupted
URL: https://github.com/apache/avro/pull/273
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java 
b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
index 0d5e5c1b7..8c0279fd8 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
@@ -47,7 +47,7 @@
  DatumReader reader)
 throws IOException {
 if (in.length() < MAGIC.length)
-  throw new IOException("Not an Avro data file");
+  throw new EOFException("Not an Avro data file");
 
 // read magic header
 byte[] magic = new byte[MAGIC.length];
@@ -60,7 +60,7 @@
 if (Arrays.equals(DataFileReader12.MAGIC, magic)) // 1.2 format
   return new DataFileReader12(in, reader);
 
-throw new IOException("Not an Avro data file");
+throw new InvalidAvroMagicException("Not an Avro data file");
   }
 
   /**
diff --git 
a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java 
b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java
index 0a2747666..f1803f8a0 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java
@@ -102,7 +102,7 @@ void initialize(InputStream in) throws IOException {
   throw new IOException("Not an Avro data file.", e);
 }
 if (!Arrays.equals(DataFileConstants.MAGIC, magic))
-  throw new IOException("Not an Avro data file.");
+  throw new InvalidAvroMagicException("Not an Avro data file.");
 
 long l = vin.readMapStart();  // read meta data
 if (l > 0) {
diff --git 
a/lang/java/avro/src/main/java/org/apache/avro/file/InvalidAvroMagicException.java
 
b/lang/java/avro/src/main/java/org/apache/avro/file/InvalidAvroMagicException.java
new file mode 100644
index 0..ae27dc381
--- /dev/null
+++ 
b/lang/java/avro/src/main/java/org/apache/avro/file/InvalidAvroMagicException.java
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.avro.file;
+
+import java.io.IOException;
+
+public class InvalidAvroMagicException extends IOException {
+public InvalidAvroMagicException(String message){ super(message); }
+}


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Throwing more specific exception if an avro file has currupted magic
> 
>
> Key: AVRO-2127
> URL: https://issues.apache.org/jira/browse/AVRO-2127
> Project: Apache Avro
>  Issue Type: Improvement
>  Components: java
>Affects Versions: 1.8.2
>Reporter: Dmitrii Bundin
>Assignee: Dmitrii Bundin
>Priority: Minor
>
> Curently we have IOException thrown if an avro file has incorrect magic. 
> It seems reasonable to throw a subclass of IOException to be able to handle 
> incorrect magic (in case length are match) in user code.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (AVRO-2127) Throwing more specific exception if an avro file has currupted magic

2018-11-08 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/AVRO-2127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16680053#comment-16680053
 ] 

ASF GitHub Bot commented on AVRO-2127:
--

dkulp closed pull request #323: AVRO-2127: throw more specific exceptions from 
DataFileStream#initialize
URL: https://github.com/apache/avro/pull/323
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/lang/java/avro/src/main/java/org/apache/avro/InvalidAvroMagicException.java 
b/lang/java/avro/src/main/java/org/apache/avro/InvalidAvroMagicException.java
new file mode 100644
index 0..6519ad800
--- /dev/null
+++ 
b/lang/java/avro/src/main/java/org/apache/avro/InvalidAvroMagicException.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.avro;
+
+import java.io.IOException;
+
+public class InvalidAvroMagicException extends IOException {
+  public InvalidAvroMagicException(String message) {
+super(message);
+  }
+}
diff --git 
a/lang/java/avro/src/main/java/org/apache/avro/InvalidNumberEncodingException.java
 
b/lang/java/avro/src/main/java/org/apache/avro/InvalidNumberEncodingException.java
new file mode 100644
index 0..fe5408f2d
--- /dev/null
+++ 
b/lang/java/avro/src/main/java/org/apache/avro/InvalidNumberEncodingException.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.avro;
+
+import java.io.IOException;
+
+public class InvalidNumberEncodingException extends IOException {
+  public InvalidNumberEncodingException(String message) {
+super(message);
+  }
+}
diff --git 
a/lang/java/avro/src/main/java/org/apache/avro/UnknownAvroCodecException.java 
b/lang/java/avro/src/main/java/org/apache/avro/UnknownAvroCodecException.java
new file mode 100644
index 0..abeb69c40
--- /dev/null
+++ 
b/lang/java/avro/src/main/java/org/apache/avro/UnknownAvroCodecException.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.avro;
+
+import java.io.IOException;
+
+public class UnknownAvroCodecException extends IOException {
+  public UnknownAvroCodecException(String message) {
+super(message);
+  }
+}
diff --git 
a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java 
b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
index ba0daa5ea..0c399a9e5 100644
--- 

[jira] [Commented] (AVRO-2127) Throwing more specific exception if an avro file has currupted magic

2018-11-08 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/AVRO-2127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16680056#comment-16680056
 ] 

ASF subversion and git services commented on AVRO-2127:
---

Commit c6f772b408046c61b3269d8aecc5f1684bcad6fb in avro's branch 
refs/heads/master from Vladislav
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=c6f772b ]

AVRO-2127: throw more specific exceptions from DataFileStream#initialize (#323)

* AVRO-2127: throw more specific exceptions from DataFileStream#initialize

* AVRO-2127: throw more specific exceptions from DataFileReader12


> Throwing more specific exception if an avro file has currupted magic
> 
>
> Key: AVRO-2127
> URL: https://issues.apache.org/jira/browse/AVRO-2127
> Project: Apache Avro
>  Issue Type: Improvement
>  Components: java
>Affects Versions: 1.8.2
>Reporter: Dmitrii Bundin
>Assignee: Dmitrii Bundin
>Priority: Minor
>
> Curently we have IOException thrown if an avro file has incorrect magic. 
> It seems reasonable to throw a subclass of IOException to be able to handle 
> incorrect magic (in case length are match) in user code.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (AVRO-2127) Throwing more specific exception if an avro file has currupted magic

2018-11-08 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/AVRO-2127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16680054#comment-16680054
 ] 

ASF subversion and git services commented on AVRO-2127:
---

Commit c6f772b408046c61b3269d8aecc5f1684bcad6fb in avro's branch 
refs/heads/master from Vladislav
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=c6f772b ]

AVRO-2127: throw more specific exceptions from DataFileStream#initialize (#323)

* AVRO-2127: throw more specific exceptions from DataFileStream#initialize

* AVRO-2127: throw more specific exceptions from DataFileReader12


> Throwing more specific exception if an avro file has currupted magic
> 
>
> Key: AVRO-2127
> URL: https://issues.apache.org/jira/browse/AVRO-2127
> Project: Apache Avro
>  Issue Type: Improvement
>  Components: java
>Affects Versions: 1.8.2
>Reporter: Dmitrii Bundin
>Assignee: Dmitrii Bundin
>Priority: Minor
>
> Curently we have IOException thrown if an avro file has incorrect magic. 
> It seems reasonable to throw a subclass of IOException to be able to handle 
> incorrect magic (in case length are match) in user code.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (AVRO-2127) Throwing more specific exception if an avro file has currupted magic

2018-11-08 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/AVRO-2127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16680063#comment-16680063
 ] 

ASF GitHub Bot commented on AVRO-2127:
--

dkulp commented on issue #273: AVRO-2127 Make InvalidAvroMagicException thrown 
if stream header is corrupted
URL: https://github.com/apache/avro/pull/273#issuecomment-437088121
 
 
   This was included as part of #323 / AVRO-2127


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Throwing more specific exception if an avro file has currupted magic
> 
>
> Key: AVRO-2127
> URL: https://issues.apache.org/jira/browse/AVRO-2127
> Project: Apache Avro
>  Issue Type: Improvement
>  Components: java
>Affects Versions: 1.8.2
>Reporter: Dmitrii Bundin
>Assignee: Dmitrii Bundin
>Priority: Minor
>
> Curently we have IOException thrown if an avro file has incorrect magic. 
> It seems reasonable to throw a subclass of IOException to be able to handle 
> incorrect magic (in case length are match) in user code.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (AVRO-2127) Throwing more specific exception if an avro file has currupted magic

2018-07-27 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/AVRO-2127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16559603#comment-16559603
 ] 

ASF GitHub Bot commented on AVRO-2127:
--

rezex opened a new pull request #323: AVRO-2127: throw more specific exceptions 
from DataFileStream#initialize
URL: https://github.com/apache/avro/pull/323
 
 
   This patch throws more precise IOExceptions from DataFileStream#initialize 
and some lower methods.
   By agreement with https://github.com/bunadmitrii, his patch was improved a 
little.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Throwing more specific exception if an avro file has currupted magic
> 
>
> Key: AVRO-2127
> URL: https://issues.apache.org/jira/browse/AVRO-2127
> Project: Avro
>  Issue Type: Improvement
>  Components: java
>Affects Versions: 1.8.2
>Reporter: Dmitrii Bundin
>Assignee: Dmitrii Bundin
>Priority: Minor
>
> Curently we have IOException thrown if an avro file has incorrect magic. 
> It seems reasonable to throw a subclass of IOException to be able to handle 
> incorrect magic (in case length are match) in user code.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (AVRO-2127) Throwing more specific exception if an avro file has currupted magic

2018-02-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/AVRO-2127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16360772#comment-16360772
 ] 

ASF GitHub Bot commented on AVRO-2127:
--

busbey commented on a change in pull request #273: AVRO-2127 Make 
InvalidAvroMagicException thrown if stream header is corrupted
URL: https://github.com/apache/avro/pull/273#discussion_r167560025
 
 

 ##
 File path: 
lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
 ##
 @@ -47,7 +47,7 @@
  DatumReader reader)
 throws IOException {
 if (in.length() < MAGIC.length)
-  throw new IOException("Not an Avro data file");
+  throw new EOFException("Not an Avro data file");
 
 Review comment:
   Will this be confusing? Say I want to take files and throw them at the wall 
to see what sticks. With this change as-is I'll need to see if the IOE is 
either EOF or IAM. Is that desirable? Do we gain enough by being able to 
distinguish the case where the magic header was invalid due to not enough bytes?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Throwing more specific exception if an avro file has currupted magic
> 
>
> Key: AVRO-2127
> URL: https://issues.apache.org/jira/browse/AVRO-2127
> Project: Avro
>  Issue Type: Improvement
>  Components: java
>Affects Versions: 1.8.2
>Reporter: Dmitrii Bundin
>Assignee: Dmitrii Bundin
>Priority: Minor
>
> Curently we have IOException thrown if an avro file has incorrect magic. 
> It seems reasonable to throw a subclass of IOException to be able to handle 
> incorrect magic (in case length are match) in user code.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (AVRO-2127) Throwing more specific exception if an avro file has currupted magic

2018-02-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/AVRO-2127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16360773#comment-16360773
 ] 

ASF GitHub Bot commented on AVRO-2127:
--

busbey commented on a change in pull request #273: AVRO-2127 Make 
InvalidAvroMagicException thrown if stream header is corrupted
URL: https://github.com/apache/avro/pull/273#discussion_r167560725
 
 

 ##
 File path: 
lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java
 ##
 @@ -102,7 +102,7 @@ void initialize(InputStream in) throws IOException {
   throw new IOException("Not an Avro data file.", e);
 
 Review comment:
   Is there an analogous case here to the EOF above? If there weren't enough 
bytes in the stream for the magic check, right now here we throw a bare IOE, 
right?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Throwing more specific exception if an avro file has currupted magic
> 
>
> Key: AVRO-2127
> URL: https://issues.apache.org/jira/browse/AVRO-2127
> Project: Avro
>  Issue Type: Improvement
>  Components: java
>Affects Versions: 1.8.2
>Reporter: Dmitrii Bundin
>Assignee: Dmitrii Bundin
>Priority: Minor
>
> Curently we have IOException thrown if an avro file has incorrect magic. 
> It seems reasonable to throw a subclass of IOException to be able to handle 
> incorrect magic (in case length are match) in user code.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)