auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_location_customize_user); LocationEngine locationEngine = LocationSource.getLocationEngine(this); locationEngine.requestLocationUpdates(); mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(MapboxMap mapboxMap) { map = mapboxMap; permissionsManager = new PermissionsManager(CustomizeUserLocationActivity.this); if (!PermissionsManager.areLocationPermissionsGranted(CustomizeUserLocationActivity.this)) { permissionsManager.requestLocationPermissions(CustomizeUserLocationActivity.this); } else { enableGps(); } map.getMyLocationViewSettings().setPadding(0, 500, 0, 0); map.getMyLocationViewSettings().setForegroundTintColor(Color.parseColor("#56B881")); map.getMyLocationViewSettings().setAccuracyTintColor(Color.parseColor("#FBB03B")); } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_location_customize_user); locationEngine = LocationSource.getLocationEngine(this); mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(MapboxMap mapboxMap) { map = mapboxMap; permissionsManager = new PermissionsManager(CustomizeUserLocationActivity.this); if (!PermissionsManager.areLocationPermissionsGranted(CustomizeUserLocationActivity.this)) { permissionsManager.requestLocationPermissions(CustomizeUserLocationActivity.this); } else { enableLocation(); } map.getMyLocationViewSettings().setPadding(0, 500, 0, 0); map.getMyLocationViewSettings().setForegroundTintColor(Color.parseColor("#56B881")); map.getMyLocationViewSettings().setAccuracyTintColor(Color.parseColor("#FBB03B")); } }); }
Source:
public static void setBoundSlotPosition(Bound bound, List<List<KeyRange>> slots, int[] position) { int idx; for (idx = 0; idx < slots.size(); idx++) { if (!slots.get(idx).get(position[idx]).isSingleKey()) { break; } } if (idx < slots.size() - 1) { if (bound == Bound.LOWER) { for (int i = idx + 1; i < slots.size(); i++) { position[i] = 0; } } else { for (int i = idx + 1; i < slots.size(); i++) { position[i] = slots.get(i).size() - 1; } } } }

Target:
private static void setBoundSlotPosition(Bound bound, List<List<KeyRange>> slots, int[] position) { int idx; for (idx = 0; idx < slots.size(); idx++) { if (!slots.get(idx).get(position[idx]).isSingleKey()) { break; } } if (idx < slots.size() - 1) { if (bound == Bound.LOWER) { for (int i = idx + 1; i < slots.size(); i++) { position[i] = 0; } } else { for (int i = idx + 1; i < slots.size(); i++) { position[i] = slots.get(i).size() - 1; } } } }
Source:
protected final boolean useOnModifyDatabinding() { EObject viewCandidate = getVElement().eContainer(); while (viewCandidate != null && !VView.class.isInstance(viewCandidate)) { viewCandidate = viewCandidate.eContainer(); } if (!VView.class.isInstance(viewCandidate)) { return false; } final VViewModelProperties properties = VView.class.cast(viewCandidate).getLoadingProperties(); if (properties == null) { return false; } return USE_ON_MODIFY_DATABINDING_VALUE .equalsIgnoreCase((String) properties.get(USE_ON_MODIFY_DATABINDING_KEY)); }

Target:
protected final boolean useOnModifyDatabinding() { final VElement viewCandidate = getViewModelContext().getViewModel(); if (!VView.class.isInstance(viewCandidate)) { return false; } final VViewModelProperties properties = VView.class.cast(viewCandidate).getLoadingProperties(); if (properties == null) { return false; } return EMFFormsSWTConstants.USE_ON_MODIFY_DATABINDING_VALUE .equalsIgnoreCase((String) properties.get(EMFFormsSWTConstants.USE_ON_MODIFY_DATABINDING_KEY)); }
Source:
public void add(final RevCommit c) { sinceLastIndex++; if (++inQueue > REBUILD_INDEX_COUNT && sinceLastIndex > REBUILD_INDEX_COUNT) { sinceLastIndex = 0; buildIndex(); } Entry q = head; final long when = c.commitTime; if (index != null && index[first] != null && index[first].commit.commitTime > when) { int low = first, high = last; while (low <= high) { int mid = (low + high) >>> 1; int t = index[mid].commit.commitTime; if (t < when) high = mid - 1; else if (t > when) { low = mid + 1; } else { low = mid - 1; break; } } low = Math.min(low, high); while (low >= first && when == index[low].commit.commitTime) --low; q = index[low]; } final Entry n = newEntry(c); if (q == null || (q == head && when > q.commit.commitTime)) { n.next = q; head = n; } else { Entry p = q.next; while (p != null && p.commit.commitTime > when) { q = p; p = q.next; } n.next = q.next; q.next = n; } }

Target:
public void add(final RevCommit c) { sinceLastIndex++; if (++inQueue > REBUILD_INDEX_COUNT && sinceLastIndex > REBUILD_INDEX_COUNT) buildIndex(); Entry q = head; final long when = c.commitTime; if (first <= last && index[first].commit.commitTime > when) { int low = first, high = last; while (low <= high) { int mid = (low + high) >>> 1; int t = index[mid].commit.commitTime; if (t < when) high = mid - 1; else if (t > when) low = mid + 1; else { low = mid - 1; break; } } low = Math.min(low, high); while (low >= first && when == index[low].commit.commitTime) --low; q = index[low]; } final Entry n = newEntry(c); if (q == null || (q == head && when > q.commit.commitTime)) { n.next = q; head = n; } else { Entry p = q.next; while (p != null && p.commit.commitTime > when) { q = p; p = q.next; } n.next = q.next; q.next = n; } }
Source:
public void requestPasswordReset(@RequestBody Map<String, String> body) { User user = null; String usernameOrEmail = body.get("usernameOrEmail"); if ((user = userService.getUserByEmail(usernameOrEmail)) == null) { user = userService.getUserByUsername(usernameOrEmail); } if (user != null) { userService.setUserActivationKey(user); } }

Target:
public void requestPasswordReset(@RequestBody Map<String, String> body) { String usernameOrEmail = body.get("usernameOrEmail"); User user = userService.getUserByUsernameOrEmail(usernameOrEmail); if (user != null) { userService.setUserActivationKey(user); } }
Source:
private void shutdownAndAwaitTermination(final ExecutorService executorService, Instant start, final String logMessageOnSuccess) { executorService.shutdown(); try { executorService.awaitTermination(awaitTerminationTime.toMillis(), TimeUnit.MILLISECONDS); logger.log(Level.INFO, logMessageOnSuccess + " (took {0})", DurationFormatUtils.formatDurationWords(Duration.between(start, Instant.now()).toMillis(), true, true)); } catch (InterruptedException e) { logger.log(Level.SEVERE, "Interrupted while building suggesters", e); Thread.currentThread().interrupt(); } }

Target:
private void shutdownAndAwaitTermination(final ExecutorService executorService, Instant start, final String logMessageOnSuccess) { executorService.shutdown(); try { executorService.awaitTermination(awaitTerminationTime.toMillis(), TimeUnit.MILLISECONDS); logger.log(Level.INFO, "{0} (took {1})", new Object[]{logMessageOnSuccess, DurationFormatUtils.formatDurationWords(Duration.between(start, Instant.now()).toMillis(), true, true)}); } catch (InterruptedException e) { logger.log(Level.SEVERE, "Interrupted while building suggesters", e); Thread.currentThread().interrupt(); } }
Source:
public void prepareTest() { driver.manage().timeouts().pageLoadTimeout(100, TimeUnit.SECONDS); widgets = new ArrayList<>(); widgets.add(new PollsnackWidgetPageObject(driver)); widgets.add(new SoundCloudWidgetPageObject(driver)); widgets.add(new SpotifyWidgetPageObject(driver)); widgets.add(new TwitterWidgetPageObject(driver)); widgets.add(new VKWidgetPageObject(driver)); widgets.add(new WeiboWidgetPageObject(driver)); String content = ""; for (WidgetPageObject widget : widgets) { content += widget.getTag(); } ArticleContent articleContent = new ArticleContent(); articleContent.clear(ARTICLE_NAME); articleContent.push(content, ARTICLE_NAME); }

Target:
public void prepareTest() { driver.manage().timeouts().pageLoadTimeout(100, TimeUnit.SECONDS); widgets = new ArrayList<>(); widgets.add(new PollsnackWidgetPageObject(driver)); widgets.add(new SoundCloudWidgetPageObject(driver)); widgets.add(new SpotifyWidgetPageObject(driver)); widgets.add(new TwitterWidgetPageObject(driver)); widgets.add(new VKWidgetPageObject(driver)); widgets.add(new WeiboWidgetPageObject(driver)); widgets.add(new GoogleFormWidgetPageObject(driver)); widgets.add(new PolldaddyWidgetPageObject(driver)); String content = ""; for (WidgetPageObject widget : widgets) { content += widget.getTag(); } ArticleContent articleContent = new ArticleContent(); articleContent.clear(ARTICLE_NAME); articleContent.push(content, ARTICLE_NAME); }
Source:
private void submitPayload(String url, String jsonPayloadObject, String pushApplicationId, String masterSecret, MessageResponseCallback callback) { String credentials = pushApplicationId + ":" + masterSecret; int statusCode = 0; HttpURLConnection httpURLConnection = null; try { String encoded = Base64.encodeBytes(credentials.getBytes(UTF_8)); httpURLConnection = post(url, encoded, jsonPayloadObject); statusCode = httpURLConnection.getResponseCode(); logger.info(String.format("HTTP Response code form UnifiedPush Server: %s", statusCode)); logger.info("To: " + url); if (isRedirect(statusCode)) { String redirectURL = httpURLConnection.getHeaderField("Location"); logger.info(String.format("Performing redirect to '%s'", redirectURL)); this.submitPayload(redirectURL, jsonPayloadObject, pushApplicationId, masterSecret, callback); } else { if (isSuccess(statusCode)) { callback.success(statusCode); } callback.complete(statusCode); } } catch (Exception e) { logger.severe("Send did not succeed: " + e.getMessage()); callback.failure(e); } finally { if (httpURLConnection != null) { httpURLConnection.disconnect(); } } }

Target:
private void submitPayload(String url, String jsonPayloadObject, String pushApplicationId, String masterSecret, MessageResponseCallback callback) { String credentials = pushApplicationId + ":" + masterSecret; int statusCode = 0; HttpURLConnection httpURLConnection = null; try { String encoded = Base64.encodeBytes(credentials.getBytes(UTF_8)); httpURLConnection = post(url, encoded, jsonPayloadObject); statusCode = httpURLConnection.getResponseCode(); logger.info(String.format("HTTP Response code form UnifiedPush Server: %s", statusCode)); if (isRedirect(statusCode)) { String redirectURL = httpURLConnection.getHeaderField("Location"); logger.info(String.format("Performing redirect to '%s'", redirectURL)); this.submitPayload(redirectURL, jsonPayloadObject, pushApplicationId, masterSecret, callback); } else { if(callback != null){ callback.onComplete(statusCode); } } } catch (Exception e) { logger.severe("Send did not succeed: " + e.getMessage()); if(callback != null){ callback.onError(e); } } finally { if (httpURLConnection != null) { httpURLConnection.disconnect(); } } }
Source:
protected void recordLineage(LineageRecorder lineageRecorder, List<String> outputFields) { lineageRecorder.recordRead("Read", "Read from files.", outputFields); }

Target:
protected void recordLineage(LineageRecorder lineageRecorder, List<String> outputFields) { lineageRecorder.recordWrite("Write", String.format("Wrote to %s files.", config.getFormat().name().toLowerCase()), outputFields); }
Source:
public void write(final ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (closeSent != null) { ReferenceCountUtil.release(msg); promise.setFailure(new ClosedChannelException()); } else if (msg instanceof CloseWebSocketFrame) { closeSent = promise; ctx.write(msg).addListener(new ChannelPromiseNotifier(false, promise)); } else { ctx.write(msg, promise); } }

Target:
public void write(final ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (closeSent != null) { ReferenceCountUtil.release(msg); promise.setFailure(new ClosedChannelException()); } else if (msg instanceof CloseWebSocketFrame) { closeSent = promise.unvoid(); ctx.write(msg).addListener(new ChannelPromiseNotifier(false, closeSent)); } else { ctx.write(msg, promise); } }
Source:
public WorldRendererImpl(Context context, GLBufferPool bufferPool) { this.context = context; this.worldProvider = context.get(WorldProvider.class); this.backdropProvider = context.get(BackdropProvider.class); this.backdropRenderer = context.get(BackdropRenderer.class); this.renderingConfig = context.get(Config.class).getRendering(); this.renderingDebugConfig = renderingConfig.getDebug(); this.systemManager = context.get(ComponentSystemManager.class); this.shaderManager = context.get(ShaderManager.class); this.entityManager = context.get(EntityManager.class); if (renderingConfig.isOculusVrSupport()) { playerCamera = new OculusStereoCamera(); currentRenderingStage = RenderingStage.LEFT_EYE; } else { playerCamera = new PerspectiveCamera(renderingConfig.getCameraSettings()); currentRenderingStage = RenderingStage.MONO; } LocalPlayerSystem localPlayerSystem = context.get(LocalPlayerSystem.class); localPlayerSystem.setPlayerCamera(playerCamera); renderableWorld = new RenderableWorldImpl(worldProvider, context.get(ChunkProvider.class), bufferPool, playerCamera, dag); renderQueues = renderableWorld.getRenderQueues(); initMainDirectionalLight(); initRenderingSupport(); }

Target:
public WorldRendererImpl(Context context, GLBufferPool bufferPool) { this.context = context; this.worldProvider = context.get(WorldProvider.class); this.backdropProvider = context.get(BackdropProvider.class); this.backdropRenderer = context.get(BackdropRenderer.class); this.renderingConfig = context.get(Config.class).getRendering(); this.renderingDebugConfig = renderingConfig.getDebug(); this.systemManager = context.get(ComponentSystemManager.class); this.shaderManager = context.get(ShaderManager.class); this.entityManager = context.get(EntityManager.class); if (renderingConfig.isOculusVrSupport()) { playerCamera = new OculusStereoCamera(); currentRenderingStage = RenderingStage.LEFT_EYE; } else { playerCamera = new PerspectiveCamera(renderingConfig.getCameraSettings()); currentRenderingStage = RenderingStage.MONO; } LocalPlayerSystem localPlayerSystem = context.get(LocalPlayerSystem.class); localPlayerSystem.setPlayerCamera(playerCamera); renderableWorld = new RenderableWorldImpl(worldProvider, context.get(ChunkProvider.class), bufferPool, playerCamera); renderQueues = renderableWorld.getRenderQueues(); initMainDirectionalLight(); initRenderingSupport(); }
Source:
public @Nullable String getSelectedItemValue() { String ret = null; RegistrationOption selected = (RegistrationOption)getSelectedItem(); if (selected != null) { ret = selected.getValue(); } return ret; }

Target:
public @Nullable String getSelectedItemValue() { String value = null; RegistrationOption selected = (RegistrationOption)getSelectedItem(); if (selected != null) { value = selected.getValue(); } return value; }
Source:
public SimpleClusteredVersion readFrom(ProtoStreamReader reader) throws IOException { return new SimpleClusteredVersion(reader.readInt("topology"), reader.readLong("version")); }

Target:
public SimpleClusteredVersion readFrom(ProtoStreamReader reader) throws IOException { int topology = reader.readInt("topology"); long version = reader.readLong("version"); return new SimpleClusteredVersion(topology, version); }
Source:
public Map<String, ConnectionProfile> loadConnectionProfiles() { IConnectionProfile[] connectionProfiles = ProfileManager.getInstance() .getProfiles(); Map<String, ConnectionProfile> result = new LinkedHashMap<String, ConnectionProfile>(); for (IConnectionProfile currentProfile : connectionProfiles) { ConnectionProfile profile = new ConnectionProfile(); profile.setName(currentProfile.getName()); Properties props = currentProfile.getBaseProperties(); String driverClass = props.getProperty(DRIVER_CLASS); if (driverClass == null) continue; profile.setDriver(driverClass); String driverLocation = props.getProperty(DRIVER_LOCATION); if (driverLocation == null) continue; profile.setPath(driverLocation); profile.setUser(props.getProperty(USER_NAME)); profile.setPassword(props.getProperty(PASSWORD)); profile.setUrl(props.getProperty(URL)); profile.setDialect(props.getProperty(HIBERNATE_DIALECT)); profile.setSavePassword(Boolean.parseBoolean(props .getProperty(SAVE_PWD))); result.put(profile.getName(), profile); } return result; }

Target:
public Map<String, ConnectionProfile> loadConnectionProfiles() { IConnectionProfile[] connectionProfiles = ProfileManager.getInstance() .getProfiles(); Map<String, ConnectionProfile> result = new LinkedHashMap<String, ConnectionProfile>(); for (IConnectionProfile currentProfile : connectionProfiles) { ConnectionProfile profile = new ConnectionProfile(); profile.setName(currentProfile.getName()); Properties props = currentProfile.getBaseProperties(); String driverClass = props.getProperty(DRIVER_CLASS); if (driverClass == null) { logInfo( "Value for " + DRIVER_CLASS + " in connection profile " + currentProfile.getName() + "was null. Ignoring this connection profile."); continue; } profile.setDriver(driverClass); String driverLocation = props.getProperty(DRIVER_LOCATION); if (driverLocation == null) { logInfo( "Value for " + DRIVER_LOCATION + " in connection profile " + currentProfile.getName() + "was null. Ignoring this connection profile."); continue; } profile.setPath(driverLocation); profile.setUser(props.getProperty(USER_NAME)); profile.setPassword(props.getProperty(PASSWORD)); profile.setUrl(props.getProperty(URL)); profile.setDialect(props.getProperty(HIBERNATE_DIALECT)); profile.setSavePassword(Boolean.parseBoolean(props .getProperty(SAVE_PWD))); result.put(profile.getName(), profile); } return result; }
Source:
public int getIntMetric(String metric) { Object metricValue = event.get(metric); if (metricValue == null) { return 0; } if (metricValue instanceof Number) { return ((Number) metricValue).intValue(); } else if (metricValue instanceof String) { try { return Integer.valueOf(((String) metricValue).replace(",", "")); } catch (Exception e) { throw new ParseException(e, "Unable to parse metrics[%s], value[%s]", metric, metricValue); } } else { throw new ParseException("Unknown type[%s]", metricValue.getClass()); } }

Target:
public int getIntMetric(String metric) { Object metricValue = event.get(metric); if (metricValue == null) { return 0; } if (metricValue instanceof Number) { return ((Number) metricValue).intValue(); } else if (metricValue instanceof String) { try { String s = ((String) metricValue).replace(",", ""); return LONG_PAT.matcher(s).matches() ? Integer.valueOf(s) : Double.valueOf(s).intValue(); } catch (Exception e) { throw new ParseException(e, "Unable to parse metrics[%s], value[%s]", metric, metricValue); } } else { throw new ParseException("Unknown type[%s]", metricValue.getClass()); } }
Source:
public GhciEvaluator() throws HaskellException { try { this.ghci = new ProcessBuilder(GHCIPATH) .redirectErrorStream(true) .start(); this.in = this.ghci.getInputStream(); this.out = this.ghci.getOutputStream(); } catch (IOException e) { throw new HaskellException(e); } this.NL = System.getProperty("line.separator"); this.eval(":set prompt " + SENTINEL); this.eval("import Prelude"); this.eval("import Data.List"); this.eval("import Data.Maybe"); this.eval("import Data.Either"); this.eval(":set +r"); }

Target:
public GhciEvaluator() throws HaskellException { try { this.ghci = new ProcessBuilder(GHCIPATH) .redirectErrorStream(true) .start(); this.in = this.ghci.getInputStream(); this.out = this.ghci.getOutputStream(); } catch (IOException e) { throw new HaskellException(e); } this.NL = System.getProperty("line.separator"); this.eval(":set prompt " + SENTINEL); this.eval(":module " + Joiner.on(" ").join(MODULES)); this.eval(":set +r"); }
Source:
public void addReviewData(ITask review, String description) { TaskData reviewData = new TaskData(new TaskAttributeMapper(new TaskRepository("", "")), "", review.getUrl(), review.getTaskId()); reviewData.getRoot().createMappedAttribute(TaskAttribute.DESCRIPTION).setValue(description); try { when(taskDataManager.getTaskData(review)).thenReturn(reviewData); } catch (CoreException e) { e.printStackTrace(); } }

Target:
public void addReviewData(ITask review, String description) throws CoreException { TaskData reviewData = new TaskData(new TaskAttributeMapper(new TaskRepository("", "")), "", review.getUrl(), review.getTaskId()); reviewData.getRoot().createMappedAttribute(TaskAttribute.DESCRIPTION).setValue(description); when(taskDataManager.getTaskData(review)).thenReturn(reviewData); }
Source:
public static byte[] castToBinary(Object x, int targetSqlType) throws SQLException { if (x instanceof byte[]) { return (byte[]) x; } try { if (x instanceof String) { return x.toString().getBytes(UTF_8); } } catch (RuntimeException e) { throw invalidConversion(x, targetSqlType, e); } throw invalidConversion(x, targetSqlType); }

Target:
public static byte[] castToBinary(Object x, int targetSqlType) throws SQLException { if (x instanceof byte[]) { return (byte[]) x; } if (x instanceof String) { return ((String) x).getBytes(UTF_8); } throw invalidConversion(x, targetSqlType); }
Source:
AsyncRequestAndCallback(Position position) { String formattedUrl; try { formattedUrl = json ? url : formatRequest(position); } catch (UnsupportedEncodingException | JsonProcessingException e) { throw new RuntimeException("Forwarding formatting error", e); } requestBuilder = client.target(formattedUrl).request(); if (header != null && !header.isEmpty()) { for (String line: header.split("\\r?\\n")) { String[] values = line.split(":", 2); String headerName = values[0].trim(); String headerValue = values[1].trim(); requestBuilder.header(headerName, headerValue); if (headerName.equals(HttpHeaders.CONTENT_TYPE)) { mediaType = MediaType.valueOf(headerValue); } } } if (json) { payload = prepareJsonPayload(position); } deliveryPending.incrementAndGet(); }

Target:
AsyncRequestAndCallback(Position position) { String formattedUrl; try { formattedUrl = (json && !urlVariables) ? url : formatRequest(position); } catch (UnsupportedEncodingException | JsonProcessingException e) { throw new RuntimeException("Forwarding formatting error", e); } requestBuilder = client.target(formattedUrl).request(); if (header != null && !header.isEmpty()) { for (String line: header.split("\\r?\\n")) { String[] values = line.split(":", 2); String headerName = values[0].trim(); String headerValue = values[1].trim(); if (headerName.equals(HttpHeaders.CONTENT_TYPE)) { mediaType = MediaType.valueOf(headerValue); } else { requestBuilder.header(headerName, headerValue); } } } if (json) { payload = prepareJsonPayload(position); } deliveryPending.incrementAndGet(); }
Source:
protected void checkAllowWritesOnUiThread() { if (getSharedRealm().capabilities.isMainThread()) { if (!getConfiguration().isAllowWritesOnUiThread()) { throw new RealmException("Running transactions on the UI thread is disabled by default. You can opt in by using 'RealmConfiguration.allowWritesOnUiThread' or avoid it by using 'Realm.executeTransactionAsync'."); } } }

Target:
protected void checkAllowWritesOnUiThread() { if (getSharedRealm().capabilities.isMainThread()) { if (!getConfiguration().isAllowWritesOnUiThread()) { throw new RealmException("Running transactions on the UI thread has been disabled. It can be enabled by setting 'RealmConfiguration.Builder.allowWritesOnUiThread(true)'."); } } }
Source:
protected boolean validate() { Guid vdsId = getVdsId(); VDS vds = vdsDao.get(vdsId); if (vds.getStatus() != VDSStatus.Maintenance && vds.getStatus() != VDSStatus.NonResponsive && vds.getStatus() != VDSStatus.Up && vds.getStatus() != VDSStatus.Error && vds.getStatus() != VDSStatus.PreparingForMaintenance && vds.getStatus() != VDSStatus.Down && vds.getStatus() != VDSStatus.InstallFailed) { return failValidation(EngineMessage.VDS_CANNOT_MAINTENANCE_VDS_IS_NOT_OPERATIONAL); } orderListOfRunningVmsOnVds(vdsId); for (VM vm : vms) { if (vm.isHostedEngine()) { if (!HostedEngineHelper.haveHostsAvailableforHE( vdsDao.getAllForClusterWithStatus(vds.getClusterId(), VDSStatus.Up), Collections.singletonList(vdsId))) { return failValidation(EngineMessage.VDS_CANNOT_MAINTENANCE_NO_ALTERNATE_HOST_FOR_HOSTED_ENGINE); } continue; } if ((getParameters().isInternal() && vm.getMigrationSupport() == MigrationSupport.IMPLICITLY_NON_MIGRATABLE) || vm.getMigrationSupport() == MigrationSupport.PINNED_TO_HOST) { return failValidation(EngineMessage.VDS_CANNOT_MAINTENANCE_IT_INCLUDES_NON_MIGRATABLE_VM); } } ActionReturnValue returnValue = getReturnValue(); if (returnValue != null) { if (!returnValue.getValidationMessages().isEmpty()) { addMaintenanceFailedReason(returnValue.getValidationMessages()); } } return true; }

Target:
protected boolean validate() { final boolean result = validateImpl(); if (!result) { addValidationMessageVariables(); addMaintenanceFailedReason( backend.getErrorsTranslator().translateErrorText(getReturnValue().getValidationMessages())); } return result; }
Source:
public List<QualifiedPatientIdentifier> retrievePatientCorrelation( QualifiedPatientIdentifier qualifiedPatientIdentifier, List<String> includeOnlyAssigningAuthorities) { Retriever retriever = new Retriever(); return retriever.retrievePatientCorrelation(qualifiedPatientIdentifier, includeOnlyAssigningAuthorities); }

Target:
public List<QualifiedPatientIdentifier> retrievePatientCorrelation( QualifiedPatientIdentifier qualifiedPatientIdentifier, List<String> includeOnlyAssigningAuthorities) { return Retriever.retrievePatientCorrelation(qualifiedPatientIdentifier, includeOnlyAssigningAuthorities); }
Source:
private void initializeAnnouncementView() { User user = mBaseInterface.getUser(); if (user != null) { mUser.setText(user.getName()); user.loadUserImage(getActivity(), mPicture); mTime.setText(getString(R.string.pause_semester_today)); mTitle.setText(getString(R.string.pause_semester_announcement_title)); mBody.setText(getString(R.string.pause_semester_announcement_body)); mSchool.setVisibility(View.GONE); } }

Target:
private void initializeAnnouncementView() { User user = mBaseInterface.getUser(); if (user == null) { Log.e("User Null", "Base Interface user is null"); return; } mUser.setText(user.getName()); user.loadUserImage(getActivity(), mPicture); mTime.setText(getString(R.string.pause_semester_today)); mTitle.setText(getString(R.string.pause_semester_announcement_title)); mBody.setText(getString(R.string.pause_semester_announcement_body)); mSchool.setVisibility(View.GONE); }
Source:
public void testGetCrashLogContents() { AbstractDevice device = mock(AbstractDevice.class); when(device.getExternalStoragePath()).thenReturn("/storage"); when(device.getCrashLog()).thenCallRealMethod(); when( device.executeCommandQuietly(argThat(matchesCmdLine("adb shell ls /storage/")))) .thenReturn(String.format("some_file%nappcrash.log%nanother_file")); when( device.executeCommandQuietly(argThat(matchesCmdLine("adb.exe shell ls C:\\storage/")))) .thenReturn(String.format("some_file%nappcrash.log%nanother_file")); when( device.executeCommandQuietly(argThat(matchesCmdLine("adb shell cat /storage/appcrash.log")))) .thenReturn("crash log contents"); when( device.executeCommandQuietly(argThat(matchesCmdLine("adb.exe shell cat C:\\storage\\appcrash.log")))) .thenReturn("crash log contents"); assertEquals("crash log contents", device.getCrashLog()); }

Target:
public void testGetCrashLogContents() { AbstractDevice device = mock(AbstractDevice.class); when(device.getExternalStoragePath()).thenReturn("/storage"); when(device.getCrashLog()).thenCallRealMethod(); when( device.executeCommandQuietly(argThat(matchesCmdLine(".*adb(\\.exe)? shell ls /storage/$")))) .thenReturn(String.format("some_file%nappcrash.log%nanother_file")); when( device.executeCommandQuietly(argThat(matchesCmdLine(".*adb(\\.exe)? shell cat /storage/appcrash\\.log$")))) .thenReturn("crash log contents"); assertEquals("crash log contents", device.getCrashLog()); }
Source:
public void run() { Set<Subscription> subscriptions = Util.newSet(); for (Product product : products) { List<Subscription> subs = subAdapter.getSubscriptions(product.toDTO()); log.debug("Will refresh subscriptions in all orgs using product: ", subs.size(), product.getId()); if (log.isDebugEnabled()) { for (Subscription s : subs) { Owner so = s.getOwner(); if (so == null || so.getKey() == null) { log.debug(" Received a subscription without a well-defined owner: {}", s.getId()); continue; } if (!this.owners.containsKey(so.getKey())) { log.debug(" {}", s); } } } subscriptions.addAll(subs); } for (Subscription subscription : subscriptions) { Owner so = subscription.getOwner(); if (so == null || so.getKey() == null) { log.error("Received a subscription without a well-defined owner: {}", subscription.getId()); continue; } if (this.owners.containsKey(so.getKey())) { log.debug("Skipping subscription \"{}\" for owner: {}", subscription.getId(), so); continue; } Pool masterPool = poolManager.convertToMasterPool(subscription); poolManager.refreshPoolsForMasterPool(masterPool, true, lazy, new HashSet<Product>()); } for (Owner owner : this.owners.values()) { poolManager.refreshPoolsWithRegeneration(subAdapter, owner, lazy); try { ownerManager.refreshOwnerForContentAccess(owner); } catch (Exception e) { log.error("Unable to handle content access certificates", e.getStackTrace().toString()); } } }

Target:
public void run() { Set<Subscription> subscriptions = Util.newSet(); for (Product product : products) { List<Subscription> subs = subAdapter.getSubscriptions(product.toDTO()); log.debug("Will refresh subscriptions in all orgs using product: ", subs.size(), product.getId()); if (log.isDebugEnabled()) { for (Subscription s : subs) { Owner so = s.getOwner(); if (so == null || so.getKey() == null) { log.debug(" Received a subscription without a well-defined owner: {}", s.getId()); continue; } if (!this.owners.containsKey(so.getKey())) { log.debug(" {}", s); } } } subscriptions.addAll(subs); } for (Subscription subscription : subscriptions) { Owner so = subscription.getOwner(); if (so == null || so.getKey() == null) { log.error("Received a subscription without a well-defined owner: {}", subscription.getId()); continue; } if (this.owners.containsKey(so.getKey())) { log.debug("Skipping subscription \"{}\" for owner: {}", subscription.getId(), so); continue; } Pool masterPool = poolManager.convertToMasterPool(subscription); poolManager.refreshPoolsForMasterPool(masterPool, true, lazy, new HashSet<Product>()); } for (Owner owner : this.owners.values()) { poolManager.refreshPoolsWithRegeneration(subAdapter, owner, lazy); ownerManager.refreshOwnerForContentAccess(owner); } }
Source:
private void switchForceField() { if (this.state == ForceFieldState.ACTIVE) this.state = ForceFieldState.INACTIVE; else this.state = ForceFieldState.ACTIVE; }

Target:
private void switchForceField() { this.state = state.switchState(); }
Source:
private void outputEventLog() { try { ShaftEscape.LOGGER.writeToFile(); final String log = new String(Files.readAllBytes( Paths.get(Logger.OUTFILE)), StandardCharsets.UTF_8); System.out.println("\n== EVENT_LOG =="); System.out.println(log); System.out.println("== END_EVENT_LOG ==\n"); } catch (IOException e) { fail(); } }

Target:
private void outputEventLog() { try { ShaftEscape.LOGGER.writeToFile(); final String log = new String(Files.readAllBytes( Paths.get(Logger.OUTFILE)), StandardCharsets.UTF_8); System.out.println("\n== EVENT_LOG =="); System.out.println(log); System.out.println("== END_EVENT_LOG ==\n"); } catch (IOException e) { fail("IOException thrown: " + e.getMessage()); } }
Source:
public void shouldReceiveUpgradeStatusCode() throws Exception { ServerConnectionEstablisher establisher = new ServerConnectionEstablisher(); HttpMessage handshakeRequest = new HttpMessage(HttpHandshakeBuilder.getHttpHandshakeRequestHeader(new URI("http://" + HOST_NAME + ":" + WEBSOCKET_PORT,true))); NanoWebSocketTestServer webSocketServer = super.getWebSocketTestServer(); System.out.println(handshakeRequest.getRequestHeader().toString()); establisher.send(new HandshakeConfig(handshakeRequest,false,false)); assertEquals(101,handshakeRequest.getResponseHeader().getStatusCode()); assertEquals(webSocketServer.getLastConnection() .getHandshakeResponse().getHeader(HttpHandshakeBuilder.SEC_WEB_SOCKET_ACCEPT) , WebSocketUtils.encodeWebSocketKey(handshakeRequest.getRequestHeader().getHeader(HttpHandshakeBuilder.SEC_WEB_SOCKET_KEY))); }

Target:
public void shouldReceiveUpgradeStatusCode() throws Exception { ServerConnectionEstablisher establisher = new ServerConnectionEstablisher(); NanoWebSocketTestServer webSocketServer = super.getWebSocketTestServer(); HttpMessage handshakeRequest = new HttpMessage(HttpHandshakeBuilder.getHttpHandshakeRequestHeader(super.getServertUrl())); establisher.send(new HandshakeConfig(handshakeRequest,false,false)); assertEquals(101,handshakeRequest.getResponseHeader().getStatusCode()); assertEquals(webSocketServer.getLastConnection() .getHandshakeResponse().getHeader(HttpHandshakeBuilder.SEC_WEB_SOCKET_ACCEPT) , WebSocketUtils.encodeWebSocketKey(handshakeRequest.getRequestHeader().getHeader(HttpHandshakeBuilder.SEC_WEB_SOCKET_KEY))); }
Source:
public void promptForDbCredentialsIfMissing(Server server) { String defaultUser = "root"; String user = promptForValueIfMissingWithDefault( "Please specify database username (-D%s)", server.getDbUser(), "dbUser", defaultUser); server.setDbUser(user); String dbPassword = promptForPasswordIfMissingWithDefault( "Please specify database password (-D%s)", server.getDbPassword(), "dbPassword", ""); server.setDbPassword(dbPassword); }

Target:
public void promptForDbCredentialsIfMissing(Server server) { String defaultUser = "root"; String user = promptForValueIfMissingWithDefault( "Please specify database username (-D%s)", server.getDbUser(), "dbUser", defaultUser); server.setDbUser(user); String dbPassword = promptForPasswordIfMissingWithDefault( "Note: whitespace-only passwords will be left blank and trailing/leading whitespace will be removed.\nPlease specify database password (-D%s)", server.getDbPassword(), "dbPassword", ""); server.setDbPassword(dbPassword.trim()); }
Source:
public ServiceCreationConfiguration ehcache3CacheManagerConfiguration() { val ehcacheProperties = casProperties.getTicket().getRegistry().getEhcache3(); val terracottaClusterUri = ehcacheProperties.getTerracottaClusterUri(); if (StringUtils.isNotBlank(terracottaClusterUri)) { var clusterConfigBuilder = ClusteringServiceConfigurationBuilder.cluster(URI.create(terracottaClusterUri)) .timeouts(TimeoutsBuilder.timeouts() .connection(Duration.ofSeconds(ehcacheProperties.getClusterConnectionTimeout())) .read(Duration.ofSeconds(ehcacheProperties.getClusterReadWriteTimeout())) .write(Duration.ofSeconds(ehcacheProperties.getClusterReadWriteTimeout())).build()) .autoCreate(s -> s.defaultServerResource(ehcacheProperties.getDefaultServerResource()) .resourcePool(ehcacheProperties.getResourcePoolName(), ehcacheProperties.getResourcePoolSize(), MemoryUnit.valueOf(ehcacheProperties.getResourcePoolUnits()))); return clusterConfigBuilder.build(); } else { val rootDirectory = ehcacheProperties.getRootDirectory(); val rootDirectoryFile = new File(rootDirectory); if (!rootDirectoryFile.exists()) { LOGGER.debug("Creating folder for ehcache ticket registry disk cache [{}]", rootDirectory); val mkdirResult = rootDirectoryFile.mkdirs(); if (!mkdirResult) { LOGGER.warn("Unable to create folder for ehcache ticket registry disk cache [{}]", rootDirectory); } } return new DefaultPersistenceConfiguration(rootDirectoryFile); } }

Target:
public ServiceCreationConfiguration ehcache3CacheManagerConfiguration() { val ehcacheProperties = casProperties.getTicket().getRegistry().getEhcache3(); val terracottaClusterUri = ehcacheProperties.getTerracottaClusterUri(); if (StringUtils.isNotBlank(terracottaClusterUri)) { var clusterConfigBuilder = ClusteringServiceConfigurationBuilder.cluster(URI.create(terracottaClusterUri)) .timeouts(TimeoutsBuilder.timeouts() .connection(Duration.ofSeconds(ehcacheProperties.getClusterConnectionTimeout())) .read(Duration.ofSeconds(ehcacheProperties.getClusterReadWriteTimeout())) .write(Duration.ofSeconds(ehcacheProperties.getClusterReadWriteTimeout())).build()) .autoCreate(s -> s.defaultServerResource(ehcacheProperties.getDefaultServerResource()) .resourcePool(ehcacheProperties.getResourcePoolName(), ehcacheProperties.getResourcePoolSize(), MemoryUnit.valueOf(ehcacheProperties.getResourcePoolUnits()))); return clusterConfigBuilder.build(); } val rootDirectory = ehcacheProperties.getRootDirectory(); val rootDirectoryFile = new File(rootDirectory); if (!rootDirectoryFile.exists()) { LOGGER.debug("Creating folder for ehcache ticket registry disk cache [{}]", rootDirectory); val mkdirResult = rootDirectoryFile.mkdirs(); if (!mkdirResult) { LOGGER.warn("Unable to create folder for ehcache ticket registry disk cache [{}]", rootDirectory); } } return new DefaultPersistenceConfiguration(rootDirectoryFile); }
Source:
public boolean isDefaultValue() { if(this.equals(FRIEND_TRUST.NORMAL)) return true; else return false; }

Target:
public boolean isDefaultValue() { return this.equals(FRIEND_TRUST.NORMAL); }
Source:
public void testDisableErrorLogByDefault() throws Exception { StatusUpdateUtil _statusUpdateUtil = new StatusUpdateUtil(); int n = 1; Exception e = new RuntimeException("test exception"); TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, "localhost", "TestDB", 1, 1, n, 1, "MasterSlave", true); MockParticipantManager[] participants = new MockParticipantManager[n]; for (int i = 0; i < n; i++) { String instanceName = "localhost_" + (12918 + i); participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName); participants[i].syncStart(); } Message message = new Message(Message.MessageType.STATE_TRANSITION, "Some unique id"); message.setSrcName("cm-instance-0"); message.setTgtSessionId(participants[0].getSessionId()); message.setFromState("Offline"); message.setToState("Slave"); message.setPartitionName("TestDB_0"); message.setMsgId("Some unique message id"); message.setResourceName("TestDB"); message.setTgtName("localhost_12918"); message.setStateModelDef("MasterSlave"); message.setStateModelFactoryName(HelixConstants.DEFAULT_STATE_MODEL_FACTORY); _statusUpdateUtil.logError(message, HelixStateTransitionHandler.class, e, "test status update", participants[0]); String errPath = PropertyPathBuilder.instanceError(clusterName, "localhost_12918", participants[0].getSessionId(), "TestDB", "TestDB_0"); try { ZNRecord error = _gZkClient.readData(errPath); Assert.fail("not expecting being able to send error logs to ZK by default."); } catch (ZkException zke) { Assert.assertTrue(true); } for (int i = 0; i < n; i++) { participants[i].syncStop(); } }

Target:
public void testDisableErrorLogByDefault() throws Exception { StatusUpdateUtil statusUpdateUtil = new StatusUpdateUtil(); setFinalStatic(StatusUpdateUtil.class.getField("ERROR_LOG_TO_ZK_ENABLED"), false); Exception e = new RuntimeException("test exception"); statusUpdateUtil.logError(message, HelixStateTransitionHandler.class, e, "test status update", participants[0]); String errPath = PropertyPathBuilder .instanceError(clusterName, "localhost_12918", participants[0].getSessionId(), "TestDB", "TestDB_0"); try { ZNRecord error = _gZkClient.readData(errPath); Assert.fail("not expecting being able to send error logs to ZK by default."); } catch (ZkException zke) { } }
Source:
public List<String> getJournalKeysFromDois(List<String> dois, Site site) throws IOException { if (dois.size() == 0) { return new ArrayList<String>(); } List<String> quoted = dois.stream().map(doi -> { return "\"" + QueryParser.escape(doi) + "\""; }).collect(Collectors.toList()); ArticleSearchQuery explicitDoiSearchQuery = ArticleSearchQuery.builder() .setSimple(false) .setRows(dois.size()) .setQuery("id:(" + String.join(" OR ", quoted) + ")") .setIsJournalSearch(true) .build(); Map<String, ?> results = solrSearchApi.search(explicitDoiSearchQuery, site); List<Map<String, ?>> docs = (List<Map<String, ?>>) results.get("docs"); List<String> journalKeys = null; if (docs.size() == dois.size()) { journalKeys = docs.stream().map(data -> { return (String) data.get("journal_key"); }).collect(Collectors.toList()); } else { log.warn("incorrect solr result count " + docs.size() + " != " + dois.size() + " for query=" + explicitDoiSearchQuery.getQuery()); } return journalKeys; }

Target:
public List<String> getJournalKeysFromDois(List<String> dois, Site site) throws IOException { if (dois.isEmpty()) { return new ArrayList<String>(); } List<String> quoted = dois.stream().map(doi -> { return "\"" + QueryParser.escape(doi) + "\""; }).collect(Collectors.toList()); ArticleSearchQuery explicitDoiSearchQuery = ArticleSearchQuery.builder() .setSimple(false) .setRows(dois.size()) .setQuery("id:(" + String.join(" OR ", quoted) + ")") .setIsJournalSearch(true) .build(); Map<String, ?> results = solrSearchApi.search(explicitDoiSearchQuery, site); List<Map<String, ?>> docs = (List<Map<String, ?>>) results.get("docs"); List<String> journalKeys = null; if (docs.size() == dois.size()) { journalKeys = docs.stream().map(data -> { return (String) data.get("journal_key"); }).collect(Collectors.toList()); } else { log.warn("incorrect solr result count " + docs.size() + " != " + dois.size() + " for query=" + explicitDoiSearchQuery.getQuery()); } return journalKeys; }
Source:
private void checkout() throws NoWorkTreeException, IOException { for (int i = toBeDeleted.size() - 1; i >= 0; i--) { String fileName = toBeDeleted.get(i); File f = new File(nonNullRepo().getWorkTree(), fileName); if (!f.delete()) if (!f.isDirectory()) failingPaths.put(fileName, MergeFailureReason.COULD_NOT_DELETE); modifiedFiles.add(fileName); } for (Map.Entry<String, DirCacheEntry> entry : toBeCheckedOut .entrySet()) { DirCacheEntry cacheEntry = entry.getValue(); if (cacheEntry.getFileMode() == FileMode.GITLINK) { new File(db.getWorkTree(), entry.getKey()).mkdirs(); } else { DirCacheCheckout.checkoutEntry(db, cacheEntry, reader); modifiedFiles.add(entry.getKey()); } } }

Target:
private void checkout() throws NoWorkTreeException, IOException { for (int i = toBeDeleted.size() - 1; i >= 0; i--) { String fileName = toBeDeleted.get(i); File f = new File(nonNullRepo().getWorkTree(), fileName); if (!f.delete()) if (!f.isDirectory()) failingPaths.put(fileName, MergeFailureReason.COULD_NOT_DELETE); modifiedFiles.add(fileName); } for (Map.Entry<String, DirCacheEntry> entry : toBeCheckedOut .entrySet()) { DirCacheEntry cacheEntry = entry.getValue(); if (cacheEntry.getFileMode() == FileMode.GITLINK) { new File(nonNullRepo().getWorkTree(), entry.getKey()).mkdirs(); } else { DirCacheCheckout.checkoutEntry(db, cacheEntry, reader); modifiedFiles.add(entry.getKey()); } } }
Source:
public Blob run() { JSONArray result = new JSONArray(); JSONObject resultJSON = new JSONObject(); if (updateInProgress) { resultJSON.put("status", "inProgress"); result.add(resultJSON); return Blobs.createJSONBlob(result.toString()); } if (!((NuxeoPrincipal) session.getPrincipal()).isAdministrator()) { resultJSON.put("status", "error"); resultJSON.put("message", "Must be Administrator to use this function"); result.add(resultJSON); return Blobs.createJSONBlob(result.toString()); } if (!Framework.isDevModeSet()) { resultJSON.put("status", "error"); resultJSON.put("message", "You must enable Dev mode to Hot reload your Studio Snapshot package."); result.add(resultJSON); return Blobs.createJSONBlob(result.toString()); } List<DownloadablePackage> pkgs = pm.listRemoteAssociatedStudioPackages(); DownloadablePackage snapshotPkg = StudioSnapshotHelper.getSnapshot(pkgs); if (snapshotPkg == null) { resultJSON.put("status", "error"); resultJSON.put("message", "No Snapshot Package was found."); result.add(resultJSON); return Blobs.createJSONBlob(result.toString()); } try { updateInProgress = true; hotReloadPackage(snapshotPkg, resultJSON); result.add(resultJSON); return Blobs.createJSONBlob(result.toString()); } finally { updateInProgress = false; } }

Target:
public Blob run() { JSONArray result = new JSONArray(); JSONObject resultJSON = new JSONObject(); if (updateInProgress) { return jsonHelper(inProgress, "Update in progress.", null); } if (!((NuxeoPrincipal) session.getPrincipal()).isAdministrator()) { return jsonHelper(error, "Must be Administrator to use this function.", null); } if (!Framework.isDevModeSet()) { return jsonHelper(error, "You must enable Dev mode to Hot reload your Studio Snapshot package.", null); } List<DownloadablePackage> pkgs = pm.listRemoteAssociatedStudioPackages(); DownloadablePackage snapshotPkg = StudioSnapshotHelper.getSnapshot(pkgs); if (snapshotPkg == null) { return jsonHelper(error, "No Snapshot Package was found.", null); } try { updateInProgress = true; return hotReloadPackage(snapshotPkg); } finally { updateInProgress = false; } }
Source:
public EmbeddedCacheManager startCaches(final String... cacheNames) { authzHelper.checkPermission(AuthorizationPermission.LIFECYCLE); List<Thread> threads = new ArrayList<Thread>(cacheNames.length); final AtomicReference<RuntimeException> exception = new AtomicReference<RuntimeException>(null); for (final String cacheName : new HashSet<String>(Arrays.asList(cacheNames))) { String threadName = "CacheStartThread," + configurationManager.getGlobalConfiguration().transport().nodeName() + "," + cacheName; Thread thread = new Thread(threadName) { @Override public void run() { try { createCache(cacheName, cacheName); } catch (RuntimeException e) { exception.set(e); } catch (Throwable t) { exception.set(new RuntimeException(t)); } } }; thread.start(); threads.add(thread); } try { for (Thread thread : threads) { thread.join(); } } catch (InterruptedException e) { throw new CacheException("Interrupted while waiting for the caches to start"); } RuntimeException runtimeException = exception.get(); if (runtimeException != null) { throw runtimeException; } return this; }

Target:
public EmbeddedCacheManager startCaches(final String... cacheNames) { authzHelper.checkPermission(AuthorizationPermission.LIFECYCLE); Map<String, Thread> threads = new HashMap<>(cacheNames.length); final AtomicReference<RuntimeException> exception = new AtomicReference<RuntimeException>(null); for (final String cacheName : cacheNames) { if (!threads.containsKey(cacheName)) { String threadName = "CacheStartThread," + configurationManager.getGlobalConfiguration().transport().nodeName() + "," + cacheName; Thread thread = new Thread(threadName) { @Override public void run() { try { createCache(cacheName, cacheName); } catch (RuntimeException e) { exception.set(e); } catch (Throwable t) { exception.set(new RuntimeException(t)); } } }; thread.start(); threads.put(cacheName, thread); } } try { for (Thread thread : threads.values()) { thread.join(); } } catch (InterruptedException e) { throw new CacheException("Interrupted while waiting for the caches to start"); } RuntimeException runtimeException = exception.get(); if (runtimeException != null) { throw runtimeException; } return this; }
Source:
public void checkRttButtonStatus() { Contact contact = conversation == null ? null : conversation.getContact(); if (contact != null && contact.getPresences().supports(Namespace.RTT) && activity.xmppConnectionService.useRealTimeText() && conversation.getBooleanAttribute(Conversation.ATTRIBUTE_REAL_TIME_TEXT, false)) { conversation.setAttribute(Conversation.ATTRIBUTE_REAL_TIME_TEXT, "true"); setRttButtonAlpha(true); } else { conversation.setAttribute(Conversation.ATTRIBUTE_REAL_TIME_TEXT, "false"); setRttButtonAlpha(false); } }

Target:
public void checkRttButtonStatus() { if (conversation != null) { Contact contact = conversation.getContact(); if (contact != null && contact.getPresences().supports(Namespace.RTT) && conversation.getBooleanAttribute(Conversation.ATTRIBUTE_REAL_TIME_TEXT, false)) { setRttButtonAlpha(true); } else { setRttButtonAlpha(false); } } }