Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4041624
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:54:14+00:00 2026-05-20T12:54:14+00:00

we currently experience some file writing/encoding problems that we cannot reproduce. Actually there are

  • 0

we currently experience some file writing/encoding problems that we cannot reproduce.
Actually there are 2 problems which might have the same cause:

1) We have an application (or better multiple instances of the same app) that uses a velocity template to create a css file on user request. However, in some instances of that application (running on the same server, using the same libraries in the same versions) prepend some stange characters to the CSS string which is written to the file (it’s not a UTF-8 byte order mark).

2) Another application recently delivered a Javascript file (located in the EAR) with junk characters appended. Most of the time the same application delivers that Javascript file correctly, and we could not reproduce that behavior yet. A guess would be that the file which is written to the server’s temp folder is corrupted somehow.

Both applications have the fact in common that junk characters are added to a file so it might be the same or a similar cause.

However, as I said before, we’re unable to reproduce that behavior on our test or development machines and we have no idea what could be the cause (we’ve already checked the file encoding which is set to UTF-8).

Here’s some more information on the system:

OS: Debian GNU/Linux 5.0.4 (lenny)
JBoss: 4.2.3.GA
Java: SUn JDK 1.5.0_17-b04

Any idea what could be going on or what we could look for?

Thanks in advance.

Edit:

Part of the code for problem 1)

...
FileWriter fw;
try
{
  String path = tConfigProperties.getProperty( VELOCITYPATHPARAM );
  fw = new FileWriter( path + VELOCITYFILEPARM );
  fw.write( sw.toString() );//sw is a StringWriter passed to velocity for template processing
  fw.close();
}
catch( IOException e )
{
  //handle exception and display error message
}

Problem 2) can’t be a problem with our Java code, since all we do is link the Javascript in the JSP.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T12:54:15+00:00Added an answer on May 20, 2026 at 12:54 pm

    I would look into the possibility that your code is reading / writing the file using a byte buffer, and not taking account of the value returned by the read(byte[]) calls. (It sounds pretty basic, but I recently saw an SO question where this was the root problem.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.