auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testBlogPosting() { onView(withText("Log In")) .perform(click()); onView(withId(R.id.input)) .perform(replaceText(mUserEmail), closeSoftKeyboard()); onView(withText("Next")) .perform(click()); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } onView(withId(R.id.login_enter_password)) .perform(click()); onView(withId(R.id.input)) .perform(replaceText(mUserPassword), closeSoftKeyboard()); onView(withText("Next")) .perform(click()); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } onView(withText("Continue")) .perform(click()); onView(withId(R.id.viewpager_main)) .perform(ViewPagerActions.scrollToFirst()); onView(withId(R.id.fab_button)) .perform(click()); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } onView(withId(R.id.title)) .perform(replaceText("Hello"), closeSoftKeyboard()); onView(withId(R.id.aztec)) .perform(replaceText("World"), closeSoftKeyboard()); onView(withId(R.id.menu_save_post)) .perform(click()); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } onView(withId(R.id.promo_dialog_button_positive)) .perform(click()); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } onView(withText(R.string.uploading_post)).inRoot(new ToastMatcher()) .check(matches(isDisplayed())); }

Target:
public void testBlogPosting() { new LoginRobot() .selectLoginOption() .typeUsername(USERNAME) .tapNextButton() .tapToEnterPasswordInstead() .typePassword(PASSWORD) .tapNextButton() .tapToContinueOnSiteSelection(); new NavigationRobot() .selectMyWordpressSites(); MySitesMenuRobot mySitesMenu = new MySitesMenuRobot(); mySitesMenu.tapToWriteNewPost(); new ComposePostRobot() .writeTitle("Hello") .writePost("World") .tapToPublish(); mySitesMenu.tapBlogPosts(); new BlogPostsRobot.ResultRobot() .hasTitleAndTextAtPosition("Hello", "World", 0); }
Source:
public void placeOnTop(Node pNode) { assert pNode != null; if( aType == DiagramType.SEQUENCE && pNode.getClass() == CallNode.class ) { return; } if( pNode.hasParent() ) { Node parent = pNode.getParent(); parent.placeLast(pNode); placeOnTop(parent); } else if( containsAsRoot(pNode) ) { removeRootNode(pNode); addRootNode(pNode); } }

Target:
public void placeOnTop(Node pNode) { assert pNode != null; if( pNode.getClass() == CallNode.class ) { return; } if( pNode.hasParent() ) { Node parent = pNode.getParent(); parent.placeLast(pNode); placeOnTop(parent); } else if( containsAsRoot(pNode) ) { removeRootNode(pNode); addRootNode(pNode); } }
Source:
public int[] downloadSetupConfigurationTemplate(String uuid){ int[] result = new int[2]; try { SetupConfigurationTemplate setupConfigurationTemplate = setupConfigurationController.downloadSetupConfigurationTemplate(uuid); result[0] = SyncStatusConstants.SUCCESS; if(setupConfigurationTemplate != null) { result[1] = 1; } System.out.println("MuzimaSyncService: "+setupConfigurationTemplate.getConfigJson()); setupConfigurationController.saveSetupConfigurationTemplate(setupConfigurationTemplate); } catch (SetupConfigurationController.SetupConfigurationDownloadException e){ Log.e(TAG, "Exception when trying to download setup configs"); result[0] = SyncStatusConstants.DOWNLOAD_ERROR; } catch (SetupConfigurationController.SetupConfigurationSaveException e){ Log.e(TAG, "Exception when trying to save setup configs"); result[0] = SyncStatusConstants.SAVE_ERROR; } return result; }

Target:
public int[] downloadSetupConfigurationTemplate(String uuid){ int[] result = new int[2]; try { SetupConfigurationTemplate setupConfigurationTemplate = setupConfigurationController.downloadSetupConfigurationTemplate(uuid); result[0] = SyncStatusConstants.SUCCESS; if(setupConfigurationTemplate != null) { result[1] = 1; } setupConfigurationController.saveSetupConfigurationTemplate(setupConfigurationTemplate); } catch (SetupConfigurationController.SetupConfigurationDownloadException e){ Log.e(TAG, "Exception when trying to download setup configs"); result[0] = SyncStatusConstants.DOWNLOAD_ERROR; } catch (SetupConfigurationController.SetupConfigurationSaveException e){ Log.e(TAG, "Exception when trying to save setup configs"); result[0] = SyncStatusConstants.SAVE_ERROR; } return result; }
Source:
public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (orientation != newConfig.orientation) { try { orientation = newConfig.orientation; getFragmentManager().beginTransaction().remove(this).commit(); getFragmentManager().beginTransaction() .replace(R.id.cover_fragment_container, CoverFragment.class.newInstance()) .commitAllowingStateLoss(); } catch (Exception e) { Log.e(TAG, "onConfigurationChanged " + e.toString()); } } }

Target:
public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); CoverFragment next; if (orientation != newConfig.orientation) { try { Log.d(TAG, "onConfigurationChanged " + newConfig.orientation); orientation = newConfig.orientation; if (_prev == null) { next = CoverFragment.class.newInstance(); } else { next = _prev; } _prev = this; getParentFragmentManager().beginTransaction() .remove(_prev) .add(R.id.cover_fragment_container, next) .commitAllowingStateLoss(); } catch (Exception e) { Log.e(TAG, "onConfigurationChanged " + e.toString()); } } }
Source:
protected void serviceStart() throws Exception { super.serviceStart(); if (UserGroupInformation.isSecurityEnabled()) { delegationTokenManager.startThreads(); } InetSocketAddress connectAddress = NetUtils.getConnectAddress(this.heartbeatListener.getAddress()); URI connectUri = RecoverableRpcProxy.toConnectURI(connectAddress); FSRecoveryHandler recoveryHandler = new FSRecoveryHandler(dag.assertAppPath(), getConfig()); recoveryHandler.writeConnectUri(connectUri.toString()); try { org.mortbay.log.Log.setLog(null); } catch (Throwable throwable) { } try { Configuration config = getConfig(); if (SecurityUtils.isStramWebSecurityEnabled()) { config = new Configuration(config); config.set("hadoop.http.filter.initializers", StramWSFilterInitializer.class.getCanonicalName()); } addSSLConfigResource(config); WebApp webApp = WebApps.$for("stram", StramAppContext.class, appContext, "ws").with(config).start(new StramWebApp(this.dnmgr)); LOG.info("Started web service at port: " + webApp.port()); appMasterTrackingUrl = NetUtils.getConnectAddress(webApp.getListenerAddress()).getAddress().getCanonicalHostName() + ":" + webApp.port(); if (ConfigUtils.isSSLEnabled(config)) { appMasterTrackingUrl = "https://" + appMasterTrackingUrl; } LOG.info("Setting tracking URL to: " + appMasterTrackingUrl); } catch (Exception e) { LOG.error("Webapps failed to start. Ignoring for now:", e); } }

Target:
protected void serviceStart() throws Exception { super.serviceStart(); if (UserGroupInformation.isSecurityEnabled()) { delegationTokenManager.startThreads(); } InetSocketAddress connectAddress = NetUtils.getConnectAddress(this.heartbeatListener.getAddress()); URI connectUri = RecoverableRpcProxy.toConnectURI(connectAddress); FSRecoveryHandler recoveryHandler = new FSRecoveryHandler(dag.assertAppPath(), getConfig()); recoveryHandler.writeConnectUri(connectUri.toString()); try { org.mortbay.log.Log.setLog(null); } catch (Throwable throwable) { } try { Configuration config = SecurityUtils.configureWebAppSecurity(getConfig(), dag.getValue(Context.DAGContext.SSL_CONFIG)); WebApp webApp = WebApps.$for("stram", StramAppContext.class, appContext, "ws").with(config).start(new StramWebApp(this.dnmgr)); LOG.info("Started web service at port: " + webApp.port()); connectAddress = NetUtils.getConnectAddress(webApp.getListenerAddress()); String hostname = connectAddress.getAddress().getCanonicalHostName(); if (hostname.equals(connectAddress.getAddress().getHostAddress())) { hostname = connectAddress.getHostName(); } appMasterTrackingUrl = hostname + ":" + webApp.port(); if (ConfigUtils.isSSLEnabled(config)) { appMasterTrackingUrl = "https://" + appMasterTrackingUrl; } LOG.info("Setting tracking URL to: " + appMasterTrackingUrl); } catch (Exception e) { LOG.error("Webapps failed to start. Ignoring for now:", e); } }
Source:
protected void executeVdsBrokerCommand() { String storageDomainId = getParameters().getStorageDomainId().toString(); List<String> deviceList = getParameters().getDeviceList(); String[] deviceArray = deviceList.toArray(new String[deviceList.size()]); boolean isForce = getParameters().isForce(); boolean supportForceCreateVG = Config.<Boolean> getValue( ConfigValues.SupportForceCreateVG, getVds().getVdsGroupCompatibilityVersion().toString()); _result = supportForceCreateVG ? getBroker().createVG(storageDomainId, deviceArray, isForce) : getBroker().createVG(storageDomainId, deviceArray); proceedProxyReturnValue(); setReturnValue(_result.uuid); }

Target:
protected void executeVdsBrokerCommand() { String storageDomainId = getParameters().getStorageDomainId().toString(); List<String> deviceList = getParameters().getDeviceList(); String[] deviceArray = deviceList.toArray(new String[deviceList.size()]); boolean isForce = getParameters().isForce(); boolean supportForceCreateVG = Config.<Boolean> getValue( ConfigValues.SupportForceCreateVG, getVds().getVdsGroupCompatibilityVersion().toString()); result = supportForceCreateVG ? getBroker().createVG(storageDomainId, deviceArray, isForce) : getBroker().createVG(storageDomainId, deviceArray); proceedProxyReturnValue(); setReturnValue(result.uuid); }
Source:
public boolean addNextEvent(final MistEvent event, final Direction direction) { if (operatorChainManager != null && queue.isEmpty()) { operatorChainManager.insert(this); } return queue.add(new Tuple<>(event, direction)); }

Target:
public boolean addNextEvent(final MistEvent event, final Direction direction) { final boolean isAdded; synchronized (this) { if (operatorChainManager != null && queue.isEmpty()) { isAdded = queue.add(new Tuple<>(event, direction)); operatorChainManager.insert(this); } else { isAdded = queue.add(new Tuple<>(event, direction)); } } return isAdded; }
Source:
public void freeUnderlyingResources() { int spi = mSpi.getSpi(); try { mSrvConfig .getNetdInstance() .ipSecDeleteSecurityAssociation( 0, mConfig.getSourceAddress(), mConfig.getDestinationAddress(), spi, 0, mConfig.getMarkMask()); } catch (RemoteException | ServiceSpecificException e) { Log.e(TAG, "Failed to delete SA with ID: " + mResourceId, e); } getResourceTracker().give(); }

Target:
public void freeUnderlyingResources() { int spi = mSpi.getSpi(); try { mSrvConfig .getNetdInstance() .ipSecDeleteSecurityAssociation( uid, mConfig.getSourceAddress(), mConfig.getDestinationAddress(), spi, 0, mConfig.getMarkMask()); } catch (RemoteException | ServiceSpecificException e) { Log.e(TAG, "Failed to delete SA with ID: " + mResourceId, e); } getResourceTracker().give(); }
Source:
public void execute() { final Setting setting = getActionContext().getSetting(); final EObject eObject = setting.getEObject(); final EStructuralFeature eStructuralFeature = setting.getEStructuralFeature(); final List<?> containments = (List<?>) eObject.eGet(eStructuralFeature, true); final List<?> moveUpList = Arrays.asList( ((IStructuredSelection) getTableViewer().getSelection()).toArray()); sortSelectionBasedOnIndex(moveUpList, containments); final EditingDomain editingDomain = getActionContext().getEditingDomain(); for (final Object moveUpObject : moveUpList) { final int currentIndex = containments.indexOf(moveUpObject); if (currentIndex <= 0) { return; } editingDomain.getCommandStack() .execute( new MoveCommand( editingDomain, eObject, eStructuralFeature, currentIndex, currentIndex - 1)); } }

Target:
public void execute() { final List<?> containments = getContainments(); final List<?> moveUpList = Arrays.asList( ((IStructuredSelection) getTableViewer().getSelection()).toArray()); sortSelectionBasedOnIndex(moveUpList, containments); final EditingDomain editingDomain = getActionContext().getEditingDomain(); final Setting setting = getActionContext().getSetting(); final EObject eObject = setting.getEObject(); final EStructuralFeature eStructuralFeature = setting.getEStructuralFeature(); for (final Object moveUpObject : moveUpList) { final int currentIndex = containments.indexOf(moveUpObject); if (currentIndex <= 0) { return; } editingDomain.getCommandStack() .execute( new MoveCommand( editingDomain, eObject, eStructuralFeature, currentIndex, currentIndex - 1)); } }
Source:
protected Array createArrayOf(String typeName, Object[] array) { Connection connection = null; try { connection = getJdbcTemplate().getDataSource().getConnection(); return connection.createArrayOf(typeName, array); } catch (SQLException e) { throw new RuntimeException(e); } finally { if (connection != null) { try { connection.close();} catch (SQLException e) } } }

Target:
protected Array createArrayOf(String typeName, Object[] array) { try (Connection connection = getJdbcTemplate().getDataSource().getConnection()) { return connection.createArrayOf(typeName, array); } catch (SQLException ex) { throw new RuntimeException(ex); } }
Source:
public byte[] serialize() { ByteBuffer buffer = ByteBuffer.allocate(9); buffer.put(TYPE_LONG); buffer.putLong(value); return buffer.array(); }

Target:
public byte[] serialize() { ByteBuffer buffer = ByteBuffer.allocate(Byte.BYTES + Long.BYTES); buffer.put(getType().getByte()); buffer.putLong(value); return buffer.array(); }
Source:
public ServiceReference[] getServiceReferences(String clazz, String filter) { ServiceReference[] refs = null; try { if (bundleContext != null) { refs = bundleContext.getServiceReferences(clazz, filter); } } catch (InvalidSyntaxException e) { if (log.isLoggable(Level.SEVERE)) { log.log(Level.SEVERE, e.getMessage(), e); } } return refs; }

Target:
public ServiceReference[] getServiceReferences(String clazz, String filter) throws PlatformServicesException { ServiceReference[] refs = null; try { if (bundleContext != null) { refs = bundleContext.getServiceReferences(clazz, filter); } } catch (InvalidSyntaxException e) { throw new PlatformServicesException(e); } return refs; }
Source:
private boolean execute(final IProcessDMContext processDmc, final IDebugCommandRequest request) { try { fExecutor.execute(new DsfRunnable() { @Override public void run() { IProcesses procService = fTracker.getService(IProcesses.class); if (procService != null) { procService.terminate(processDmc, new ImmediateRequestMonitor() { @Override protected void handleCompleted() { if (!getStatus().isOK()) { request.setStatus(getStatus()); request.done(); } else { WaitForTerminationJob job = new WaitForTerminationJob(fSession.getId(), request); job.schedule(); } }; }); } else { request.done(); } } }); } catch (RejectedExecutionException e) { request.done(); } return false; }

Target:
private boolean execute(final IProcessDMContext processDmc, final IDebugCommandRequest request) { try { fExecutor.execute(new DsfRunnable() { @Override public void run() { IProcesses procService = fTracker.getService(IProcesses.class); if (procService != null) { procService.terminate(processDmc, new ImmediateRequestMonitor() { @Override protected void handleCompleted() { if (!isSuccess()) { request.setStatus(getStatus()); request.done(); } else { WaitForTerminationJob job = new WaitForTerminationJob(fSession.getId(), request); job.schedule(); } }; }); } else { request.done(); } } }); } catch (RejectedExecutionException e) { request.done(); } return false; }
Source:
void deleteProperty(AccumuloElement element, Property property, Authorizations authorizations) { if (!element.getFetchHints().isIncludeAllProperties()) { throw new VertexiumMissingFetchHintException(element.getFetchHints(), "All Properties"); } if (!element.getFetchHints().isIncludeAllPropertyMetadata()) { throw new VertexiumMissingFetchHintException(element.getFetchHints(), "All Property Metadata"); } Mutation m = new Mutation(element.getId()); elementMutationBuilder.addPropertyDeleteToMutation(m, property); addMutations(element, m); getSearchIndex().deleteProperty( this, element, PropertyDescriptor.fromProperty(property), authorizations ); if (hasEventListeners()) { queueEvent(new DeletePropertyEvent(this, element, property)); } }

Target:
void deleteProperty(AccumuloElement element, Property property, Authorizations authorizations) { if (!element.getFetchHints().isIncludePropertyAndMetadata(property.getName())) { throw new VertexiumMissingFetchHintException(element.getFetchHints(), "Property " + property.getName() + " needs to be included with metadata"); } Mutation m = new Mutation(element.getId()); elementMutationBuilder.addPropertyDeleteToMutation(m, property); addMutations(element, m); getSearchIndex().deleteProperty( this, element, PropertyDescriptor.fromProperty(property), authorizations ); if (hasEventListeners()) { queueEvent(new DeletePropertyEvent(this, element, property)); } }
Source:
public List<ExperimentSpotDesignReadSpec> list() { List expmts = this.getHibernateTemplate().find("from ExperimentSpotDesignReadSpec as readSpec order by readSpec.experimentSpotDesignReadSpecId asc" ); return expmts; }

Target:
public List<ExperimentSpotDesignReadSpec> list() { List expmts = this.getHibernateTemplate().find("from ExperimentSpotDesignReadSpec as readSpec" ); return expmts; }
Source:
public void testToFlowElement_autostart() throws Exception { final ReusableSubprocess definition = new ReusableSubprocess(); definition.getExecutionSet().setAdHocAutostart(new AdHocAutostart(true)); final View<BaseReusableSubprocess> view = new ViewImpl<>(definition, Bounds.create()); final Node<View<BaseReusableSubprocess>, ?> node = new NodeImpl<>(java.util.UUID.randomUUID().toString()); node.setContent(view); final PropertyWriter propertyWriter = tested.toFlowElement(node); assertTrue(CallActivityPropertyWriter.class.isInstance(propertyWriter)); assertTrue(CustomElement.autoStart.of(propertyWriter.getFlowElement()).get()); }

Target:
public void testToFlowElement_autostart() { final ReusableSubprocess definition = new ReusableSubprocess(); definition.getExecutionSet().setAdHocAutostart(new AdHocAutostart(true)); final View<BaseReusableSubprocess> view = new ViewImpl<>(definition, Bounds.create()); final Node<View<BaseReusableSubprocess>, ?> node = new NodeImpl<>(java.util.UUID.randomUUID().toString()); node.setContent(view); final PropertyWriter propertyWriter = tested.toFlowElement(node); assertTrue(CallActivityPropertyWriter.class.isInstance(propertyWriter)); assertTrue(CustomElement.autoStart.of(propertyWriter.getFlowElement()).get()); }
Source:
public static Date parseDate(String date, String format) { return parseDate(date, new SimpleDateFormat(format, Locale.getDefault())); }

Target:
public static Date parseDate(String date, String format) { if (date == null) { return null; } return parseDate(date, new SimpleDateFormat(format, Locale.getDefault())); }
Source:
public boolean equals(Object that) { if (this == that) { return true; } if (that instanceof Rating) { Rating other = (Rating) that; return type.equals(other.type) && value == other.value && numberOfVotes.equals(other.numberOfVotes); } return false; }

Target:
public boolean equals(Object that) { if (this == that) { return true; } if (that instanceof Rating) { Rating other = (Rating) that; return type.equals(other.type) && value == other.value && Objects.equals(numberOfVotes, other.numberOfVotes); } return false; }
Source:
public static void connect(Socket socket, SocketAddress endpoint, SocketAddress localAddr, int timeout) throws IOException { if (socket == null || endpoint == null || timeout < 0) { throw new IllegalArgumentException("Illegal argument for connect()"); } SocketChannel ch = socket.getChannel(); if (localAddr != null) { Class localClass = localAddr.getClass(); Class remoteClass = endpoint.getClass(); Preconditions.checkArgument(localClass.equals(remoteClass), "Local address %s must be of same family as remote address %s.", localAddr, endpoint); socket.bind(localAddr); } try { if (ch == null) { socket.connect(endpoint, timeout); } else { SocketIOWithTimeout.connect(ch, endpoint, timeout); } } catch (SocketTimeoutException ste) { throw new ConnectTimeoutException(ste.getMessage()); } catch (UnresolvedAddressException ue) { throw new UnknownHostException(ue.getMessage()); } if (socket.getLocalPort() == socket.getPort() && socket.getLocalAddress().equals(socket.getInetAddress())) { LOG.info("Detected a loopback TCP socket, disconnecting it"); socket.close(); throw new ConnectException( "Localhost targeted connection resulted in a loopback. " + "No daemon is listening on the target port."); } }

Target:
public static void connect(Socket socket, SocketAddress endpoint, SocketAddress localAddr, int timeout) throws IOException { if (socket == null || endpoint == null || timeout < 0) { throw new IllegalArgumentException("Illegal argument for connect()"); } SocketChannel ch = socket.getChannel(); if (localAddr != null) { Class localClass = localAddr.getClass(); Class remoteClass = endpoint.getClass(); Preconditions.checkArgument(localClass.equals(remoteClass), "Local address %s must be of same family as remote address %s.", localAddr, endpoint); socket.bind(localAddr); } try { if (ch == null) { socket.connect(endpoint, timeout); } else { SocketIOWithTimeout.connect(ch, endpoint, timeout); } } catch (SocketTimeoutException ste) { throw new ConnectTimeoutException(ste.getMessage()); } catch (UnresolvedAddressException uae) { throw new UnknownHostException(uae.getMessage()); } if (socket.getLocalPort() == socket.getPort() && socket.getLocalAddress().equals(socket.getInetAddress())) { LOG.info("Detected a loopback TCP socket, disconnecting it"); socket.close(); throw new ConnectException( "Localhost targeted connection resulted in a loopback. " + "No daemon is listening on the target port."); } }
Source:
public void testReviewForm() throws ParseException { final DeliveryReviewView view = getDeliveryReviewView(); final DeliveryReviewView.DeliveryForm deliveryForm = view.getDelivery(); deliveryForm.setGrade("4.0"); deliveryForm.setState("Rejected"); deliveryForm.setCommentary("Hello World!"); assertTrue(deliveryForm.getGrade() == 4.0D); assertEquals(Delivery.State.REJECTED, deliveryForm.getSelectedState()); assertEquals("Hello World!", deliveryForm.getCommentary()); }

Target:
public void testReviewForm() throws ParseException { final DeliveryReviewView view = getDeliveryReviewView(); final DeliveryReviewView.DeliveryForm deliveryForm = view.getDelivery(); deliveryForm.setGrade(INSUFFICIENT_GRADE); deliveryForm.setState(State.REJECTED); deliveryForm.setCommentary(DELIVERY_COMMENTARY); assertEquals(INSUFFICIENT_GRADE, deliveryForm.getGrade(), 1e-4); assertEquals(Delivery.State.REJECTED, deliveryForm.getSelectedState()); assertEquals(DELIVERY_COMMENTARY, deliveryForm.getCommentary()); }
Source:
private static void addRequestParameter(SOAPFactory soapFactory, OMElement bodyFirstChild, OMNamespace ns, String key, Object parameter) { if (parameter instanceof DataHandler) { DataHandler dataHandler = (DataHandler)parameter; OMText dataText = bodyFirstChild.getOMFactory().createOMText( dataHandler, true); OMElement omElement = soapFactory.createOMElement(key, ns, bodyFirstChild); omElement.addChild(dataText); omElement.addAttribute("filename",((DataHandler) parameter).getDataSource().getName(),ns); omElement.addAttribute("filename", ((DataHandler) parameter).getDataSource().getName(), ns); } else { String textValue = parameter.toString(); soapFactory.createOMElement(key, ns, bodyFirstChild).setText( textValue); } }

Target:
private static void addRequestParameter(SOAPFactory soapFactory, OMElement bodyFirstChild, OMNamespace ns, String key, Object parameter) { if (parameter instanceof DataHandler) { DataHandler dataHandler = (DataHandler)parameter; OMText dataText = bodyFirstChild.getOMFactory().createOMText( dataHandler, true); OMElement omElement = soapFactory.createOMElement(key, ns, bodyFirstChild); omElement.addChild(dataText); omElement.addAttribute("filename", ((DataHandler) parameter).getDataSource().getName(), ns); } else { String textValue = parameter.toString(); soapFactory.createOMElement(key, ns, bodyFirstChild).setText( textValue); } }
Source:
public Future<Void> executeFailed(Stage stage, Class<?> executingClass, ConsumerRecord<byte[], byte[]> consumerRecord, Throwable error) { if (!withinToleranceLimits()) { errorHandlingMetrics.recordFailure(); markAsFailed(); throw new ConnectException("Tolerance exceeded in the errant record reporter", error); } context.consumerRecord(consumerRecord); context.currentContext(stage, executingClass); context.error(error); errorHandlingMetrics.recordError(); return context.report(); }

Target:
public Future<Void> executeFailed(Stage stage, Class<?> executingClass, ConsumerRecord<byte[], byte[]> consumerRecord, Throwable error) { markAsFailed(); context.consumerRecord(consumerRecord); context.currentContext(stage, executingClass); context.error(error); errorHandlingMetrics.recordFailure(); Future<Void> errantRecordFuture = context.report(); if (!withinToleranceLimits()) { errorHandlingMetrics.recordError(); throw new ConnectException("Tolerance exceeded in error handler", error); } return errantRecordFuture; }
Source:
public OutputWriter createOutputWriter() { if (file.exists()) { ExcelDatastore datastore = new ExcelDatastore(file.getName(), new FileResource(file), file.getAbsolutePath()); try (final UpdateableDatastoreConnection connection = datastore.openConnection()) { final DataContext dataContext = connection.getDataContext(); final Schema[] schemas = dataContext.getSchemas(); if (schemas.length >= 1) { final String[] tableNames = schemas[1].getTableNames(); for (int i = 0; i < tableNames.length; i++) { if (tableNames[i].equals(sheetName)) { if (overwriteSheetIfExists) { final Table tableSheet = dataContext.getTableByQualifiedLabel(sheetName); final UpdateableDataContext updateableDataContext = connection .getUpdateableDataContext(); updateableDataContext.executeUpdate(new UpdateScript() { @Override public void run(UpdateCallback callback) { callback.dropTable(tableSheet).execute(); ; } }); } } } } } } String[] headers = new String[columns.length]; for (int i = 0; i < headers.length; i++) { headers[i] = columns[i].getName(); } return ExcelOutputWriterFactory.getWriter(file.getPath(), sheetName, columns); }

Target:
public OutputWriter createOutputWriter() { if (file.exists()) { ExcelDatastore datastore = new ExcelDatastore(file.getName(), new FileResource(file), file.getAbsolutePath()); try (final UpdateableDatastoreConnection connection = datastore.openConnection()) { final DataContext dataContext = connection.getDataContext(); final String[] tableNames = dataContext.getDefaultSchema().getTableNames(); for (int i = 0; i < tableNames.length; i++) { if (tableNames[i].equals(sheetName)) { if (overwriteSheetIfExists) { final Table tableSheet = dataContext.getTableByQualifiedLabel(sheetName); final UpdateableDataContext updateableDataContext = connection.getUpdateableDataContext(); updateableDataContext.executeUpdate(new DropTable(tableSheet)); } } } } } String[] headers = new String[columns.length]; for (int i = 0; i < headers.length; i++) { headers[i] = columns[i].getName(); } return ExcelOutputWriterFactory.getWriter(file.getPath(), sheetName, columns); }
Source:
public boolean isQueryCacheable(Query query) { return !query.isDescending() && !unCacheable.contains(query.getType()); }

Target:
public boolean isQueryCacheable(Query query) { return !unCacheable.contains(query.getType()); }
Source:
public void testBacktickEscapedIdentifier() { assertTrue(CharFormatUtil.unescapeIdentifier("``").isEmpty()); assertTrue(CharFormatUtil.unescapeIdentifier("").isEmpty()); assertTrue(CharFormatUtil.unescapeIdentifier("`s`").equals("s")); assertTrue(CharFormatUtil.unescapeIdentifier("`self`").equals("self")); assertFalse(CharFormatUtil.unescapeIdentifier("`self").equals("self")); assertFalse(CharFormatUtil.unescapeIdentifier("self`").equals("self")); assertFalse(CharFormatUtil.unescapeIdentifier("``self`").equals("self")); }

Target:
public void testBacktickEscapedIdentifier() { assertTrue(CharFormatUtil.unescapeIdentifier("``").isEmpty()); assertTrue(CharFormatUtil.unescapeIdentifier("").isEmpty()); assertEquals("self", CharFormatUtil.unescapeIdentifier("`self`")); assertEquals("s",CharFormatUtil.unescapeIdentifier("`s`")); assertEquals("self",CharFormatUtil.unescapeIdentifier("`self`")); assertEquals("`self", CharFormatUtil.unescapeIdentifier("`self")); assertEquals("self`", CharFormatUtil.unescapeIdentifier("self`")); assertEquals("`self", CharFormatUtil.unescapeIdentifier("``self`")); }
Source:
protected void validateAuthenticationState(HttpClient httpClient) throws GerritLoginException { Optional<Cookie> cookie = findCookieWithName(LOGIN_COOKIE_NAME, httpClient); cookie.ifPresent(this::setXsrfCookie); if (!cookie.isPresent()) { if (CoreUtil.TEST_MODE) { System.err.println(" Authentication failed: " + httpClient.getState()); } throw new GerritLoginException(); } }

Target:
protected void validateAuthenticationState(HttpClient httpClient) throws GerritLoginException { Optional<Cookie> cookie = findCookieWithName(LOGIN_COOKIE_NAME, httpClient); setXsrfCookie(nonNullOrThrow(cookie, () -> new GerritLoginException(), httpClient).get()); }
Source:
private void testGetForDeletedBlobWithoutIncludeExpiredOption(List<BlobId> blobIds) { try { store.get(blobIds, EnumSet.noneOf(StoreGetOptions.class)); assertTrue( "get should fail for a expired blob, if StoreGetOptions.Store_Include_Expired is not set in get options", false); } catch (StoreException e) { assertTrue( "get for expired blob with with StoreGetOptions.Store_Include_Expired not set in get options should throw exception with " + StoreErrorCodes.TTL_Expired + " error code.", e.getErrorCode().equals(StoreErrorCodes.TTL_Expired)); } }

Target:
private void testGetForDeletedBlobWithoutIncludeExpiredOption(List<BlobId> blobIds) { try { store.get(blobIds, EnumSet.noneOf(StoreGetOptions.class)); fail("get should fail for a expired blob, if StoreGetOptions.Store_Include_Expired is not set in get options"); } catch (StoreException e) { assertEquals( "get for expired blob with with StoreGetOptions.Store_Include_Expired not set in get options, should throw exception with " + StoreErrorCodes.TTL_Expired + " error code.", e.getErrorCode(), StoreErrorCodes.TTL_Expired); } }
Source:
public Publisher<Integer> createFailedPublisher() { return null; }

Target:
public Publisher<Integer> createFailedPublisher() { final SubmissionPublisher<Integer> sp = new SubmissionPublisher<Integer>(); sp.closeExceptionally(new IOException()); return ReactiveStreamsFlowBridge.toReactiveStreams(sp); }
Source:
public String name() { return Json.createReader(new StringReader(this.obj)) .readObject() .getString("name"); }

Target:
public String name() { return this.json().getString("name"); }
Source:
protected FieldBase(String name, DataType dataType) { if (CoreUtils.isNullOrEmpty(name)) { throw logger.logExceptionAsError(new IllegalArgumentException("The name of field cannot be null")); } this.name = name; this.dataType = dataType; }

Target:
protected FieldBase(String name, DataType dataType) { if (CoreUtils.isNullOrEmpty(name)) { throw logger.logExceptionAsError(new IllegalArgumentException("The name of the field cannot be null")); } this.dataType = Objects.requireNonNull(dataType, "'dataType' cannot be null."); this.name = name; }
Source:
public Map<?, ?> read() { final Yaml yaml = new Yaml(); final Map<String, String> properties = new HashMap<>(); try (InputStream in = inputStream) { yaml.loadAll(in).forEach((Object obj) -> this.loadValue(properties, "", obj)); return properties; } catch (IOException e) { throw new IllegalStateException("Cannot load environment", e); } }

Target:
public Map<?, ?> read() { final YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean(); try (InputStream in = inputStream) { yaml.setResources(new InputStreamResource(inputStream)); return yaml.getObject(); } catch (IOException e) { throw new IllegalStateException("Cannot load environment", e); } }
Source:
private static String createOrUpdateAccountsAndWait(Collection<Account> accounts) throws Exception { String jsonFilePath = tempDirPath + File.separator + UUID.randomUUID().toString() + ".json"; writeAccountsToFile(accounts, jsonFilePath); int numOfAccounts = AccountUpdater.createOrUpdate(jsonFilePath, ZK_SERVER_ADDRESS, HELIX_STORE_ROOT_PATH, null, null); Thread.sleep(100); return numOfAccounts == -1 ? null : jsonFilePath; }

Target:
private static void createOrUpdateAccountsAndWait(Collection<Account> accounts) throws Exception { String jsonFilePath = tempDirPath + File.separator + UUID.randomUUID().toString() + ".json"; writeAccountsToFile(accounts, jsonFilePath); AccountUpdateTool.updateAccount(jsonFilePath, ZK_SERVER_ADDRESS, HELIX_STORE_ROOT_PATH, 2000, 2000); Thread.sleep(100); }
Source:
private Integer extractCount(HttpServletRequest request) { Integer count = Integer.valueOf(getParameter(request, "count")); checkArgument(COUNT_RANGE.contains(count), "'count' must be in range %s, was %s", COUNT_RANGE, count); return count; }

Target:
private Integer extractCount(HttpServletRequest request) { Integer count = Integer.valueOf(getParameter(request, COUNT_PARAM)); checkArgument(COUNT_RANGE.contains(count), "'count' must be between %s and %s, was %s", COUNT_RANGE.lowerEndpoint(), COUNT_RANGE.upperEndpoint(), count); return count; }
Source:
private void dismissToast() { try { toast.cancel(); } catch (NullPointerException e) { ZLog.logException(e); } }

Target:
private void dismissToast() { if (toast != null) { toast.cancel(); } }
Source:
public boolean hasDeploymentSubModel(final String subsystemName, final PathElement address) { final Resource root = deploymentUnit.getAttachment(DEPLOYMENT_RESOURCE); final PathElement subsystem = PathElement.pathElement(SUBSYSTEM, subsystemName); return root.hasChild(subsystem) && root.getChild(subsystem).hasChild(address); }

Target:
public boolean hasDeploymentSubModel(final String subsystemName, final PathElement address) { final Resource root = deploymentUnit.getAttachment(DEPLOYMENT_RESOURCE); final PathElement subsystem = PathElement.pathElement(SUBSYSTEM, subsystemName); return root.hasChild(subsystem) && (address == null || root.getChild(subsystem).hasChild(address)); }
Source:
void scheduleKeepAliveHeartbeat() { Scheduler.get().scheduleFixedDelay(new RepeatingCommand() { @Override public boolean execute() { boolean sessionInUse = restApiSessionId != null; if (sessionInUse && refreshRestApiSession) { sendRequest(createRequest(engineAuthToken), new RestApiRequestCallback()); refreshRestApiSession = false; } return sessionInUse; } }, SESSION_HEARTBEAT_MS); }

Target:
void scheduleKeepAliveHeartbeat() { Scheduler.get().scheduleFixedDelay(new RepeatingCommand() { @Override public boolean execute() { boolean sessionInUse = restApiSessionId != null; if (sessionInUse && refreshRestApiSession) { sendRequest(createRequest(), new RestApiRequestCallback()); refreshRestApiSession = false; } return sessionInUse; } }, SESSION_HEARTBEAT_MS); }
Source:
public void marriedKeychainBloomFilter() throws Exception { wallet = new Wallet(params); blockStore = new MemoryBlockStore(params); chain = new BlockChain(params, wallet, blockStore); String XPUB = "xpub68KFnj3bqUx1s7mHejLDBPywCAKdJEu1b49uniEEn2WSbHmZ7xbLqFTjJbtx1LUcAt1DwhoqWHmo2s5WMJp6wi38CiF2hYD49qVViKVvAoi"; wallet.addFollowingAccounts(ImmutableList.of(DeterministicKey.deserializeB58(null, XPUB))); Address address = wallet.currentReceiveAddress(); assertTrue(wallet.getBloomFilter(1e-12).contains(address.getHash160())); Transaction t1 = createFakeTx(params, CENT, address); StoredBlock b1 = createFakeBlock(blockStore, t1).storedBlock; TransactionOutPoint outPoint = new TransactionOutPoint(params, 0, t1); assertFalse(wallet.getBloomFilter(1e-12).contains(outPoint.bitcoinSerialize())); wallet.receiveFromBlock(t1, b1, BlockChain.NewBlockType.BEST_CHAIN, 0); assertTrue(wallet.getBloomFilter(1e-12).contains(outPoint.bitcoinSerialize())); }

Target:
public void marriedKeychainBloomFilter() throws Exception { wallet = new Wallet(params); blockStore = new MemoryBlockStore(params); chain = new BlockChain(params, wallet, blockStore); String XPUB = "xpub68KFnj3bqUx1s7mHejLDBPywCAKdJEu1b49uniEEn2WSbHmZ7xbLqFTjJbtx1LUcAt1DwhoqWHmo2s5WMJp6wi38CiF2hYD49qVViKVvAoi"; wallet.addFollowingAccountKeys(ImmutableList.of(DeterministicKey.deserializeB58(null, XPUB))); Address address = wallet.currentReceiveAddress(); assertTrue(wallet.getBloomFilter(0.001).contains(address.getHash160())); Transaction t1 = createFakeTx(params, CENT, address); StoredBlock b1 = createFakeBlock(blockStore, t1).storedBlock; TransactionOutPoint outPoint = new TransactionOutPoint(params, 0, t1); assertFalse(wallet.getBloomFilter(0.001).contains(outPoint.bitcoinSerialize())); wallet.receiveFromBlock(t1, b1, BlockChain.NewBlockType.BEST_CHAIN, 0); assertTrue(wallet.getBloomFilter(0.001).contains(outPoint.bitcoinSerialize())); }
Source:
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { IMonitorControl monitor = null; if (receiver instanceof IMonitorControl) { monitor = (IMonitorControl) receiver; } else { if (selectedMonitorId != null) { monitor = MonitorControlManager.getInstance().getMonitorControl(selectedMonitorId); } } if (monitor != null) { if (IS_ACTIVE.equals(property)) { return monitor.isActive() == toBoolean(expectedValue); } } return false; }

Target:
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { IMonitorControl monitor = null; if (receiver instanceof IMonitorControl) { monitor = (IMonitorControl) receiver; } else if (selectedMonitorId != null) { monitor = MonitorControlManager.getInstance().getMonitorControl(selectedMonitorId); } if (monitor != null && IS_ACTIVE.equals(property)) { return monitor.isActive() == toBoolean(expectedValue); } return false; }
Source:
public WorkspaceConfigImpl devFileToWorkspaceConfig(Devfile devfile) throws DevfileFormatException { validateCurrentVersion(devfile); WorkspaceConfigImpl config = new WorkspaceConfigImpl(); config.setName(devfile.getName()); List<ProjectConfigImpl> projects = new ArrayList<>(); devfile.getProjects().forEach(project -> projects.add(devProjectToProjectConfig(project))); config.setProjects(projects); Map<String, String> attributes = new HashMap<>(); StringJoiner pluginsStringJoiner = new StringJoiner(","); StringJoiner toolIdToNameMappingStringJoiner = new StringJoiner(","); for (Tool tool : devfile.getTools()) { switch (tool.getType()) { case EDITOR_TOOL_TYPE: attributes.put(WORKSPACE_TOOLING_EDITOR_ATTRIBUTE, tool.getId()); break; case PLUGIN_TOOL_TYPE: pluginsStringJoiner.add(tool.getId()); break; case KUBERNETES_TOOL_TYPE: continue; default: throw new DevfileFormatException( format("Unsupported tool %s type provided: %s", tool.getName(), tool.getType())); } toolIdToNameMappingStringJoiner.add(tool.getId() + "=" + tool.getName()); } if (pluginsStringJoiner.length() > 0) { attributes.put(WORKSPACE_TOOLING_PLUGINS_ATTRIBUTE, pluginsStringJoiner.toString()); } if (toolIdToNameMappingStringJoiner.length() > 0) { attributes.put(ALIASES_WORKSPACE_ATTRIBUTE_NAME, toolIdToNameMappingStringJoiner.toString()); } config.setAttributes(attributes); List<CommandImpl> commands = new ArrayList<>(); devfile .getCommands() .forEach(command -> commands.addAll(devCommandToCommandImpls(devfile, command))); config.setCommands(commands); return config; }

Target:
public WorkspaceConfigImpl devFileToWorkspaceConfig(Devfile devfile) throws DevfileFormatException { validateCurrentVersion(devfile); WorkspaceConfigImpl config = new WorkspaceConfigImpl(); config.setName(devfile.getName()); List<ProjectConfigImpl> projects = new ArrayList<>(); devfile.getProjects().forEach(project -> projects.add(devProjectToProjectConfig(project))); config.setProjects(projects); Map<String, String> attributes = new HashMap<>(); StringJoiner pluginsStringJoiner = new StringJoiner(","); StringJoiner toolIdToNameMappingStringJoiner = new StringJoiner(","); for (Tool tool : devfile.getTools()) { switch (tool.getType()) { case EDITOR_TOOL_TYPE: attributes.put(WORKSPACE_TOOLING_EDITOR_ATTRIBUTE, tool.getId()); break; case PLUGIN_TOOL_TYPE: pluginsStringJoiner.add(tool.getId()); break; case KUBERNETES_TOOL_TYPE: case OPENSHIFT_TOOL_TYPE: continue; default: throw new DevfileFormatException( format("Unsupported tool %s type provided: %s", tool.getName(), tool.getType())); } toolIdToNameMappingStringJoiner.add(tool.getId() + "=" + tool.getName()); } if (pluginsStringJoiner.length() > 0) { attributes.put(WORKSPACE_TOOLING_PLUGINS_ATTRIBUTE, pluginsStringJoiner.toString()); } if (toolIdToNameMappingStringJoiner.length() > 0) { attributes.put(ALIASES_WORKSPACE_ATTRIBUTE_NAME, toolIdToNameMappingStringJoiner.toString()); } config.setAttributes(attributes); List<CommandImpl> commands = new ArrayList<>(); devfile .getCommands() .forEach(command -> commands.addAll(devCommandToCommandImpls(devfile, command))); config.setCommands(commands); return config; }
Source:
public void testGetTaskRawFormViaUIClient() throws Exception { long processInstanceId = processClient.startProcess(CONTAINER_ID, HIRING_2_PROCESS_ID); assertThat(processInstanceId).isGreaterThan(0); try { List<TaskSummary> tasks = taskClient.findTasksByStatusByProcessInstanceId(processInstanceId, null, 0, 10); assertThat(tasks).isNotNull().hasSize(1); Long taskId = tasks.get(0).getId(); String result = uiServicesClient.getTaskRawForm( CONTAINER_ID, taskId ); logger.debug("Form content is '{}'", result); assertThat(result).isNotNull().isNotEmpty(); } finally { processClient.abortProcessInstance(CONTAINER_ID, processInstanceId); } }

Target:
public void testGetTaskRawFormViaUIClient() throws Exception { long processInstanceId = processClient.startProcess(CONTAINER_ID, HIRING_2_PROCESS_ID); assertThat(processInstanceId).isGreaterThan(0); try { List<TaskSummary> tasks = taskClient.findTasksByStatusByProcessInstanceId(processInstanceId, null, 0, 10); assertThat(tasks).isNotNull().hasSize(1); Long taskId = tasks.get(0).getId(); changeUser(USER_JOHN); String result = uiServicesClient.getTaskRawForm(CONTAINER_ID, taskId); logger.debug("Form content is '{}'", result); assertThat(result).isNotNull().isNotEmpty(); } finally { changeUser(USER_YODA); processClient.abortProcessInstance(CONTAINER_ID, processInstanceId); } }
Source:
private void buyCard(GameUserBean gameUser, GameBean game, Map<String, String> returnedParams) throws PlayException, GameException { DevelopmentCards availableDevelopmentCards = game.getAvailableDevelopmentCards(); DevelopmentCard obtainedDevelopmentCard = cardUtil.pullDevelopmentCard(availableDevelopmentCards); DevelopmentCards usersDevelopmentCards = gameUser.getDevelopmentCards(); usersDevelopmentCards.increaseQuantityByOne(obtainedDevelopmentCard); availableDevelopmentCards.decreaseQuantityByOne(obtainedDevelopmentCard); returnedParams.put("card", obtainedDevelopmentCard.name()); }

Target:
private void buyCard(GameUserBean gameUser, GameBean game, Map<String, String> returnedParams) throws PlayException, GameException { DevelopmentCards availableDevelopmentCards = game.getAvailableDevelopmentCards(); DevelopmentCard chosenDevelopmentCard = cardUtil.chooseDevelopmentCard(availableDevelopmentCards); log.debug("Card " + chosenDevelopmentCard + " was chosen from the list: " + availableDevelopmentCards); DevelopmentCards usersDevelopmentCards = gameUser.getDevelopmentCards(); usersDevelopmentCards.increaseQuantityByOne(chosenDevelopmentCard); availableDevelopmentCards.decreaseQuantityByOne(chosenDevelopmentCard); returnedParams.put("card", chosenDevelopmentCard.name()); }
Source:
public void returnsCorrectInputWithStream() throws Exception { final byte[] bytes = new Utf8String("Stream returnsCorrectInput!").asBytes(); MatcherAssert.assertThat( "Stream doesn't provide correct bytes", new BytesOf( new Body.Stream(new InputOf(bytes).stream()) ).asBytes(), new IsEqual<>(bytes) ); }

Target:
public void returnsCorrectInputWithStream() throws Exception { final byte[] bytes = new Utf8String("Stream returnsCorrectInput!").asBytes(); MatcherAssert.assertThat( "Body content of Body.Stream doesn't provide the correct bytes", new BytesOf( new Body.Stream(new InputOf(bytes).stream()) ).asBytes(), new IsEqual<>(bytes) ); }
Source:
private void handleSelectorEvents(List<ResponseInfo> responseInfoList) { long handleSelectorEventsStartTimeMs = System.currentTimeMillis(); for (String connId : selector.connected()) { connectionTracker.checkInConnection(connId); } List<String> disconnectedList = selector.disconnected(); networkMetrics.connectionsDisconnectedCount.mark(disconnectedList.size()); for (String connId : disconnectedList) { connectionTracker.removeConnection(connId); RequestMetadata requestMetadata = connectionIdToRequestInFlight.remove(connId); if (requestMetadata != null) { responseInfoList .add(new ResponseInfo(requestMetadata.requestInfo.getRequest(), NetworkClientErrorCode.NetworkError, null)); } } for (NetworkReceive recv : selector.completedReceives()) { String connId = recv.getConnectionId(); connectionTracker.checkInConnection(connId); RequestMetadata requestMetadata = connectionIdToRequestInFlight.remove(connId); responseInfoList .add(new ResponseInfo(requestMetadata.requestInfo.getRequest(), null, recv.getReceivedBytes().getPayload())); requestMetadata.onResponseReceive(); } networkMetrics.handleSelectorEventsTime.update(System.currentTimeMillis() - handleSelectorEventsStartTimeMs); }

Target:
private void handleSelectorEvents(List<ResponseInfo> responseInfoList) { for (String connId : selector.connected()) { connectionTracker.checkInConnection(connId); } for (String connId : selector.disconnected()) { connectionTracker.removeConnection(connId); RequestMetadata requestMetadata = connectionIdToRequestInFlight.remove(connId); if (requestMetadata != null) { responseInfoList .add(new ResponseInfo(requestMetadata.requestInfo.getRequest(), NetworkClientErrorCode.NetworkError, null)); } } for (NetworkReceive recv : selector.completedReceives()) { String connId = recv.getConnectionId(); connectionTracker.checkInConnection(connId); RequestMetadata requestMetadata = connectionIdToRequestInFlight.remove(connId); responseInfoList .add(new ResponseInfo(requestMetadata.requestInfo.getRequest(), null, recv.getReceivedBytes().getPayload())); requestMetadata.onResponseReceive(); } }
Source:
public Void visitInstanceOf(InstanceOfTree node, Void p) { if (node.getType().getKind() == Kind.ANNOTATED_TYPE) { AnnotatedTypeMirror type = atypeFactory.fromExpression((ExpressionTree) node.getType()); if (type.hasAnnotation(Nullable.class)) { checker.reportError(node, "instanceof.nullable.error"); } if (type.hasAnnotation(NonNull.class)) { checker.reportWarning(node, "instanceof.nonnull.redundant"); } } return super.visitInstanceOf(node, p); }

Target:
public Void visitInstanceOf(InstanceOfTree node, Void p) { Tree refTypeTree = node.getType(); if (refTypeTree.getKind() == Kind.ANNOTATED_TYPE) { List<? extends AnnotationMirror> annotations = TreeUtils.annotationsFromTree((AnnotatedTypeTree) refTypeTree); if (AnnotationUtils.containsSame(annotations, NULLABLE)) { checker.reportError(node, "instanceof.nullable"); } if (AnnotationUtils.containsSame(annotations, NONNULL)) { checker.reportWarning(node, "instanceof.nonnull.redundant"); } } return super.visitInstanceOf(node, p); }
Source:
public void onStartup(ServletContext servletContext) { LongTaskTimer longTaskTimer = LongTaskTimer .builder("spring.cloud.dataflow.server").description("DataFlow duration timer") .tags(Tags.empty()).register(Metrics.globalRegistry); this.longTaskSample = longTaskTimer.start(); if (StringUtils.hasText(dataSourceUrl) && dataSourceUrl.startsWith("jdbc:h2:tcp://localhost:")) { logger.info("Start Embedded H2"); initH2TCPServer(); } }

Target:
public void onStartup(ServletContext servletContext) { LongTaskTimer longTaskTimer = LongTaskTimer .builder("spring.cloud.dataflow.server").description("Spring Cloud Data Flow duration timer") .tags(Tags.empty()).register(Metrics.globalRegistry); this.longTaskSample = longTaskTimer.start(); if (StringUtils.hasText(dataSourceUrl) && dataSourceUrl.startsWith("jdbc:h2:tcp://localhost:")) { logger.info("Start Embedded H2"); initH2TCPServer(); } }