Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

4.3.2.final patch #330

Merged
merged 7 commits into from

3 participants

Hardy Ferentschik CloudBees pull request builder plugin Gunnar Morling
Hardy Ferentschik

For 4.3.2 I only applied the HV-912 changes. I did not move ConstraintMapping as on master (part of the "reducing accessibility of some classes and methhods". I think it is technically not necessary and it could break existing clients. @gunnarmorling, wdyt?

Hardy Ferentschik

@gunnarmorling any chance you can run this version with a security manager enabled?

CloudBees pull request builder plugin

HV-5-MASTER #514 FAILURE
Looks like there's a problem with this pull request

...nal/cfg/context/ConstraintMappingContextImplBase.java
@@ -87,4 +90,63 @@ public MethodConstraintMappingContext method(String name, Class<?>... parameterT
return new MethodConstraintMappingContextImpl( beanClass, method, mapping );
}
+
+ /**
+ * Returns the member with the given name and type.
+ *
+ * @param clazz The class from which to retrieve the member. Cannot be {@code null}.
+ * @param property The property name without 'is', 'get' or 'has'. Cannot be {@code null} or empty.
+ * @param elementType The element type. Either {@code ElementType.FIELD} or {@code ElementType METHOD}.
+ *
+ * @return the member which matching the name and type or {@code null} if no such member exists.
+ */
+ public static Member getMember(Class<?> clazz, String property, ElementType elementType) {
Gunnar Morling Owner

This should not be public.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
...alidator/internal/metadata/raw/ConstrainedMethod.java
@@ -113,7 +116,7 @@ public ConstrainedMethod(
this.hasParameterConstraints = hasParameterConstraints( parameterMetaData );
if ( isConstrained() ) {
Gunnar Morling Owner

The method should not be set accessible here, only the copy hold in ValidatorImpl.

Hardy Ferentschik Owner

Of course. I missed this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Gunnar Morling

I think it is technically not necessary and it could break existing clients.

Makes sense. I had moved it to reduce some visibilities but we cannot do it in 4.3 as we don't have the IF/class split for it there.

...validator/internal/metadata/raw/ConstrainedField.java
((16 lines not shown))
}
public BeanConstraintLocation getLocation() {
return (BeanConstraintLocation) super.getLocation();
}
+ @Override
Gunnar Morling Owner

Interesting, was this part of the original change? Not that it does harm, just wondering.

Hardy Ferentschik Owner

it was directly added by your changes, but the version on 4.3 did not have an equals at all. I thought it would not harm. On the other hand hashCode is missing, so I probably just get rid of it altogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Gunnar Morling gunnarmorling commented on the diff
...g/hibernate/validator/internal/util/StringHelper.java
((11 lines not shown))
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validator.internal.util;
+
+import java.util.Arrays;
+
+/**
+ * Helper class dealing with strings.
+ *
+ * @author Gunnar Morling
+ */
+public class StringHelper {
Gunnar Morling Owner

Oh, how did this become part of the back-port? I don't remember to have touched it in the original PR.

Hardy Ferentschik Owner

You didn't. During the merge of ReflectionHelper I had to choose the version of getPropertyName to use. I went for the one using the StringHelper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
.../internal/util/annotationfactory/AnnotationProxy.java
@@ -130,4 +133,46 @@ public String toString() {
result.addAll( values.keySet() );
return result;
}
+
+ private boolean areEqual(Object o1, Object o2) {
Gunnar Morling Owner

Hum, same here. Apparently some more changes sneaked into the back-port.

Hardy Ferentschik Owner

this method is actually not used. I remove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Gunnar Morling

@gunnarmorling any chance you can run this version with a security manager enabled?

Yes, I'll give it a try.

Gunnar Morling

I'm seeing one permission issue, but I'm not totally clear about the cause. ValidationXmlParser cannot access the XML mapping files in the TCK JAR. I need to assign the following permission to the HV code base:

permission java.io.FilePermission "/path/to/jsr303-tck-1.0.6.GA.jar", "read";

That's not required on master. I'm wondering whether it's related to that special classloader which is used in the 1.0 TCK. Does this ring a bell in any way?

Hardy Ferentschik

Pushed a forced update to apply review comments

CloudBees pull request builder plugin

HV-5-MASTER #517 FAILURE
Looks like there's a problem with this pull request

Gunnar Morling

One more test is failing when running with a security manager, ConstraintDefinitionsTest. This is due to annotation methods not being set to accessible before invoking them which has been fixed upstream with HV-843. For the sake of completeness, we should backport this fix I guess. Relevance in practice is rather low as it only is a problem for package-private constraint types, so we could also ignore that one test failure. WDYT?

Hardy Ferentschik

That's not required on master. I'm wondering whether it's related to that special classloader which is used in the 1.0 TCK. Does this ring a bell in any way?

Not really. Obviously the harness is executed differently. On the 4.3 branch is was something homegrown and on master it is Arquillian. How do you run the tests? In container or not?

Hardy Ferentschik

One more test is failing when running with a security manager, ConstraintDefinitionsTest. This is due to annotation methods not being set to accessible before invoking them which has been fixed upstream with HV-843.

I remember vaguely.

For the sake of completeness, we should backport this fix I guess.

I see how hard it is to apply.

Relevance in practice is rather low as it only is a problem for package-private constraint types

Sure. Let me have a quick look.

Hardy Ferentschik

I added a commit with the HV-843 backport. @gunnarmorling, could you check again?

CloudBees pull request builder plugin

HV-5-MASTER #518 FAILURE
Looks like there's a problem with this pull request

Gunnar Morling

@hferentschik, Ah you pushed another update with the JAXB fix already, right?

Gunnar Morling gunnarmorling merged commit 763feff into from
Hardy Ferentschik

Ah you pushed another update with the JAXB fix already, right?

yes

CloudBees pull request builder plugin

HV-5-MASTER #521 FAILURE
Looks like there's a problem with this pull request

Hardy Ferentschik

thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 23, 2014
  1. Gunnar Morling Hardy Ferentschik

    HV-912 Removing methods from ReflectionHelper which make privileged o…

    gunnarmorling authored hferentschik committed
    …perations publicly accessible
Commits on Jul 24, 2014
  1. Gunnar Morling Hardy Ferentschik
  2. Gunnar Morling Hardy Ferentschik
  3. Gunnar Morling Hardy Ferentschik

    HV-912 Wrapping call to JAXBContext#newInstance() and Unmarshaller#un…

    gunnarmorling authored hferentschik committed
    …marshal() into privileged actions
  4. Gunnar Morling Hardy Ferentschik
  5. Gunnar Morling Hardy Ferentschik

    HV-912 Not exposing accessible-made members

    gunnarmorling authored hferentschik committed
  6. Hardy Ferentschik

    HV-843 Making sure non public annotation members are accessible. Unif…

    hferentschik authored
    …ying handling of annotation member value handling.
Something went wrong with that request. Please try again.