/** * Returns the Java type for the given SQL type name. * * @param sqlTypeName SQL type name (e.g. numeric). * @return The suitable Java type. * @throws MappingException The SQL type is not recognized. */ public static Class<?> sqlTypeName2javaType(final String sqlTypeName) throws MappingException { for (int i = 0; i < TYPEINFO.length; ++i) { if (sqlTypeName.equals(TYPEINFO[i]._sqlTypeName)) { return TYPEINFO[i]._javaType; } } throw new MappingException("jdo.sqlTypeNotSupported", sqlTypeName); }
public MappingException(String message, Exception e) { super(Messages.message(message)); setException(e); }
LOG.error(e1.getMessage()); return null; LOG.error(e.getMessage()); _loopCache.remove(type); return null;
throw new OpenClinicaSystemException(e.getMessage(), e.getCause()); } catch (MappingException e) { throw new OpenClinicaSystemException(e.getMessage(), e.getCause()); } catch (Exception e) { throw new OpenClinicaSystemException(e.getMessage(), e.getCause());
private void openDB() { try { JDOManager.loadConfiguration (_dbConf, ClassLoader.getSystemClassLoader()); _jdo = JDOManager.createInstance(_dbName); //only to try a connection _jdo.getDatabase(); } catch (MappingException pe) { pe.printStackTrace(); System.exit(1); } catch (org.exolab.castor.jdo.PersistenceException pe) { pe.printStackTrace(); System.exit(1); } }
public final void afterPropertiesSet() throws IOException { if (mappingLocations != null && targetClass != null) { throw new IllegalArgumentException("Cannot set both the 'mappingLocations' and 'targetClass' property. " + "Set targetClass for unmarshalling a single class, and 'mappingLocations' for multiple classes'"); } if (logger.isInfoEnabled()) { if (mappingLocations != null) { logger.info("Configured using " + StringUtils.arrayToCommaDelimitedString(mappingLocations)); } else if (targetClass != null) { logger.info("Configured for target class [" + targetClass.getName() + "]"); } else { logger.info("Using default configuration"); } } try { xmlContext = createXMLContext(mappingLocations, targetClass); } catch (MappingException ex) { throw new CastorSystemException("Could not load Castor mapping: " + ex.getMessage(), ex); } catch (ResolverException rex) { throw new CastorSystemException("Could not load Castor mapping: " + rex.getMessage(), rex); } }
e1.printStackTrace(); } catch (MappingException e1) { e1.printStackTrace(); } catch (MarshalException e) { e.printStackTrace();
/** * Get list of mapping sources to resolve. * * @return List of mapping sources to resolve. * @throws MappingException If no mapping source has been loaded previously. */ public List getMappingSources() throws MappingException { if (_mappings.size() == 0) { throw new MappingException("Must call loadMapping first"); } return Collections.unmodifiableList(_mappings); }
/** * Returns the value of the field from the object. * * @param object The object * @return The value of the field * @throws IllegalStateException The Java object has changed and is no longer supported by this * handler, or the handler is not compatiable with the Java object */ public final Object getValue(Object object) throws IllegalStateException { if (_handler == null) { throw new IllegalStateException(NULL_HANDLER_ERR); } Object value = _handler.getValue(object); if ((_autoCollectionIteration) && (value != null)) { if (value instanceof java.util.Enumeration) { return new GFHConverterEnumeration(this, (Enumeration) value); } // -- other collection type? if (CollectionHandlers.hasHandler(value.getClass())) { CollectionHandler colHandler = null; try { colHandler = CollectionHandlers.getHandler(value.getClass()); } catch (MappingException mx) { throw new IllegalStateException(mx.getMessage()); } return new GFHConverterEnumeration(this, colHandler.elements(value)); } } return convertUponGet(value); } // -- getValue
public MappingException( String message, Exception e ) { super( Messages.message( message ) ); setException (e); }
/** * Sets the iteration method. */ public void setIterMethod(Method method) throws MappingException { if ((method.getModifiers() & Modifier.PUBLIC) == 0 || (method.getModifiers() & Modifier.STATIC) != 0) throw new MappingException("mapping.accessorNotAccessible", method, method.getDeclaringClass().getName()); if (method.getParameterTypes().length != 0) throw new MappingException("mapping.readMethodHasParam", method, method.getDeclaringClass().getName()); _iterMethod = method; }
throw new IllegalStateException(mx.getMessage());
/** * Sets the enumeration method. */ public void setEnumMethod(Method method) throws MappingException { if ((method.getModifiers() & Modifier.PUBLIC) == 0 || (method.getModifiers() & Modifier.STATIC) != 0) throw new MappingException("mapping.accessorNotAccessible", method, method.getDeclaringClass().getName()); if (method.getParameterTypes().length != 0) throw new MappingException("mapping.readMethodHasParam", method, method.getDeclaringClass().getName()); _enumMethod = method; }
throw new PersistenceException(e.getMessage()); } catch (MappingException e) { throw new PersistenceException(e.getMessage());
/** * Returns the Java type for the given SQL type. * * @param sqlTypeNum SQL type name (see JDBC API) * @return The suitable Java type * @throws MappingException The SQL type is not recognized. */ public static Class<?> sqlTypeNum2javaType(final int sqlTypeNum) throws MappingException { for (int i = 0; i < TYPEINFO.length; ++i) { if (sqlTypeNum == TYPEINFO[i]._sqlTypeNum) { return TYPEINFO[i]._javaType; } } throw new MappingException("jdo.sqlTypeNotSupported", new Integer(sqlTypeNum)); }
/** * Returns the SQL type name for the given SQL type number. * * @param sqlTypeNum SQL type name (see JDBC API) * @return The SQL type name. * @throws MappingException The SQL type is not recognized. */ public static String sqlTypeNum2sqlTypeName(final int sqlTypeNum) throws MappingException { for (int i = 0; i < TYPEINFO.length; ++i) { if (sqlTypeNum == TYPEINFO[i]._sqlTypeNum) { return TYPEINFO[i]._sqlTypeName; } } throw new MappingException("jdo.sqlTypeNotSupported", new Integer(sqlTypeNum)); }
/** * Mutator method used by {@link org.exolab.castor.xml.Introspector}. Please understand how this * method is used before you start playing with it! :-) */ public void setWriteMethod(Method method) throws MappingException { if ((method.getModifiers() & Modifier.PUBLIC) == 0 || (method.getModifiers() & Modifier.STATIC) != 0) throw new MappingException("mapping.accessorNotAccessible", method, method.getDeclaringClass().getName()); if (method.getParameterTypes().length != 1) throw new MappingException("mapping.writeMethodNoParam", method, method.getDeclaringClass().getName()); _setMethod = method; }
/** * Mutator method used by {@link org.exolab.castor.xml.Introspector}. Please understand how this * method is used before you start playing with it! :-) */ public void setReadMethod(Method method) throws MappingException { if ((method.getModifiers() & Modifier.PUBLIC) == 0 || (method.getModifiers() & Modifier.STATIC) != 0) throw new MappingException("mapping.accessorNotAccessible", method, method.getDeclaringClass().getName()); if (method.getParameterTypes().length != 0) throw new MappingException("mapping.readMethodHasParam", method, method.getDeclaringClass().getName()); _getMethod = method; }
/** * Mutator method used by {@link AbstractMappingLoader} and * {@link org.exolab.castor.xml.Introspector}. Please understand how this method is used before * you start playing with it! :-) */ public void setCreateMethod(Method method) throws MappingException { if ((method.getModifiers() & Modifier.PUBLIC) == 0 || (method.getModifiers() & Modifier.STATIC) != 0) throw new MappingException("mapping.accessorNotAccessible", method, method.getDeclaringClass().getName()); if (method.getParameterTypes().length != 0) throw new MappingException("mapping.createMethodNoParam", method, method.getDeclaringClass().getName()); _createMethod = method; }
/** * Sets the enumeration method. */ public void setEnumMethod( Method method ) throws MappingException { if ( ( method.getModifiers() & Modifier.PUBLIC ) == 0 || ( method.getModifiers() & Modifier.STATIC ) != 0 ) throw new MappingException( "mapping.accessorNotAccessible", method, method.getDeclaringClass().getName() ); if ( method.getParameterTypes().length != 0 ) throw new MappingException( "mapping.readMethodHasParam", method, method.getDeclaringClass().getName() ); _enumMethod = method; }