Passing File objects

It may be that I just don't understand OO principles enough, but I'm having difficulties when I pass a File object to a method. Here's the method that is confusing me.
The method is suppose to change a file's name. It does this just fine. Then I want to change the name inside the File object that points to the file to reflect the new name.
private void foo(File f){
String p = f.getParent();
String n = f.getName();
File tmp = new File(p + "\\" +"Processed_" + n);
boolean b = false;
rename = f.renameTo(tmp);
So then I envoke the method with this
File myFile = new File(pathname);
foo(myFile);
myfile.getname();
Why does myfile.getName return the original name of the file? I pass the myFile by reference to foo(), correct? So when I modify myFile inside foo(), shouldn't those changes persist after exiting foo()?
I've also tried putting this line of code after the rename in foo()
f = new File(p + "\\" +"Processed_" + n);
But when I exit out of foo() this name is not in myFile. myFile still has the original name. The name of the physical file has changed.
Any takers?????
PS when I use f.getName() after the rename inside foo(), the new name is returned.

I looked at the source code for the File class. It appears as if File.renameTo() is indeed renaming the physical file but not updating the name of the file stored in the object; so, when you call getName() after the rename, it returns the original file name.
The Java source method is as follows:
public boolean renameTo(File dest) {
     SecurityManager security = System.getSecurityManager();
     if (security != null) {
     security.checkWrite(path);
     security.checkWrite(dest.path);
     return fs.rename(this, dest);
fs is a FileSystem object.
Basically, this looks like you're the victim of a sin of omission rather than a sin of commission. Your understanding of pointers in Java is not (necessarily) faulty; it's just that it looks like in this case Sun programmers either forgot to add a setName call or they decided it was beyond this scope of the renameTo() method call to do so.

Similar Messages

  • Pass a object from one jar to another jar file

    I have a common jar file which will communicate to the server for data validation purpose.But after validation it has to invoke different different jar file based on its response from the server.So, I might have a object which has to pass from the common jar file to a specific jar file.So, I like to know what will be the best procedure to achieve it.
    Please help me out.

    arpitak wrote:
    Yes,jar file holds class files.one of class files wants to trigger a method of a class file which resides in different jar file.this is the situation I tried to describe.Let consider there are three jar files like JAR A,JAR B ,JAR C.Here JAR A is a common jar where other two jar could be used as a plug in. So based on the condition any one of them (JARS) will be triggered by the common jar(JAR A).this is the situation.The class file of JAR A will trigger some method or main method of the JAR B/JAR C.So,here how could I pass a object from one jar to another is my main question.
    Is it clear now?
    I need a solution for this very urgently.Are you looking for a plug-in framework? That is, dynamically discovering and loading plugins. I am not experienced in developing or using plugins. However Googling "java plugin" brings up JPF.
    If you just have multiple jars that have different classes, the JVM will load the appropriate classes if it can find the jars through the standard classloader on the classpath or through a customer classloader.

  • Passing complex object from bpel process to web service

    I have deployed my web service on apache axis.The wsdl file looks like as follows,
    <?xml version="1.0" encoding="UTF-8" ?>
    - <wsdl:definitions targetNamespace="http://bpel.jmetro.actiontech.com" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://bpel.jmetro.actiontech.com" xmlns:intf="http://bpel.jmetro.actiontech.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    - <wsdl:types>
    - <schema targetNamespace="http://bpel.jmetro.actiontech.com" xmlns="http://www.w3.org/2001/XMLSchema">
    <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
    - <complexType name="ADLevelBpelWS">
    - <sequence>
    <element name="adLevelStr" nillable="true" type="xsd:string" />
    <element name="id" type="xsd:int" />
    </sequence>
    </complexType>
    - <complexType name="TransResultWS">
    - <sequence>
    <element name="description" nillable="true" type="xsd:string" />
    <element name="id" type="xsd:long" />
    <element name="responseType" type="xsd:int" />
    <element name="status" type="xsd:boolean" />
    </sequence>
    </complexType>
    - <complexType name="NamespaceDataImplBpelWS">
    - <sequence>
    <element name="ADLevel" nillable="true" type="impl:ADLevelBpelWS" />
    <element name="appdataDef" nillable="true" type="apachesoap:Map" />
    <element name="description" nillable="true" type="xsd:string" />
    <element name="name" nillable="true" type="xsd:string" />
    </sequence>
    </complexType>
    - <complexType name="CreateSharedNamespaceBpelWS">
    - <sequence>
    <element name="actor" nillable="true" type="xsd:string" />
    <element name="comment" nillable="true" type="xsd:string" />
    <element name="from" nillable="true" type="xsd:string" />
    <element name="namespaceData" nillable="true" type="impl:NamespaceDataImplBpelWS" />
    <element name="priority" type="xsd:int" />
    <element name="processAtTime" nillable="true" type="xsd:dateTime" />
    <element name="replyTo" nillable="true" type="xsd:string" />
    <element name="responseRequired" type="xsd:boolean" />
    </sequence>
    </complexType>
    </schema>
    - <schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
    <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
    - <complexType name="mapItem">
    - <sequence>
    <element name="key" nillable="true" type="xsd:string" />
    <element name="value" nillable="true" type="xsd:string" />
    </sequence>
    </complexType>
    - <complexType name="Map">
    - <sequence>
    <element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem" />
    </sequence>
    </complexType>
    </schema>
    </wsdl:types>
    + <wsdl:message name="createNamespaceRequest">
    <wsdl:part name="createNs" type="impl:CreateSharedNamespaceBpelWS" />
    </wsdl:message>
    - <wsdl:message name="createNamespaceResponse">
    <wsdl:part name="createNamespaceReturn" type="impl:TransResultWS" />
    </wsdl:message>
    - <wsdl:portType name="JMetroWebService">
    - <wsdl:operation name="createNamespace" parameterOrder="createNs">
    <wsdl:input message="impl:createNamespaceRequest" name="createNamespaceRequest" />
    <wsdl:output message="impl:createNamespaceResponse" name="createNamespaceResponse" />
    </wsdl:operation>
    </wsdl:portType>
    - <wsdl:binding name="NAMESPACEWITHMAPSoapBinding" type="impl:JMetroWebService">
    <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
    - <wsdl:operation name="createNamespace">
    <wsdlsoap:operation soapAction="" />
    - <wsdl:input name="createNamespaceRequest">
    <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://bpel.jmetro.actiontech.com" use="encoded" />
    </wsdl:input>
    - <wsdl:output name="createNamespaceResponse">
    <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://bpel.jmetro.actiontech.com" use="encoded" />
    </wsdl:output>
    </wsdl:operation>
    </wsdl:binding>
    - <wsdl:service name="JMetroWebServiceService">
    - <wsdl:port binding="impl:NAMESPACEWITHMAPSoapBinding" name="NAMESPACEWITHMAP">
    <wsdlsoap:address location="http://localhost:7001/axis/services/NAMESPACEWITHMAP" />
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>
    My NamespaceDataObjectImplBpelWS object contains element appDataDef which is of type java.util.Map.My bpel wsdl file is as below,
    <?xml version="1.0"?>
    <definitions name="NsWithMap"
    targetNamespace="http://bpel.jmetro.actiontech.com"
    xmlns:tns="http://bpel.jmetro.actiontech.com"
    xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:apachesoap="http://xml.apache.org/xml-soap"
    >
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    TYPE DEFINITION - List of services participating in this BPEL process
    The default output of the BPEL designer uses strings as input and
    output to the BPEL Process. But you can define or import any XML
    Schema type and us them as part of the message types.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <types>
         <schema targetNamespace="http://bpel.jmetro.actiontech.com" xmlns="http://www.w3.org/2001/XMLSchema">
         <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
              <element name="createNamespace" type="tns:CreateSharedNamespaceBpelWS"/>
              <element name="transResult" type="tns:TransResultWS"/>
              <complexType name="TransResultWS">
                   <sequence>
                        <element name="description" type="string" />
                        <element name="id" type="long" />
                        <element name="responseType" type="int" />
                        <element name="status" type="boolean" />
              </sequence>
              </complexType>
              <complexType name="ADLevelBpelWS">
                   <sequence>
                        <element name="adLevelStr" type="string" />
                        <element name="id" type="int" />
                   </sequence>
              </complexType>
              <complexType name="NamespaceDataImplBpelWS">
                   <sequence>
                        <element name="ADLevel" type="tns:ADLevelBpelWS" />
                        <element name="description" type="string" />
                        <element name="name" type="string" />
                        <element name="appdataDef" type="apachesoap:Map" />
                   </sequence>
              </complexType>
              <complexType name="CreateSharedNamespaceBpelWS">
                   <sequence>
                        <element name="namespaceData" type="tns:NamespaceDataImplBpelWS" />
              </sequence>
              </complexType>
         <element name="desc" type="string"/>
         </schema>
         <schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
                   <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
                        <complexType name="mapItem">
                             <sequence>
                                  <element name="key" type="string" />
                                  <element name="value" type="string" />
                        </sequence>
                        </complexType>
                        <complexType name="Map">
                             <sequence>
                             <element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem" />
                             </sequence>
                        </complexType>
              </schema>
    </types>
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    MESSAGE TYPE DEFINITION - Definition of the message types used as
    part of the port type defintions
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <message name="NsWithMapRequestMessage">
    <part name="payload" element="tns:createNamespace"/>
    </message>
    <message name="NsWithMapResponseMessage">
    <part name="payload" element="tns:transResult"/>
    </message>
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    PORT TYPE DEFINITION - A port type groups a set of operations into
    a logical service unit.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <!-- portType implemented by the NsWithMap BPEL process -->
    <portType name="NsWithMap">
    <operation name="initiate">
    <input message="tns:NsWithMapRequestMessage"/>
    </operation>
    </portType>
    <!-- portType implemented by the requester of NsWithMap BPEL process
    for asynchronous callback purposes
    -->
    <portType name="NsWithMapCallback">
    <operation name="onResult">
    <input message="tns:NsWithMapResponseMessage"/>
    </operation>
    </portType>
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    PARTNER LINK TYPE DEFINITION
    the NsWithMap partnerLinkType binds the provider and
    requester portType into an asynchronous conversation.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <plnk:partnerLinkType name="NsWithMap">
    <plnk:role name="NsWithMapProvider">
    <plnk:portType name="tns:NsWithMap"/>
    </plnk:role>
    <plnk:role name="NsWithMapRequester">
    <plnk:portType name="tns:NsWithMapCallback"/>
    </plnk:role>
    </plnk:partnerLinkType>
    </definitions>
    I am trying to set this map data using java code ,
         HashMap procADMap1 = new HashMap(5);
                   PropertyTypeWS pType = new PropertyTypeWS();
                   pType.setTypeIndex(2);     
              AppdataDefImplWS appData1 = new AppdataDefImplWS();
              appData1.setName("Project");
              appData1.setType(pType);
              appData1.setMaxSize(400);
              appData1.setLOB(false);
         appData1.setDefaultValue("Project Default value");
              procADMap1.put(appData1.getName(), appData1);
              setVariableData("request","createNs","/createNs/namespaceData/appdataDef",procADMap1);     
    Then I am passing request object to the method which I want to invoke from bpel process.
    I am able to deploy the application but when I do post message I am getting following exception,
    NamespaceWithMap (createNamespace) (faulted)
    [2004/09/09 18:35:54] "{http://schemas.oracle.com/bpel/extension}bindingFault" has been thrown. Less
    faultName: {{http://schemas.oracle.com/bpel/extension}bindingFault}
    messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage}
    code: {Server.userException}
    summary: {org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.}
    detail: {null}
    Is there any other way to handle Map type in bpel process?
    Thanks in advance,
    Sanjay

    Thanks for the quick reply.Actually the web service is already deployed on the server.What I want to do is use existing wsdl file of the deployed web service and invoke the method of the same using oracle PM.
    If I remove element which uses apachesoap:Map type it just works fine also I am getting the complex object returned by the web service method.But when I try to set appDataDef which is of type apachesoap:Map(Axis conversion for java.util.Map and it uses namespace xmlns:apachesoap="http://xml.apache.org/xml-soap") I am getting the error.
    Can you give me some direction to use this exising wsdl file to set map object or it is not possible.

  • How to get File  object from Document Object . ?

    In conventional Dom Parsing we pass file to DocumentBuilder to get Document Object .
      File file = new File("c:\\MyXMLFile.xml");
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      DocumentBuilder db = dbf.newDocumentBuilder();
      Document doc = db.parse(file); // gOT Document here . My problem is how do i get File object back from Document . If i have Document object with mi.
    Please consider above code as example i dont have File object in my code . i am using Xhive DB API where i get Document directly from API method .
    I need to convert this Document to File to get size of file
    Please suggest solution on this
    Edited by: AmitChalwade123456 on Dec 5, 2008 6:10 AM

    Hello Guys any views on this topic

  • Question about using file objects

    Hi,
    I have two somewhat related issues in using file objects.
    In one app, a simple swing gui that passes a file to a sax parsing class and reports back any errors, if I parse a file using the app, then try to edit the file I'm parsing (in another application) and save, I get an error message. I need to close the parsing app before I can save the file.
    In another app I wrote, one that takes a group of files and runs an xslt stylesheet on them, if I select too many files, I get an OutOfMemory error, which leads me to believe that as the files go through multilple processes, they stay alive on the heap.
    a file object is basically just a pathname, right? If I'm not using a BufferedWriter, or InputStreamReader or whatever, you can't really close a file...will the notifiy() method let the jvm know that it can let go of the file?
    thanks,
    bp

    A File object is just a path, it doesn't open the file or lock it, etc.. But if you are parsing the file, you must be opening (and forgetting to close it).

  • How to release process model sequence file object?

    Calling engine's method GetStationModelSequenceFile we get the reference to the process model sequence file object. According to TestStand Help, you should "Release this reference when you are done using it." The question is: how do you release it? Call engine's method ReleaseSequenceFileEx passing the reference to the model sequence file gotten from GetStationModelSequenceFile won't work, it returns FALSE which means the sequence file can't be released. Similar problems exist with methods SequenceFile.GetModelSequenceFile, Execution.GetModelSequenceFile. My aplication is written in VB. Using the statement like
    Set modelSequenceFile = Nothing also does not solve the problem.  I want to get some information of process model, such as version number, so I call those API functions in my code, which was developed under TestStand 3.1. I post this question because when I ran my application with TestStand 3.5 or 4.0 beta, I got the warning dialog when loading a sequence file and then closing the application. The dialog listed all the unreleased objects which I figured out is due to that the process model file was not released. Because message in the dialog is as following:
    The following top-level objects were not released:
            Sequences [1 object(s) not released]
                Sequence #1:
                    Name: Test UUTs
            Type Definitions [43 object(s) not released]
                Type Definition #1:
                    Name: TimeDetails
                Type Definition #2:
                    Name: ReportOptions
    Of course there are more in the list, but the sequence file loaded into the application is released correctly by calling engine's method ReleaseSequenceFileEx, so it does not appear in the list.
    Any help will be greatly appreciated.

    Here are what I did after launch the operator interface:
    1) Call Engine.GetSequenceFileEx to get a reference to a sequence file.
    2) Display steps of MainSequence of the sequence file in GUI.
    3) Call Engine.GetStationModelSequenceFile to get a reference to the station process model sequence file. The variable used to save the reference of process model sequence file is modelSequenceFile.
    4) Loop through all the sequences in process model sequence file, get the references of entrypoint sequences in the process model and put them in a container (VB Collection).
    At this point,
    Calling modelSequenceFile.CanUnload returns TRUE
    Calling modelSequenceFile.IsExecuting returns FALSE
    Calling Engine.ReleaseSequenceFileEx(modelSequenceFile, ReleaseSeqFile_UnloadFile) returns FALSE
    There is no other loaded process model sequence file reference at this point.

  • Problem in passing/returning objects over dynamic web service call

    Hi Friends,
    I am beginner in java web service.
    Here is the problem I am facing when I pass/return user defined objects to remote web service method using dynamic we service call.
    The client can call the remote web service method in 2 ways.
    1. By generating client stubs using WSDL file
    - In this case, I am able to pass/return the user defined objects to remote method without any issue only when the server side web services are deployed in any server(jboss)
    - But in java 1.6 & above, the web services can be deployed without server using endpoint. In this case, I am not able to pass/return objects over web service calls.
    2. Without generating client stubs (dynamic web service call)
    - This will establish a connection at run time using the given WSDL file (I have attached the document). I have to form an XML(This will contain API name, arguments) string as input at run time
    - In this case, it allows only string as argument while passing & returning.
    Please let me know if you can help me on this.
    Regards,
    pani

    I'm not sure about your question, but this might help:
    [http://forum.java.sun.com/thread.jspa?threadID=5251188|http://forum.java.sun.com/thread.jspa?threadID=5251188]
    You might also want to read on JAXB.

  • Creating a File object in a JSP page

    Hi,
    I am trying to create a File object in my JSP page by passing it a relative path. The jsp page is in 'website/testfolder/index.jsp' and the File is in 'website/photos/1.jpg'. In my jsp page i do the following:
    <% File f = new File("../photos/1.jpg");
    boolean test = f.isFile(); %>
    The value returned is false. I am trying to figure out why it can't locate the file.
    Thanks

    You have to use absolute paths. You can get the absolute path for the given relative path by ServletContext#getRealPath().

  • Handling file objects in the EJB layer

    It is seen that file handling in the EJB violates the specs.
    But, I have the requirement to read and parse some xpdl(xml specification) file in EJB.
    The parsing function is already in the EJB layer and the filepath is obtained as input from jsp(in the request) in a servlet.
    Im passing the filepath as a parameter to the bean method before parsing.
    Now the requirement is to construct the File object out of xpdl file and pass it as a parameter to EJB method. How can this be achieved?

    Hi,
    I'm not sure if this is helpful or not, but I just wanted to ask: If you know you need to parse the file on the EJB side, why not just go and do it? If you can always guarantee that files will be present in the same location that the beans are deployed to, then I don't think there is anything stopping you from reading them, if you know the full path to each file?
    You wrote that the path to the file is obtained from a JSP page. If those files need to be parsed anyway, you could move the parsing code to your JSPs (servlets), and use ServletContext.getResourceAsStream to read the contents. Then you could send the contents as a parameter to your EJB call.
    One last thing: if the files are large, you might want to consider using JMS and message-driven beans to do the reading/parsing job. Your MDBs could then call the EJBs, but you would have to return your results in an asynchronous manner.
    Just a couple of thoughts.
    Mark

  • Passing Opaque Objects from Oracle to Java

    Hi all
    I am trying to write a stored procedure that needs to be called from different triggers. Each triggers needs to pass a different set of data to the stored procedure. Now the problem is that i need to pack the different set of data into one opaque object type that i can pass onto java. Is there any way of doing this. I am using Oracle 9i running on Linux 2.4.9. I tried using the Object datatype in Oracle 9i. But am not able to pass a object datatype to java directly.

    Didn't know that. Guess the way this API handles the struct is it puts it on the heap, since this idea (with passing a 32-bit var back and forth with a memory location) worked.
    My next problem - I can't figure out a way to destroy a jstring: whenever I do an env->GetStringUTF((char*)charBuff), it seems to simply copy the bytes from the buffer
    into the same String object up the length of the buff (so I get the extra bytes from the previous String if it was longer at the end).
    Here's how it works: I have a loop in C code that parses tags inside a file, then depending on what tag it is, I create a new jobject and call a Java method to do stuff
    to that object. As one of the parameters in the constructor I pass in a String that I create (as you can see above) from a character array, however I am getting
    massive artifacts when I print out that String inside the Java method.
    Thoughts? :(

  • Pass Files As Arguments

    I have several files and want to pass them as arguments to a Helper class for further processing. I put the public static void main (String arg[]) {} class and the Helper class in a package.
    I got error messages "cannot resolve symbol" for:
    1. variable XSLTransformHelper for if (!XSLTransformHelper.transform(xmlin, xslin, htmlout))
    2. method close() for xmlin.close();
    3. method close() for xslin.close();
    4. method close() for htmlout.close();
    I cannot spot the problems and my code can be seen below:
    =====================================
    package Transform;
    import java.io.*;
    public class XSLTransform {
    public static void main(String[] args) throws Exception {
    //Create a file object with the file name in the argument:
    File xmlin = new File("c:/javaprj/RSS.xml");
    File xslin = new File("c:/javaprj/RSS.xsl");
    File htmlout = new File("c:/javaprj/RSS.html");
    if (!XSLTransformHelper.transform(xmlin, xslin, htmlout))
    System.err.println("Transformation failed");
    else
    try {
    xmlin.close();
    xslin.close();
    htmlout.close();
    catch(IOException e)
    {System.out.println("closing file exception");}
    =======================================================
    =======================================================
    package Transform;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.stream.StreamSource;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    public class XSLTransformHelper {
    public static boolean transform(String xmlFilename, String xslFilename, String resultFilename) {
    try {
    TransformerFactory factory = TransformerFactory.newInstance();
    Source xmlSource = new StreamSource(new FileInputStream(xmlFilename));
    Source xslSource = new StreamSource(new FileInputStream(xslFilename));
    Transformer transformer = factory.newTransformer(xslSource);
    Result result = new StreamResult(new FileOutputStream(resultFilename));
    transformer.transform(xmlSource, result);
    return true;
    } catch (TransformerFactoryConfigurationError transformerFactoryConfigurationError) {
    transformerFactoryConfigurationError.printStackTrace();
    } catch (FileNotFoundException e) {
    e.printStackTrace();
    } catch (TransformerException e) {
    e.printStackTrace();
    return false;
    ======================================================

    I have several files and want to pass them as
    arguments to a Helper class for further processing. I
    put the public static void main (String arg[]) {}
    class and the Helper class in a package.
    I got error messages "cannot resolve symbol" for:
    1. variable XSLTransformHelper for if
    (!XSLTransformHelper.transform(xmlin, xslin,
    htmlout))
    2. method close() for xmlin.close();
    3. method close() for xslin.close();
    4. method close() for htmlout.close();
    I cannot spot the problems and my code can be seen
    below:
    =====================================
    package Transform;
    import java.io.*;
    public class XSLTransform {
    public static void main(String[] args) throws
    ws Exception {
    //Create a file object with the file name in the
    n the argument:
    File xmlin = new File("c:/javaprj/RSS.xml");
    File xslin = new File("c:/javaprj/RSS.xsl");
    File htmlout = new File("c:/javaprj/RSS.html");
    if (!XSLTransformHelper.transform(xmlin, xslin,
    slin, htmlout))
    System.err.println("Transformation failed");
    else
    try {
    xmlin.close();
    xslin.close();
    htmlout.close();
    catch(IOException e)
    {System.out.println("closing file
    losing file exception");}
    =======================================================
    =======================================================
    package Transform;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.stream.StreamSource;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    public class XSLTransformHelper {
    public static boolean transform(String
    ing xmlFilename, String xslFilename, String
    resultFilename) {
    try {
    TransformerFactory factory =
    y factory = TransformerFactory.newInstance();
    Source xmlSource = new StreamSource(new
    mSource(new FileInputStream(xmlFilename));
    Source xslSource = new StreamSource(new
    mSource(new FileInputStream(xslFilename));
    Transformer transformer =
    ansformer = factory.newTransformer(xslSource);
    Result result = new StreamResult(new
    mResult(new FileOutputStream(resultFilename));
    transformer.transform(xmlSource, result);
    return true;
    } catch (TransformerFactoryConfigurationError
    onError transformerFactoryConfigurationError) {
    transformerFactoryConfigurationError.printStackTrace()
    } catch (FileNotFoundException e) {
    e.printStackTrace();
    } catch (TransformerException e) {
    e.printStackTrace();
    return false;
    ======================================================I observe that you pass Files as arguments of the method transform while this method is expecting Strings!!!!

  • "Cannot put olap file object" exception when trying to copy outline

    Hi all,
    I'm trying to copy a given outline file to a remote essbase server (11.1.1 installed in Linux 64 bits).
    I already managed to create both application and DB, but when I'm trying to copy a file from my file server, I get the following exception:
    EssException: com.essbase.api.base.EssException: Cannot put olap file object. ..\data\1 (The system cannot find the path specified)
    def copyOutline(self,destOlapAppName, destOlapCubeName):
    print "* Copying outline for " + destOlapAppName + "/" + destOlapCubeName
    self.ess = IEssbase.Home.create(IEssbase.JAPI_VERSION)
    self.dom = self.ess.signOn(self.userName, self.password, "essbase", "EMBEDDED")
    destOlapSvr = self.dom.getOlapServer(self.essHost)
    destOlapSvr.connect()
    srcPath = '\\\\Some\\Existing\\Path\\To\\Outline.otl'
    try:
    destOlapSvr.getApplication(destOlapAppName).stop()
    except EssException, (e):
    print e.getMessage()
    pass
    try:
    destOlapSvr.lockOlapFileObject(destOlapAppName,
    destOlapCubeName,
    IEssOlapFileObject.TYPE_OUTLINE,
    destOlapCubeName)
    except EssException, (e):
    print e.getMessage()
    pass
    destOlapSvr.copyOlapFileObjectToServer(destOlapAppName,
    destOlapCubeName,
    IEssOlapFileObject.TYPE_OUTLINE,
    destOlapCubeName,
    srcPath,
    False)
    I get the exception at copyOlapFileObjectToServer.
    This is the header I'm getting when using EMBEDDED mode:
    Hyperion Provider Services - Release 11.1.1.3.00 Build 196
    Copyright (c) 1991, 2009 Oracle and / or its affiliates. All rights reserved.
    connection mode : EMBEDDED
    essbase.properties: essbase.properties
    domain.db location: domain.db
    console log enable : false
    file log enable : false
    logRequest : false
    logLevel : ERROR
    java System properties -DESS_ES_HOME: null
    What am I missing here? Maybe the fact that I dont have ESS_ES_HOME defined?
    Thanks all.

    Figured out what the problem was.
    found this reference: http://essbaselabs.blogspot.com/2009_05_01_archive.html where it says what DESS_ES_HOME should be.
    gave vm -DDESS_ES_HOME the correct value and voila....

  • Initialize QTMovie in a child thread by passing Movie object.

    I'm working on an Qt (Qt framework) application in which I'm making use of a .mm file to call MAC specific functions.
    I need to initialize QTMovie in a child thread by passing Movie object.
    [QTMovie movieWithQuickTimeMovie:movie disposeWhenDone:TRUE error:nil]
    It appears like I have to initialize QTMovie in main thread. I came across performSelectorOnMainThread which might be of some help. Could anyone please show me the right usage of the same?
    I need to call a method using performSelectorOnMainThread by passing the Movie object to it and which returns the initialized QTMovie object.
    Thanks in advance.

    Ah, you seem to be on to something, there. The main thread gives
    sun.misc.Launcher$AppClassLoader@111f71
    while the child thread gives null. The same occurs whether the experiment is in
    the same JVM instance or not.
    So presumably this means I need to get the context loader from the main thread
    and set it in the child thread manually!?
    - Angus.
    Patrick Linskey wrote:
    Angus Monro <[email protected]> writes:
    Okay.... I'm not really sure what you're asking for. What I've done is
    printed the ClassLoader object as given by
    com.solarmetric.util.app.Prefs.class.getClassLoader(), along with its
    parent recursively up the tree of loaders. This gave:
    sun.misc.Launcher$AppClassLoader@111f71
    sun.misc.Launcher$ExtClassLoader@256a7c
    This result was exactly the same irrespective of whether I did it from the
    main thread or the child thread. But the exception still happens only the
    child thread.Sorry, I should have been more clear. Can you print out the current
    thread's context's classloader?
    System.out.println (Thread.currentThread ().getContextClassLoader ());
    Also, what happens if you run the test in the main thread and then in
    the child thread, all in the same JVM?
    -Patrick
    - Angus.
    Patrick Linskey [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • File object can't find a file

    Hi,
    I am trying to create a File object using:
    File file = new File("myfile.txt");
    I am getting a FileNotFoundException.
    The file is stored in a folder (windows2000) that I have put on both my classpath and path.
    When I type echo %classpath% or %path% I see the folder.
    I am running this as a standalone class (not a servlet).
    I am using Websphere Studio App. Developer.
    Does anyone have any suggestions?
    Thanks in advance,
    Vaughne

    Thanks but I don't want to specify an absolute path.
    On my PC the file exists in "e:\SomeFolder"
    Put on the production PC it may exist in "c:\SomeOtherFolder"
    That's why I want the JVM to find the file using either the Path or Classpath variables......
    ------------------8<----------------
    You do have to supply the full path to the file if you want to load it.
    If you need to supply a different path on each system, then use a system property. To pass in a system property at run time, use:
    java -DmyFilePath=c:\somefolder ......
    In your code, you can retrieve the path using:
    String myPath = System.getProperty("myFilePath");
    File myfile = new File(myPath + System.getProperty("file.separator") + "MyFile.txt");
    Thanks,
    Brian

  • Pass SSIS Object to child SSIS package

    I tried to pass a SSIS Object (actually a DataSet) to a child package. I got an error which tells me that I am not allowed to do that. Why can't I do it ? This never happens in a programming language. Are there any workarounds for this ?
    Thanks.
    error message - 
    Error - Property "Value" with type "Object" of variable "User::MY_DATA_SET"
    can not be exported to the configuration file.

    What you are trying to do is unsupported. If you need to pass a rowset to another package store the rows in a table or use a raw file.
    The workaround is mentioned here - http://stackoverflow.com/questions/20669398/pass-ssis-object-to-child-ssis-package
    Or you can directly go to the solution at - 
    http://agilebi.com/jwelch/2009/10/03/passing-an-object-from-a-parent-package-to-a-child/
    I tested it and it works. Thanks.

Maybe you are looking for

  • Issue with viewing Package Body  in SQL Developer 2.1 RC1

    Were anybody able to see the package body of other user in 2.1 RC1. I had an issue since 2.1 EA 1 so... just curious. - Oracle 9i - Windows XP SP3 Please do let me know if there is any hint or setting that can be change to view the package body. Than

  • Attach Documents using Generic Object Services

    With reference to Manual Bassani's SDN Contribution of code examples on how to attach documents using Generic Object Services - we have found that since implementing ECC 6 the following code no longer works (at the end of page 9): CALL CREATE ATTACHM

  • Producer Consumer with a state machine within the consumer

        Hi All, I have been trying to develop a data acquisition system with the producer consumer architecture.  To the left of the two main loops I initialize the serial port and any constants and variables im using.  I also have an obtain queue VI nee

  • Please, i need help getting internet on my phone.

    Okay, so I got a replacement and this one doesn't have a web browser option. I remember last time I had to download a file and add it manually by the blackberry software. Can someone please send me the file I need to download pretty please?

  • After Effects and Cinema 4D but what about Carrara and Poser

    I know Autodesk owns Maya, 3DS and even Softimage's/Avid's XSI.  Having said that I don't doubt that is why Adobe partnered with Cinema 4D. I am not a fan of Cinema 4D myself and would have prefered Maya, 3DS Max or even XSI over Cinema 4D for integr