Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
ee021b21
Commit
ee021b21
authored
13 years ago
by
buczekp
Browse files
Options
Downloads
Patches
Plain Diff
minor: don't expose internal errors to users
SVN: 22174
parent
c12fcc31
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ServerExceptionTranslatingAdvisor.java
+10
-7
10 additions, 7 deletions
...bis/generic/server/ServerExceptionTranslatingAdvisor.java
with
10 additions
and
7 deletions
openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ServerExceptionTranslatingAdvisor.java
+
10
−
7
View file @
ee021b21
...
@@ -32,9 +32,9 @@ import ch.systemsx.cisd.common.exceptions.UserFailureException;
...
@@ -32,9 +32,9 @@ import ch.systemsx.cisd.common.exceptions.UserFailureException;
import
ch.systemsx.cisd.openbis.generic.shared.IServer
;
import
ch.systemsx.cisd.openbis.generic.shared.IServer
;
/**
/**
* Translates deeply nested exceptions thrown on server side e.g. by Spring
(like
* Translates deeply nested exceptions thrown on server side e.g. by Spring
that contain user
* {@link TransactionSystemException} or {@link DataAccessException})
into {UserFailureException}
*
readable error messages (like
{@link TransactionSystemException} or {@link DataAccessException})
* with message taken from the root exception cause.
*
into {UserFailureException}
with message taken from the root exception cause.
* <p>
* <p>
* The most important reason why this advisor was introduced was to translate exceptions that happen
* The most important reason why this advisor was introduced was to translate exceptions that happen
* just before commit/rollback of transactions, like {@link TransactionSystemException}. Such
* just before commit/rollback of transactions, like {@link TransactionSystemException}. Such
...
@@ -75,11 +75,14 @@ public class ServerExceptionTranslatingAdvisor extends DefaultPointcutAdvisor
...
@@ -75,11 +75,14 @@ public class ServerExceptionTranslatingAdvisor extends DefaultPointcutAdvisor
{
{
return
invocation
.
proceed
();
return
invocation
.
proceed
();
}
catch
(
NestedRuntimeException
ex
)
}
catch
(
NestedRuntimeException
ex
)
// e.g. TransactionSystemException, DataAccessException
{
{
// Deferred trigger may throw an exception just before commit.
if
(
ex
instanceof
TransactionSystemException
||
ex
instanceof
DataAccessException
)
// Message in the exception is readable for the user.
{
throw
new
UserFailureException
(
ex
.
getMostSpecificCause
().
getMessage
(),
ex
);
throw
new
UserFailureException
(
ex
.
getMostSpecificCause
().
getMessage
(),
ex
);
}
else
{
throw
ex
;
// don't expose query syntax errors etc.
}
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment