Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 470284: Do not log a stack trace when creating a schema is no sequence #394

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019 Payara Services Ltd.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -19,6 +20,7 @@
import java.io.Writer;
import org.eclipse.persistence.exceptions.*;
import org.eclipse.persistence.internal.sessions.AbstractSession;
import org.eclipse.persistence.logging.SessionLog;
import org.eclipse.persistence.sequencing.Sequence;

/**
Expand Down Expand Up @@ -84,13 +86,23 @@ public void alter(AbstractSession session, Writer writer) throws ValidationExcep
*/
@Override
public void createOnDatabase(AbstractSession session) throws EclipseLinkException {
// If the sequence does not already exist a stack trace will be logged
// this temporarily  sets the level to FINEST to avoid having appear in the log
// unnecessarily
int logLevel = session.getLogLevel();
session.setLogLevel(SessionLog.FINEST);
try {
if (checkIfExist(session)) {
if (this.isAlterSupported(session)) {
alterOnDatabase(session);
}
} else {
super.createOnDatabase(session);
}
} finally {
//reset log level
session.setLogLevel(logLevel);
}
}

/**
Expand Down