auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onPlayerChat(final AsyncPlayerChatEvent event) { if (isAborted(event)) { return; } final User user = ess.getUser(event.getPlayer()); if (user == null) { event.setCancelled(true); return; } final ChatStore chatStore = new ChatStore(ess, user, getChatType(event.getMessage())); setChatStore(event, chatStore); String formatted = FormatUtil.formatMessage(user, "essentials.chat", event.getMessage()); if ((ChatColor.stripColor(formatted)).length() == 0) { event.setCancelled(true); } event.setMessage(formatted); String group = user.getGroup(); String world = user.getWorld().getName(); Player player = user.getBase(); String prefix = FormatUtil.replaceFormat(ess.getPermissionsHandler().getPrefix(player)); String suffix = FormatUtil.replaceFormat(ess.getPermissionsHandler().getSuffix(player)); Team team = player.getScoreboard().getPlayerTeam(player); String format = ess.getSettings().getChatFormat(group); format = format.replace("{0}", group); format = format.replace("{1}", world); format = format.replace("{2}", world.substring(0, 1).toUpperCase(Locale.ENGLISH)); format = format.replace("{3}", team == null ? "" : team.getPrefix()); format = format.replace("{4}", team == null ? "" : team.getSuffix()); format = format.replace("{5}", team == null ? "" : team.getDisplayName()); format = format.replace("{6}", prefix); format = format.replace("{7}", suffix); format = format.replace("{8}", player.getName()); synchronized (format) { event.setFormat(format); } }

Target:
public void onPlayerChat(final AsyncPlayerChatEvent event) { if (isAborted(event)) { return; } final User user = ess.getUser(event.getPlayer()); if (user == null) { event.setCancelled(true); return; } final ChatStore chatStore = new ChatStore(ess, user, getChatType(event.getMessage())); setChatStore(event, chatStore); event.setMessage(FormatUtil.formatMessage(user, "essentials.chat", event.getMessage())); if ((ChatColor.stripColor(event.getMessage())).length() == 0) { event.setCancelled(true); return; } String group = user.getGroup(); String world = user.getWorld().getName(); Player player = user.getBase(); String prefix = FormatUtil.replaceFormat(ess.getPermissionsHandler().getPrefix(player)); String suffix = FormatUtil.replaceFormat(ess.getPermissionsHandler().getSuffix(player)); Team team = player.getScoreboard().getPlayerTeam(player); String format = ess.getSettings().getChatFormat(group); format = format.replace("{0}", group); format = format.replace("{1}", world); format = format.replace("{2}", world.substring(0, 1).toUpperCase(Locale.ENGLISH)); format = format.replace("{3}", team == null ? "" : team.getPrefix()); format = format.replace("{4}", team == null ? "" : team.getSuffix()); format = format.replace("{5}", team == null ? "" : team.getDisplayName()); format = format.replace("{6}", prefix); format = format.replace("{7}", suffix); format = format.replace("{8}", player.getName()); synchronized (format) { event.setFormat(format); } }
Source:
private void copyAllMemoryImages(Guid containerID) { for (Snapshot snapshot : snapshotsWithMemory) { List<Guid> guids = Guid.createGuidListFromString(snapshot.getMemoryVolume()); ActionReturnValue vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForMemoryDumpImage( containerID, guids.get(0), guids.get(2), guids.get(3))); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed during ExportVmCommand"); } getTaskIdList().addAll(vdcRetValue.getVdsmTaskIdList()); vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForMemoryConfImage( containerID, guids.get(0), guids.get(4), guids.get(5))); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed during ExportVmCommand"); } getTaskIdList().addAll(vdcRetValue.getVdsmTaskIdList()); } }

Target:
private void copyAllMemoryImages(Guid containerID) { for (Snapshot snapshot : snapshotsWithMemory) { List<Guid> guids = Guid.createGuidListFromString(snapshot.getMemoryVolume()); ActionReturnValue vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForMemoryDumpImage( containerID, guids.get(0), guids.get(2), guids.get(3))); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed during ExportVmCommand"); } vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForMemoryConfImage( containerID, guids.get(0), guids.get(4), guids.get(5))); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed during ExportVmCommand"); } } }
Source:
public BundleAsyncResponse bundleRequest(@OrganisationIdentification final String organisationIdentification, @MessagePriority final String messagePriority, @ResponseUrl final String responseUrl, @RequestPayload final BundleRequest request) throws OsgpException { LOGGER.info("Bundle request for organisation: and device: {}. and responseUrl: {}", organisationIdentification, request.getDeviceIdentification(), responseUrl); BundleAsyncResponse response = null; try { response = new BundleAsyncResponse(); final String deviceIdentification = request.getDeviceIdentification(); final Actions actions = request.getActions(); final List<? extends Action> actionList = actions.getActionList(); final List<ActionRequest> actionRequestList = this.actionMapperService.mapAllActions(actionList); final String correlationUid = this.bundleService.enqueueBundleRequest(organisationIdentification, deviceIdentification, actionRequestList, MessagePriorityEnum.getMessagePriority(messagePriority)); response.setCorrelationUid(correlationUid); response.setDeviceIdentification(request.getDeviceIdentification()); this.responseUrlService.saveResponseUrlIfNeeded(correlationUid, responseUrl); } catch (final Exception e) { this.handleException(e); } return response; }

Target:
public BundleAsyncResponse bundleRequest(@OrganisationIdentification final String organisationIdentification, @MessagePriority final String messagePriority, @ResponseUrl final String responseUrl, @RequestPayload final BundleRequest request) throws OsgpException { LOGGER.info("Bundle request for organisation: and device: {}. and responseUrl: {}", organisationIdentification, request.getDeviceIdentification(), responseUrl); BundleAsyncResponse response = null; try { response = new BundleAsyncResponse(); final String deviceIdentification = request.getDeviceIdentification(); final Actions actions = request.getActions(); final List<? extends Action> actionList = actions.getActionList(); final List<ActionRequest> actionRequestList = this.actionMapperService.mapAllActions(actionList); final String correlationUid = this.bundleService.enqueueBundleRequest(organisationIdentification, deviceIdentification, actionRequestList, MessagePriorityEnum.getMessagePriority(messagePriority)); response.setCorrelationUid(correlationUid); response.setDeviceIdentification(request.getDeviceIdentification()); this.saveResponseUrlIfNeeded(correlationUid, responseUrl); } catch (final Exception e) { this.handleException(e); } return response; }
Source:
public void updateAnnotation(CoreSession session, String annotationId, Annotation annotation) { IdRef annotationRef = new IdRef(annotationId); if (!session.exists(annotationRef)) { throw new IllegalArgumentException("The annotation " + annotationId + " does not exist."); } DocumentModel annotationModel = session.getDocument(annotationRef); Comments.externalAnnotationToDocumentModel().accept(annotation, annotationModel); session.saveDocument(annotationModel); }

Target:
public void updateAnnotation(CoreSession session, String annotationId, Annotation annotation) { IdRef annotationRef = new IdRef(annotationId); if (!session.exists(annotationRef)) { throw new IllegalArgumentException("The annotation " + annotationId + " does not exist."); } DocumentModel annotationModel = session.getDocument(annotationRef); Comments.annotationToDocumentModel(annotation, annotationModel); if (annotation instanceof ExternalEntity) { Comments.externalEntityToDocumentModel((ExternalEntity) annotation, annotationModel); } session.saveDocument(annotationModel); }
Source:
private static int primeNo(int index) { return Match .when(1, (i) -> 2) .orElse(() -> knownPrimes.drop(index - 1).head()) .apply(index); }

Target:
private static int primeNo(int index) { return knownPrimes.drop(index - 1).head(); }
Source:
private void strictCheck(List<FileDescriptor> walFiles, FileWALPointer lowBound, FileWALPointer highBound) throws IgniteCheckedException { int idx = 0; if (lowBound.index() > Long.MIN_VALUE) { for (; idx < walFiles.size(); idx++) { FileDescriptor desc = walFiles.get(idx); assert desc != null; if (desc.idx() == lowBound.index()) break; } } if (idx == walFiles.size()) throw new IgniteCheckedException("Wal segments not in bounds."); long curWalSegmIdx = walFiles.get(idx).idx(); for (; idx < walFiles.size() && curWalSegmIdx <= highBound.index(); idx++, curWalSegmIdx++) { FileDescriptor desc = walFiles.get(idx); assert desc != null; if (curWalSegmIdx != desc.idx()) throw new IgniteCheckedException("Wal segment " + curWalSegmIdx + " not found."); } if (highBound.index() < Long.MAX_VALUE && curWalSegmIdx <= highBound.index()) throw new IgniteCheckedException("Wal segments not in bounds."); }

Target:
private static void strictCheck(List<FileDescriptor> walFiles, FileWALPointer lowBound, FileWALPointer highBound) throws IgniteCheckedException { int idx = 0; if (lowBound.index() > Long.MIN_VALUE) { for (; idx < walFiles.size(); idx++) { FileDescriptor desc = walFiles.get(idx); assert desc != null; if (desc.idx() == lowBound.index()) break; } } if (idx == walFiles.size()) throw new IgniteCheckedException("Wal segments not in bounds. loBoundIndex=" + lowBound.index() + ", indexes=" + printIndexes(walFiles)); long curWalSegmIdx = walFiles.get(idx).idx(); for (; idx < walFiles.size() && curWalSegmIdx <= highBound.index(); idx++, curWalSegmIdx++) { FileDescriptor desc = walFiles.get(idx); assert desc != null; if (curWalSegmIdx != desc.idx()) throw new IgniteCheckedException("Wal segment " + curWalSegmIdx + " not found in files " + printIndexes(walFiles)); } if (highBound.index() < Long.MAX_VALUE && curWalSegmIdx <= highBound.index()) throw new IgniteCheckedException("Wal segments not in bounds. hiBoundIndex=" + highBound.index() + ", indexes=" + printIndexes(walFiles)); }
Source:
public <T> Tuple.WindowedTuple<T> getWindowedValueWithTimestamp(Tuple<T> input, long timestamp) { if (windowOption == null && input instanceof Tuple.WindowedTuple) { initialWindowStates(((Tuple.WindowedTuple<T>)input).getWindows()); return (Tuple.WindowedTuple<T>)input; } else { return new Tuple.WindowedTuple<>(assignWindows(input, timestamp), timestamp, input.getValue()); } }

Target:
public <T> Tuple.WindowedTuple<T> getWindowedValueWithTimestamp(Tuple<T> input, long timestamp) { if (windowOption == null && input instanceof Tuple.WindowedTuple) { initializeWindowStates(((Tuple.WindowedTuple<T>)input).getWindows()); return (Tuple.WindowedTuple<T>)input; } else { return new Tuple.WindowedTuple<>(assignWindows(input, timestamp), timestamp, input.getValue()); } }
Source:
public InternetGatewayHandler(TagSetHandler tagSetHandler, InternetGatewayAttachmentSetHandler attachmentHandler) { this.tagSetHandler = tagSetHandler; this.attachmentSetHandler = attachmentHandler; }

Target:
InternetGatewayHandler(TagSetHandler tagSetHandler, InternetGatewayAttachmentSetHandler attachmentHandler) { this.tagSetHandler = tagSetHandler; this.attachmentSetHandler = attachmentHandler; }
Source:
protected void onHandleIntent(Intent intent) { final Bundle extras = intent.getExtras(); GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this); String messageType = gcm.getMessageType(intent); if (!extras.isEmpty()) { if (GoogleCloudMessaging. MESSAGE_TYPE_SEND_ERROR.equals(messageType)) { sendNotification("Send error: " + extras.toString()); } else if (GoogleCloudMessaging. MESSAGE_TYPE_DELETED.equals(messageType)) { sendNotification("Deleted messages on server: " + extras.toString()); } else if (GoogleCloudMessaging. MESSAGE_TYPE_MESSAGE.equals(messageType)) { for (int i=0; i<5; i++) { Log.i(TAG, "Working... " + (i + 1) + "/5 @ " + SystemClock.elapsedRealtime()); try { Thread.sleep(5000); } catch (InterruptedException e) { } } Log.i(TAG, "Completed work @ " + SystemClock.elapsedRealtime()); sendNotification("Received: " + extras.toString()); Log.i(TAG, "Received: " + extras.toString()); Handler h = new Handler(Looper.getMainLooper()); final Context c = this.getApplicationContext(); h.post(new Runnable() { public void run() { Toast.makeText(c, extras.toString(), Toast.LENGTH_SHORT).show(); } }); } } GcmBroadcastReceiver.completeWakefulIntent(intent); }

Target:
protected void onHandleIntent(Intent intent) { final Bundle extras = intent.getExtras(); GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this); String messageType = gcm.getMessageType(intent); if (!extras.isEmpty()) { if (GoogleCloudMessaging. MESSAGE_TYPE_SEND_ERROR.equals(messageType)) { sendNotification("Send error: " + extras.toString()); } else if (GoogleCloudMessaging. MESSAGE_TYPE_DELETED.equals(messageType)) { sendNotification("Deleted messages on server: " + extras.toString()); } else if (GoogleCloudMessaging. MESSAGE_TYPE_MESSAGE.equals(messageType)) { for (int i=0; i<5; i++) { Log.i(TAG, "Working... " + (i + 1) + "/5 @ " + SystemClock.elapsedRealtime()); try { Thread.sleep(5000); } catch (InterruptedException e) { } } Log.i(TAG, "Completed work @ " + SystemClock.elapsedRealtime()); sendNotification("Received: " + extras.toString()); } } GcmBroadcastReceiver.completeWakefulIntent(intent); }
Source:
private static void testSearchLoanTransactionsWithCustomFields(LoanTransaction loanTransaction) throws MambuApiException { String methodName = new Object() { }.getClass().getEnclosingMethod().getName(); System.out.println("\nIn " + methodName); if(loanTransaction == null){ System.out.println("WARN: " + methodName + " could not run transaction is null"); } JSONFilterConstraints filterConstraints = getJsonFilterConstraintsForParentTransactionGreaterThanOne(loanTransaction); LoansService loanService = MambuAPIFactory.getLoanService(); List<LoanTransaction> transactions = loanService.getLoanTransactionsWithFullDetails(filterConstraints, "0", "100"); for (LoanTransaction transaction : transactions) { List<CustomFieldValue> customFieldValues = transaction.getCustomFieldValues(); logCustomFieldValues(customFieldValues, "LoanAccount", transaction.getParentAccountKey()); } }

Target:
private static void testSearchLoanTransactionsWithCustomFields(LoanTransaction loanTransaction) throws MambuApiException { String methodName = new Object() { }.getClass().getEnclosingMethod().getName(); System.out.println("\nIn " + methodName); if(loanTransaction == null){ System.out.println("WARN: " + methodName + " could not run because transaction is null"); } JSONFilterConstraints filterConstraints = getJsonFilterConstraintsForParentTransactionGreaterThanOne(loanTransaction); LoansService loanService = MambuAPIFactory.getLoanService(); List<LoanTransaction> transactions = loanService.getLoanTransactionsWithFullDetails(filterConstraints, "0", "100"); for (LoanTransaction transaction : transactions) { List<CustomFieldValue> customFieldValues = transaction.getCustomFieldValues(); logCustomFieldValues(customFieldValues, "LoanAccount", transaction.getParentAccountKey()); } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_template_printer); String printStyle = this.getIntent().getExtras().getString(KEY_TEMPLATE_STYLE); if(printStyle == null) { if(CompoundIntentList.isIntentCompound(this.getIntent())) { printStyle = TEMPLATE_STYLE_ZPL; } else { printStyle = TEMPLATE_STYLE_HTML; } } if(printStyle == TEMPLATE_STYLE_ZPL) { if(savedInstanceState != null) { return; } } if(TEMPLATE_STYLE_ZPL.equals(printStyle)) { doZebraPrint(); return; } String path = getPathOrThrowError(getIntent().getExtras()); if(path == null) { return; } if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { showErrorDialog(Localization.get("print.not.supported")); return; } this.outputPath = CommCareApplication._().getTempFilePath() + ".html"; preparePrintDoc(path); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_template_printer); String printStyle = this.getIntent().getExtras().getString(KEY_TEMPLATE_STYLE); if(printStyle == null) { if(CompoundIntentList.isIntentCompound(this.getIntent())) { printStyle = TEMPLATE_STYLE_ZPL; } else { printStyle = TEMPLATE_STYLE_HTML; } } if(TEMPLATE_STYLE_ZPL.equals(printStyle)) { if(savedInstanceState != null) { return; } else { doZebraPrint(); return; } } String path = getPathOrThrowError(getIntent().getExtras()); if(path == null) { return; } if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { showErrorDialog(Localization.get("print.not.supported")); return; } this.outputPath = CommCareApplication._().getTempFilePath() + ".html"; preparePrintDoc(path); }
Source:
public void getAddress( final double latitude, final double longitude, final ReverseGeocoderCallback callback) { if (cache != null) { String cachedAddress = cache.get(new AbstractMap.SimpleImmutableEntry<>(latitude, longitude)); if (cachedAddress != null) { callback.onSuccess(cachedAddress); return; } } Context.getAsyncHttpClient().prepareGet(String.format(Locale.US, url, latitude, longitude)) .execute(new AsyncCompletionHandler() { @Override public Object onCompleted(Response response) throws Exception { try (JsonReader reader = Json.createReader(response.getResponseBodyAsStream())) { Address address = parseAddress(reader.readObject()); if (address != null) { String formattedAddress = addressFormat.format(address); if (cache != null) { cache.put(new AbstractMap.SimpleImmutableEntry<>(latitude, longitude), formattedAddress); } callback.onSuccess(formattedAddress); } else { callback.onFailure(new GeocoderException("Empty address")); } } return null; } @Override public void onThrowable(Throwable t) { callback.onFailure(t); } }); }

Target:
public String getAddress( final double latitude, final double longitude, final ReverseGeocoderCallback callback) { if (cache != null) { String cachedAddress = cache.get(new AbstractMap.SimpleImmutableEntry<>(latitude, longitude)); if (cachedAddress != null) { if (callback != null) { callback.onSuccess(cachedAddress); } return cachedAddress; } } if (callback != null) { Context.getAsyncHttpClient().prepareGet(String.format(url, latitude, longitude)) .execute(new AsyncCompletionHandler() { @Override public Object onCompleted(Response response) throws Exception { return handleResponse(latitude, longitude, response, callback); } @Override public void onThrowable(Throwable t) { callback.onFailure(t); } }); } else { try { Response response = Context.getAsyncHttpClient() .prepareGet(String.format(url, latitude, longitude)).execute().get(); return handleResponse(latitude, longitude, response, null); } catch (InterruptedException | ExecutionException | IOException error) { Log.warning("Geocoding failed", error); } } return null; }
Source:
public void checkCodeCommentFeature() { editor.goToPosition(17, 1); editor.typeTextIntoEditor(CONTROL.toString() + "/"); editor.waitTextIntoEditor(" editor.typeTextIntoEditor(Keys.END.toString()); }

Target:
public void checkCodeCommentFeature() { editor.goToPosition(17, 1); editor.launchCommentCodeFeature(); editor.waitTextIntoEditor(" editor.typeTextIntoEditor(Keys.END.toString()); }
Source:
static String generateTaskShape(Integer taskOrdering, int xAxe) { StringBuilder taskBuilder = new StringBuilder(); final int yAxe = 218; taskBuilder.append(" <bpmndi:BPMNShape id=\"Task_"); taskBuilder.append(taskOrdering); taskBuilder.append("_di\" bpmnElement=\"Task_"); taskBuilder.append(taskOrdering); taskBuilder.append(END_LINE); generateBounds(taskBuilder, xAxe, yAxe, 100, 80); taskBuilder.append(CLOSE_SHAPE); taskBuilder.append(" <bpmndi:BPMNEdge id=\"SequenceFlow_"); taskBuilder.append(taskOrdering + 1); taskBuilder.append("_di\" bpmnElement=\"SequenceFlow_"); taskBuilder.append(taskOrdering + 1); taskBuilder.append(END_LINE); generateWayPoint(taskBuilder, xAxe + 100, yAxe + 40); generateWayPoint(taskBuilder, xAxe + 150, yAxe + 40); taskBuilder.append(OPEN_LABEL); generateBounds(taskBuilder, xAxe + 125, yAxe + 29, 0, 12); taskBuilder.append(CLOSE_LABEL); taskBuilder.append(" </bpmndi:BPMNEdge>\n"); return taskBuilder.toString(); }

Target:
static String generateTaskShape(Integer taskOrdering, int xAxe) { StringBuilder taskBuilder = new StringBuilder(); final int diagramHeight = 218; taskBuilder.append(" <bpmndi:BPMNShape id=\"Task_"); taskBuilder.append(taskOrdering); taskBuilder.append("_di\" bpmnElement=\"Task_"); taskBuilder.append(taskOrdering); taskBuilder.append(END_LINE); generateBounds(taskBuilder, xAxe, diagramHeight, 100, 80); taskBuilder.append(CLOSE_SHAPE); taskBuilder.append(" <bpmndi:BPMNEdge id=\"SequenceFlow_"); taskBuilder.append(taskOrdering + 1); taskBuilder.append("_di\" bpmnElement=\"SequenceFlow_"); taskBuilder.append(taskOrdering + 1); taskBuilder.append(END_LINE); generateWayPoint(taskBuilder, xAxe + 100, diagramHeight + 40); generateWayPoint(taskBuilder, xAxe + 150, diagramHeight + 40); taskBuilder.append(OPEN_LABEL); generateBounds(taskBuilder, xAxe + 125, diagramHeight + 29, 0, 12); taskBuilder.append(CLOSE_LABEL); taskBuilder.append(" </bpmndi:BPMNEdge>\n"); return taskBuilder.toString(); }
Source:
public void testGetInstanceCountMultipleVerticles() throws Exception { AtomicInteger messageCount = new AtomicInteger(0); AtomicInteger totalReportedInstances = new AtomicInteger(0); vertx.eventBus().consumer("instanceCount", event -> { messageCount.incrementAndGet(); totalReportedInstances.addAndGet((int)event.body()); if(messageCount.intValue() == 3) { assertEquals(9, totalReportedInstances.get()); } }); vertx.deployVerticle(TestVerticle3.class.getCanonicalName(), new DeploymentOptions().setInstances(3), ar -> { assertTrue(ar.succeeded()); testComplete(); }); await(); Deployment deployment = ((VertxInternal) vertx).getDeployment(vertx.deploymentIDs().iterator().next()); vertx.undeploy(deployment.deploymentID()); }

Target:
public void testGetInstanceCountMultipleVerticles() throws Exception { AtomicInteger messageCount = new AtomicInteger(0); AtomicInteger totalReportedInstances = new AtomicInteger(0); vertx.eventBus().consumer("instanceCount", event -> { messageCount.incrementAndGet(); totalReportedInstances.addAndGet((int)event.body()); if(messageCount.intValue() == 3) { assertEquals(9, totalReportedInstances.get()); testComplete(); } }); vertx.deployVerticle(TestVerticle3.class.getCanonicalName(), new DeploymentOptions().setInstances(3), ar -> { assertTrue(ar.succeeded()); }); await(); Deployment deployment = ((VertxInternal) vertx).getDeployment(vertx.deploymentIDs().iterator().next()); vertx.undeploy(deployment.deploymentID()); }
Source:
public void testWithInvalidAuthorizationCode(String opHost, String redirectUrl, String userId, String userSecret) throws Exception{ final DevelopersApi client = Tester.api(); final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrl); final String state = CoreUtils.secureRandomString(); final String authorizationStr = Tester.getAuthorization(site); final String code = codeRequest(client, site.getOxdId(), userId, userSecret, state, CoreUtils.secureRandomString(), authorizationStr); final String invalidCode = code.concat("blah"); final GetTokensByCodeParams params = new GetTokensByCodeParams(); params.setOxdId(site.getOxdId()); params.setCode(invalidCode); params.setState(state); try { client.getTokensByCode(authorizationStr, params); } catch (ApiException ex) { assertEquals(400, ex.getCode()); } }

Target:
public void testWithInvalidAuthorizationCode(String opHost, String redirectUrl, String userId, String userSecret) throws Exception{ final DevelopersApi client = Tester.api(); final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrl); final String state = CoreUtils.secureRandomString(); final String authorizationStr = Tester.getAuthorization(site); final String code = codeRequest(client, site.getOxdId(), userId, userSecret, state, CoreUtils.secureRandomString(), authorizationStr); final String invalidCode = code.concat("blah"); final GetTokensByCodeParams params = new GetTokensByCodeParams(); params.setOxdId(site.getOxdId()); params.setCode(invalidCode); params.setState(state); try { client.getTokensByCode(authorizationStr, params); fail("Test should throw an exception"); } catch (ApiException ex) { assertEquals(400, ex.getCode()); } }
Source:
protected final void setReliabilityAttributes(boolean lengthCheck, boolean acknowledge, String ackHost, int ackPort, int ackTimeout) { this.mapper.setLengthCheck(lengthCheck); this.waitForAck = acknowledge; this.mapper.setAcknowledge(acknowledge); this.mapper.setAckAddress(ackHost + ":" + ackPort); this.ackHost = ackHost; this.ackPort = ackPort; if (ackTimeout > 0) { this.ackTimeout = ackTimeout; } this.acknowledge = acknowledge; if (!this.acknowledge) { Assert.hasLength(ackHost); Assert.state(StringUtils.isEmpty(socketExpression), "acknowledge cannot be used together with socketExpression"); } }

Target:
protected final void setReliabilityAttributes(boolean lengthCheck, boolean acknowledge, String ackHost, int ackPort, int ackTimeout) { this.mapper.setLengthCheck(lengthCheck); this.waitForAck = acknowledge; this.mapper.setAcknowledge(acknowledge); this.mapper.setAckAddress(ackHost + ":" + ackPort); this.ackHost = ackHost; this.ackPort = ackPort; if (ackTimeout > 0) { this.ackTimeout = ackTimeout; } this.acknowledge = acknowledge; if (this.acknowledge) { Assert.hasLength(ackHost); } }
Source:
public ArrayOfDoublesSketchBuildAggregator( final DimensionSelector keySelector, final List<BaseDoubleColumnValueSelector> valueSelectors, final int nominalEntries) { this.keySelector = keySelector; this.valueSelectors = valueSelectors; sketch = new ArrayOfDoublesUpdatableSketchBuilder().setNominalEntries(nominalEntries) .setNumberOfValues(valueSelectors.size()).build(); }

Target:
public ArrayOfDoublesSketchBuildAggregator( final DimensionSelector keySelector, final List<BaseDoubleColumnValueSelector> valueSelectors, final int nominalEntries ) { this.keySelector = keySelector; this.valueSelectors = valueSelectors.toArray(new BaseDoubleColumnValueSelector[0]); values = new double[valueSelectors.size()]; sketch = new ArrayOfDoublesUpdatableSketchBuilder().setNominalEntries(nominalEntries) .setNumberOfValues(valueSelectors.size()).build(); }
Source:
public void accept(Frame frame) { FrameType frameType = frame.getType(); switch (frameType) { case RESERVED: break; case SETUP: this.setup.increment(); break; case LEASE: this.lease.increment(); break; case KEEPALIVE: this.keepalive.increment(); break; case REQUEST_RESPONSE: this.requestResponse.increment(); break; case REQUEST_FNF: this.requestFireAndForget.increment(); break; case REQUEST_STREAM: this.requestStream.increment(); break; case REQUEST_CHANNEL: this.requestChannel.increment(); break; case REQUEST_N: this.requestN.increment(); break; case CANCEL: this.cancel.increment(); break; case PAYLOAD: break; case ERROR: this.error.increment(); break; case METADATA_PUSH: this.metadataPush.increment(); break; case RESUME: this.resume.increment(); break; case RESUME_OK: this.resumeOk.increment(); break; case NEXT: this.next.increment(); break; case COMPLETE: this.complete.increment(); break; case NEXT_COMPLETE: this.nextComplete.increment(); break; case EXT: this.extension.increment(); break; default: this.logger.warn("Skipping count of unknown frame type: {}", frameType); } }

Target:
public void accept(Frame frame) { FrameType frameType = frame.getType(); switch (frameType) { case SETUP: this.setup.increment(); break; case LEASE: this.lease.increment(); break; case KEEPALIVE: this.keepalive.increment(); break; case REQUEST_RESPONSE: this.requestResponse.increment(); break; case REQUEST_FNF: this.requestFireAndForget.increment(); break; case REQUEST_STREAM: this.requestStream.increment(); break; case REQUEST_CHANNEL: this.requestChannel.increment(); break; case REQUEST_N: this.requestN.increment(); break; case CANCEL: this.cancel.increment(); break; case PAYLOAD: this.payload.increment(); break; case ERROR: this.error.increment(); break; case METADATA_PUSH: this.metadataPush.increment(); break; case RESUME: this.resume.increment(); break; case RESUME_OK: this.resumeOk.increment(); break; case NEXT: this.next.increment(); break; case COMPLETE: this.complete.increment(); break; case NEXT_COMPLETE: this.nextComplete.increment(); break; case EXT: this.extension.increment(); break; default: this.logger.debug("Skipping count of unknown frame type: {}", frameType); this.unknown.increment(); } }
Source:
@Test public void configRoundTrip() throws Exception { JUnitResultArchiver a = new JUnitResultArchiver("TEST-*.xml"); a.setKeepLongStdio(true); a.setTestDataPublishers(Collections.singletonList((TestDataPublisher) new MockTestDataPublisher("testing"))); a.setHealthScaleFactor(0.77); a = j.configRoundtrip(a); assertEquals("TEST-*.xml", a.getTestResults()); assertTrue(a.isKeepLongStdio()); List<? extends TestDataPublisher> testDataPublishers = a.getTestDataPublishers(); assertEquals(1, testDataPublishers.size()); assertEquals(MockTestDataPublisher.class, testDataPublishers.get(0).getClass()); assertEquals("testing", ((MockTestDataPublisher) testDataPublishers.get(0)).getName()); assertEquals(0.77, a.getHealthScaleFactor(), 0.01); }

Target:
@Test public void configRoundTrip() throws Exception { JUnitResultArchiver a = new JUnitResultArchiver("TEST-*.xml"); a.setKeepLongStdio(true); a.setTestDataPublishers(Collections.<TestDataPublisher>singletonList(new MockTestDataPublisher("testing"))); a.setHealthScaleFactor(0.77); a = j.configRoundtrip(a); assertEquals("TEST-*.xml", a.getTestResults()); assertTrue(a.isKeepLongStdio()); List<? extends TestDataPublisher> testDataPublishers = a.getTestDataPublishers(); assertEquals(1, testDataPublishers.size()); assertEquals(MockTestDataPublisher.class, testDataPublishers.get(0).getClass()); assertEquals("testing", ((MockTestDataPublisher) testDataPublishers.get(0)).getName()); assertEquals(0.77, a.getHealthScaleFactor(), 0.01); }
Source:
private Optional<byte[]> buildIndex(final List<String> accountIds) { final RoaringBitmap roaringBitmap = new RoaringBitmap(); for(String accountId : accountIds) { roaringBitmap.add(Integer.valueOf(accountId)); } final ByteArrayOutputStream bos = new ByteArrayOutputStream(); final DataOutputStream dos = new DataOutputStream(bos); try { roaringBitmap.serialize(dos); } catch (IOException e) { return Optional.absent(); } return Optional.of(bos.toByteArray()); }

Target:
private Optional<byte[]> buildIndex(final List<String> accountIds) { final RoaringBitmap roaringBitmap = new RoaringBitmap(); for(String accountId : accountIds) { roaringBitmap.add(Integer.valueOf(accountId)); } final ByteArrayOutputStream bos = new ByteArrayOutputStream(); final DataOutputStream dos = new DataOutputStream(bos); try { roaringBitmap.serialize(dos); return Optional.of(bos.toByteArray()); } catch (IOException e) { LOGGER.error("Failed generating Bitmap index: {}", e.getMessage()); return Optional.absent(); } finally { try { bos.close(); dos.close(); } catch (IOException e) { LOGGER.error("{}", e.getMessage()); } } }
Source:
public void doBuildQuietPeriodInSeconds() throws Exception { final int projectQuietPeriodInSeconds = 10; final int projectQuietPeriodInMillis = projectQuietPeriodInSeconds * 1000; final int timeToExecuteProject = 5000; final FreeStyleProject project = j.createFreeStyleProject(); project.setQuietPeriod(projectQuietPeriodInSeconds); final JenkinsRule.WebClient webClient = j.createWebClient(); webClient.goTo(project.getUrl() + "build", ""); Assert.assertEquals(0, project.getBuilds().size()); Thread.sleep(projectQuietPeriodInMillis / 2); Assert.assertEquals(0, project.getBuilds().size()); Thread.sleep(projectQuietPeriodInMillis / 2 + timeToExecuteProject); Assert.assertEquals(1, project.getBuilds().size()); }

Target:
public void doBuildQuietPeriodInSeconds() throws Exception { final int projectQuietPeriodInSeconds = 50; final FreeStyleProject project = j.createFreeStyleProject(); project.setQuietPeriod(projectQuietPeriodInSeconds); final JenkinsRule.WebClient webClient = j.createWebClient(); webClient.goTo(project.getUrl() + "build", ""); long triggerTime = System.currentTimeMillis(); Queue.Item item = Jenkins.get().getQueue().getItem(1); Assert.assertTrue(item instanceof Queue.WaitingItem); Assert.assertTrue(item.task instanceof FreeStyleProject); Queue.WaitingItem waitingItem = (Queue.WaitingItem) item; Assert.assertTrue((waitingItem.timestamp.getTimeInMillis() - triggerTime) > 45000); Jenkins.get().getQueue().doCancelItem(1); }
Source:
public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) { List<Element> sourceElements = source.getAllElements(); sourceElements.stream() .filter(element -> SUPPORTED_ELEMENTS.contains(element.getName())) .filter(unsafeSubResource(msg.getRequestHeader().getHostName())) .forEach( element -> { Alert alert = new Alert( getPluginId(), Alert.RISK_MEDIUM, Alert.CONFIDENCE_HIGH, getName()); alert.setDetail( getString("desc"), msg.getRequestHeader().getURI().toString(), "", "", "", getString("soln"), getString("refs"), element.toString(), 287, -1, msg); parent.raiseAlert(id, alert); }); }

Target:
public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) { List<Element> sourceElements = source.getAllElements(); sourceElements.stream() .filter(element -> SupportedElements.contains(element.getName())) .filter(unsafeSubResource(msg.getRequestHeader().getHostName())) .forEach( element -> { Alert alert = new Alert( getPluginId(), Alert.RISK_MEDIUM, Alert.CONFIDENCE_HIGH, getName()); alert.setDetail( getString("desc"), msg.getRequestHeader().getURI().toString(), "", "", "", getString("soln"), getString("refs"), element.toString(), 16, 15, msg); parent.raiseAlert(id, alert); }); }
Source:
private int allocateResources(int workerNum) { int allocatedWorkerNum = 0; for (int i = 0; i < workerNum; ++i) { if (allocateResource(defaultSlotResourceProfile).isPresent()) { ++allocatedWorkerNum; } } return allocatedWorkerNum; }

Target:
private int allocateResources(int workerNum) { int allocatedWorkerNum = 0; for (int i = 0; i < workerNum; ++i) { if (allocateResource(defaultSlotResourceProfile).isPresent()) { ++allocatedWorkerNum; } else { break; } } return allocatedWorkerNum; }
Source:
private void send(String exchangeName, String routingKey, final Message<?> requestMessage, CorrelationData correlationData) { if (this.amqpTemplate instanceof RabbitTemplate) { MessageConverter converter = ((RabbitTemplate) this.amqpTemplate).getMessageConverter(); org.springframework.amqp.core.Message amqpMessage = MappingUtils.mapMessage(requestMessage, converter, getHeaderMapper(), this.getDefaultDeliveryMode()); ((RabbitTemplate) this.amqpTemplate).send(exchangeName, routingKey, amqpMessage, correlationData); } else { this.amqpTemplate.convertAndSend(exchangeName, routingKey, requestMessage.getPayload(), new MessagePostProcessor() { @Override public org.springframework.amqp.core.Message postProcessMessage( org.springframework.amqp.core.Message message) throws AmqpException { getHeaderMapper().fromHeadersToRequest(requestMessage.getHeaders(), message.getMessageProperties()); return message; } }); } }

Target:
private void send(String exchangeName, String routingKey, final Message<?> requestMessage, CorrelationData correlationData) { if (this.amqpTemplate instanceof RabbitTemplate) { MessageConverter converter = ((RabbitTemplate) this.amqpTemplate).getMessageConverter(); org.springframework.amqp.core.Message amqpMessage = MappingUtils.mapMessage(requestMessage, converter, getHeaderMapper(), getDefaultDeliveryMode()); ((RabbitTemplate) this.amqpTemplate).send(exchangeName, routingKey, amqpMessage, correlationData); } else { this.amqpTemplate.convertAndSend(exchangeName, routingKey, requestMessage.getPayload(), new MessagePostProcessor() { @Override public org.springframework.amqp.core.Message postProcessMessage( org.springframework.amqp.core.Message message) throws AmqpException { getHeaderMapper().fromHeadersToRequest(requestMessage.getHeaders(), message.getMessageProperties()); return message; } }); } }
Source:
public void validate () { LOG.info("Cacheing stops, trips, and routes..."); for (Stop stop : feed.stops) stopById.put(stop.stop_id, stop); for (ShapePoint shape : feed.shapePoints.getAllOrdered()) shapeById.put(shape.shape_id, shape); for (Trip trip: feed.trips) tripById.put(trip.trip_id, trip); for (Route route: feed.routes) routeById.put(route.route_id, route); LOG.info("Done."); List<StopTime> stopTimesForTrip = new ArrayList<>(); String previousTripId = null; for (StopTime stopTime : feed.stopTimes.getAllOrdered()) { if (stopTime.trip_id == null) continue; if (!stopTime.trip_id.equals(previousTripId) && !stopTimesForTrip.isEmpty()) { processTrip(stopTimesForTrip); stopTimesForTrip.clear(); } stopTimesForTrip.add(stopTime); previousTripId = stopTime.trip_id; } processTrip(stopTimesForTrip); }

Target:
public void validate () { LOG.info("Cacheing stops, trips, and routes..."); for (Stop stop : feed.stops) stopById.put(stop.stop_id, stop); for (Trip trip: feed.trips) tripById.put(trip.trip_id, trip); for (Route route: feed.routes) routeById.put(route.route_id, route); LOG.info("Done."); List<StopTime> stopTimesForTrip = new ArrayList<>(); String previousTripId = null; for (StopTime stopTime : feed.stopTimes.getAllOrdered()) { if (stopTime.trip_id == null) continue; if (!stopTime.trip_id.equals(previousTripId) && !stopTimesForTrip.isEmpty()) { processTrip(stopTimesForTrip); stopTimesForTrip.clear(); } stopTimesForTrip.add(stopTime); previousTripId = stopTime.trip_id; } processTrip(stopTimesForTrip); }
Source:
private void DiskInterface_SelectedItemChanged() { boolean isLunDisk = getDiskStorageType().getEntity() == DiskStorageType.LUN; DiskInterface diskInterface = getDiskInterface().getSelectedItem(); getIsSgIoUnfiltered().setIsAvailable(isLunDisk && DiskInterface.VirtIO_SCSI.equals(diskInterface)); getIsScsiPassthrough().setIsAvailable(isLunDisk && DiskInterface.VirtIO_SCSI.equals(diskInterface)); getIsUsingScsiReservation().setIsAvailable(isLunDisk && DiskInterface.VirtIO_SCSI.equals(diskInterface)); getIsReadOnly().setIsAvailable(!DiskInterface.IDE.equals(diskInterface) && !DiskInterface.SATA.equals(diskInterface)); updatePassDiscardAvailability(); updateScsiPassthroughChangeability(); updateScsiReservationChangeability(); updateReadOnlyChangeability(); updatePlugChangeability(); updatePassDiscardChangeability(); updateWipeAfterDeleteChangeability(); }

Target:
private void DiskInterface_SelectedItemChanged() { boolean isLunDisk = getDiskStorageType().getEntity() == DiskStorageType.LUN; DiskInterface diskInterface = getDiskInterface().getSelectedItem(); getIsSgIoUnfiltered().setIsAvailable(isLunDisk && DiskInterface.VirtIO_SCSI.equals(diskInterface)); getIsScsiPassthrough().setIsAvailable(isLunDisk && DiskInterface.VirtIO_SCSI.equals(diskInterface)); getIsUsingScsiReservation().setIsAvailable(isLunDisk && DiskInterface.VirtIO_SCSI.equals(diskInterface)); getIsReadOnly().setIsAvailable(diskInterface != DiskInterface.IDE && diskInterface != DiskInterface.SATA); updatePassDiscardAvailability(); updateScsiPassthroughChangeability(); updateScsiReservationChangeability(); updateReadOnlyChangeability(); updatePlugChangeability(); updatePassDiscardChangeability(); updateWipeAfterDeleteChangeability(); }
Source:
public final void onFailure(Exchange exchange) { boolean connected = AccessController.doPrivileged((PrivilegedAction<Boolean>) asyncFileEntry::checkNetwork); if (!connected) { LOGGER.debug( "a network error occurred, The file failed to process", asyncFileEntry.getName()); } else if (exchange.getException() != null) { LOGGER.debug( "Exchange failed synchronization on exception: {}", exchange.getExchangeId(), exchange.getException()); } callback.accept(asyncFileEntry, false); }

Target:
public final void onFailure(Exchange exchange) { boolean connected = AccessController.doPrivileged((PrivilegedAction<Boolean>) asyncFileEntry::checkNetwork); if (!connected) { LOGGER.debug( "a network error occurred, The file failed to process", asyncFileEntry.getName()); } else if (exchange != null && exchange.getException() != null) { LOGGER.debug( "Exchange failed synchronization on exception: {}", exchange.getExchangeId(), exchange.getException()); } callback.accept(asyncFileEntry, false); }
Source:
protected E doBackward(Tuple<I> tuple) { final Message unpacked = unpack(tuple.getState() .getState()); final TypeUrl entityStateType = repository.getEntityStateType(); final S state = (S) FieldMasks.applyMask(fieldMask, unpacked, entityStateType); final E entity = repository.create(tuple.getId()); final EntityRecord record = tuple.getState(); if (entity != null) { if (entity instanceof AbstractVersionableEntity) { AbstractVersionableEntity versionable = (AbstractVersionableEntity) entity; versionable.setState(state, record.getVersion()); versionable.setVisibility(record.getVisibility()); } else { entity.injectState(state); } } return entity; }

Target:
protected E doBackward(Tuple<I> tuple) { final Message unpacked = unpack(tuple.getState() .getState()); final TypeUrl entityStateType = repository.getEntityStateType(); final S state = (S) FieldMasks.applyMask(fieldMask, unpacked, entityStateType); final E entity = repository.create(tuple.getId()); final EntityRecord record = tuple.getState(); if (entity != null) { if (entity instanceof AbstractVersionableEntity) { final AbstractVersionableEntity versionable = (AbstractVersionableEntity) entity; versionable.setState(state, record.getVersion()); versionable.setVisibility(record.getVisibility()); } else { entity.injectState(state); } } return entity; }
Source:
public Boolean getisValueTypeCorrect() { if (this.xmpNode.getChildren().size() != 3) { return Boolean.FALSE; } VeraPDFXMPNode description = null; VeraPDFXMPNode name = null; VeraPDFXMPNode valueType = null; for (VeraPDFXMPNode child : this.xmpNode.getChildren()) { if (XMPSchemaRegistryImpl.NS_PDFA_FIELD.equals(child.getNamespaceURI())) { switch (child.getName()) { case "description": description = child; break; case "name": name = child; break; case "valueType": valueType = child; break; } } } return Boolean.valueOf(description != null && name != null && valueType != null); }

Target:
public Boolean getisValueTypeCorrect() { boolean isValid = true; boolean isDescriptionPresent = false; boolean isNamePresent = false; boolean isValueTypePresent = false; for (VeraPDFXMPNode child : this.xmpNode.getChildren()) { if (XMPSchemaRegistryImpl.NS_PDFA_FIELD.equals(child.getNamespaceURI())) { switch (child.getName()) { case "description": if (isDescriptionPresent) { isValid = false; } else { isDescriptionPresent = true; } break; case "name": if (isNamePresent) { isValid = false; } else { isNamePresent = true; } break; case "valueType": if (isValueTypePresent) { isValid = false; } else { isValueTypePresent = true; } break; default: isValid = false; } } else { isValid = false; } } return Boolean.valueOf(isValid); }
Source:
protected TmfXYChartViewer createChartViewer(Composite parent) { TmfXYChartSettings settings = new TmfXYChartSettings(Messages.ScriptedXYTreeViewer_DefaultViewerTitle, Messages.ScriptedXYTreeViewer_DefaultXAxis, Messages.ScriptedXYTreeViewer_DefaultYAxis, 1); String name = getSecondaryIdName(); return new ScriptedXYViewer(parent, settings, name); }

Target:
protected TmfXYChartViewer createChartViewer(Composite parent) { TmfXYChartSettings settings = new TmfXYChartSettings(Messages.ScriptedXYTreeViewer_DefaultViewerTitle, Messages.ScriptedXYTreeViewer_DefaultXAxis, Messages.ScriptedXYTreeViewer_DefaultYAxis, 1); return new TmfFilteredXYChartViewer(parent, settings, getViewSite().getSecondaryId().replace(ScriptedXYView.COLON, ":")); }
Source:
public List<OntClass> listClasses() { return ontology.listClasses().toList(); }

Target:
public Set<OntClass> listClasses() { return ontology.listClasses().toSet(); }
Source:
public int hashCode() { int result = leaderSessionID.hashCode(); result = 31 * result + Objects.hashCode(leaderAddress); return result; }

Target:
public int hashCode() { int result = Objects.hashCode(leaderSessionID); result = 31 * result + Objects.hashCode(leaderAddress); return result; }
Source:
public synchronized INavigatorContentService findService(String aViewerId) { if(aViewerId == null || aViewerId.length() == 0) { return null; } INavigatorContentService contentService; for (Iterator<WeakReference<INavigatorContentService>> iter = registeredContentServices.iterator(); iter.hasNext();) { WeakReference ref = iter.next(); if(ref.get() == null) { iter.remove(); } else { contentService = (INavigatorContentService)ref.get(); if (contentService != null && aViewerId.equals(contentService.getViewerId())) { return contentService; } } } return null; }

Target:
public synchronized INavigatorContentService findService(String aViewerId) { if(aViewerId == null || aViewerId.length() == 0) { return null; } INavigatorContentService contentService; for (Iterator<WeakReference<INavigatorContentService>> iter = registeredContentServices.iterator(); iter.hasNext();) { WeakReference ref = iter.next(); contentService = (INavigatorContentService) ref.get(); if (contentService == null) { iter.remove(); } else if (aViewerId.equals(contentService.getViewerId())) { return contentService; } } return null; }
Source:
public Syndication createSyndication(ArticleVersionIdentifier versionId, String target) { ArticleVersion articleVersion = articleCrudService.getArticleVersion(versionId); Syndication syndication = new Syndication(articleVersion, target); syndication.setStatus(Syndication.STATUS_PENDING); syndication.setSubmissionCount(0); hibernateTemplate.save(syndication); return syndication; }

Target:
public Syndication createSyndication(ArticleVersionIdentifier versionId, String target) { ArticleVersion articleVersion = articleCrudService.getArticleVersion(versionId); Syndication syndication = new Syndication(articleVersion, target); syndication.setStatus(SyndicationStatuses.PENDING.name()); syndication.setSubmissionCount(0); hibernateTemplate.save(syndication); return syndication; }
Source:
private void initializeActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowCustomEnabled(true); actionBar.setCustomView(R.layout.actionbar_custom); actionBar.setDisplayHomeAsUpEnabled(true); }

Target:
private void initializeActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); }
Source:
public void refreshBuilds(final RefreshRequest request, final GetBuildsRequest buildRequest, final IOperationMonitor monitor) throws CoreException { final List<IBuild> result = BuildRunner.run(new BuildRunnableWithResult<List<IBuild>>() { @Override public List<IBuild> run() throws CoreException { List<IBuild> builds = server.getBehaviour().getBuilds(buildRequest, monitor); return builds; } }); if (result == null) { return; } final BuildServer original = server.getOriginal(); original.getLoader().getRealm().syncExec(new Runnable() { public void run() { Date refreshDate = new Date(); List<IBuildPlan> plans = new ArrayList<>(); plans.addAll(request.getModel().getPlans()); for (IBuildPlan modelPlan : plans) { if (modelPlan.getServer() == original && modelPlan.getId().equals(buildRequest.getPlan().getId())) { updateLastBuild(request, modelPlan, result.get(0), refreshDate); } } } }); }

Target:
public void refreshBuilds(final RefreshRequest request, final GetBuildsRequest buildRequest, final IOperationMonitor monitor) throws CoreException { final List<IBuild> result = BuildRunner.run(new BuildRunnableWithResult<List<IBuild>>() { @Override public List<IBuild> run() throws CoreException { return server.getBehaviour().getBuilds(buildRequest, monitor); } }); if (result == null) { return; } final BuildServer original = server.getOriginal(); original.getLoader().getRealm().syncExec(new Runnable() { public void run() { Date refreshDate = new Date(); for (IBuildPlan modelPlan : request.getModel().getPlans()) { if (modelPlan.getServer() == original && modelPlan.getId().equals(buildRequest.getPlan().getId())) { updateLastBuild(request, modelPlan, result.get(0), refreshDate); } } } }); }