ToString by reflection

Hi,
I'm trying to create an abstract VO where toString metlhod would be able to get all public fields and write their names and values.
I'ts quite easy, but when the VO has a reference to itself, toString method start an infinite looping.
How cold I solve it?
Best Regards,
Rodrigo Souza
Sao Paulo - Brazil
PS: toString implementation
     public String toString() {
          String mask = "[{0}] {1} ";
          String values = "";
          Class cls = getClass();
          Field[] fields = cls.getDeclaredFields();
          for (int i = 0; i < fields.length; i++) {
               String fieldName = fields.getName().substring(0, 1)
                         .toUpperCase()
                         + fields[i].getName().substring(1,
                                   fields[i].getName().length());
               String get = "get";
               try {
                    Method method = cls.getMethod(get + fieldName, new Class[] {});
                    Object obj = method.invoke(this, new Object[] {});
                    values += MessageFormat.format(mask, new String[] {
                              fields[i].getName(), String.valueOf(obj) });
               } catch (Exception e) {
          return values;

Note to OP: If you have classes containing circular references, you might not be able to use ToStringBuilder - it may have the same problem you are experiencing in your reinvention of it. You'll need to experiment. If it's still a problem, obviously you need to custom-write specific toString() implementations for those kinds of classes to account for the circular references - it's not going to magically write itself of course.

Similar Messages

  • ToString() using reflection is slow

    hi,
    I use Apache Commons ToStringBuilder reflection to convert beans to text lines of a big text file (~100MB in size). Reflection is slower that is clear but I'd like to know how much it is slower compared to explicit conversion of data members to strings?
    thanks,

    I read somewhere that reflectively accessing a field is about 1000 times slower than accessing the field directly. Maybe it's gotten better.

  • [Urgent] Bug found with coherence LimitFilters - Coherence 3.7.1.9

    Hi,
    We believe we have identified a serious bug with LimitFilters while using the Coherence Extend client (I am not sure if it only affects the extend client).
    The summary of the bug is that when using Integers as keys to a cache, we get different results as to when we use Strings, Double, etc, when the data is partitioned across two nodes. We do not get the correct results of the query.  Also of note is that this only happens when we provide a comparator.
    Steps to reproduce
    - Start up a distributed cache across two nodes.
    - Add data to the cache, a simplified example is a cache of Integers->Strings
    - See the test below
    Has anybody experienced this before?  I have tried to isolate the test case as much as possible but it could still be environment dependent.. any suggested workarounds that are not too much of a hack are appreciated! If we increase the page size, the problem seems to disappear.
    [code]
    @Test
      public void testStringCache() {
      NamedCache cache = CacheFactory.getCache(CoherenceCacheName.Product.getXmlName());
      cache.clear();
      productCache.put(Integer.valueOf(49355),""+49355);
      productCache.put(Integer.valueOf(49356),""+49356);
      productCache.put(Integer.valueOf(49357),""+49357);
      productCache.put(Integer.valueOf(49358),""+49358);
      productCache.put(Integer.valueOf(49362),""+49362);
      productCache.put(Integer.valueOf(49365),""+49365);
      productCache.put(Integer.valueOf(49366),""+49366);
      productCache.put(Integer.valueOf(49423),""+49423);
      productCache.put(Integer.valueOf(50284),""+50284);
      productCache.put(Integer.valueOf(59404),""+59404);
      productCache.put(Integer.valueOf(62897),""+62897);
      productCache.put(Integer.valueOf(63342),""+63342);
      productCache.put(Integer.valueOf(66133),""+66133);
      productCache.put(Integer.valueOf(68848),""+68848);
      productCache.put(Integer.valueOf(99861),""+99861);
      productCache.put(Integer.valueOf(326637),""+326637);
      productCache.put(Integer.valueOf(365149),""+365149);
      productCache.put(Integer.valueOf(366043),""+366043);
      productCache.put(Integer.valueOf(366569),""+366569);
      Filter productCacheFilter = new AlwaysFilter();
      int pageSize = 20;
      LimitFilter limitedFilter = new LimitFilter(productCacheFilter, pageSize);
      limitedFilter.setPage(0); //limitfilter is zero based.
      Set<Map.Entry<Integer, ? extends IProduct>> products =productCache.entrySet(limitedFilter, new ReflectionExtractor("toString")); // the reflection extractor here is a comparator.
      Integer count = (Integer) productCache.aggregate(productCacheFilter,new Count());
      System.out.println("Count is "+count + "but products = "+products.size());
    [/code]
    - If we change Integer to String/Double, the counts match (19/19). Otherwise the results are 19/17
    - Removing the comparator fixes the issue

    Bug 17287442 has been created for this issued.
    Paul

  • Problem with reflection in Generics

    I'm using the Prototype compiler for JSR-014 and I am having a big problem with reflection. In the simplest case
    class n<T> {
        void go() {
         this.getGenericType().getTypeParameters();
         this.getClass().getGenericInterfaces();
    }I get a "cannot resolve symbol" on both lines. A glance at the jar included with the prototype shows why: all the collection classes are there, and a lot of the java.lang types, but not java.lang.Class and none of the java.lang.reflection classes.
    So what gives? Is reflection not supported yet? (gaak!) Is there another jar I am supposed to download?
    Thanks

    Schapel is right.
    but also
    The signatures for fields and methods will include the generic types.
    If you really wanted to, this would work.
    get the Class's ClassLoader,
    work out the name of the Class's file, and get an inputStream to this resource (from the classloader). (This bit works because I use as a diagnostics tool to see if classes are loaded from my jar, or my patches directory - see below).
    Write some stuff to read the class file and parse out the generic signatures for the things you are interested in.
    I don't think this last part would fit into anyones definition of "fun", however the specs are all available, and it may turn out simpler than at first appearances.
    Here's the code I use to get the location of where a class is loaded from.
        static URL getLoadPath(Class theClass) {
            StringBuffer resourcename = new StringBuffer(theClass.getName());
            for(int i=0;i < resourcename.length(); i++) {
                if(resourcename.charAt(i) == '.') {
                    resourcename.setCharAt(i,'/');
            resourcename.append(".class");
            return theClass.getClassLoader().getResource(resourcename.toString());
        }if you use getResourceAsStream() in place of getResource() you will have the .class file as an inputStream which you can read and parse.
    Have Fun
    Bruce

  • A Universal Comparator using reflections

    Folks,
    <edit purpose="bump" secondaryPurpose="explain stuff a bit better">
    Sorry I didn't explain what this thing is... and zero bites in the veiw of several active silver backs means, I presume, that I did something magorly wrong... so...
    This class class calls the compare method passing the result of named "getter" method on the two objects to compare. So what? Well... Ummm... It means you can sort by any field of any List (or PriorityQueue, or what-have-you) without having to pre-write a Comparator.... Which is good.
    </edit>
    I was inspired by a blog entry by ?was it warnerja? which was referenced in a thread which was linked from an off-topic post in a thread I read last ?Thursday? night... and to cut a long storry short... I can't find the blog entry again :(
    My implementation is based on [this one by Lone Deranger|http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=3308&lngWId=2] ... which has a couple of problems
    1. infinite recursion in the equals method == OutOfStackSpaceException
    2. It gets the method defintion every time you call compare == sloooooooooooowwwwwwwwwww.
    This version
    * is a bit faster
    * verifies as much as possible in constructor.
    * uses generics to verify (as far as possible) the runtime "compared Class" type.
    But I'm pretty sure someone who really knows there generics could improve upon the implementation (or quit possibly the fundamental design). Specifically I'm not in love passing the Class of the compared objects as well as define the generic type. There's GOT to be a better way... I'm just to inexpert/stupid to recognise it... I've probably been staring straight at it for the last two hours.
    So.... This thing works... but any suggestions and/or constructive criticism would be welcome ;-) Thanx.
    UniversalReflectiveComparator.java
    package forums;
    import java.util.Comparator;
    import java.lang.reflect.Method;
    import java.lang.reflect.Type;
    public class UniversalReflectiveComparator<T> implements Comparator<T>
      public static String DEFAULT_METHOD_NAME = "toString";
      public static final int ASCENDING = 1;
      public static final int DESCENDING = -1;
      public static int DEFAULT_ORDER = ASCENDING;
      private static final java.lang.Object[] NO_ARGS = null;
      private final String methodName;
      private final Method getterMethod;
      private final int order;
      public UniversalReflectiveComparator(Class classToCompare)
        throws NoSuchMethodException
        this(classToCompare, DEFAULT_METHOD_NAME, DEFAULT_ORDER);
      public UniversalReflectiveComparator(Class classToCompare, String methodName)
        throws NoSuchMethodException
        this(classToCompare, methodName, DEFAULT_ORDER);
      public UniversalReflectiveComparator(Class classToCompare, int order)
        throws NoSuchMethodException
        this(classToCompare, DEFAULT_METHOD_NAME, order);
      @SuppressWarnings("unchecked")
      public UniversalReflectiveComparator(Class classToCompare, String methodName, int order)
        throws NoSuchMethodException
        getterMethod = classToCompare.getMethod(methodName, (java.lang.Class<?>[])null);
        Class returnType = getterMethod.getReturnType();
        if ("void".equals(returnType.getName())) {
          throw new IllegalArgumentException("Cannot compare on the '"+methodName+"' method"
          + " because its return type is void (ie: it does not return a value to compare).");
        if ( !doesImplement(returnType, Comparable.class.getCanonicalName()) ) {
          throw new IllegalArgumentException("Cannot compare on the '"+methodName+"' method"
          + " because its return type '"+returnType.getName()+"' does not implement Comparable.");
        this.methodName = methodName;
        this.order = order;
      @Override
      @SuppressWarnings("unchecked")
      public int compare(T o1, T o2) {
        try {
          Comparable o1attribute = (Comparable) getterMethod.invoke(o1, NO_ARGS);
          Comparable o2attribute = (Comparable) getterMethod.invoke(o2, NO_ARGS);
          return o1attribute.compareTo(o2attribute) * order;
        } catch (Exception e) {
          throw new IllegalStateException("Failed to compare "+clazz(o1)+ " to "+clazz(o2), e);
       * Returns the type and string value of the given object.
       * eg: java.lang.String 'Hello World!'
      private static String clazz(Object object) {
        return object.getClass().getCanonicalName()+" '"+String.valueOf(object)+"'";
       * Returns: Does the given clazz implement the given interfaceName
       * @param clazz the Class to be examined.
       * @param canonicalInterfaceName the full name (with or without generics)
       *  of the interface sought: path.to.Interface[<path.to.GenericType>]
      private static boolean doesImplement(Class clazz, String canonicalInterfaceName) {
        for ( Type intrface : clazz.getGenericInterfaces() ) {
          if ( intrface.toString().startsWith(canonicalInterfaceName) ) {
            return true;
        return false;
    UniversalComparatorTest.java
    package forums;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Collections;
    import java.util.Comparator;
    import java.io.FileReader;
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    // A simple "Bean" class for testing only.
    // Does NOT implement comparable!
    class Word {
      private final String word;
      public Word(String word) { this.word=word; }
      public String getWord() {  return this.word; }
      public void noop() { }
      public String toString() { return this.word;  }
      public Word notComparable() { return new Word("notComparable"); }
    class UniversalComparatorTest
      @SuppressWarnings("unchecked")
      public static void main(String[] args) {
        try {
          List<Word> words = readWords("WordFinder.txt");
          System.err.println("---------------------------------------------------");
          // SUCCESS CASES
                           //short for new UniversalReflectiveComparator<Word>(Word.class,"toString",ASCENDING);
          try {
            Collections.sort(words, new UniversalReflectiveComparator<Word>(Word.class));
            System.out.println(words);
          } catch (Exception e) {e.printStackTrace();}
          System.err.println("---------------------------------------------------");
          try {
            Collections.sort(words, new UniversalReflectiveComparator<Word>(Word.class, "getWord", UniversalReflectiveComparator.DESCENDING));
          } catch (Exception e) {e.printStackTrace();}
          System.out.println(words);
          System.err.println("---------------------------------------------------");
          try {
            Collections.sort(words, new UniversalReflectiveComparator<Word>(Word.class, UniversalReflectiveComparator.DESCENDING));
          } catch (Exception e) {e.printStackTrace();}
          System.out.println(words);
          System.err.println("---------------------------------------------------");
          // FAIL CASES
          try {
            Collections.sort(words, new UniversalReflectiveComparator<Word>(Word.class, "nonExistantMethodName"));
          } catch (Exception e) {e.printStackTrace();}
          System.err.println("---------------------------------------------------");
          try {
            Collections.sort(words, new UniversalReflectiveComparator<Word>(Word.class, "noop"));
          } catch (Exception e) {e.printStackTrace();}
          System.err.println("---------------------------------------------------");
          try {
            Collections.sort(words, new UniversalReflectiveComparator<Word>(Word.class, "notComparable"));
          } catch (Exception e) {e.printStackTrace();}
          System.err.println("---------------------------------------------------");
        } catch (Exception e) {
          e.printStackTrace();
       * reads each line of the given file into a List of strings.
       * @param String filename - the name of the file to read
       * @return an List handle ArrayList of strings containing file contents.
      public static List<Word> readWords(String filename) throws FileNotFoundException, IOException {
        List<Word> results = new ArrayList<Word>();
        BufferedReader reader = null;
        try {
          reader = new BufferedReader(new FileReader(filename));
          String line = null;
          while ( (line=reader.readLine()) != null ) {
            results.add(new Word(line));
        } finally {
          if(reader!=null)reader.close();
        return results;
    }Cheers all. Keith.
    PS: If you happen to know that blog entry... could you post a link... please.
    Edited by: corlettk on 2/11/2008 15:52 - Ooops!
    Edited by: corlettk on 2/11/2008 18:20 - You Snobs!
    Edited by: corlettk on 2/11/2008 19:00 - Dodgems bump!

    Here's the latest installment...
    This thing writes, compiles and instantiates and caches the requested implementation of Comparator<?> on-the-fly with the system default javax.tools.JavaCompiler
    Some Notes:
    * Gee, it's just sooooo easy to invoke the compiler.
    * Compilation errors are printed to stdout.
    * It takes too long to compile... aprox nine-tenths of a second (0.95 +/- 0.04) for a really simple little class.
    * I like the cache... subsequent calls for the same comparator are instant ;-)
    * Possible enhancement: oninit: load the cache with .class's from the specified package (a seperate comparators package), so you only have to create each comparator once per release (ie: like JSP's)
    * It throws too many distinct exception types... I think it would be better if it threw only one ComparatorGenerationException (but I'm too lazy to fix it now).
    * I don't like the "staticness" anymore, especially with a cache involved. Maybe a ComparatorFactoryConfig extends Properties would be the best way to configure the factory? Or maybe a ComparatorSpec class should be passed to the createComparator method... to eliminate all that cumbersome overloading to just to provide defaults. Hmmm.
    * The order switch means you can sort both ways using the one generated
    * A simillar "nulls first or last" switch would be a good enhancement.
    * Camickr's solution also features a case[in]senstive switch... feel free to add it ;-)
    * It's still not a scratch on Mr Kirkman's ASM solution (which is aprox 10 times as fast), but it'll definately give the "pure reflection" solution a run for it's money.
    * I can imagine a common "front end" for both the "reflective" and "code-gen" solutions... if the list size is less than 10,000 just reflect it, else code-gen.
    UniversalOnTheFlyCompiledComparatorFactory.java
    package forums;
    import java.util.Comparator;
    import java.lang.reflect.Method;
    import java.lang.reflect.Type;
    import java.io.File;
    import java.io.FileWriter;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.util.Arrays;
    import java.util.Map;
    import java.util.HashMap;
    import javax.tools.DiagnosticCollector;
    import javax.tools.JavaCompiler;
    import javax.tools.JavaFileObject;
    import javax.tools.StandardJavaFileManager;
    import javax.tools.ToolProvider;
    public class UniversalOnTheFlyCompiledComparatorFactory
      public static String DEFAULT_METHOD_NAME = "toString";
      public static String SRC_DIR = "C:/java/home/src/";
      public static String PACKAGE = "forums";
      public static final int DESCENDING = -1;
      public static final int ASCENDING = 1;
      public static int DEFAULT_ORDER = ASCENDING;
      private static final java.lang.Class<?>[] NULL_CLASS_ARRAY = null;
      public static Comparator createComparator(Class classToCompare)
        throws NoSuchMethodException, IOException, CompilationException, ClassNotFoundException, InstantiationException, IllegalAccessException
        return createComparator(classToCompare, DEFAULT_METHOD_NAME, DEFAULT_ORDER);
      public static Comparator createComparator(Class classToCompare, String methodName)
        throws NoSuchMethodException, IOException, CompilationException, ClassNotFoundException, InstantiationException, IllegalAccessException
        return createComparator(classToCompare, methodName, DEFAULT_ORDER);
      public static Comparator createComparator(Class classToCompare, int order)
        throws NoSuchMethodException, IOException, CompilationException, ClassNotFoundException, InstantiationException, IllegalAccessException
        return createComparator(classToCompare, DEFAULT_METHOD_NAME, order);
      public static Map<String,Comparator<?>> cache = new HashMap<String,Comparator<?>>();
      @SuppressWarnings("unchecked")
      public static Comparator createComparator(Class classToCompare, String methodName, int order)
        throws NoSuchMethodException, IOException, CompilationException, ClassNotFoundException, InstantiationException, IllegalAccessException
        final String key = classToCompare.getName()+"."+methodName+"_"+order;
        Comparator<?> comparator = cache.get(key);
        if (comparator != null) {
          return comparator;
        final Method getterMethod = classToCompare.getMethod(methodName, NULL_CLASS_ARRAY);
        final Class returnType = getterMethod.getReturnType();
        if ("void".equals(returnType.getName())) {
          throw new IllegalArgumentException("Cannot compare on the '"+methodName+"' method because its return type is void (ie: it does not return a value to compare).");
        if ( !isComparable(returnType) ) {
          throw new IllegalArgumentException("Cannot compare on the '"+methodName+"' method because its return type '"+returnType.getName()+"' does not implement Comparable.");
        final File javaFile = writeComparatorJava(classToCompare, getterMethod, order);
        if ( ToolProvider.getSystemJavaCompiler().run(null, System.out, System.err, javaFile.getName()) != 0 ) {
          throw new CompilationException("Failed to compile comparator file: "+javaFile.getAbsolutePath());
        final String comparatorClassName = PACKAGE+"."+javaFile.getName().replaceAll("\\.java$", "");
        comparator = (Comparator<?>) Class.forName(comparatorClassName).newInstance();
        cache.put(key, comparator);
        return comparator;
      private static File writeComparatorJava(Class classToCompare, Method getterMethod, int order)
        throws IOException, CompilationException
        final String nameOfClassToCompare = classToCompare.getName().replaceAll("^.*(?=\\.)\\.",""); // remove everything before the last .
        final String getterMethodName = getterMethod.getName();
        final String comparatorClassName = nameOfClassToCompare + getterMethodName.replaceAll("^get","").replaceAll("toString","String") + "Comparator";
        final File comparatorClassFile = new File(SRC_DIR+PACKAGE+"/"+comparatorClassName+".java");
        PrintWriter out = null;
        try {
          out = new PrintWriter(new FileWriter(comparatorClassFile));
          out.println("package "+PACKAGE+";");
          out.println("public class "+comparatorClassName+" implements java.util.Comparator<"+nameOfClassToCompare+">");
          out.println("{");
          out.println("  public static final int DESCENDING = -1;");
          out.println("  public static final int ASCENDING = 1;");
          out.println("  public static final int DEFAULT_ORDER = "+order+";");
          out.println("  public final int order;");
          out.println();
          out.println("  public "+comparatorClassName+"() { this(DEFAULT_ORDER); }");
          out.println();
          out.println("  public "+comparatorClassName+"(int order) { this.order = order; }");
          out.println();
          out.println("  // nulls come last");
          out.println("  public int compare("+nameOfClassToCompare+" a, "+nameOfClassToCompare+" b) {");
          out.println("    if (a==null) {");
          out.println("      return b==null ? 0 : -1;");
          out.println("    } else {");
          out.println("      return b==null ? 1 : a."+getterMethodName+"().compareTo(b."+getterMethodName+"()) * order;");
          out.println("    }");
          out.println("  }");
          out.println();
          out.println("}");
        } finally {
          if (out!=null)out.close();
        return comparatorClassFile;
       * Returns: Does the given clazz implement the given interfaceName
       * @param clazz the Class to be examined.
       * @param canonicalInterfaceName the full name (with or without generics)
       *  of the interface sought: path.to.Interface[<path.to.GenericType>]
      private static boolean isComparable(Class clazz) {
        for ( Type i : clazz.getGenericInterfaces() ) {
          if ( i.toString().startsWith("java.lang.Comparable") ) {
            return true;
        return false;
    UniversalComparatorTest.java
    package forums;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Collections;
    import java.util.Comparator;
    import java.io.FileReader;
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    // A simple "Bean" class for testing only.
    // Does NOT implement comparable!
    class Word {
      private final String word;
      public Word(String word) { this.word=word; }
      public String getWord() {  return this.word; }
      public void noop() { }
      public String toString() { return this.word;  }
      public Word notComparable() { return new Word("notComparable"); }
    class UniversalComparatorTest
      @SuppressWarnings("unchecked")
      public static void main(String[] args) {
        try {
          List<Word> words = readWords("WordFinder.txt");
          System.err.println("---------------------------------------------------");
            long start = System.nanoTime();
            try {
              Comparator<Word> wordComparator = UniversalOnTheFlyCompiledComparatorFactory.createComparator(Word.class);
              Collections.sort(words, wordComparator);
              System.out.println(words);
            } catch (Exception e) {e.printStackTrace();}
            long stop = System.nanoTime();
            System.err.printf("took %6.4f seconds%n", (stop-start)/1000000000.0);
            System.err.println("---------------------------------------------------\n");
            long start = System.nanoTime();
            try {
              Comparator<Word> wordComparator = UniversalOnTheFlyCompiledComparatorFactory.createComparator(Word.class);
              Collections.sort(words, wordComparator);
              System.out.println(words);
            } catch (Exception e) {e.printStackTrace();}
            long stop = System.nanoTime();
            System.err.printf("took %6.4f seconds%n", (stop-start)/1000000000.0);
            System.err.println("---------------------------------------------------\n");
        } catch (Exception e) {
          e.printStackTrace();
       * reads each line of the given file into a List of strings.
       * @param String filename - the name of the file to read
       * @return an List handle ArrayList of strings containing file contents.
      public static List<Word> readWords(String filename) throws FileNotFoundException, IOException {
        List<Word> results = new ArrayList<Word>();
        BufferedReader reader = null;
        try {
          reader = new BufferedReader(new FileReader(filename));
          String line = null;
          while ( (line=reader.readLine()) != null ) {
            results.add(new Word(line));
        } finally {
          if(reader!=null)reader.close();
        return results;
    }Cheers. Keith.
    It's Bed Time ;-)

  • Java Reflection and dynamic class loading

    I am trying to load my classes 'dynamically' using java reflection, which is a feature absolutely necessary for my webapp. I could not get this to work as of yet. Could someone please give me a piece of sample code that would do the following :
    - return the value (String) of known method y from class x
    - class x is only known at runtime (from the query-string in this case)
    - method y is known
    Thanks in advance.
    cheers,
         Tom
    PS: Please do not give me any links to tutorials/articles that do not do the EXACT thing that I asked for. Thank you.

    tried it, but it always gives me a MethodNotFoundException, because its trying to find my class in java.lang.String for some reason...
    heres part of the code (its an altered version of the code given in the invoke tutorial):
    public String getMethodReturnValue(String methodName, String className) {
    String result = null;
    Class theModuleClass = String.class;
    Class[] parameterTypes = new Class[] {};
    Method concatMethod;
    //Object[] arguments = new Object[] {parameters};
    try {
    concatMethod = theModuleClass.getMethod(methodName, null);
    result = (String) concatMethod.invoke(createObject(className), parameterTypes);
    } catch (NoSuchMethodException e) {
    result = e.toString();
    } catch (IllegalAccessException e) {
    result = e.toString();
    } catch (InvocationTargetException e) {
    result = e.toString();
    return result;
    private Object createObject (String className) {
    Object object = null;
    try {
    Class classDefinition = Class.forName(className);
    object = classDefinition.newInstance();
    } catch (Exception e) {}
    return object;
    Thanks for any help!
    -Tom

  • System.Reflection.TargetInvocationException: An exception occurred during the operation, making the result invalid.

    When I run my app on device and the internet is connected its ok, but if I use the emulator (althought the internet is connected):
    $exception{System.Reflection.TargetInvocationException: An exception occurred during the operation, making the result invalid.  Check InnerException for exception details. ---> System.Net.WebException: The remote server returned
    an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.
       at System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
       at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClasse.<EndGetResponse>b__d(Object sendState)
       at System.Net.Browser.AsyncHelper.<>c__DisplayClass1.<BeginOnUI>b__0(Object sendState)
       --- End of inner exception stack trace ---
       at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
       at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
       at System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
       at System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult result)
       --- End of inner exception stack trace ---
       at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
       at System.Net.DownloadStringCompletedEventArgs.get_Result()
       at FitnessApp.BL.ServerConnection.wc_DownloadStringCompleted(Object sender, DownloadStringCompletedEventArgs e)
       at System.Net.WebClient.OnDownloadStringCompleted(DownloadStringCompletedEventArgs e)
       at System.Net.WebClient.DownloadStringOperationCompleted(Object arg)}
    System.Exception {System.Reflection.TargetInvocationException}
    this is the stack trace:
       at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
       at System.Net.DownloadStringCompletedEventArgs.get_Result()
       at FitnessApp.BL.ServerConnection.wc_DownloadStringCompleted(Object sender, DownloadStringCompletedEventArgs e)
       at System.Net.WebClient.OnDownloadStringCompleted(DownloadStringCompletedEventArgs e)
       at System.Net.WebClient.DownloadStringOperationCompleted(Object arg)
    this is my code:
    void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
    try
    if (e.Error != null)
    string error = e.Error.Message;
    string functionCall = e.UserState.ToString();
    if (!string.IsNullOrEmpty(e.Result)) //this line throws an exception
    if (functionCall == "getProductCode")
    ProductsList productsList = JsonConvert.DeserializeObject<ProductsList>(e.Result);
    if (productsList.products != null)
    serverProducts = productsList.products.Select(p =>
    new BE.Product
    Product_code = p.PID,
    Product_name = p.Name
    }).ToList();
    else
    serverProducts.Clear();
    if (DataDownloadCompleted != null)
    if(functionCall =="getProductCode")
    DataDownloadCompleted(this, new BE.StringEventArgs("getProductCode"));
    catch (Exception)
    throw;
    public void searchProductCode(string productName)
    try
    if (DeviceNetworkInformation.IsNetworkAvailable && DeviceNetworkInformation.IsCellularDataEnabled)
    wc.DownloadStringAsync(new Uri(baseURI + "get_products_json.php?search=" + productName), "getProductCode");
    else
    throw new Exception(FitnessApp.Resources.AppResources.ErrorServerConnection);
    catch (Exception )
    throw ;
    Any solution?
    thank you..

    The server did not find the resource you asked for.
    You might want to make sure your emulator is connected to the internet and can go online.
    http://blogs.msdn.com/b/wsdevsol/archive/2013/10/01/why-can-t-the-windows-phone-emulator-go-online.aspx

  • Problem in returning the object + reflection + hashMap + list

    Hi All,
    i am very new to java forums...
    i'm sorry to disturb you all.. i don't exaclty know how to raise a question in forums..
    Here my query is ::::
    i have xlsReader file,which will read the data from the xls file.
    after reading it,i am adding the contents of the xls sheet in to a Arraylist.
    then i've put the list contents in to an object array,
    then i'm invoking the getter and setter method of the javabean class.
    and i'm returning object,but object contains only the last data of the list,instead of whole contents in that object.
    the code is here,where am returnung the object.
    kindly do reply...
    Thanks in advance...:)
    public static Object setDynamicValue ( Method setter2, List columnData, Object obj2 , Method getter2 )
    Object val2=null;
    try {
    for ( int i = 0 ; i < columnData.size() ; i++ ) {
    Object obj[] =( Object [] )columnData.get(i);
    for ( int j = 0; j < obj.length; j++) {
    // System.out.println("column Data:pppp: :"+obj[j].toString());
    setter2.invoke(obj2, new Object[] {obj[j].toString() });
    val2 = getter2.invoke(obj2, new Object[0]);
    //System.out.println("output:::"+val2.toString());
    // return val2;
    System.out.println("#########################");
    }catch (IllegalAccessException e) {
    System.out.println("IllegalAccessException came :::"+e);
    } catch (IllegalArgumentException e) {
    // TODO Auto-generated catch block
    System.out.println("IllegalArgumentException came :::"+e);
    e.printStackTrace();
    } catch (InvocationTargetException e) {
    System.out.println("InvocationTargetException came :::"+e);
    // TODO Auto-generated catch block
    e.printStackTrace();
    return val2;
    here,we are returning the object val2 , but its printing only the last data of the list
    Object o1 = setDynamicValue ( setter2, columnName ,columnData, obj2,getter2 );
    System.out.println("lastvalue of the list :"+o1);
    thanks...
    plz reply..

    You are getting only the last data of the list because you does not have any mechanism to hold other values.
    Check inf your code your the following code in the inner for loop (loop with index j)
    val2 = getter2.invoke(obj2, new Object[0]);
    Even if you are capturing some value into val2, it gets replaced next time the body of for loop runs. This way you are getting only the last data.
    If you want to capture all values use arraylist. Keep adding all values to arraylist and return it. While printing iterate over arraylist and print values.
    This is not a problem related to reflection or hashMap. Just the logic you have written is incorrect.

  • Java.lang.IllegalAccessException using Reflection and SSL

    Hi all,
    I am getting the java.lang.IllegalAccessException when trying to access the field's value. I'm passing an object that has it's fields set. I'm trying to determine the object passed to my method, get the object's fields, get the field values and store them in an array for later processing. The italic line is where the error occurs. I'm running SSL and my constructors for the objects that I'm passing are all declared "public".
    Can anyone help me fix this problem or suggest a better way?
    Thanks.
    *my method
        public void setHtFields( Object obj ) throws Exception
            setAction( "view" );
            setRecType( obj.getClass().getName() );
            Field flds[] = obj.getClass().getDeclaredFields();
            String fieldList = "";
            String value = "";
            for ( int x=0; x<flds.length ; x++ )
    value = flds[x].get(obj).toString();            htFields.put( flds[x].getName(), value);
                fieldList +=  flds[x].getName() + "::" + value + "~";
            setFieldValue( fieldList );
            insertRecord();
            return;
    * stack trace
    java.lang.IllegalAccessException
         at java.lang.reflect.Field.get(Native Method)
         at com.yoursummit.utils.historyLogging.setHtFields(historyLogging.java:276)
         at org.apache.jsp.edit_emp_jsp._jspService(edit_emp_jsp.java:99)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
         at java.lang.Thread.run(Thread.java:479)

    The object your are invoking setHtFields on must be declaring some private or protected fields which you can't access.
    If you try printing the thrown IllegalAccessException message, not just a stack trace, you will see which exacly one.

  • Reflection Set Properties

    Hello,  I have the below code snippet where I am trying to load dynamic csv files(The columns names can change, so I cant define a regular class and read them into that class) and create a dynamic class with Reflection and then map the data back to
    those properties.  I cant figure out how to set the properties for the dynamic class.  How do I map the data to the properties dynamically?
    //The Files Look Like This
    //FILE 1
    "Item","Id","Color"
    "Cart","24HJ01","Blue"
    "Cart","24HJ02","Red"
    "Cart","24HJ03","Orange"
    "Cart","24HJ04","Yellow"
    "Tank","24HJ05","Blue"
    "Tank","24HJ06","Black"
    "Tank","24HJ07","Orange"
    "Switch","24HJ08","White"
    "Switch","24HJ09","Brown"
    "Switch","25HJ07","Black"
    //FILE 2
    "City","State","Code"
    "Buffalo","NY","A001"
    "Denver","CO","A002"
    "Tampa","FL","A003"
    "Nashville","TN","A004"
    //Field Class
    public class Field
    public string FieldName { get; set; }
    public Type FieldType { get; set; }
    //Building My Class Like this
    public static class MyTypeBuilder
    public static void CreateNewObject(List<Field> fields)
    var myType = CompileResultType(fields);
    var myObject = Activator.CreateInstance(myType);
    public static Type CompileResultType(List<Field> fields)
    TypeBuilder tb = GetTypeBuilder();
    ConstructorBuilder constructor =
    tb.DefineDefaultConstructor(MethodAttributes.Public | MethodAttributes.SpecialName |
    MethodAttributes.RTSpecialName);
    foreach (var field in fields)
    CreateProperty(tb, field.FieldName, field.FieldType);
    Type objectType = tb.CreateType();
    return objectType;
    private static TypeBuilder GetTypeBuilder()
    var typeSignature = "MyDynamicType";
    var an = new AssemblyName(typeSignature);
    AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(an,
    AssemblyBuilderAccess.Run);
    ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("MainModule");
    TypeBuilder tb = moduleBuilder.DefineType(typeSignature
    , TypeAttributes.Public |
    TypeAttributes.Class |
    TypeAttributes.AutoClass |
    TypeAttributes.AnsiClass |
    TypeAttributes.BeforeFieldInit |
    TypeAttributes.AutoLayout
    , null);
    return tb;
    private static void CreateProperty(TypeBuilder tb, string propertyName, Type propertyType)
    FieldBuilder fieldBuilder = tb.DefineField("_" + propertyName, propertyType, FieldAttributes.Private);
    PropertyBuilder propertyBuilder = tb.DefineProperty(propertyName, PropertyAttributes.HasDefault,
    propertyType, null);
    MethodBuilder getPropMthdBldr = tb.DefineMethod("get_" + propertyName,
    MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.HideBySig, propertyType,
    Type.EmptyTypes);
    ILGenerator getIl = getPropMthdBldr.GetILGenerator();
    getIl.Emit(OpCodes.Ldarg_0);
    getIl.Emit(OpCodes.Ldfld, fieldBuilder);
    getIl.Emit(OpCodes.Ret);
    MethodBuilder setPropMthdBldr =
    tb.DefineMethod("set_" + propertyName,
    MethodAttributes.Public |
    MethodAttributes.SpecialName |
    MethodAttributes.HideBySig,
    null, new[] {propertyType});
    ILGenerator setIl = setPropMthdBldr.GetILGenerator();
    Label modifyProperty = setIl.DefineLabel();
    Label exitSet = setIl.DefineLabel();
    setIl.MarkLabel(modifyProperty);
    setIl.Emit(OpCodes.Ldarg_0);
    setIl.Emit(OpCodes.Ldarg_1);
    setIl.Emit(OpCodes.Stfld, fieldBuilder);
    setIl.Emit(OpCodes.Nop);
    setIl.MarkLabel(exitSet);
    setIl.Emit(OpCodes.Ret);
    propertyBuilder.SetGetMethod(getPropMthdBldr);
    propertyBuilder.SetSetMethod(setPropMthdBldr);
    // My Current Attempt -- Everything works correctly until I get down to the foreach statement to try and Set the Object Properties.  
    //File To Load
    const string file = @"sample.txt";
    //Define string Type to Dynamically build the Properties
    var testDataType = typeof(string);
    //Read in the File
    var configFile = File.ReadLines(file).Select(line => line.Split(new[] {','}));
    //Enumerate to List
    var enumerable = configFile as IList<string[]> ?? configFile.ToList();
    //Get Columns
    var columns = enumerable.Take(1);
    //Read the columns into a string list and replace the quotes
    var columnList = new List<string>(columns.First().Select(s => s.Replace("\"", string.Empty)));
    ////Get Rows
    //var rows = enumerable.Skip(1);
    ////Read rows into a list
    //var rowList = rows.Select(yu => yu.Select(s => s.Replace("\"", string.Empty))).ToList();
    //Map the columns to the Field class
    var loadFields = columnList.Select(p => new Field {FieldName = p, FieldType = testDataType}).ToList();
    //Create Dynamic Class
    var myType = MyTypeBuilder.CompileResultType(loadFields);
    //Get the type
    Type customType = myType;
    //create the actual List<customType> type
    Type genericListType = typeof(List<>);
    //Make Generic Type
    Type customListType = genericListType.MakeGenericType(customType);
    //Create List
    IList customListInstance = (IList)Activator.CreateInstance(customListType);
    //Create Instance
    object someCustomClassInstance = Activator.CreateInstance(customType);
    //Get Properties
    var properties = someCustomClassInstance.GetType().GetProperties();
    foreach (var o in enumerable)
    //SetObjectProperty(someCustomClassInstance, properties.First().Name.ToString(CultureInfo.InvariantCulture), o[1]);
    //customListInstance.Add(someCustomClassInstance);
    private void SetObjectProperty(object theObject, string propertyName, object value)
    Type type = theObject.GetType();
    var property = type.GetProperty(propertyName);
    var setter = property.SetMethod;
    setter.Invoke(theObject, new object[] { value });

    Hello,  I have the below code snippet where I am trying to load dynamic csv files(The columns names can change, so I cant define a regular class and read them into that class) 
    Why not? A CSV file is no type so it won't give any information. 
    I describe this mostly as pulling a tooth rectally. Do things as difficult as possible. it serves nothing but for those who don't know better it looks impressive. 
    Success
    Cor

  • Working around unchecked conversions when using reflection

    I think I've convinced myself that there's no way around this issue when using reflection and Generics, but here's the issue:
    Suppose I've got a method that uses reflection to compare an arbitrary property in
    an arbitrary pair of beans (of the same class).
    public static <T> int compare(T bean0, T bean1, String prop) throws Exception {
         Method m = bean0.getClass().getMethod(
                   "get" + prop.substring(0,1).toUpperCase() +
                   prop.substring(1));
         Object o0 = m.invoke(bean0);
         Object o1 = m.invoke(bean1);
         if (o0 instanceof Comparable &&
             o1 instanceof Comparable &&
             (o1.getClass().isAssignableFrom(o0.getClass()) ||
              o0.getClass().isAssignableFrom(o1.getClass()))) {
              return ((Comparable)o0).compareTo(o1); // compiler warning
         } else {
              return o0.toString().compareTo(o1.toString());
    }There's no way that, in general, when using reflection to invoke methods, that you can coerce the types to avoid compile-time type safety warnings. I think the above code is guarranteed not to throw a runtime ClassCastException, but there's no way to write the code so that the compiler can guarrantee it. At least that's what I think. Am I wrong?

    Ok it looks like you're dealing with a classloader issue. when you call that method, it is the equivelant of calling
    Class.forName("Box", true, this.getClass().getClassLoader())The exception is thrown when your class's classloader cannot find the class box. try putting 'null' there
    Class.forName("Box", true, null)and it will request the bootstrap classloader to load the class. just make sure you have permission :
    If the loader is null, and a security manager is present, and the caller's class loader is not null, then this method calls the security manager's checkPermission method with a RuntimePermission("getClassLoader") permission to ensure it's ok to access the bootstrap class loader. (copied from the API)

  • Java reflection and parameter's names

    hi, I have to extract from a method of a given class all types and names of the parameters, i've tryed to use java reflection function:
    Method[] metodo = temp.getDeclaredMethods();
    for (int i = 0; i < metodo.length; i++) System.out.println(metodo.toString());
    and the output is:
    public void DinamicLoad.function1.method1()
    public void DinamicLoad.function1.method2(java.lang.String)the function extract only the parameter's type, not his name

    Probabily all the "dozens, hundreds, thousands of
    other people who use reflection" knows very well
    classes that they use.
    Imagine to produce a class from a wsdl file, how can
    you know the content?
    How can you pass parameters if you know only the type
    and not the MEANING?When building classes from XML it's rare to use the constructor to convey the attributes, far more often each attribute is set independantly using a single argument setter with a signature like:
    public void setMyAttribute(String value) {Hence attribute names (e.g. myAttribute) are normally compared against method names, not parameter names.
    If constructors are to be used then parameters will be supplied in order.

  • Reflection using super?

    This is pseudocode for what I want to do. Is there a way to do it?
    class MyException extends Exception
      MyException(Throwable cause)
         if (islessthan_jdk1.4())
            super(cause.toString());
         else
            super(cause); //this needs to somehow be done with reflection in order to compile under 1.3
    }

    I personally like the idea of compiling under 1.4 and running under 1.3 knowing that the worst I'll get is a MethodNotImplementedException (which I can avoid by doing things properly).
    The only problem is the hassle of the compile/debug sequence if I use this solution to often: compile under 1.4, switch jdk, debug, switch jdk, compile ...
    Following is what I'm doing now (just avoiding using super all together), here's my specific code (Version.is14() does what you think it does):
    public class MutexAssumptionException extends RuntimeException
        String message = "";
        public MutexAssumptionException()
            fillInStackTrace();
        public MutexAssumptionException(Throwable cause)
            fillInStackTrace();
            if (Version.is14())
                try
                    getClass().getMethod("initCause", new Class[]{Throwable.class}).invoke(this, new Object[]{cause});
                } catch (Exception e) {}
            else
                message = cause.getMessage();
        public MutexAssumptionException(String message)
            this.message = message;
            fillInStackTrace();
        public MutexAssumptionException(String message, Throwable cause)
            this.message = message;
            fillInStackTrace();
            if (Version.is14())
                try
                    getClass().getMethod("initCause", new Class[]{Throwable.class}).invoke(this, new Object[]{cause});
                } catch (Exception e) {}
        public String getMessage()
            return super.getMessage();
    }I'll probably move this pattern into a superclass as I'll be using it a couple times, and just extend that class.

  • Why Java Platarform Micro Edition 3.0 doesn't reflect the reality ?

    Hi guys,
    It's my first ME project and I would like to know why into version 3.0 of ME, don't have the necessity of create your access (read and write into files) methods using Threads, and in 2.5.2 I must have to use Threads ? Because my project runs smooth into 3.0 but not into my mobile (E63) and 2.5.2 emulator, after reading plenty docs, and change the emulator to 2.5.2 I did discover that have the need of using Threads. What is the right one and why the 3.0 doesn't reflect the reality ?
    There are any way that my project made with 3.0 runs smooth, how ?
    Thank you in advance.

    Hi once again,
    One example of what I'm doing, using the javax.microedition.io.file.FileConnection to save and read my files, though it only works into my 3.0 emulator.
    I'm using this method to open and read the file.
    private String loadCipher(String typedKey, String pathLoad, String fileName) throws DigestException {
            StringBuffer notFormattedText = new StringBuffer();
            pathLoad = pathLoad + fileName;
            FileConnection fc = null;
            InputStream is = null;
            try {
                fc = (FileConnection) Connector.open(pathLoad);
                is = fc.openInputStream();
                int ch = 0;
                for (int i = 0; i < fc.fileSize(); i++) {
                    if ((ch = is.read()) != -1) {
                        notFormattedText.append((char) ch);
                is.close();
                fc.close();
            } catch (IOException ioe) {
                System.out.print("Error reading!");  // Here I'll have to deal with exceptions
                System.out.print("IOException : " + ioe.getMessage());
            } catch (SecurityException se) {
                System.out.print("Error security!");  // Here I'll have to deal with exceptions
                System.out.print("Securuty exception : " + se.getMessage());
            pathLoad = FILE_ROOT;
            String myFileText = notFormattedText.toString();
            byte[] keyFromFile = readKey(typedKey, myFileText.getBytes()); // Here is where the program goes and decript my file
            return new String(keyFromFile);  // Here I return the decripted text to be compared with password or for that the user might read it.
        }I don't intend to use Thread to run it, although I'm afraid of that it's the only way and with this all program structure will have to be re-designed.
    Anyone knows if Thread is needed just to use the javax.crypto.... and javax.security..... ? Because I'm lost.
    Thank you in advanced

  • Instantiation an inner class using reflection

    I want to instantiate an inner class using the Class.newInstance() method called within the Outer class constructor:
    public Outer
    public Outer()
    Inner.class.newInstance();
    private Class Inner { }
    When I try it, however, I get an InstantiationException.
    Is there some way to do this?
    Thanks for the help.
    Scott

    Here is a consolidation of what everyone posted and it does appear to work. In one of your post you used the getDeclaredConstructors() method and said it was less than ideal; I am not sure what you meant but I suspect it was the hard coded array reference. Anyhow I used the getDeclaredConstructor() method which appears to get non-public constructors also and is basically the same as using the getConstructor() method.
    import java.lang.reflect.*;
    public class Test35 {
        static public void main(String[] args) {
            Test35 t35 = new Test35();
            t35.testIt();
        private class Inner {
            public String toString() {
                return "Hear I am";
        public void testIt() {
            try {
                Constructor con = Inner.class.getDeclaredConstructor(new Class[] {Test35.class});
                Inner in = (Inner)con.newInstance(new Object[] {this});
                System.out.println(in);
            } catch (Exception e) {
                e.printStackTrace();

Maybe you are looking for

  • Error in Viewing BPEL Xpth Functions

    I have BPEL Process Manager in my PC. I wanted to view BPEL XPath Functions by typing http://localhost:9700/BPELConsole/domain.jsp?mode=XPath as suggested in BPEL Process Manager Developer's Guide (Part No. B14448-01). But it is throwing the followin

  • How to short close a Service PO

    Hi Gurus, How to short close a Service PO like we do for Stock PO by ticking Delivery Completed Indicator. Regards

  • TS1702 Ipad3 why no incoming video when on skype

    Ipad 3 why no incoming video when on skype ie. why cant i see someone that i am talking to. They can see me.

  • Source of component explorer

    Can we get the source for the component explorer? I like how it does some things and would like to see how they are done. Thanks, John Luke Mills

  • Blank Album Artwork on ipod 16gb touch

    I have a random problem with the artwork for a album not showing on the ipod and the artwork shows in itunes. A black square shows on the ipod. It happens with albums downloaded from the itunes store and imported cd's. It seems to be random, and will