|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2016 the original author or authors. |
| 2 | + * Copyright 2002-2017 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
17 | 17 | package org.springframework.core.type.classreading;
|
18 | 18 |
|
19 | 19 | import java.lang.reflect.Field;
|
| 20 | +import java.security.AccessControlException; |
20 | 21 |
|
21 | 22 | import org.apache.commons.logging.Log;
|
22 | 23 | import org.apache.commons.logging.LogFactory;
|
@@ -80,14 +81,21 @@ protected Object getEnumValue(String asmTypeDescriptor, String attributeValue) {
|
80 | 81 | Class<?> enumType = this.classLoader.loadClass(Type.getType(asmTypeDescriptor).getClassName());
|
81 | 82 | Field enumConstant = ReflectionUtils.findField(enumType, attributeValue);
|
82 | 83 | if (enumConstant != null) {
|
| 84 | + ReflectionUtils.makeAccessible(enumConstant); |
83 | 85 | valueToUse = enumConstant.get(null);
|
84 | 86 | }
|
85 | 87 | }
|
86 | 88 | catch (ClassNotFoundException ex) {
|
87 | 89 | logger.debug("Failed to classload enum type while reading annotation metadata", ex);
|
88 | 90 | }
|
| 91 | + catch (NoClassDefFoundError ex) { |
| 92 | + logger.debug("Failed to classload enum type while reading annotation metadata", ex); |
| 93 | + } |
89 | 94 | catch (IllegalAccessException ex) {
|
90 |
| - logger.warn("Could not access enum value while reading annotation metadata", ex); |
| 95 | + logger.debug("Could not access enum value while reading annotation metadata", ex); |
| 96 | + } |
| 97 | + catch (AccessControlException ex) { |
| 98 | + logger.debug("Could not access enum value while reading annotation metadata", ex); |
91 | 99 | }
|
92 | 100 | return valueToUse;
|
93 | 101 | }
|
|
0 commit comments