java.util.InvalidPropertiesFormatException Java Examples

The following examples show how to use java.util.InvalidPropertiesFormatException. 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: PropertiesDefaultHandler.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException, UnsupportedEncodingException
{
    this.properties = props;

    try {
        SAXParser parser = new SAXParserImpl();
        parser.parse(in, this);
    } catch (SAXException saxe) {
        throw new InvalidPropertiesFormatException(saxe);
    }

    /**
     * String xmlVersion = propertiesElement.getAttribute("version"); if
     * (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0) throw new
     * InvalidPropertiesFormatException( "Exported Properties file format
     * version " + xmlVersion + " is not supported. This java installation
     * can read" + " versions " + EXTERNAL_XML_VERSION + " or older. You" +
     * " may need to install a newer version of JDK.");
     */
}
 
Example #2
Source File: PropertiesDefaultHandler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException, UnsupportedEncodingException
{
    this.properties = props;

    try {
        SAXParser parser = new SAXParserImpl();
        parser.parse(in, this);
    } catch (SAXException saxe) {
        throw new InvalidPropertiesFormatException(saxe);
    }

    /**
     * String xmlVersion = propertiesElement.getAttribute("version"); if
     * (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0) throw new
     * InvalidPropertiesFormatException( "Exported Properties file format
     * version " + xmlVersion + " is not supported. This java installation
     * can read" + " versions " + EXTERNAL_XML_VERSION + " or older. You" +
     * " may need to install a newer version of JDK.");
     */
}
 
Example #3
Source File: PropertiesDefaultHandler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException, UnsupportedEncodingException
{
    this.properties = props;

    try {
        SAXParser parser = new SAXParserImpl();
        parser.parse(in, this);
    } catch (SAXException saxe) {
        throw new InvalidPropertiesFormatException(saxe);
    }

    /**
     * String xmlVersion = propertiesElement.getAttribute("version"); if
     * (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0) throw new
     * InvalidPropertiesFormatException( "Exported Properties file format
     * version " + xmlVersion + " is not supported. This java installation
     * can read" + " versions " + EXTERNAL_XML_VERSION + " or older. You" +
     * " may need to install a newer version of JDK.");
     */
}
 
Example #4
Source File: ModelServer.java    From serve with Apache License 2.0 6 votes vote down vote up
public void startAndWait()
        throws InterruptedException, IOException, GeneralSecurityException,
                InvalidSnapshotException {
    try {
        List<ChannelFuture> channelFutures = start();
        // Create and schedule metrics manager
        MetricManager.scheduleMetrics(configManager);
        System.out.println("Model server started."); // NOPMD

        channelFutures.get(0).sync();
    } catch (InvalidPropertiesFormatException e) {
        logger.error("Invalid configuration", e);
    } finally {
        serverGroups.shutdown(true);
        logger.info("Torchserve stopped.");
    }
}
 
Example #5
Source File: PropertiesDefaultHandler.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException, UnsupportedEncodingException
{
    this.properties = props;

    try {
        SAXParser parser = new SAXParserImpl();
        parser.parse(in, this);
    } catch (SAXException saxe) {
        throw new InvalidPropertiesFormatException(saxe);
    }

    /**
     * String xmlVersion = propertiesElement.getAttribute("version"); if
     * (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0) throw new
     * InvalidPropertiesFormatException( "Exported Properties file format
     * version " + xmlVersion + " is not supported. This java installation
     * can read" + " versions " + EXTERNAL_XML_VERSION + " or older. You" +
     * " may need to install a newer version of JDK.");
     */
}
 
Example #6
Source File: PropertiesDefaultHandler.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException, UnsupportedEncodingException
{
    this.properties = props;

    try {
        SAXParser parser = new SAXParserImpl();
        parser.parse(in, this);
    } catch (SAXException saxe) {
        throw new InvalidPropertiesFormatException(saxe);
    }

    /**
     * String xmlVersion = propertiesElement.getAttribute("version"); if
     * (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0) throw new
     * InvalidPropertiesFormatException( "Exported Properties file format
     * version " + xmlVersion + " is not supported. This java installation
     * can read" + " versions " + EXTERNAL_XML_VERSION + " or older. You" +
     * " may need to install a newer version of JDK.");
     */
}
 
Example #7
Source File: PropertiesDefaultHandler.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException, UnsupportedEncodingException
{
    this.properties = props;

    try {
        SAXParser parser = new SAXParserImpl();
        parser.parse(in, this);
    } catch (SAXException saxe) {
        throw new InvalidPropertiesFormatException(saxe);
    }

    /**
     * String xmlVersion = propertiesElement.getAttribute("version"); if
     * (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0) throw new
     * InvalidPropertiesFormatException( "Exported Properties file format
     * version " + xmlVersion + " is not supported. This java installation
     * can read" + " versions " + EXTERNAL_XML_VERSION + " or older. You" +
     * " may need to install a newer version of JDK.");
     */
}
 
Example #8
Source File: PropertiesDefaultHandler.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException, UnsupportedEncodingException
{
    this.properties = props;

    try {
        SAXParser parser = new SAXParserImpl();
        parser.parse(in, this);
    } catch (SAXException saxe) {
        throw new InvalidPropertiesFormatException(saxe);
    }

    /**
     * String xmlVersion = propertiesElement.getAttribute("version"); if
     * (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0) throw new
     * InvalidPropertiesFormatException( "Exported Properties file format
     * version " + xmlVersion + " is not supported. This java installation
     * can read" + " versions " + EXTERNAL_XML_VERSION + " or older. You" +
     * " may need to install a newer version of JDK.");
     */
}
 
Example #9
Source File: PropertiesDefaultHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException, UnsupportedEncodingException
{
    this.properties = props;

    try {
        SAXParser parser = new SAXParserImpl();
        parser.parse(in, this);
    } catch (SAXException saxe) {
        throw new InvalidPropertiesFormatException(saxe);
    }

    /**
     * String xmlVersion = propertiesElement.getAttribute("version"); if
     * (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0) throw new
     * InvalidPropertiesFormatException( "Exported Properties file format
     * version " + xmlVersion + " is not supported. This java installation
     * can read" + " versions " + EXTERNAL_XML_VERSION + " or older. You" +
     * " may need to install a newer version of JDK.");
     */
}
 
Example #10
Source File: ProfilingPointFactory.java    From netbeans with Apache License 2.0 6 votes vote down vote up
ProfilingPoint[] loadProfilingPoints(Lookup.Provider project)
                              throws IOException, InvalidPropertiesFormatException {
    Properties properties = new Properties();
    ProfilerStorage.loadProjectProperties(properties, project, getProfilingPointsStorage());

    int index = 0;
    List<ProfilingPoint> profilingPoints = new ArrayList();
    while (properties.getProperty(index + "_" + ProfilingPoint.PROPERTY_NAME) != null) { // NOI18N
        ProfilingPoint profilingPoint = loadProfilingPoint(project, properties, index);

        if (profilingPoint != null) {
            profilingPoints.add(profilingPoint);
        } else {
            ErrorManager.getDefault().log(ErrorManager.ERROR, "Invalid " + getType() + // NOI18N
                                         " Profiling Point format at index " + index +  // NOI18N
                                         " in project " + ProjectUtilities.getDisplayName(project)); // NOI18N
        }

        index++;
    }

    return profilingPoints.toArray(new ProfilingPoint[0]);
}
 
Example #11
Source File: PropertiesDefaultHandler.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException, UnsupportedEncodingException
{
    this.properties = props;

    try {
        SAXParser parser = new SAXParserImpl();
        parser.parse(in, this);
    } catch (SAXException saxe) {
        throw new InvalidPropertiesFormatException(saxe);
    }

    /**
     * String xmlVersion = propertiesElement.getAttribute("version"); if
     * (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0) throw new
     * InvalidPropertiesFormatException( "Exported Properties file format
     * version " + xmlVersion + " is not supported. This java installation
     * can read" + " versions " + EXTERNAL_XML_VERSION + " or older. You" +
     * " may need to install a newer version of JDK.");
     */
}
 
Example #12
Source File: LoadAndStoreXML.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test loadFromXML with malformed documents
 */
static void testLoadWithMalformedDoc(Path dir) throws IOException {
    try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, "*.xml")) {
        for (Path file: stream) {
            System.out.println("testLoadWithMalformedDoc, file=" + file.getFileName());
            try (InputStream in = Files.newInputStream(file)) {
                Properties props = new Properties();
                try {
                    props.loadFromXML(in);
                    throw new RuntimeException("InvalidPropertiesFormatException not thrown");
                } catch (InvalidPropertiesFormatException x) {
                    System.out.println(x);
                }
            }
        }
    }
}
 
Example #13
Source File: PropertiesDefaultHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException, UnsupportedEncodingException
{
    this.properties = props;

    try {
        SAXParser parser = new SAXParserImpl();
        parser.parse(in, this);
    } catch (SAXException saxe) {
        throw new InvalidPropertiesFormatException(saxe);
    }

    /**
     * String xmlVersion = propertiesElement.getAttribute("version"); if
     * (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0) throw new
     * InvalidPropertiesFormatException( "Exported Properties file format
     * version " + xmlVersion + " is not supported. This java installation
     * can read" + " versions " + EXTERNAL_XML_VERSION + " or older. You" +
     * " may need to install a newer version of JDK.");
     */
}
 
Example #14
Source File: PropertiesDefaultHandler.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException, UnsupportedEncodingException
{
    this.properties = props;

    try {
        SAXParser parser = new SAXParserImpl();
        parser.parse(in, this);
    } catch (SAXException saxe) {
        throw new InvalidPropertiesFormatException(saxe);
    }

    /**
     * String xmlVersion = propertiesElement.getAttribute("version"); if
     * (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0) throw new
     * InvalidPropertiesFormatException( "Exported Properties file format
     * version " + xmlVersion + " is not supported. This java installation
     * can read" + " versions " + EXTERNAL_XML_VERSION + " or older. You" +
     * " may need to install a newer version of JDK.");
     */
}
 
Example #15
Source File: PropertiesDefaultHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException, UnsupportedEncodingException
{
    this.properties = props;

    try {
        SAXParser parser = new SAXParserImpl();
        parser.parse(in, this);
    } catch (SAXException saxe) {
        throw new InvalidPropertiesFormatException(saxe);
    }

    /**
     * String xmlVersion = propertiesElement.getAttribute("version"); if
     * (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0) throw new
     * InvalidPropertiesFormatException( "Exported Properties file format
     * version " + xmlVersion + " is not supported. This java installation
     * can read" + " versions " + EXTERNAL_XML_VERSION + " or older. You" +
     * " may need to install a newer version of JDK.");
     */
}
 
Example #16
Source File: PropertiesDefaultHandler.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException, UnsupportedEncodingException
{
    this.properties = props;

    try {
        SAXParser parser = new SAXParserImpl();
        parser.parse(in, this);
    } catch (SAXException saxe) {
        throw new InvalidPropertiesFormatException(saxe);
    }

    /**
     * String xmlVersion = propertiesElement.getAttribute("version"); if
     * (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0) throw new
     * InvalidPropertiesFormatException( "Exported Properties file format
     * version " + xmlVersion + " is not supported. This java installation
     * can read" + " versions " + EXTERNAL_XML_VERSION + " or older. You" +
     * " may need to install a newer version of JDK.");
     */
}
 
Example #17
Source File: PropertiesDefaultHandler.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException, UnsupportedEncodingException
{
    this.properties = props;

    try {
        SAXParser parser = new SAXParserImpl();
        parser.parse(in, this);
    } catch (SAXException saxe) {
        throw new InvalidPropertiesFormatException(saxe);
    }

    /**
     * String xmlVersion = propertiesElement.getAttribute("version"); if
     * (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0) throw new
     * InvalidPropertiesFormatException( "Exported Properties file format
     * version " + xmlVersion + " is not supported. This java installation
     * can read" + " versions " + EXTERNAL_XML_VERSION + " or older. You" +
     * " may need to install a newer version of JDK.");
     */
}
 
Example #18
Source File: ConcurrentMapProperties.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized void loadFromXML( InputStream in ) throws IOException, InvalidPropertiesFormatException {
  super.putAll( storageMap );
  super.loadFromXML( in );
  super.forEach( ( key, value ) -> storageMap.putIfAbsent( key, value ) );
  super.clear();
}
 
Example #19
Source File: ConcurrentHashMapBackedProperties.java    From jadira with Apache License 2.0 5 votes vote down vote up
@Override
public void loadFromXML(InputStream in) throws IOException, InvalidPropertiesFormatException {
	try{
		super.loadFromXML(in);
		this.properties.putAll(this);
	}
	finally{
		super.clear();
	}
}
 
Example #20
Source File: AegisElementProviderTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Before
public void before() throws InvalidPropertiesFormatException, IOException {
    properties = new Properties();
    properties.loadFromXML(getClass().getResourceAsStream("jsonCases.xml"));
    simpleBeanXml = properties.getProperty("simpleBeanXml");
    noNamespaceXml = properties.getProperty("noNamespaceBeanXml");
}
 
Example #21
Source File: UtilProperties.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
@Override
public void loadFromXML(InputStream in) throws IOException, InvalidPropertiesFormatException {
    try {
        xmlToProperties(in, null, this);
    } finally {
        in.close();
    }
}
 
Example #22
Source File: AdvancedPropertiesValidatorTest.java    From jackrabbit-filevault with Apache License 2.0 5 votes vote down vote up
@Test
public void testPropertiesWithInvalidElement()
        throws URISyntaxException, IOException, SAXException, ParserConfigurationException, ConfigurationException {
    try (InputStream input = this.getClass().getResourceAsStream("/invalid-package/META-INF/vault/properties.xml")) {
        Collection<ValidationMessage> messages = validator.validateMetaInfData(input, Paths.get("vault/properties.xml"));
        ValidationExecutorTest.assertViolation(messages,
                new ValidationMessage(ValidationMessageSeverity.WARN,
                               AdvancedPropertiesValidator.MESSAGE_INVALID_PROPERTIES_XML,
                        new InvalidPropertiesFormatException("org.xml.sax.SAXParseException; lineNumber: 35; columnNumber: 19; Element type \"someinvalidentry\" must be declared.")));
    }
}
 
Example #23
Source File: ConcurrentMapProperties.java    From hop with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized void loadFromXML( InputStream in ) throws IOException, InvalidPropertiesFormatException {
  super.putAll( storageMap );
  super.loadFromXML( in );
  super.forEach( ( key, value ) -> storageMap.putIfAbsent( key, value ) );
  super.clear();
}
 
Example #24
Source File: PropertiesXmlLoader.java    From j2objc with Apache License 2.0 5 votes vote down vote up
public void load(final Properties p, InputStream in) throws IOException,
        InvalidPropertiesFormatException {
    if (in == null) {
        throw new NullPointerException("in == null");
    }

    try {
        XMLReader reader = XMLReaderFactory.createXMLReader();
        reader.setContentHandler(new DefaultHandler() {
            private String key;

            @Override
            public void startElement(String uri, String localName,
                    String qName, Attributes attributes) throws SAXException {
                key = null;
                if (qName.equals("entry")) {
                    key = attributes.getValue("key");
                }
            }

            @Override
            public void characters(char[] ch, int start, int length)
                    throws SAXException {
                if (key != null) {
                    String value = new String(ch, start, length);
                    p.put(key, value);
                    key = null;
                }
            }
        });
        reader.parse(new InputSource(in));
    } catch (SAXException e) {
        throw new InvalidPropertiesFormatException(e);
    }
}
 
Example #25
Source File: BasicXmlPropertiesProvider.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException
{
    PropertiesDefaultHandler handler = new PropertiesDefaultHandler();
    handler.load(props, in);
}
 
Example #26
Source File: BasicXmlPropertiesProvider.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException
{
    PropertiesDefaultHandler handler = new PropertiesDefaultHandler();
    handler.load(props, in);
}
 
Example #27
Source File: BasicXmlPropertiesProvider.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException
{
    PropertiesDefaultHandler handler = new PropertiesDefaultHandler();
    handler.load(props, in);
}
 
Example #28
Source File: BasicXmlPropertiesProvider.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException
{
    PropertiesDefaultHandler handler = new PropertiesDefaultHandler();
    handler.load(props, in);
}
 
Example #29
Source File: BasicXmlPropertiesProvider.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void load(Properties props, InputStream in)
    throws IOException, InvalidPropertiesFormatException
{
    PropertiesDefaultHandler handler = new PropertiesDefaultHandler();
    handler.load(props, in);
}
 
Example #30
Source File: BPlusTree.java    From BPlusTree with Apache License 2.0 5 votes vote down vote up
/**
 * Map the short value to an actual node type enumeration value.
 * This paradoxically is the opposite of that we do in the similarly named
 * function in each node.
 *
 * @param pval a value read from the file indicating which type of node this is
 * @return nodeType equivalent
 * @throws InvalidPropertiesFormatException is thrown when the node is of an unknown type
 */
private TreeNodeType getPageType(short pval)
        throws InvalidPropertiesFormatException {
    switch(pval) {

        case 1:         // LEAF
            {return(TreeNodeType.TREE_LEAF);}

        case 2:         // INTERNAL NODE
            {return(TreeNodeType.TREE_INTERNAL_NODE);}

        case 3:         // INTERNAL NODE /w ROOT
            {return(TreeNodeType.TREE_ROOT_INTERNAL);}

        case 4:         // LEAF NODE /w ROOT
            {return(TreeNodeType.TREE_ROOT_LEAF);}

        case 5:         // LEAF OVERFLOW NODE
            {return(TreeNodeType.TREE_LEAF_OVERFLOW);}

        case 6:         // TREE_LOOKUP_OVERFLOW
        {
            return (TreeNodeType.TREE_LOOKUP_OVERFLOW);
        }
        default: {
            throw new InvalidPropertiesFormatException("Unknown " +
                    "node value read; file possibly corrupt?");
        }
    }
}