Field.get(Object obj) now returning null with Generics (Java 5.0) ??

Hello,
I'm currently using Java 5.0 (especially for the Generics part) on a new Java/J2EE project, but having a strange issue with code working previously in a Java 1.4 project.
Below is an overriding of the toString() method provided by the Object class which allow me to view nicely in debug (dev. mode) the contents of my Transfer Objects (all the TO's must extend this ATO abstract class).
Previously this code displayed me something like:
[field1 => value1, field2 => value2] ... for a TO (sort of "Javabean") having e.g. two String fields with values initialized to "value1" (resp. "value2").
But unfortunately, this does (or seems) not to work anymore, having such display :
[field1 => null, field2 => null]I tried to debug, and the problem is that the call fieldValue = field.get(this); returns null while it should returns the actual value of the field.
I thing it it strongly related to Generics, but could not at the moment found how/why it does not work.
May someone help...? Thanks.
public abstract class ATO {
    // Reflection for field value display
    public String toString() {
        StringBuffer sb = new StringBuffer("[");
        MessageFormat mf = new MessageFormat("{0} => {1}, ");
        Field[] fields = this.getClass().getDeclaredFields();
        for (int i = 0; i < fields.length; i++) {
            Field field = (Field) fields;
String fieldName = field.getName();
Object fieldValue = null;
try {
fieldValue = field.get(this);
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
mf.format(new Object[] { fieldName, fieldValue }, sb, null);
if (sb.length() > 1) {
sb.setLength(sb.length() - 2);
sb.append("]");
return sb.toString();

ejp wrote:
Field field = (Field) fields;
This cast is unnecessary.
Effectively, I haven't noticed it yet. Fixed.
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
}Either the field value really is null or you are getting one of these exceptions which you are ignoring. Never write empty catch blocks.That's true, I missed something. Fixed with some code to log the eventual exceptions.
Thanks for you answer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Why does the Java method ServletContext.getResourceAsStream return null with a know good path to an xsl file?

    iPLANET ISSUE
    Why does the Java method ServletContext.getResourceAsStream return null with a know good path to an xsl file?
    CODE
    ServletContext context = mpiCfg.getServletConfig().getServletContext();
    // Debugging
    out.print(context.getServerInfo());     // Get server info
    out.print(&#8220;getRealPath = &#8221; + context.getRealPath("WEB-INF/xsl/RedirectToAcs.xsl"));
    String strXslName = "RedirectToAcs.xsl";
    InputStream is = context.getResourceAsStream("WEB-INF/xsl/"+ strXslName);
    TRACE FROM THE LOG
    [26/Jul/2002:08:23:15] info ( 2868): [0][][ClearCommerceCcpaMpi][]getServerInfo() = iPlanet-WebServer-Enterprise/6.0, getRealPath() = C:\iPlanet\Servers\web-apps\ccpa\WEB-INF\xsl\RedirectToAcs.xsl
    [26/Jul/2002:08:23:15] info ( 2868): [0][][ClearCommerceCcpaMpi][]strXslName = RedirectToAcs.xsl, is = null
    [26/Jul/2002:08:23:15] info ( 2868): [1][][ClearCommerceCcpaMpi][16]ResourceAsStream is null
    [26/Jul/2002:08:23:15] info ( 2868): [1][][ClearCommerceCcpaMpi][30]Problem reading XSL file.
    DIRECTORY DUMP
    C:\iPlanet\Servers\web-apps\ccpa\WEB-INF\xsl>dir
    Volume in drive C has no label.
    Volume Serial Number is 9457-EBF4
    Directory of C:\iPlanet\Servers\web-apps\ccpa\WEB-INF\xsl
    07/22/2002 05:54p <DIR> .
    07/22/2002 05:54p <DIR> ..
    07/22/2002 05:54p 3,086 RedirectToAcs.xsl
    07/22/2002 05:54p 3,088 Response.xsl
    2 File(s) 6,174 bytes
    2 Dir(s) 1,797,405,696 bytes free

    I think there's supposed to be a forward slash before WEB-INF.
    InputStream is = context.getResourceAsStream("/WEB-INF/xsl/"+ strXslName);

  • Get textFrame by label returns null and anchored objects

    I have the following two functions:
    function getByLabel(page, label)
        for(var i=0; i < page.allPageItems.length; i++)
            if( page.allPageItems[i].label == label )
                return page.allPageItems[i];
    and
    Object.prototype.findItems = function(/*obj*/props)
        if( !('everyItem' in this) )
            throw new Error("Error: " + this + " is not a collection.");
        var ret = this.everyItem().getElements(),
            i = ret.length,
            e, p;
        while( i-- && e=ret[i] )
            for( p in props )
                if( (p in e) && e[p]===props[p] ) continue;
                ret.splice(i,1);
        return ret;
    In my page structure, I got one main text frame (the content area) and two vertical text fromes on the sides of the page. There is also a small box textframe on top of the page. All these textboxes EXCEPT the main text frame are ALL "ANCHORED objects". I had to make them anchored objects, eitherwise after importing data, the boxes would jump around. (Example, the small box textframe that is on the top would get moved to the content area textframe etc). Not sure if using anchored objects is the proper way to fix this.
    When I try to get the small box text frame, it does not work using the findItems (returns null) but it works fine with the getByLabel method. Why is that?
    The calling syntax is:
    for( i=0 ; i < doc.pages.length ; ++i )
            var page = doc.pages.item(i);
            var textFrame = getByLabel(page, 'lblSection' ); //This works
            //   var textFrame = page.textFrames.findItems({ label:  'lblSection' })[0]; This does not work, returns null
            if( textFrame != null )
                textFrame.parentStory.contents = "";

    (function () {
        // Per the InDesign Scripting Guide, app.activeScript is only
        // valid when a script is directly executed from InDesign, not
        // from the ESTK, so a try/catch block is recommended to handle
        // it.
        var d;
        try {
            d = app.activeScript.parent.parent.fsName;
        } catch (e) {
            d = Folder.appPackage.parent.fsName+"/Scripts";
            return d;

  • Field.set(Object obj, Object value)

    As I parse an XML file (Using SAX XML Reader) I'm also building objects dynamically as I go on parsing. I'm using Field.set() successfully to assign values to String or Integer instance variables, but If one of these objects has an instance variable which is say, a vector. then how can I dynamically add (using addElement(object)) objects to it? Could please someone help?
    // Get the Class object of member
    // Assume member is the current object
    Class memberClass = member.getClass();
    // Dynamically access the instance variable
    memberField = memberClass.getDeclaredField(currentElement);
    // Set the value of the instance variable
    memberField.set(member,newValue);
    Thanks,
    Ahmet

    This is still a problem for me and I am yet to find a solution. I'd like to define the problem once again and hope for a suggestion that might lead to a solution:
    I've got an object called "member" whose instance variables are dynamically being set from a SAX parser ContentHandler modules. In this "member" object all but one instance variables are of type String. With the below logic, I have no problem of setting values for these dynamically;
    // Get the Class object of member
    Class memberClass = member.getClass();
    // Dynamically access the instance variable
    memberField = memberClass.getDeclaredField(currentElement);
    // Set the value of the instance variable, which is parsed value gotten from String s = new String(ch, start, end); in characters method in ContentHandler class
    memberField.set(member,s);
    The problem arises when I want to set the only instance variable in the member class which is of type Vector. My intention is to use xxxx.addElements(someObject) where someObject is already created and initialized. How can I use memberField.set(member,s) when the field is Vector and instead of setting a value I want to use addElements.

  • How to get UserPrincipalName if getUserPrincipalName() return null?

    Hi Everybody,
    Issue like topic posted. This issue is directed related to To Frank: how to have some pages not need login while ADF Security is on
    let me re-cap the use case: I have a web apps with security implemented. A welcome page with no ADF BC access is out of security as the main entry. All works fine until I need to add user registration functionality to the apps. I added a method binding to the welcome page to link to use registration page. The problem is I have custom codes in prepareSession() in application module to set the User Principle after security login as the current user. After I added the method binding to the welcome page. The AM was accessed at the first time in welcome page and the UserPriciple in user session is set to null. After login, the UserPriciple is not reset to the login user. So I get null when I call getUserPrincipalName(). So my problem is how could I get UserPrincipalName without use session from AM? Can I use JSF security and how?
    thanks everyone!

    "ObjectID"? I may be wrong but I think it's up the JVM how to deal with issues like this. The default response from toString doesn't have to be what it usually is, and isn't guaranteed to have any meaning.
    You can't do pointer arithmetic in Java, if that's what you're hoping for.
    But check out System.identityHashCode. That plus getClass.getName plus an @ plus formatting as hex will get the string you want.

  • Getting connection error on windows xp with connector-java-3.1.10 for Mysql

    Hi,
    I am using Mysql 4.1.13 with Tomcat 5 and Connector mysql-connector-java-3.1.10 on Windows XP machine. When I try to update the table in batch mode sometimes( When server is idle for a long time) get following error.
    ERROR [com.userdefined.SchedulerJobs.DownloadDssPresetJob] com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2921)
    =ERROR [com.userdefined.SchedulerJobs.DownloadDssPresetJob] com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1570)
    =ERROR [com.userdefined.SchedulerJobs.DownloadDssPresetJob] com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
    =ERROR [com.userdefined.SchedulerJobs.DownloadDssPresetJob] com.mysql.jdbc.Connection.execSQL(Connection.java:2972)
    =ERROR [com.userdefined.SchedulerJobs.DownloadDssPresetJob] com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
    com.mysql.jdbc.Statement.execute(Statement.java:529)
    I also get the following error :
    com.mysql.jdbc.CommunicationsException
    MESSAGE: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.SocketException
    MESSAGE: Software caused connection abort: recv failed
    STACKTRACE:
    java.net.SocketException: Software caused connection abort: recv failed
    java.net.SocketException: Software caused connection abort: recv failed
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:129)
         at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:105)
         at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:148)
         at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:176)
         at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1899)
         at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2348)
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2858)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1570)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:2972)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
         at com.mysql.jdbc.Statement.executeQuery(Statement.java:822)
         at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
         at com.userdefined.DatabaseMapping.DatabaseParser.getColumns(DatabaseParser.java:388)
         at com.userdefined.DatabaseMapping.Table.<init>(Table.java:62)
         at com.userdefined.DatabaseMapping.DBMapping.parseAndSave(DBMapping.java:185)
         at com.userdefined.SchedulerJobs.DownloadDssNewJob.downloadJob(DownloadDssNewJob.java:404)
         at com.userdefined.SchedulerJobs.DownloadDssNewJob.execute(DownloadDssNewJob.java:113)
         at org.quartz.core.JobRunShell.run(JobRunShell.java:191)
         at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:516)
    I have searched the web for the same but could not come up with the exact solution.
    Please help me with the same.
    Regards,
    veena

    And, according to this release note:
    http://java.sun.com/j2se/1.4.2/docs/guide/swing/SwingChanges.html#4668963
    ...sounds like exactly what you are seeing.
    Metal Can Now Pick up Font Sizes from the Desktop on Microsoft Windows
    The bugtraq reports that correspond to this change are: 4419964 and 4668963.
    Prior to this release, the DefaultMetalTheme ignored the font size information from the Windows desktop. As of release 1.4.1, DefaultMetalTheme can use the font sizes specified in the Windows desktop. This can be disabled using the system property swing.useSystemFontSettings. An additional part of this bug is that our Windows look and feel was picking up the wrong fonts for a handful of components; this has been fixed.

  • Nulls from HashMap.get(Object)

    I understand that I get the nulls because the Object is not in the map. But is there some elegant way to have it default to the empty String?
    Right now, after I grab all my data into variable with HashMap.get(Object), I go and check each once for null, and assign it the empty String instead. This is a lot of lines of code for something that is so basic.
    I know i could initialize them all to the empty string, and then for each variable, check the HashMap with containsKey(Object) before assigning with HashMap.get(Object). Now, would I be correct in assuming the compiler would optimize this for me and not actually check the HashMap twice for the same Object? And... even if that is the case, its still just as many lines of code.
    Is there perhaps some more elegant way?
    String exchange = parameterMap.get("exchange");
    String messageType = parameterMap.get("messagetype");
    String traderTimeStamp = parameterMap.get("traderTimeStamp");
    String exchangeTimeStamp = parameterMap.get("exchangeTimeStamp");
    String sequence = parameterMap.get("sequence");
    String product = parameterMap.get("product");
    String quantity = parameterMap.get("quantity");
    String price = parameterMap.get("price");
    if (exchange == null)
    exchange = "";
    if (messageType == null)
    messageType = "";
    if (traderTimeStamp == null)
    traderTimeStamp = "";
    if (exchangeTimeStamp == null)
    exchangeTimeStamp = "";
    if (sequence == null)
    sequence = "";
    if (product == null)
    product = "";
    if (quantity == null)
    quantity = "";
    if (price == null)
    price = "";

    You could first put "" for all potential keys.
    Or you could create a helper method
    public String nonNull(String s) {
      return (s != null) ? s : "";
    String exchange = nonNull(parameterMap.get("exchange"));

  • Map.get(K) and Map.get(Object)

    When I first saw the new 2.0 generics compiler, I was very pleased to see that the signature of Map.get() has changed (since 1.3) from:
        interface Map<K,V> { V get(Object obj); }to:
        interface Map<K,V> { V get(K key); }because it means buggy code like this:
        Map<File,Integer> fileSizeMap = new HashMap<File,Integer>();
        Integer sizeOfFile = fileSizeMap.get("/tmp/foo");
        if (sizeOfFile == null) {
            System.err.println("File not found in map");
        }(where I have mistakenly called Map.get() with a String rather than a File) will now get a compiler error rather than a fault raised several months after the application has gone live.
    So, as I say, I am very pleased with the new signature for Map.get(), although I would also like to see the following methods changed:
        boolean containsKey(Object)   -> boolean containsKey(K)
        boolean containsValue(Object) -> boolean containsValue(V)
        V remove(Object object)       -> V remove(K)However, I just read on http://cag.lcs.mit.edu/~cananian/Projects/GJ/Bugs/v20/map.html that Neal Gafter says that putting Map.get(K) into 2.0 was a mistake, and that it will be put back to Map.get(Object) in the next version.
    I do hope I haven't missed something obvious, but keeping these methods with Object parameters seems to me to be a backwards step from the excellent type safety benefits provided by Generics.
    Does anyone else agree with me that having get(K) would be beneficial in allowing the compiler to identify bugs that would otherwise only be discovered much later?
    Or, could someone explain to me why having get(Object) is preferable, and whether this reason is more important than the type safety issue I identified in my example code above?
    Many thanks in advance
    Geoff

    Gafter wrote:
    The reason the argument type is Object and not K is that existing code depends on the fact
    that passing the "wrong" key type is allowed, causes no error, and simply results in the
    key not being found in the map.But "existing code" does not use Generics, and therefore as with all other non-generic code, the authors of that code can choose to either leave it as it is (in which case their Maps will become Map<Object,Object> and Map.get() will then take an Object), or to upgrade it to Generics, and take advantage of the helpful compiler messages that may highlight some design flaws in the original code.
    In Jakarta Commons Collections (this is "existing code"), there's a class MultiHashMap which extends HashMap. When you call MultiHashMap.put(someKey, someValue) it appends someValue to an ArrayList that gets stored as the value in the HashMap. However when you call MultiHashMap.get(someKey), it returns a Collection of values, rather than just a single value.
    If they try to upgrade MultiHashMap to Generics, they are going to come up with a problem: they would be needing something like this:
        public class MultiHashMap<K,V> extends HashMap<K,V> {
            public V put(K key, V value) { ... }
            public Collection<V> get(K key) { ... }
        }which of course is not allowed, since Map<K,V>.get() returns V, not Collection<V>.
    Now, I don't hear anyone saying: This "existing code" relies on Map.get() returning an Object, so in Generics we're going to make Map.get() return Object rather than V.
    No, instead we (correctly) say: That MultiHashMap code was wrong to abuse the flexibility provided by the use of Object as the return value of Map.get(), and if it wishes to use Generics, it will either need to become MultiHashMap<K,Object>, or if it insists on being MultiHashMap<K,V>, it will not be allowed to extend HashMap.
    I really don't see the problem in using Generics (and a typesafe Java Collections API) as a means of highlighting problems in existing code. As I said before, existing code will continue to work as before, because List will become List<Object> and Map will become Map<Object,Object>.
    This is no worse than "accidentally" trying to get() with a key of the right
    type but the wrong value. Since none of these methods place the key into the
    map, it is entirely typesafe to use Object as the method's parameter.Suppose for a moment that when String.endsWith() was first written, it took an Object parameter instead of a String. If I were to say to you: This method needs to change its parameter from Object to String, would you tell me that that there's no need to make the change, because a String can only ever end in a String, and so it is entirely typesafe to use Object as the method's parameter?
    Geoff

  • Get Object[] length in ArrayList

    How do I get the size of the Object[] in ArrayList?
    Not ArrayList.size() which returns how many Elements
    are in the List.

    You could use reflection if you really wanted to know
    how much memory you have "wasted".
    KajHere's a stupid class to do just that.
    Thanks.
    import java.util.*;
    import java.lang.reflect.*;
    public class Test{
    public static void main(String[] args){
         new Test();
    public Test(){
         List list = new ArrayList(1);
         double capacity = 0;
         double size = 0;
         Random rand = new Random();
         int iter = rand.nextInt(100);
         System.out.println("Iter: " + iter);
         for(int i = 0; i < iter; i++){
         int rn = rand.nextInt(10);
         Integer integer = new Integer(rn);
         list.add(integer);
         size = list.size();
         System.out.println("List Size: " + size);
         try{
         Class al = list.getClass();
         // Get Declared Fields
         System.out.println("\nGet Declared Fields");
         Field[] fields1 = al.getDeclaredFields();
         for(int i = 0; i < fields1.length; i++){
         System.out.println("Field: " + fields1.getName());
         // Get Fields
         System.out.println("\nGet Fields");
         Field[] fields2 = al.getFields();
         for(int i = 0; i < fields2.length; i++){
         System.out.println("Field: " + fields2[i].getName());
         // Get Field
         System.out.println("\nGet Field");
         //Field field = al.getField("elementData");
         Field field = fields1[1];
         field.setAccessible(true);
         System.out.println("Field (elementData): " + field.getName());
         Object obj = field.get(list);
         Object[] elementData = (Object[])obj;
         capacity = elementData.length;
         } catch(Exception e){
         e.printStackTrace();
    System.out.println("List Capacity: " + capacity);
         int percentOver = (int)(((capacity - size) / capacity) * 100);
    System.out.println("Percent Over: " + percentOver);

  • TreeMap's containsValue(Object obj)

    In the Map interface there is a method called containsValue(Object obj) that returns a boolean. My question is, does this method call the objects equal method? or does it have some other way to check for the object in the map?

         * Returns <tt>true</tt> if this map maps one or more keys to the
         * specified value.  More formally, returns <tt>true</tt> if and only if
         * this map contains at least one mapping to a value <tt>v</tt> such
         * that <tt>(value==null ? v==null : value.equals(v))</tt>.  This
         * operation will probably require time linear in the Map size for most
         * implementations of Map.
         * @param value value whose presence in this Map is to be tested.
         * @return  <tt>true</tt> if a mapping to <tt>value</tt> exists;
         *          <tt>false</tt> otherwise.
         * @since 1.2
        public boolean containsValue(Object value) {
            return (root==null ? false :
                    (value==null ? valueSearchNull(root)
                                 : valueSearchNonNull(root, value)));
        private boolean valueSearchNull(Entry n) {
            if (n.value == null)
                return true;
            // Check left and right subtrees for value
            return (n.left  != null && valueSearchNull(n.left)) ||
                   (n.right != null && valueSearchNull(n.right));
        private boolean valueSearchNonNull(Entry n, Object value) {
            // Check this node for the value
            if (value.equals(n.value))
                return true;
            // Check left and right subtrees for value
            return (n.left  != null && valueSearchNonNull(n.left, value)) ||
                   (n.right != null && valueSearchNonNull(n.right, value));
        }Hope that helps :)

  • Response writer return null in afterPhase(PhaseEvent event)

    Hi Guys,
    i am trying to include AJAX functionality in a JSF custom data table component. i try to include AJAX stuff with PhaseListener afterPhase method. but i couldn't able to get ResponseWriter as it return null. please help me if you have any other alternatives.
    Regards,
    Ananth.P

    Hi Abhi
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
        <title>WelCome</title>
      </head>
      <body>
        <form name="FORM1" action="index.jspx" method="POST" enctype="text/plain"
              id="MYFORM">
        <input type="text" name="EMPNO" value="02320" maxlength="5" size="10"/>
        <input type="hidden" name="MYLOGIN" value="domain\username" />
        <input type="submit" value="SUBMIT"/>
        </form>
      </body>
    </html>
    Above is my HTML source
    When I hit submit button in firefox, following is displayed in firebug
    2 urls are displayed and following is the output
    url :  POST  ..../faces/index.jspx
            Post : EMPNO=02320
                      MYLOGIN=domain\username
    url : GET  ..../faces/index.jspx?_adf.ctrl-state=pho8qnvmy_39&_afrLoop=12220822020345
            PARAM :
                            _adf.ctrl-state      pho8qnvmy_39
                            _afrLoop            12220822020345
    Thanks
    Deven

  • Get attribute name from VO returns null.

    Hello,
    I'm using JDeveloper 11.1.1.3. I have an af:inputfile component in which i set a ValueChangeListener. I'm using the attribute "Filename" from the form view to set the name of the file before saving it to a directory. At first, i had a different layout for my jspx page (very similar in design) and everything was working perfectly. When i redesigned the page, i'm now getting "null" as the filename. I'm not able to get the attribute! Although i didn't change anything in the code! I tried writing a simple method to output the attribute:
          public String justOutput(){
            BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
            AttributeBinding attr = (AttributeBinding) bindings.getControlBinding("Filename");
            if (attr == null)
                return null;
            String filename = (String) attr.getInputValue();
            System.out.print(filename);
            return null;
          }It was able to output the attribute. But in my original method i'm getting "null".
    ******Another important observation*******
    If i pressed upload another time at runtime and uploaded another file it works again!
    Here is my code:
         public void uploadFile(ValueChangeEvent valueChangeEvent)  {
              InputStream in;
              FileOutputStream out;   
              ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
              String fileLoc = context.getInitParameter("DATA_DIR");                 
              UploadedFile file= (UploadedFile)valueChangeEvent.getNewValue();                           
              boolean exists = (new File(fileLoc)).exists();
              if(!exists){
                (new File(fileLoc)).mkdirs();
              if(file != null && file.getLength() > 0){
                FacesContext context2 = FacesContext.getCurrentInstance();
                FacesMessage message = new FacesMessage("File Uploaded" + file.getFilename() +
                                                        "(" + file.getLength() + "bytes)");
                //context2.addMessage(valueChangeEvent.getComponent().getClientId(context2), message);
                BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
                AttributeBinding attr = (AttributeBinding) bindings.getControlBinding("Filename");
                if (attr == null)
                    return;
                String filename = (String) attr.getInputValue();
                try {
                         out = new FileOutputStream("C:\\demos\\" + filename + ".pdf");
                         in = file.getInputStream();
                         for (int bytes=0; bytes < file.getLength(); bytes++) {
                             out.write(in.read());
                         in.close();
                         out.close();
                     } catch (IOException e) {
                     e.printStackTrace();
              else {
                  String filename = file != null ? file.getFilename():null;
                  String byteLength = file != null ? "" + file.getLength():"0";
          }I don't think the code is wrong because it worked before. But why is this happening?
    Can anyone please help!?
    Mohamed.

    Sorry for the late reply Frank,
    Thanks for your reply, no i didn't! But it worked when i set the 'autosubmit' property to true... Like you said:
    the name field hasn't updated the model to the time you try and access itThanks again.
    Mohamed

  • Getting SPWeb.CurrentUser as null with Windows Authentication (AD), when configured for Claims Authentication

    Hi All,
    We recently migrated to SP 2013 from SP 2010. We are using most of the OOB features, with a few custom code. We have implemented a custom ASP.NET Membership Provider that authenticates against a web service. This was working fine on SP 2010.
    The entire code base was migrated to SP 2013 (with .net fw 4.5, etc) and any issues Compile / Runtime were fixed. However, we are stuck at one bug, which seems to be occuring only while trying to login with Windows Authentication. When a user tries to login
    with Forms Authentication, the error is never noticed.
    Scenrio: Login as Windows Authentiction.
    Result: The user is signed into the system and is authenticated against the AD. For random page loads - it throws access denied (even though he is a site collection admin). While attaching a debugger, we found that, at times the SPWeb.CurrentUser is null (weird).
    At the same time, the HttpContext.Current.Request.IsAuthenticated returns true. Which means the User is Authenticated, but not available in the SPWeb.CurrentUser object. 
    Attached are couple of ULS Logs that we found. The line which says IsAuthenticated=True, UserIdentityName=, ClaimsCount=0 is a little disturbing. Can you please let me know what is happening here? I am not able to access the root site (http://win2012d2:1234/)
    however, i am able to access (http://win2012d2:1234/SitePages/Home.aspx) just fine, without any issues.
    Please note, this error is only when the user is logged into sharepoint as a windows user. The forms user faces no such issues.
    ULS Logs:
    Name=Request (GET:http://win2012d2:1234/)
    Non-OAuth request. IsAuthenticated=True, UserIdentityName=, ClaimsCount=0
    Application error when access /, Error=Exception of type 'System.ArgumentException' was thrown.  Parameter name: encodedValue  
     at Microsoft.SharePoint.Administration.Claims.SPClaimEncodingManager.DecodeClaimFromFormsSuffix(String encodedValue)    
     at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(IClaimsIdentity claimsIdentity, String encodedIdentityClaimSuffix)    
     at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(String encodedIdentityClaimSuffix)    
     at Microsoft.SharePoint.Utilities.SPUtility.GetFullUserKeyFromLoginName(String loginName)    
     at Microsoft.SharePoint.ApplicationRuntime.SPHeaderManager.AddIsapiHeaders(HttpContext context, String encodedUrl, NameValueCollection headers)    
     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PreRequestExecuteAppHandler(Object oSender, EventArgs ea)    
     at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()    
     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    Getting Error Message for Exception System.ArgumentException: Exception of type 'System.ArgumentException' was thrown.  Parameter name: encodedValue    
     at Microsoft.SharePoint.Administration.Claims.SPClaimEncodingManager.DecodeClaimFromFormsSuffix(String encodedValue)    
     at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(IClaimsIdentity claimsIdentity, String encodedIdentityClaimSuffix)    
     at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(String encodedIdentityClaimSuffix)    
     at Microsoft.SharePoint.Utilities.SPUtility.GetFullUserKeyFromLoginName(String loginName)    
     at Microsoft.SharePoint.ApplicationRuntime.SPHeaderManager.AddIsapiHeaders(HttpContext context, String encodedUrl, NameValueCollection headers)    
     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PreRequestExecuteAppHandler(Object oSender, EventArgs ea)    
     at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()    
     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    [Forced due to logging gap, Original Level: Verbose] Looking up {0} site {1} in the farm {2} 
    Unknown SPRequest error occurred. More information: 0x80070005
    SPRequest.GetPageListId: UserPrincipalName=, AppPrincipalName= ,bstrUrl=http://win2012d2:1234/
    System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)), StackTrace:   
     at Microsoft.SharePoint.SPContext.get_ListId()    
     at Microsoft.SharePoint.SPContext.get_List()    
     at Microsoft.SharePoint.WebControls.ScriptLink.InitJs_Register(Page page)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, Boolean injectNoDefer, Boolean controlRegistration, Boolean loadInlineLast,
    Boolean ignoreFileNotFound)    
     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion, String ctag)    
     at Microsoft.SharePoint.WebControls.ScriptLink.Register(String uiVersion, Control ctrl, Page page, String name, Boolean localizable, Boolean defer)    
     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer)    
     at Microsoft.SharePoint.WebControls.ScriptLink.GetOnDemandScriptKey(String strKey, String strFile, Boolean registerDependencies, Control ctrl, Page page)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Page page, String strFile, Boolean localizable)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, Boolean injectNoDefer, Boolean controlRegistration, Boolean loadInlineLast,
    Boolean ignoreFileNotFound)    
     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion, String ctag)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable)    
     at Microsoft.SharePoint.WebControls.ScriptLink.OnLoad(EventArgs e)    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
     at System.Web.UI.Page.ProcessRequest()    
     at System.Web.UI.Page.ProcessRequest(HttpContext context)    
     at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)    
     at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm)    
     at System.Web.HttpServerUtility.Transfer(String path)    
     at Microsoft.SharePoint.Utilities.SPUtility.TransferToErrorPage(String message, String linkText, String linkUrl)    
     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorHandler(HttpApplication app, Boolean errorIsOnErrorPage)    
     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorAppHandler(Object oSender, EventArgs ea)    
     at System.EventHandler.Invoke(Object sender, EventArgs e)    
     at System.Web.HttpApplication.RaiseOnError()    
     at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)    
     at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)    
     at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)    
     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)    
     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)    
     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
    SPRequest.OpenWeb: UserPrincipalName=, AppPrincipalName= ,bstrUrl=http://win2012d2:1234/
    System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)), StackTrace:   
     at Microsoft.SharePoint.SPWeb.InitWeb()    
     at Microsoft.SharePoint.SPWeb.get_WebTemplateConfiguration()    
     at Microsoft.SharePoint.WebControls.ScriptLink.InitJs_Register(Page page)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, Boolean injectNoDefer, Boolean controlRegistration, Boolean loadInlineLast,
    Boolean ignoreFileNotFound)    
     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion, String ctag)    
     at Microsoft.SharePoint.WebControls.ScriptLink.Register(String uiVersion, Control ctrl, Page page, String name, Boolean localizable, Boolean defer)    
     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer)    
     at Microsoft.SharePoint.WebControls.ScriptLink.GetOnDemandScriptKey(String strKey, String strFile, Boolean registerDependencies, Control ctrl, Page page)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Page page, String strFile, Boolean localizable)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, Boolean injectNoDefer, Boolean controlRegistration, Boolean loadInlineLast,
    Boolean ignoreFileNotFound)    
     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion, String ctag)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable)    
     at Microsoft.SharePoint.WebControls.ScriptLink.OnLoad(EventArgs e)    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
     at System.Web.UI.Page.ProcessRequest()    
     at System.Web.UI.Page.ProcessRequest(HttpContext context)    
     at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)    
     at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm)    
     at System.Web.HttpServerUtility.Transfer(String path)    
     at Microsoft.SharePoint.Utilities.SPUtility.TransferToErrorPage(String message, String linkText, String linkUrl)    
     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorHandler(HttpApplication app, Boolean errorIsOnErrorPage)    
     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorAppHandler(Object oSender, EventArgs ea)    
     at System.EventHandler.Invoke(Object sender, EventArgs e)    
     at System.Web.HttpApplication.RaiseOnError()    
     at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)    
     at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)    
     at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)    
     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)    
     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)    
     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)

    Hi Mohamed,
    According to your description, my understanding is that the error occurred when users login with Windows Authentication.
    From the error message, I recommend to check if the anonymous access is enabled for the web application.
    And please also make sure that the users all are available and have permission to access the site.
    Here is a similar thread for you to take a look:
    http://social.technet.microsoft.com/Forums/en-US/28623bdc-a2f0-4876-9be4-9a764f106366/getting-spwebcurrentuser-as-null-with-windows-authentication-ad-when-configured-for-claims?forum=sharepointdevelopment
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Problem with accessing dynamically created movie clips, returns null...

    Hopefully this is a stupid question with an easy answer, if my code is straight forward enough.
    I am using this snippet of code to create menu items, and then use the jCount variable below to give the clips an index number, like so (which seems to be working just fine):
    for(var j:Number=0;j<xmlSubMenuLength;j++){ 
        var mcSubMenuItem:mcSubMenu=new mcSubMenu();   
        addChild(mcSubMenuItem);    
        jCount++;   
        mcSubMenuItem.name = "mcSubMenuItem" + jCount;
        //traces out names correctly
        trace ("---------------------------------jCount NAME = "+ mcSubMenuItem.name);
        mcSubMenuItem.x=mcMenuHolder.x+20;
        mcSubMenuItem.y =mcMenuHolder.y;
        mcSubMenuItem.y+= nextBtnY;
        nextBtnY+=subtopicSpace;
        global_subi.text = String(jCount); //i see the proper count of 10 in the text field
    However, when I try to access the clips using this snippet:  
    for(var j:Number=0;j<Number(global_subi.text);j++)//
      trace("GLOBAL SUBI = "+ String(global_subi.text));  //traces out 10, which it should
      var scSubMenuItem:String = "mcSubMenuItem" + j;  
      var scSubContent:Object = this.getChildByName(scSubMenuItem);
      trace(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>scSubContent:Object = "+ scSubContent); //returns null!
    My last trace statement returns null. Can anyone see my error, or explain why I can't access my clips after they have been created?
    Thank you muchly,
    ~Chipleh

    Hi kglad,
    Thanks for the response.
    "it's not clear from the shown code that jCount is initialized." - I've posted the relevant code below, which shows that I'm initializing jCount.
    "and it's not clear why you don't use j instead of jCount in that for-loop" - j is used as loop for creating the subtopic movie clips within the i for-loop. So, for each topic in i for-loop, create a group of suptopics using the j for-loop. The j for-loop re-initiates j every time the length of the subtopics is reached(if that makes any sense) - i.e. topic1>subtopic 1,2,3,4 : topic2>subtopic>1,2 : topic3>subtopic1,2,3,4
    jCount is used to keep a running count of the total number of subtopcs created - i.e. per the example above, jCount will display 10.
    var topicSpace:uint=button_mc.height;
    var subtopicSpace:uint = button_mc.height;
    var nextBtnY:uint = 0;//whatever;
    var jCount:Number = 0;
    function createXMLMenu(menuLength:Number,itemName:XMLList):void{
         var navItemText:XMLList = itemName;
          for(var i:Number=0;i<menuLength;i++)
               var mcMenuItem:mcMenu=new mcMenu();        
               addChild(mcMenuItem); 
               mcMenuItem.btnTxt.htmlText = i+1 +". " +navItemText[i];  
               mcMenuItem.ivar = i;  
               mcMenuItem.name = "mcMenuItem" + i;  
               mcMenuItem.x=mcMenuHolder.x;
               mcMenuItem.y =mcMenuHolder.y;
              //kglad's addition
               mcMenuItem.y+= nextBtnY;
               nextBtnY+=topicSpace; 
               var subVar:Number = i;//mcMenuItem.ivar 
               //Submenu content
               var xmlSubMenuLength:Number = xml.sim.bodyText.page[i].subpage.length()
               var menuItemAttachment:MovieClip = MovieClip(mcMenuItem); 
               for(var j:Number=0;j<xmlSubMenuLength;j++)
                     var xmlSubPageNumber:XMLList = xml.sim.bodyText.page[subVar].subpage;
                     var subNavLinkNumber:Number = xmlSubPageNumber[j];
                     var subTitleText:String = xml.sim.bodyText.page[subVar].subpage.subNavItem[j];
                     var mcSubMenuItem:mcSubMenu=new mcSubMenu();
                     trace("mcSubMenuItem.ivar = "+ j+1);
                     var mc2Attach2:MovieClip = MovieClip(menuItemAttachment);
                     mcSubMenuItem.btnTxt.htmlText = j+1 +". " +subTitleText;   
                     mcSubMenuItem.ivar = Number(subVar);
                     mcSubMenuItem.jvar = Number(j);
                     addChild(mcSubMenuItem);
                     jCount++;   
                     mcSubMenuItem.name = "mcSubMenuItem" + jCount;
                     trace ("---------------------------------jCount NAME = "+ mcSubMenuItem.name);
                     mcSubMenuItem.x=mcMenuHolder.x+20;
                     mcSubMenuItem.y =mcMenuHolder.y;
                     //kglad's addition
                     mcSubMenuItem.y+= nextBtnY;
                     nextBtnY+=subtopicSpace;    
                     global_subi.text = String(jCount);
                mcSubMenuItem.lExtend.visible = false;  
    global_i.text = String(i);
    Then I try to access the clips like so:
    -The first for-loop access the topic movie clips, no problem, and traces out scContent correctly.
    -The second for-loop traces out null everytime, when I would expect it to be tracing out the names of the subtopic movie clips.
    function accessClips(){
         //This will access the topic movie clips
         for(var i:Number=0;i<Number(global_i.text);i++)
               var scMenuItem:String = "mcMenuItem" + i;
               var scContent:Object = this.getChildByName(scMenuItem);            
               trace(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>scContent:Object = "+ scContent);
         //This is supposed to access the subtopic movie clips
         for(var j:Number=0;j<Number(global_subi.text);j++)//
               var scSubMenuItem:String = "mcSubMenuItem" + j;
               var scSubContent:Object = this.getChildByName(scSubMenuItem);
               trace(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>scSubContent:Object = "+ scSubContent);
    Hope this makes sense, Chipleh confused. If the code is not clear enough, let me know and I'll try to further clarify.
    Thanks again,
    ~Chipleh

  • How to use getRelativePath() with browseForOpen()? It returns null

    It's quite simple:
    fTargetFile:File = File.applicationDirectory.resolvePath("assets");
    fRootFile:File = File.applicationDirectory.resolvePath("assets");
    fTargetFile.addEventListener(Event.SELECT,onSelect)
    fTargetFile.browseForOpen("test"); <-- here I open a file in "/assets/images/test.jpg"
    function onSelect(e:Event):void
        trace(fRootFile.getRelativePath(fTargetFile));  <-- this returns null
    Every single "tutorial" in the web - along with Adobe's documentation - gracefully uses resolvePath to explicitly point to the file objects, thereby bypassing the actual use case. getRelativePath indeed works with resolvePath, but using resolvePath means I've already known where the file is located in the first place, rendering getRelativePath actually useless
    tracing the nativePath property of both objects returns the correct path.
    What I'm trying to do is letting the user choose a file within the "assets" directory. The file can be from any folder so long as they're under the "assets", and once user chooses a file, display the relative path from "assets" to the chosen file.
    So, in the example above, I expect "images/test.jpg" to be returned, but it returns nothing
    Do I have to do some wizardry before getRelativePath works?

    This post is rather old, so I may not be able to help the original author of this topic, but as I found this thread, when searching for a solution for this problem myself, I might be able to help someone else.
    I found the following solution:
    function onSelect(e:Event):void
      var f1:File = (new File()).resolvePath(e.currentTarget.nativePath);
      var f2:File = (new File()).resolvePath(File.applicationDirectory.nativePath);
      trace(f2.getRelativePath(f1, true));

Maybe you are looking for

  • Manaed server is not running

    Hi, I have a request regaring Manager Server as im ubable to setart the maagerd server. I have installed SOA on Windows 7 64-bit environemnt and I installed JDK1.6 64-bit version. Iam able start the Admin Server from command prompt using startWebLogi

  • How do I install The Lorax Daily Print Activities?

    First, make sure your computer and printer meet the system requirements: Windows XP SP2 and above (32- and 64-bit), Windows Vista (32- and 64-bit), Windows 7 (32- and 64-bit) Connected printer Internet access After that, installing The Lorax Daily Pr

  • How to: Secure pdf form that is emailed and later uploaded

    We have a pdf form that will be posted on our website.  Local college/university faculty will link to the form on their websites or just give students the link to our page.  Students will fill the form and it will be emailed to a faculty member from

  • To_date function now fails

    I have a package that ran successfully for years. This morning it fails with a ORA-01858: a non-numeric character was found where a numeric was expected. It fails on the to_date function ie to_date(SYSDATE,'RRRRMMDD'). Why is it failing now and did n

  • IP SLA Not enabled

    Hello friends, In IPM i have discovered all devices fron CS but only 4 are IP SLA enabled,It is showing for 3switches 3560 POE switch Model              SW Version              SW Image WS-C3560G-48PS     12.2(35)SE5             C3560-IPBASE-M and fo