ContentFeatureSource throws an unhandled NullPointerException when its namespace URI input argument (name.getNamespaceURI()) evaluates to null. The NPE can be triggered by featureSource.getInfo().getSchema() on the Shapefile or ShapefileDirectory DataStore.
Relevant code is in ContentFeatureSource.getSchema() shown below. the name.getNamespaceURI() code should be tested for null before passing it into the URI constructor to avoid a NPE:
Other similar classes having similar code which should probably also receive this fix are org.geotools.data.view.DefaultView, org.geotools.data.transform.DefaultResourceInfo, and org.geotools.data.wfs.impl.WFSContentComplexFeatureSource (although it's unsupported).
To reproduce, execute the following code: