public InvalidMappingException(Origin origin) { super( String.format( "Could not parse mapping document: %s (%s)", origin.getName(), origin.getType() ), origin ); this.origin = origin; }
@Override public String getMessage() { String message = super.getMessage(); if (origin != null) { message += " : origin(" + origin.getName() + ")"; } return message; }
public MappingNotFoundException(Throwable root, Origin origin) { super( String.format( "Mapping (%s) not found : %s", origin.getType(), origin.getName() ), root, origin ); } }
public MappingNotFoundException(Origin origin) { super( String.format( "Mapping (%s) not found : %s", origin.getType(), origin.getName() ), origin ); }
/** * Constructs an InvalidMappingException using the given information. * * @param customMessage The custom message explaining the exception condition * @param origin The origin of the invalid mapping document */ public InvalidMappingException(String customMessage, Origin origin) { this( customMessage, origin.getType().getLegacyTypeText(), origin.getName() ); }
public CacheableFileXmlSource(Origin origin, File xmlFile, boolean strict) { super( origin ); this.xmlFile = xmlFile; this.strict = strict; this.serFile = determineCachedFile( xmlFile ); if ( strict ) { if ( !serFile.exists() ) { throw new MappingException( String.format( "Cached file [%s] could not be found", origin.getName() ), origin ); } if ( isSerfileObsolete() ) { throw new MappingException( String.format( "Cached file [%s] could not be used as the mapping file is newer", origin.getName() ), origin ); } } }
public Binding bind(File file) { final Origin origin = new Origin( SourceType.FILE, file.getPath() ); LOG.tracef( "reading mappings from file : %s", origin.getName() ); if ( !file.exists() ) { throw new MappingNotFoundException( origin ); } return new FileXmlSource( origin, file ).doBind( getMappingBinder() ); }
"Unable to perform unmarshalling at line number " + handler.getLineNumber() + " and column " + handler.getColumnNumber() + " in " + origin.getType().name() + " " + origin.getName() + ". Message: " + handler.getMessage(), e );
assertEquals( e.getOrigin().getName(), "completelybogus.hbm.xml" ); assertEquals( e.getOrigin().getName(), "completelybogus.hbm.xml" ); assertEquals( e.getOrigin().getName(), "org/hibernate/Hibernate.hbm.xml" ); assertEquals( e.getOrigin().getName(), "completelybogus.hbm.xml" ); assertEquals( e.getOrigin().getName(), "completelybogus.hbm.xml" ); assertEquals( null, e.getOrigin().getName() ); assertEquals( e.getOrigin().getName(), "nothere" ); assertEquals( e.getOrigin().getName(), "nothere" ); assertEquals( e.getOrigin().getName(), "file://nothere" ); assertEquals( me.getOrigin().getName(), "file://nothere" );
@Override public String getMessage() { String message = super.getMessage(); if (origin != null) { message += " : origin(" + origin.getName() + ")"; } return message; }
public InvalidMappingException(Origin origin) { super( String.format( "Could not parse mapping document: %s (%s)", origin.getName(), origin.getType() ), origin ); this.origin = origin; }
public MappingNotFoundException(Throwable root, Origin origin) { super( String.format( "Mapping (%s) not found : %s", origin.getType(), origin.getName() ), root, origin ); } }
public MappingNotFoundException(Origin origin) { super( String.format( "Mapping (%s) not found : %s", origin.getType(), origin.getName() ), origin ); }
/** * Constructs an InvalidMappingException using the given information. * * @param customMessage The custom message explaining the exception condition * @param origin The origin of the invalid mapping document */ public InvalidMappingException(String customMessage, Origin origin) { this( customMessage, origin.getType().getLegacyTypeText(), origin.getName() ); }
public CacheableFileXmlSource(Origin origin, File xmlFile, boolean strict) { super( origin ); this.xmlFile = xmlFile; this.strict = strict; this.serFile = determineCachedFile( xmlFile ); if ( strict ) { if ( !serFile.exists() ) { throw new MappingException( String.format( "Cached file [%s] could not be found", origin.getName() ), origin ); } if ( isSerfileObsolete() ) { throw new MappingException( String.format( "Cached file [%s] could not be used as the mapping file is newer", origin.getName() ), origin ); } } }
MappingNotFoundException mnf = (MappingNotFoundException)re; Origin origin = mnf.getOrigin(); return "A " + origin.getType() + " located at " + origin.getName() + " was not found.\n" + "Check the following:\n" + "\n" + "1) Is the spelling/casing correct ?\n" + "2) Is " + mnf.getOrigin().getName() + " available via the classpath ?\n" + "3) Does it actually exist ?\n";
public Binding bind(File file) { final Origin origin = new Origin( SourceType.FILE, file.getPath() ); LOG.tracef( "reading mappings from file : %s", origin.getName() ); if ( !file.exists() ) { throw new MappingNotFoundException( origin ); } return new FileXmlSource( origin, file ).doBind( getMappingBinder() ); }