Skip to content

Commit 3d5458e

Browse files
committed
refactored com.mongodb.DBTCPConnector#_checkWriteError to make intent clearer.
1 parent 1d90607 commit 3d5458e

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/main/com/mongodb/DBTCPConnector.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,12 @@ void _checkClosed(){
123123
throw new IllegalStateException( "this Mongo has been closed" );
124124
}
125125

126-
WriteResult _checkWriteError( DB db , MyPort mp , DBPort port , WriteConcern concern )
126+
WriteResult _checkWriteError( DB db, DBPort port , WriteConcern concern )
127127
throws MongoException, IOException {
128-
CommandResult e = null;
129-
e = port.runCommand( db , concern.getCommand() );
130-
131-
if ( ! e.hasErr() )
132-
return new WriteResult( e , concern );
128+
CommandResult e = port.runCommand( db , concern.getCommand() );
133129

134130
e.throwOnError();
135-
return null;
131+
return new WriteResult( e , concern );
136132
}
137133

138134
@Override
@@ -155,7 +151,7 @@ public WriteResult say( DB db , OutMessage m , WriteConcern concern , ServerAddr
155151
port.checkAuth( db );
156152
port.say( m );
157153
if ( concern.callGetLastError() ){
158-
return _checkWriteError( db , mp , port , concern );
154+
return _checkWriteError( db , port , concern );
159155
}
160156
else {
161157
return new WriteResult( db , port , concern );

0 commit comments

Comments
 (0)