} catch (DataSourceException e) { notFound = true; assertTrue(e.getMessage().startsWith("Feature type " + typeName + " not found")); } catch (DataSourceException e) { notFound = true; assertTrue(e.getMessage().startsWith("Feature type " + typeName + " not found"));
/** * Test that asking for a nonexistent type causes an excception to be thrown with the correct * number of type names in the detail message. * * @throws Exception */ @Test public void testThrowDataSourceException() throws Exception { Name typeName = Types.typeName(GSMLNS, "DoesNotExist"); boolean handledException = false; try { AppSchemaDataAccessRegistry.getMappingByElement(typeName); } catch (DataSourceException e) { LOGGER.info(e.toString()); handledException = true; assertTrue(e.getMessage().startsWith("Feature type " + typeName + " not found")); } assertTrue( "Expected a DataSourceException to have been thrown and handled", handledException); }
} catch (DataSourceException e) { assertTrue( e.getMessage() .startsWith( "Duplicate mappingName or targetElement across FeatureTypeMapping instances detected.")); } catch (DataSourceException e) { assertTrue( e.getMessage() .startsWith( "Duplicate mappingName or targetElement across FeatureTypeMapping instances detected.")); } catch (DataSourceException e) { assertTrue( e.getMessage() .startsWith( "Duplicate mappingName or targetElement across FeatureTypeMapping instances detected."));
public static GridCoverage2D openGeoTiffFile(String filePath) { GridCoverage2D gc2D = null; try { File gridFile = new File(filePath); Hints hints = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE); GeoTiffReader reader = new GeoTiffReader(gridFile, hints); try { gc2D = reader.read(null); } catch (IOException e) { LOGGER.log(Level.FINE, e.getMessage(), e); } } catch (DataSourceException e) { LOGGER.log(Level.FINE, e.getMessage(), e); } return gc2D; }
private GTRasterDataBinding parseTiff(File file){ JAI.getDefaultInstance().getTileCache().setMemoryCapacity(256*1024*1024); Hints hints = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE); GeoTiffReader reader; try { reader = new GeoTiffReader(file, hints); GridCoverage2D coverage = (GridCoverage2D) reader.read(null); return new GTRasterDataBinding(coverage); } catch (DataSourceException e) { LOGGER.error(e.getMessage(), e); throw new RuntimeException(e); } catch (IOException e) { LOGGER.error(e.getMessage(), e); throw new RuntimeException(e); } }
LOGGER.error(e.getMessage()); throw new IOException("AsciiGRID cannot be read from source"); } catch (IllegalArgumentException e) {
} catch (DataSourceException e) { notFound = true; assertTrue(e.getMessage().startsWith("Feature type " + typeName + " not found")); } catch (DataSourceException e) { notFound = true; assertTrue(e.getMessage().startsWith("Feature type " + typeName + " not found"));
/** * Test that asking for a nonexistent type causes an excception to be thrown with the correct * number of type names in the detail message. * * @throws Exception */ @Test public void testThrowDataSourceException() throws Exception { Name typeName = Types.typeName(GSMLNS, "DoesNotExist"); boolean handledException = false; try { AppSchemaDataAccessRegistry.getMappingByElement(typeName); } catch (DataSourceException e) { LOGGER.info(e.toString()); handledException = true; assertTrue(e.getMessage().startsWith("Feature type " + typeName + " not found")); } assertTrue("Expected a DataSourceException to have been thrown and handled", handledException); }
} catch (DataSourceException e) { assertTrue(e .getMessage() .startsWith( "Duplicate mappingName or targetElement across FeatureTypeMapping instances detected.")); } catch (DataSourceException e) { assertTrue(e .getMessage() .startsWith( "Duplicate mappingName or targetElement across FeatureTypeMapping instances detected.")); } catch (DataSourceException e) { assertTrue(e .getMessage() .startsWith( "Duplicate mappingName or targetElement across FeatureTypeMapping instances detected."));