Explorar o código

Fixed deperication warnings.

Thomas Flucke %!s(int64=7) %!d(string=hai) anos
pai
achega
536a5c6d7a

+ 1 - 0
.gitignore

@@ -1 +1,2 @@
 build/
+.idea/

+ 2 - 2
build.xml

@@ -28,8 +28,8 @@
     <property name="compile.debug" value="true" />
 	<property name="compile.deprecation" value="true" />
 	<property name="compile.optimize" value="true" />
-	<property name="compile.nowarn" value="true" />
-	<property name="compile.nowarn" value="true" />
+	<property name="compile.nowarn" value="false" />
+	<property name="compile.werror" value="true" />
 
 	<property name="app.name" value="ieat" />
 	<property name="app.path" value="/${app.name}" />

+ 2 - 2
src/magoffin/matt/ieat/biz/RecipeBiz.java

@@ -52,10 +52,10 @@ import magoffin.matt.util.TemporaryFile;
 public interface RecipeBiz {
 	
 	/** The US measurement system constant. */
-	public static final Integer US_SYSTEM_ID = new Integer(1);
+	public static final Integer US_SYSTEM_ID = 1;
 	
 	/** The Metric measurement system constant. */
-	public static final Integer METRIC_SYSTEM_ID = new Integer(2);
+	public static final Integer METRIC_SYSTEM_ID = 2;
 	
 	/**
 	 * Get a Recipe by its ID.

+ 1 - 1
src/magoffin/matt/ieat/biz/impl/RecipeBizImpl.java

@@ -579,7 +579,7 @@ public class RecipeBizImpl implements RecipeBiz {
 		Integer servings = altered.getServingSize();
 		int newServings = (int)Math.floor(
 				(servings == null ? 1.0 : servings.doubleValue()) * size);
-		altered.setServingSize(new Integer(newServings));
+		altered.setServingSize(newServings);
 
 		altered.getIngredient().clear();
 		

+ 1 - 1
src/magoffin/matt/ieat/biz/impl/UserBizImpl.java

@@ -120,7 +120,7 @@ public class UserBizImpl implements UserBiz {
 		}
 		
 		// generate random access level (negative), to use as confirmation
-		Integer rnd = new Integer(-(int)(Math.random()*1000000000));
+		Integer rnd = -(int)(Math.random()*1000000000);
 		user.setAccessLevel(rnd);
 		
 		// store user

+ 12 - 12
src/magoffin/matt/ieat/biz/impl/lucene/RecipeSearchBizLuceneImpl.java

@@ -79,7 +79,7 @@ public class RecipeSearchBizLuceneImpl implements RecipeSearchBiz, RecipeSearchI
 	 */
 	private static final String LUCENE_SORT_ERROR_EMPTY_INDEX = "no terms";
 
-	private static final Integer ZERO = new Integer(0);
+	private static final Integer ZERO = 0;
 	
 	private final Logger log = Logger.getLogger(RecipeSearchBizLuceneImpl.class);
 
@@ -120,12 +120,12 @@ public class RecipeSearchBizLuceneImpl implements RecipeSearchBiz, RecipeSearchI
 		Set<Integer> tmpSet = new TreeSet<Integer>(); // to sort
 		for ( int i = 0; i < allowableRecipeIndexPageSizes.length; i++ ) {
 			if ( allowableRecipeIndexPageSizes[i] < 1 ) {
-				tmpSet.add(new Integer(-1));
+				tmpSet.add(-1);
 			} else {
-				tmpSet.add(new Integer(allowableRecipeIndexPageSizes[i]));
+				tmpSet.add(allowableRecipeIndexPageSizes[i]);
 			}
 		}
-		if ( !tmpSet.contains(new Integer(defaultRecipeIndexPageSize)) ) {
+		if ( !tmpSet.contains(defaultRecipeIndexPageSize) ) {
 			throw new RuntimeException("defaultRecipeIndexPageSize value '" 
 					+defaultRecipeIndexPageSize +"' not available in allowableRecipeIndexPageSizes set "
 					+tmpSet);
@@ -133,7 +133,7 @@ public class RecipeSearchBizLuceneImpl implements RecipeSearchBiz, RecipeSearchI
 		int[] tmpArray = new int[tmpSet.size()];
 		int i = 0;
 		this.recipePagination = domainObjectFactory.getPaginationSupportInstance();
-		this.recipePagination.setDefaultPageSize(new Integer(defaultRecipeIndexPageSize));
+		this.recipePagination.setDefaultPageSize(defaultRecipeIndexPageSize);
 		for ( Iterator itr = tmpSet.iterator(); itr.hasNext(); i++ ) {
 			Integer anInt = (Integer)itr.next();
 			tmpArray[i] = anInt.intValue();
@@ -155,12 +155,12 @@ public class RecipeSearchBizLuceneImpl implements RecipeSearchBiz, RecipeSearchI
 		tmpSet.clear();
 		for ( i = 0; i < allowableUserIndexPageSizes.length; i++ ) {
 			if ( allowableUserIndexPageSizes[i] < 1 ) {
-				tmpSet.add(new Integer(-1));
+				tmpSet.add(-1);
 			} else {
-				tmpSet.add(new Integer(allowableUserIndexPageSizes[i]));
+				tmpSet.add(allowableUserIndexPageSizes[i]);
 			}
 		}
-		if ( !tmpSet.contains(new Integer(defaultUserIndexPageSize)) ) {
+		if ( !tmpSet.contains(defaultUserIndexPageSize) ) {
 			throw new RuntimeException("defaultUserIndexPageSize value '" 
 					+defaultUserIndexPageSize +"' not available in allowableUserIndexPageSizes set "
 					+tmpSet);
@@ -168,7 +168,7 @@ public class RecipeSearchBizLuceneImpl implements RecipeSearchBiz, RecipeSearchI
 		tmpArray = new int[tmpSet.size()];
 		i = 0;
 		this.userPagination = domainObjectFactory.getPaginationSupportInstance();
-		this.userPagination.setDefaultPageSize(new Integer(defaultUserIndexPageSize));
+		this.userPagination.setDefaultPageSize(defaultUserIndexPageSize);
 		for ( Iterator itr = tmpSet.iterator(); itr.hasNext(); i++ ) {
 			Integer anInt = (Integer)itr.next();
 			tmpArray[i] = anInt.intValue();
@@ -391,8 +391,8 @@ public class RecipeSearchBizLuceneImpl implements RecipeSearchBiz, RecipeSearchI
 			results.setTotalResults(ZERO);
 		}
 		
-		results.setPageSize(new Integer(pageSize));
-		results.setPageStart(new Integer(criteria.getPageStart()));
+		results.setPageSize(pageSize);
+		results.setPageStart(criteria.getPageStart());
 		results.setUiIndex(index);
 		
 		return matches;
@@ -593,7 +593,7 @@ public class RecipeSearchBizLuceneImpl implements RecipeSearchBiz, RecipeSearchI
 					domainObjectFactory.getIndexSelectionTypeInstance();
 				section.setIndexKey(aSection);
 				int count = getIndexCount(indexType,aSection);
-				section.setCount(new Integer(count));
+				section.setCount(count);
 				if ( aSection.equals(displaySection) ) {
 					section.setSelected(true);
 				}

+ 1 - 1
src/magoffin/matt/ieat/dao/hbm/IngredientDaoImpl.java

@@ -98,7 +98,7 @@ implements IngredientDao {
 						if ( myRs == null ) {
 							myRs = rs;
 						}
-						callbackData.ingredientId = new Integer(rs.getInt(1));
+						callbackData.ingredientId = rs.getInt(1);
 						callbackData.name = rs.getString(2);
 						callback.handle(callbackData);
 					}

+ 4 - 4
src/magoffin/matt/ieat/dao/hbm/RecipeDaoImpl.java

@@ -163,7 +163,7 @@ implements RecipeDao {
 						callbackData.step = rs.getString(5);
 						int aInt = rs.getInt(6);
 						if ( !rs.wasNull() ) {
-							callbackData.ingredientId = new Integer(aInt);
+							callbackData.ingredientId = aInt;
 						} else {
 							callbackData.ingredientId = null;
 						}
@@ -171,8 +171,8 @@ implements RecipeDao {
 						if ( !rs.wasNull() ) {
 							short aShort = rs.getShort(8);
 							if ( !rs.wasNull() ) {
-								callbackData.ratingUserId = new Integer(aInt);
-								callbackData.rating = new Short(aShort);
+								callbackData.ratingUserId = aInt;
+								callbackData.rating = aShort;
 							} else {
 								callbackData.ratingUserId = null;
 								callbackData.rating = null;
@@ -183,7 +183,7 @@ implements RecipeDao {
 						}
 						aInt = rs.getInt(9);
 						if ( !rs.wasNull() ) {
-							callbackData.ownerId = new Integer(aInt);
+							callbackData.ownerId = aInt;
 						} else {
 							callbackData.ownerId = null;
 						}

+ 1 - 1
src/magoffin/matt/ieat/dao/hbm/UnitDaoImpl.java

@@ -108,7 +108,7 @@ public class UnitDaoImpl extends GenericHibernateDao<Unit,Integer> implements Un
 						if ( myRs == null ) {
 							myRs = rs;
 						}
-						callbackData.unitId = new Integer(rs.getInt(1));
+						callbackData.unitId = rs.getInt(1);
 						callbackData.name = rs.getString(2);
 						callbackData.abbreviation = rs.getString(3);
 						callback.handle(callbackData);

+ 1 - 1
src/magoffin/matt/ieat/dao/hbm/UserDaoImpl.java

@@ -133,7 +133,7 @@ public class UserDaoImpl extends GenericHibernateDao<User,Integer> implements Us
 						if ( myRs == null ) {
 							myRs = rs;
 						}
-						callbackData.userId = new Integer(rs.getInt(1));
+						callbackData.userId = rs.getInt(1);
 						callbackData.name = rs.getString(2);
 						callbackData.login = rs.getString(3);
 						callbackData.email = rs.getString(4);

+ 1 - 1
src/magoffin/matt/ieat/web/EditRecipeForm.java

@@ -71,7 +71,7 @@ public class EditRecipeForm extends AddRecipeForm {
 		for ( RecipeIngredient ri : l ) {
 			if ( ri.getUnit() == null ) {
 				Unit u = getDomainObjectFactory().getUnitInstance();
-				u.setUnitId(new Integer(0));
+				u.setUnitId(0);
 				ri.setUnit(u);
 			}
 		}

+ 4 - 4
src/magoffin/matt/ieat/web/WebUtil.java

@@ -225,8 +225,8 @@ public final class WebUtil {
 			RecipeSearchCriteria recipeCriteria, 
 			DomainObjectFactory dof) {
 		if ( indexCriteria != null ) {
-			sr.setPageSize(new Integer(indexCriteria.getPageSize()));
-			sr.setPageStart(new Integer(indexCriteria.getPageStart()));
+			sr.setPageSize(indexCriteria.getPageSize());
+			sr.setPageStart(indexCriteria.getPageStart());
 			UiIndex idx = dof.getIndexInstance();
 			UiIndex.IndexSectionType sec = dof.getIndexSelectionTypeInstance();
 			sec.setIndexKey(indexCriteria.getDisplaySection());
@@ -285,8 +285,8 @@ public final class WebUtil {
 			model.put("index.displaySection",criteria.getDisplaySection());
 		}
 		if ( criteria.getPageSize() > 0 ) {
-			model.put("index.pageSize",new Integer(criteria.getPageSize()));
-			model.put("index.pageStart",new Integer(criteria.getPageStart()));
+			model.put("index.pageSize", criteria.getPageSize());
+			model.put("index.pageStart", criteria.getPageStart());
 		}
 	}
 	

+ 1 - 1
src/magoffin/matt/ieat/web/setup/ListManagerForm.java

@@ -424,7 +424,7 @@ public class ListManagerForm extends SimpleFormController {
 		Map<String, Object> refData = referenceData(request,command,errors);
 		model.putAll(refData);
 		if ( updateCount > 0 ) {
-			model.put("updateCount",new Integer(updateCount));
+			model.put("updateCount", updateCount);
 		}
 		
 		return new ModelAndView(getSuccessView(), model);

+ 1 - 1
src/magoffin/matt/ieat/web/setup/SetupWizard.java

@@ -62,7 +62,7 @@ import org.springframework.web.servlet.mvc.AbstractWizardFormController;
  */
 public class SetupWizard extends AbstractWizardFormController {
 	
-	private static final Integer ADMIN_ACCESS_LEVEL = new Integer(1);
+	private static final Integer ADMIN_ACCESS_LEVEL = 1;
 	
 	private XwebParamDao parameterDao;
 	private DomainObjectFactory domainObjectFactory;