add exception log
This commit is contained in:
parent
e40f7cc031
commit
6400a18ec4
|
@ -256,7 +256,9 @@ public class ScriptController extends BaseController {
|
|||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
return this.buildReponseModel(true, null, null, 0, null,
|
||||
BusinessModelMapFactory.toModel(this.getScriptService()
|
||||
.getScriptByName(name)), null);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/deleteScript", method = { RequestMethod.GET,
|
||||
|
|
|
@ -22,6 +22,7 @@ public class ScriptRepositoty extends AbstractRepositoty {
|
|||
try {
|
||||
session.merge(scriptWithoutId);
|
||||
transaction.commit();
|
||||
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
transaction.rollback();
|
||||
|
@ -36,7 +37,7 @@ public class ScriptRepositoty extends AbstractRepositoty {
|
|||
protected void guardOtherUniqueConditionForEntity(
|
||||
String uniquePropertyName, String value)
|
||||
throws EntityUniqueAlReadyExistException {
|
||||
if (getScriptBy(value) != null) {
|
||||
if (getScriptByName(value) != null) {
|
||||
throw new EntityUniqueAlReadyExistException("Script with the name "
|
||||
+ value + " already exists");
|
||||
}
|
||||
|
@ -84,12 +85,13 @@ public class ScriptRepositoty extends AbstractRepositoty {
|
|||
return result;
|
||||
}
|
||||
|
||||
public Script getScriptBy(String name) {
|
||||
public Script getScriptByName(String name) {
|
||||
Session session = this.getSessionHelper().openSession();
|
||||
try {
|
||||
return (Script) session.createCriteria(Script.class)
|
||||
.add(Restrictions.eq("name", name)).uniqueResult();
|
||||
} catch (Exception e) {
|
||||
logger.info(ExceptionLog.getStackTrace(e));
|
||||
return null;
|
||||
} finally {
|
||||
releaseSession(session);
|
||||
|
|
|
@ -52,6 +52,10 @@ public class ScriptService {
|
|||
return this.getScriptRepositoty().getEntity(scriptId);
|
||||
}
|
||||
|
||||
public Script getScriptByName(String name) {
|
||||
return this.getScriptRepositoty().getScriptByName(name);
|
||||
}
|
||||
|
||||
public List<Script> loadScripts(User user) {
|
||||
return this.getScriptRepositoty().loadEntities(user);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Date;
|
|||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.master.domain.entity.User;
|
||||
import org.bench4q.master.domain.repository.UserRepository;
|
||||
import org.bench4q.master.helper.StringHelper;
|
||||
|
@ -88,6 +89,8 @@ public class AuthenticationManager {
|
|||
}
|
||||
String hex = request.getHeader("Authorization").substring(
|
||||
"Bearer ".length());
|
||||
Logger.getLogger(AuthenticationManager.class).info( request.getHeader("Authorization"));
|
||||
Logger.getLogger(AuthenticationManager.class).info("hex:" + hex);
|
||||
byte[] bytes = this.getStringHelper().convertToBytes(hex);
|
||||
return this.extractAccessToken(bytes);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import org.bench4q.master.domain.service.TestPlanService;
|
|||
import org.bench4q.master.exception.ExceptionLog;
|
||||
import org.bench4q.master.test.TestBase_MakeUpTestPlan;
|
||||
import org.bench4q.share.enums.master.TestPlanStatus;
|
||||
import org.bench4q.share.helper.MarshalHelper;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
|
Loading…
Reference in New Issue