Package ru.aristar.jnuget.files

Examples of ru.aristar.jnuget.files.NugetFormatException


    public static Index loadFrom(InputStream inputStream) throws IOException, NugetFormatException {
        try {
            ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
            return (Index) objectInputStream.readObject();
        } catch (ClassNotFoundException ex) {
            throw new NugetFormatException("Поток не содержит данные индекса", ex);
        }
    }
View Full Code Here


            InputSource inputSource = new InputSource(inputStream);
            SAXSource saxSource = new SAXSource(inFilter, inputSource);
            NuspecFile result = (NuspecFile) unmarshaller.unmarshal(saxSource);
            return result;
        } catch (JAXBException | SAXException e) {
            throw new NugetFormatException("Ошибка чтения спецификации пакета из XML потока", e);
        }
    }
View Full Code Here

     * идентификатор и версия
     */
    public NuspecFile(PackageEntry entry) throws NugetFormatException {
        EntryProperties properties = entry.getProperties();
        if (entry.getTitle() == null || properties.getVersion() == null) {
            throw new NugetFormatException("Идентификатор и версия пакета должны"
                    + " быть указаны: " + entry.getTitle() + ':' + properties.getVersion());
        }
        getMetadata().authors = entry.getAuthor() == null ? null : entry.getAuthor().getName();
        getMetadata().dependencies = new Dependencies();
        getMetadata().id = entry.getTitle();
View Full Code Here

                }
                case "tags": {
                    return false; //TODO Доделать
                }
                default:
                    throw new NugetFormatException(format("Поле \"{0}\" не поддерживается.", field));
            }
        } catch (NugetFormatException e) {
            return false;
        }
    }
View Full Code Here

     * @param expected эталон
     * @throws NugetFormatException токен не соответствует эталону
     */
    public static void assertToken(String actual, String expected) throws NugetFormatException {
        if (!actual.equalsIgnoreCase(expected)) {
            throw new NugetFormatException("Встретился токен '" + actual + "', когда ожидался '" + expected + "'");
        }
    }
View Full Code Here

        if (propertyName.startsWith("get") || propertyName.startsWith("set")) {
            return lowerFirstSymbol(propertyName.substring(3));
        } else if (propertyName.startsWith("is")) {
            return lowerFirstSymbol(propertyName.substring(2));
        } else {
            throw new NugetFormatException(format("Метод {0} не является get, is или set", method));
        }
    }
View Full Code Here

            case "version": {
                Expression expression = VersionEq.parse(tokens);
                return expression;
            }
            default:
                throw new NugetFormatException(format("Токен \"{0}\" не поддерживается.", token));
        }
    }
View Full Code Here

    public Expression parse(String value) throws NugetFormatException {
        TokenQueue tokenQueue = new TokenQueue(value);
        try {
            return parse(tokenQueue, null);
        } catch (NugetFormatException e) {
            throw new NugetFormatException("Не удалось проанализировать "
                    + "строку: \"" + value + "\", позиция "
                    + tokenQueue.getCurrentPosition(), e);
        }
    }
View Full Code Here

        if (versionString == null) {
            return null;
        }
        Matcher matcher = getPattern().matcher(versionString);
        if (!matcher.find()) {
            throw new NugetFormatException(format("Строка \"{0}\"не соответствует формату версии. ", versionString));
        }
        Integer major = parseInt(matcher.group(1));
        Integer minor = parseInt(matcher.group(2));
        Integer build = parseInt(matcher.group(3));
        String revision = null;
View Full Code Here

        Matcher matcher = pattern.matcher(dependencyString);
        if (!matcher.matches()) {
            Pattern emptyDependencyPattern = Pattern.compile("^::[^:]+");
            final String errorMessage = format("Строка зависимостей не соответствует формату RSS NuGet: {0}", dependencyString);
            if (!emptyDependencyPattern.matcher(dependencyString).matches()) {
                throw new NugetFormatException(errorMessage);
            }
            logger.warn(errorMessage);
            return null;
        }
        Dependency dependency = new Dependency();
View Full Code Here

TOP

Related Classes of ru.aristar.jnuget.files.NugetFormatException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.