You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/10/19 11:33:50 UTC
[commons-io] branch master updated: Sort member
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git
The following commit(s) were added to refs/heads/master by this push:
new 7d92032a Sort member
7d92032a is described below
commit 7d92032a68ed017da54b65f2525c4073d9f218e7
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Oct 19 07:33:46 2023 -0400
Sort member
---
.../serialization/ValidatingObjectInputStream.java | 52 +++++++++++-----------
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/src/main/java/org/apache/commons/io/serialization/ValidatingObjectInputStream.java b/src/main/java/org/apache/commons/io/serialization/ValidatingObjectInputStream.java
index 9d16dfe8..e0465c72 100644
--- a/src/main/java/org/apache/commons/io/serialization/ValidatingObjectInputStream.java
+++ b/src/main/java/org/apache/commons/io/serialization/ValidatingObjectInputStream.java
@@ -109,6 +109,32 @@ public class ValidatingObjectInputStream extends ObjectInputStream {
return this;
}
+ /**
+ * Checks that the class name conforms to requirements.
+ *
+ * @param name The class name
+ * @throws InvalidClassException when a non-accepted class is encountered
+ */
+ private void checkClassName(final String name) throws InvalidClassException {
+ // Reject has precedence over accept
+ for (final ClassNameMatcher m : rejectMatchers) {
+ if (m.matches(name)) {
+ invalidClassNameFound(name);
+ }
+ }
+
+ boolean ok = false;
+ for (final ClassNameMatcher m : acceptMatchers) {
+ if (m.matches(name)) {
+ ok = true;
+ break;
+ }
+ }
+ if (!ok) {
+ invalidClassNameFound(name);
+ }
+ }
+
/**
* Called to throw {@link InvalidClassException} if an invalid
* class name is found during deserialization. Can be overridden, for example
@@ -175,30 +201,4 @@ public class ValidatingObjectInputStream extends ObjectInputStream {
checkClassName(osc.getName());
return super.resolveClass(osc);
}
-
- /**
- * Checks that the class name conforms to requirements.
- *
- * @param name The class name
- * @throws InvalidClassException when a non-accepted class is encountered
- */
- private void checkClassName(final String name) throws InvalidClassException {
- // Reject has precedence over accept
- for (final ClassNameMatcher m : rejectMatchers) {
- if (m.matches(name)) {
- invalidClassNameFound(name);
- }
- }
-
- boolean ok = false;
- for (final ClassNameMatcher m : acceptMatchers) {
- if (m.matches(name)) {
- ok = true;
- break;
- }
- }
- if (!ok) {
- invalidClassNameFound(name);
- }
- }
}
\ No newline at end of file