poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1746274 - /poi/trunk/src/java/org/apache/poi/util/
Date Tue, 31 May 2016 13:48:25 GMT
Author: centic
Date: Tue May 31 13:48:25 2016
New Revision: 1746274

URL: http://svn.apache.org/viewvc?rev=1746274&view=rev
Log:
Fix some compiler/IntelliJ warnings

Modified:
    poi/trunk/src/java/org/apache/poi/util/ByteField.java
    poi/trunk/src/java/org/apache/poi/util/CloseIgnoringInputStream.java
    poi/trunk/src/java/org/apache/poi/util/FixedField.java
    poi/trunk/src/java/org/apache/poi/util/IntegerField.java
    poi/trunk/src/java/org/apache/poi/util/LittleEndianConsts.java
    poi/trunk/src/java/org/apache/poi/util/LittleEndianInputStream.java
    poi/trunk/src/java/org/apache/poi/util/LongField.java
    poi/trunk/src/java/org/apache/poi/util/POILogFactory.java
    poi/trunk/src/java/org/apache/poi/util/RLEDecompressingInputStream.java
    poi/trunk/src/java/org/apache/poi/util/ShortField.java
    poi/trunk/src/java/org/apache/poi/util/StringUtil.java
    poi/trunk/src/java/org/apache/poi/util/SystemOutLogger.java
    poi/trunk/src/java/org/apache/poi/util/TempFileCreationStrategy.java
    poi/trunk/src/java/org/apache/poi/util/Units.java
    poi/trunk/src/java/org/apache/poi/util/XMLHelper.java

Modified: poi/trunk/src/java/org/apache/poi/util/ByteField.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/ByteField.java?rev=1746274&r1=1746273&r2=1746274&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/ByteField.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/ByteField.java Tue May 31 13:48:25 2016
@@ -182,7 +182,7 @@ public class ByteField
      */
 
     public void readFromStream(final InputStream stream)
-        throws IOException, BufferUnderrunException
+        throws IOException
     {
     	// TODO - are these ~Field used / necessary
     	int ib = stream.read();

Modified: poi/trunk/src/java/org/apache/poi/util/CloseIgnoringInputStream.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/CloseIgnoringInputStream.java?rev=1746274&r1=1746273&r2=1746274&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/CloseIgnoringInputStream.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/CloseIgnoringInputStream.java Tue May 31 13:48:25
2016
@@ -33,7 +33,6 @@ public class CloseIgnoringInputStream ex
    }
 
    public void close() {
-      // Does nothing and ignores you
-      return;
+      // Does nothing and ignores closing the wrapped stream
    }
 }

Modified: poi/trunk/src/java/org/apache/poi/util/FixedField.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/FixedField.java?rev=1746274&r1=1746273&r2=1746274&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/FixedField.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/FixedField.java Tue May 31 13:48:25 2016
@@ -41,7 +41,7 @@ public interface FixedField
      *            of the array's valid index range
      */
 
-    public void readFromBytes(byte [] data)
+    void readFromBytes(byte [] data)
         throws ArrayIndexOutOfBoundsException;
 
     /**
@@ -56,8 +56,8 @@ public interface FixedField
      *            the InputStream
      */
 
-    public void readFromStream(InputStream stream)
-        throws IOException, BufferUnderrunException;
+    void readFromStream(InputStream stream)
+        throws IOException;
 
     /**
      * write the value out to an array of bytes at the appropriate
@@ -70,7 +70,7 @@ public interface FixedField
      *            of the array's valid index range
      */
 
-    public void writeToBytes(byte [] data)
+    void writeToBytes(byte [] data)
         throws ArrayIndexOutOfBoundsException;
 
     /**
@@ -79,6 +79,6 @@ public interface FixedField
      * @return the value as a String
      */
 
-    public String toString();
+    String toString();
 }   // end public interface FixedField
 

Modified: poi/trunk/src/java/org/apache/poi/util/IntegerField.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/IntegerField.java?rev=1746274&r1=1746273&r2=1746274&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/IntegerField.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/IntegerField.java Tue May 31 13:48:25 2016
@@ -182,7 +182,7 @@ public class IntegerField
      */
 
     public void readFromStream(final InputStream stream)
-        throws IOException, BufferUnderrunException
+        throws IOException
     {
         _value = LittleEndian.readInt(stream);
     }

Modified: poi/trunk/src/java/org/apache/poi/util/LittleEndianConsts.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/LittleEndianConsts.java?rev=1746274&r1=1746273&r2=1746274&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/LittleEndianConsts.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/LittleEndianConsts.java Tue May 31 13:48:25 2016
@@ -26,14 +26,11 @@ package org.apache.poi.util;
  * @author Andrew C. Oliver (acoliver at apache dot org)
  */
 
-public interface LittleEndianConsts
-{
-
+public interface LittleEndianConsts {
     // sizes of various numbers in this environment
-    public static final int BYTE_SIZE   = 1;
-    public static final int SHORT_SIZE  = 2;
-    public static final int INT_SIZE    = 4;
-    public static final int LONG_SIZE   = 8;
-    public static final int DOUBLE_SIZE = 8;
+    int BYTE_SIZE   = 1;
+    int SHORT_SIZE  = 2;
+    int INT_SIZE    = 4;
+    int LONG_SIZE   = 8;
+    int DOUBLE_SIZE = 8;
 }   // end public interface LittleEndianConsts
-

Modified: poi/trunk/src/java/org/apache/poi/util/LittleEndianInputStream.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/LittleEndianInputStream.java?rev=1746274&r1=1746273&r2=1746274&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/LittleEndianInputStream.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/LittleEndianInputStream.java Tue May 31 13:48:25
2016
@@ -21,8 +21,6 @@ import java.io.FilterInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
-import org.apache.poi.util.LittleEndian.BufferUnderrunException;
-
 /**
  * Wraps an {@link InputStream} providing {@link LittleEndianInput}<p/>
  *
@@ -76,14 +74,12 @@ public class LittleEndianInputStream ext
      * get an unsigned int value from an InputStream
      * 
      * @return the unsigned int (32-bit) value
-     * @exception IOException
-     *                will be propagated back to the caller
-     * @exception BufferUnderrunException
-     *                if the stream cannot provide enough bytes
+     * @exception RuntimeException
+     *                wraps any IOException thrown from reading the stream.
      */
     public long readUInt() {
        long retNum = readInt();
-       return retNum & 0x00FFFFFFFFl;
+       return retNum & 0x00FFFFFFFFL;
     }
 	
 	public long readLong() {

Modified: poi/trunk/src/java/org/apache/poi/util/LongField.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/LongField.java?rev=1746274&r1=1746273&r2=1746274&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/LongField.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/LongField.java Tue May 31 13:48:25 2016
@@ -179,7 +179,7 @@ public class LongField
      */
 
     public void readFromStream(final InputStream stream)
-        throws IOException, BufferUnderrunException
+        throws IOException
     {
         _value = LittleEndian.readLong(stream);
     }

Modified: poi/trunk/src/java/org/apache/poi/util/POILogFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/POILogFactory.java?rev=1746274&r1=1746273&r2=1746274&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/POILogFactory.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/POILogFactory.java Tue May 31 13:48:25 2016
@@ -72,8 +72,6 @@ public final class POILogFactory {
      * @return a POILogger for the specified class
      */
     public static POILogger getLogger(final String cat) {
-        POILogger logger = null;
-
         // If we haven't found out what logger to use yet,
         //  then do so now
         // Don't look it up until we're first asked, so
@@ -82,7 +80,9 @@ public final class POILogFactory {
         if(_loggerClassName == null) {
         	try {
         		_loggerClassName = System.getProperty("org.apache.poi.util.POILogger");
-        	} catch(Exception e) {}
+        	} catch(Exception e) {
+                // ignore any exception here
+            }
 
         	// Use the default logger if none specified,
         	//  or none could be fetched
@@ -100,7 +100,7 @@ public final class POILogFactory {
 
         // Fetch the right logger for them, creating
         //  it if that's required
-        logger = _loggers.get(cat);
+        POILogger logger = _loggers.get(cat);
         if (logger == null) {
             try {
                 @SuppressWarnings("unchecked")

Modified: poi/trunk/src/java/org/apache/poi/util/RLEDecompressingInputStream.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/RLEDecompressingInputStream.java?rev=1746274&r1=1746273&r2=1746274&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/RLEDecompressingInputStream.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/RLEDecompressingInputStream.java Tue May 31 13:48:25
2016
@@ -67,7 +67,7 @@ public class RLEDecompressingInputStream
     /**
      * Creates a new wrapper RLE Decompression InputStream.
      * 
-     * @param in
+     * @param in The stream to wrap with the RLE Decompression
      * @throws IOException
      */
     public RLEDecompressingInputStream(InputStream in) throws IOException {
@@ -275,11 +275,11 @@ public class RLEDecompressingInputStream
         return (b0 & 0xFF) | ((b1 & 0xFF) << 8) | ((b2 & 0xFF) <<
16) | ((b3 & 0xFF) << 24);
     }
 
-    public static final byte[] decompress(byte[] compressed) throws IOException {
+    public static byte[] decompress(byte[] compressed) throws IOException {
         return decompress(compressed, 0, compressed.length);
     }
     
-    public static final byte[] decompress(byte[] compressed, int offset, int length) throws
IOException {
+    public static byte[] decompress(byte[] compressed, int offset, int length) throws IOException
{
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         InputStream instream = new ByteArrayInputStream(compressed, offset, length);
         InputStream stream = new RLEDecompressingInputStream(instream);

Modified: poi/trunk/src/java/org/apache/poi/util/ShortField.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/ShortField.java?rev=1746274&r1=1746273&r2=1746274&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/ShortField.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/ShortField.java Tue May 31 13:48:25 2016
@@ -179,7 +179,7 @@ public class ShortField
      */
 
     public void readFromStream(final InputStream stream)
-        throws IOException, BufferUnderrunException
+        throws IOException
     {
         _value = LittleEndian.readShort(stream);
     }

Modified: poi/trunk/src/java/org/apache/poi/util/StringUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/StringUtil.java?rev=1746274&r1=1746273&r2=1746274&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/StringUtil.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/StringUtil.java Tue May 31 13:48:25 2016
@@ -283,7 +283,7 @@ public class StringUtil {
 	/**
 	 * Checks to see if a given String needs to be represented as Unicode
 	 *
-	 * @param value
+	 * @param value The string to look at.
 	 * @return true if string needs Unicode to be represented.
 	 */
 	public static boolean isUnicodeString(final String value) {

Modified: poi/trunk/src/java/org/apache/poi/util/SystemOutLogger.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/SystemOutLogger.java?rev=1746274&r1=1746273&r2=1746274&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/SystemOutLogger.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/SystemOutLogger.java Tue May 31 13:48:25 2016
@@ -87,10 +87,7 @@ public class SystemOutLogger extends POI
             currentLevel = POILogger.DEBUG;
         }
 
-        if (level >= currentLevel) {
-            return true;
-        }
-        return false;
+        return level >= currentLevel;
     }
 
 

Modified: poi/trunk/src/java/org/apache/poi/util/TempFileCreationStrategy.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/TempFileCreationStrategy.java?rev=1746274&r1=1746273&r2=1746274&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/TempFileCreationStrategy.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/TempFileCreationStrategy.java Tue May 31 13:48:25
2016
@@ -34,5 +34,5 @@ public interface TempFileCreationStrateg
      * 
      * @throws IOException If no temporary file could be created.
      */
-    public File createTempFile(String prefix, String suffix) throws IOException;
+    File createTempFile(String prefix, String suffix) throws IOException;
 }

Modified: poi/trunk/src/java/org/apache/poi/util/Units.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/Units.java?rev=1746274&r1=1746273&r2=1746274&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/Units.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/Units.java Tue May 31 13:48:25 2016
@@ -75,23 +75,22 @@ public class Units {
     /**
      * Converts a value of type FixedPoint to a floating point
      *
-     * @param fixedPoint
+     * @param fixedPoint value in fixed point notation
      * @return floating point (double)
      * 
      * @see <a href="http://msdn.microsoft.com/en-us/library/dd910765(v=office.12).aspx">[MS-OSHARED]
- 2.2.1.6 FixedPoint</a>
      */
     public static double fixedPointToDouble(int fixedPoint) {
         int i = (fixedPoint >> 16);
-        int f = (fixedPoint >> 0) & 0xFFFF;
-        double floatPoint = (i + f/65536d);
-        return floatPoint;
+        int f = fixedPoint & 0xFFFF;
+        return (i + f/65536d);
     }
     
     /**
      * Converts a value of type floating point to a FixedPoint
      *
-     * @param floatPoint
-     * @return fixedPoint
+     * @param floatPoint value in floating point notation
+     * @return fixedPoint value in fixed points notation
      * 
      * @see <a href="http://msdn.microsoft.com/en-us/library/dd910765(v=office.12).aspx">[MS-OSHARED]
- 2.2.1.6 FixedPoint</a>
      */
@@ -100,8 +99,7 @@ public class Units {
         double integralPart = floatPoint - fractionalPart;
         int i = (int)Math.floor(integralPart);
         int f = (int)Math.rint(fractionalPart*65536d);
-        int fixedPoint = (i << 16) | (f & 0xFFFF);
-        return fixedPoint;
+        return (i << 16) | (f & 0xFFFF);
     }
 
     public static double masterToPoints(int masterDPI) {

Modified: poi/trunk/src/java/org/apache/poi/util/XMLHelper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/XMLHelper.java?rev=1746274&r1=1746273&r2=1746274&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/XMLHelper.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/XMLHelper.java Tue May 31 13:48:25 2016
@@ -22,7 +22,6 @@ import javax.xml.parsers.DocumentBuilder
 
 /**
  * Helper methods for working with javax.xml classes.
- * @see org.apache.poi.util.SAXHelper
  */
 public final class XMLHelper
 {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message