You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by pg...@apache.org on 2002/08/08 01:37:02 UTC
cvs commit: jakarta-james/src/java/org/apache/james/nntpserver LISTGroup.java AuthServiceImpl.java NNTPServer.java
pgoldstein 2002/08/07 16:37:02
Modified: src/java/org/apache/james/nntpserver LISTGroup.java
AuthServiceImpl.java NNTPServer.java
Log:
Part of the String=>StringBuffer changes. Includes some additional
commenting, formatting fixes, and wrapping of logging calls in log
level checks. Also converted equalsIgnoreCase paradigm as discussed on
mailing list. Locale issue for both toUpperCase() and toLowerCase() was
addressed as well.
Revision Changes Path
1.4 +16 -4 jakarta-james/src/java/org/apache/james/nntpserver/LISTGroup.java
Index: LISTGroup.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/LISTGroup.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- LISTGroup.java 18 Jan 2002 02:48:36 -0000 1.3
+++ LISTGroup.java 7 Aug 2002 23:37:02 -0000 1.4
@@ -24,16 +24,28 @@
static LISTGroup ACTIVE(final PrintWriter prt) {
return new LISTGroup() {
public void show(NNTPGroup group) {
- prt.println(group.getName()+" "+group.getFirstArticleNumber()+" "+
- group.getLastArticleNumber()+" "+
- (group.isPostAllowed()?"y":"n"));
+ StringBuffer showBuffer =
+ new StringBuffer(128)
+ .append(group.getName())
+ .append(" ")
+ .append(group.getFirstArticleNumber())
+ .append(" ")
+ .append(group.getLastArticleNumber())
+ .append(" ")
+ .append((group.isPostAllowed() ? "y":"n"));
+ prt.println(showBuffer.toString());
}
};
}
static LISTGroup NEWSGROUPS(final PrintWriter prt) {
return new LISTGroup() {
public void show(NNTPGroup group) {
- prt.println(group.getName()+" "+group.getDescription());
+ StringBuffer showBuffer =
+ new StringBuffer(128)
+ .append(group.getName())
+ .append(" ")
+ .append(group.getDescription());
+ prt.println(showBuffer.toString());
}
};
}
1.4 +10 -5 jakarta-james/src/java/org/apache/james/nntpserver/AuthServiceImpl.java
Index: AuthServiceImpl.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/AuthServiceImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AuthServiceImpl.java 3 Jun 2002 16:07:06 -0000 1.3
+++ AuthServiceImpl.java 7 Aug 2002 23:37:02 -0000 1.4
@@ -17,6 +17,8 @@
import org.apache.james.services.UsersRepository;
import org.apache.james.services.UsersStore;
+import java.util.Locale;
+
/**
* Provides Authentication State.
* Authenticates users.
@@ -40,12 +42,13 @@
protected boolean passwordSet = false;
public boolean isAuthorized(String command) {
+ command = command.toUpperCase(Locale.US);
boolean allowed = isAuthenticated();
// some commads are authorized, even if the user is not authenticated
- allowed = allowed || command.equalsIgnoreCase("AUTHINFO");
- allowed = allowed || command.equalsIgnoreCase("AUTHINFO");
- allowed = allowed || command.equalsIgnoreCase("MODE");
- allowed = allowed || command.equalsIgnoreCase("QUIT");
+ allowed = allowed || command.equals("AUTHINFO");
+ allowed = allowed || command.equals("AUTHINFO");
+ allowed = allowed || command.equals("MODE");
+ allowed = allowed || command.equals("QUIT");
return allowed;
}
@@ -59,7 +62,9 @@
public void configure( Configuration configuration ) throws ConfigurationException {
authRequired =
configuration.getChild("authRequired").getValueAsBoolean(false);
- getLogger().debug("Auth required state is :" + authRequired);
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Auth required state is :" + authRequired);
+ }
}
public boolean isAuthenticated() {
1.7 +5 -3 jakarta-james/src/java/org/apache/james/nntpserver/NNTPServer.java
Index: NNTPServer.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/NNTPServer.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- NNTPServer.java 3 Jun 2002 16:07:06 -0000 1.6
+++ NNTPServer.java 7 Aug 2002 23:37:02 -0000 1.7
@@ -31,7 +31,7 @@
public void configure( final Configuration configuration )
throws ConfigurationException
{
- //System.out.println(getClass().getName()+": configure");
+ //System.out.println(getClass().getName() + ": configure");
m_port = configuration.getChild( "port" ).getValueAsInteger( 119 );
try {
@@ -49,11 +49,13 @@
}
super.configure( configuration.getChild( "handler" ) );
- getLogger().info("configured NNTPServer to run at : "+m_port);
+ if (getLogger().isInfoEnabled()) {
+ getLogger().info("configured NNTPServer to run at : " + m_port);
+ }
}
public void initialize() throws Exception {
- //System.out.println(getClass().getName()+": init");
+ //System.out.println(getClass().getName() + ": init");
super.initialize();
System.out.println("Started NNTP Server "+m_connectionName);
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>