Java Code Examples for java.net.URISyntaxException#getLocalizedMessage()

The following examples show how to use java.net.URISyntaxException#getLocalizedMessage() . These examples are extracted from open source projects. 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
private void verifyOrigin(String origin, String rporigin) {
    try{
        URI originURI = new URI(origin);
        URI rporiginURI = new URI(rporigin);
        if(!originURI.equals(rporiginURI)){
            skfsLogger.log(skfsConstants.SKFE_LOGGER,Level.FINE, "FIDO-ERR-5011", "Invalid Origin");
            throw new SKIllegalArgumentException("Invalid Origin: " + originURI + " != " + rporiginURI);
        }
    } catch (URISyntaxException ex) {
        skfsLogger.log(skfsConstants.SKFE_LOGGER,Level.FINE, "FIDO-ERR-5011", "Invalid Origin: " + ex.getLocalizedMessage());
        throw new SKIllegalArgumentException("Invalid Origin " + ex.getLocalizedMessage());
    }
}
 
Example 2
private NiFiProperties loadSpecifiedProperties(final String propertiesFile, final Map<String, String> others) {
    String filePath;
    try {
        filePath = NarUnpackerTest.class.getResource(propertiesFile).toURI().getPath();
    } catch (URISyntaxException ex) {
        throw new RuntimeException("Cannot load properties file due to "
                + ex.getLocalizedMessage(), ex);
    }
    return NiFiProperties.createBasicNiFiProperties(filePath, others);
}
 
Example 3
Source Project: netbeans   File: WebServiceManager.java    License: Apache License 2.0 5 votes vote down vote up
static File copyWsdlResources(String wsdlUrl) throws IOException {
    File userDirFile = new File(WEBSVC_HOME);
    File catalogFile = new File(userDirFile, WsdlUtil.getCatalogForWsdl(wsdlUrl));
    File dir = catalogFile.getParentFile();

    boolean success = false;
    dir = catalogFile.getParentFile();
    try {
        FileObject dirFO = FileUtil.createFolder(dir);
        URI catalog = catalogFile.toURI();
        URI wsdlUri = new URL(wsdlUrl).toURI();

        Retriever retriever = Retriever.getDefault();
        FileObject wsdlFO = retriever.retrieveResource(dirFO, catalog, wsdlUri);

        if (wsdlFO == null) {
            throw new IOException(NbBundle.getMessage(WebServiceManager.class, "WSDL_COPY_ERROR"));
        }
        File result = FileUtil.toFile(wsdlFO);
        success = true;
        return result;
    } catch (URISyntaxException ex) {
        throw new IOException(ex.getLocalizedMessage());
    } finally {
        if (catalogFile.exists() && !success) {
            rmDir(catalogFile.getParentFile());
        }
    }
}
 
Example 4
Source Project: netbeans   File: WebServiceManager.java    License: Apache License 2.0 5 votes vote down vote up
static File copyWsdlResources(String wsdlUrl) throws IOException {
    File userDirFile = new File(WEBSVC_HOME);
    File catalogFile = new File(userDirFile, WsdlUtil.getCatalogForWsdl(wsdlUrl));
    File dir = catalogFile.getParentFile();

    boolean success = false;
    dir = catalogFile.getParentFile();
    try {
        FileObject dirFO = FileUtil.createFolder(dir);
        URI catalog = catalogFile.toURI();
        URI wsdlUri = new URL(wsdlUrl).toURI();

        Retriever retriever = Retriever.getDefault();
        FileObject wsdlFO = retriever.retrieveResource(dirFO, catalog, wsdlUri);

        if (wsdlFO == null) {
            throw new IOException(NbBundle.getMessage(WebServiceManager.class, "WSDL_COPY_ERROR"));
        }

        FileUtil.createFolder(new File(WEBSVC_HOME));
        File result = FileUtil.toFile(wsdlFO);
        success = true;
        return result;
    } catch (URISyntaxException ex) {
        throw new IOException(ex.getLocalizedMessage());
    } finally {
        if (catalogFile.exists() && !success) {
            rmDir(catalogFile.getParentFile());
        }
    }
}
 
Example 5
protected void validateBeforeNext() throws WizardValidationException {
    try {
        HgURL url;
        try {
            url = repository.getUrl();
        } catch (URISyntaxException ex) {
            throw new WizardValidationException((JComponent) component,
                                                ex.getMessage(),
                                                ex.getLocalizedMessage());
        }

        if (support == null) {
            support = new RepositoryStepProgressSupport();
            component.add(support.getProgressComponent(), BorderLayout.SOUTH);
        }
        support.setRepositoryRoot(url);
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(url);
        RequestProcessor.Task task = support.start(rp, url, NbBundle.getMessage(CloneRepositoryWizardPanel.class, "BK2012"));
        task.waitFinished();
    } finally {
        if (support != null) {      //see bug #167172
            /*
             * We cannot reuse the progress component because
             * org.netbeans.api.progress.ProgressHandle cannot be reused.
             */
            component.remove(support.getProgressComponent());
            support = null;
        }
    }

}
 
Example 6
Source Project: nifi-minifi   File: NarUnpackerTest.java    License: Apache License 2.0 5 votes vote down vote up
private NiFiProperties loadSpecifiedProperties(final String propertiesFile, final Map<String, String> others) {
    String filePath;
    try {
        filePath = NarUnpackerTest.class.getResource(propertiesFile).toURI().getPath();
    } catch (URISyntaxException ex) {
        throw new RuntimeException("Cannot load properties file due to "
                + ex.getLocalizedMessage(), ex);
    }
    return NiFiProperties.createBasicNiFiProperties(filePath, others);
}
 
Example 7
Source Project: XACML   File: AnyURIValidator.java    License: MIT License 5 votes vote down vote up
@Override
public void validate(Object value) throws InvalidValueException {
	if (value instanceof String) {
		try {
			new URI((String) value);
		} catch (URISyntaxException e) {
			throw new InvalidValueException(e.getLocalizedMessage());
		}
	} else
		throw new InvalidValueException("Unrecognized URI");
}
 
Example 8
Source Project: nifi   File: NarUnpackerTest.java    License: Apache License 2.0 5 votes vote down vote up
private NiFiProperties loadSpecifiedProperties(final String propertiesFile, final Map<String, String> others) {
    String filePath;
    try {
        filePath = NarUnpackerTest.class.getResource(propertiesFile).toURI().getPath();
    } catch (URISyntaxException ex) {
        throw new RuntimeException("Cannot load properties file due to " + ex.getLocalizedMessage(), ex);
    }
    return NiFiProperties.createBasicNiFiProperties(filePath, others);
}