You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by se...@apache.org on 2016/01/25 15:22:02 UTC
[3/6] flink git commit: [hotfix] Remove use of
StringUtils.stringifyException() where used is counterindicated
[hotfix] Remove use of StringUtils.stringifyException() where used is counterindicated
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/6823895a
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/6823895a
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/6823895a
Branch: refs/heads/master
Commit: 6823895a2ef776060a437e0d4979a6d8bfef48f7
Parents: 257f0b1
Author: Stephan Ewen <se...@apache.org>
Authored: Mon Jan 18 18:51:53 2016 +0100
Committer: Stephan Ewen <se...@apache.org>
Committed: Mon Jan 25 15:07:16 2016 +0100
----------------------------------------------------------------------
.../flink/api/common/io/BinaryInputFormat.java | 13 +++++---
.../java/org/apache/flink/util/TestLogger.java | 2 +-
.../flink/runtime/util/SerializableHashMap.java | 8 ++---
.../apache/flink/runtime/blob/BlobKeyTest.java | 35 ++++++--------------
.../test/cancelling/CancelingTestBase.java | 6 ++--
5 files changed, 27 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/6823895a/flink-core/src/main/java/org/apache/flink/api/common/io/BinaryInputFormat.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/io/BinaryInputFormat.java b/flink-core/src/main/java/org/apache/flink/api/common/io/BinaryInputFormat.java
index e738d52..3789544 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/io/BinaryInputFormat.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/io/BinaryInputFormat.java
@@ -29,7 +29,6 @@ import org.apache.flink.core.fs.FileSystem;
import org.apache.flink.core.fs.Path;
import org.apache.flink.core.memory.DataInputView;
import org.apache.flink.core.memory.DataInputViewStreamWrapper;
-import org.apache.flink.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -169,13 +168,17 @@ public abstract class BinaryInputFormat<T> extends FileInputFormat<T> {
return createStatistics(allFiles, stats);
} catch (IOException ioex) {
if (LOG.isWarnEnabled()) {
- LOG.warn(String.format("Could not determine complete statistics for file '%s' due to an I/O error: %s",
- this.filePath, StringUtils.stringifyException(ioex)));
+ LOG.warn(
+ String.format("Could not determine complete statistics for file '%s' due to an I/O error",
+ this.filePath),
+ ioex);
}
} catch (Throwable t) {
if (LOG.isErrorEnabled()) {
- LOG.error(String.format("Unexpected problem while getting the file statistics for file '%s' due to %s",
- this.filePath, StringUtils.stringifyException(t)));
+ LOG.error(
+ String.format("Unexpected problem while getting the file statistics for file '%s'",
+ this.filePath),
+ t);
}
}
// no stats available
http://git-wip-us.apache.org/repos/asf/flink/blob/6823895a/flink-core/src/test/java/org/apache/flink/util/TestLogger.java
----------------------------------------------------------------------
diff --git a/flink-core/src/test/java/org/apache/flink/util/TestLogger.java b/flink-core/src/test/java/org/apache/flink/util/TestLogger.java
index 7166d06..bf8d378 100644
--- a/flink-core/src/test/java/org/apache/flink/util/TestLogger.java
+++ b/flink-core/src/test/java/org/apache/flink/util/TestLogger.java
@@ -56,7 +56,7 @@ public class TestLogger {
log.error("\n--------------------------------------------------------------------------------"
+ "\nTest {} failed with:\n{}"
+ "\n================================================================================"
- , description, StringUtils.stringifyException(e));
+ , description, ExceptionUtils.stringifyException(e));
}
};
}
http://git-wip-us.apache.org/repos/asf/flink/blob/6823895a/flink-runtime/src/main/java/org/apache/flink/runtime/util/SerializableHashMap.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/util/SerializableHashMap.java b/flink-runtime/src/main/java/org/apache/flink/runtime/util/SerializableHashMap.java
index 2744fe8..dae1827 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/util/SerializableHashMap.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/util/SerializableHashMap.java
@@ -76,14 +76,14 @@ public class SerializableHashMap<K extends IOReadableWritable, V extends IOReada
try {
keyClass = (Class<K>) Class.forName(keyType);
} catch (ClassNotFoundException e) {
- throw new IOException(StringUtils.stringifyException(e));
+ throw new IOException(e);
}
K key = null;
try {
key = keyClass.newInstance();
} catch (Exception e) {
- throw new IOException(StringUtils.stringifyException(e));
+ throw new IOException(e);
}
key.read(in);
@@ -93,14 +93,14 @@ public class SerializableHashMap<K extends IOReadableWritable, V extends IOReada
try {
valueClass = (Class<V>) Class.forName(valueType);
} catch (ClassNotFoundException e) {
- throw new IOException(StringUtils.stringifyException(e));
+ throw new IOException(e);
}
V value;
try {
value = valueClass.newInstance();
} catch (Exception e) {
- throw new IOException(StringUtils.stringifyException(e));
+ throw new IOException(e);
}
value.read(in);
http://git-wip-us.apache.org/repos/asf/flink/blob/6823895a/flink-runtime/src/test/java/org/apache/flink/runtime/blob/BlobKeyTest.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/blob/BlobKeyTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/blob/BlobKeyTest.java
index 6f873de..4071a1c 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/blob/BlobKeyTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/blob/BlobKeyTest.java
@@ -58,15 +58,9 @@ public final class BlobKeyTest {
* Tests the serialization/deserialization of BLOB keys
*/
@Test
- public void testSerialization() {
+ public void testSerialization() throws Exception {
final BlobKey k1 = new BlobKey(KEY_ARRAY_1);
- final BlobKey k2;
- try {
- k2 = CommonTestUtils.createCopySerializable(k1);
- } catch (IOException ioe) {
- fail(StringUtils.stringifyException(ioe));
- return;
- }
+ final BlobKey k2 = CommonTestUtils.createCopySerializable(k1);
assertEquals(k1, k2);
assertEquals(k1.hashCode(), k2.hashCode());
assertEquals(0, k1.compareTo(k2));
@@ -100,25 +94,16 @@ public final class BlobKeyTest {
* Test the serialization/deserialization using input/output streams.
*/
@Test
- public void testStreams() {
+ public void testStreams() throws Exception {
final BlobKey k1 = new BlobKey(KEY_ARRAY_1);
final ByteArrayOutputStream baos = new ByteArrayOutputStream(20);
- try {
- k1.writeToOutputStream(baos);
- baos.close();
- } catch (IOException ioe) {
- fail(StringUtils.stringifyException(ioe));
- return;
- }
- final ByteArrayInputStream bais = new ByteArrayInputStream(
- baos.toByteArray());
- final BlobKey k2;
- try {
- k2 = BlobKey.readFromInputStream(bais);
- } catch (IOException ioe) {
- fail(StringUtils.stringifyException(ioe));
- return;
- }
+
+ k1.writeToOutputStream(baos);
+ baos.close();
+
+ final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ final BlobKey k2 = BlobKey.readFromInputStream(bais);
+
assertEquals(k1, k2);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flink/blob/6823895a/flink-tests/src/test/java/org/apache/flink/test/cancelling/CancelingTestBase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/cancelling/CancelingTestBase.java b/flink-tests/src/test/java/org/apache/flink/test/cancelling/CancelingTestBase.java
index f6361ca..9671fce 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/cancelling/CancelingTestBase.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/cancelling/CancelingTestBase.java
@@ -132,9 +132,11 @@ public abstract class CancelingTestBase extends TestLogger {
JobManagerActorTestUtils.waitForJobStatus(jobGraph.getJobID(), JobStatus.CANCELED,
executor.getLeaderGateway(TestingUtils.TESTING_DURATION()),
TestingUtils.TESTING_DURATION());
- } catch (Exception e) {
+ }
+ catch (Exception e) {
LOG.error("Exception found in runAndCancelJob.", e);
- Assert.fail(StringUtils.stringifyException(e));
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
}
}