jmuehlner commented on code in PR #842:
URL: https://github.com/apache/guacamole-client/pull/842#discussion_r1174238699


##########
guacamole/src/main/java/org/apache/guacamole/rest/directory/DirectoryResource.java:
##########
@@ -639,10 +649,11 @@ else if (op == APIPatch.Operation.replace) {
 
                         try {
 
-                            // Fetch the object to be updated. If no object is
-                            // found, a directory GET failure event will be
-                            // logged, and the update attempt will be aborted.
-                            original = getObjectByIdentifier(identifier);
+                            // Fetch the object to be updated from the atomic
+                            // directory instance. If no object is found, a 
+                            // directory GET failure event will be logged, and
+                            // the update attempt will be aborted.
+                            original = getObjectByIdentifier(identifier, 
directory);

Review Comment:
   This is what happened when I enabled the history recording extension:
   
   ```
   java.lang.ClassCastException: 
org.apache.guacamole.history.connection.HistoryConnection cannot be cast to 
org.apache.guacamole.auth.jdbc.connection.ModeledConnection
        at 
org.apache.guacamole.auth.jdbc.connection.ConnectionDirectory.update(ConnectionDirectory.java:71)
        at 
org.mybatis.guice.transactional.TransactionalMethodInterceptor.invoke(TransactionalMethodInterceptor.java:100)
        at 
org.apache.guacamole.rest.directory.DirectoryResource$3.executeOperation(DirectoryResource.java:652)
        at 
org.apache.guacamole.auth.jdbc.base.JDBCDirectory.tryAtomically(JDBCDirectory.java:42)```
        
   In other words, it was pulling a connection from the history recording 
extension directory, which had been decorated the extension into a different 
`Connection` subclass, and trying to write it to JDBC directory, which did not 
like that one bit.
   
   We have to use the directory provided by `tryAtomically()` since it's the 
only directory we have that's guaranteed to be atomic.



##########
guacamole/src/main/java/org/apache/guacamole/rest/directory/DirectoryResource.java:
##########
@@ -639,10 +649,11 @@ else if (op == APIPatch.Operation.replace) {
 
                         try {
 
-                            // Fetch the object to be updated. If no object is
-                            // found, a directory GET failure event will be
-                            // logged, and the update attempt will be aborted.
-                            original = getObjectByIdentifier(identifier);
+                            // Fetch the object to be updated from the atomic
+                            // directory instance. If no object is found, a 
+                            // directory GET failure event will be logged, and
+                            // the update attempt will be aborted.
+                            original = getObjectByIdentifier(identifier, 
directory);

Review Comment:
   This is what happened when I enabled the history recording extension:
   
   ```
   java.lang.ClassCastException: 
org.apache.guacamole.history.connection.HistoryConnection cannot be cast to 
org.apache.guacamole.auth.jdbc.connection.ModeledConnection
        at 
org.apache.guacamole.auth.jdbc.connection.ConnectionDirectory.update(ConnectionDirectory.java:71)
        at 
org.mybatis.guice.transactional.TransactionalMethodInterceptor.invoke(TransactionalMethodInterceptor.java:100)
        at 
org.apache.guacamole.rest.directory.DirectoryResource$3.executeOperation(DirectoryResource.java:652)
        at 
org.apache.guacamole.auth.jdbc.base.JDBCDirectory.tryAtomically(JDBCDirectory.java:42)
   ```
        
   In other words, it was pulling a connection from the history recording 
extension directory, which had been decorated the extension into a different 
`Connection` subclass, and trying to write it to JDBC directory, which did not 
like that one bit.
   
   We have to use the directory provided by `tryAtomically()` since it's the 
only directory we have that's guaranteed to be atomic.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to