BF [ 1748346 ] NPE on locator fields that are not mandatory
http://sourceforge.net/tracker/index.php?func=detail&aid=1748346&group_id=176962&atid=879332 * fixed javadoc
This commit is contained in:
parent
3859f40636
commit
f85842e48c
|
@ -30,6 +30,8 @@ import javax.swing.*;
|
||||||
*
|
*
|
||||||
* @author Jorg Janke
|
* @author Jorg Janke
|
||||||
* @version $Id: Util.java,v 1.3 2006/07/30 00:52:23 jjanke Exp $
|
* @version $Id: Util.java,v 1.3 2006/07/30 00:52:23 jjanke Exp $
|
||||||
|
*
|
||||||
|
* @author Teo Sarca, SC ARHIPAC SERVICE SRL - BF [ 1748346 ]
|
||||||
*/
|
*/
|
||||||
public class Util
|
public class Util
|
||||||
{
|
{
|
||||||
|
@ -67,9 +69,9 @@ public class Util
|
||||||
} // replace
|
} // replace
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove CR / LF from String
|
* Remove CR / LF from String
|
||||||
* @param in input
|
* @param in input
|
||||||
* @return cleaned string
|
* @return cleaned string
|
||||||
*/
|
*/
|
||||||
public static String removeCRLF (String in)
|
public static String removeCRLF (String in)
|
||||||
{
|
{
|
||||||
|
@ -88,9 +90,9 @@ public class Util
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean - Remove all white spaces
|
* Clean - Remove all white spaces
|
||||||
* @param in in
|
* @param in in
|
||||||
* @return cleaned string
|
* @return cleaned string
|
||||||
*/
|
*/
|
||||||
public static String cleanWhitespace (String in)
|
public static String cleanWhitespace (String in)
|
||||||
{
|
{
|
||||||
|
@ -117,11 +119,12 @@ public class Util
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mask HTML content.
|
* Mask HTML content.
|
||||||
* i.e. replace characters with &values;
|
* i.e. replace characters with &values;
|
||||||
* CR is not masked
|
* CR is not masked
|
||||||
* @param content content
|
* @param content content
|
||||||
* @return masked content
|
* @return masked content
|
||||||
|
* @see #maskHTML(String, boolean)
|
||||||
*/
|
*/
|
||||||
public static String maskHTML (String content)
|
public static String maskHTML (String content)
|
||||||
{
|
{
|
||||||
|
@ -129,16 +132,17 @@ public class Util
|
||||||
} // maskHTML
|
} // maskHTML
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mask HTML content.
|
* Mask HTML content.
|
||||||
* i.e. replace characters with &values;
|
* i.e. replace characters with &values;
|
||||||
* @param content content
|
* @param content content
|
||||||
* @param maskCR convert CR into <br>
|
* @param maskCR convert CR into <br>
|
||||||
* @return masked content
|
* @return masked content or null if the <code>content</code> is null
|
||||||
*/
|
*/
|
||||||
public static String maskHTML (String content, boolean maskCR)
|
public static String maskHTML (String content, boolean maskCR)
|
||||||
{
|
{
|
||||||
//if (content == null || content.length() == 0 || content.equals(" "))
|
// If the content is null, then return null - teo_sarca [ 1748346 ]
|
||||||
//return " ";
|
if (content == null)
|
||||||
|
return content;
|
||||||
//
|
//
|
||||||
StringBuffer out = new StringBuffer();
|
StringBuffer out = new StringBuffer();
|
||||||
char[] chars = content.toCharArray();
|
char[] chars = content.toCharArray();
|
||||||
|
@ -179,10 +183,10 @@ public class Util
|
||||||
} // maskHTML
|
} // maskHTML
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of occurances of countChar in string.
|
* Get the number of occurances of countChar in string.
|
||||||
* @param string String to be searched
|
* @param string String to be searched
|
||||||
* @param countChar to be counted character
|
* @param countChar to be counted character
|
||||||
* @return number of occurances
|
* @return number of occurances
|
||||||
*/
|
*/
|
||||||
public static int getCount (String string, char countChar)
|
public static int getCount (String string, char countChar)
|
||||||
{
|
{
|
||||||
|
@ -199,9 +203,9 @@ public class Util
|
||||||
} // getCount
|
} // getCount
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is String Empty
|
* Is String Empty
|
||||||
* @param str string
|
* @param str string
|
||||||
* @return true if >= 1 char
|
* @return true if >= 1 char
|
||||||
*/
|
*/
|
||||||
public static boolean isEmpty (String str)
|
public static boolean isEmpty (String str)
|
||||||
{
|
{
|
||||||
|
@ -209,11 +213,11 @@ public class Util
|
||||||
} // isEmpty
|
} // isEmpty
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Find index of search character in str.
|
* Find index of search character in str.
|
||||||
* This ignores content in () and 'texts'
|
* This ignores content in () and 'texts'
|
||||||
* @param str string
|
* @param str string
|
||||||
* @param search search character
|
* @param search search character
|
||||||
* @return index or -1 if not found
|
* @return index or -1 if not found
|
||||||
*/
|
*/
|
||||||
public static int findIndexOf (String str, char search)
|
public static int findIndexOf (String str, char search)
|
||||||
{
|
{
|
||||||
|
@ -322,9 +326,9 @@ public class Util
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Init Cap Words With Spaces
|
* Init Cap Words With Spaces
|
||||||
* @param in string
|
* @param in string
|
||||||
* @return init cap
|
* @return init cap
|
||||||
*/
|
*/
|
||||||
public static String initCap (String in)
|
public static String initCap (String in)
|
||||||
{
|
{
|
||||||
|
@ -350,11 +354,11 @@ public class Util
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Return a Iterator with only the relevant attributes.
|
* Return a Iterator with only the relevant attributes.
|
||||||
* Fixes implementation in AttributedString, which returns everything
|
* Fixes implementation in AttributedString, which returns everything
|
||||||
* @param aString attributed string
|
* @param aString attributed string
|
||||||
* @param relevantAttributes relevant attributes
|
* @param relevantAttributes relevant attributes
|
||||||
* @return iterator
|
* @return iterator
|
||||||
*/
|
*/
|
||||||
static public AttributedCharacterIterator getIterator (AttributedString aString,
|
static public AttributedCharacterIterator getIterator (AttributedString aString,
|
||||||
AttributedCharacterIterator.Attribute[] relevantAttributes)
|
AttributedCharacterIterator.Attribute[] relevantAttributes)
|
||||||
|
@ -405,8 +409,8 @@ public class Util
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dump a Map (key=value) to out
|
* Dump a Map (key=value) to out
|
||||||
* @param map Map
|
* @param map Map
|
||||||
*/
|
*/
|
||||||
static public void dump (Map map)
|
static public void dump (Map map)
|
||||||
{
|
{
|
||||||
|
@ -421,8 +425,8 @@ public class Util
|
||||||
} // dump (Map)
|
} // dump (Map)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print Action and Input Map for component
|
* Print Action and Input Map for component
|
||||||
* @param comp Component with ActionMap
|
* @param comp Component with ActionMap
|
||||||
*/
|
*/
|
||||||
public static void printActionInputMap (JComponent comp)
|
public static void printActionInputMap (JComponent comp)
|
||||||
{
|
{
|
||||||
|
@ -500,9 +504,9 @@ public class Util
|
||||||
} // printActionInputMap
|
} // printActionInputMap
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is 8 Bit
|
* Is 8 Bit
|
||||||
* @param str string
|
* @param str string
|
||||||
* @return true if string contains chars > 255
|
* @return true if string contains chars > 255
|
||||||
*/
|
*/
|
||||||
public static boolean is8Bit (String str)
|
public static boolean is8Bit (String str)
|
||||||
{
|
{
|
||||||
|
@ -521,9 +525,9 @@ public class Util
|
||||||
} // is8Bit
|
} // is8Bit
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean Ampersand (used to indicate shortcut)
|
* Clean Ampersand (used to indicate shortcut)
|
||||||
* @param in input
|
* @param in input
|
||||||
* @return cleaned string
|
* @return cleaned string
|
||||||
*/
|
*/
|
||||||
public static String cleanAmp (String in)
|
public static String cleanAmp (String in)
|
||||||
{
|
{
|
||||||
|
@ -539,10 +543,10 @@ public class Util
|
||||||
} // cleanAmp
|
} // cleanAmp
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trim to max character length
|
* Trim to max character length
|
||||||
* @param str string
|
* @param str string
|
||||||
* @param length max (incl) character length
|
* @param length max (incl) character length
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static String trimLength (String str, int length)
|
public static String trimLength (String str, int length)
|
||||||
{
|
{
|
||||||
|
@ -556,9 +560,9 @@ public class Util
|
||||||
} // trimLength
|
} // trimLength
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Size of String in bytes
|
* Size of String in bytes
|
||||||
* @param str string
|
* @param str string
|
||||||
* @return size in bytes
|
* @return size in bytes
|
||||||
*/
|
*/
|
||||||
public static int size (String str)
|
public static int size (String str)
|
||||||
{
|
{
|
||||||
|
@ -578,10 +582,10 @@ public class Util
|
||||||
} // size
|
} // size
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trim to max byte size
|
* Trim to max byte size
|
||||||
* @param str string
|
* @param str string
|
||||||
* @param size max size in bytes
|
* @param size max size in bytes
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static String trimSize (String str, int size)
|
public static String trimSize (String str, int size)
|
||||||
{
|
{
|
||||||
|
@ -612,8 +616,8 @@ public class Util
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Test
|
* Test
|
||||||
* @param args args
|
* @param args args
|
||||||
*/
|
*/
|
||||||
public static void main (String[] args)
|
public static void main (String[] args)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue