Package com.cedarsoft

Examples of com.cedarsoft.VersionMismatchException


   *
   * @param formatVersion the format version
   */
  protected void verifyVersionReadable( @NotNull Version formatVersion ) {
    if ( !isVersionReadable( formatVersion ) ) {
      throw new VersionMismatchException( getFormatVersionRange(), formatVersion );
    }
  }
View Full Code Here


   *
   * @param formatVersion the format version
   */
  protected void verifyVersionWritable( @NotNull Version formatVersion ) {
    if ( !isVersionWritable( formatVersion ) ) {
      throw new VersionMismatchException( getFormatVersion(), formatVersion );
    }
  }
View Full Code Here

      }

      //Parse and verify the version
      Version version = parseVersionFromNamespaceUri( namespaceURI );
      if ( !getFormatVersionRange().contains( version ) ) {
        throw new VersionMismatchException( getFormatVersion(), version );
      }

      //Verify the name space
      verifyNamespaceUri( namespaceURI );
View Full Code Here

  public T deserialize( @NotNull InputStream in ) throws IOException, VersionException {
    try {
      XMLStreamReader reader = StaxSupport.getXmlInputFactory().createXMLStreamReader( in );
      Version version = Version.parse( getProcessingInstructionData( reader, PI_TARGET_FORMAT ) );
      if ( !getFormatVersionRange().contains( version ) ) {
        throw new VersionMismatchException( getFormatVersion(), version );
      }

      reader.nextTag();
      T deserialized = deserialize( reader, version );
View Full Code Here

      }

      //Parse and verify the version
      Version version = parseVersionFromNamespaceUri( namespaceURI );
      if ( !getFormatVersionRange().contains( version ) ) {
        throw new VersionMismatchException( getFormatVersion(), version );
      }

      //Verify the name space
      verifyNamespaceUri( namespaceURI );
View Full Code Here

   *
   * @param formatVersion the format version
   */
  protected void verifyVersionReadable( @NotNull Version formatVersion ) {
    if ( !isVersionReadable( formatVersion ) ) {
      throw new VersionMismatchException( getFormatVersionRange(), formatVersion );
    }
  }
View Full Code Here

   *
   * @param formatVersion the format version
   */
  protected void verifyVersionWritable( @NotNull Version formatVersion ) {
    if ( !isVersionWritable( formatVersion ) ) {
      throw new VersionMismatchException( getFormatVersion(), formatVersion );
    }
  }
View Full Code Here

      VersionMapping mapping = entry.getValue();

      //Check the write version
      PluggableSerializer<?, S, D, E> serializer = getSerializer( entry.getKey() );
      if ( !serializer.getFormatVersion().equals( mapping.getDelegateWriteVersion() ) ) {
        throw new VersionMismatchException( serializer.getFormatVersion(), mapping.getDelegateWriteVersion(), "Invalid serialization/output version for <" + entry.getKey().getName() + ">. " );
      }
    }

    return true;
  }
View Full Code Here

    //Check whether the minimum equals the expected version range minimum
    {
      Version currentMin = entries.get( 0 ).getVersionRange().getMin();
      if ( !currentMin.equals( sourceVersionRange.getMin() ) ) {
        throw new VersionMismatchException( sourceVersionRange.getMin(), currentMin, "Lower border of source range not mapped: " );
      }
    }

    //Verify the last entry. Does the max version range fit?
    {
      Entry last = entries.get( entries.size() - 1 );
      Version currentMax = last.getVersionRange().getMax();
      if ( !currentMax.equals( sourceVersionRange.getMax() ) ) {
        throw new VersionMismatchException( sourceVersionRange.getMax(), currentMax, "Upper border of source range not mapped: " );
      }
    }
  }
View Full Code Here

      //Verify the mapping itself
      try {
        mapping.verify();
        mapping.verifyMappedVersions( mappedVersions );
      } catch ( VersionMismatchException e ) {
        RuntimeException newException = new VersionMismatchException( e.getExpected(), e.getActual(), "Invalid mapping for <" + toString.convert( entry.getKey() ) + ">: " + e.getMessage(), false );
        newException.setStackTrace( e.getStackTrace() );
        throw newException;
      } catch ( UnsupportedVersionException e ) {
        RuntimeException newException = new UnsupportedVersionException( e.getActual(), e.getSupportedRange(), "Invalid mapping for <" + toString.convert( entry.getKey() ) + ">: " + e.getMessage(), false );
        newException.setStackTrace( e.getStackTrace() );
        throw newException;
      }
    }

    return true;
View Full Code Here

TOP

Related Classes of com.cedarsoft.VersionMismatchException

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.