Camel
  1. Camel
  2. CAMEL-4560

camel-file component does not close a file when it's used with camel-xslt

    Details

    • Estimated Complexity:
      Unknown

      Description

      Here are the steps to reproduce:

      1. Create the directory target/in.
      2. Put the file "file.xml" into the directory target/in. Note: the end tag in this file is not closed properly.
      3. Run the test.
      4. The test should fail.
      5. The file "file.xml" remains in the target/in but it should not.
      FileLockedTest.java
      package org.apache.camel;
      
      import org.apache.camel.builder.RouteBuilder;
      import org.apache.camel.component.mock.MockEndpoint;
      import org.apache.camel.test.junit4.CamelTestSupport;
      import org.junit.Test;
      
      public class FileLockedTest extends CamelTestSupport {
      
          @Test
          public void testFileLocked() throws Exception {
              MockEndpoint result = getMockEndpoint("mock:result");
              result.setAssertPeriod(10000);
              result.expectedMessageCount(1);
              result.assertIsSatisfied();
          }
      
          @Override
          protected RouteBuilder createRouteBuilder() throws Exception {
              return new RouteBuilder() {
                  @Override
                  public void configure() throws Exception {
                      from("file:target/in?delay=100&moveFailed=.error")
                          .onException(Throwable.class)
                              .to("mock:result")
                          .end()
                          .to("xslt:FileLockedTest.xsl");
                  }
              };
          }
      
      }
      
      FileLockedTest.xsl
      <?xml version="1.0" encoding="UTF-8"?>
      <xsl:stylesheet
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          xmlns="http://schemas.computershare.ru/codex/2011/08/"
          version="1.0">
      
          <xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes" />
          <xsl:preserve-space elements="*"/>
      
          <xsl:template match="/">
              <xsl:apply-templates />
          </xsl:template>
      
          <xsl:template match="@* | node()">
              <xsl:copy>
                  <xsl:apply-templates select="@* | node()" />
              </xsl:copy>
          </xsl:template>
      
      </xsl:stylesheet>
      
      file.xml; Note: the end tag is not closed properly
      <root></root
      

        Activity

        Hide
        Claus Ibsen added a comment -

        Thanks for reporting with such a a detail error report.

        Show
        Claus Ibsen added a comment - Thanks for reporting with such a a detail error report.
        Hide
        Claus Ibsen added a comment -

        Thanks for reporting. I have coded a fix on my windows box. Running tests in camel-core before committing.

        Show
        Claus Ibsen added a comment - Thanks for reporting. I have coded a fix on my windows box. Running tests in camel-core before committing.
        Hide
        Sergey Zhemzhitsky added a comment -

        Win7 x64 Enterprise

        java version "1.6.0_21"
        Java(TM) SE Runtime Environment (build 1.6.0_21-b07)
        Java HotSpot(TM) Client VM (build 17.0-b17, mixed mode, sharing)

        Show
        Sergey Zhemzhitsky added a comment - Win7 x64 Enterprise java version "1.6.0_21" Java(TM) SE Runtime Environment (build 1.6.0_21-b07) Java HotSpot(TM) Client VM (build 17.0-b17, mixed mode, sharing)
        Hide
        Claus Ibsen added a comment -

        What JDK and OS are you using?

        Show
        Claus Ibsen added a comment - What JDK and OS are you using?

          People

          • Assignee:
            Claus Ibsen
            Reporter:
            Sergey Zhemzhitsky
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development