Advertisement
Guest User

Untitled

a guest
Jan 28th, 2014
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.72 KB | None | 0 0
  1. # This patch file was generated by NetBeans IDE
  2. # This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
  3. # It uses platform neutral UTF-8 encoding.
  4. # Above lines and this line are ignored by the patching process.
  5. 41a42,45
  6. > import org.objenesis.Objenesis;
  7. > import org.objenesis.ObjenesisException;
  8. > import org.objenesis.ObjenesisStd;
  9. > import org.objenesis.instantiator.ObjectInstantiator;
  10. 49a54,55
  11. >     private static Map<Class, ObjectInstantiator> instantiators = new HashMap<Class, ObjectInstantiator>();
  12. >     private static Objenesis objenesis = new ObjenesisStd();
  13. 52a59,64
  14. >         try {
  15. >             ObjectInstantiator instantiator = objenesis.getInstantiatorOf(clazz);
  16. >             clazz.cast(instantiator.newInstance());
  17. >             instantiators.put(clazz, instantiator);
  18. >         } catch (ObjenesisException e) {
  19. >             //Logger.getLogger(this.getClass()).log(Level.OFF, "Registration error: Objenesis failed. Falling back to no-argument constructor.", e);
  20. 56,57c68,69
  21. <         } catch( NoSuchMethodException e ) {
  22. <             throw new RuntimeException( "Registration error: no-argument constructor not found on:" + clazz );
  23. ---
  24. >             } catch (NoSuchMethodException ex) {
  25. >                 throw new RuntimeException("Registration error: no-argument constructor not found on:" + clazz);
  26. 59a72
  27. >     }        
  28. 123a137,139
  29. >             object = c.cast(instantiators.get(c));
  30. >         }catch(NullPointerException ex){
  31. >             try {
  32. 126c142
  33. <             throw new SerializerException( "Error creating object of type:" + c, e );
  34. ---
  35. >                 throw new SerializerException("Error creating object of type:" + c, e);
  36. 127a144
  37. >         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement