Skip to content

Commit 043f11f

Browse files
Issues with logging of exceptions inside ODB were fixed
1 parent da7f063 commit 043f11f

125 files changed

Lines changed: 844 additions & 827 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

client/src/main/java/com/orientechnologies/orient/client/binary/OChannelBinaryAsynchClient.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -319,13 +319,7 @@ private void throwSerializedException(final byte[] serializedException) throws I
319319
proxyInstance.addSuppressed((Exception) throwable);
320320
throw proxyInstance;
321321

322-
} catch (NoSuchMethodException e) {
323-
OLogManager.instance().error(this, "Error during exception deserialization", e);
324-
} catch (InvocationTargetException e) {
325-
OLogManager.instance().error(this, "Error during exception deserialization", e);
326-
} catch (InstantiationException e) {
327-
OLogManager.instance().error(this, "Error during exception deserialization", e);
328-
} catch (IllegalAccessException e) {
322+
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
329323
OLogManager.instance().error(this, "Error during exception deserialization", e);
330324
}
331325
}
@@ -337,8 +331,7 @@ private void throwSerializedException(final byte[] serializedException) throws I
337331
else
338332
OLogManager.instance().error(this,
339333
"Error during exception serialization, serialized exception is not Throwable, exception type is " + (throwable != null ?
340-
throwable.getClass().getName() :
341-
"null"));
334+
throwable.getClass().getName() : "null"), null);
342335
}
343336

344337
public void beginRequest(final byte iCommand, final OStorageRemoteSession session) throws IOException {

client/src/main/java/com/orientechnologies/orient/client/binary/OChannelBinaryClientAbstract.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ protected void throwSerializedException(final byte[] serializedException) throws
270270
// WRAP IT
271271
else
272272
OLogManager.instance().error(this,
273-
"Error during exception serialization, serialized exception is not Throwable, exception type is "
274-
+ (throwable != null ? throwable.getClass().getName() : "null"));
273+
"Error during exception serialization, serialized exception is not Throwable, exception type is " + (throwable != null ?
274+
throwable.getClass().getName() :
275+
"null"), null);
275276
}
276277
}

client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public synchronized OServerAdmin createDatabase(final String iDatabaseName, fina
211211

212212
if (iDatabaseName == null || iDatabaseName.length() <= 0) {
213213
final String message = "Cannot create unnamed remote storage. Check your syntax";
214-
OLogManager.instance().error(this, message);
214+
OLogManager.instance().error(this, message, null);
215215
throw new OStorageException(message);
216216
} else {
217217
String storageMode;

client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemote.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,7 @@ public OChannelBinaryAsynchClient getNetwork(final String iCurrentURL) {
16761676
if (!network.tryLock()) {
16771677
// CANNOT LOCK IT, MAYBE HASN'T BE CORRECTLY UNLOCKED BY PREVIOUS USER?
16781678
OLogManager.instance()
1679-
.error(this, "Removing locked network channel '%s' (connected=%s)...", iCurrentURL, network.isConnected());
1679+
.error(this, "Removing locked network channel '%s' (connected=%s)...", null, iCurrentURL, network.isConnected());
16801680
connectionManager.remove(network);
16811681
network = null;
16821682
}

core/src/main/java/com/orientechnologies/common/collection/OMultiValue.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ else if (iObject.getClass().isArray())
128128
return Array.get(iObject, 0);
129129
} catch (RuntimeException e) {
130130
// IGNORE IT
131-
OLogManager.instance().debug(iObject, "Error on reading the first item of the Multi-value field '%s'", iObject);
131+
OLogManager.instance().debug(iObject, "Error on reading the first item of the Multi-value field '%s'", iObject, e);
132132
}
133133

134134
return null;
@@ -165,7 +165,7 @@ else if (iObject instanceof Iterable<?>) {
165165
return Array.get(iObject, Array.getLength(iObject) - 1);
166166
} catch (RuntimeException e) {
167167
// IGNORE IT
168-
OLogManager.instance().debug(iObject, "Error on reading the last item of the Multi-value field '%s'", iObject);
168+
OLogManager.instance().debug(iObject, "Error on reading the last item of the Multi-value field '%s'", iObject, e);
169169
}
170170

171171
return null;
@@ -228,7 +228,7 @@ else if (iObject instanceof Iterator<?> || iObject instanceof Iterable<?>) {
228228
}
229229
} catch (RuntimeException e) {
230230
// IGNORE IT
231-
OLogManager.instance().debug(iObject, "Error on reading the first item of the Multi-value field '%s'", iObject);
231+
OLogManager.instance().debug(iObject, "Error on reading the first item of the Multi-value field '%s'", iObject, e);
232232
}
233233
return null;
234234
}
@@ -388,7 +388,7 @@ public static String toString(final Object iObject) {
388388
sb.append(e == iObject ? "(this Collection)" : e);
389389
if (it.hasNext())
390390
sb.append(", ");
391-
} catch (NoSuchElementException ex) {
391+
} catch (NoSuchElementException ignore) {
392392
// IGNORE THIS
393393
}
394394
}
@@ -408,7 +408,7 @@ public static String toString(final Object iObject) {
408408
sb.append(e.getValue() == iObject ? "(this Map)" : e.getValue());
409409
if (it.hasNext())
410410
sb.append(", ");
411-
} catch (NoSuchElementException ex) {
411+
} catch (NoSuchElementException ignore) {
412412
// IGNORE THIS
413413
}
414414
}

core/src/main/java/com/orientechnologies/common/comparator/OComparatorFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class OComparatorFactory {
4040
try {
4141
Class<?> sunClass = Class.forName("sun.misc.Unsafe");
4242
unsafeDetected = sunClass != null;
43-
} catch (ClassNotFoundException cnfe) {
43+
} catch (ClassNotFoundException ignore) {
4444
// Ignore
4545
}
4646

core/src/main/java/com/orientechnologies/common/concur/lock/OAdaptiveLock.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public void lock() {
8585
Thread.currentThread().interrupt();
8686
return;
8787
}
88-
} catch (InterruptedException e2) {
88+
} catch (InterruptedException ignore) {
8989
Thread.currentThread().interrupt();
9090
}
9191
}
@@ -165,15 +165,7 @@ private String extractLockOwnerStackTrace(Lock lock) {
165165

166166
printWriter.flush();
167167
return stringWriter.toString();
168-
} catch (RuntimeException e) {
169-
return null;
170-
} catch (NoSuchFieldException e) {
171-
return null;
172-
} catch (IllegalAccessException e) {
173-
return null;
174-
} catch (NoSuchMethodException e) {
175-
return null;
176-
} catch (InvocationTargetException e) {
168+
} catch (RuntimeException | NoSuchFieldException | IllegalAccessException | InvocationTargetException | NoSuchMethodException ignore) {
177169
return null;
178170
}
179171

core/src/main/java/com/orientechnologies/common/concur/lock/OReadersWriterSpinLock.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.util.concurrent.locks.AbstractOwnableSynchronizer;
2828
import java.util.concurrent.locks.LockSupport;
2929

30+
import com.orientechnologies.common.log.OLogManager;
3031
import com.orientechnologies.common.types.OModifiableInteger;
3132

3233
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -37,14 +38,14 @@
3738
*/
3839
@SuppressFBWarnings("SE_TRANSIENT_FIELD_NOT_RESTORED")
3940
public class OReadersWriterSpinLock extends AbstractOwnableSynchronizer {
40-
private static final long serialVersionUID = 7975120282194559960L;
41+
private static final long serialVersionUID = 7975120282194559960L;
4142

42-
private final transient LongAdder distributedCounter;
43-
private final transient AtomicReference<WNode> tail = new AtomicReference<WNode>();
44-
private final transient ThreadLocal<OModifiableInteger> lockHolds = new InitOModifiableInteger();
43+
private final transient LongAdder distributedCounter;
44+
private final transient AtomicReference<WNode> tail = new AtomicReference<WNode>();
45+
private final transient ThreadLocal<OModifiableInteger> lockHolds = new InitOModifiableInteger();
4546

46-
private final transient ThreadLocal<WNode> myNode = new InitWNode();
47-
private final transient ThreadLocal<WNode> predNode = new ThreadLocal<WNode>();
47+
private final transient ThreadLocal<WNode> myNode = new InitWNode();
48+
private final transient ThreadLocal<WNode> predNode = new ThreadLocal<WNode>();
4849

4950
public OReadersWriterSpinLock() {
5051
final WNode wNode = new WNode();
@@ -138,7 +139,7 @@ public void acquireWriteLock() {
138139
if (System.currentTimeMillis() - beginTime > 1000)
139140
try {
140141
Thread.sleep(1);
141-
} catch (InterruptedException e) {
142+
} catch (InterruptedException ignore) {
142143
break;
143144
}
144145
}
@@ -195,7 +196,7 @@ protected OModifiableInteger initialValue() {
195196
private final static class WNode {
196197
private final Queue<Thread> waitingReaders = new ConcurrentLinkedQueue<Thread>();
197198

198-
private volatile boolean locked = true;
199-
private volatile Thread waitingWriter;
199+
private volatile boolean locked = true;
200+
private volatile Thread waitingWriter;
200201
}
201202
}

core/src/main/java/com/orientechnologies/common/concur/resource/OSharedResourceAdaptive.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ protected void acquireExclusiveLock() {
117117
Thread.currentThread().interrupt();
118118
return;
119119
}
120-
} catch (InterruptedException e2) {
120+
} catch (InterruptedException ignore) {
121121
Thread.currentThread().interrupt();
122122
}
123123
}
@@ -153,7 +153,7 @@ protected void acquireSharedLock() {
153153
Thread.currentThread().interrupt();
154154
return;
155155
}
156-
} catch (InterruptedException e2) {
156+
} catch (InterruptedException ignore) {
157157
Thread.currentThread().interrupt();
158158
}
159159
}
@@ -214,15 +214,7 @@ private String extractLockOwnerStackTrace(Lock lock) {
214214

215215
printWriter.flush();
216216
return stringWriter.toString();
217-
} catch (RuntimeException e) {
218-
return null;
219-
} catch (NoSuchFieldException e) {
220-
return null;
221-
} catch (IllegalAccessException e) {
222-
return null;
223-
} catch (NoSuchMethodException e) {
224-
return null;
225-
} catch (InvocationTargetException e) {
217+
} catch (RuntimeException | NoSuchFieldException | IllegalAccessException | NoSuchMethodException | InvocationTargetException ignore) {
226218
return null;
227219
}
228220

core/src/main/java/com/orientechnologies/common/concur/resource/OSharedResourceTimeout.java

100644100755
Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected void acquireSharedLock() throws OTimeoutException {
5353
} else if (lock.readLock().tryLock(timeout, TimeUnit.MILLISECONDS))
5454
// OK
5555
return;
56-
} catch (InterruptedException e) {
56+
} catch (InterruptedException ignore) {
5757
Thread.currentThread().interrupt();
5858
}
5959

@@ -72,7 +72,7 @@ protected void acquireExclusiveLock() throws OTimeoutException {
7272
} else if (lock.writeLock().tryLock(timeout, TimeUnit.MILLISECONDS))
7373
// OK
7474
return;
75-
} catch (InterruptedException e) {
75+
} catch (InterruptedException ignore) {
7676
Thread.currentThread().interrupt();
7777
}
7878

@@ -114,15 +114,7 @@ private String extractLockOwnerStackTrace(Lock lock) {
114114

115115
printWriter.flush();
116116
return stringWriter.toString();
117-
} catch (RuntimeException e) {
118-
return null;
119-
} catch (NoSuchFieldException e) {
120-
return null;
121-
} catch (IllegalAccessException e) {
122-
return null;
123-
} catch (NoSuchMethodException e) {
124-
return null;
125-
} catch (InvocationTargetException e) {
117+
} catch (RuntimeException | NoSuchFieldException | IllegalAccessException | NoSuchMethodException | InvocationTargetException ignore) {
126118
return null;
127119
}
128120
}

0 commit comments

Comments
 (0)