Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
erwan committed Mar 14, 2011
1 parent 30060f1 commit 137612d
Show file tree
Hide file tree
Showing 20 changed files with 14 additions and 36 deletions.
2 changes: 1 addition & 1 deletion framework/src/play/cache/MemcachedImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static MemcachedImpl getInstance(boolean forceClientInit) throws IOExcept
} else if (forceClientInit) {
// When you stop the client, it sets the interrupted state of this thread to true. If you try to reinit it with the same thread in this state,
// Memcached client errors out. So a simple call to interrupted() will reset this flag
Thread.currentThread().interrupted();
Thread.interrupted();
uniqueInstance.initClient();
}
return uniqueInstance;
Expand Down
1 change: 0 additions & 1 deletion framework/src/play/classloading/ApplicationClasses.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.Map;
import play.Logger;
import play.Play;
import play.PlayPlugin;
import play.exceptions.UnexpectedException;
import play.vfs.VirtualFile;

Expand Down
2 changes: 0 additions & 2 deletions framework/src/play/classloading/ApplicationClassloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.log4j.PatternLayout;
import play.Logger;
import play.Play;
import play.PlayPlugin;
import play.vfs.VirtualFile;
import play.cache.Cache;
import play.classloading.ApplicationClasses.ApplicationClass;
Expand Down
1 change: 0 additions & 1 deletion framework/src/play/data/binding/Binder.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import play.Logger;
import play.Play;
import play.PlayPlugin;
import play.data.Upload;
import play.data.binding.types.*;
import play.data.validation.Validation;
Expand Down
1 change: 0 additions & 1 deletion framework/src/play/data/binding/Unbinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.util.List;
import java.util.Map;
import play.Play;
import play.PlayPlugin;
import play.data.binding.types.DateBinder;

/**
Expand Down
1 change: 0 additions & 1 deletion framework/src/play/data/validation/Validation.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.regex.Pattern;
import net.sf.oval.configuration.annotation.AbstractAnnotationCheck;
import play.Play;
import play.PlayPlugin;
import play.classloading.enhancers.LocalvariablesNamesEnhancer.LocalVariablesNamesTracer;
import play.exceptions.UnexpectedException;

Expand Down
1 change: 0 additions & 1 deletion framework/src/play/db/DBPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.mchange.v2.c3p0.ComboPooledDataSource;

import java.io.File;
import java.io.FileInputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.sql.Connection;
Expand Down
1 change: 0 additions & 1 deletion framework/src/play/db/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.lang.reflect.Field;
import java.util.List;
import play.Play;
import play.PlayPlugin;
import play.exceptions.UnexpectedException;

public interface Model {
Expand Down
10 changes: 4 additions & 6 deletions framework/src/play/db/jpa/Blob.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import org.hibernate.Hibernate;

import org.hibernate.HibernateException;
import org.hibernate.type.StringType;
import org.hibernate.usertype.UserType;

import play.Play;
import play.db.Model.BinaryField;
import play.exceptions.UnexpectedException;
Expand Down Expand Up @@ -84,12 +86,8 @@ public int hashCode(Object o) throws HibernateException {
return o.hashCode();
}

// TODO: After we switch to Hibernate 3.6, Hibernate.STRING must be changed to
// Hibernate.StringType.INSTANCE (how stupid is that to deprecate stuff before offering
// an alternative?
@SuppressWarnings("deprecation")
public Object nullSafeGet(ResultSet rs, String[] names, Object o) throws HibernateException, SQLException {
String val = (String) Hibernate.STRING.nullSafeGet(rs, names[0]);
String val = (String) StringType.INSTANCE.nullSafeGet(rs, names[0]);
if(val == null || val.length() == 0 || !val.contains("|")) {
return new Blob();
}
Expand Down
1 change: 0 additions & 1 deletion framework/src/play/i18n/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.regex.Pattern;

import play.Play;
import play.PlayPlugin;
import play.data.binding.Binder;

/**
Expand Down
19 changes: 8 additions & 11 deletions framework/src/play/libs/Time.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.commons.lang.NotImplementedException;

/**
* Time utils
*/
Expand Down Expand Up @@ -196,7 +198,7 @@ public static Date parseCRONExpression(String cron) {
* month".
* <P>
* The '#' character is allowed for the day-of-week field. This character is
* used to specify &quot;the nth&quot; XXX day of the month. For example, the
* used to specify &quot;the nth&quot; xxx day of the month. For example, the
* value of &quot;6#3&quot; in the day-of-week field means the third Friday of
* the month (day 6 = Friday and &quot;#3&quot; = the 3rd one in the month).
* Other examples: &quot;2#1&quot; = the first Monday of the month and
Expand Down Expand Up @@ -356,8 +358,6 @@ public Date getNextInvalidTimeAfter(Date date) {

Date newDate = null;

//TODO: (QUARTZ-481) IMPROVE THIS! The following is a BAD solution to this problem. Performance will be very bad here, depending on the cron expression. It is, however A solution.

//keep getting the next included time until it's farther than one second
// apart. At that point, lastDate is the last valid fire time. We return
// the second immediately following it.
Expand Down Expand Up @@ -1256,8 +1256,8 @@ protected Date getTimeAfter(Date afterTime) {
continue;
}
} else if (dayOfWSpec && !dayOfMSpec) { // get day by day of week rule
if (lastdayOfWeek) { // are we looking for the last XXX day of
// the month?
if (lastdayOfWeek) {
// are we looking for the last day of the month?
int dow = daysOfWeek.first().intValue(); // desired
// d-o-w
int cDow = cl.get(Calendar.DAY_OF_WEEK); // current d-o-w
Expand Down Expand Up @@ -1300,7 +1300,7 @@ protected Date getTimeAfter(Date afterTime) {
}

} else if (nthdayOfWeek != 0) {
// are we looking for the Nth XXX day in the month?
// are we looking for the Nth day in the month?
int dow = daysOfWeek.first().intValue(); // desired
// d-o-w
int cDow = cl.get(Calendar.DAY_OF_WEEK); // current d-o-w
Expand Down Expand Up @@ -1383,7 +1383,6 @@ protected Date getTimeAfter(Date afterTime) {
} else { // dayOfWSpec && !dayOfMSpec
throw new UnsupportedOperationException(
"Support for specifying both a day-of-week AND a day-of-month parameter is not implemented.");
// TODO:
}
cl.set(Calendar.DAY_OF_MONTH, day);

Expand Down Expand Up @@ -1473,17 +1472,15 @@ protected void setCalendarHour(Calendar cal, int hour) {
* that the <code>CronExpression</code> matches.
*/
protected Date getTimeBefore(Date endTime) {
// TODO: implement QUARTZ-423
return null;
throw new NotImplementedException();
}

/**
* NOT YET IMPLEMENTED: Returns the final time that the
* <code>CronExpression</code> will match.
*/
public Date getFinalFireTime() {
// TODO: implement QUARTZ-423
return null;
throw new NotImplementedException();
}

protected boolean isLeapYear(int year) {
Expand Down
2 changes: 0 additions & 2 deletions framework/src/play/mvc/ActionInvoker.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.apache.log4j.PatternLayout;
import play.Logger;
import play.Play;
import play.PlayPlugin;
import play.cache.CacheFor;
import play.classloading.enhancers.ControllersEnhancer.ControllerInstrumentation;
import play.classloading.enhancers.ControllersEnhancer.ControllerSupport;
Expand Down
1 change: 0 additions & 1 deletion framework/src/play/mvc/Router.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import play.Logger;
import play.Play;
import play.Play.Mode;
import play.PlayPlugin;
import play.vfs.VirtualFile;
import play.exceptions.NoRouteFoundException;
import play.exceptions.UnexpectedException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public void onConfigurationRead() {

}

@SuppressWarnings("unchecked")
private Class<PlayPlugin> resolveClass(String pluginClassName) {
try{
return (Class<PlayPlugin>)getClass().getClassLoader().loadClass(pluginClassName);
Expand Down
1 change: 0 additions & 1 deletion framework/src/play/server/PlayHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import play.Invoker.InvocationContext;
import play.Logger;
import play.Play;
import play.PlayPlugin;
import play.exceptions.PlayException;
import play.exceptions.UnexpectedException;
import play.i18n.Messages;
Expand Down
1 change: 0 additions & 1 deletion framework/src/play/server/ServletWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import play.Invoker.InvocationContext;
import play.Logger;
import play.Play;
import play.PlayPlugin;
import play.data.validation.Validation;
import play.exceptions.PlayException;
import play.exceptions.UnexpectedException;
Expand Down
1 change: 0 additions & 1 deletion framework/src/play/templates/GroovyTemplateCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.Map;
import java.util.regex.Pattern;
import play.Play;
import play.PlayPlugin;
import play.exceptions.TemplateCompilationException;
import play.templates.GroovyInlineTags.CALL;

Expand Down
1 change: 0 additions & 1 deletion framework/src/play/templates/TemplateLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import play.Logger;
import play.Play;
import play.PlayPlugin;
import play.vfs.VirtualFile;
import play.exceptions.TemplateCompilationException;
import play.exceptions.TemplateNotFoundException;
Expand Down
1 change: 0 additions & 1 deletion framework/src/play/test/Fixtures.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import play.Logger;
import play.Play;
import play.PlayPlugin;
import play.classloading.ApplicationClasses;
import play.data.binding.Binder;
import play.data.binding.types.DateBinder;
Expand Down
1 change: 0 additions & 1 deletion framework/src/play/test/TestEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import play.Logger;
import play.Play;
import play.PlayPlugin;
import play.vfs.VirtualFile;

/**
Expand Down

0 comments on commit 137612d

Please sign in to comment.