Skip to content

Commit 292c39c

Browse files
committed
Fix POM leakage - remove some unnecessary warnings
1 parent 5e61b80 commit 292c39c

7 files changed

Lines changed: 51 additions & 49 deletions

File tree

‎config-prettyfaces/pom.xml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@
1818
<dependency>
1919
<groupId>org.ocpsoft.rewrite</groupId>
2020
<artifactId>rewrite-api</artifactId>
21+
<scope>provided</scope>
2122
</dependency>
2223
<dependency>
2324
<groupId>org.ocpsoft.rewrite</groupId>
2425
<artifactId>rewrite-api-el</artifactId>
26+
<scope>provided</scope>
2527
</dependency>
2628
<dependency>
2729
<groupId>org.ocpsoft.rewrite</groupId>
2830
<artifactId>rewrite-api-servlet</artifactId>
31+
<scope>provided</scope>
2932
</dependency>
3033
<dependency>
3134
<groupId>org.ocpsoft.rewrite</groupId>

‎config-prettyfaces/src/main/java/com/ocpsoft/pretty/faces/config/annotation/PrettyAnnotationHandler.java‎

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import com.ocpsoft.pretty.faces.el.LazyExpression;
4444
import com.ocpsoft.pretty.faces.el.PrettyExpression;
4545

46-
@SuppressWarnings("unchecked")
4746
public class PrettyAnnotationHandler
4847
{
4948

@@ -60,7 +59,7 @@ public class PrettyAnnotationHandler
6059
/**
6160
* A map to resolve the bean name for a {@link Class} object
6261
*/
63-
private final Map<Class, String> beanNameMap = new HashMap<Class, String>();
62+
private final Map<Class<?>, String> beanNameMap = new HashMap<Class<?>, String>();
6463

6564
/**
6665
* The {@link ActionSpec} objects generated from annotation scanning
@@ -86,13 +85,12 @@ public PrettyAnnotationHandler(LazyBeanNameFinder beanNameFinder)
8685
}
8786

8887
/**
89-
* This method scans the supplied class for PrettyFaces annotations. The
90-
* method must be called for every class that should be scanner before
91-
* finally calling {@link #build(PrettyConfigBuilder)}.
88+
* This method scans the supplied class for PrettyFaces annotations. The method must be called for every class that
89+
* should be scanner before finally calling {@link #build(PrettyConfigBuilder)}.
9290
*
9391
* @param clazz The class to scan
9492
*/
95-
public void processClass(Class clazz)
93+
public void processClass(Class<?> clazz)
9694
{
9795

9896
// log class name on trace level
@@ -135,11 +133,10 @@ public void processClass(Class clazz)
135133
/**
136134
* Checks for PrettyFaces mapping annotations on a single class
137135
*
138-
* @param clazz
139-
* Class to scan
136+
* @param clazz Class to scan
140137
* @return The IDs of the mappings found on the class
141138
*/
142-
public String[] processClassMappingAnnotations(Class clazz)
139+
public String[] processClassMappingAnnotations(Class<?> clazz)
143140
{
144141

145142
// list of all mapping IDs found on the class
@@ -174,15 +171,15 @@ public String[] processClassMappingAnnotations(Class clazz)
174171
return classMappingIds.toArray(new String[classMappingIds.size()]);
175172

176173
}
177-
174+
178175
/**
179176
* Process a single {@link URLMapping} annotation.
180177
*
181178
* @param clazz The class that the annotation was found on
182179
* @param mappingAnnotation The annotation to process
183180
* @return The mapping ID of the mapping found
184181
*/
185-
private String processPrettyMappingAnnotation(Class clazz, URLMapping mappingAnnotation)
182+
private String processPrettyMappingAnnotation(Class<?> clazz, URLMapping mappingAnnotation)
186183
{
187184

188185
// log class name
@@ -223,7 +220,8 @@ private String processPrettyMappingAnnotation(Class clazz, URLMapping mappingAnn
223220
if (validationAnnotation.index() < 0)
224221
{
225222
throw new IllegalArgumentException(
226-
"Please set the index of the path parameter you want to validate with the @URLValidator specified on mapping: " + mapping.getId());
223+
"Please set the index of the path parameter you want to validate with the @URLValidator specified on mapping: "
224+
+ mapping.getId());
227225
}
228226

229227
// prepare PathValidator
@@ -253,7 +251,7 @@ private String processPrettyMappingAnnotation(Class clazz, URLMapping mappingAnn
253251
*
254252
* @param clazz Class to scan
255253
*/
256-
private void processPrettyBeanAnnotation(Class clazz)
254+
private void processPrettyBeanAnnotation(Class<?> clazz)
257255
{
258256

259257
// get reference to @URLMapping annotation
@@ -277,8 +275,7 @@ private void processPrettyBeanAnnotation(Class clazz)
277275
}
278276

279277
/**
280-
* Searches for {@link URLAction} or {@link URLActions} annotations on a
281-
* method.
278+
* Searches for {@link URLAction} or {@link URLActions} annotations on a method.
282279
*
283280
* @param method Method to scan
284281
* @param classMappingIds The mapping IDs of the class this method belongs to
@@ -340,9 +337,9 @@ else if (classMappingIds != null && classMappingIds.length > 0)
340337
else
341338
{
342339
throw new IllegalArgumentException("Unable to find a suitable mapping "
343-
+ "for the query-parameter definied on field '" + field.getName() + "' in class '"
344-
+ field.getDeclaringClass().getName() + "'. Either place a @URLMapping annotation on the "
345-
+ "class or reference a foreign mapping using the 'mappingId' attribute.");
340+
+ "for the query-parameter definied on field '" + field.getName() + "' in class '"
341+
+ field.getDeclaringClass().getName() + "'. Either place a @URLMapping annotation on the "
342+
+ "class or reference a foreign mapping using the 'mappingId' attribute.");
346343
}
347344

348345
// check if there is also a validation annotation placed on the field
@@ -367,8 +364,7 @@ else if (classMappingIds != null && classMappingIds.length > 0)
367364
}
368365

369366
/**
370-
* Creates a {@link UrlAction} object from the supplied {@link URLAction}
371-
* annotation
367+
* Creates a {@link UrlAction} object from the supplied {@link URLAction} annotation
372368
*
373369
* @param actionAnnotation The annotation
374370
* @param method The method that was annotated
@@ -390,18 +386,18 @@ private void processPrettyActionAnnotation(URLAction actionAnnotation, Method me
390386
// action belongs to the mapping mentioned with mappingId attribute
391387
actionSpec.setMappingIds(new String[] { actionAnnotation.mappingId().trim() });
392388
}
393-
else if ( classMappingIds != null && classMappingIds.length > 0 )
389+
else if (classMappingIds != null && classMappingIds.length > 0)
394390
{
395391
// use the mapping found on the class
396-
actionSpec.setMappingIds( classMappingIds );
392+
actionSpec.setMappingIds(classMappingIds);
397393
}
398394
else
399395
{
400396
// No mapping found... throw an exception..
401397
throw new IllegalArgumentException("Unable to find a suitable mapping "
402-
+ "for the action definied on method '" + method.getName() + "' in class '"
403-
+ method.getDeclaringClass().getName() + "'. Either place a @URLMapping annotation on the "
404-
+ "class or reference a foreign mapping using the 'mappingId' attribute.");
398+
+ "for the action definied on method '" + method.getName() + "' in class '"
399+
+ method.getDeclaringClass().getName() + "'. Either place a @URLMapping annotation on the "
400+
+ "class or reference a foreign mapping using the 'mappingId' attribute.");
405401
}
406402

407403
// add action to list of actions
@@ -413,18 +409,16 @@ else if ( classMappingIds != null && classMappingIds.length > 0 )
413409
* Returns <code>true</code> for "blank" strings.
414410
*
415411
* @param str Input string
416-
* @return <code>true</code> if string is <code>null</code> or trimmed value
417-
* is empty
412+
* @return <code>true</code> if string is <code>null</code> or trimmed value is empty
418413
*/
419414
private static boolean isBlank(String str)
420415
{
421416
return (str == null) || (str.trim().length() == 0);
422417
}
423418

424419
/**
425-
* This methods adds all mappings found to the supplied
426-
* {@link PrettyConfigBuilder}. It should be called after all classes has
427-
* been scanned via {@link #processClass(Class)}.
420+
* This methods adds all mappings found to the supplied {@link PrettyConfigBuilder}. It should be called after all
421+
* classes has been scanned via {@link #processClass(Class)}.
428422
*
429423
* @param builder The builder to add the mappings to
430424
*/
@@ -451,8 +445,8 @@ public void build(PrettyConfigBuilder builder)
451445
if (mapping == null)
452446
{
453447
throw new IllegalArgumentException("Unable to find the mapping '" + mappingId
454-
+ "' referenced at method '" + actionSpec.getMethod().getName() + "' in class '"
455-
+ actionSpec.getMethod().getDeclaringClass().getName() + "'.");
448+
+ "' referenced at method '" + actionSpec.getMethod().getName() + "' in class '"
449+
+ actionSpec.getMethod().getDeclaringClass().getName() + "'.");
456450
}
457451

458452
// build UrlMapping
@@ -462,7 +456,7 @@ public void build(PrettyConfigBuilder builder)
462456
urlAction.setInheritable(actionSpec.isInheritable());
463457

464458
// try to get bean name
465-
Class clazz = actionSpec.getMethod().getDeclaringClass();
459+
Class<?> clazz = actionSpec.getMethod().getDeclaringClass();
466460

467461
// build expression
468462
PrettyExpression expression = buildPrettyExpression(clazz, actionSpec.getMethod().getName());
@@ -494,8 +488,8 @@ public void build(PrettyConfigBuilder builder)
494488
if (mapping == null)
495489
{
496490
throw new IllegalArgumentException("Unable to find the mapping '" + mappingId
497-
+ "' referenced at field '" + queryParamSpec.getFieldName() + "' in class '"
498-
+ queryParamSpec.getOwnerClass().getName() + "'.");
491+
+ "' referenced at field '" + queryParamSpec.getFieldName() + "' in class '"
492+
+ queryParamSpec.getOwnerClass().getName() + "'.");
499493
}
500494

501495
// build UrlMapping
@@ -522,7 +516,7 @@ public void build(PrettyConfigBuilder builder)
522516
if (log.isTraceEnabled())
523517
{
524518
log.trace("Registered query-param '" + queryParam.getName() + "' to '" + expression + "' in mapping: "
525-
+ mapping.getId());
519+
+ mapping.getId());
526520
}
527521

528522
// register this action
@@ -540,8 +534,8 @@ public void build(PrettyConfigBuilder builder)
540534
}
541535

542536
/**
543-
* Creates a {@link PrettyExpression} for a class and component. This method
544-
* may return a {@link ConstantExpression} or a {@link LazyExpression}.
537+
* Creates a {@link PrettyExpression} for a class and component. This method may return a {@link ConstantExpression}
538+
* or a {@link LazyExpression}.
545539
*
546540
* @param clazz The class of the bean
547541
* @param component the component (property or method name)

‎config-prettyfaces/src/test/java/com/ocpsoft/pretty/faces/config/annotation/WebClassesFinderTest.java‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
public class WebClassesFinderTest
2929
{
3030

31+
@SuppressWarnings({ "unchecked", "rawtypes" })
3132
@Test
3233
public void testWebClassesFinder() throws Exception
3334
{
@@ -49,13 +50,16 @@ public void testWebClassesFinder() throws Exception
4950
EasyMock.expect(servletContext.getResource("/WEB-INF/classes/")).andReturn(classesUrl).anyTimes();
5051
EasyMock.expect(servletContext.getResourcePaths("/WEB-INF/classes/")).andReturn(classesDirectory).anyTimes();
5152
EasyMock.expect(servletContext.getResource("/WEB-INF/classes/package/")).andReturn(packageUrl).anyTimes();
52-
EasyMock.expect(servletContext.getResourcePaths("/WEB-INF/classes/package/")).andReturn(packageDirectory).anyTimes();
53-
EasyMock.expect(servletContext.getResource("/WEB-INF/classes/package/TestClass.class")).andReturn(classUrl).anyTimes();
53+
EasyMock.expect(servletContext.getResourcePaths("/WEB-INF/classes/package/")).andReturn(packageDirectory)
54+
.anyTimes();
55+
EasyMock.expect(servletContext.getResource("/WEB-INF/classes/package/TestClass.class")).andReturn(classUrl)
56+
.anyTimes();
5457
EasyMock.replay(servletContext);
5558

5659
// ClassLoader that knows the test class
5760
ClassLoader classLoader = EasyMock.createNiceMock(ClassLoader.class);
58-
EasyMock.expect(classLoader.loadClass("package.TestClass")).andReturn((Class) ClassFinderTestBean.class).anyTimes();
61+
EasyMock.expect(classLoader.loadClass("package.TestClass")).andReturn((Class) ClassFinderTestBean.class)
62+
.anyTimes();
5963
EasyMock.replay(classLoader);
6064

6165
// Prepare mock of PrettyAnnotationHandler
@@ -73,7 +77,7 @@ public void testWebClassesFinder() throws Exception
7377

7478
}
7579

76-
80+
@SuppressWarnings({ "unchecked", "rawtypes" })
7781
@Test
7882
public void testWebClassesFinderWithJettyRunGoal() throws Exception
7983
{
@@ -95,13 +99,16 @@ public void testWebClassesFinderWithJettyRunGoal() throws Exception
9599
EasyMock.expect(servletContext.getResource("/WEB-INF/classes/")).andReturn(classesUrl).anyTimes();
96100
EasyMock.expect(servletContext.getResourcePaths("/WEB-INF/classes/")).andReturn(classesDirectory).anyTimes();
97101
EasyMock.expect(servletContext.getResource("/WEB-INF/classes/package/")).andReturn(packageUrl).anyTimes();
98-
EasyMock.expect(servletContext.getResourcePaths("/WEB-INF/classes/package/")).andReturn(packageDirectory).anyTimes();
99-
EasyMock.expect(servletContext.getResource("/WEB-INF/classes/package/TestClass.class")).andReturn(classUrl).anyTimes();
102+
EasyMock.expect(servletContext.getResourcePaths("/WEB-INF/classes/package/")).andReturn(packageDirectory)
103+
.anyTimes();
104+
EasyMock.expect(servletContext.getResource("/WEB-INF/classes/package/TestClass.class")).andReturn(classUrl)
105+
.anyTimes();
100106
EasyMock.replay(servletContext);
101107

102108
// ClassLoader that knows the test class
103109
ClassLoader classLoader = EasyMock.createNiceMock(ClassLoader.class);
104-
EasyMock.expect(classLoader.loadClass("package.TestClass")).andReturn((Class) ClassFinderTestBean.class).anyTimes();
110+
EasyMock.expect(classLoader.loadClass("package.TestClass")).andReturn((Class) ClassFinderTestBean.class)
111+
.anyTimes();
105112
EasyMock.replay(classLoader);
106113

107114
// Prepare mock of PrettyAnnotationHandler

‎config-prettyfaces/src/test/java/com/ocpsoft/pretty/faces/config/annotation/WebLibFinderTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class WebLibFinderTest
3939
{
4040

4141
@Test
42-
@SuppressWarnings("unchecked")
42+
@SuppressWarnings({ "unchecked", "rawtypes" })
4343
public void testWebLibFinder() throws Exception
4444
{
4545

‎impl-servlet-tests/src/test/java/org/ocpsoft/rewrite/servlet/config/RequestConstraintTransformTestProvider.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.ocpsoft.rewrite.context.EvaluationContext;
2525
import org.ocpsoft.rewrite.event.Rewrite;
2626
import org.ocpsoft.rewrite.param.Constraint;
27-
import org.ocpsoft.rewrite.param.ParameterStore;
2827
import org.ocpsoft.rewrite.param.Transposition;
2928
import org.ocpsoft.rewrite.servlet.http.event.HttpServletRewrite;
3029

‎pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<properties>
2525
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
26-
<version.jboss.spec>3.0.1.Final</version.jboss.spec>
26+
<version.jboss.spec>3.0.2.Final</version.jboss.spec>
2727
<version.junit>4.8.1</version.junit>
2828
<version.common>1.0.5.Final</version.common>
2929
<version.logging>1.0.2.Final</version.logging>

‎test-harness/src/main/java/org/ocpsoft/rewrite/mock/MockFailedBinding.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import org.ocpsoft.rewrite.bind.Binding;
44
import org.ocpsoft.rewrite.context.EvaluationContext;
55
import org.ocpsoft.rewrite.event.Rewrite;
6-
import org.ocpsoft.rewrite.param.Parameter;
76

87
public class MockFailedBinding implements Binding
98
{

0 commit comments

Comments
 (0)