JSONParser.parseStrict() with \

2013-03-24 Thread rkulisas
Hi, 

I have JSON string that contains \. When I pass this to either 
parseStrict() or parseLenient(), I get back string with  instead of \. I 
tested this with JS eval() as well. eval() returns string with \. Anyone 
know how to work around this?

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: JSONParser.parseStrict() with \

2013-03-24 Thread Thomas Broyer
Could you show your code? (JSON string I mean)

On Sunday, March 24, 2013 9:14:18 AM UTC+1, rkulisas wrote:

 Hi, 

 I have JSON string that contains \. When I pass this to either 
 parseStrict() or parseLenient(), I get back string with  instead of \. I 
 tested this with JS eval() as well. eval() returns string with \. Anyone 
 know how to work around this?

 Thank you.


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Receiver method onConstraintViolation not called

2013-03-24 Thread Thomas Broyer
See 
https://code.google.com/p/google-web-toolkit/wiki/RequestFactoryMovingParts#Flow
 for 
the flow on the server-side.
Notably, validation shouldn't happen in a transaction.
How are managing your sessions/transactions? What are their respective 
lifetimes?

On Saturday, March 23, 2013 7:38:15 PM UTC+1, Nils wrote:

 Hello,
 any ideas why the Receiver method onFailure is triggered instead of 
 onConstraintViolation when validation fails on server side?
 I just have to annotate the entities in my ejb module right? I'm using 
 RequestFactory for communication with server.
 On server side i'm getting a rollback exception caused by a 
 constraintViolationException, so everything seems to be right.
 I'm using JBoss 6.1.0 Final and gwt 2.4 with requestfactory(also tried gwt 
 2.5).
 I have an extra webapplication for RequestFactory, there i have a class 
 extending DefaultRequestTransport. On my client project i'm
 doing requestFactory.initialize(eventBus, class extending 
 DefaultRequestTransport.
 I also did a post on gwt-validation group (
 https://groups.google.com/forum/#!topic/gwt-validation/skPpP2kOvaQ) with 
 some more
 information.

 Thanks in advance.


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Declared compileSourcesArtifact was not found in project dependencies

2013-03-24 Thread Thomas Broyer
Note: for help with the org.codehaus.mojo:gwt-maven-plugin, please use the 
dedicated list at 
https://groups.google.com/d/forum/codehaus-mojo-gwt-maven-plugin-users

Replies inlined below:

On Sunday, March 24, 2013 2:07:14 AM UTC+1, Kris wrote:

 Hi, I have a maven project with several modules. 
 One module contains JPA objects. Used with hibernate. 

 I would like make this a GWT module do I can use these classes in my GWT 
 module. 
 Don't know if this is even possible.. what will the GWT compiler say to 
 all the jpa/hibernate annotations ?? 

 But so far I build the jpa module so it contains the source code and added 
 a .gwt.xml file..

 *?xml version=1.0 encoding=UTF-8?*
 *module*
 *  inherits name=com.google.gwt.user.User /*
 *  source path='ppmock' /*
 */module*

 This file is placed in 
 src/main/java/com/mycomp/jsi/model

 The java classes are in 
 src/main/java/com/mycomp/jsi/model/ppmock

 The jar file gets build including the gwt.xml file and the source file. 

 In my GWT module I inherit the module.. 
 *inherits name=com.mycomp.jsi.model.ppmock/*

 And in the pom.xml file of the gwt module : 
 *compileSourcesArtifacts*
 *
  compileSourcesArtifactcom.mycomp.jsi.model.ppmock/compileSourcesArtifact
 *
 */compileSourcesArtifacts*


You're supposed to put a grouId:artifactId here. The plugin will resolve 
the version from the same dependency in the project and then resolve an 
artifact with that GAV and classifier=sources.

But if your JAR already contains the sources and gwt.xml files, you don't 
need compileSourcesArtifacts at all (anyway, it's a hack, you shouldn't use 
it, you should instead add a dependency on the sources artifact if needed)
 

 But when I mvn clean install i get.. 

 [WARNING] Declared compileSourcesArtifact was not found in project 
 dependencies com.mycomp.jsi.model.ppmock






-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




How to mock static client side DOM calls with PowerMock?

2013-03-24 Thread membersound
Hi,

I have a class Bar that extends Foo. In Foo there is a DOM.createUniqueId()that 
I want to mock.

What am I missing in the following code?


Foo {
String id;

public Foo() {
String id = DOM.createUniqueId();
}
}

Bar extends Foo {
public Bar() {
super();
}

public boolean testMe() {
return true;
}
}


@RunWith(PowerMockRunner.class)
@PrepareForTest(DOM.class)
Class TestFoo {
@Test
public void testFoo() {
PowerMockito.mockStatic(DOM.class);
PowerMockito.when(DOM.createUniqueId()).thenReturn(1);

Foo foo = new Foo();
assertTrue(foo.testMe());
assertEquals(bar.getId(), 1);
}
}

Result:
Caused by: java.lang.UnsupportedOperationException: ERROR: GWT.create() is 
only usable in client code!

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Receiver method onConstraintViolation not called

2013-03-24 Thread Nils
Hi,
thanks for your reply.
All my session beans are stateless and i'm using  a persistence unit with 
jta-transaction and hibernatePersistence provider.
I didn't change the transaction attribute, so it should be 'required' by 
default. I also don't call transaction methods explicit.
Please correct me if i'm wrong, with request factory validation is done 
before the business method is invoked right?
I just did a little debugging:
validate method in serviceLayerDecorator is called.
In RelfectiveServiceLayer the validate method checks the jsr303validator ( 
without hibernate-validator-4.1.0.Final.jar i got log message Unable to 
initialize a JSR 303 Bean Validator when initializing).
Thought, this could be the problem, but after adding the jar the validator 
was initiated successful.
validate of jsr303validator (org.hibernate.validator.engine.ValidatorImpl) 
is called, but an empty set of constraintViolations is returned!
When this method is called on server side from the 
BeanValidationEventListener, the set is not empty.
For the response receiver.onTransportSuccess(text) is called on the created 
requestCallback in DefaultRequestTransport class.
ProcessPayload checks the constraint violatoins, but its emtpy.

Am Sonntag, 24. März 2013 11:21:32 UTC+1 schrieb Thomas Broyer:

 See 
 https://code.google.com/p/google-web-toolkit/wiki/RequestFactoryMovingParts#Flow
  for 
 the flow on the server-side.
 Notably, validation shouldn't happen in a transaction.
 How are managing your sessions/transactions? What are their respective 
 lifetimes?

 On Saturday, March 23, 2013 7:38:15 PM UTC+1, Nils wrote:

 Hello,
 any ideas why the Receiver method onFailure is triggered instead of 
 onConstraintViolation when validation fails on server side?
 I just have to annotate the entities in my ejb module right? I'm using 
 RequestFactory for communication with server.
 On server side i'm getting a rollback exception caused by a 
 constraintViolationException, so everything seems to be right.
 I'm using JBoss 6.1.0 Final and gwt 2.4 with requestfactory(also tried 
 gwt 2.5).
 I have an extra webapplication for RequestFactory, there i have a class 
 extending DefaultRequestTransport. On my client project i'm
 doing requestFactory.initialize(eventBus, class extending 
 DefaultRequestTransport.
 I also did a post on gwt-validation group (
 https://groups.google.com/forum/#!topic/gwt-validation/skPpP2kOvaQ) with 
 some more
 information.

 Thanks in advance.



-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Receiver method onConstraintViolation not called

2013-03-24 Thread Thomas Broyer


On Sunday, March 24, 2013 2:50:59 PM UTC+1, Nils wrote:

 Hi,
 thanks for your reply.
 All my session beans are stateless and i'm using  a persistence unit with 
 jta-transaction and hibernatePersistence provider.
 I didn't change the transaction attribute, so it should be 'required' by 
 default. I also don't call transaction methods explicit.


I'm not a JPA/Hibernate expert; all I can say is that, for RequestFactory, 
you *need* to use a session-per-request pattern (aka OpenSessionInView) and 
have your transactions scoped to your business methods (annotate them 
with @Transactional if you use Spring or Guice-persist; or otherwise make 
sure the transaction is opened just before or within the method, and is 
committed/rolled back with the method or just after it returns).
 

 Please correct me if i'm wrong, with request factory validation is done 
 before the business method is invoked right?


Yes.
 

 I just did a little debugging:
 validate method in serviceLayerDecorator is called.
 In RelfectiveServiceLayer the validate method checks the jsr303validator ( 
 without hibernate-validator-4.1.0.Final.jar i got log message Unable to 
 initialize a JSR 303 Bean Validator when initializing).
 Thought, this could be the problem, but after adding the jar the validator 
 was initiated successful.
 validate of jsr303validator (org.hibernate.validator.engine.ValidatorImpl) 
 is called, but an empty set of constraintViolations is returned!
 When this method is called on server side from the 
 BeanValidationEventListener, the set is not empty.


So this is where you have to investigate.
Create a very small app where you create the validator the same as in 
ReflectiveServiceLayer and validate your objects (the thing that, today, 
doesn't detect violations), and then do your stuff with your object (the 
thing that detects violations). In other words, move RequestFactory out of 
the equation. With that in hand, go ask JPA/Hibernate/whatever forums 
and/or StackOverflow.
 

 For the response receiver.onTransportSuccess(text) is called on the 
 created requestCallback in DefaultRequestTransport class.
 ProcessPayload checks the constraint violatoins, but its emtpy.


Quite obviously.
Any exception raised in a business method results in onFailure being 
called on the client-side *for that method*. It doesn't matter that the 
exception is a ConstraintViolationException: conceptually, there could be 
other business methods that complete successfully.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to mock static client side DOM calls with PowerMock?

2013-03-24 Thread Jens
The DOM class contains a static class variable impl that is instantiated 
using GWT.create(). I don't think you can workaround this fact using 
PowerMockito.

What you can do is to refactor your code slightly. Instead of

public Foo() {
  id = DOM.createUniqueId();
}

you would refactor it to

public Foo(IdGenerator idGenerator) {
  id = idGenerator.createUniqueId();
}

where IdGenerator is an interface. You can then create a default 
implementation of that interface that uses DOM.createUniqueId() in your 
production code and during testing you can then mock that interface easily.

If you don't want that, you have to use a slow GWTTestCase to make 
GWT.create() work. 

You could also move that code into a view implementation that would need a 
GWTTestCase anyways if you choose to test that view implementation.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: momentgwt - a GWT wrapper library for momentjs.com

2013-03-24 Thread Mohammad Al-Quraian
When I tried to use the example:
Moment.moment().add(2, days).format( Do , h:mm:ss a)

After inheriting the required module and including the jar, it gives me 
this error:
The type org.sgx.jsutil.client.JsObject cannot be resolved. It is 
indirectly referenced from required .class files


On Thursday, March 21, 2013 10:22:15 PM UTC+3, Sebastián Gurin wrote:

 I just released a GWT wrapper for the nice JavaScript library momentjs (
 momentjs.com). It resulted on a small and easy to use alternative for 
 working with dates, calendars, intervals, date formats, date 
 internationalization, etc. 

 https://github.com/cancerberoSgx/momentgwt

 Hope it can be of help to somebody working with dates, calendars, etc. 


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: momentgwt - a GWT wrapper library for momentjs.com

2013-03-24 Thread Mohammad Al-Quraian
I think the module org.sgx.jsutil.JsUtil is required.

On Sunday, March 24, 2013 9:43:10 PM UTC+3, Mohammad Al-Quraian wrote:

 When I tried to use the example:
 Moment.moment().add(2, days).format( Do , h:mm:ss a)

 After inheriting the required module and including the jar, it gives me 
 this error:
 The type org.sgx.jsutil.client.JsObject cannot be resolved. It is 
 indirectly referenced from required .class files


 On Thursday, March 21, 2013 10:22:15 PM UTC+3, Sebastián Gurin wrote:

 I just released a GWT wrapper for the nice JavaScript library momentjs (
 momentjs.com). It resulted on a small and easy to use alternative for 
 working with dates, calendars, intervals, date formats, date 
 internationalization, etc. 

 https://github.com/cancerberoSgx/momentgwt

 Hope it can be of help to somebody working with dates, calendars, etc. 



-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: java.lang.NullPointerException at com.google.gwt.dev.util.DiskCache.transferToStream(DiskCache.java:187)

2013-03-24 Thread Thomas Broyer


On Monday, March 25, 2013 1:25:29 AM UTC+1, Kris wrote:

 GWT 2.5.1
 Maven 3.0.4

 Hi, suddenly I get this error, and I google it for a while now, and can 
 see others had the problem.
 But no solution... 

 * java.lang.NullPointerException*
 *[ERROR]  at 
 com.google.gwt.dev.util.DiskCache.transferToStream(DiskCache.java:187)*
 *[ERROR]  at 
 com.google.gwt.dev.util.DiskCacheToken.writeObject(DiskCacheToken.java:91)
 *
 *[ERROR]  at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)*
 *[ERROR]  at 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 *


The only reason this can happen is if the JVM is shutting down while 
threads are trying to write to the DiskCache, which would be abnormal.
And indeed it is: your problem is not this NPE, it's an internal compiler 
error:
[INFO] [ERROR] Unexpected internal compiler error
[INFO] java.lang.NoSuchFieldError: warningThreshold
[INFO]  at 
com.google.gwt.dev.javac.JdtCompiler.getCompilerOptions(JdtCompiler.java:413)

And this NoSuchFieldError can only happen if you have JDT/ECJ in your 
classpath (from a version incompatible with the one bundled within GWT).

You're best option is to use separate client and server code in distinct 
artifacts (see https://github.com/tbroyer/gwt-maven-archetypes for 
examples, 
https://groups.google.com/d/topic/codehaus-mojo-gwt-maven-plugin-users/vrLAcqp5oAg/discussion
 
for the rationale; see also 
https://plus.google.com/113945685385052458154/posts/RDrK7ukVFqJ if you're 
OK to try alpha software) but a short-term solution is to use 
gwtSdkFirstInClasspath: 
http://mojo.codehaus.org/gwt-maven-plugin/compile-mojo.html#gwtSdkFirstInClasspath

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: JSONParser.parseStrict() with \

2013-03-24 Thread rkulisas
Before calling parseStrict(): 
{name:item_name,index:0,*text:Kindle Fire HD 8.9\...*}

After parseStrict(): 
{name:item_name, index:0, *text:Kindle Fire HD 8.9 ...*}

On Sunday, March 24, 2013 3:14:50 AM UTC-7, Thomas Broyer wrote:

 Could you show your code? (JSON string I mean)

 On Sunday, March 24, 2013 9:14:18 AM UTC+1, rkulisas wrote:

 Hi, 

 I have JSON string that contains \. When I pass this to either 
 parseStrict() or parseLenient(), I get back string with  instead of \. I 
 tested this with JS eval() as well. eval() returns string with \. Anyone 
 know how to work around this?

 Thank you.



-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[gwt-contrib] Re: Original GWT Logo Assets

2013-03-24 Thread Thomas Broyer


On Saturday, March 23, 2013 3:16:09 PM UTC+1, Kelly Norton wrote:

 Thomas Broyer reached out to get vector versions of the original GWT Logo 
 so I'm going to just throw my copies into the community before they are 
 lost. As far as I remember, these logos were originally created by Michael 
 Lopez in 2006. I'm pretty confident that the illustrator file I have is the 
 final iteration. I've uploaded the logo to my Dropbox and exported it to a 
 few common formats (unfortunately the SVG version does have some issues).

 Illustrator (original)
 http://dl.dropbox.com/u/4920373/gwt-logo/gwt-logo.ai

 PDF
 http://dl.dropbox.com/u/4920373/gwt-logo/gwt-logo.pdf

 PNG (1000x940)
 http://dl.dropbox.com/u/4920373/gwt-logo/gwt-logo.png

 SVG (This is a failed attempt to use Inkscape to convert from PDF. The 
 entire left side of the box did not survive the process. I home someone 
 more familiar with the inner workings of Inkscape can get a better SVG 
 version)
 http://dl.dropbox.com/u/4920373/gwt-logo/gwt-logo.svgz


It looks like Inkscape imports the gradient with 
stop-opacity:1;stop-color:#00 instead of 
stop-opacity:0;stop-color:#ff (when I imported the *.ai file)

-- 
-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit Contributors group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.