diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java index 80478ca..f11b718 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java @@ -3819,12 +3819,14 @@ public static boolean skipHeader(RecordReader curr * Table description for target table. * */ - public static int getHeaderCount(TableDesc table) throws IOException { + public static int getHeaderCount(TableDesc table) { int headerCount; try { - headerCount = Integer.parseInt(table.getProperties().getProperty(serdeConstants.HEADER_COUNT, "0")); + headerCount = Integer.parseInt( + table.getProperties().getProperty(serdeConstants.HEADER_COUNT, "0")); } catch (NumberFormatException nfe) { - throw new IOException(nfe); + throw new IllegalArgumentException( + "Invalid value for " + serdeConstants.HEADER_COUNT, nfe); } return headerCount; } @@ -3838,17 +3840,20 @@ public static int getHeaderCount(TableDesc table) throws IOException { * @param job * Job configuration for current job. */ - public static int getFooterCount(TableDesc table, JobConf job) throws IOException { + public static int getFooterCount(TableDesc table, JobConf job) { int footerCount; try { - footerCount = Integer.parseInt(table.getProperties().getProperty(serdeConstants.FOOTER_COUNT, "0")); - if (footerCount > HiveConf.getIntVar(job, HiveConf.ConfVars.HIVE_FILE_MAX_FOOTER)) { - throw new IOException("footer number exceeds the limit defined in hive.file.max.footer"); + footerCount = Integer.parseInt( + table.getProperties().getProperty(serdeConstants.FOOTER_COUNT, "0")); + if (footerCount > HiveConf.getIntVar(job, + HiveConf.ConfVars.HIVE_FILE_MAX_FOOTER)) { + throw new IllegalArgumentException( + "Footer number exceeds the limit defined in " + + HiveConf.ConfVars.HIVE_FILE_MAX_FOOTER); } } catch (NumberFormatException nfe) { - - // Footer line number must be set as an integer. - throw new IOException(nfe); + throw new IllegalArgumentException( + "Invalid value for " + serdeConstants.FOOTER_COUNT, nfe); } return footerCount; }