You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/06/03 01:20:56 UTC

[james-project] 05/06: [REFACTORING] Remove unused classes: PipedInputStreamHandlingError, PipedOutputStreamHandlingError

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 41f71d0eadbcfb5ebf1871cb706a84363ed7221b
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Tue May 31 11:01:57 2022 +0700

    [REFACTORING] Remove unused classes: PipedInputStreamHandlingError, PipedOutputStreamHandlingError
---
 .../utils/PipedInputStreamHandlingError.java       | 115 ---------------------
 .../utils/PipedOutputStreamHandlingError.java      |  37 -------
 2 files changed, 152 deletions(-)

diff --git a/server/blob/blob-cassandra/src/main/java/org/apache/james/blob/cassandra/utils/PipedInputStreamHandlingError.java b/server/blob/blob-cassandra/src/main/java/org/apache/james/blob/cassandra/utils/PipedInputStreamHandlingError.java
deleted file mode 100644
index 950582369a..0000000000
--- a/server/blob/blob-cassandra/src/main/java/org/apache/james/blob/cassandra/utils/PipedInputStreamHandlingError.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************
- * 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.james.blob.cassandra.utils;
-
-import java.io.IOException;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.util.Optional;
-import java.util.concurrent.atomic.AtomicReference;
-
-public class PipedInputStreamHandlingError extends PipedInputStream {
-    private final AtomicReference<RuntimeException> error;
-
-    public PipedInputStreamHandlingError() {
-        super();
-        this.error = new AtomicReference<>();
-    }
-
-    void setError(RuntimeException e) {
-        error.set(e);
-    }
-
-    private void assertNoError() {
-        Optional<RuntimeException> maybeError = Optional.ofNullable(error.get());
-        if (maybeError.isPresent()) {
-            throw maybeError.get();
-        }
-    }
-
-    @Override
-    public void connect(PipedOutputStream src) throws IOException {
-        assertNoError();
-        super.connect(src);
-    }
-
-    @Override
-    protected synchronized void receive(int b) throws IOException {
-        assertNoError();
-        super.receive(b);
-    }
-
-    @Override
-    public synchronized int read() throws IOException {
-        assertNoError();
-        return super.read();
-    }
-
-    @Override
-    public synchronized int read(byte[] b, int off, int len) throws IOException {
-        assertNoError();
-        return super.read(b, off, len);
-    }
-
-    @Override
-    public synchronized int available() throws IOException {
-        assertNoError();
-        return super.available();
-    }
-
-    @Override
-    public void close() throws IOException {
-        try {
-            assertNoError();
-        } finally {
-            super.close();
-        }
-    }
-
-    @Override
-    public int read(byte[] b) throws IOException {
-        assertNoError();
-        return super.read(b);
-    }
-
-    @Override
-    public long skip(long n) throws IOException {
-        assertNoError();
-        return super.skip(n);
-    }
-
-    @Override
-    public synchronized void mark(int readlimit) {
-        assertNoError();
-        super.mark(readlimit);
-    }
-
-    @Override
-    public synchronized void reset() throws IOException {
-        assertNoError();
-        super.reset();
-    }
-
-    @Override
-    public boolean markSupported() {
-        assertNoError();
-        return super.markSupported();
-    }
-}
diff --git a/server/blob/blob-cassandra/src/main/java/org/apache/james/blob/cassandra/utils/PipedOutputStreamHandlingError.java b/server/blob/blob-cassandra/src/main/java/org/apache/james/blob/cassandra/utils/PipedOutputStreamHandlingError.java
deleted file mode 100644
index 4be3eb9cdc..0000000000
--- a/server/blob/blob-cassandra/src/main/java/org/apache/james/blob/cassandra/utils/PipedOutputStreamHandlingError.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************
- * 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.james.blob.cassandra.utils;
-
-import java.io.IOException;
-import java.io.PipedOutputStream;
-
-public class PipedOutputStreamHandlingError extends PipedOutputStream {
-    private final PipedInputStreamHandlingError pipedInputStream;
-
-    public PipedOutputStreamHandlingError(PipedInputStreamHandlingError snk) throws IOException {
-        super(snk);
-
-        this.pipedInputStream = snk;
-    }
-
-    public void propagateError(RuntimeException error) {
-        pipedInputStream.setError(error);
-    }
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org