Corrupt JPEG data: 1 extraneous bytes before marker 0xd9

Hello,
Every time when I run the programming with icon and string JList, it shows the following message:
Corrupt JPEG data: 1 extraneous bytes before marker 0xd9
Does any body have any ideas to solve the above problem?
Thank you in advance.
Daniel

Have you tried using an uncorrupted JPEG image?

Similar Messages

  • Library error:corrupt JPEG data:2699 extraneous bytes before marker 0xe2

    How can I fix this library error: corrupt JPEG data:2699 extraneous bytes before marker 0xe2
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
          <div id="head-nav">
            <ul>
              <li><a href="../about/contactus.html"> Contact us</a></li>
              <span class="spacer">|</span>
              <li><a href="../news/news.html">News</a></li>
              <span class="spacer">|</span>
              <li><a href="../events/events.html" target="_new">Events</a></li>
              <span class="spacer">|</span>
              <li><a href="../hr/index.html">Careers</a></li>
              <span class="spacer">|</span>
              <li><a href="../volunteer/index.html">Volunteer</a></li>
            </ul>
            <form action="http://www.bancroftneurohealth.org/search.html" id="cse-search-box">
              <div class="search">
                <input type="hidden" name="cx" value="008757697627747439989:fqakzcjmvkq" />
                <input type="hidden" name="cof" value="FORID:9" />
                <input type="hidden" name="ie" value="UTF-8" />
                <input type="text" name="q" size="31" />
                <input type="submit" name="sa" value="Search" />
              </div>
            </form>
            <script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script>
          </div>

    I think the error is with the marker within the search box. I did not create the search box but need to update the nav list within the div where the search box resides. Anyone have experience with the google cse-search box below?
    "cse-search-box">
              <div class="search">
                <input type="hidden" name="cx" value="008757697627747439989:fqakzcjmvkq" />
                <input type="hidden" name="cof" value="FORID:9" />
                <input type="hidden" name="ie" value="UTF-8" />
                <input type="text" name="q" size="31" />
                <input type="submit" name="sa" value="Search" />
              </div>
            </form>
            <script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script>
          </div>
        I think the marker within the search box is causing the error. I did not create this search box but need to update the navigation
    div which contains this search box.

  • Corrupt JPEG Data

    Whenever I open the Assets tab in Dreamweaver 8 (am using XP
    Pro), I get a one-after-the-other series of the error message:
    Corrupt JPEG data: 11 extraneous bytes before marker 0xdb . The
    number of extraneous bytes varies (58, 4, etc) and so does the 0x
    number (0xd9, 0xc4, etc.)
    I don't know which jpg files are causing the problem and
    there are hundreds of them listed within Dreamweaver Assets.
    How can I determine which jpeg files are corrupt?

    > Why does Dreamweaver bother with this error message
    about "corrupt jpeg
    > data:
    > premature end of data segment" if the image, created in
    Photoshop, works
    > fine
    > on the web page, and in any other software??
    Most likely because the image has a corrupted data segment
    that your limited
    test of software chooses to ignore?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "RichR49" <[email protected]> wrote in
    message
    news:ghr65t$6ep$[email protected]..
    > Why does Dreamweaver bother with this error message
    about "corrupt jpeg
    > data:
    > premature end of data segment" if the image, created in
    Photoshop, works
    > fine
    > on the web page, and in any other software?? Since
    Adobe/Macromedia hard
    > coded
    > this error message into Dreamweaver, they should be able
    to disable it in
    > a
    > patch. I would like to see a complete list of
    Dreamweaver error messages
    > along
    > with a solution to fix the problem, in the back of the
    manual that comes
    > with
    > the software. It is currently not documented anywhere.
    >

  • Getting JPEG Library Error for Corrupt JPEG Data using CS5

    After recently upgrading to CS5 I am getting JPEG Library Errors for corrupt JPEG data. I have my old PC still in use that uses CS4 and does not generate these errors when accessing the same site. Could someone please assist me in how to get rid of these errors using CS5? I can't find help out there anywhere for this!
    Thanks in advance!

    You could use Photoshop's Image Processor to open all of your jpegs in a given folder, make a slight tweek and resave them in the hopes of cleaning out any errors that DW is hitting. It's worth a shot maybe.
    1. In PS go to File > Scripts > Image Processor
    2. For Step 1, browse to a folder in your site with jpeg issues
    3. For Step 2, choose save in same location
    4. For Step 3, choose Save as JPEG and check Convert File to sRGB
    5. Click Run
    This will create a sub folder called JPEG with the images resaved there. You can drag them into the parent folder to replace the originals.
    If you haven't already, make sure to report the bug here: https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
    At least the right people will be made aware of it then and if it's common enough to trip whatever quantity/user reports system they use, it would get included for repair.
    I honestly don't think it's a "bug" per se, since the forum isn't absolutely flooded with the problem.

  • Corrupt JPEG data causing shutdown issues

    I've found the following log entries in system.log, as I am having a problem with shutting down my applications.
    System Preferences[266]: Corrupt JPEG data: premature end of data segment
    Dec 1 15:22:42 system-name [0x0-0x25025].com.apple.systempreferences[266]: Mon Dec 1 15:22:42 system-name.local System Preferences[266] <Error>: Corrupt JPEG data: premature end of data segment\n
    I think it might be related to corrupted wallpaper in JPEG format.
    Is there any way of finding out which files are corrupted so that I can remove them?

    Thanks.
    I figured a way to do determine if a JPEG was corrupt.
    It was actually quite visible using the Cover Flow method, the jpeg wasn't showing up properly. I was afraid there was other corruption that wasn't so visible.
    What I did was, I opened up my Console from Utilities and watched the logs. As I scrolled through each picture using Cover Flow, an error would show up in the console logs.
    That's how I figured it out, thanks for your ideas!

  • Corrupt JPEG Data: Premature End of Data Segment

    I've searched and searched this error for ever and everyone
    says remove images from folders (an option i do not have), and no
    one seems to have error i have.
    I need to find out how to remove this error, it causes me
    endless grief, stops my uploads (sometimes it comes up in the
    middle of an upload), sometimes shows up behind dreamweaver, so i
    don't see it.
    Help
    I'm using Dreamweaver 8.01 (govt office, can't easily
    upgrade).
    on XP PRO Sp2
    if any other specs are needed, pls let me know.
    thank you.

    You are not the only one. I'm dealing with the same issue. I
    did you ever get an anwer anywhere?
    Thanks,
    Doug Collins

  • JPEG "Extraneous Bytes" Error

    Does anyone know what causes this error in Dreamweaver?
    Corrupt JPEG data: 2945 extraneous bytes before marker 0xd5
    Thanks,
    Harry

    It has to be one jpg file that is causing the problem - see:
    http://help.wugnet.com/bravenet/webmaster/Corrupt-JPEG-Data-ftopict93555.html
    Maybe look at using:  http://www.irfanview.com/
    It's a free graphics tool and a very good one.  It may tell you more about an image than the other apps.  You can use it to resave the image one by one or by a batch process.

  • DW Windows claims corrupt JPEGs; Mac doesn't

    When I open a certain site in DW 8.0.2 Windows, it complains
    that some of the JPEGs are corrupt (it won't say which) by bringing
    up a "Corrupt JPEG data" dialog and sometimes an additional dialog
    complaining about data after a certain marker.
    However, opening the same site in the Macintosh version
    reveals no problems at all, even when the site images are exact
    copies. No browser has any problems with any file on the site, and
    a wide selection of graphics programs on both platforms have no
    problem opening any of the files.
    Is the Windows version ultra-picky about JPEG conformity? Is
    it a bug? And in any event, how do I locate the files that DW Win
    dislikes (that's quicker than dismissing a string of dialog boxes,
    ie does not involve removing blocks of images until the problem
    goes away and then putting them back again)?
    Any observations welcome.
    Thanks,
    --Richard E

    If you need to communicate with Macromedia, you need to
    contact them
    directly, or use the wish form -
    http://www.macromedia.com/cfusion/mmform/index.cfm?name=wishform
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "RocDoc7" <[email protected]> wrote in
    message
    news:ebt8m0$jj4$[email protected]..
    >I have been battling the same problem ever since I
    installed Dreamweaver 8
    >(and
    > upgraded to 8.0.2). It is really taxing my patience. Can
    someone from
    > Macromedia comment on the "jpg error" problem? A simple
    addition to the
    > Preferences where we can turn off those annoying pop-ups
    would be very
    > helpful.
    >
    > RocDoc7
    >

  • Corrupt jpeg

    I've searched the archives but not much help there. I'm
    getting a sporadic corrupt jpeg error. When it happens it occurs
    when I'm ABOUT to create a new page from a template. I haven't been
    able to determine yet if I've actually selected the dwt (I think it
    happens when I get to the asset tab). When it occurs it repeats 3
    times.
    The dilemma is that it gives no indication which jpeg file is
    corrupt and so far I've seen no indication that any jpeg I'm
    working with isn't displaying properly.
    Any thoughts?
    Tom
    [EDIT] Did some more testing. The error message is being
    displayed when I switch from the files to the asset tab before I
    select the template. This is an intermittent problem meaning that
    it doesn't happen all the time and I haven't yet figured out how to
    recreate it.

    The error message is a red herring. It has nothing to do with
    JPG images.
    I have no idea what causes it, but I do know that Adobe is
    interested in
    fixing it.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "TCarp" <[email protected]> wrote in message
    news:[email protected]...
    > Hey Drew
    >
    > Thanks for keeping an eye on this. If there is a single
    image it's more
    > basic
    > than an individual html page from the site. I think
    someone earlier in
    > the
    > thread mentioned that this may not be what the error
    message is implying
    > (i.e.
    > a corruption in a jpeg).
    >
    > Let me go over the symptoms again. The error occurs when
    I navigate from
    > the
    > files view to the assets view regardless of whether
    there is an individual
    > html
    > page open at the time. What I'm doing at the time is
    copying/pasting data
    > from
    > one dwt to a new one. It's possible that I could be
    doing this conversion
    > in a
    > more efficient way, but....
    >
    > During the procedure I go to the assets tab to create a
    new page from a
    > template. It's when I select the assets tab BEFORE I
    select the template
    > that
    > I get the error. What's frustrating is that it doesn't
    occur every time.
    > What
    > makes it more baffling is that I can recreate the
    problem reliably when I
    > am
    > working with specific pages. For example, the procedure
    I used most often
    > was
    > to open the old html page, switch to assets view to
    select the template
    > for the
    > new page, create the new page, and then start to copy
    process. If I have
    > a
    > failure, I can often go back, re-do the steps, and have
    the failure. But
    > again, I have seen the failure without opening the old
    html page.
    >
    > The other symptom is, when it occurs, the error always
    occurs 3 times
    > before
    > settling down.
    >
    > If there is a corrupt jpeg somewhere it doesn't fit the
    pattern of errors
    > I'm
    > seeing.
    >
    > What I may do next is to focus on the jpegs used on the
    site (there are
    > quite
    > a few). Please don't tell me that opening each one in PS
    will not
    > reliably
    > find the corrupted one.
    >
    > Thanks for commenting. This is one where other
    perspectives can help with
    > the
    > forest and trees.
    >
    > Tom
    >

  • Corrupted jpegs from LR export

    Hi all,
    I just finished processing my first wedding photos in LR2. After exporting the photos to jpegs I am checking them in bridge and see that roughly a little over half (about 350 photos) of my exported images were showing some random vertical and horizontal lines as if those files were corrupted. That never happened before in LR1. Has anyone here experienced the same problem?
    I had to re-export these images consuming a lot of my time. I am using a Windows XP sp3, though when I exported the images I was still in sp2.
    ps.: The images took literally 3 hours longer to export in LR2 than it used to in LR1.
    Any help is appreciated,
    Lisa

    Yes I confirm. I first posted a problem regarding the Exporting of JPG's out of Lightroom in this thread here:
    http://www.adobeforums.com/webx/.59b63f9d/2
    Following advice contained in that thread my thinking changed somewhat and I believed that the problem might have been in dpMagic - a small application that allows one to view CR2 images in Windows Explorer along with other file formats. I subsequently contacted dpMagic who asked me to forward a few problem images along with screenshots from Explorer when it crashed along with a screenshot of the Event Log. Here is the reply that I received from them this morning:
    thanks you for the detailed information. We were able to reproduce the
    problem. It is originated from the corrupted exif info in the jpeg image.
    The next published version of the application will be resistable to such
    kind of errors.
    with the best regards
    Eugen Shashkou dpMagic DEV
    It would appear after all then that Lightroom is causing corruption of Exported JPG files. I have no way of knowing in which way the EXIF data is being corrupted, and whilst dpMagic say that the next version will be 'resistable' I would much prefer Adobe to see what is causing the corrupted EXIF data in the first place.
    Could one of the mods kindly post a bug regarding this matter referring Adobe to this thread if necessary. It would be appreciated - thanks.

  • FIle Creation in the Application Server With Unicode-8 and Byte-Order Mark

    Hi Guys,
    I've requirement of creating a file in the Application server with the Data.
    The Data Format Should be in UTF-8 and Byte-Order Mark.
    I need to supply this data from SAP to PRMS.
    I'm able to create a file with Unicode, but any of the guys have worked on Umicode with Byte-Order Mark, please let me know.
    Thanks,
    Adi.

    Hi Mathieu,
    If you haven't found an aswer yet, you can check in transaction SE24 CL_ABAP_FILE_UTILITIES method CREATE_UTF8_FILE_WITH_BOM. You can check the code of the method (it's very short) so you can understand how it works. It's also a static method so you can call it directly in your program.
    Ex:
    CALL METHOD cl_abap_file_utilities=>create_utf8_file_with_bom(your_file_name).
    I hope this helps.
    Pax Vobiscum.
    ~ Eric

  • Corrupt SRUDB.dat in WIndows 8.1 - Event ID 476

    Hi all,
    I have an issue slight issue with a Windows 8.1 machine (non domain joined). The user was complaining that the system/applications would become unresponsive. I ran a "Chkdsk /f /r" and it came back with a few bad clusters of which some where located
    in the "\Windows\System32\sru\SRUDB.dat" file.
    In the Application Event Log I see an event ID 476 raised which contain the following:
    svchost (1300) SRUJet: The database page read from the file "C:\WINDOWS\system32\SRU\SRUDB.dat" at offset 2195456 (0x0000000000218000) (database page 535 (0x217)) for 4096 (0x00001000) bytes failed verification because it contains no page data. 
    The read operation will fail with error -1019 (0xfffffc05).  If this condition persists then please restore the database from a previous backup. This problem is likely due to faulty hardware. Please contact your hardware vendor for further assistance
    diagnosing the problem.
    I'm running an "sfc /scannow", but it looks as though the actual SRUDB.dat database has become corrupt. What does this DAT file contain and is there a way to recreate?
    SFC retunred:
    Windows Resource Protection found corrupt files but was unable to fix some
    of them. Details are included in the CBS.Log windir\Logs\CBS\CBS.log. For
    example C:\Windows\Logs\CBS\CBS.log. Note that logging is currently not
    supported in offline servicing scenarios.
    I can post the CBS.log file if required, but toward the end there are some interesting entries:
    2014-11-30 16:04:31, Info                  CSI    000008c5 [SR] Verify complete
    2014-11-30 16:04:31, Info                  CSI    000008c6 [SR] Repairing 2 components
    2014-11-30 16:04:31, Info                  CSI    000008c7 [SR] Beginning Verify and Repair transaction
    2014-11-30 16:04:31, Info                  CSI    000008c8 [SR] Cannot repair member file [l:32{16}]"bootmgfw.efi.mui" of Microsoft-Windows-BootEnvironment-Core-BootManager-EFI.Resources,
    Version = 6.3.9600.17031, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture = [l:10{5}]"en-GB", VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
    2014-11-30 16:04:32, Info                  CSI    000008c9 Hashes for file member \SystemRoot\WinSxS\amd64_prncacla.inf_31bf3856ad364e35_6.3.9600.17415_none_95dd5540d57f8c01\Amd64\CNBJ2530.DPB
    do not match actual file [l:36{18}]"Amd64\CNBJ2530.DPB" :
      Found: {l:32 b:Lj30AtCo6GC4fXRo0EX1GOwFbEaWFP3FS+YNHfv0SZ4=} Expected: {l:32 b:n520k714Uu3utHa5JGQ6HQYbZphKhlMWq5pEmfnCDuw=}
    2014-11-30 16:04:32, Info                  CSI    000008ca [SR] Cannot repair member file [l:36{18}]"Amd64\CNBJ2530.DPB" of prncacla.inf, Version =
    6.3.9600.17415, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type = [l:24{12}]"driverUpdate", TypeName neutral, PublicKey neutral in the store, hash mismatch
    2014-11-30 16:04:32, Info                  CSI    000008cb [SR] Unable to repair \SystemRoot\WinSxS\amd64_microsoft-windows-b..nager-efi.resources_31bf3856ad364e35_6.3.9600.17031_en-gb_68408c0dc1958b90\\[l:32{16}]"bootmgfw.efi.mui"
    2014-11-30 16:04:32, Info                  CSI    000008cc [SR] Cannot repair member file [l:32{16}]"bootmgfw.efi.mui" of Microsoft-Windows-BootEnvironment-Core-BootManager-EFI.Resources,
    Version = 6.3.9600.17031, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture = [l:10{5}]"en-GB", VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
    2014-11-30 16:04:32, Info                  CSI    000008cd [SR] This component was referenced by [l:168{84}]"Package_2145_for_KB2919355~31bf3856ad364e35~amd64~~6.3.1.14.2919355-4305_neutral_GDR"
    2014-11-30 16:04:32, Info                  CSI    000008ce Hashes for file member \SystemRoot\WinSxS\amd64_prncacla.inf_31bf3856ad364e35_6.3.9600.17415_none_95dd5540d57f8c01\Amd64\CNBJ2530.DPB
    do not match actual file [l:36{18}]"Amd64\CNBJ2530.DPB" :
      Found: {l:32 b:Lj30AtCo6GC4fXRo0EX1GOwFbEaWFP3FS+YNHfv0SZ4=} Expected: {l:32 b:n520k714Uu3utHa5JGQ6HQYbZphKhlMWq5pEmfnCDuw=}
    2014-11-30 16:04:32, Info                  CSI    000008cf [SR] Cannot repair member file [l:36{18}]"Amd64\CNBJ2530.DPB" of prncacla.inf, Version =
    6.3.9600.17415, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type = [l:24{12}]"driverUpdate", TypeName neutral, PublicKey neutral in the store, hash mismatch
    2014-11-30 16:04:32, Info                  CSI    000008d0 [SR] This component was referenced by [l:166{83}]"Package_2709_for_KB3000850~31bf3856ad364e35~amd64~~6.3.1.8.3000850-6825_neutral_GDR"
    2014-11-30 16:04:32, Info                  CSI    000008d1 [SR] Repair complete
    2014-11-30 16:04:32, Info                  CSI    000008d2 [SR] Committing transaction
    2014-11-30 16:04:32, Info                  CSI    000008d3 Creating NT transaction (seq 2), objectname [6]"(null)"
    2014-11-30 16:04:32, Info                  CSI    000008d4 Created NT transaction (seq 2) result 0x00000000, handle @0xf0c
    2014-11-30 16:04:32, Info                  CSI    000008d5@2014/11/30:16:04:32.816 Beginning NT transaction commit...
    2014-11-30 16:04:32, Info                  CSI    000008d6@2014/11/30:16:04:32.891 CSI perf trace:
    CSIPERF:TXCOMMIT;82527
    2014-11-30 16:04:32, Info                  CSI    000008d7 [SR] Verify and Repair Transaction completed. All files and registry keys listed in this transaction 
    have been successfully repaired
    Following this I ran a "Dism /Online /Cleanup-Image /RestoreHealth", which seems to have repair a few packages as seen in the CBS log, therefore I can an "sfc /scannow" once more - this time SFC reported there were no integrity violations.
    However, the Event ID 476 and corrupt SRUDB.dat still persists. Is there anything that anyone can suggest?
    Cheers
    Chris
    Chris

    Hi Swinter,
    “WD diagnostic showed there were unrecoverable errors” “the system seems to be stable”
    Since there are unrecoverable errors and it has much possibility to relate to the drive. The error will occur again if the hardware issue is not be resolved. If the issue is under tolerant , I recommend you to back up your important data to a separate media.
    This is vital to avoid of losing important data due to the unexpected drive corruption. Making a full system imagine is a better choice, though the error may be included.
    If you decide to replace the hard drive ,this video may be helpful.
    Video: Restoring your PC after a hard drive failure
    http://windows.microsoft.com/en-HK/windows7/help/videos/restoring-your-pc-after-a-hard-drive-failure#tab=system
    Best regards

  • Byte Order Mark (BOM) not found in UTF-8 file download from XI

    Hi Guys,
    Facing difficulty in downloading file from XI in UTF-8 format with byte order mark.
    Receiver File adapter has been configured to download the file in UTF-8 file format. But the byte order mark is missing. Same works well for UTF-16. Could see the byte order mark at the beginning of  file "FEFF" for UTF-16BE - Unicode big endian.
    As per SAP help, UTF-8 supposed to be the default encoding for TEXT file type.
    Configuring the Receiver File/FTP Adapter in the SAP help link.
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/frameset.htm
    Could you please advice on how to achieve BOM in UTF-8 file as it is very important for the outbound file to get loaded in our vendor system.
    Thanks.
    Best Regards
    Thiru

    Hi!<br>
    <br>
    Had the same problem. But here, we create a "CSV"-File which must have the BOM otherwise it will not be recogniced as UTF-8.
    <br>
    Therefore I've done the folowing:
    Created a simple destination-structure which represents the CSV and done the mapping with the graphical-mapper. The destination-Structure looks like:
    <br>
    (?xml version="1.0" encoding="UTF-8"?)<br>
    (ONLYLINES)<br>
         (LINE)<br>
              (ENTRY)Hello I'm line 1(/ENTRY)<br>
         (/LINE)<br>
         (LINE)<br>
              (ENTRY)and I'm line 2(/ENTRY)<br>
         (/LINE)<br>
    (/ONLYLINES)
    As you can see, the "ENTRY"-Element holds the data.<br>
    <br>
    Now I've created the folowing Java-Mapping and added that mapping within the Interface-Mapping as second step after the graphical mapping:<br>
    <br>
    ---cut---<br>
    package sfs.biz.xi.global;<br>
    <br>
    import java.io.InputStream;<br>
    import java.io.OutputStream;<br>
    import java.util.Map;<br>
    <br>
    import javax.xml.parsers.DocumentBuilder;<br>
    import javax.xml.parsers.DocumentBuilderFactory;<br>
    <br>
    import org.w3c.dom.Document;<br>
    import org.w3c.dom.Element;<br>
    import org.w3c.dom.NodeList;<br>
    <br>
    import com.sap.aii.mapping.api.StreamTransformation;<br>
    import com.sap.aii.mapping.api.StreamTransformationException;<br>
    <br>
    public class OnlyLineConvertAddingBOM implements StreamTransformation {<br>
    <br>
         public void execute(InputStream in, OutputStream out) throws StreamTransformationException {<br>
              try {<br>
                   byte BOM[] = new byte[3];<br>
                   BOM[0]=(byte)0xEF;<br>
                   BOM[1]=(byte)0xBB;<br>
                   BOM[2]=(byte)0xBF;<br>
                   String retString=new String(BOM,"UTF-8");<br>
                   Element ServerElement;<br>
                   NodeList Server;<br>
                   <br>
                DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();<br>
                DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();<br>
                Document doc = docBuilder.parse(in);<br>
                doc.getDocumentElement().normalize();<br>
                NodeList ConnectionList = doc.getElementsByTagName("ENTRY");<br>
                int count=ConnectionList.getLength();<br>
                for (int i=0;i<count;i++) {<br>
                    ServerElement = (Element)ConnectionList.item(i);<br>
                    Server = ServerElement.getChildNodes();<br>
                    retString += Server.item(0).getNodeValue().trim() + "\r\n";<br>
                }<br>
                <br>
                out.write(retString.getBytes("UTF-8"));<br>
                   <br>
              } catch (Throwable t) {<br>
                   throw new StreamTransformationException(t.toString());<br>
              }<br>
         }<br>
    <br>
         public void setParameter(Map arg0) {<br>
              // TODO Auto-generated method stub<br>
              <br>
         }<br>
    <br>
    /*<br>
         public static void main(String[] args) {<br>
              File testfile=new File("c:\\instance.xml");<br>
              File testout=new File("C:\\testout.txt");<br>
              FileInputStream fis = null;<br>
              FileOutputStream fos= null;<br>
              OnlyLineConvertAddingBOM myFI=new OnlyLineConvertAddingBOM();<br>
              try {<br>
                    fis = new FileInputStream(testfile);<br>
                     fos = new FileOutputStream(testout);<br>
                    myFI.setParameter(null);<br>
                    myFI.execute(fis, fos);<br>
              } catch (Exception e) {<br>
                   e.printStackTrace();<br>
              }<br>
                    <br>
                    <br>
         }<br>
         */<br>
    <br>
    }<br>
    --cut---
    <br>
    This Mapping searches all "ENTRY"-Tags within the XML-Strucure and creates a big string which startes with the UTF-8-BOM and than combined each ENTRY-Element, separated by CR/LF.<br>
    <br>
    We use this as Payload for an Mail-Adapter (sending via SMTP) but it should also work on File-Adapter.<br>
    <br>
    Hope it helps.<br>
    Rene<br>
    <br>
    Besides: could someone tell SAP that this editor is the WORSEST editor I've ever seen. Maybe this guys should copy somethink from wikipedia :-((
    Edited by: Rene Pilz on Oct 8, 2009 5:06 PM

  • ESB Routing Service Byte Order Mark error

    Hi,
    I have a esb routing service to accept soap messages from an external system. The external system sents messages with a Byte Order Mark for UTF8 at the start. If i look at the tcp messages i see the following:
    POST /event/DefaultSystem/CaseVerhuizing/EsbStuf0204Service HTTP/1.1
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client
    Protocol 2.0.50727.42)
    Content-Type: text/xml; charset=utf-8
    SOAPAction: "http://www.egem.nl/StUF"
    Host: ux920:7777
    Content-Length: 2382
    Expect: 100-continue
    Connection: Keep-Alive
    HTTP/1.1 100 Continue
    ...<?xml version="1.0" encoding="utf-8"?><soap:Envelope
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    The three dots signify the hexadecimal value EF BB BF which is for UTF8. This raises an error however in iAS:
    HTTP/1.1 400 Bad Request
    Date: Mon, 16 Jul 2007 14:41:32 GMT
    Server: Oracle-Application-Server-10g/10.1.3.1.0 Oracle-HTTP-Server
    Content-Length: 158
    Connection: close
    Content-Type: text/html; charset=ISO-8859-1
    Bad Request
    Error parsing envelope: (1, 1) Start of root element
    expected
    It seems the esb routing service is trying to parse the Byte Order Mark as xml and therfore can not find the soap envelope tag? Any help is appreciated!
    Kind Regards,
    Andre Jochems
    Message was edited by:
    ajochems

    Hi Andre,
    We got exactly the same error as you did. Your analysis is also correct; the first 3 bytes of the reply are not interpreted by BPEL/ESB as a BOM, but as 'real' characters.
    The problem is due to the fact that the UTF-8 BOM is actually optional in the specifications, and obligatory for UTF-16. The UTF-8 BOM practically has no meaning, and is never used in most SOA applications. However the guys that made the webservice you need to consume are (wrongly) convinced that the UTF-8 BOM is supposed to be there according to the OASIS/W3C specs. Which is not true btw...
    For more info on BOMs, check: http://en.wikipedia.org/wiki/Byte_Order_Mark
    Unfortunately I don't have the code for our 'proxy' service anymore. I remember that we simply made a little servlet, that uses input- and outputstreams. The inputstream then filters the BOM. Remember to also proxy the WSDL to 'rewrite' the endpoint ;-)
    HTH,
    Bas

  • How to solve java.io.IOException: Corrupt form data: premature ending

    hei evryone!
    Does anyone knows how to solve this bug?
    java.io.IOException: Corrupt form data: premature ending
    Im using Oreilly's cos.jar MultipartRequest
    here is my form :
    <FORM METHOD="POST" NAME="uploadform" action="mbbfile" ENCTYPE="multipart/form-data">
    <TR>
    <TD>Select a File:</TD>
    <TD><INPUT TYPE="FILE" NAME="srcfile" style="width:400px"/></TD>
    </TR>
    <TR><TD><INPUT TYPE="SUBMIT" VALUE="Send"/></TD></TR>
    </FORM>
    HERE IS mbbfile which is a servlet :
    package mbb.servlet;
    import java.io.IOException;
    import java.sql.Connection;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import com.oreilly.servlet.MultipartRequest;
    import org.jconfig.Configuration;
    import org.jconfig.ConfigurationManager;
    public class MBBFileServlet extends HttpServlet{
         private static final Configuration conf = ConfigurationManager.getConfiguration("ConfigFile");
         public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
              String filePath = conf.getProperty("FilePath", "", "test");
              try{
              MultipartRequest multi = new MultipartRequest(req,filePath,5*1024*1024);
              }catch(Exception e){
                   System.out.println("MBBFileServlet Exception ---> "+e.getMessage());
         public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
              doGet(req,res);
    Sometimes it works meaning the file is uploaded in the directory without any exception, sometimes the file is uploaded but with exception on the log saying "MBBFileServlet Exception ---> Corrupt form data: Premature Ending". and sometimes the files is not uploaded at all and when i check the error is : "MBBFileServlet Exception ---> Corrupt form data: Premature Ending". Can anyone please help me on this matter. Thx!
    Your response would be deeply appreciated.
    br,
    TAC

    Hi all!
    Since I've spent some days now trying to figure out what was wrong with my file upload in Struts 1.1, I would like to share my solution with the rest of you in order to spare you for the same amout of wasted time I've spent :-)
    My platform is Resin 3.0.8 and Struts 1.1. My problem was that JPEG's got corrupted when arriviving at the server. After a few days searching on the net, I tried with a plain servlet and the O'Reilly package, and the app worked perfect.
    Here is my servlet:
    package no.yourcompany.yourapp.servlet;
    import com.oreilly.servlet.multipart.MultipartParser;
    import com.oreilly.servlet.multipart.Part;
    import com.oreilly.servlet.multipart.FilePart;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.ServletException;
    import javax.servlet.ServletContext;
    import javax.servlet.RequestDispatcher;
    import java.io.IOException;
    import java.io.ByteArrayOutputStream;
    public class ImageUpload extends HttpServlet {
    private static final String PAGE_RECEIPT = "/popImageUploadReceipt.do";
    private static final int MAX_FILE_SIZE_IN_BYTES = 10000000; // 10 M
    * Extracts image from request and puts it into person form.
    * @see HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    // custom beans from my project, not defined here
    PersonRegistrationForm personRegistrationForm = null;
    PortraitImage portraitImage = null;
    ByteArrayOutputStream outputStream = null;
    Part currentPart = null;
    FilePart currFilePart = null;
    personRegistrationForm = (PersonRegistrationForm) request.getSession().getAttribute(DsnSessionKeyConstantsIF.KEY_PERSON_FORM);
    portraitImage = personRegistrationForm.getPortraitImage();
    try {
    MultipartParser parser = new MultipartParser(request, MAX_FILE_SIZE_IN_BYTES);
    while ((currentPart = parser.readNextPart()) != null) {
    if (currentPart.isFile()) {
    currFilePart = (FilePart) currentPart;
    outputStream = new ByteArrayOutputStream();
    currFilePart.writeTo(outputStream);
    // portraitImage is just a bean for encapsulating image data, not defined in this posting
    portraitImage.setContentType(currFilePart.getContentType());
    portraitImage.setImageAsByteArray(outputStream.toByteArray());
    portraitImage.setOriginalFileName(currFilePart.getFileName());
    break;
    } // if (currentPart.isFile())
    } // while ((currentPart = parser.readNextPart()) != null)
    } catch (IOException ioe) {
    // noop
    // redirect to receipt page
    ServletContext servletContext = this.getServletContext();
    RequestDispatcher requestDispatcher = servletContext.getRequestDispatcher(PAGE_RECEIPT);
    requestDispatcher.forward(request, response);
    } // doPost
    } // ImageUpload
    AND ADD THIS TO YOUR WEB.XML
    <servlet>
    <servlet-name>ImageUpload</servlet-name>
    <servlet-class>no.yourcompany.yourapp.servlet.ImageUpload</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ImageUpload</servlet-name>
    <url-pattern>imageUpload.do</url-pattern>
    </servlet-mapping>
    AND THE HTML-FORM IS HERE
    <form action="/yourapp/imageUpload.do" method="post" enctype="multipart/form-data" accept="image/*">
    <p>
    <input type="file" name="portraitImage" />
    </p>
    <p>
    <input type="image" src="/dsn/img/btn_last_bilde.gif" border="0">
    </p>
    </form>

Maybe you are looking for