You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-commits@incubator.apache.org by ng...@apache.org on 2007/10/02 20:57:40 UTC
svn commit: r581383 - in
/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver:
command/PASS.java util/ClassUtils.java
Author: ngn
Date: Tue Oct 2 13:57:40 2007
New Revision: 581383
URL: http://svn.apache.org/viewvc?rev=581383&view=rev
Log:
Fixed potential NPEs
Modified:
incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASS.java
incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/util/ClassUtils.java
Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASS.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASS.java?rev=581383&r1=581382&r2=581383&view=diff
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASS.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASS.java Tue Oct 2 13:57:40 2007
@@ -98,14 +98,17 @@
}
// anonymous login limit check
- boolean anonymous = userName.equals("anonymous");
- int currAnonLogin = stat.getCurrentAnonymousLoginNumber();
- int maxAnonLogin = conManager.getMaxAnonymousLogins();
- if( anonymous && (currAnonLogin >= maxAnonLogin) ) {
- out.write(FtpReplyUtil.translate(session, FtpReply.REPLY_421_SERVICE_NOT_AVAILABLE_CLOSING_CONTROL_CONNECTION, "PASS.anonymous", null));
- return;
- }
+ boolean anonymous = userName != null && userName.equals("anonymous");
+ if(anonymous) {
+ int currAnonLogin = stat.getCurrentAnonymousLoginNumber();
+ int maxAnonLogin = conManager.getMaxAnonymousLogins();
+ if( currAnonLogin >= maxAnonLogin ) {
+ out.write(FtpReplyUtil.translate(session, FtpReply.REPLY_421_SERVICE_NOT_AVAILABLE_CLOSING_CONTROL_CONNECTION, "PASS.anonymous", null));
+ return;
+ }
+ }
+
// login limit check
int currLogin = stat.getCurrentLoginNumber();
int maxLogin = conManager.getMaxLogins();
Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/util/ClassUtils.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/util/ClassUtils.java?rev=581383&r1=581382&r2=581383&view=diff
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/util/ClassUtils.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/util/ClassUtils.java Tue Oct 2 13:57:40 2007
@@ -76,9 +76,12 @@
throw new RuntimeException("Failed invoking setter " + setter.getDisplayName() + " on " + target, e);
}
} else {
- throw new RuntimeException("Property \"" + setter.getDisplayName() + "\" is not settable on class "+ target.getClass());
+ if(setter != null) {
+ throw new RuntimeException("Property \"" + setter.getDisplayName() + "\" is not settable on class "+ target.getClass());
+ } else {
+ throw new RuntimeException("Property is not settable on class "+ target.getClass());
+ }
}
-
}
private static void setProperty(Object target, PropertyDescriptor setter, String propertyValue) {