Program: 35622
Project: 35622
Buggy source:
private void processOperation(){
  userEntity=userUtils.getCurrentUser();
  OperationsObserver operationsObserver=new OperationsObserver();
  if (!TextUtils.isEmpty(callUrl)) {
    conversationToken=callUrl.substring(callUrl.lastIndexOf("String_Node_Str") + 1,callUrl.length());
    if (callUrl.contains("String_Node_Str")) {
      baseUrl=callUrl.substring(0,callUrl.indexOf("String_Node_Str"));
    }
 else {
      baseUrl=callUrl.substring(0,callUrl.indexOf("String_Node_Str"));
    }
  }
  if (userEntity != null) {
    credentials=ApiUtils.getCredentials(userEntity.getUsername(),userEntity.getToken());
    if (!TextUtils.isEmpty(baseUrl) && !baseUrl.equals(userEntity.getBaseUrl())) {
      credentials=null;
    }
switch (operationCode) {
case 1:
      ncApi.removeSelfFromRoom(credentials,ApiUtils.getUrlForRemoveSelfFromRoom(userEntity.getBaseUrl(),room.getToken())).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(operationsObserver);
    break;
case 2:
  ncApi.renameRoom(credentials,ApiUtils.getRoom(userEntity.getBaseUrl(),room.getToken()),room.getName()).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(operationsObserver);
break;
case 3:
ncApi.makeRoomPublic(credentials,ApiUtils.getUrlForRoomVisibility(userEntity.getBaseUrl(),room.getToken())).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(operationsObserver);
break;
case 4:
case 5:
case 6:
String pass="String_Node_Str";
if (room.getPassword() != null) {
pass=room.getPassword();
}
ncApi.setPassword(credentials,ApiUtils.getUrlForPassword(userEntity.getBaseUrl(),room.getToken()),pass).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(operationsObserver);
break;
case 7:
break;
case 8:
ncApi.makeRoomPrivate(credentials,ApiUtils.getUrlForRoomVisibility(userEntity.getBaseUrl(),room.getToken())).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(operationsObserver);
break;
case 9:
ncApi.deleteRoom(credentials,ApiUtils.getUrlForRoomParticipants(userEntity.getBaseUrl(),room.getToken())).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(operationsObserver);
break;
case 10:
String finalCredentials=credentials;
ncApi.getRoom(finalCredentials,ApiUtils.getRoom(baseUrl,conversationToken)).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(new Observer<RoomOverall>(){
@Override public void onSubscribe(Disposable d){
disposable=d;
}
@Override public void onNext(RoomOverall roomOverall){
room=roomOverall.getOcs().getData();
ncApi.getCapabilities(finalCredentials,ApiUtils.getUrlForCapabilities(baseUrl)).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<CapabilitiesOverall>(){
@Override public void onSubscribe(Disposable d){
}
@Override public void onNext(CapabilitiesOverall capabilitiesOverall){
if (capabilitiesOverall.getOcs().getData().getCapabilities().getSpreedCapability() != null && capabilitiesOverall.getOcs().getData().getCapabilities().getSpreedCapability().getFeatures() != null && capabilitiesOverall.getOcs().getData().getCapabilities().getSpreedCapability().getFeatures().contains("String_Node_Str")) {
if (room.isHasPassword() && room.isGuest()) {
eventBus.post(new BottomSheetLockEvent(true,0,true,false));
Bundle bundle=new Bundle();
bundle.putParcelable(BundleKeys.KEY_ROOM,Parcels.wrap(room));
bundle.putString(BundleKeys.KEY_CALL_URL,callUrl);
bundle.putInt(BundleKeys.KEY_OPERATION_CODE,99);
getRouter().pushController(RouterTransaction.with(new EntryMenuController(bundle)).pushChangeHandler(new HorizontalChangeHandler()).popChangeHandler(new HorizontalChangeHandler()));
}
 else {
initiateCall();
}
}
 else {
showResultImage(false,true);
}
}
@Override public void onError(Throwable e){
showResultImage(false,false);
}
@Override public void onComplete(){
}
}
);
}
@Override public void onError(Throwable e){
showResultImage(false,false);
dispose();
}
@Override public void onComplete(){
dispose();
}
}
);
break;
case 11:
RetrofitBucket retrofitBucket;
boolean isGroupCallWorkaround=false;
if (conversationType.equals(Room.RoomType.ROOM_PUBLIC_CALL) || !userEntity.hasSpreedCapabilityWithName("String_Node_Str")) {
retrofitBucket=ApiUtils.getRetrofitBucketForCreateRoom(userEntity.getBaseUrl(),"String_Node_Str",null,conversationName);
}
 else {
String roomType="String_Node_Str";
if (!userEntity.hasSpreedCapabilityWithName("String_Node_Str")) {
isGroupCallWorkaround=true;
roomType="String_Node_Str";
}
retrofitBucket=ApiUtils.getRetrofitBucketForCreateRoom(userEntity.getBaseUrl(),roomType,null,conversationName);
}
String finalCredentials1=credentials;
final boolean isGroupCallWorkaroundFinal=isGroupCallWorkaround;
ncApi.createRoom(credentials,retrofitBucket.getUrl(),retrofitBucket.getQueryMap()).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(new Observer<RoomOverall>(){
@Override public void onSubscribe(Disposable d){
}
@Override public void onNext(RoomOverall roomOverall){
room=roomOverall.getOcs().getData();
if (conversationType.equals(Room.RoomType.ROOM_PUBLIC_CALL) && isGroupCallWorkaroundFinal) {
ncApi.makeRoomPrivate(finalCredentials1,ApiUtils.getUrlForRoomVisibility(userEntity.getBaseUrl(),room.getToken())).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(new Observer<GenericOverall>(){
@Override public void onSubscribe(Disposable d){
}
@Override public void onNext(GenericOverall genericOverall){
inviteUsersToAConversation();
}
@Override public void onError(Throwable e){
showResultImage(false,false);
dispose();
}
@Override public void onComplete(){
dispose();
}
}
);
}
 else {
inviteUsersToAConversation();
}
}
@Override public void onError(Throwable e){
showResultImage(false,false);
dispose();
}
@Override public void onComplete(){
dispose();
}
}
);
break;
case 99:
ncApi.joinRoom(credentials,ApiUtils.getUrlForRoomParticipants(baseUrl,conversationToken),callPassword).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(operationsObserver);
break;
default :
break;
}
}
}

Fixed version (ground truth):
private void processOperation(){
  userEntity=userUtils.getCurrentUser();
  OperationsObserver operationsObserver=new OperationsObserver();
  if (!TextUtils.isEmpty(callUrl)) {
    conversationToken=callUrl.substring(callUrl.lastIndexOf("String_Node_Str") + 1,callUrl.length());
    if (callUrl.contains("String_Node_Str")) {
      baseUrl=callUrl.substring(0,callUrl.indexOf("String_Node_Str"));
    }
 else {
      baseUrl=callUrl.substring(0,callUrl.indexOf("String_Node_Str"));
    }
  }
  if (userEntity != null) {
    credentials=ApiUtils.getCredentials(userEntity.getUsername(),userEntity.getToken());
    if (!TextUtils.isEmpty(baseUrl) && !baseUrl.equals(userEntity.getBaseUrl())) {
      credentials=null;
    }
switch (operationCode) {
case 1:
      ncApi.removeSelfFromRoom(credentials,ApiUtils.getUrlForRemoveSelfFromRoom(userEntity.getBaseUrl(),room.getToken())).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(operationsObserver);
    break;
case 2:
  ncApi.renameRoom(credentials,ApiUtils.getRoom(userEntity.getBaseUrl(),room.getToken()),room.getName()).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(operationsObserver);
break;
case 3:
ncApi.makeRoomPublic(credentials,ApiUtils.getUrlForRoomVisibility(userEntity.getBaseUrl(),room.getToken())).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(operationsObserver);
break;
case 4:
case 5:
case 6:
String pass="String_Node_Str";
if (room.getPassword() != null) {
pass=room.getPassword();
}
ncApi.setPassword(credentials,ApiUtils.getUrlForPassword(userEntity.getBaseUrl(),room.getToken()),pass).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(operationsObserver);
break;
case 7:
break;
case 8:
ncApi.makeRoomPrivate(credentials,ApiUtils.getUrlForRoomVisibility(userEntity.getBaseUrl(),room.getToken())).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(operationsObserver);
break;
case 9:
ncApi.deleteRoom(credentials,ApiUtils.getUrlForRoomParticipants(userEntity.getBaseUrl(),room.getToken())).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(operationsObserver);
break;
case 10:
String finalCredentials=credentials;
ncApi.getRoom(finalCredentials,ApiUtils.getRoom(baseUrl,conversationToken)).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(new Observer<RoomOverall>(){
@Override public void onSubscribe(Disposable d){
disposable=d;
}
@Override public void onNext(RoomOverall roomOverall){
room=roomOverall.getOcs().getData();
ncApi.getCapabilities(finalCredentials,ApiUtils.getUrlForCapabilities(baseUrl)).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<CapabilitiesOverall>(){
@Override public void onSubscribe(Disposable d){
}
@Override public void onNext(CapabilitiesOverall capabilitiesOverall){
if (capabilitiesOverall.getOcs().getData().getCapabilities().getSpreedCapability() != null && capabilitiesOverall.getOcs().getData().getCapabilities().getSpreedCapability().getFeatures() != null && capabilitiesOverall.getOcs().getData().getCapabilities().getSpreedCapability().getFeatures().contains("String_Node_Str")) {
if (room.isHasPassword() && room.isGuest()) {
eventBus.post(new BottomSheetLockEvent(true,0,true,false));
Bundle bundle=new Bundle();
bundle.putParcelable(BundleKeys.KEY_ROOM,Parcels.wrap(room));
bundle.putString(BundleKeys.KEY_CALL_URL,callUrl);
bundle.putInt(BundleKeys.KEY_OPERATION_CODE,99);
getRouter().pushController(RouterTransaction.with(new EntryMenuController(bundle)).pushChangeHandler(new HorizontalChangeHandler()).popChangeHandler(new HorizontalChangeHandler()));
}
 else {
initiateCall();
}
}
 else {
showResultImage(false,true);
}
}
@Override public void onError(Throwable e){
showResultImage(false,false);
}
@Override public void onComplete(){
}
}
);
}
@Override public void onError(Throwable e){
showResultImage(false,false);
dispose();
}
@Override public void onComplete(){
dispose();
}
}
);
break;
case 11:
RetrofitBucket retrofitBucket;
boolean isGroupCallWorkaround=false;
if (conversationType.equals(Room.RoomType.ROOM_PUBLIC_CALL) || !userEntity.hasSpreedCapabilityWithName("String_Node_Str")) {
retrofitBucket=ApiUtils.getRetrofitBucketForCreateRoom(userEntity.getBaseUrl(),"String_Node_Str",null,conversationName);
}
 else {
String roomType="String_Node_Str";
if (!userEntity.hasSpreedCapabilityWithName("String_Node_Str")) {
isGroupCallWorkaround=true;
roomType="String_Node_Str";
}
retrofitBucket=ApiUtils.getRetrofitBucketForCreateRoom(userEntity.getBaseUrl(),roomType,null,conversationName);
}
final boolean isGroupCallWorkaroundFinal=isGroupCallWorkaround;
ncApi.createRoom(credentials,retrofitBucket.getUrl(),retrofitBucket.getQueryMap()).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(new Observer<RoomOverall>(){
@Override public void onSubscribe(Disposable d){
}
@Override public void onNext(RoomOverall roomOverall){
room=roomOverall.getOcs().getData();
if (conversationType.equals(Room.RoomType.ROOM_PUBLIC_CALL) && isGroupCallWorkaroundFinal) {
performGroupCallWorkaround(credentials);
}
 else {
inviteUsersToAConversation();
}
}
@Override public void onError(Throwable e){
showResultImage(false,false);
dispose();
}
@Override public void onComplete(){
dispose();
}
}
);
break;
case 99:
ncApi.joinRoom(credentials,ApiUtils.getUrlForRoomParticipants(baseUrl,conversationToken),callPassword).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(operationsObserver);
break;
default :
break;
}
}
}