File tree Expand file tree Collapse file tree 1 file changed +4
-24
lines changed
src/main/java/com/arangodb/springframework/core/template Expand file tree Collapse file tree 1 file changed +4
-24
lines changed Original file line number Diff line number Diff line change @@ -125,18 +125,8 @@ private ArangoDatabase db() {
125
125
return db ;
126
126
}
127
127
db = arango .db (databaseName );
128
- try {
129
- db .getInfo ();
130
- } catch (final ArangoDBException e ) {
131
- if (new Integer (404 ).equals (e .getResponseCode ())) {
132
- try {
133
- arango .createDatabase (databaseName );
134
- } catch (final ArangoDBException e1 ) {
135
- throw translateExceptionIfPossible (e1 );
136
- }
137
- } else {
138
- throw translateExceptionIfPossible (e );
139
- }
128
+ if (!db .exists ()) {
129
+ db .create ();
140
130
}
141
131
database = db ;
142
132
return db ;
@@ -169,18 +159,8 @@ private ArangoCollection _collection(
169
159
170
160
return collectionCache .computeIfAbsent (name , collName -> {
171
161
final ArangoCollection collection = db ().collection (collName );
172
- try {
173
- collection .getInfo ();
174
- } catch (final ArangoDBException e ) {
175
- if (new Integer (404 ).equals (e .getResponseCode ())) {
176
- try {
177
- db ().createCollection (collName , options );
178
- } catch (final ArangoDBException e1 ) {
179
- throw translateExceptionIfPossible (e1 );
180
- }
181
- } else {
182
- throw translateExceptionIfPossible (e );
183
- }
162
+ if (!collection .exists ()) {
163
+ collection .create (options );
184
164
}
185
165
if (persistentEntity != null ) {
186
166
ensureCollectionIndexes (collection (collection ), persistentEntity );
You can’t perform that action at this time.
0 commit comments