You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2010/01/16 21:31:38 UTC
svn commit: r900021 - in /maven/maven-3/trunk/maven-model-builder/src:
main/java/org/apache/maven/model/interpolation/
test/java/org/apache/maven/model/interpolation/
Author: bentmann
Date: Sat Jan 16 20:31:38 2010
New Revision: 900021
URL: http://svn.apache.org/viewvc?rev=900021&view=rev
Log:
[MNG-4529] maven fails on IBM JDK 1.5.0 with exception IllegalAccessException: Field is final
Added:
maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/ (with props)
maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java (with props)
Modified:
maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java
Modified: maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java?rev=900021&r1=900020&r2=900021&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java (original)
+++ maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java Sat Jan 16 20:31:38 2010
@@ -32,6 +32,7 @@
import java.io.File;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
@@ -329,6 +330,11 @@
return false;
}
+ if ( Modifier.isFinal( field.getModifiers() ) )
+ {
+ return false;
+ }
+
return true;
}
Propchange: maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/
------------------------------------------------------------------------------
bugtraq:label = Enter issue ID:
Propchange: maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/
------------------------------------------------------------------------------
bugtraq:message = Issue id: %BUGID%
Propchange: maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/
------------------------------------------------------------------------------
bugtraq:number = false
Propchange: maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/
------------------------------------------------------------------------------
bugtraq:url = http://jira.codehaus.org/browse/%BUGID%
Added: maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java?rev=900021&view=auto
==============================================================================
--- maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java (added)
+++ maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java Sat Jan 16 20:31:38 2010
@@ -0,0 +1,60 @@
+package org.apache.maven.model.interpolation;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+import java.util.Properties;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.building.DefaultModelBuildingRequest;
+import org.apache.maven.model.building.SimpleProblemCollector;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Benjamin Bentmann
+ */
+public class StringSearchModelInterpolatorTest
+ extends TestCase
+{
+
+ public void testFinalFieldsExcludedFromInterpolation()
+ {
+ Properties props = new Properties();
+ props.setProperty( "expression", "value" );
+ DefaultModelBuildingRequest request = new DefaultModelBuildingRequest();
+ request.setUserProperties( props );
+
+ SimpleProblemCollector problems = new SimpleProblemCollector();
+ StringSearchModelInterpolator interpolator = new StringSearchModelInterpolator();
+ interpolator.interpolateObject( new ClassWithFinalField(), new Model(), null, request, problems );
+
+ assertTrue( problems.getFatals().toString(), problems.getFatals().isEmpty() );
+ assertTrue( problems.getErrors().toString(), problems.getErrors().isEmpty() );
+ assertTrue( problems.getWarnings().toString(), problems.getWarnings().isEmpty() );
+ }
+
+ static class ClassWithFinalField
+ {
+
+ public static final String CONSTANT = "${expression}";
+
+ }
+
+}
Propchange: maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision