From 8e0b1c3a5f957af3049cfa0438317177e16d6de6 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Mon, 13 Feb 2012 15:37:19 +0100 Subject: [PATCH 1/2] Compensate for Eclipse vs Sun compiler discrepancy Eclipse allows autoboxing on type inference; Sun javac does not. This means that variables assigned from calls to AnnotationAttributes#getNumber should consistently use object wrappers as opposed to number primitives. There was only one such instance anyway, and has now been updated accordingly. --- .../context/annotation/AnnotationConfigUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java index 4b296177b99..d184aa9b005 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -232,7 +232,7 @@ public class AnnotationConfigUtils { } if (abd instanceof AbstractBeanDefinition) { if (metadata.isAnnotated(Role.class.getName())) { - int role = attributesFor(metadata, Role.class).getNumber("value"); + Integer role = attributesFor(metadata, Role.class).getNumber("value"); ((AbstractBeanDefinition)abd).setRole(role); } } From 1d9d3e6ff79ce9f0eca03b02cd1df705925575da Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Mon, 13 Feb 2012 15:47:31 +0100 Subject: [PATCH 2/2] Fix false negative test failure in ResourceTests Prior to changes in commit 57851de88e84006afc104c4f22eb2fbaf2e0d3d1, AbstractResource#getFilename threw IllegalStateException unless overridden by a subclass. Following that change, this method now throws null instead, but ResourceTests#testAbstractResourceExceptions had not been updated to reflect, resulting in a false negative failure. This has now been fixed. Issue: SPR-9043 --- .../org/springframework/core/io/ResourceTests.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/org.springframework.core/src/test/java/org/springframework/core/io/ResourceTests.java b/org.springframework.core/src/test/java/org/springframework/core/io/ResourceTests.java index 97e498bfbdd..86c0043d401 100644 --- a/org.springframework.core/src/test/java/org/springframework/core/io/ResourceTests.java +++ b/org.springframework.core/src/test/java/org/springframework/core/io/ResourceTests.java @@ -16,6 +16,7 @@ package org.springframework.core.io; +import static org.hamcrest.CoreMatchers.nullValue; import static org.junit.Assert.*; import java.io.ByteArrayInputStream; @@ -215,13 +216,8 @@ public class ResourceTests { catch (FileNotFoundException ex) { assertTrue(ex.getMessage().indexOf(name) != -1); } - try { - resource.getFilename(); - fail("IllegalStateException should have been thrown"); - } - catch (IllegalStateException ex) { - assertTrue(ex.getMessage().indexOf(name) != -1); - } + + assertThat(resource.getFilename(), nullValue()); } }