summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorSimon Rettberg2017-05-04 11:18:40 +0200
committerSimon Rettberg2017-05-04 11:18:40 +0200
commitc8b302a0f5cd208e1991115d6fc962b544cb3218 (patch)
tree6060ccf173527928915fd99b887a05748d9850bb /src/main
parentFix ccaught exception (broken on newer java) (diff)
downloadmasterserver-c8b302a0f5cd208e1991115d6fc962b544cb3218.tar.gz
masterserver-c8b302a0f5cd208e1991115d6fc962b544cb3218.tar.xz
masterserver-c8b302a0f5cd208e1991115d6fc962b544cb3218.zip
Fixes
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/openslx/imagemaster/thrift/server/MasterServerHandler.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main/java/org/openslx/imagemaster/thrift/server/MasterServerHandler.java b/src/main/java/org/openslx/imagemaster/thrift/server/MasterServerHandler.java
index 3bdbd3f..deb2a33 100644
--- a/src/main/java/org/openslx/imagemaster/thrift/server/MasterServerHandler.java
+++ b/src/main/java/org/openslx/imagemaster/thrift/server/MasterServerHandler.java
@@ -362,7 +362,11 @@ public class MasterServerHandler implements MasterServer.Iface
List<ByteBuffer> blockHashes;
try {
img = DbImage.getImageVersion( imageVersionId );
- blockHashes = DbImageBlock.getBlockHashes( img.imageVersionId );
+ if ( img != null ) {
+ blockHashes = DbImageBlock.getBlockHashes( img.imageVersionId );
+ } else {
+ blockHashes = null;
+ }
} catch ( SQLException e ) {
throw new TInvocationException( InvocationError.INTERNAL_SERVER_ERROR, "Database error" );
}
@@ -472,18 +476,14 @@ public class MasterServerHandler implements MasterServer.Iface
public UserInfo getUser( String userToken, String userId )
throws TAuthorizationException, TNotFoundException, TInvocationException
{
- Session session = SessionManager.getSessionFromToken( userToken );
+ Session session = SessionManager.getSessionFromSessionId( userToken );
if ( session == null )
throw new TAuthorizationException( AuthorizationError.NOT_AUTHENTICATED, "No valid user token" );
- UserInfo userInfo = session.getUserInfo();
- UserUtil.assertTutor( userInfo );
- UserInfo queriedUser;
- try {
- queriedUser = DbUser.getUserInfo( userToken );
- } catch ( SQLException e ) {
- throw new TInvocationException( InvocationError.INTERNAL_SERVER_ERROR, "Database broken" );
- }
- if ( UserUtil.getFirstPublishingUser( queriedUser ) == null )
+ UserInfo queryingUser = session.getUserInfo();
+ UserUtil.assertTutor( queryingUser );
+ UserInfo queriedUser = new UserInfo( userId, null, null, null, null );
+ queriedUser = UserUtil.getFirstPublishingUser( queriedUser );
+ if ( queriedUser == null )
throw new TNotFoundException( "Unknown userid" );
return queriedUser;
}