Fix bug I introduced with the class loader. I hang me head in shame as I did
not look at the output of the unit tests.
This commit is contained in:
parent
d8d9269bbc
commit
37e181d6dc
|
|
@ -40,7 +40,9 @@ import org.apache.regexp.RE;
|
|||
import org.apache.regexp.RESyntaxException;
|
||||
|
||||
/**
|
||||
* Represents the configuration that checkstyle uses when checking.
|
||||
* Represents the configuration that checkstyle uses when checking. The
|
||||
* configuration is Serializable, however the ClassLoader configuration is
|
||||
* lost.
|
||||
* @author <a href="mailto:oliver@puppycrawl.com">Oliver Burn</a>
|
||||
**/
|
||||
public class Configuration
|
||||
|
|
@ -103,8 +105,11 @@ public class Configuration
|
|||
/** line numbers to ignore in header **/
|
||||
private TreeSet mHeaderIgnoreLineNo = new TreeSet();
|
||||
|
||||
/** class loader to resolve classes with **/
|
||||
private ClassLoader mLoader =
|
||||
/**
|
||||
* class loader to resolve classes with. Needs to be transient as unable
|
||||
* to persist.
|
||||
**/
|
||||
private transient ClassLoader mLoader =
|
||||
Thread.currentThread().getContextClassLoader();
|
||||
|
||||
/** where to place right curlies **/
|
||||
|
|
@ -275,6 +280,7 @@ public class Configuration
|
|||
aStream.defaultReadObject();
|
||||
|
||||
// initialize the transient fields
|
||||
mLoader = Thread.currentThread().getContextClassLoader();
|
||||
mRegexps = new HashMap();
|
||||
try {
|
||||
// Loop on the patterns creating the RE's
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class ConfigSerializationTest
|
|||
/**
|
||||
* Test that the RE deserialization mechanism works for one example.
|
||||
*/
|
||||
public void testRegexpDesrialization()
|
||||
public void testRegexpDeserialization()
|
||||
throws Exception
|
||||
{
|
||||
Configuration configOrig = new Configuration();
|
||||
|
|
@ -49,6 +49,7 @@ public class ConfigSerializationTest
|
|||
|
||||
Configuration configCopy = copyBySerialization(configOrig);
|
||||
assertNotNull(configCopy);
|
||||
assertNotNull(configCopy.getClassLoader());
|
||||
|
||||
// test that the general deserialization mechanism for RE fields works
|
||||
RE typeRegexp = configCopy.getTypeRegexp();
|
||||
|
|
|
|||
Loading…
Reference in New Issue