Author: ruwan
Date: Tue Apr 27 09:41:08 2010
New Revision: 938379
URL: http://svn.apache.org/viewvc?rev=938379&view=rev
Log:
minor reformatting
Modified:
synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/SynapseCommonsException.java
synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/util/MiscellaneousUtil.java
synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/util/TemporaryData.java
Modified:
synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/SynapseCommonsException.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/SynapseCommonsException.java?rev=938379&r1=938378&r2=938379&view=diff
==============================================================================
---
synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/SynapseCommonsException.java
(original)
+++
synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/SynapseCommonsException.java
Tue Apr 27 09:41:08 2010
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.synapse.commons;
import org.apache.commons.logging.Log;
Modified:
synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/util/MiscellaneousUtil.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/util/MiscellaneousUtil.java?rev=938379&r1=938378&r2=938379&view=diff
==============================================================================
---
synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/util/MiscellaneousUtil.java
(original)
+++
synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/util/MiscellaneousUtil.java
Tue Apr 27 09:41:08 2010
@@ -72,7 +72,7 @@ public class MiscellaneousUtil {
* @param type Expected Type using Class
* @return Value corresponding to the given property name
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({"TypeParameterExplicitlyExtendsObject", "unchecked"})
public static <T extends Object> T getProperty(
Properties properties, String name, T defaultValue, Class<?
extends T> type) {
@@ -185,29 +185,29 @@ public class MiscellaneousUtil {
public static byte[] asBytes(InputStream in) {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- byte[] buffer = new byte[1024];
- int len;
- try {
- while ((len = in.read(buffer)) >= 0)
- out.write(buffer, 0, len);
- } catch (IOException e) {
- throw new SynapseCommonsException("Error during converting a
inputstream " +
- "into a bytearray ", e, log);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException ignored) {
- }
- }
- try {
- out.close();
- } catch (IOException ignored) {
- }
- }
- return out.toByteArray();
- }
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len;
+ try {
+ while ((len = in.read(buffer)) >= 0)
+ out.write(buffer, 0, len);
+ } catch (IOException e) {
+ throw new SynapseCommonsException("Error during converting a
inputstream " +
+ "into a bytearray ", e, log);
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException ignored) {
+ }
+ }
+ try {
+ out.close();
+ } catch (IOException ignored) {
+ }
+ }
+ return out.toByteArray();
+ }
/**
Modified:
synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/util/TemporaryData.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/util/TemporaryData.java?rev=938379&r1=938378&r2=938379&view=diff
==============================================================================
---
synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/util/TemporaryData.java
(original)
+++
synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/util/TemporaryData.java
Tue Apr 27 09:41:08 2010
@@ -240,7 +240,7 @@ public class TemporaryData {
* Create a temporary file and write the existing in memory data to it.
*
* @return an open FileOutputStream to the temporary file
- * @throws IOException
+ * @throws IOException in case of an error in switching to the temp file
*/
FileOutputStream switchToTempFile() throws IOException {
temporaryFile = File.createTempFile(tempPrefix, tempSuffix);
@@ -283,7 +283,7 @@ public class TemporaryData {
*
* @param in An InputStream to read data from. This method will not
* close the stream.
- * @throws IOException
+ * @throws IOException in case of an error in reading from
<code>InputStream</code>
*/
public void readFrom(InputStream in) throws IOException {
while (true) {
@@ -318,7 +318,7 @@ public class TemporaryData {
*
* @param out The output stream to write the data to. This method will
* not close the stream.
- * @throws IOException
+ * @throws IOException in case of an error in writing to the
<code>OutputStream</code>
*/
public void writeTo(OutputStream out) throws IOException {
if (temporaryFile != null) {
@@ -346,6 +346,7 @@ public class TemporaryData {
}
}
+ @SuppressWarnings({"ResultOfMethodCallIgnored"})
public void release() {
if (temporaryFile != null) {
if (log.isDebugEnabled()) {
@@ -355,6 +356,8 @@ public class TemporaryData {
}
}
+ @SuppressWarnings({"FinalizeDoesntCallSuperFinalize",
"ResultOfMethodCallIgnored"})
+ @Override
protected void finalize() throws Throwable {
if (temporaryFile != null) {
log.warn("Cleaning up unreleased temporary file " + temporaryFile);