You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2008/12/10 18:09:22 UTC
svn commit: r725343 - in
/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel:
component/file/FileComponent.java
component/file/strategy/RenameFileProcessStrategy.java util/ObjectHelper.java
Author: davsclaus
Date: Wed Dec 10 09:09:21 2008
New Revision: 725343
URL: http://svn.apache.org/viewvc?rev=725343&view=rev
Log:
CAMEL-1155: Refactored ObjectHelper to use isEmpty, isNotEmpty for null and empty string tests.
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java?rev=725343&r1=725342&r2=725343&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java Wed Dec 10 09:09:21 2008
@@ -94,7 +94,7 @@
boolean ignoreCase = reminder.startsWith("ignoreCase:");
reminder = ignoreCase ? ifStartsWithReturnRemainder("ignoreCase:", reminder) : reminder;
- ObjectHelper.notNull(reminder, "sortBy expression");
+ ObjectHelper.notEmpty(reminder, "sortBy expression", this);
// recursive add nested sorters
return DefaultFileSorter.sortByFileLanguage(reminder, reverse, ignoreCase, createSortByComparator(it));
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java?rev=725343&r1=725342&r2=725343&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java Wed Dec 10 09:09:21 2008
@@ -62,7 +62,6 @@
if (beginRenamer != null) {
File newName = beginRenamer.renameFile(exchange, file);
- // deleting any existing files before renaming
File to = renameFile(file, newName);
exchange.setFile(to);
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java?rev=725343&r1=725342&r2=725343&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java Wed Dec 10 09:09:21 2008
@@ -157,33 +157,64 @@
}
/**
- * Asserts whether the value is <b>not</b> <tt>null</tt> or an empty string.
+ * Asserts whether the value is <b>not</b> <tt>null</tt>
*
* @param value the value to test
* @param name the key that resolved the value
+ * @throws IllegalArgumentException is thrown if assertion fails
*/
public static void notNull(Object value, String name) {
- if (isEmpty(value)) {
+ if (value == null) {
throw new IllegalArgumentException(name + " must be specified");
}
}
/**
- * Asserts whether the value is <b>not</b> <tt>null</tt> or an empty string.
+ * Asserts whether the value is <b>not</b> <tt>null</tt>
*
* @param value the value to test
* @param on additional description to indicate where this problem occured (appended as toString())
* @param name the key that resolved the value
+ * @throws IllegalArgumentException is thrown if assertion fails
*/
public static void notNull(Object value, String name, Object on) {
if (on == null) {
notNull(value, name);
- } else if (isEmpty(value)) {
+ } else if (value == null) {
throw new IllegalArgumentException(name + " must be specified on: " + on);
}
}
/**
+ * Asserts whether the string is <b>not</b> empty.
+ *
+ * @param value the string to test
+ * @param name the key that resolved the value
+ * @throws IllegalArgumentException is thrown if assertion fails
+ */
+ public static void notEmpty(String value, String name) {
+ if (isEmpty(value)) {
+ throw new IllegalArgumentException(name + " must be specified and not empty");
+ }
+ }
+
+ /**
+ * Asserts whether the string is <b>not</b> empty.
+ *
+ * @param value the string to test
+ * @param on additional description to indicate where this problem occured (appended as toString())
+ * @param name the key that resolved the value
+ * @throws IllegalArgumentException is thrown if assertion fails
+ */
+ public static void notEmpty(String value, String name, Object on) {
+ if (on == null) {
+ notNull(value, name);
+ } else if (isEmpty(value)) {
+ throw new IllegalArgumentException(name + " must be specified and not empty on: " + on);
+ }
+ }
+
+ /**
* Tests whether the value is <tt>null</tt> or an empty string.
*
* @param value the value, if its a String it will be tested for text length as well
Re: svn commit: r725343 - in /activemq/camel/trunk/camel-core/src/main/java/org/apache/camel: component/file/FileComponent.java component/file/strategy/RenameFileProcessStrategy.java util/ObjectHelper.java
Posted by Claus Ibsen <cl...@gmail.com>.
D:\project\camel\components\camel-ftp>svn commit --message
"CAMEL-1155: Sorry James my Bad"
Sending camel-ftp\src\main\java\org\apache\camel\component\file\remote\FtpProducer.java
Sending camel-ftp\src\main\java\org\apache\camel\component\file\remote\SftpEndpoint.java
Sending camel-ftp\src\main\java\org\apache\camel\component\file\remote\SftpProducer.java
Transmitting file data ...
Committed revision 725401.
On Wed, Dec 10, 2008 at 8:39 PM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> Sorry my bad. I have a separate camel-ftp with a large refactor in
> progress of the FTP component. So this refactor rename slipped.
>
> I will fix it asap.
>
>
>
> On Wed, Dec 10, 2008 at 8:30 PM, James Strachan
> <ja...@gmail.com> wrote:
>> I get build failures in camel-ftp now - do you?
>>
>> /mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java:[28,0]
>> cannot find symbol
>> symbol : static isNotNullAndNonEmpty
>> location: class org.apache.camel.util.ObjectHelper
>>
>> /mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpProducer.java:[96,51]
>> cannot find symbol
>> symbol : method isNotNullAndNonEmpty(java.lang.String)
>> location: class org.apache.camel.util.ObjectHelper
>>
>> /mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java:[55,12]
>> cannot find symbol
>> symbol : method isNotNullAndNonEmpty(java.lang.String)
>> location: class org.apache.camel.component.file.remote.SftpEndpoint
>>
>> /mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java:[58,16]
>> cannot find symbol
>> symbol : method isNotNullAndNonEmpty(java.lang.String)
>> location: class org.apache.camel.component.file.remote.SftpEndpoint
>>
>> /mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java:[66,12]
>> cannot find symbol
>> symbol : method isNotNullAndNonEmpty(java.lang.String)
>> location: class org.apache.camel.component.file.remote.SftpEndpoint
>>
>> /mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java:[95,51]
>> cannot find symbol
>> symbol : method isNotNullAndNonEmpty(java.lang.String)
>> location: class org.apache.camel.util.ObjectHelper
>>
>> 2008/12/10 <da...@apache.org>:
>>> Author: davsclaus
>>> Date: Wed Dec 10 09:09:21 2008
>>> New Revision: 725343
>>>
>>> URL: http://svn.apache.org/viewvc?rev=725343&view=rev
>>> Log:
>>> CAMEL-1155: Refactored ObjectHelper to use isEmpty, isNotEmpty for null and empty string tests.
>>>
>>> Modified:
>>> activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java
>>> activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java
>>> activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
>>>
>>> Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java
>>> URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java?rev=725343&r1=725342&r2=725343&view=diff
>>> ==============================================================================
>>> --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java (original)
>>> +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java Wed Dec 10 09:09:21 2008
>>> @@ -94,7 +94,7 @@
>>> boolean ignoreCase = reminder.startsWith("ignoreCase:");
>>> reminder = ignoreCase ? ifStartsWithReturnRemainder("ignoreCase:", reminder) : reminder;
>>>
>>> - ObjectHelper.notNull(reminder, "sortBy expression");
>>> + ObjectHelper.notEmpty(reminder, "sortBy expression", this);
>>>
>>> // recursive add nested sorters
>>> return DefaultFileSorter.sortByFileLanguage(reminder, reverse, ignoreCase, createSortByComparator(it));
>>>
>>> Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java
>>> URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java?rev=725343&r1=725342&r2=725343&view=diff
>>> ==============================================================================
>>> --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java (original)
>>> +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java Wed Dec 10 09:09:21 2008
>>> @@ -62,7 +62,6 @@
>>>
>>> if (beginRenamer != null) {
>>> File newName = beginRenamer.renameFile(exchange, file);
>>> - // deleting any existing files before renaming
>>> File to = renameFile(file, newName);
>>> exchange.setFile(to);
>>> }
>>>
>>> Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
>>> URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java?rev=725343&r1=725342&r2=725343&view=diff
>>> ==============================================================================
>>> --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java (original)
>>> +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java Wed Dec 10 09:09:21 2008
>>> @@ -157,33 +157,64 @@
>>> }
>>>
>>> /**
>>> - * Asserts whether the value is <b>not</b> <tt>null</tt> or an empty string.
>>> + * Asserts whether the value is <b>not</b> <tt>null</tt>
>>> *
>>> * @param value the value to test
>>> * @param name the key that resolved the value
>>> + * @throws IllegalArgumentException is thrown if assertion fails
>>> */
>>> public static void notNull(Object value, String name) {
>>> - if (isEmpty(value)) {
>>> + if (value == null) {
>>> throw new IllegalArgumentException(name + " must be specified");
>>> }
>>> }
>>>
>>> /**
>>> - * Asserts whether the value is <b>not</b> <tt>null</tt> or an empty string.
>>> + * Asserts whether the value is <b>not</b> <tt>null</tt>
>>> *
>>> * @param value the value to test
>>> * @param on additional description to indicate where this problem occured (appended as toString())
>>> * @param name the key that resolved the value
>>> + * @throws IllegalArgumentException is thrown if assertion fails
>>> */
>>> public static void notNull(Object value, String name, Object on) {
>>> if (on == null) {
>>> notNull(value, name);
>>> - } else if (isEmpty(value)) {
>>> + } else if (value == null) {
>>> throw new IllegalArgumentException(name + " must be specified on: " + on);
>>> }
>>> }
>>>
>>> /**
>>> + * Asserts whether the string is <b>not</b> empty.
>>> + *
>>> + * @param value the string to test
>>> + * @param name the key that resolved the value
>>> + * @throws IllegalArgumentException is thrown if assertion fails
>>> + */
>>> + public static void notEmpty(String value, String name) {
>>> + if (isEmpty(value)) {
>>> + throw new IllegalArgumentException(name + " must be specified and not empty");
>>> + }
>>> + }
>>> +
>>> + /**
>>> + * Asserts whether the string is <b>not</b> empty.
>>> + *
>>> + * @param value the string to test
>>> + * @param on additional description to indicate where this problem occured (appended as toString())
>>> + * @param name the key that resolved the value
>>> + * @throws IllegalArgumentException is thrown if assertion fails
>>> + */
>>> + public static void notEmpty(String value, String name, Object on) {
>>> + if (on == null) {
>>> + notNull(value, name);
>>> + } else if (isEmpty(value)) {
>>> + throw new IllegalArgumentException(name + " must be specified and not empty on: " + on);
>>> + }
>>> + }
>>> +
>>> + /**
>>> * Tests whether the value is <tt>null</tt> or an empty string.
>>> *
>>> * @param value the value, if its a String it will be tested for text length as well
>>>
>>>
>>>
>>
>>
>>
>> --
>> James
>> -------
>> http://macstrac.blogspot.com/
>>
>> Open Source Integration
>> http://fusesource.com/
>>
>
>
>
> --
>
> /Claus Ibsen
> Apache Camel Committer
> Blog: http://davsclaus.blogspot.com/
>
--
/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/
Re: svn commit: r725343 - in /activemq/camel/trunk/camel-core/src/main/java/org/apache/camel: component/file/FileComponent.java component/file/strategy/RenameFileProcessStrategy.java util/ObjectHelper.java
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Sorry my bad. I have a separate camel-ftp with a large refactor in
progress of the FTP component. So this refactor rename slipped.
I will fix it asap.
On Wed, Dec 10, 2008 at 8:30 PM, James Strachan
<ja...@gmail.com> wrote:
> I get build failures in camel-ftp now - do you?
>
> /mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java:[28,0]
> cannot find symbol
> symbol : static isNotNullAndNonEmpty
> location: class org.apache.camel.util.ObjectHelper
>
> /mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpProducer.java:[96,51]
> cannot find symbol
> symbol : method isNotNullAndNonEmpty(java.lang.String)
> location: class org.apache.camel.util.ObjectHelper
>
> /mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java:[55,12]
> cannot find symbol
> symbol : method isNotNullAndNonEmpty(java.lang.String)
> location: class org.apache.camel.component.file.remote.SftpEndpoint
>
> /mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java:[58,16]
> cannot find symbol
> symbol : method isNotNullAndNonEmpty(java.lang.String)
> location: class org.apache.camel.component.file.remote.SftpEndpoint
>
> /mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java:[66,12]
> cannot find symbol
> symbol : method isNotNullAndNonEmpty(java.lang.String)
> location: class org.apache.camel.component.file.remote.SftpEndpoint
>
> /mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java:[95,51]
> cannot find symbol
> symbol : method isNotNullAndNonEmpty(java.lang.String)
> location: class org.apache.camel.util.ObjectHelper
>
> 2008/12/10 <da...@apache.org>:
>> Author: davsclaus
>> Date: Wed Dec 10 09:09:21 2008
>> New Revision: 725343
>>
>> URL: http://svn.apache.org/viewvc?rev=725343&view=rev
>> Log:
>> CAMEL-1155: Refactored ObjectHelper to use isEmpty, isNotEmpty for null and empty string tests.
>>
>> Modified:
>> activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java
>> activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java
>> activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
>>
>> Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java
>> URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java?rev=725343&r1=725342&r2=725343&view=diff
>> ==============================================================================
>> --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java (original)
>> +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java Wed Dec 10 09:09:21 2008
>> @@ -94,7 +94,7 @@
>> boolean ignoreCase = reminder.startsWith("ignoreCase:");
>> reminder = ignoreCase ? ifStartsWithReturnRemainder("ignoreCase:", reminder) : reminder;
>>
>> - ObjectHelper.notNull(reminder, "sortBy expression");
>> + ObjectHelper.notEmpty(reminder, "sortBy expression", this);
>>
>> // recursive add nested sorters
>> return DefaultFileSorter.sortByFileLanguage(reminder, reverse, ignoreCase, createSortByComparator(it));
>>
>> Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java
>> URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java?rev=725343&r1=725342&r2=725343&view=diff
>> ==============================================================================
>> --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java (original)
>> +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java Wed Dec 10 09:09:21 2008
>> @@ -62,7 +62,6 @@
>>
>> if (beginRenamer != null) {
>> File newName = beginRenamer.renameFile(exchange, file);
>> - // deleting any existing files before renaming
>> File to = renameFile(file, newName);
>> exchange.setFile(to);
>> }
>>
>> Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
>> URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java?rev=725343&r1=725342&r2=725343&view=diff
>> ==============================================================================
>> --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java (original)
>> +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java Wed Dec 10 09:09:21 2008
>> @@ -157,33 +157,64 @@
>> }
>>
>> /**
>> - * Asserts whether the value is <b>not</b> <tt>null</tt> or an empty string.
>> + * Asserts whether the value is <b>not</b> <tt>null</tt>
>> *
>> * @param value the value to test
>> * @param name the key that resolved the value
>> + * @throws IllegalArgumentException is thrown if assertion fails
>> */
>> public static void notNull(Object value, String name) {
>> - if (isEmpty(value)) {
>> + if (value == null) {
>> throw new IllegalArgumentException(name + " must be specified");
>> }
>> }
>>
>> /**
>> - * Asserts whether the value is <b>not</b> <tt>null</tt> or an empty string.
>> + * Asserts whether the value is <b>not</b> <tt>null</tt>
>> *
>> * @param value the value to test
>> * @param on additional description to indicate where this problem occured (appended as toString())
>> * @param name the key that resolved the value
>> + * @throws IllegalArgumentException is thrown if assertion fails
>> */
>> public static void notNull(Object value, String name, Object on) {
>> if (on == null) {
>> notNull(value, name);
>> - } else if (isEmpty(value)) {
>> + } else if (value == null) {
>> throw new IllegalArgumentException(name + " must be specified on: " + on);
>> }
>> }
>>
>> /**
>> + * Asserts whether the string is <b>not</b> empty.
>> + *
>> + * @param value the string to test
>> + * @param name the key that resolved the value
>> + * @throws IllegalArgumentException is thrown if assertion fails
>> + */
>> + public static void notEmpty(String value, String name) {
>> + if (isEmpty(value)) {
>> + throw new IllegalArgumentException(name + " must be specified and not empty");
>> + }
>> + }
>> +
>> + /**
>> + * Asserts whether the string is <b>not</b> empty.
>> + *
>> + * @param value the string to test
>> + * @param on additional description to indicate where this problem occured (appended as toString())
>> + * @param name the key that resolved the value
>> + * @throws IllegalArgumentException is thrown if assertion fails
>> + */
>> + public static void notEmpty(String value, String name, Object on) {
>> + if (on == null) {
>> + notNull(value, name);
>> + } else if (isEmpty(value)) {
>> + throw new IllegalArgumentException(name + " must be specified and not empty on: " + on);
>> + }
>> + }
>> +
>> + /**
>> * Tests whether the value is <tt>null</tt> or an empty string.
>> *
>> * @param value the value, if its a String it will be tested for text length as well
>>
>>
>>
>
>
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://fusesource.com/
>
--
/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/
Re: svn commit: r725343 - in /activemq/camel/trunk/camel-core/src/main/java/org/apache/camel: component/file/FileComponent.java component/file/strategy/RenameFileProcessStrategy.java util/ObjectHelper.java
Posted by James Strachan <ja...@gmail.com>.
I get build failures in camel-ftp now - do you?
/mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java:[28,0]
cannot find symbol
symbol : static isNotNullAndNonEmpty
location: class org.apache.camel.util.ObjectHelper
/mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpProducer.java:[96,51]
cannot find symbol
symbol : method isNotNullAndNonEmpty(java.lang.String)
location: class org.apache.camel.util.ObjectHelper
/mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java:[55,12]
cannot find symbol
symbol : method isNotNullAndNonEmpty(java.lang.String)
location: class org.apache.camel.component.file.remote.SftpEndpoint
/mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java:[58,16]
cannot find symbol
symbol : method isNotNullAndNonEmpty(java.lang.String)
location: class org.apache.camel.component.file.remote.SftpEndpoint
/mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java:[66,12]
cannot find symbol
symbol : method isNotNullAndNonEmpty(java.lang.String)
location: class org.apache.camel.component.file.remote.SftpEndpoint
/mnt/builds/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java:[95,51]
cannot find symbol
symbol : method isNotNullAndNonEmpty(java.lang.String)
location: class org.apache.camel.util.ObjectHelper
2008/12/10 <da...@apache.org>:
> Author: davsclaus
> Date: Wed Dec 10 09:09:21 2008
> New Revision: 725343
>
> URL: http://svn.apache.org/viewvc?rev=725343&view=rev
> Log:
> CAMEL-1155: Refactored ObjectHelper to use isEmpty, isNotEmpty for null and empty string tests.
>
> Modified:
> activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java
> activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java
> activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
>
> Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java
> URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java?rev=725343&r1=725342&r2=725343&view=diff
> ==============================================================================
> --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java (original)
> +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java Wed Dec 10 09:09:21 2008
> @@ -94,7 +94,7 @@
> boolean ignoreCase = reminder.startsWith("ignoreCase:");
> reminder = ignoreCase ? ifStartsWithReturnRemainder("ignoreCase:", reminder) : reminder;
>
> - ObjectHelper.notNull(reminder, "sortBy expression");
> + ObjectHelper.notEmpty(reminder, "sortBy expression", this);
>
> // recursive add nested sorters
> return DefaultFileSorter.sortByFileLanguage(reminder, reverse, ignoreCase, createSortByComparator(it));
>
> Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java
> URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java?rev=725343&r1=725342&r2=725343&view=diff
> ==============================================================================
> --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java (original)
> +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/RenameFileProcessStrategy.java Wed Dec 10 09:09:21 2008
> @@ -62,7 +62,6 @@
>
> if (beginRenamer != null) {
> File newName = beginRenamer.renameFile(exchange, file);
> - // deleting any existing files before renaming
> File to = renameFile(file, newName);
> exchange.setFile(to);
> }
>
> Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
> URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java?rev=725343&r1=725342&r2=725343&view=diff
> ==============================================================================
> --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java (original)
> +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java Wed Dec 10 09:09:21 2008
> @@ -157,33 +157,64 @@
> }
>
> /**
> - * Asserts whether the value is <b>not</b> <tt>null</tt> or an empty string.
> + * Asserts whether the value is <b>not</b> <tt>null</tt>
> *
> * @param value the value to test
> * @param name the key that resolved the value
> + * @throws IllegalArgumentException is thrown if assertion fails
> */
> public static void notNull(Object value, String name) {
> - if (isEmpty(value)) {
> + if (value == null) {
> throw new IllegalArgumentException(name + " must be specified");
> }
> }
>
> /**
> - * Asserts whether the value is <b>not</b> <tt>null</tt> or an empty string.
> + * Asserts whether the value is <b>not</b> <tt>null</tt>
> *
> * @param value the value to test
> * @param on additional description to indicate where this problem occured (appended as toString())
> * @param name the key that resolved the value
> + * @throws IllegalArgumentException is thrown if assertion fails
> */
> public static void notNull(Object value, String name, Object on) {
> if (on == null) {
> notNull(value, name);
> - } else if (isEmpty(value)) {
> + } else if (value == null) {
> throw new IllegalArgumentException(name + " must be specified on: " + on);
> }
> }
>
> /**
> + * Asserts whether the string is <b>not</b> empty.
> + *
> + * @param value the string to test
> + * @param name the key that resolved the value
> + * @throws IllegalArgumentException is thrown if assertion fails
> + */
> + public static void notEmpty(String value, String name) {
> + if (isEmpty(value)) {
> + throw new IllegalArgumentException(name + " must be specified and not empty");
> + }
> + }
> +
> + /**
> + * Asserts whether the string is <b>not</b> empty.
> + *
> + * @param value the string to test
> + * @param on additional description to indicate where this problem occured (appended as toString())
> + * @param name the key that resolved the value
> + * @throws IllegalArgumentException is thrown if assertion fails
> + */
> + public static void notEmpty(String value, String name, Object on) {
> + if (on == null) {
> + notNull(value, name);
> + } else if (isEmpty(value)) {
> + throw new IllegalArgumentException(name + " must be specified and not empty on: " + on);
> + }
> + }
> +
> + /**
> * Tests whether the value is <tt>null</tt> or an empty string.
> *
> * @param value the value, if its a String it will be tested for text length as well
>
>
>
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://fusesource.com/