Skip to content

Commit

Permalink
MailHander should catch ServiceConfigurationError eclipse-ee4j#123
Browse files Browse the repository at this point in the history
Signed-off-by: jmehrens <[email protected]>
  • Loading branch information
jmehrens committed Jan 31, 2024
1 parent 2551740 commit cdb2b71
Showing 1 changed file with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1561,11 +1561,19 @@ public static ExploitHandler getInstance() throws Exception {

@Override
public String getEncoding(){
throw new Error();
final Class<?> lock = ExploitHandler.class;
synchronized (lock) {
if (INSTANCE == null) {
throw new Error();
} else {
return null;
}
}
}

@Override
public Level getLevel() {
assertEquals(Level.OFF, super.getLevel());
return Level.ALL;
}

Expand All @@ -1577,6 +1585,11 @@ public boolean isLoggable(LogRecord record) {
return true;
}

@Override
protected void reportError(String msg, Exception ex, int code) {
throw new AssertionError(msg + " code: "+ code, ex);
}

@Deprecated
@SuppressWarnings("override")
protected void finalize() throws Throwable {
Expand Down Expand Up @@ -1640,7 +1653,7 @@ public void testThisExcape() throws Exception {
} catch (SecurityException expect) {
assertEquals("this-escape", expect.getMessage());
}

try {
ErrorManager em = h.getErrorManager();
fail(String.valueOf(em));
Expand All @@ -1655,9 +1668,11 @@ public void testThisExcape() throws Exception {
assertEquals("this-escape", expect.getMessage());
}

for (int i = 0; i < 5000; ++i) {
//Check that p
for (int i = 0; i < 2500; ++i) {
LogRecord r = new LogRecord(Level.SEVERE, "");
assertTrue(h.isLoggable(r));
assertTrue(h.getClass().getName(),
h.isLoggable(r));
h.publish(r);
}

Expand Down

0 comments on commit cdb2b71

Please sign in to comment.