当前位置: 首页>>代码示例>>Java>>正文


Java InvalidPropertiesFormatException类代码示例

本文整理汇总了Java中java.util.InvalidPropertiesFormatException的典型用法代码示例。如果您正苦于以下问题:Java InvalidPropertiesFormatException类的具体用法?Java InvalidPropertiesFormatException怎么用?Java InvalidPropertiesFormatException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InvalidPropertiesFormatException类属于java.util包,在下文中一共展示了InvalidPropertiesFormatException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadProfilingPoints

import java.util.InvalidPropertiesFormatException; //导入依赖的package包/类
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]);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:ProfilingPointFactory.java

示例2: readValuesFromConfiguration

import java.util.InvalidPropertiesFormatException; //导入依赖的package包/类
private void readValuesFromConfiguration(String config) throws InvalidPropertiesFormatException {
    if (config == null) {
        throw new InvalidPropertiesFormatException("Invalid properties format: null");
    }

    String[] values = config.split(separator);
    if (values.length < 4)
        throw new InvalidPropertiesFormatException(config);

    zeroBit = charArrayFrom(values[0]);
    oneBit = charArrayFrom(values[1]);

    try {
        paddingBetweenBytes = Integer.parseInt(values[2]);
        mostSignificantBitFirst = values[3].startsWith(mostSignificantBitFirstIndicator);
        pulseExtractiorParameters = new PulseExtractiorParameters();
        if (values.length > 4)
            getPulseParametersFromTaps(values, 4);
    } catch (Throwable t) {
        throw new InvalidPropertiesFormatException("Cannot parse configuration string (" + t.toString() + "): " + config);
    }
}
 
开发者ID:eightbitjim,项目名称:cassette-nibbler,代码行数:23,代码来源:EncodingScheme.java

示例3: getPulseParametersFromTaps

import java.util.InvalidPropertiesFormatException; //导入依赖的package包/类
private void getPulseParametersFromTaps(String [] values, int startingIndex) throws InvalidPropertiesFormatException {
    if (values.length < startingIndex + 3)
        throw new InvalidPropertiesFormatException("Invalid properties. Cannot get pulse length values");

    try {
        for (int i = 0; i < 3; i++) {
            int numberOfTaps = Integer.parseInt(values[startingIndex + i]);
            switch (i) {
                case 0:
                    pulseExtractiorParameters.shortPulseLength = pulseExtractiorParameters.secondsForTaps(numberOfTaps);
                    break;
                case 1:
                    pulseExtractiorParameters.mediumPulseLength = pulseExtractiorParameters.secondsForTaps(numberOfTaps);
                    break;
                case 2:
                    pulseExtractiorParameters.longPulseLength = pulseExtractiorParameters.secondsForTaps(numberOfTaps);
                    break;
            }
        }
    } catch (Throwable t) {
        throw new InvalidPropertiesFormatException("Invalid properties.");
    }
}
 
开发者ID:eightbitjim,项目名称:cassette-nibbler,代码行数:24,代码来源:EncodingScheme.java

示例4: load

import java.util.InvalidPropertiesFormatException; //导入依赖的package包/类
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.");
     */
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:PropertiesDefaultHandler.java

示例5: testLoadWithMalformedDoc

import java.util.InvalidPropertiesFormatException; //导入依赖的package包/类
/**
 * 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);
                }
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:LoadAndStoreXML.java

示例6: loadConfig

import java.util.InvalidPropertiesFormatException; //导入依赖的package包/类
/**
 * Attempts to load properties file with database configuration. Must
 * include username, password, database, and hostname.
 *
 * @param configPath path to database properties file
 * @return database properties
 * @throws IOException if unable to properly parse properties file
 * @throws FileNotFoundException if properties file not found
 */
private Properties loadConfig(String configPath) throws FileNotFoundException, IOException {

	// Specify which keys must be in properties file
	Set<String> required = new HashSet<>();
	required.add("username");
	required.add("password");
	required.add("database");
	required.add("hostname");

	// Load properties file
	Properties config = new Properties();
	config.load(new FileReader(configPath));

	// Check that required keys are present
	if (!config.keySet().containsAll(required)) {
		String error = "Must provide the following in properties file: ";
		throw new InvalidPropertiesFormatException(error + required);
	}

	return config;
}
 
开发者ID:brianisadog,项目名称:hotelApp,代码行数:31,代码来源:DatabaseConnector.java

示例7: testExceptionHttpStatusMapWithOneGoodNumberAndOneGoodName

import java.util.InvalidPropertiesFormatException; //导入依赖的package包/类
@Test
public void testExceptionHttpStatusMapWithOneGoodNumberAndOneGoodName() throws Exception {
    final Class<IllegalArgumentException> clazz1 = IllegalArgumentException.class;
    final HttpStatus status1 = HttpStatus.OK;
    final Class<InvalidPropertiesFormatException> clazz2 = InvalidPropertiesFormatException.class;
    final HttpStatus status2 = HttpStatus.ACCEPTED;
    final Map<String, String> m = new HashMap<String, String>() {{
        put(clazz1.getName(), status1.toString());
        put(clazz2.getName(), status2.name());
    }};
    doReturn(m).when(properties).getMappings();

    final ExceptionHttpStatusMap map = configuration.exceptionHttpStatusMap();

    assertThat(map.size(), is(equalTo(8)));
    assertThat(map.get(clazz1), is(equalTo(status1)));
    assertThat(map.get(clazz2), is(equalTo(status2)));
}
 
开发者ID:nus-ncl,项目名称:services-in-one,代码行数:19,代码来源:ExceptionAutoConfigurationTest.java

示例8: testExceptionHttpStatusMapWithOneBadNumberAndOneGoodName

import java.util.InvalidPropertiesFormatException; //导入依赖的package包/类
@Test
public void testExceptionHttpStatusMapWithOneBadNumberAndOneGoodName() throws Exception {
    final Class<IllegalArgumentException> clazz1 = IllegalArgumentException.class;
    final String status1 = "0";
    final Class<InvalidPropertiesFormatException> clazz2 = InvalidPropertiesFormatException.class;
    final HttpStatus status2 = HttpStatus.ACCEPTED;
    final Map<String, String> m = new HashMap<String, String>() {{
        put(clazz1.getName(), status1);
        put(clazz2.getName(), status2.name());
    }};
    doReturn(m).when(properties).getMappings();

    final ExceptionHttpStatusMap map = configuration.exceptionHttpStatusMap();

    assertThat(map.size(), is(equalTo(7)));
    assertThat(map.get(clazz1), is(equalTo(DEFAULT_HTTP_STATUS)));
    assertThat(map.get(clazz2), is(equalTo(status2)));
}
 
开发者ID:nus-ncl,项目名称:services-in-one,代码行数:19,代码来源:ExceptionAutoConfigurationTest.java

示例9: loadVirtualKeyboardsXml

import java.util.InvalidPropertiesFormatException; //导入依赖的package包/类
private static List<UnicodeList> loadVirtualKeyboardsXml(XMLPropertiesConfiguration conf)
		throws InvalidPropertiesFormatException, FileNotFoundException, IOException {
	
	List<UnicodeList> unicodeLists = new ArrayList<>();		
	Iterator<String> it=conf.getKeys();
	while (it.hasNext()) {
		String key = it.next();
		String value = conf.getString(key);
		logger.info("value = '"+value+"'");

		UnicodeList ul = new UnicodeList(key, value);
		unicodeLists.add(ul);
	}
	Collections.sort(unicodeLists);

	return unicodeLists;
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:18,代码来源:TrpVirtualKeyboardsTabWidget.java

示例10: valueOrDefault

import java.util.InvalidPropertiesFormatException; //导入依赖的package包/类
private String valueOrDefault(Element parentNode, String key, FieldProvider def) throws InvalidPropertiesFormatException {
    // Handle parent undefined:
    if (parentNode == null)
        return def.getPropertyValue(key);

    NodeList nodes = parentNode.getElementsByTagName(key);

    // Handle multiple nodes
    if (nodes.getLength() > 1)
        throw new InvalidPropertiesFormatException(String.format(
                "\"<%s>\" should contain only one \"<%s>\" element.", parentNode.getNodeName(), key));
    // No nodes
    if (nodes.getLength() == 0)
        return def.getPropertyValue(key);

    return nodes.item(0).getTextContent();
}
 
开发者ID:fdi2-epsilon,项目名称:teams-game,代码行数:18,代码来源:XmlMetaParser.java

示例11: read

import java.util.InvalidPropertiesFormatException; //导入依赖的package包/类
private void read(Path path) throws InvalidPropertiesFormatException, IOException, Epub3MakerException {
    InputStream stream = new FileInputStream(path.toFile());
    prop.loadFromXML(stream);
    stream.close();

    if (log.isDebugEnabled()) {
    	log.debug("show settings in " + path);
        prop.list(System.out);
    }

    if (prop.getProperty(SeriesBaseDirKey) == null) {
        throw new Epub3MakerException("!!! SeriesBaseDir is not set !!!");
    }
    if (prop.getProperty(OutputBaseDirKey) == null) {
        throw new Epub3MakerException("!!! OutputBaseDir is not set !!!");
    }
    if (prop.getProperty(TemplateBaseDirKey) == null) {
        throw new Epub3MakerException("!!! TemplateBaseDir is not set !!!");
    }
}
 
开发者ID:cccties,项目名称:chilo-producer,代码行数:21,代码来源:Config.java

示例12: Config

import java.util.InvalidPropertiesFormatException; //导入依赖的package包/类
public Config(String filename, String homeDir) throws InvalidPropertiesFormatException, IOException, Epub3MakerException {
 	if(homeDir != null){
 		homePath = Paths.get(homeDir);
 	}

 	Path path = null;
 	if(filename != null){
path = Paths.get(filename);
 	} else if(homePath != null){
 		path = homePath.resolve(defaultFilename);
 	} else {
 		path = Paths.get(defaultFilename);
 	}

 	read(path);

 	if(homePath != null){
 		String str = prop.getProperty(TemplateBaseDirKey);
 		str = homePath.resolve(str).toString();
 		prop.setProperty(TemplateBaseDirKey, str);

 		prop.setProperty(ExtensionBaseDirKey, homePath.toString());
 	}
 }
 
开发者ID:cccties,项目名称:chilo-producer,代码行数:25,代码来源:Config.java

示例13: test_Serialization

import java.util.InvalidPropertiesFormatException; //导入依赖的package包/类
/**
 * @tests java.util.InvalidPropertiesFormatException#SerializationTest()
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "Verifies serialization/deserialization compatibility.",
    method = "!SerializationSelf",
    args = {}
)
public void test_Serialization() throws Exception {
    InvalidPropertiesFormatException ipfe = new InvalidPropertiesFormatException(
            "Hey, this is InvalidPropertiesFormatException");
    try {
        SerializationTest.verifySelf(ipfe);
    } catch (NotSerializableException e) {
        // expected
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:19,代码来源:InvalidPropertiesFormatExceptionTest.java

示例14: doRun

import java.util.InvalidPropertiesFormatException; //导入依赖的package包/类
/**
    * Message format is length, byte[length] = destinationID, length, byte[length] = body
    * @throws IOException
    */
   private void doRun() throws IOException {
      while(running) {
         int length = clientStream.readInt();
//         System.out.printf("Reading destination of size: %d\n", length);
         byte[] destinationID = new byte[length];
         clientStream.readFully(destinationID);
//         System.out.printf("destinationID=%s\n", new String(destinationID));
         length = clientStream.readInt();
//         System.out.printf("Reading msg of size: %d\n", length);
         byte[] msg = new byte[length];
         clientStream.readFully(msg);
         try {
            store.store(destinationID, msg);
         } catch (InvalidPropertiesFormatException e) {
            // Exception thrown to log the client connection generating the error
            System.err.printf("Invalid properties msg sent by: %s\n", this);
         }
      }
   }
 
开发者ID:starksm64,项目名称:RaspberryPiBeaconParser,代码行数:24,代码来源:ScannerHandler.java

示例15: onSave

import java.util.InvalidPropertiesFormatException; //导入依赖的package包/类
@Command
@NotifyChange("*")
public void onSave() throws SearchLibException,
		InvalidPropertiesFormatException, IOException {
	Client client = getClient();
	if (client == null)
		return;
	AutoCompletionManager manager = client.getAutoCompletionManager();
	AutoCompletionItem autoCompItem = selectedItem != null ? selectedItem
			: new AutoCompletionItem(client, name);
	autoCompItem.setFields(fields);
	autoCompItem.setRows(rows);
	autoCompItem.setSearchRequest(searchRequest);
	if (selectedItem == null)
		manager.add(autoCompItem);
	else
		autoCompItem.save();
	onCancel();
}
 
开发者ID:jaeksoft,项目名称:opensearchserver,代码行数:20,代码来源:AutoCompletionComposer.java


注:本文中的java.util.InvalidPropertiesFormatException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。