javax.xml.bind.PropertyException Java Examples

The following examples show how to use javax.xml.bind.PropertyException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MarshallerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Object getProperty(String name) throws PropertyException {
    if( INDENT_STRING.equals(name) )
        return indent;
    if( ENCODING_HANDLER.equals(name) || ENCODING_HANDLER2.equals(name) )
        return escapeHandler;
    if( PREFIX_MAPPER.equals(name) )
        return prefixMapper;
    if( XMLDECLARATION.equals(name) )
        return !isFragment();
    if( XML_HEADERS.equals(name) )
        return header;
    if( C14N.equals(name) )
        return c14nSupport;
    if ( OBJECT_IDENTITY_CYCLE_DETECTION.equals(name))
            return serializer.getObjectIdentityCycleDetection();

    return super.getProperty(name);
}
 
Example #2
Source File: ZKHelper.java    From DBus with Apache License 2.0 6 votes vote down vote up
/**
 * read dbSourceName from ZK and set into DataSourceInfo
 *
 * @param dsInfo (in)
 * @return
 * @throws Exception
 */
public void loadDsNameAndOffset(DataSourceInfo dsInfo) throws Exception {
    // read dbSourceName
    String path = topologyRoot + "/" + Constants.DISPATCHER_RAW_TOPICS_PROPERTIES;
    Properties raw_topics = zkService.getProperties(path);
    String dbSourceName = raw_topics.getProperty(Constants.DISPATCHER_DBSOURCE_NAME);
    if (dbSourceName == null) {
        throw new PropertyException("配置参数文件内容不能为空! " + Constants.DISPATCHER_DBSOURCE_NAME);
    }

    String dataTopicOffset = raw_topics.getProperty(Constants.DISPATCHER_OFFSET);
    if (dataTopicOffset == null) {
        throw new PropertyException("配置参数文件内容不能为空! " + Constants.DISPATCHER_OFFSET);
    }

    dsInfo.setDbSourceName(dbSourceName);
    dsInfo.setDataTopicOffset(dataTopicOffset);
}
 
Example #3
Source File: MarshallerImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Object getProperty(String name) throws PropertyException {
    if( INDENT_STRING.equals(name) )
        return indent;
    if( ENCODING_HANDLER.equals(name) || ENCODING_HANDLER2.equals(name) )
        return escapeHandler;
    if( PREFIX_MAPPER.equals(name) )
        return prefixMapper;
    if( XMLDECLARATION.equals(name) )
        return !isFragment();
    if( XML_HEADERS.equals(name) )
        return header;
    if( C14N.equals(name) )
        return c14nSupport;
    if ( OBJECT_IDENTITY_CYCLE_DETECTION.equals(name))
            return serializer.getObjectIdentityCycleDetection();

    return super.getProperty(name);
}
 
Example #4
Source File: UnmarshallerImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void setProperty(String name, Object value) throws PropertyException {
    if(name.equals(FACTORY)) {
        coordinator.setFactories(value);
        return;
    }
    if(name.equals(IDResolver.class.getName())) {
        idResolver = (IDResolver)value;
        return;
    }
    if(name.equals(ClassResolver.class.getName())) {
        coordinator.classResolver = (ClassResolver)value;
        return;
    }
    if(name.equals(ClassLoader.class.getName())) {
        coordinator.classLoader = (ClassLoader)value;
        return;
    }
    super.setProperty(name, value);
}
 
Example #5
Source File: AbstractMarshallerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Default implementation of the getProperty method handles
 * the four defined properties in Marshaller.  If a provider
 * needs to support additional provider specific properties,
 * it should override this method in a derived class.
 */
public Object getProperty( String name )
    throws PropertyException {

    if( name == null ) {
        throw new IllegalArgumentException(
            Messages.format( Messages.MUST_NOT_BE_NULL, "name" ) );
    }

    // recognize and handle four pre-defined properties.
    if( JAXB_ENCODING.equals(name) )
        return getEncoding();
    if( JAXB_FORMATTED_OUTPUT.equals(name) )
        return isFormattedOutput()?Boolean.TRUE:Boolean.FALSE;
    if( JAXB_NO_NAMESPACE_SCHEMA_LOCATION.equals(name) )
        return getNoNSSchemaLocation();
    if( JAXB_SCHEMA_LOCATION.equals(name) )
        return getSchemaLocation();
    if( JAXB_FRAGMENT.equals(name) )
        return isFragment()?Boolean.TRUE:Boolean.FALSE;

    throw new PropertyException(name);
}
 
Example #6
Source File: InfluxSink.java    From DBus with Apache License 2.0 6 votes vote down vote up
public InfluxSink() throws IOException, PropertyException {
    Properties configProps = ConfUtils.getProps(CONFIG_PROPERTIES);
    String dbURL = configProps.getProperty(Constants.InfluxDB.DB_URL);
    String dbName = configProps.getProperty(Constants.InfluxDB.DB_NAME);
    tableName = configProps.getProperty(Constants.InfluxDB.TABLE_NAME);
    if (dbURL == null) {
        throw new PropertyException("配置参数文件内容不能为空! " + Constants.InfluxDB.DB_URL);
    }
    if (dbName == null) {
        throw new PropertyException("配置参数文件内容不能为空! " + Constants.InfluxDB.DB_NAME);
    }
    if (tableName == null) {
        throw new PropertyException("配置参数文件内容不能为空! " + Constants.InfluxDB.TABLE_NAME);
    }

    postURL = String.format("%s/write?db=%s", dbURL, dbName);
    initPost();
}
 
Example #7
Source File: AbstractMarshallerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Default implementation of the getProperty method handles
 * the four defined properties in Marshaller.  If a provider
 * needs to support additional provider specific properties,
 * it should override this method in a derived class.
 */
public Object getProperty( String name )
    throws PropertyException {

    if( name == null ) {
        throw new IllegalArgumentException(
            Messages.format( Messages.MUST_NOT_BE_NULL, "name" ) );
    }

    // recognize and handle four pre-defined properties.
    if( JAXB_ENCODING.equals(name) )
        return getEncoding();
    if( JAXB_FORMATTED_OUTPUT.equals(name) )
        return isFormattedOutput()?Boolean.TRUE:Boolean.FALSE;
    if( JAXB_NO_NAMESPACE_SCHEMA_LOCATION.equals(name) )
        return getNoNSSchemaLocation();
    if( JAXB_SCHEMA_LOCATION.equals(name) )
        return getSchemaLocation();
    if( JAXB_FRAGMENT.equals(name) )
        return isFragment()?Boolean.TRUE:Boolean.FALSE;

    throw new PropertyException(name);
}
 
Example #8
Source File: UnmarshallerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void setProperty(String name, Object value) throws PropertyException {
    if(name.equals(FACTORY)) {
        coordinator.setFactories(value);
        return;
    }
    if(name.equals(IDResolver.class.getName())) {
        idResolver = (IDResolver)value;
        return;
    }
    if(name.equals(ClassResolver.class.getName())) {
        coordinator.classResolver = (ClassResolver)value;
        return;
    }
    if(name.equals(ClassLoader.class.getName())) {
        coordinator.classLoader = (ClassLoader)value;
        return;
    }
    super.setProperty(name, value);
}
 
Example #9
Source File: MarshallerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Object getProperty(String name) throws PropertyException {
    if( INDENT_STRING.equals(name) )
        return indent;
    if( ENCODING_HANDLER.equals(name) || ENCODING_HANDLER2.equals(name) )
        return escapeHandler;
    if( PREFIX_MAPPER.equals(name) )
        return prefixMapper;
    if( XMLDECLARATION.equals(name) )
        return !isFragment();
    if( XML_HEADERS.equals(name) )
        return header;
    if( C14N.equals(name) )
        return c14nSupport;
    if ( OBJECT_IDENTITY_CYCLE_DETECTION.equals(name))
            return serializer.getObjectIdentityCycleDetection();

    return super.getProperty(name);
}
 
Example #10
Source File: AbstractMarshallerImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Default implementation of the getProperty method handles
 * the four defined properties in Marshaller.  If a provider
 * needs to support additional provider specific properties,
 * it should override this method in a derived class.
 */
public Object getProperty( String name )
    throws PropertyException {

    if( name == null ) {
        throw new IllegalArgumentException(
            Messages.format( Messages.MUST_NOT_BE_NULL, "name" ) );
    }

    // recognize and handle four pre-defined properties.
    if( JAXB_ENCODING.equals(name) )
        return getEncoding();
    if( JAXB_FORMATTED_OUTPUT.equals(name) )
        return isFormattedOutput()?Boolean.TRUE:Boolean.FALSE;
    if( JAXB_NO_NAMESPACE_SCHEMA_LOCATION.equals(name) )
        return getNoNSSchemaLocation();
    if( JAXB_SCHEMA_LOCATION.equals(name) )
        return getSchemaLocation();
    if( JAXB_FRAGMENT.equals(name) )
        return isFragment()?Boolean.TRUE:Boolean.FALSE;

    throw new PropertyException(name);
}
 
Example #11
Source File: MarshallerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Object getProperty(String name) throws PropertyException {
    if( INDENT_STRING.equals(name) )
        return indent;
    if( ENCODING_HANDLER.equals(name) || ENCODING_HANDLER2.equals(name) )
        return escapeHandler;
    if( PREFIX_MAPPER.equals(name) )
        return prefixMapper;
    if( XMLDECLARATION.equals(name) )
        return !isFragment();
    if( XML_HEADERS.equals(name) )
        return header;
    if( C14N.equals(name) )
        return c14nSupport;
    if ( OBJECT_IDENTITY_CYCLE_DETECTION.equals(name))
            return serializer.getObjectIdentityCycleDetection();

    return super.getProperty(name);
}
 
Example #12
Source File: MarshallerImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Object getProperty(String name) throws PropertyException {
    if( INDENT_STRING.equals(name) )
        return indent;
    if( ENCODING_HANDLER.equals(name) || ENCODING_HANDLER2.equals(name) )
        return escapeHandler;
    if( PREFIX_MAPPER.equals(name) )
        return prefixMapper;
    if( XMLDECLARATION.equals(name) )
        return !isFragment();
    if( XML_HEADERS.equals(name) )
        return header;
    if( C14N.equals(name) )
        return c14nSupport;
    if ( OBJECT_IDENTITY_CYCLE_DETECTION.equals(name))
            return serializer.getObjectIdentityCycleDetection();

    return super.getProperty(name);
}
 
Example #13
Source File: AbstractMarshallerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Default implementation of the getProperty method handles
 * the four defined properties in Marshaller.  If a provider
 * needs to support additional provider specific properties,
 * it should override this method in a derived class.
 */
public Object getProperty( String name )
    throws PropertyException {

    if( name == null ) {
        throw new IllegalArgumentException(
            Messages.format( Messages.MUST_NOT_BE_NULL, "name" ) );
    }

    // recognize and handle four pre-defined properties.
    if( JAXB_ENCODING.equals(name) )
        return getEncoding();
    if( JAXB_FORMATTED_OUTPUT.equals(name) )
        return isFormattedOutput()?Boolean.TRUE:Boolean.FALSE;
    if( JAXB_NO_NAMESPACE_SCHEMA_LOCATION.equals(name) )
        return getNoNSSchemaLocation();
    if( JAXB_SCHEMA_LOCATION.equals(name) )
        return getSchemaLocation();
    if( JAXB_FRAGMENT.equals(name) )
        return isFragment()?Boolean.TRUE:Boolean.FALSE;

    throw new PropertyException(name);
}
 
Example #14
Source File: UnmarshallerImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void setProperty(String name, Object value) throws PropertyException {
    if(name.equals(FACTORY)) {
        coordinator.setFactories(value);
        return;
    }
    if(name.equals(IDResolver.class.getName())) {
        idResolver = (IDResolver)value;
        return;
    }
    if(name.equals(ClassResolver.class.getName())) {
        coordinator.classResolver = (ClassResolver)value;
        return;
    }
    if(name.equals(ClassLoader.class.getName())) {
        coordinator.classLoader = (ClassLoader)value;
        return;
    }
    super.setProperty(name, value);
}
 
Example #15
Source File: AbstractMarshallerImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Default implementation of the getProperty method handles
 * the four defined properties in Marshaller.  If a provider
 * needs to support additional provider specific properties,
 * it should override this method in a derived class.
 */
public Object getProperty( String name )
    throws PropertyException {

    if( name == null ) {
        throw new IllegalArgumentException(
            Messages.format( Messages.MUST_NOT_BE_NULL, "name" ) );
    }

    // recognize and handle four pre-defined properties.
    if( JAXB_ENCODING.equals(name) )
        return getEncoding();
    if( JAXB_FORMATTED_OUTPUT.equals(name) )
        return isFormattedOutput()?Boolean.TRUE:Boolean.FALSE;
    if( JAXB_NO_NAMESPACE_SCHEMA_LOCATION.equals(name) )
        return getNoNSSchemaLocation();
    if( JAXB_SCHEMA_LOCATION.equals(name) )
        return getSchemaLocation();
    if( JAXB_FRAGMENT.equals(name) )
        return isFragment()?Boolean.TRUE:Boolean.FALSE;

    throw new PropertyException(name);
}
 
Example #16
Source File: AbstractMarshallerImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Default implementation of the getProperty method handles
 * the four defined properties in Marshaller.  If a provider
 * needs to support additional provider specific properties,
 * it should override this method in a derived class.
 */
public Object getProperty( String name )
    throws PropertyException {

    if( name == null ) {
        throw new IllegalArgumentException(
            Messages.format( Messages.MUST_NOT_BE_NULL, "name" ) );
    }

    // recognize and handle four pre-defined properties.
    if( JAXB_ENCODING.equals(name) )
        return getEncoding();
    if( JAXB_FORMATTED_OUTPUT.equals(name) )
        return isFormattedOutput()?Boolean.TRUE:Boolean.FALSE;
    if( JAXB_NO_NAMESPACE_SCHEMA_LOCATION.equals(name) )
        return getNoNSSchemaLocation();
    if( JAXB_SCHEMA_LOCATION.equals(name) )
        return getSchemaLocation();
    if( JAXB_FRAGMENT.equals(name) )
        return isFragment()?Boolean.TRUE:Boolean.FALSE;

    throw new PropertyException(name);
}
 
Example #17
Source File: UnmarshallerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void setProperty(String name, Object value) throws PropertyException {
    if(name.equals(FACTORY)) {
        coordinator.setFactories(value);
        return;
    }
    if(name.equals(IDResolver.class.getName())) {
        idResolver = (IDResolver)value;
        return;
    }
    if(name.equals(ClassResolver.class.getName())) {
        coordinator.classResolver = (ClassResolver)value;
        return;
    }
    if(name.equals(ClassLoader.class.getName())) {
        coordinator.classLoader = (ClassLoader)value;
        return;
    }
    super.setProperty(name, value);
}
 
Example #18
Source File: AbstractUnmarshallerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Default implementation of the getProperty method always
 * throws PropertyException since there are no required
 * properties. If a provider needs to handle additional
 * properties, it should override this method in a derived class.
 */
public Object getProperty( String name )
    throws PropertyException {

    if( name == null ) {
        throw new IllegalArgumentException(
            Messages.format( Messages.MUST_NOT_BE_NULL, "name" ) );
    }

    throw new PropertyException(name);
}
 
Example #19
Source File: AbstractUnmarshallerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Default implementation of the setProperty method always
 * throws PropertyException since there are no required
 * properties. If a provider needs to handle additional
 * properties, it should override this method in a derived class.
 */
public void setProperty( String name, Object value )
    throws PropertyException {

    if( name == null ) {
        throw new IllegalArgumentException(
            Messages.format( Messages.MUST_NOT_BE_NULL, "name" ) );
    }

    throw new PropertyException(name, value);
}
 
Example #20
Source File: MarshallerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void checkString( String name, Object value ) throws PropertyException {
    if(!(value instanceof String))
        throw new PropertyException(
            Messages.MUST_BE_X.format(
                    name,
                    String.class.getName(),
                    value.getClass().getName() ) );
}
 
Example #21
Source File: AbstractUnmarshallerImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Default implementation of the getProperty method always
 * throws PropertyException since there are no required
 * properties. If a provider needs to handle additional
 * properties, it should override this method in a derived class.
 */
public Object getProperty( String name )
    throws PropertyException {

    if( name == null ) {
        throw new IllegalArgumentException(
            Messages.format( Messages.MUST_NOT_BE_NULL, "name" ) );
    }

    throw new PropertyException(name);
}
 
Example #22
Source File: AbstractUnmarshallerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Default implementation of the getProperty method always
 * throws PropertyException since there are no required
 * properties. If a provider needs to handle additional
 * properties, it should override this method in a derived class.
 */
public Object getProperty( String name )
    throws PropertyException {

    if( name == null ) {
        throw new IllegalArgumentException(
            Messages.format( Messages.MUST_NOT_BE_NULL, "name" ) );
    }

    throw new PropertyException(name);
}
 
Example #23
Source File: AbstractMarshallerImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Default implementation of the setProperty method handles
 * the four defined properties in Marshaller. If a provider
 * needs to handle additional properties, it should override
 * this method in a derived class.
 */
public void setProperty( String name, Object value )
    throws PropertyException {

    if( name == null ) {
        throw new IllegalArgumentException(
            Messages.format( Messages.MUST_NOT_BE_NULL, "name" ) );
    }

    // recognize and handle four pre-defined properties.
    if( JAXB_ENCODING.equals(name) ) {
        checkString( name, value );
        setEncoding( (String)value );
        return;
    }
    if( JAXB_FORMATTED_OUTPUT.equals(name) ) {
        checkBoolean( name, value );
        setFormattedOutput((Boolean) value );
        return;
    }
    if( JAXB_NO_NAMESPACE_SCHEMA_LOCATION.equals(name) ) {
        checkString( name, value );
        setNoNSSchemaLocation( (String)value );
        return;
    }
    if( JAXB_SCHEMA_LOCATION.equals(name) ) {
        checkString( name, value );
        setSchemaLocation( (String)value );
        return;
    }
    if( JAXB_FRAGMENT.equals(name) )  {
        checkBoolean(name, value);
        setFragment((Boolean) value );
        return;
    }

    throw new PropertyException(name, value);
}
 
Example #24
Source File: ExceptionBean.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Converts the given {@link Throwable} into an XML representation
 * and put that as a DOM tree under the given node.
 */
public static void marshal( Throwable t, Node parent ) throws JAXBException {
    Marshaller m = JAXB_CONTEXT.createMarshaller();
    try {
            m.setProperty("com.sun.xml.internal.bind.namespacePrefixMapper",nsp);
    } catch (PropertyException pe) {}
    m.marshal(new ExceptionBean(t), parent );
}
 
Example #25
Source File: AbstractUnmarshallerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Default implementation of the setProperty method always
 * throws PropertyException since there are no required
 * properties. If a provider needs to handle additional
 * properties, it should override this method in a derived class.
 */
public void setProperty( String name, Object value )
    throws PropertyException {

    if( name == null ) {
        throw new IllegalArgumentException(
            Messages.format( Messages.MUST_NOT_BE_NULL, "name" ) );
    }

    throw new PropertyException(name, value);
}
 
Example #26
Source File: UnmarshallerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Object getProperty(String name) throws PropertyException {
    if(name.equals(IDResolver.class.getName())) {
        return idResolver;
    }
    return super.getProperty(name);
}
 
Example #27
Source File: AbstractMarshallerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Default implementation of the setProperty method handles
 * the four defined properties in Marshaller. If a provider
 * needs to handle additional properties, it should override
 * this method in a derived class.
 */
public void setProperty( String name, Object value )
    throws PropertyException {

    if( name == null ) {
        throw new IllegalArgumentException(
            Messages.format( Messages.MUST_NOT_BE_NULL, "name" ) );
    }

    // recognize and handle four pre-defined properties.
    if( JAXB_ENCODING.equals(name) ) {
        checkString( name, value );
        setEncoding( (String)value );
        return;
    }
    if( JAXB_FORMATTED_OUTPUT.equals(name) ) {
        checkBoolean( name, value );
        setFormattedOutput((Boolean) value );
        return;
    }
    if( JAXB_NO_NAMESPACE_SCHEMA_LOCATION.equals(name) ) {
        checkString( name, value );
        setNoNSSchemaLocation( (String)value );
        return;
    }
    if( JAXB_SCHEMA_LOCATION.equals(name) ) {
        checkString( name, value );
        setSchemaLocation( (String)value );
        return;
    }
    if( JAXB_FRAGMENT.equals(name) )  {
        checkBoolean(name, value);
        setFragment((Boolean) value );
        return;
    }

    throw new PropertyException(name, value);
}
 
Example #28
Source File: AbstractUnmarshallerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Default implementation of the setProperty method always
 * throws PropertyException since there are no required
 * properties. If a provider needs to handle additional
 * properties, it should override this method in a derived class.
 */
public void setProperty( String name, Object value )
    throws PropertyException {

    if( name == null ) {
        throw new IllegalArgumentException(
            Messages.format( Messages.MUST_NOT_BE_NULL, "name" ) );
    }

    throw new PropertyException(name, value);
}
 
Example #29
Source File: MarshallerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void checkString( String name, Object value ) throws PropertyException {
    if(!(value instanceof String))
        throw new PropertyException(
            Messages.MUST_BE_X.format(
                    name,
                    String.class.getName(),
                    value.getClass().getName() ) );
}
 
Example #30
Source File: MarshallerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void checkBoolean( String name, Object value ) throws PropertyException {
    if(!(value instanceof Boolean))
        throw new PropertyException(
            Messages.MUST_BE_X.format(
                    name,
                    Boolean.class.getName(),
                    value.getClass().getName() ) );
}