auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void createServerMessenger(final ServerConnectionProps props) { try { this.serverMessenger = new ServerMessenger(props.getName(), props.getPort(), objectStreamFactory); serverMessenger.addConnectionChangeListener(this); messengers = new Messengers(serverMessenger); messengers.registerRemote(serverStartupRemote, SERVER_REMOTE_NAME); GameHostingResponse gameHostingResponse = null; if (System.getProperty(LOBBY_URI) != null) { final URI lobbyUri = URI.create(System.getProperty(LOBBY_URI)); gameHostingResponse = GameHostingClient.newClient(lobbyUri).sendGameHostingRequest(); lobbyWatcherThread = new LobbyWatcherThread( gameSelectorModel, serverMessenger, ui == null ? new WatcherThreadMessaging.HeadlessWatcherThreadMessaging() : new WatcherThreadMessaging.HeadedWatcherThreadMessaging(ui)); lobbyWatcherThread.createLobbyWatcher(lobbyUri, gameHostingResponse); } chatController = new ChatController(CHAT_NAME, messengers, node -> false); if (ui == null) { chatModel = new HeadlessChat(new Chat(new MessengersChatTransmitter(CHAT_NAME, messengers))); } else { final var chatPanel = ChatPanel.newChatPanel(messengers, CHAT_NAME, ChatSoundProfile.GAME); chatModelCancel = () -> chatPanel.setChat(null); chatModel = chatPanel; } serverMessenger.setAcceptNewConnections(true); gameDataChanged(); serverSetupModel.onServerMessengerCreated(this, gameHostingResponse); } catch (final IOException ioe) { log.log(Level.SEVERE, "Unable to create server socket", ioe); cancel(); } }

Target:
private void createServerMessenger(final ServerConnectionProps props) { try { this.serverMessenger = new ServerMessenger(props.getName(), props.getPort(), objectStreamFactory); serverMessenger.addConnectionChangeListener(this); messengers = new Messengers(serverMessenger); messengers.registerRemote(serverStartupRemote, SERVER_REMOTE_NAME); @Nullable final GameHostingResponse gameHostingResponse; if (System.getProperty(LOBBY_URI) != null) { final URI lobbyUri = URI.create(System.getProperty(LOBBY_URI)); gameHostingResponse = GameHostingClient.newClient(lobbyUri).sendGameHostingRequest(); lobbyWatcherThread = new LobbyWatcherThread( gameSelectorModel, serverMessenger, ui == null ? new WatcherThreadMessaging.HeadlessWatcherThreadMessaging() : new WatcherThreadMessaging.HeadedWatcherThreadMessaging(ui)); lobbyWatcherThread.createLobbyWatcher(lobbyUri, gameHostingResponse); } else { gameHostingResponse = null; } chatController = new ChatController(CHAT_NAME, messengers, node -> false); if (ui == null) { chatModel = new HeadlessChat(new Chat(new MessengersChatTransmitter(CHAT_NAME, messengers))); } else { final var chatPanel = ChatPanel.newChatPanel(messengers, CHAT_NAME, ChatSoundProfile.GAME); chatModelCancel = () -> chatPanel.setChat(null); chatModel = chatPanel; } serverMessenger.setAcceptNewConnections(true); gameDataChanged(); serverSetupModel.onServerMessengerCreated(this, gameHostingResponse); } catch (final IOException ioe) { log.log(Level.SEVERE, "Unable to create server socket", ioe); cancel(); } }
Source:
protected boolean approveMoveRequest(IEditCommandRequest request) { MoveRequest moveRequest = (MoveRequest) request; EObject targetContainer = moveRequest.getTargetContainer(); if (targetContainer instanceof Element) { if (!UMLRTProfileUtils.isUMLRTProfileApplied((Element) targetContainer)) { return super.approveRequest(request); } } Map<?, ?> elementsToMove = moveRequest.getElementsToMove(); for (Object elementToMove : elementsToMove.keySet()) { if (elementToMove instanceof Port) { return false; } } return super.approveRequest(request); }

Target:
protected boolean approveMoveRequest(IEditCommandRequest request) { MoveRequest moveRequest = (MoveRequest) request; EObject targetContainer = moveRequest.getTargetContainer(); if (targetContainer instanceof Element) { if (!UMLRTProfileUtils.isUMLRTProfileApplied((Element) targetContainer)) { return super.approveRequest(request); } } Map<?, ?> elementsToMove = moveRequest.getElementsToMove(); for (Object elementToMove : elementsToMove.keySet()) { if (elementToMove instanceof Port && ((Port) elementToMove).eContainer() != null) { return false; } } return super.approveRequest(request); }
Source:
public void execute(final Object message) throws Exception { initialSessionRequest = (SmsSessionRequest) message; initialSessionSid = Sid.generate(Sid.Type.SMS_MESSAGE); final SmsMessage.Builder builder = SmsMessage.builder(); builder.setSid(initialSessionSid); builder.setAccountSid(accountId); builder.setApiVersion(version); builder.setRecipient(initialSessionRequest.to()); builder.setSender(initialSessionRequest.from()); builder.setBody(initialSessionRequest.body()); builder.setDirection(Direction.INBOUND); builder.setStatus(Status.RECEIVED); builder.setPrice(new BigDecimal("0.00")); builder.setPriceUnit(Currency.getInstance("USD")); final StringBuilder buffer = new StringBuilder(); buffer.append("/").append(version).append("/Accounts/"); buffer.append(accountId.toString()).append("/SMS/Messages/"); buffer.append(initialSessionSid.toString()); final URI uri = URI.create(buffer.toString()); builder.setUri(uri); SmsVerb.populateAttributes(verb, builder); final SmsMessage record = builder.build(); final SmsMessagesDao messages = storage.getSmsMessagesDao(); messages.addSmsMessage(record); getContext().system().eventStream().publish(record); service.tell(new DestroySmsSession(initialSession), source); initialSession = null; final List<NameValuePair> parameters = parameters(); request = new HttpRequestDescriptor(url, method, parameters); downloader.tell(request, source); }

Target:
public void execute(final Object message) throws Exception { initialSessionRequest = (SmsSessionRequest) message; initialSessionSid = Sid.generate(Sid.Type.SMS_MESSAGE); final SmsMessage.Builder builder = SmsMessage.builder(); builder.setSid(initialSessionSid); builder.setAccountSid(accountId); builder.setApiVersion(version); builder.setRecipient(initialSessionRequest.to()); builder.setSender(initialSessionRequest.from()); builder.setBody(initialSessionRequest.body()); builder.setDirection(Direction.INBOUND); builder.setStatus(Status.RECEIVED); builder.setPrice(new BigDecimal("0.00")); builder.setPriceUnit(Currency.getInstance("USD")); final StringBuilder buffer = new StringBuilder(); buffer.append("/").append(version).append("/Accounts/"); buffer.append(accountId.toString()).append("/SMS/Messages/"); buffer.append(initialSessionSid.toString()); final URI uri = URI.create(buffer.toString()); builder.setUri(uri); final SmsMessage record = builder.build(); final SmsMessagesDao messages = storage.getSmsMessagesDao(); messages.addSmsMessage(record); getContext().system().eventStream().publish(record); service.tell(new DestroySmsSession(initialSession), source); initialSession = null; final List<NameValuePair> parameters = parameters(); request = new HttpRequestDescriptor(url, method, parameters); downloader.tell(request, source); }
Source:
public void handleSpecialDaysResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handleSpecialDaysresponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception); result = ResponseMessageResultType.NOT_OK; } this.webServiceResponseMessageSender.send(ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }

Target:
public void handleSpecialDaysResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handleSpecialDaysresponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception); result = ResponseMessageResultType.NOT_OK; } ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send(responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
public CacheableLocator createLocator(AnnotatedElement annotatedElement) { TimeOutDuration customDuration; if (annotatedElement.isAnnotationPresent(WithTimeout.class)){ WithTimeout withTimeout = annotatedElement.getAnnotation(WithTimeout.class); customDuration = new TimeOutDuration(withTimeout.time(), withTimeout.unit()); } else customDuration = timeOutDuration; builder.setAnnotated(annotatedElement); By by = builder.buildBy(); if (by != null) return new AppiumElementLocator(searchContext, by, builder.isLookupCached(), customDuration, originalWebDriver); return null; }

Target:
public CacheableLocator createLocator(AnnotatedElement annotatedElement) { TimeOutDuration customDuration; if (annotatedElement.isAnnotationPresent(WithTimeout.class)) { WithTimeout withTimeout = annotatedElement.getAnnotation(WithTimeout.class); customDuration = new TimeOutDuration(withTimeout.time(), withTimeout.unit()); } else { customDuration = timeOutDuration; } builder.setAnnotated(annotatedElement); By by = builder.buildBy(); if (by != null) return new AppiumElementLocator(searchContext, by, builder.isLookupCached(), customDuration, originalWebDriver); return null; }
Source:
public static void openURL(String url) { try { if (!GraphicsEnvironment.isHeadless()) { log.warn("graphical browser requested but currently no display"); } Class<?> d = Class.forName("java.awt.Desktop"); d.getDeclaredMethod("browse", new Class[] { java.net.URI.class }).invoke(d.getDeclaredMethod("getDesktop").invoke(null), new Object[] { java.net.URI.create(url) }); } catch (Exception ignore) { String osName = System.getProperty("os.name"); try { if (osName.startsWith("Mac OS")) { Class.forName("com.apple.eio.FileManager").getDeclaredMethod("openURL", new Class[] { String.class }).invoke(null, new Object[] { url }); } else if (osName.startsWith("Windows")) Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); else { String browser = null; for (String b : browsers) if (browser == null && Runtime.getRuntime().exec(new String[] { "which", b }).getInputStream().read() != -1) Runtime.getRuntime().exec(new String[] { browser = b, url }); if (browser == null) throw new Exception(Arrays.toString(browsers)); } } catch (Exception e) { log.warn("attempted to start browser - but desktop or browser not supported"); } } }

Target:
public static void openURL(String url) { try { if (GraphicsEnvironment.isHeadless()) { log.warn("graphical browser requested but currently no display"); } Class<?> d = Class.forName("java.awt.Desktop"); d.getDeclaredMethod("browse", new Class[] { java.net.URI.class }).invoke(d.getDeclaredMethod("getDesktop").invoke(null), new Object[] { java.net.URI.create(url) }); } catch (Exception ignore) { String osName = System.getProperty("os.name"); try { if (osName.startsWith("Mac OS")) { Class.forName("com.apple.eio.FileManager").getDeclaredMethod("openURL", new Class[] { String.class }).invoke(null, new Object[] { url }); } else if (osName.startsWith("Windows")) Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); else { String browser = null; for (String b : browsers) if (browser == null && Runtime.getRuntime().exec(new String[] { "which", b }).getInputStream().read() != -1) Runtime.getRuntime().exec(new String[] { browser = b, url }); if (browser == null) throw new Exception(Arrays.toString(browsers)); } } catch (Exception e) { log.warn("attempted to start browser - but desktop or browser not supported"); } } }
Source:
public void put(Slice key, long timeBucket, Slice value) { BucketedValue bucketedValue = flash.get(key); if (bucketedValue == null) { bucketedValue = new BucketedValue(); flash.put(key, bucketedValue); sizeInBytes.getAndAdd(key.length); sizeInBytes.getAndAdd(Long.SIZE); } if (timeBucket >= bucketedValue.getTimeBucket()) { int inc = null == bucketedValue.getValue() ? value.length : value.length - bucketedValue.getValue().length; sizeInBytes.getAndAdd(inc); bucketedValue.setTimeBucket(timeBucket); bucketedValue.setValue(value); } }

Target:
public void put(Slice key, long timeBucket, Slice value) { BucketedValue bucketedValue = flash.get(key); if (bucketedValue == null) { bucketedValue = new BucketedValue(); flash.put(key, bucketedValue); sizeInBytes.getAndAdd(key.length); sizeInBytes.getAndAdd(Long.SIZE); } if (timeBucket >= bucketedValue.getTimeBucket()) { int inc = null == bucketedValue.getValue() ? value.length : value.length - bucketedValue.getValue().length; sizeInBytes.getAndAdd(inc); bucketedValue.setTimeBucket(timeBucket); bucketedValue.setValue(value); } else { LOG.warn("ignoring {}; existing {}", key, value, timeBucket, bucketedValue.getValue(), bucketedValue.getTimeBucket()); } }
Source:
public void testExecutionAttemptIdInTwoIdenticalJobsIsNotSame() throws Exception { JobVertex v1 = new JobVertex("vertex1"); JobVertex v2 = new JobVertex("vertex2"); JobVertex v3 = new JobVertex("vertex3"); v1.setParallelism(5); v2.setParallelism(7); v3.setParallelism(2); v1.setInvokableClass(AbstractInvokable.class); v2.setInvokableClass(AbstractInvokable.class); v3.setInvokableClass(AbstractInvokable.class); List<JobVertex> ordered = new ArrayList<>(Arrays.asList(v1, v2, v3)); ExecutionGraph eg1 = createExecutionGraph(); ExecutionGraph eg2 = createExecutionGraph(); try { eg1.attachJobGraph(ordered); eg2.attachJobGraph(ordered); } catch (JobException e) { e.printStackTrace(); fail("Job failed with exception: " + e.getMessage()); } assertThat(Sets.intersection(eg1.getRegisteredExecutions().keySet(), eg2.getRegisteredExecutions().keySet()), is(empty())); }

Target:
public void testExecutionAttemptIdInTwoIdenticalJobsIsNotSame() throws Exception { JobVertex v1 = new JobVertex("vertex1"); JobVertex v2 = new JobVertex("vertex2"); JobVertex v3 = new JobVertex("vertex3"); v1.setParallelism(5); v2.setParallelism(7); v3.setParallelism(2); v1.setInvokableClass(AbstractInvokable.class); v2.setInvokableClass(AbstractInvokable.class); v3.setInvokableClass(AbstractInvokable.class); List<JobVertex> ordered = new ArrayList<>(Arrays.asList(v1, v2, v3)); ExecutionGraph eg1 = createExecutionGraph(); ExecutionGraph eg2 = createExecutionGraph(); eg1.attachJobGraph(ordered); eg2.attachJobGraph(ordered); assertThat(Sets.intersection(eg1.getRegisteredExecutions().keySet(), eg2.getRegisteredExecutions().keySet()), is(empty())); }
Source:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RequestCodes.JETPACK_LOGIN && resultCode == RESULT_OK) { trackResult(); } finishAndGoBackToSource(); }

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RequestCodes.JETPACK_LOGIN) { if (resultCode == RESULT_OK) { trackResult(); } else { finishAndGoBackToSource(); } } }
Source:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mContext = getActivity().getApplicationContext(); mDataBaseAdapter = new DataBaseAdapter(getActivity()); mDataBaseAdapter.createDatabase(); mDataBaseAdapter.open(); mItemAdapter = new ATMItemListAdapter(mContext, ((MainActivity) getActivity()).getLocationTracker()); setListAdapter(mItemAdapter); getLoaderManager().initLoader(0, null, this); getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); getListView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { ((ListView) parent).setItemChecked(position, ((ListView) parent).isItemChecked(position)); return false; } }); getListView().setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() { private int nr = 0; @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { return true; } @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { return false; } @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { return false; } @Override public void onDestroyActionMode(ActionMode mode) { nr = 0; } @Override public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) { if (checked) { nr++; } else { nr--; } mode.setTitle(nr + " rows selected!"); } }); }

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mContext = getActivity().getApplicationContext(); mDataBaseAdapter = new DataBaseAdapter(getActivity()); mDataBaseAdapter.createDatabase(); mDataBaseAdapter.open(); mItemAdapter = new ATMItemListAdapter(mContext, ((MainActivity) getActivity()).getLocationTracker()); setListAdapter(mItemAdapter); getLoaderManager().initLoader(0, null, this); getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); getListView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { ((ListView) parent).setItemChecked(position, ((ListView) parent).isItemChecked(position)); return false; } }); getListView().setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() { private int nr = 0; @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { return true; } @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { return false; } @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { return false; } @Override public void onDestroyActionMode(ActionMode mode) { nr = 0; } @Override public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) { if (checked) { nr++; } else { nr--; } mode.setTitle(nr + " rows selected!"); } }); }
Source:
public void writeTo(OutputStream out) throws IOException { for (MimePart part : mimeParts) { part.writeTo(out); } out.write(footer); }

Target:
@Override public void writeTo(OutputStream out) throws IOException { for (MimePart part : mimeParts) { part.writeTo(out); } out.write(footer); }
Source:
public FongoDBCollection(FongoDB db, String name) { super(db, name); this.fongoDb = db; this.nonIdCollection = name.startsWith("system"); this.expressionParser = new ExpressionParser(); this.updateEngine = new UpdateEngine(); this.objectComparator = expressionParser.buildObjectComparator(true); this._idIndex = new Index("_id", new BasicDBObject("_id", 1), true); this.indexes.put(Collections.singleton("_id"), _idIndex); }

Target:
public FongoDBCollection(FongoDB db, String name) { super(db, name); this.fongoDb = db; this.nonIdCollection = name.startsWith("system"); this.expressionParser = new ExpressionParser(); this.updateEngine = new UpdateEngine(); this.objectComparator = expressionParser.buildObjectComparator(true); this._idIndex = new Index("_id", new BasicDBObject("_id", 1), true, true); this.indexes.add(_idIndex); }
Source:
public void testExpandedImageUsingValidUrl() throws ImageStore.CantGetImageException{ final Intent intent = new Intent(); intent.putExtra("mp_message", "MESSAGE"); intent.putExtra("mp_imgurl", VALID_URL); Bitmap fakeBitmap = getFakeBitmap(); when(mpPushSpy.getBitmapFromUrl(VALID_URL)).thenReturn(fakeBitmap); mpPushSpy.createNotification(intent); verify(mpPushSpy).getBitmapFromUrl(VALID_URL); verify(builderSpy).setStyle(new Notification.BigPictureStyle().bigPicture(fakeBitmap)); }

Target:
public void testExpandedImageUsingValidUrl() { final Intent intent = new Intent(); intent.putExtra("mp_message", "MESSAGE"); intent.putExtra("mp_img", VALID_IMAGE_URL); Bitmap fakeBitmap = getFakeBitmap(); when(mpPushSpy.getBitmapFromUrl(VALID_IMAGE_URL)).thenReturn(fakeBitmap); mpPushSpy.createNotification(intent); verify(mpPushSpy).getBitmapFromUrl(VALID_IMAGE_URL); verify(mpPushSpy).setBigPictureStyle(fakeBitmap); }
Source:
private void cloneTemplate() { Snapshot snapshot = getSelectedItem(); if (snapshot == null) { return; } if (getWindow() != null) { return; } VM selectedVm = getEntity(); final UnitVmModel model = new UnitVmModel(new NewTemplateVmModelBehavior(), this); setWindow(model); model.startProgress(null); model.getVmType().setSelectedItem(selectedVm.getVmType()); model.getIsHighlyAvailable().setEntity(selectedVm.getStaticData().isAutoStartup()); AsyncDataProvider.getInstance().getVmConfigurationBySnapshot(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { NewTemplateVmModelBehavior behavior = (NewTemplateVmModelBehavior) model.getBehavior(); VM vm = (VM) returnValue; behavior.setVm(vm); model.setTitle(ConstantsManager.getInstance().getConstants().newTemplateTitle()); model.setHelpTag(HelpTag.new_template); model.setHashName("new_template"); model.setIsNew(true); model.setCustomPropertiesKeysList(AsyncDataProvider.getInstance().getCustomPropertiesList()); model.initialize(VmSnapshotListModel.this.getSystemTreeSelectedItem()); model.getCommands().add( new UICommand("OnNewTemplate", VmSnapshotListModel.this) .setTitle(ConstantsManager.getInstance().getConstants().ok()) .setIsDefault(true)); model.getCommands().add(UICommand.createCancelUiCommand("Cancel", VmSnapshotListModel.this)); model.stopProgress(); } }), snapshot.getId()); }

Target:
private void cloneTemplate() { Snapshot snapshot = getSelectedItem(); if (snapshot == null) { return; } if (getWindow() != null) { return; } VM selectedVm = getEntity(); final UnitVmModel model = new UnitVmModel(new NewTemplateVmModelBehavior(), this); setWindow(model); model.startProgress(null); model.getVmType().setSelectedItem(selectedVm.getVmType()); model.getIsHighlyAvailable().setEntity(selectedVm.getStaticData().isAutoStartup()); AsyncDataProvider.getInstance().getVmConfigurationBySnapshot(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { NewTemplateVmModelBehavior behavior = (NewTemplateVmModelBehavior) model.getBehavior(); VM vm = (VM) returnValue; behavior.setVm(vm); model.setTitle(ConstantsManager.getInstance().getConstants().newTemplateTitle()); model.setHelpTag(HelpTag.clone_template_from_snapshot); model.setHashName("clone_template_from_snapshot"); model.setIsNew(true); model.setCustomPropertiesKeysList(AsyncDataProvider.getInstance().getCustomPropertiesList()); model.initialize(VmSnapshotListModel.this.getSystemTreeSelectedItem()); model.getCommands().add( new UICommand("OnNewTemplate", VmSnapshotListModel.this) .setTitle(ConstantsManager.getInstance().getConstants().ok()) .setIsDefault(true)); model.getCommands().add(UICommand.createCancelUiCommand("Cancel", VmSnapshotListModel.this)); model.stopProgress(); } }), snapshot.getId()); }
Source:
private boolean mediateMessage(SequenceMediator sequenceMediator, MessageContext synCtx) { try { return sequenceMediator.mediate(synCtx); } catch (SynapseException syne) { if (!synCtx.getFaultStack().isEmpty()) { log.warn("Executing fault handler due to exception encountered" + syne); ((FaultHandler) synCtx.getFaultStack().pop()).handleFault(synCtx, syne); } else { log.warn("Exception encountered but no fault handler found - message dropped"); } } catch (Exception e) { String msg = "Unexpected error occurred executing the Target"; log.error(msg, e); if (synCtx.getServiceLog() != null) { synCtx.getServiceLog().error(msg, e); } if (!synCtx.getFaultStack().isEmpty()) { log.warn("Executing fault handler due to exception encountered"); ((FaultHandler) synCtx.getFaultStack().pop()).handleFault(synCtx, e); } else { log.warn("Exception encountered but no fault handler found - message dropped"); } } return true; }

Target:
private boolean mediateMessage(SequenceMediator sequenceMediator, MessageContext synCtx) { try { return sequenceMediator.mediate(synCtx); } catch (SynapseException syne) { if (!synCtx.getFaultStack().isEmpty()) { log.warn("Executing fault handler due to exception encountered", syne); ((FaultHandler) synCtx.getFaultStack().pop()).handleFault(synCtx, syne); } else { log.warn("Exception encountered but no fault handler found - message dropped"); } } catch (Exception e) { String msg = "Unexpected error occurred executing the Target"; log.error(msg, e); if (synCtx.getServiceLog() != null) { synCtx.getServiceLog().error(msg, e); } if (!synCtx.getFaultStack().isEmpty()) { log.warn("Executing fault handler due to exception encountered"); ((FaultHandler) synCtx.getFaultStack().pop()).handleFault(synCtx, e); } else { log.warn("Exception encountered but no fault handler found - message dropped"); } } return true; }
Source:
private String getTemplateDirectory(String template) { String templateDirectoryName; switch (infrastructure) { case openshift: case k8s: templateDirectoryName = Infrastructure.k8s.toString().toLowerCase(); break; case docker: default: templateDirectoryName = infrastructure.toString().toLowerCase(); } return String.format("/templates/factory/%s/%s", templateDirectoryName, template); }

Target:
private String getTemplateDirectory(String template) { String templateDirectoryName; switch (infrastructure) { case OSIO: templateDirectoryName = Infrastructure.OPENSHIFT.toString().toLowerCase(); break; default: templateDirectoryName = infrastructure.toString().toLowerCase(); } return String.format("/templates/factory/%s/%s", templateDirectoryName, template); }
Source:
protected DiskImage getDiskImage() { if (_diskImage == null) { DiskImage tmpImage = getImage(); _diskImage = (tmpImage == null || tmpImage.getVmEntityType() == VmEntityType.TEMPLATE)?(null):(tmpImage); } return _diskImage; }

Target:
protected DiskImage getDiskImage() { if (_diskImage == null) { _diskImage = getImage(); } return _diskImage; }
Source:
public ConfigAccessor(String zkAddress) { _usesExternalZkClient = false; if (Boolean.parseBoolean(System.getProperty(SystemPropertyKeys.MULTI_ZK_ENABLED))) { try { _zkClient = new FederatedZkClient( new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder().build(), new RealmAwareZkClient.RealmAwareZkClientConfig()); return; } catch (IOException | InvalidRoutingDataException | IllegalStateException e) { throw new HelixException("Failed to create ConfigAccessor!", e); } } _zkClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(zkAddress), new HelixZkClient.ZkClientConfig().setZkSerializer(new ZNRecordSerializer())); }

Target:
public ConfigAccessor(String zkAddress) { _usesExternalZkClient = false; if (Boolean.parseBoolean(System.getProperty(SystemPropertyKeys.MULTI_ZK_ENABLED))) { try { _zkClient = new FederatedZkClient( new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder().build(), new RealmAwareZkClient.RealmAwareZkClientConfig() .setZkSerializer(new ZNRecordSerializer())); return; } catch (IOException | InvalidRoutingDataException | IllegalStateException e) { throw new HelixException("Failed to create ConfigAccessor!", e); } } _zkClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(zkAddress), new HelixZkClient.ZkClientConfig().setZkSerializer(new ZNRecordSerializer())); }
Source:
public Boolean call() throws InterruptedException { CallContext callContext = bulkOutputCallerImpl.getCallContextQueue().poll(); continueCalling = (callContext == null)? false:bulkOutputCallerImpl.processOutput(callContext); if(continueCalling) { bulkOutputCallerImpl.getCallContextQueue().put(callContext); submitTask(this); } else if(getPhase() == WorkPhase.COMPLETED && bulkOutputCallerImpl.getCallContextQueue().isEmpty()) { getCallerThreadPoolExecutor().shutdown(); } return true; }

Target:
public Boolean call() throws InterruptedException { CallContext callContext = bulkOutputCallerImpl.getCallContextQueue().poll(); continueCalling = (callContext == null)? false:bulkOutputCallerImpl.processOutput(callContext); if(continueCalling) { bulkOutputCallerImpl.getCallContextQueue().put(callContext); submitTask(this); } else if(bulkOutputCallerImpl.getCallContextQueue().isEmpty() && getCallerThreadPoolExecutor().getActiveCount() == 0) { getCallerThreadPoolExecutor().shutdown(); } return true; }
Source:
public void init() throws DBException { synchronized(RocksDBClient.class) { if(rocksDb == null) { rocksdbDir = Paths.get(getProperties().getProperty(PROP_ROCKSDB_DIR)); System.out.println("RocksDB data dir: " + rocksdbDir); try { rocksDb = initRocksDB(); } catch (final IOException | RocksDBException e) { throw new DBException(e); } } references++; } }

Target:
public void init() throws DBException { synchronized(RocksDBClient.class) { if(rocksDb == null) { rocksDbDir = Paths.get(getProperties().getProperty(PROPERTY_ROCKSDB_DIR)); LOGGER.info("RocksDB data dir: " + rocksDbDir); try { rocksDb = initRocksDB(); } catch (final IOException | RocksDBException e) { throw new DBException(e); } } references++; } }
Source:
protected List<String> getRequiredBundles() { String orgEclipseUiPluginId = getProjectInfo().isRapOption() ? "org.eclipse.rap.ui;resolution:=optional" : "org.eclipse.ui" ; String orgEclipseEmfParsleyViewsPluginId = getProjectInfo().isRapOption() ? "org.eclipse.emf.parsley.rap.views;resolution:=optional" : EmfParsleyViewsActivator.PLUGIN_ID ; return Lists.newArrayList( "org.eclipse.core.runtime", orgEclipseUiPluginId, orgEclipseEmfParsleyViewsPluginId, "org.eclipse.xtext.xbase.lib"); }

Target:
protected List<String> getRequiredBundles() { List<String> requiredBundles = Lists.newArrayList("org.eclipse.core.runtime"); if (getProjectInfo().isRapOption()) { requiredBundles.addAll( Lists.newArrayList( "org.eclipse.ui;resolution:=optional", "org.eclipse.rap.ui;resolution:=optional", EmfParsleyViewsActivator.PLUGIN_ID+";resolution:=optional", "org.eclipse.emf.parsley.rap.views;resolution:=optional") ); } else { requiredBundles.addAll( Lists.newArrayList( "org.eclipse.ui", EmfParsleyViewsActivator.PLUGIN_ID) ); } requiredBundles.add("org.eclipse.xtext.xbase.lib"); return requiredBundles; }
Source:
public HeaderExchangeClient(Client client, boolean needHeartbeat) { if (client == null) { throw new IllegalArgumentException("client == null"); } this.client = client; this.channel = new HeaderExchangeChannel(client); String dubbo = client.getUrl().getParameter(Constants.DUBBO_VERSION_KEY); this.heartbeat = client.getUrl().getParameter(Constants.HEARTBEAT_KEY, dubbo != null && dubbo.startsWith("1.0.") ? Constants.DEFAULT_HEARTBEAT : 0); this.idleTimeout = client.getUrl().getParameter(Constants.HEARTBEAT_TIMEOUT_KEY, heartbeat * 3); if (idleTimeout < heartbeat * 2) { throw new IllegalStateException("idleTimeout < heartbeatInterval * 2"); } if (needHeartbeat) { long tickDuration = calculateLeastDuration(heartbeat); idleCheckTimer = new HashedWheelTimer(new NamedThreadFactory("dubbo-client-idleCheck", true), tickDuration, TimeUnit.MILLISECONDS, Constants.TICKS_PER_WHEEL); startIdleCheckTimer(); } }

Target:
public HeaderExchangeClient(Client client, boolean needHeartbeat) { Assert.notNull(client, "Client can't be null"); this.client = client; this.channel = new HeaderExchangeChannel(client); String dubbo = client.getUrl().getParameter(Constants.DUBBO_VERSION_KEY); this.heartbeat = client.getUrl().getParameter(Constants.HEARTBEAT_KEY, dubbo != null && dubbo.startsWith("1.0.") ? Constants.DEFAULT_HEARTBEAT : 0); this.idleTimeout = client.getUrl().getParameter(Constants.HEARTBEAT_TIMEOUT_KEY, heartbeat * 3); if (idleTimeout < heartbeat * 2) { throw new IllegalStateException("idleTimeout < heartbeatInterval * 2"); } if (needHeartbeat) { startIdleCheckTask(); } }
Source:
private static FlatMapFunction<ReadShard, Tuple2<AssemblyRegion, SimpleInterval>> shardsToAssemblyRegions( final AuthHolder authHolder, final Broadcast<ReferenceMultiSource> reference, final Broadcast<HaplotypeCallerArgumentCollection> hcArgsBroadcast, final ShardingArgumentCollection assemblyArgs, final SAMFileHeader header) { return shard -> { final ReferenceMultiSource referenceMultiSource = reference.value(); final ReferenceMultiSourceToReferenceDataSourceAdaptor refDataSource = new ReferenceMultiSourceToReferenceDataSourceAdaptor(referenceMultiSource, authHolder); final ReferenceContext refContext = new ReferenceContext(refDataSource, shard.getPaddedInterval()); final ReferenceMultiSourceToReferenceSequenceFileAdaptor referenceReader = new ReferenceMultiSourceToReferenceSequenceFileAdaptor(reference.getValue(), authHolder); final FeatureContext features = new FeatureContext(); final Iterable<AssemblyRegion> assemblyRegions = AssemblyRegion.createFromReadShard( shard, header, refContext, features, new HaplotypeCallerEngine(hcArgsBroadcast.value(), header, referenceReader), assemblyArgs.minAssemblyRegionSize, assemblyArgs.maxAssemblyRegionSize, assemblyArgs.assemblyRegionPadding, assemblyArgs.activeProbThreshold, assemblyArgs.maxProbPropagationDistance); return StreamSupport.stream(assemblyRegions.spliterator(), false) .map( a -> new Tuple2<>(a, shard.getInterval())) .collect(Collectors.toList()); }; }

Target:
private static FlatMapFunction<Iterator<Shard<GATKRead>>, Tuple2<AssemblyRegion, SimpleInterval>> shardsToAssemblyRegions( final AuthHolder authHolder, final Broadcast<ReferenceMultiSource> reference, final Broadcast<HaplotypeCallerArgumentCollection> hcArgsBroadcast, final ShardingArgumentCollection assemblyArgs, final SAMFileHeader header) { return shards -> { final ReferenceMultiSource referenceMultiSource = reference.value(); final ReferenceMultiSourceAdapter referenceSource = new ReferenceMultiSourceAdapter(referenceMultiSource, authHolder); final HaplotypeCallerEngine hcEngine = new HaplotypeCallerEngine(hcArgsBroadcast.value(), header, referenceSource); return iteratorToStream(shards).flatMap(shardToRegion(assemblyArgs, header, referenceSource, hcEngine)).iterator(); }; }
Source:
private void testNonHealthCheckRequest(HttpMethod httpMethod, String uri) throws IOException { EmbeddedChannel channel = createChannel(); Random random = new Random(); HttpHeaders headers = new DefaultHttpHeaders(); headers.add(HttpHeaders.Names.CONTENT_LENGTH, new Random().nextLong()); String location = UtilsTest.getRandomString(60); int size = random.nextInt(10000); if (httpMethod == HttpMethod.POST) { headers.add(RestUtils.Headers.LOCATION, location); headers.add(RestUtils.Headers.BLOB_SIZE, size); } channel.writeInbound(RestTestUtils.createRequest(httpMethod, uri, headers)); channel.writeInbound(new DefaultLastHttpContent()); FullHttpResponse response = (FullHttpResponse) channel.readOutbound(); HttpResponseStatus responseStatus = null; if (httpMethod == HttpMethod.POST) { responseStatus = HttpResponseStatus.CREATED; } else if (httpMethod == HttpMethod.GET) { responseStatus = HttpResponseStatus.OK; } else if (httpMethod == HttpMethod.DELETE) { responseStatus = HttpResponseStatus.ACCEPTED; } assertEquals("Unexpected response status", responseStatus, response.getStatus()); assertEquals("Unexpected content", httpMethod.toString(), RestTestUtils.getContentString(response)); assertFalse("Channel not closed", channel.isOpen()); channel.close(); }

Target:
private void testNonHealthCheckRequest(HttpMethod httpMethod, String uri) throws IOException { EmbeddedChannel channel = createChannel(); HttpRequest request = RestTestUtils.createRequest(httpMethod, uri, null); FullHttpResponse response = sendRequestAndGetResponse(channel, request); assertEquals("Unexpected response status", HttpResponseStatus.OK, response.getStatus()); assertEquals("Unexpected content", httpMethod.toString(), RestTestUtils.getContentString(response)); channel.close(); }
Source:
public Map<String, String> getUserClaims(String username, Map<String, Object> properties) throws APIManagementException { Map<String, String> map = new HashMap<String, String>(); String tenantAwareUserName = MultitenantUtils.getTenantAwareUsername(username); UserInfoDTO userinfo = new UserInfoDTO(); userinfo.setUsername(tenantAwareUserName); if (tenantAwareUserName.contains(APIConstants.DOMAIN_SEPARATOR)) { userinfo.setDomain(tenantAwareUserName.split(APIConstants.DOMAIN_SEPARATOR)[0]); } if (properties.containsKey(APIConstants.KeyManager.AUTH_CODE)) { userinfo.setAuthCode(properties.get(APIConstants.KeyManager.AUTH_CODE).toString()); } if (properties.containsKey(APIConstants.KeyManager.ACCESS_TOKEN)) { userinfo.setAccessToken(properties.get(APIConstants.KeyManager.ACCESS_TOKEN).toString()); } if (properties.containsKey(APIConstants.KeyManager.CLAIM_DIALECT)) { userinfo.setDialectURI(properties.get(APIConstants.KeyManager.CLAIM_DIALECT).toString()); } try { ClaimsList claims = userClient.generateClaims(userinfo); if (claims != null && claims.getList() != null) { for (Claim claim : claims.getList()) { map.put(claim.getUri(), claim.getValue()); } } } catch (KeyManagerClientException e) { handleException("Error while getting user info", e); } return map; }

Target:
public Map<String, String> getUserClaims(String username, Map<String, Object> properties) throws APIManagementException { Map<String, String> map = new HashMap<String, String>(); String tenantAwareUserName = MultitenantUtils.getTenantAwareUsername(username); UserInfoDTO userinfo = new UserInfoDTO(); userinfo.setUsername(tenantAwareUserName); if (tenantAwareUserName.contains(CarbonConstants.DOMAIN_SEPARATOR)) { userinfo.setDomain(tenantAwareUserName.split(CarbonConstants.DOMAIN_SEPARATOR)[0]); } if (properties.containsKey(APIConstants.KeyManager.ACCESS_TOKEN)) { userinfo.setAccessToken(properties.get(APIConstants.KeyManager.ACCESS_TOKEN).toString()); } if (properties.containsKey(APIConstants.KeyManager.CLAIM_DIALECT)) { userinfo.setDialectURI(properties.get(APIConstants.KeyManager.CLAIM_DIALECT).toString()); } try { ClaimsList claims = userClient.generateClaims(userinfo); if (claims != null && claims.getList() != null) { for (Claim claim : claims.getList()) { map.put(claim.getUri(), claim.getValue()); } } } catch (KeyManagerClientException e) { handleException("Error while getting user info", e); } return map; }
Source:
protected boolean canDoAction() { if (!isVmExist() || !isDiskExist(getOldDisk())) { return false; } if (!canRunActionOnNonManagedVm()) { return false; } if (!vmsDiskOrSnapshotPluggedTo.isEmpty()) { if (isAtLeastOneVmIsNotDown(vmsDiskOrSnapshotPluggedTo) && shouldUpdatePropertiesOtherThanSize()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); } boolean isUpdatedAsBootable = !getOldDisk().isBoot() && getNewDisk().isBoot(); if (isUpdatedAsBootable && !validate(noVmsContainBootableDisks(vmsDiskPluggedTo))) { return false; } boolean isDiskInterfaceUpdated = getOldDisk().getDiskInterface() != getNewDisk().getDiskInterface(); if (isDiskInterfaceUpdated && !validatePciAndIdeLimit(vmsDiskOrSnapshotPluggedTo)) { return false; } } if (DiskStorageType.IMAGE.equals(getOldDisk().getDiskStorageType()) && !validateCanResizeDisk()) { return false; } DiskValidator diskValidator = getDiskValidator(getNewDisk()); return validateCanUpdateShareable() && validate(diskValidator.isVirtIoScsiValid(getVm())) && validate(diskValidator.isDiskInterfaceSupported(getVm())); }

Target:
protected boolean canDoAction() { if (!isVmExist() || !isDiskExist(getOldDisk())) { return false; } if (!canRunActionOnNonManagedVm()) { return false; } if (!vmsDiskOrSnapshotPluggedTo.isEmpty()) { if (isAtLeastOneVmIsNotDown(vmsDiskOrSnapshotPluggedTo) && shouldUpdatePropertiesOtherThanSize()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); } boolean isUpdatedAsBootable = !getOldDisk().isBoot() && getNewDisk().isBoot(); if (isUpdatedAsBootable && !validate(noVmsContainBootableDisks(vmsDiskPluggedTo))) { return false; } boolean isDiskInterfaceUpdated = getOldDisk().getDiskInterface() != getNewDisk().getDiskInterface(); if (isDiskInterfaceUpdated && !validatePciAndIdeLimit(vmsDiskOrSnapshotPluggedTo)) { return false; } } if (DiskStorageType.IMAGE.equals(getOldDisk().getDiskStorageType()) && !validateCanResizeDisk()) { return false; } DiskValidator diskValidator = getDiskValidator(getNewDisk()); return validateCanUpdateShareable() && validateCanUpdateReadOnly() && validate(diskValidator.isVirtIoScsiValid(getVm())) && (getOldDisk().getDiskInterface() == getNewDisk().getDiskInterface() || validate(diskValidator.isDiskInterfaceSupported(getVm()))); }
Source:
public Producer<K, V> getProducer() { return producer; }

Target:
protected Producer<K, V> getProducer() { return producer; }
Source:
protected void addReadBuffer(final ByteBuffer bb) { addReadStats(bb.remaining()); synchronized(readerLock) { final int start = readBuffers.remaining(); readBuffers.add(bb); if(readBuffers.remaining() > 0 && start == 0){ readerListener.call().onRead(this); } } }

Target:
protected void addReadBuffer(final ByteBuffer bb) { addReadStats(bb.remaining()); synchronized(readerLock) { final int start = readBuffers.remaining(); readBuffers.add(bb); if(this.readerListener.registeredListenerCount() > 0 && readBuffers.remaining() > 0 && start == 0){ callReader(); } } }
Source:
protected Block computeSpan(SpanType type, Attributes attributes) { switch (type) { case LINK: if (attributes instanceof LinkAttributes) { return new LinkBlock((LinkAttributes) attributes); } case ITALIC: case EMPHASIS: return new ContentBlock("*", "*"); case BOLD: case STRONG: return new ContentBlock("**", "**"); case CODE: return new CodeSpan(); default: Logger.getLogger(getClass().getName()).warning("Unexpected block type: " + type); return new ContentBlock("", ""); } }

Target:
protected Block computeSpan(SpanType type, Attributes attributes) { switch (type) { case LINK: if (attributes instanceof LinkAttributes) { return new LinkBlock((LinkAttributes) attributes); } else { return new ContentBlock("<", ">"); } case ITALIC: case EMPHASIS: return new ContentBlock("*", "*"); case BOLD: case STRONG: return new ContentBlock("**", "**"); case CODE: return new CodeSpan(); default: Logger.getLogger(getClass().getName()).warning("Unexpected block type: " + type); return new ContentBlock("", ""); } }
Source:
public void test() throws Exception { connect(); waitResponse(); getActions().moveToElement(driver.findElement(jq(".z-rangeslider-track"))) .moveByOffset(15, 0) .clickAndHold() .moveByOffset(150, 0) .release() .perform(); waitResponse(); Assert.assertEquals(jq(".z-rangeslider-track").width(), jq("@rangeslider .z-sliderbuttons-button").last().positionLeft(), 5); getActions().moveToElement(driver.findElement(jq(".z-multislider-track"))) .moveByOffset(15, 0) .clickAndHold() .moveByOffset(-150, 0) .release() .perform(); waitResponse(); Assert.assertEquals(0, jq("@multislider .z-sliderbuttons-button").first().positionLeft()); }

Target:
public void test() throws Exception { connect(); waitResponse(); getActions().moveToElement(driver.findElement(jq(".z-rangeslider-track"))) .moveByOffset(15, 0) .clickAndHold() .moveByOffset(150, 0) .release() .perform(); waitResponse(); Assert.assertEquals(jq(".z-rangeslider-track").width(), jq("@rangeslider .z-sliderbuttons-button").last().positionLeft(), 1); getActions().moveToElement(driver.findElement(jq(".z-multislider-track"))) .moveByOffset(15, 0) .clickAndHold() .moveByOffset(-150, 0) .release() .perform(); waitResponse(); Assert.assertEquals(0, jq("@multislider .z-sliderbuttons-button").first().positionLeft()); }
Source:
public void testAllHomRefVCF() throws IOException { final File dbSnpFile = new File(TEST_DATA_DIR, "mini.dbsnp.vcf"); final File vcfFile = new File(TEST_DATA_DIR, "allHomRef.vcf"); final File outFile = new File(TEST_DATA_DIR, "vcmetrics_allHomRef"); final File summaryFile = new File(outFile + ".variant_calling_summary_metrics"); final File detailFile = new File(outFile + ".variant_calling_detail_metrics"); summaryFile.deleteOnExit(); detailFile.deleteOnExit(); final CollectVariantCallingMetrics program = new CollectVariantCallingMetrics(); program.INPUT = vcfFile; program.DBSNP = dbSnpFile; program.OUTPUT = outFile; Assert.assertEquals(program.doWork(), 0); final MetricsFile<CollectVariantCallingMetrics.VariantCallingDetailMetrics, Comparable<?>> detail = new MetricsFile<>(); detail.read(new FileReader(detailFile)); boolean seenSampleWithOnlyHomRefs = false; for (final CollectVariantCallingMetrics.VariantCallingDetailMetrics metrics : detail.getMetrics()) { if(metrics.SAMPLE_ALIAS.equals("HG00116")) { seenSampleWithOnlyHomRefs = true; Assert.assertEquals(metrics.TOTAL_SNPS, 0); } } Assert.assertTrue(seenSampleWithOnlyHomRefs); }

Target:
public void testAllHomRefVCF() throws IOException { final File dbSnpFile = new File(TEST_DATA_DIR, "mini.dbsnp.vcf"); final File vcfFile = new File(TEST_DATA_DIR, "allHomRef.vcf"); final File indexedVcfFile = VcfTestUtils.createTemporaryIndexedVcfFromInput(vcfFile, "allHomRef.tmp."); final File outFile = new File(TEST_DATA_DIR, "vcmetrics_allHomRef"); final File summaryFile = new File(outFile + ".variant_calling_summary_metrics"); final File detailFile = new File(outFile + ".variant_calling_detail_metrics"); outFile.deleteOnExit(); summaryFile.deleteOnExit(); detailFile.deleteOnExit(); final CollectVariantCallingMetrics program = new CollectVariantCallingMetrics(); program.INPUT = indexedVcfFile; program.DBSNP = dbSnpFile; program.OUTPUT = outFile; Assert.assertEquals(program.doWork(), 0); final MetricsFile<CollectVariantCallingMetrics.VariantCallingDetailMetrics, Comparable<?>> detail = new MetricsFile<>(); detail.read(new FileReader(detailFile)); boolean seenSampleWithOnlyHomRefs = false; for (final CollectVariantCallingMetrics.VariantCallingDetailMetrics metrics : detail.getMetrics()) { if (metrics.SAMPLE_ALIAS.equals("HG00116")) { seenSampleWithOnlyHomRefs = true; Assert.assertEquals(metrics.TOTAL_SNPS, 0); } } Assert.assertTrue(seenSampleWithOnlyHomRefs); }
Source:
public static void setupConnection( H2PooledConnection conn, QueryContext qctx, boolean distributedJoins, boolean enforceJoinOrder, boolean lazy ) { Session s = session(conn); s.setForceJoinOrder(enforceJoinOrder); s.setJoinBatchEnabled(distributedJoins); s.setLazyQueryExecution(lazy); QueryContext oldCtx = (QueryContext)s.getVariable(QCTX_VARIABLE_NAME).getObject(); assert oldCtx == null || oldCtx == qctx : oldCtx; s.setVariable("IGNITE_QUERY_CONTEXT", new ValueRuntimeSimpleObject<>(qctx)); QueryContext.threadLocal(qctx); }

Target:
public static void setupConnection( H2PooledConnection conn, QueryContext qctx, boolean distributedJoins, boolean enforceJoinOrder, boolean lazy ) { Session s = session(conn); s.setForceJoinOrder(enforceJoinOrder); s.setJoinBatchEnabled(distributedJoins); s.setLazyQueryExecution(lazy); QueryContext oldCtx = (QueryContext)s.getVariable(QCTX_VARIABLE_NAME).getObject(); assert oldCtx == null || oldCtx == qctx : oldCtx; s.setVariable(QCTX_VARIABLE_NAME, new ValueRuntimeSimpleObject<>(qctx)); QueryContext.threadLocal(qctx); }
Source:
protected void RefreshAllVdssInPool(boolean connect) { java.util.ArrayList<Guid> vdsIdsToSetNonOperational = new java.util.ArrayList<Guid>(); runSynchronizeOperation(new RefreshPoolSingleAsyncOperationFactory(), vdsIdsToSetNonOperational); for (Guid vdsId : vdsIdsToSetNonOperational) { SetNonOperationalVdsParameters tempVar = new SetNonOperationalVdsParameters(vdsId, STORAGE_DOMAIN_UNREACHABLE, null); tempVar.setSaveToDb(true); tempVar.setStorageDomainId(getStorageDomain().getId()); tempVar.setTransactionScopeOption(TransactionScopeOption.RequiresNew); Backend.getInstance().runInternalAction(VdcActionType.SetNonOperationalVds, tempVar); } }

Target:
protected void RefreshAllVdssInPool(boolean connect) { java.util.ArrayList<Guid> vdsIdsToSetNonOperational = new java.util.ArrayList<Guid>(); runSynchronizeOperation(new RefreshPoolSingleAsyncOperationFactory(), vdsIdsToSetNonOperational); for (Guid vdsId : vdsIdsToSetNonOperational) { SetNonOperationalVdsParameters tempVar = new SetNonOperationalVdsParameters(vdsId, STORAGE_DOMAIN_UNREACHABLE); tempVar.setSaveToDb(true); tempVar.setStorageDomainId(getStorageDomain().getId()); tempVar.setTransactionScopeOption(TransactionScopeOption.RequiresNew); Backend.getInstance().runInternalAction(VdcActionType.SetNonOperationalVds, tempVar); } }