Exception -File-DB-File

hai all
i am working with the senario file - db - file using bpm . i am trying to fetch the value from db i am getting the following error in the adapter pls help to sort it out
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!--  Call Adapter
  -->
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
  <SAP:Category>XIAdapterFramework</SAP:Category>
  <SAP:Code area="MESSAGE">GENERAL</SAP:Code>
  <SAP:P1 />
  <SAP:P2 />
  <SAP:P3 />
  <SAP:P4 />
  <SAP:AdditionalText>com.sap.aii.af.ra.ms.api.DeliveryException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'null': java.lang.IndexOutOfBoundsException: Index: 1, Size: 1</SAP:AdditionalText>
  <SAP:ApplicationFaultMessage namespace="" />
  <SAP:Stack />
  <SAP:Retry>M</SAP:Retry>
  </SAP:Error>
Regards
jayaraman

Hi Jayaraman,
Can you give the XML message what is going out of BPM to JDBC adapter, the Stored procedure (name & signature) you are trying to call?
This should help in analyzing the problem.
Also check the help for sample formats:
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
rgds,
Pops
Message was edited by: Pops V

Similar Messages

  • I uninstalled my Elements 10, I have my serial number how do I reinstall it, and will it be able to except files from Canons new camera dos 70d?

    I uninstalled my elements 10, I want to reinstall it, because elements 12 does not have the lighting effects, and because it seems impossible to use, I bought it because i am having trouble getting my camera raw files excepted in elements 10 from Canons new camera, the EOS 70D. THERE SHOULD BE AN UPDATE SO ELEMENTS 10 WILL RECOGNIZE THE NEW CAMERAS.

    For the 70D you need to buy PSE12. Alternatively, download and install the free Adobe DNG converter to convert your CR2 files to the Adobe universal Raw format and the files will open in all versions of PSE (keep your originals as backups and for use in the camera manufactures software)
    Windows download (.exe file) click here DNG Converter 8.2
    Mac download (.dmg file) click here DNG Converter 8.2
    You can convert a whole folder of raw images in one click. See this quick video tutorial:
    You Tube click here for DNG Converter tutorial

  • Which adapter to use to download data from site dynamically except file typ

    hi,
    I am to download data dynamically from a secure website to PI server without using file/FTP adapter and send it to any folder using PI.
    (At receiver end i will use file adapter , Please suggest for sender side)
    I will give user name and password to that site through PI.
    Which adapter I should use at sender side?
    At the same time I am to call an predefined RFC to trigger a Function module in SAP system.
    How to do that?
    Please help me out.
    Response will be appreciated..
    Thanks,
    Jaideep

    Hi
    add "&sap-client=<client>&sap-user=<loginId>&sap-password=<password>" to your wsdl
    like http://server:8000/sap/bc/srt/rfc/sap/webservice _ name?wsdl&sap-client=100&sap-user=andre&sap-password=123456
    Regard's
    Chetan Ahuja

  • The info on the desktop is garbled.  everything works except "File" reads "AAAA", etc. Help!

    It's an older G4, never had any problems with it.  Tried Disc Utilities, no help.

    SOMEBODY PLEASE HELP ME!! It's got to be some setting issue I can't figure out.  Here's a screen shot of what it's doing:

  • Cannot copy file with other buffer sizes, except 1

    Hi,
    i'd like to copy files (txt, images, etc) , but by using the following route:
    -read bytes from a file in a ByteBuffer
    -use a byte array to create a String representation in binary form (ie "0101101") of the ByteBuffer
    -print the string
    and then the reverse:
    -create a byte array from the String
    -put the bytes in another ByteBuffer
    -write them to the destination file
    The problem is, that in the general case, this only works for ByteBuffer.allocate(1)! it works for txt files with any size, but not for image files; i have not tried for any other kind of file.
    Ideas?
    import java.io.*;
    import java.nio.*;
    import java.nio.channels.*;
    import java.math.*;
    /* create the copy of a file:
    * In the middle print a string with the contents of the buffer, in binary form
    * and then use this string to create the copy of the picture.
    public class CopyFile
      static public void main( String args[] ) throws Exception
         if (args.length<2) {
          System.err.println( "Usage: java CopyFile infile outfile" );
          System.exit( 1 );
        String infile = args[0];
        String outfile = args[1];    
        FileInputStream fin = new FileInputStream( infile );
        FileOutputStream fout = new FileOutputStream( outfile );
        FileChannel fcin = fin.getChannel();
        FileChannel fcout = fout.getChannel();
        ByteBuffer bufferSource = ByteBuffer.allocate( 1 );
        ByteBuffer bufferDest = ByteBuffer.allocate( 1 );
        byte[] barraySource;
        byte[] barrayDest;
        while (true) {
          bufferSource.clear();
          int r = fcin.read( bufferSource );
          barraySource=bufferSource.array();
          BigInteger biFrom = new BigInteger(barraySource);           
          String binary = biFrom.toString(2);
          System.out.println(binary+" | ");     
           BigInteger biTo=new BigInteger(binary,2);
           barrayDest=biTo.toByteArray();
           bufferDest.clear();
           bufferDest.put(barrayDest);
          if (r==-1) {
            break;
          bufferDest.flip();
          fcout.write(bufferDest);
    }

    I've changed a couple of things, but the problem remains. It is the first time i work with binary data. Can somebody give me a hint?
    public class Test2
        public static void main(String[] args) throws Exception
            File fin=new File("C:\\Documents and Settings\\p3020139\\My Documents\\pic.JPG");
            File fout=new File("C:\\Documents and Settings\\p3020139\\My Documents\\piccp.JPG");
            FileInputStream fis=new FileInputStream(fin);
            FileOutputStream fos=new FileOutputStream(fout);       
            long fileSize= fin.length();
            long bytesRead=0;
            BufferedOutputStream baos=null;
            while (bytesRead<fileSize+1)
                byte[] barray=new byte[128];
                int read=fis.read(barray); 
                BigInteger biFrom = new BigInteger(barray);           
                String binary = biFrom.toString(2);
                System.out.println(binary);
                BigInteger biTo=new BigInteger(binary,2);
                byte[] bytesTo=biTo.toByteArray();
                baos=new BufferedOutputStream(fos,128);
                baos.write(bytesTo);
                bytesRead=bytesRead+read;
            fis.close();
            baos.close();
        }

  • Strange exception: Properties File

    Gurus,
    I am trying to run the ff code:
    if(properties == null || properties.isEmpty()){
    properties = new Properties();
    File file = new File("settings/databasesetting.properties");
    System.out.println("File path : "+file.getAbsolutePath());
    try {
    FileInputStream stream = new FileInputStream(file);
    properties. load (stream);
    } catch (FileNotFoundException e) {
    e.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    }//try
    } //if
    And I get the ff exception:
    File path : C:\Development\Java\infosys\settings\databasesetting.properties
    java.io.FileNotFoundException: settings\databasesetting.properties (The system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream. (FileInputStream.java:106)
    at com.web.database.Database. (Database.java:191)
    at com.web.database.Database.main(Database.java:570)
    Connection = null
    java.lang.NullPointerException
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at com.web.database.DatabaseManager.getConnection(DatabaseManager.java:74)
    at com.web.database.Database. (Database.java:200)
    at com.web.database.Database.main(Database.java:570)
    The strangest thing is that a file can be created using the given properties file, but I don't understand why an input strean cannot be created.
    Please help, what am I doing wrong?
    Thanks in advance.
    Yours,
    Me

    Creating a File object does not create a file on the
    filesystem. They are not the same thing.Thank you guys for responding. But the problem I was posting for is the following:
    I have a properties file that I want to load database properties from. But it gives me the problem mentioned above.. NB: The exception shown above does not give any indication about the argument you're making. The system just complains that the file cannot be found.
    Now take a look at a response from a similar post I made at wwww.javalobby.org:
    bviously your databasesetting.properties file is not located under the C:\Development\Java\infosys\settings folder.
    That's why you get the FileNotFoundException when doing new FileInputStream(file).
    You should not rely on absolute or relative path (relative to the current working directory) to load a file in Java.
    It's better to rely on the class path (as allways in Java).
    So you should:
    1- Copy the databasesetting.properties file in a folder pointed by the class path.
    For instance you could copy it under the same package folder than your class that tries to load it.
    2- Then do instead of using the File and FileInputStream classes:
    try {
    InputStream stream = getClass().getResourceAsStream("databasesetting.properties");
    properties.load(stream);
    Again, thanks for taking time out and respond. I highly appreciate it!
    Yours,
    Me

  • Why can't I delete the file?

    What I want to do is: After user download the file from web, the application will delete the file automatically on ther server. However, the delete function cannot work which it prompts the java.lang.Exception, I suspent it is the download process hold the file, how can I solve it?
    DownloadReport(request, response, reportFile);
    Utility.deleteFile(reportFile);
         public void DownloadReport(HttpServletRequest request,
                   HttpServletResponse response, String reportFile) throws Exception {
              File fFile = new File(reportFile);
              String stFileName = fFile.getName();
              response.setContentType("application/vnd.ms-excel");
              response.setHeader("Content-Disposition", "attachment;filename=\""
                        + stFileName + "\"");
              // System.out.println("Henry "+getServletContext());
              InputStream isStream = null;
              try {
                   PrintWriter out = response.getWriter();
                   isStream = new FileInputStream(fFile);
                   int i;
                   while ((i = isStream.read()) != -1) {
                        out.write(i);
                   isStream.close();
                   out.close();
              } catch (Exception ioeException) {
                   log.error("Download report error", ioeException);
                   ioeException.printStackTrace();
                   throw new ServletException("Download report error", ioeException);
         public static void deleteFile(String path) {
              boolean deleted = false;
              try {
                   File delefile = new File(path);
                   if (delefile.exists())
                        deleted = delefile.delete();
                   if (deleted == false)
                        throw new Exception("File could not be deleted " + path);
              } catch (Exception e) {
                   e.printStackTrace();
         }

    Hi, my application is using POI API generating the Excel report, after genration, the report will be stored on the server, and then user download the report to their local machine throught web and then I delete the report on the server. I don't quitely understand what you mean, could you kindly explain to me detailly:p. Btw, I have tried to print out the exception, but it only shows "java.lang.Exception: File could not be deleted " which is so limited. If I comment the DownReport function, the file could be deleted successfully. But if it happens after the download action, it is failed.

  • Auto delete everything but specified folder contents from txt file

    Hey Guys,
    I am brand new to using Powershell (like 48 hours into using it for work) and I've run into a bit of an issue.  I've only taken a programming concept classes so some of the stuff makes sense to me but a lot of it is new.  Basically I've made a
    script that automatically deletes any files over X amount of days.  My next step is to have an exceptions text that will have a list of folders that should not have its contents deleted.  This is what I have so far.
    $Date= Get-Date 
    $Days = "7"
    $Folder = "C:\publicftp\users"
    $LastWrite = $Now.AddDays(-$Days)
    #----- getting DO NOT DELETE listing from TXT ----#
    $Exceptions = Get-Content "c:\exclude.txt"
    $Files = Get-Childitem $Folder -Recurse -Exclude "c:\exclude.txt" | Where {$_.LastWriteTime -le "$LastWrite"}
    foreach ($File in $Files)
        if ($File -ne $NULL)
            Remove-Item $File.FullName -Exclude $Exceptions | out-null
    I've seen a lot of threads that show how to auto delete contents or how to exclude specific file types but I haven't seen an answer to my particular problem.  Any help would be greatly appreciated!  Thanks!

    Hi Rabbot,
    The script below may be also helpful for you, and uses the -whatif parameter in Remove-Item cmdlet, which doesn’t actually remove anything but simply tells you what would happen if you did call Remove-Item.
    $Exceptions = @()
    Get-Content "c:\exclude.txt" | foreach{
    $Exceptions += $_} #store the exception file to array
    $Folder = "C:\publicftp\users"
    $LastWrite = (get-date).adddays(-7) #over 7 days.
    $Files = Get-Childitem $Folder -Recurse | Where {$_.LastWriteTime -le $LastWrite} #filter files which over 7 days.
    Foreach ($file in $files){
    if ($Exceptions -notcontains $file.fullname){ #if the file is not listed in the exception array.
    Remove-Item $File.FullName -whatif} #use -whatif to test
    I hope this helps.

  • Classloader won't let me delete jar file!

    Hi-
    I am writing a classloader that runs main from a class called MyMain. MyMain loads classes from a jar file called MattTable.jar. I need to be able to delete the jar file once the classes are loaded from it, or even just delete it at the end of the program. Either way, the classloader will not release it so I cannot delete the jar file until after my program finishes. I want to be able to delete it from with in my code after the method is invoked.
    URL urls[] = new URL[] { new File(".").toURL() };
    URLClassLoader loader = new URLClassLoader( urls );
    Class c = loader.loadClass(mainClass);
    Method m1 = c.getMethod("main", new Class[] { args.getClass() });
    //main loads classes from an outside jar file
    m1.invoke( null, new Object[] {args} );
    //Here is where I want to delete the jar file
    //I would even accept file.deleteOnExit() but this won't work either
    If anyone can help me figure out how to delete this file, it would be a great help!
    Thanks,
    Matt

    Hi,
    I've created a small classloader for jar files which releases the handle every time a class is loaded. It might still need some optimization, but at least it works:import java.util.zip.*;
    import java.util.*;
    import java.io.*;
    public class ZipClassLoader extends ClassLoader {
         private Hashtable classes = new Hashtable();
         private File f;
         public ZipClassLoader(String zipFileName) {
              this (new File(zipFileName));
         public ZipClassLoader(File zipFile) {
              f = zipFile;
         public Class loadClass(String className) throws ClassNotFoundException {
              return (loadClass(className, true));
         public synchronized Class loadClass(String className, boolean resolve) throws ClassNotFoundException {
              if (classes.containsKey(className)) return (Class)classes.get(className);
              ZipFile zipFile = null;
              BufferedInputStream bis = null;
              byte[] res = null;
              try {
                   zipFile = new ZipFile(f);
                   ZipEntry zipEntry = zipFile.getEntry(className.replace('.', '/')+".class");
                   res = new byte[(int)zipEntry.getSize()];
                   bis = new BufferedInputStream(zipFile.getInputStream(zipEntry));
                   bis.read(res, 0, res.length);
              } catch (Exception ex) {
              } finally {
                   if (bis!=null) {
                        try {
                             bis.close();
                        } catch (IOException ioex) {}
                   if (zipFile!=null) {
                        try {
                             zipFile.close();
                        } catch (IOException ioex) {}
              if (res == null) return super.findSystemClass(className);
              Class clazz = defineClass(className, res, 0, res.length);
              if (clazz == null) throw new ClassFormatError();
              if (resolve) resolveClass(clazz);
              classes.put(className, clazz);
              return(clazz);
    }This is the test program I've created. It loads a class from the Apache log4j jar file, and deletes the file when the class is loaded:import java.io.File;
    public class Test {
         public static void main(String[] args) throws Exception {
              File f = new File("C:\\jartest\\log4j-1.2.6.jar");
              ZipClassLoader zl = new ZipClassLoader (f);
              Class c = zl.loadClass ("org.apache.log4j.ConsoleAppender", true);
              Object o = c.newInstance();
              System.out.println (o.getClass().getName());
              f.delete();
    }

  • How to copy file from  one location to another

    Hi,
    I am new to java, I tried the following code to move the file from one location to another
    public class CopyFiles {
    public String copy ( File source, File target)
    throws IOException {   
    FileChannel sourceChannel = null;
    FileChannel targetChannel =null;
    try {   
    sourceChannel =new FileInputStream(source).getChannel();
    targetChannel= new FileOutputStream(target).getChannel();
    targetChannel.transferFrom(sourceChannel, 0,
    sourceChannel.size());
    finally {   
    targetChannel.close();
    sourceChannel.close();
    return "Success";
    public static void main(String [] args) throws Exception{   
    File source = new File("C:\\users\\download.pdf");
    File destinationFile = new File("C:\\apple\\download.pdf");
    copy(source, destinationFile);
    The above code is working perfectly, but I Don't want to include the file name in destination file. i.e. File destinationFile=new File("C:\\apple"), and at the same time the pdf with same name has to get stored in the destination location, how can I achieve this.

    kameshb wrote:
    I Don't want to include the file name in destination file. i.e. File destinationFile=new File("C:\\apple"), and at the same time the pdf with same name has to get stored in the destination location, how can I achieve this.It's not totally clear what you're saying here, but what I think you mean is that you don't want to explicitly set the destination file name--you want to just give the copy the same name as the original. Yes?
    If that's the case, then break the original up into separate directory and file name portions, and then construct the destination path from the destination directory plus original file name. You can do that by manipulating the full path string, or by using the methods in java.io.File.

  • How to Copy an Image File from a Folder to another Folder

    i face the problem of copying an image file from a folder to another folder by coding. i not really know which method to use so i need some reference about it. hope to get reply soon, thx :)

    Try this code. Make an object of this class and call
    copyTo method.
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class FileUtil
    extends File {
    public FileUtil(String pathname) throws
    NullPointerException {
    super(pathname);
    public void copyTo(File dest) throws Exception {
    File parent = dest.getParentFile();
    parent.mkdirs();
    FileInputStream in = new FileInputStream(this); //
    Open the source file
    FileOutputStream out = new FileOutputStream(dest); //
    Open the destination file
    byte[] buffer = new byte[4096]; // Create an input
    buffer
    int bytes_read;
    while ( (bytes_read = in.read(buffer)) != -1) { //
    Keep reading until the end
    out.write(buffer, 0, bytes_read);
    in.close(); // Close the file
    out.close(); // Close the file
    This is poor object-oriented design. Use derivation only when you have to override methods -- this is just
    a static utility method hiding here.

  • How to SCAN uploaded files for VIRUS in APEX

    part 1:
    Goal:
    Do a virus scan of the uploaded file from APEX application prior to storing the file in custom tables.
    The process:
    Followed the document from www.developer.com:
    Implementing an Anti-Virus File Scan in JEE Applications
    By Vlad Kofman
    Go to page: 1 2 3 Next
    This article will discuss one of the ways to implement antivirus file scanning in Java, particular in the JEE applications. Viruses, Trojan Horses, and different malware and spyware are a real problem for current computer environments, and especially for the Windows operating system. If you are designing any application in Java that has a requirement to be able to upload external files, you have a potential security risk. By uploading, I mean any way to get the external file inside of the corporate firewall be it via HTTP protocol or any other means. It is quite common to have this type of requirement in an enterprise application and with Java being one of the most popular web development platforms, it is unfortunate that this type of gaping security risk is quite often overlooked.
    Java's Development Kit (JDK) does not have any means to do the antivirus scan right out of the box. This is primarily because Java is a programming language, and does not have any virus scanning packages. Furthermore, anti-virus software is not Sun's area of expertise or business model. Developing this type of software (or Java package), and more importantly maintaining it, would be a huge task for Sun. Mainly because viruses are constantly evolving and keeping virus definitions up-to-date is a daunting task. Large companies such as McAffee, Symantec, or Zone Labs develop virus detecting and combating products and spend a lot of resources to maintain them.
    Application Environment
    To implement a virus file scan in Java, a third-party package needs to be used. For the purposes of this article, I will use Symantec Scan Engine (SSE) package, which comes with Java APIs. This package is an application that serves as a TCP/IP server and has a programming interface and enables Java applications to incorporate support for content scanning technologies. For this article, I used Symantec Scan Engine 5.1, which is available as a Unix or Windows install.
    If you are using an anti-virus package from the different vendor, you will need to investigate what kind of APIs are available; however, the general approach should be similar. Also, note that my implementation can be used with JEE technology and any modern MVC framework such as Struts or Spring.
    The architecture is as follows: A server machine needs to have SSE running at all times. This can be the same machine that hosts your Application Server, but in an enterprise environment this should be a different machine. The Default Port needs to be open through the firewall to allow communication with the scan engine. All JEE applications that need to do file scanning can talk to the SSE server machine through a default port. Also, multiple applications running on different application servers can re-use the same scanning server. For more information, you should refer to the Symantec Scan Engine (SSE) Installation Guide, available on the Symantec web site.
    When an external file that needs to be scanned is sent to the SSE via its programming interface (Java APIs using the default port), before any other operation on the file is performed, the SSE returns a result code. For instance, a file is uploaded by an external user into the web email type application as an attachment; then, the SSE API is invoked by the application and the return code of pass or fail determines the outcome of the upload and whether that email can actually be sent. If you have an account on Yahoo mail, you probably have seen that Yahoo is using Norton Antivirus to scan all attachments, although no Java.
    Click here for a larger image.
    Figure 1: Screen shot from Yahoo
    For details on the Scan Engine Server Installationm please see the Symantec Scan Engine (SSE) Implementation Guide from Symantec.
    Here are some key things to remember about SSE:
    •     Java 2 SE Runtime (JRE) 5.0 Update 6.0 or later must be installed on the server before the SSE installation is done.
    •     After installation, verify that the Symantec Scan Engine daemon is running. At the Unix command prompt (if it's a Unix install), type the following command:
    ps –ea | grep sym.
    A list of processes similar to the following should appear:
    o     5358 ? 0:00 symscan
    o     5359 ? 0:00 symscan
    If nothing is displayed the SSE process did not start.
    If the SSE process did not start, type the following command to restart SSE:
    /etc/init.d/symscan restart
    •     Keeping the virus definition up to date is the most important task and if new updates are not installed, the whole scan becomes ineffective. Symantec automatically downloads the most current file definitions through LiveUpdate. Please make sure that firewall rules are in place to allow the host server to connect to the Symantec update service.
    Project Setup
    For the purposes of this article, I included a wrapper for the Symantec SSE APIs, av.jar, which has Symantec Java APIs and serves as a client to the SSE server and takes care of all communications with the server. Please refer to the download source section. The av.jar should be included in the Java CLASSPATH to work with the SSE. This jar contains a class called AVClient that takes care of actually sending the files to SSE as byte arrays and returning the result.
    In my project setting, I added three variables to be accessed via the System.getProperty mechanism. For example:
    AV_SERVER_HOST=192.168.1.150
    AV_SERVER_PORT=1344
    AV_SERVER_MODE=SCAN
    The AV_SERVER_HOST is the host name or IP of the machine where Scan Engine is installed.
    The AV_SERVER_PORT is the port where Scan Engine listens for incoming files.
    The AV_SERVER_MODE is the scan mode which can be:
    •     NOSCAN: No scanning will be done (any keyword that does not start with "SCAN" will result in ignoring the call to the Scan Engine and no files will be transferred for scanning).
    •     SCAN: Files or the byte stream will be scanned, but the scan engine will not try to repair infections.
    •     SCANREPAIR: Files will be scanned, the scan engine will try to repair infections, but nothing else will be done.
    •     SCANREPAIRDELETE: Files will be scanned, the scan engine will try to repair infections, and irreparable files will be deleted.
    Note: For the file stream (byte array) scanning, the only meaning full values are "SCAN" and "NOSCAN".
    Using the SSE Scanning Java APIs
    In any class where scan is required, call the scanning API provided in the AVClient object located in the av.jar. The AVClient object will establish connection to the Scan Engine server and has the following APIs:
    Figure 2: The significant APIs for the communication with to the Scan Engine Server.
    If scanning a file on the file system, in SCAN only mode, use the call that accepts filename only.
    If scanning a file on the file system, with SCANREPAIR or SCANREPAIRDELETE, use the call that accepts input and output file names.
    If scanning an in-memory file (byte array), use the call accepting byte array.
    For example:
    import com.av.*;
    Initialize setup parameters:
    static String avMode =
    (System.getProperty("AV_SERVER_MODE") != null)
    ? (String) System.getProperty("AV_SERVER_MODE") : "NOSCAN";
    static boolean scan = avMode.startsWith("SCAN");
    static String avServer =
    (String) System.getProperty("AV_SERVER_HOST");
    static int avPort =
    Integer.parseInt( (String) System.getProperty("AV_SERVER_PORT"));
    Scan check example for an in-memory file byte array:
    public void scanFile(byte[] fileBytes, String fileName)
    throws IOException, Exception {
    if (scan) {
    AVClient avc = new AVClient(avServer, avPort, avMode);
    if (avc.scanfile(fileName, fileBytes) == -1) {
    throw new VirusException("WARNING: A virus was detected in
    your attachment: " + fileName + "<br>Please scan
    your system with the latest antivirus software with
    updated virus definitions and try again.");
    Note that if you are using this code inside of the MVC handler, you can throw a custom VirusException and check for it in the calling method and perform any necessary cleanup. I have included the class in the AV Jar as well.
    For example:
    catch (Exception ex) {
    logger.error(ex);
    if (ex instanceof VirusException) {
    // do something here
    else {
    // there was some other error – handle it
    For more details on the Scan Engine Client API, please see Symantec Scan Engine Software Developers Guide.
    Continuation in part2

    part 4:
    c)     Clienttester.java – This is the gui app set to test if the configuration is working or not. This gui uses the method scanfile(inputfile, outputfile) as you can see the result in the outputpane of the jframe.
    * clienttester.java
    * Created on April 12, 2005, 2:37 PM
    * @author george_maculley
    package com.av;
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class clienttester
    implements ActionListener {
    // private String ipaddress = "127.0.0.1";
    private String ipaddress = "199.209.150.58";
    //private String ipaddress = "192.168.0.55";
    static JFrame frame;
    JFileChooser chooser = new JFileChooser();
    TextField pathtofile = new TextField(System.getProperty("user.home"), 30);
    // TextField pathtooutfile= new TextField(System.getProperty("user.home"),30);
    private int port = 1344;
    JButton filechooser = new JButton("Browse to file"); ;
    private String originalfilename;
    private String outputfilename;
    JButton scanbutton = new JButton("Scan");
    TextArea outputarea = new TextArea(20, 40);
    TextField iptext = new TextField("127.0.0.1", 16);
    TextField porttext = new TextField("1344", 5);
    AVClient mine;
    JRadioButton choosescan = new JRadioButton("SCAN");
    // JRadioButton choosedelete= new JRadioButton("SCANREPAIRDELETE");
    /** Creates a new instance of gui */
    public clienttester() {
    public clienttester(java.lang.String ip, java.lang.String infile, java.lang.String outfile, int port) {
    this.ipaddress = ip;
    this.port = port;
    this.originalfilename = infile;
    this.outputfilename = outfile;
    boolean setValues(java.lang.String ip, java.lang.String infile, java.lang.String outfile, int port) {
    this.ipaddress = ip;
    this.port = port;
    this.originalfilename = infile;
    this.outputfilename = outfile;
    return (true);
    public void actionPerformed(java.awt.event.ActionEvent actionEvent) {
    JComponent c = (JComponent) actionEvent.getSource();
    if (c == filechooser) {
    int retval = chooser.showDialog(frame, null);
    if (retval == JFileChooser.APPROVE_OPTION) {
    File theFile = chooser.getSelectedFile();
    if (theFile != null) {
    pathtofile.setText(theFile.getPath());
    // pathtooutfile.setText(theFile.getPath());
    JOptionPane.showMessageDialog(frame, "You chose this file: " + theFile.getPath());
    if (c == scanbutton) {
    //return object that can be passed to AVClient
    String policy;
    int thisport;
    int scanresult;
    String thisip;
    String inputfile;
    String outputfile;
    outputarea.append("Server: " + iptext.getText() + "\r\n");
    if (choosescan.isSelected()) {
    policy = "SCAN";
    else {
    policy = "SCANREPAIRDELETE";
    thisport = new Integer(porttext.getText()).intValue();
    thisip = iptext.getText();
    //mine= new AVClient(iptext.getText(),porttext.getText(),policy);
    mine = new AVClient(iptext.getText(), thisport, policy);
    if (mine.test() == 1) {
    outputarea.append("Sorry. Incorrect parameters specified.\r\n");
    System.exit(1);
    else {
    outputarea.append("Connection to SAVSE initialized.\r\n");
    inputfile = pathtofile.getText();
    // outputfile=pathtooutfile.getText();
    outputfile = "/tmp";
    outputarea.append("Scanning file " + inputfile + " \r\n");
    if (policy == "SCAN") {
    scanresult = mine.scanfile(inputfile);
    else {
    scanresult = mine.scanfile(inputfile, outputfile);
    if (scanresult == 0) {
    outputarea.append("File is clean.\r\n");
    else if (scanresult == -1) {
    outputarea.append("File is infected. \r\n");
    else {
    outputarea.append("Scan error.\r\n");
    void display() {
    Frame f = new Frame("SAVSE JAVA ICAP Client");
    f.setLayout(new GridLayout(1, 2));
    JPanel lpanel = new JPanel(new GridLayout(7, 1));
    JPanel ippanel = new JPanel();
    JPanel portpanel = new JPanel();
    JPanel rpanel = new JPanel();
    JPanel outputpanel = new JPanel();
    JPanel buttonpanel = new JPanel();
    JPanel pathpanel = new JPanel();
    // JPanel outpathpanel= new JPanel();
    JPanel policypanel = new JPanel();
    ButtonGroup policygroup = new ButtonGroup();
    filechooser.addActionListener(this);
    scanbutton.addActionListener(this);
    choosescan.setSelected(true);
    policygroup.add(choosescan);
    // policygroup.add(choosedelete);
    buttonpanel.setBorder(BorderFactory.createTitledBorder("Scan Policy"));
    buttonpanel.add(choosescan);
    // buttonpanel.add(choosedelete);
    pathpanel.setBorder(BorderFactory.createTitledBorder("Path to File"));
    pathpanel.add(pathtofile);
    f.setSize(new Dimension(650, 400));
    f.setBackground(Color.white);
    f.setResizable(true);
    ippanel.setBorder(BorderFactory.createTitledBorder("SAVSE IP Address"));
    ippanel.add(iptext);
    outputpanel.setBorder(BorderFactory.createTitledBorder("OUTPUT"));
    outputpanel.add(outputarea);
    portpanel.setBorder(BorderFactory.createTitledBorder("ICAP Port"));
    portpanel.add(porttext);
    // outpathpanel.setBorder(BorderFactory.createTitledBorder("Path to Repair File"));
    // outpathpanel.add(pathtooutfile);
    lpanel.add(ippanel);
    rpanel.add(outputpanel);
    lpanel.add(portpanel);
    lpanel.add(buttonpanel);
    lpanel.add(pathpanel);
    // lpanel.add(outpathpanel);
    lpanel.add(filechooser);
    lpanel.add(scanbutton);
    f.add(lpanel);
    f.add(rpanel);
    f.setVisible(true);
    public static void main(String[] args) {
    clienttester g = new clienttester();
    g.display();
    d)     my2.java – This is the class file I wrote to test that I am able to send a file and scan it and see the output in the JDEVELOPER. In this case the file is stored on the filesystem of the client machine. JDEVELOPER should be able to see the file.
    NOTE:
    “EICAR.com” is the test file downloaded from Symantec site to test a non malicious virus file. I n order to be able to test it like this, the Antivirus program running on your machine should be disabled, or else Antivirus will kick in and delete the file. In the first place you will not be able to download the test virus file either with anti virus running on the machine you are downloading to.
    package com.av;
    import java.io.*;
    public class my2 {
    static int my_return = 0;
    * @param fileBytes
    * @param fileName
    * @return
    public static int scanfile(String fileName){
    String avMode = "SCAN";
    boolean scan = avMode.startsWith("SCAN");
    String avServer = "xx";--avserver ip address
    int avPort = 1344;
    int the_return = 0;
    if (scan) {
    AVClient avc = new AVClient(avServer,avPort,avMode);
    the_return = avc.scanfile(fileName);
    if (the_return == -1) {
    return (the_return);
    } else
    return (the_return);
    //my_return = the_return;
    return (the_return);
    public static void main(String[] args) throws Exception {
    System.out.println("Hi there in Main");
    byte[] b1 = new byte[4];
    b1[1] = 68;
    my_return = scanfile("c:\\eicar.com");
    System.out.println(my_return);
    e)     Then finally we have my1.JAVA, which takes the filename, and it’s contents in the bytes form and scans the file. The reason for this method is we are not storing the file on the filesystem, it is read into the memory and only if it is clean, it is put into the database or else notify the user.
    package com.av;
    import java.io.*;
    public class my1 {
    static int my_return = 0;
    static int a_length = 0;
    * @param fileBytes
    * @param fileName
    * @return
    public static int scanfile(String fileName,byte[] fileBytes) throws IOException {
    String avMode = "SCAN";
    boolean scan = avMode.startsWith("SCAN");
    String avServer = "xxx";--avserver’s ip address
    int avPort = 1344;
    int the_return = 0;
    if (scan) {
    AVClient avc = new AVClient(avServer,avPort,avMode);
    // File file = new File(fileName) ;
    //byte[] fBytes = getBytesFromFile(file);
    the_return = avc.scanfile(fileName, fileBytes);
    if (the_return == -1) {
    return (the_return);
    } else
    {return (the_return);}
    my_return = the_return;
    return (the_return);
    // Returns the contents of the file in a byte array.
    * @param file
    * @return
    * @throws IOException
    public static byte[] getBytesFromFile(File file) throws IOException {
    InputStream is = new FileInputStream(file);
    // Get the size of the file
    long length = file.length();
    // You cannot create an array using a long type.
    // It needs to be an int type.
    // Before converting to an int type, check
    // to ensure that file is not larger than Integer.MAX_VALUE.
    if (length > Integer.MAX_VALUE) {
    // File is too large
    // Create the byte array to hold the data
    byte[] bytes = new byte[(int)length];
    // Read in the bytes
    int offset = 0;
    int numRead = 0;
    while (offset < bytes.length
    && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
    offset += numRead;
    // Ensure all the bytes have been read in
    if (offset < bytes.length) {
    throw new IOException("Could not completely read file "+file.getName());
    // Close the input stream and return bytes
    is.close();
    return bytes;
    // public static void main(String[] args) throws Exception {
    //System.out.println("Hi there in Main");
    // File file = new File() ;
    // byte[] b1 = getBytesFromFile(file);
    //System.out.println(b1);
    // my_return = scanfile(,b1);
    //System.out.println(my_return); }
    Finally , you have the exceptions file,
    e) package com.av;
    public class VirusException
    extends Exception {
    public VirusException() {
    super();
    public VirusException(String text) {
    super(text);
    Once you have all these classes, you can use JDEVELOPER , to load these classes into the database: This is as follows:
    Right click on the project, which has all these classes.
    NEW -> deployment profiles -> load java and stored procedures.
    When you are created deployment profile, you have to specify,
    Loadjava options.
    -f, -v (check the check boxes)
    Under privileges:
    -s – specify database schema these classes are loaded into
    -s – create sysnonym check box
    -g – grant to public or any specific users per your policy.
    Under Resolver,
    -r and –o (check the check boxes)
    I accepted the default name storedproc1. Then you right click on the storedproc1.deploy, deploy to whichever database connection you created.
    And then, In order to access this java class we need a pl/sql wrapper as follows:
    create or replace package my1 is
    function mycheck (pfilename in varchar2, psize in number)
    return number;
    end my1;
    create or replace package body my1 is
         function mycheck (pfilename in varchar2, psize in number)
    return number is
    language java
         name 'com.av.my1.scanfile(java.lang.String, byte[]) return int';
         end my1;
    And the code is invoked from sql plus as follows:
    Select my1.mycheck(“filename”, “filebytes”) from dual;
    One important catch in the above method is to send the filename and filecontents in bytes form. In order to send the file contents as filebytes, you will need another java class and load into the data base as described above.
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    * This program demonstrates how to read a file into a byte array. This method
    * reads the entire contents of the file into a byte array.
    * @version 1.0
    * @author Jeffrey M. Hunter ([email protected])
    * @author http://www.idevelopment.info
    public class ReadFileIntoByteArray {
    * method to convert a byte to a hex string.
    * @param data the byte to convert
    * @return String the converted byte
    public static String byteToHex(byte data) {
    StringBuffer buf = new StringBuffer();
    buf.append(toHexChar((data >>> 4) & 0x0F));
    buf.append(toHexChar(data & 0x0F));
    return buf.toString();
    * Convenience method to convert an int to a hex char.
    * @param i the int to convert
    * @return char the converted char
    public static char toHexChar(int i) {
    if ((0 <= i) && (i <= 9)) {
    return (char) ('0' + i);
    } else {
    return (char) ('a' + (i - 10));
    * Returns the contents of the file in a byte array
    * @param file File this method should read
    * @return byte[] Returns a byte[] array of the contents of the file
    private static byte[] getBytesFromFile(File file) throws IOException {
    InputStream is = new FileInputStream(file);
    System.out.println("\nDEBUG: FileInputStream is " + file);
    // Get the size of the file
    long length = file.length();
    System.out.println("DEBUG: Length of " + file + " is " + length + "\n");
    * You cannot create an array using a long type. It needs to be an int
    * type. Before converting to an int type, check to ensure that file is
    * not loarger than Integer.MAX_VALUE;
    if (length > Integer.MAX_VALUE) {
    System.out.println("File is too large to process");
    return null;
    // Create the byte array to hold the data
    byte[] bytes = new byte[(int)length];
    // Read in the bytes
    int offset = 0;
    int numRead = 0;
    while ( (offset < bytes.length)
    ( (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) ) {
    offset += numRead;
    // Ensure all the bytes have been read in
    if (offset < bytes.length) {
    throw new IOException("Could not completely read file " + file.getName());
    is.close();
    return bytes;
    * @param filename
    public static byte[] chk_file(String filename) {
    byte[] fileArray = null;
    try {
    fileArray = getBytesFromFile(new File( filename));
    } catch (IOException e) {
    e.printStackTrace();
    if (fileArray != null) {
    for (int i=0; i<fileArray.length; i++) {
    System.out.println(
    "fileArray[" + i + "] = " +
    ((int)fileArray[i] < 9 ? " " : "") +
    ( ((int)fileArray[i] > 9 && (int)fileArray[i] <= 99) ? " " : "") +
    fileArray[i] + " : " +
    " HEX=(0x" + byteToHex(fileArray) + ") : " +
    " charValue=(" + (char)fileArray[i] + ")");
    return fileArray;
    * Sole entry point to the class and application.
    * @param args Array of String arguments.
    public static void main(String[] args) {
    byte[] fileArray = null;
    try {
    fileArray = getBytesFromFile(new File("c:\\eicar.com"));
    } catch (IOException e) {
    e.printStackTrace();
    if (fileArray != null) {
    for (int i=0; i<fileArray.length; i++) {
    System.out.println(
    "fileArray[" + i + "] = " +
    ((int)fileArray[i] < 9 ? " " : "") +
    ( ((int)fileArray[i] > 9 && (int)fileArray[i] <= 99) ? " " : "") +
    fileArray[i] + " : " +
    " HEX=(0x" + byteToHex(fileArray[i]) + ") : " +
    " charValue=(" + (char)fileArray[i] + ")");
    Having main method helps you to run the file in JDEVELOPER or using JAVA.
    DO not forget to load this class into the database.
    And you create the pl/sql wrapper again as follows:
    create or replace FUNCTION TOBY (pfilename in varchar2) RETURN VARCHAR2 iS
    language java name
    'ReadFileIntoByteArray.chk_file(java.lang.String) return byte[]';
    And you call the function from sqlplus as follows:
    Sql>Set serveroutput on size 20000;
    Sql> call dbms_java.set_output(20000);
    Sql> Select toby(“filename”) from dual; --
    this file should be accessible, I mean you will not be able to send a file on your pc, from sql plus as sql/plus is running on your db server.
    You will be able to see the output in sql plus:
    If you are running it from the APEX:
    When we use file browser widget from APEX, the file is stored in APEX_APPLICATION_FILES table. And we retrieve that into a variable and pass this variable to the function as follows:
    DECLARE
    scan_failed EXCEPTION;
    x varchar2(400);
    z number;
    BEGIN
    select filename into x from wwv_flow_files where name = :P1_FILE_NAME;
    select my1.mycheck(x,toby(x)) into z from dual;
    if z = 0 then
    :P1_SUBJECT:= 'PASSED';
    else
    :P1_SUBJECT:= 'FAILED';
    end if;
    :P1_SCAN_RESULT := '** Scanning File **';
    IF UPPER(:P1_SUBJECT) = 'PASSED' THEN
    BEGIN
    :P1_SCAN_FLAG := 'PASSED';
    :P1_SCAN_RESULT := :P1_SCAN_RESULT || ' ** File passed scan **';
    END;
    ELSIF UPPER(:P1_SUBJECT) = 'FAILED' THEN
    BEGIN
    :P1_SCAN_FLAG := 'FAILED';
    :P1_SCAN_RESULT := :P1_SCAN_RESULT || ' ** File failed scan **';
    END;
    ELSE
    BEGIN
    :P1_SCAN_FLAG := 'UNKNOWN';
    :P1_SCAN_RESULT := :P1_SCAN_RESULT || ' ** Scan Is Not Conclussive **';
    END;
    END IF;
    --IF :P1_SCAN_FLAG = 'FAILED'
    -- THEN RAISE scan_failed;
    --END IF;
    EXCEPTION
    WHEN OTHERS THEN
    DELETE from APEX_APPLICATION_FILES WHERE name = :P1_FILE_NAME;
    RAISE_APPLICATION_ERROR (-20000, 'seb OTHERS error encountered - file upload not allowed. Possible virus detected !');
    raise;
    END;
    ACKNOWLEDMENTS:
    1) JOHN SCOTT – who suggested this ICAP API in one of the threads which is my initial starting point in this direction.
    2) VLAD KOFMAN who wrote the article on WWW.DEVELOPER.com
    3) Mr. KIRAN –One of the engineers from Metalink, who helped me at every step of getting this java programs and pl/sql wrappers working. But for him, I would have not completed my project.

  • How do I find and include pre-existing music files on my PC?

    I'm new to iTunes and believe that I should be able to find and include pre-existing music files on my PC?
    I've found out how to show the menu bar but I can't see how to do the above except file/folder by file/folder.

    Hello there, LeighCenturion.
    The following Knowledge Base article provides instruction on how to add content from your computer to iTunes:
    Adding music and other content to iTunes
    http://support.apple.com/kb/HT1473#2
    Specifically:                     
    Adding content on your computer to iTunes
    iTunes helps you add digital audio and video files on your computer directly to your iTunes library. You can add audio files that are in AAC, MP3, WAV, AIFF, Apple Lossless, or Audible.com (.aa) format. If you have unprotected WMA content, iTunes for Windows can convert these files to one of these formats. You can also add video content in QuickTime or MPEG-4 format to iTunes. To learn how to add these files to iTunes follow the steps below.
    Open iTunes
    From the File menu, choose one of the following choices:
    MacAdd to Library
    Windows
    Add File to Library
    Add Folder to Library
    Navigate to and select the file or folder that you want to add
    If iTunes is set to "Copy files to the iTunes Music folder when adding to library," iTunes will copy all content that is added to the iTunes library to the iTunes Music folder. To adjust this setting or change the location of this folder, go to the Advanced tab in iTunes Preferences.
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • Getting List of files of .wmv extension from a library \ folder in sharepoint 2013

    I need to get all the files from a particular folder in sharepoint library.
    I am using RESTAPI Javascript code as below : 
      var call = jQuery.ajax({
                    url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/GetFolderByServerRelativeUrl('" + folderName + "')/Files",
                    type: "GET",
                    dataType: "json",
                    headers: {
                        Accept: "application/json;odata=verbose"
    This code retrieves all the files in a particular folder, except files with extension of .wmv.
    The count of files retrieved also doesnt include .wmv files.
    Can anyone tell me why this is happening.
    Thanks

    Hi,
    As this is not an expected outcome when requesting files of a library, a suggestion is that please create a new library and upload one sample .wmv file to it and send the request
    again to see if it is an issue of Document Library.
    Feel free to reply with the test result if the issue still exists or there any progress.
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they
    help and unmark them if they provide no help. If you have feedback for TechNet
    Subscriber Support, contact [email protected]
    Patrick Liang
    TechNet Community Support

  • Upload excel file in SAP BI-7.0

    Hi ,
    i  need to  upload an excel  file in SAP BI 7.0 where the standard r/3 fm are not available.
    Currently we uploading a file in CSV format but now we want to upload using XLS also.
    ia way to upload excel  file in SAP BI 7.0
    Best Regards,
    Sharad
    Edited by: sharad narayan on Jan 7, 2011 10:58 AM
    while searching the forum i  found the fm MS_EXCEL_OLE_STANDARD_DAT .
    but while using this FM i  am getting the exception file not exist.
    Kindlu  suggest what  to  do
    i  even tried the FM TMP_GUI_GET_FILE_EXIST' to  check  the existence of the file.
    even then same problem.
    Please suggest
    Edited by: sharad narayan on Jan 10, 2011 2:51 PM

    Hi,
    Scheduled jobs are the jobs for which we have scheduled for a time, may be daily so that each day the scheduled jobs will trigger at the time given.So that every time u need not to trigger the job manully urself as the schedule time will hit the job will trigger itself.
    Released job means the job which is in between Sheduled state and active state.say For eg: 10 jobs are Scheduled in a queue Job no 1 is released from the queue that means any moment it will be in active state.So it is the state between Schedule and Active state of a job.
    Thanks
    Varun

Maybe you are looking for

  • HT1555 My Apple TV wasn't working so I returned it. I kept the same remote from my previous Apple TV and it's not responding to it. What should I do?

    My Apple TV wasn't working so I returned it. I kept the same remote from my previous Apple TV and it's not responding to it. What should I do?

  • Monitor wont play sound

    I have an HP 1740 Monitor with built in speakers I am running Linux Mint 13 (32bit) I had to download adobe flash player and i can hear the Linux noises. Ive cxhecked my speaker in put and output on the computer itself and its all normal. however in

  • Hook Macbook to Sylvania TV

    Hi all, I'm very uncomputery, and hoping you can help me. Is there a way to hook my MacBook up to my Sylvania TV? My MacBook is Model Name: MacBook Model Identifier: MacBook5,1 Processor Name: Intel Core 2 Duo Processor Speed: 2 GHz The TV is: Sylvan

  • Tricky problem in JTable

    Hi there, I am trying to make a JTable display the keyText of all the keys pressed, meaning if I write an "A" I want it to be shown as " shift + a ". Now I'm not quite sure about the way to handle the focus and how to trigger of the action that makes

  • How to turn off spelling check in iCal

    hi, i am new to mac (yeah, i finally made The Transition) and i have the latest Mac OS X Version 10.6.3. would anyone please advise me on how to turn the spelling check off in iCal. i can't seem to find any right answer. thanks a lot.