Problem using readPixels on subset product

I have an Sentinel3 product which I want to subset it to a region using geoRegion in snappy. After I do that I want to set some flags to bands 17 and 21. When I read band17 and I want to write a new array I got the famous error:

RuntimeError: java.lang.NullPointerException

Here is part of my code, the most important one

####create Subset operator to subset the product

parSub1 = HashMap()
parSub1.put(‘bandNames’, ‘Oa01_radiance,Oa02_radiance,Oa03_radiance,Oa04_radiance,Oa05_radiance,Oa06_radiance,Oa07_radiance,Oa08_radiance,Oa09_radiance,Oa10_radiance,Oa11_radiance,Oa12_radiance,Oa13_radiance,Oa14_radiance,Oa15_radiance,Oa16_radiance,Oa17_radiance,Oa18_radiance,Oa19_radiance,Oa20_radiance,Oa21_radiance,quality_flags’)
parSub1.put(‘copyMetadata’, ‘true’)
parSub1.put(‘geoRegion’, ‘POLYGON ((20.50 48.00, 29.50 48.00, 29.50 43.00, 20.50 43.00, 20.50 48.00, 20.50 48.00))’)

outSubset = GPF.createProduct(‘Subset’, parSub1, product)

#####Reproject Operator

parProj = HashMap()
parProj.put(‘crs’, ‘PROJCS[“Dealul Piscului 1970/ Stereo 70”, GEOGCS[“Dealul Piscului 1970”, DATUM[“Dealul Piscului 1970”, SPHEROID[“Krassowsky 1940”, 6378245.0, 298.3, AUTHORITY[“EPSG”,“7024”]], TOWGS84[28.0, -121.0, -77.0, 0.0, 0.0, 0.0, 0.0], AUTHORITY[“EPSG”,“6317”]], PRIMEM[“Greenwich”, 0.0, AUTHORITY[“EPSG”,“8901”]], UNIT[“degree”, 0.017453292519943295], AXIS[“Geodetic longitude”, EAST], AXIS[“Geodetic latitude”, NORTH], AUTHORITY[“EPSG”,“4317”]], PROJECTION[“Oblique_Stereographic”, AUTHORITY[“EPSG”,“9809”]], PARAMETER[“central_meridian”, 25.0], PARAMETER[“latitude_of_origin”, 46.0], PARAMETER[“scale_factor”, 0.99975], PARAMETER[“false_easting”, 500000.0], PARAMETER[“false_northing”, 500000.0], UNIT[“m”, 1.0], AXIS[“Easting”, EAST], AXIS[“Northing”, NORTH], AUTHORITY[“EPSG”,“31700”]]’)

parProj.put(‘resampling’, ‘Nearest’)
parProj.put(‘orthorectify’, ‘false’)
parProj.put(‘noDataValue’, ‘NaN’)
parProj.put(‘includeTiePointGrids’, ‘true’)
parProj.put(‘addDeltaBands’, ‘false’)
parProj.put(‘preserveResolution’, ‘true’)

OutReproj = GPF.createProduct(‘Reproject’, parProj, outSubset)

####read band17 and set the FLAGS
b17 = OutReproj.getBand(‘Oa17_reflectance’)
band17=np.zeros(w*h, np.dtype(‘float32’))
b17.readPixels(0,0,w,h,band17)

b17.setValidPixelExpression(FLAGS)
b17.getValidMaskExpression()


I also attach a screenshot. Somebody knows why? I suppose that is from the subset operator and the origin because when I use the same script without the subset operator everything is ok.

Cheers,
G.