You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2018/02/25 05:17:16 UTC
[karaf] branch karaf-3.0.x updated: [KARAF-5632] Reuse in
HeapDumpProvider now the copy function of LogDumpProvider to copy the dump
file.
This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch karaf-3.0.x
in repository https://gitbox.apache.org/repos/asf/karaf.git
The following commit(s) were added to refs/heads/karaf-3.0.x by this push:
new 7564871 [KARAF-5632] Reuse in HeapDumpProvider now the copy function of LogDumpProvider to copy the dump file.
new 505b6ed [KARAF-5632] This closes #464
7564871 is described below
commit 7564871b78ec59012800b08d447bd961d201e205
Author: Richard Hierlmeier <ri...@de-gmbh.com>
AuthorDate: Wed Feb 21 13:05:04 2018 +0100
[KARAF-5632] Reuse in HeapDumpProvider now the copy function of LogDumpProvider to copy the dump file.
---
.../org/apache/karaf/diagnostic/core/internal/HeapDumpProvider.java | 5 +----
.../org/apache/karaf/diagnostic/core/internal/LogDumpProvider.java | 2 +-
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/diagnostic/core/src/main/java/org/apache/karaf/diagnostic/core/internal/HeapDumpProvider.java b/diagnostic/core/src/main/java/org/apache/karaf/diagnostic/core/internal/HeapDumpProvider.java
index 03c50cf..cf1ed40 100644
--- a/diagnostic/core/src/main/java/org/apache/karaf/diagnostic/core/internal/HeapDumpProvider.java
+++ b/diagnostic/core/src/main/java/org/apache/karaf/diagnostic/core/internal/HeapDumpProvider.java
@@ -52,10 +52,7 @@ public class HeapDumpProvider implements DumpProvider {
File heapDumpFile = new File("heapdump.txt");
in = new FileInputStream(heapDumpFile);
out = destination.add("heapdump.txt");
- byte[] buffer = new byte[2048];
- while ((in.read(buffer) != -1)) {
- out.write(buffer);
- }
+ LogDumpProvider.copy(in, out);
// remove the original dump
if (heapDumpFile.exists()) {
heapDumpFile.delete();
diff --git a/diagnostic/core/src/main/java/org/apache/karaf/diagnostic/core/internal/LogDumpProvider.java b/diagnostic/core/src/main/java/org/apache/karaf/diagnostic/core/internal/LogDumpProvider.java
index ba5a24e..740cc2e 100644
--- a/diagnostic/core/src/main/java/org/apache/karaf/diagnostic/core/internal/LogDumpProvider.java
+++ b/diagnostic/core/src/main/java/org/apache/karaf/diagnostic/core/internal/LogDumpProvider.java
@@ -87,7 +87,7 @@ public class LogDumpProvider implements DumpProvider {
* @param outputStream Destination stream.
* @throws IOException When IO operation fails.
*/
- private void copy(InputStream inputStream, OutputStream outputStream) throws IOException {
+ static void copy(InputStream inputStream, OutputStream outputStream) throws IOException {
byte[] buffer = new byte[4096];
int n = 0;
while (-1 != (n = inputStream.read(buffer))) {
--
To stop receiving notification emails like this one, please contact
jbonofre@apache.org.