amiunique icon indicating copy to clipboard operation
amiunique copied to clipboard

Issue when trying to compile code

Open ishagadekar opened this issue 8 years ago • 9 comments

Hi,

I am trying to run the code on my local machine and I am getting the below error:

[error] C:\amiunique\website\app\controllers\FPController.java:346: non-static method generateToken() cannot be referenced from a static context [error] Crypto.generateToken [error] C:\amiunique\website\app\controllers\FPController.java:347: non-static method encryptAES(java.lang.String) cannot be referenced from a static context [error] Crypto.encryptAES [error] C:\amiunique\website\app\controllers\StatsController.java:28: non-static method decryptAES(java.lang.String) cannot be referenced from a static context [error] Crypto.decryptAES

Please let me know what could be the issue.

Thanks in Advance!

ishagadekar avatar Jul 24 '17 23:07 ishagadekar

Hi! Thanks for your interest in AmIUnique! Can you give me the version of Java and Play you are using? It could help me sort this out.

plaperdr avatar Jul 25 '17 08:07 plaperdr

I am using Java 8 and Play 2.4.6.

ishagadekar avatar Jul 25 '17 14:07 ishagadekar

Starting with Play 2.4.x, Crypto methods stopped being static. Try with play 2.3.x

SyBen avatar Jul 28 '17 15:07 SyBen

I tried with Play 2.3. It worked. Thanks!

ishagadekar avatar Jul 30 '17 15:07 ishagadekar

Also, in the table "fpdata", for the "id" column, I get value "Not Supported". Can you tell me what does that mean? Thanks.

ishagadekar avatar Jul 30 '17 22:07 ishagadekar

Thanks a lot @SyBen for finding out the cause of the problem! The site will probably go through a small refresh this year so we may upgrade to a more recent version of Play and this will change.

@ishagadekar The id value comes from the cookie we setup in the browser. If you get "Not Supported", it is either because cookies are blocked or the path may not be correct (i.e. if you run the site locally on your machine, it may not work).

plaperdr avatar Jul 31 '17 07:07 plaperdr

@plaperdr Cookies are not blocked on my system and even if other person hits the website from their system, it gives "Not Supported" value. Can you tell me where are the paths configured? Also, what is the purpose of "id" vs "addressHttp" fields? Thanks.

ishagadekar avatar Jul 31 '17 15:07 ishagadekar

The main path for cookies is defined on this line HERE. You can see that "amiunique.org" is directly in the code. The last two boolean values are to only allow the cookie to be used in the context of a secure connection (HTTPS) and to be delivered only through HTTP (no possibility to access it through JavaScript). If you want to use it on your own, I recommend setting at least the second-to-last boolean value (HTTPS one) to "false". The difference between "id" and "addressHttp" is simple. The "id" column is for the cookie value, the "addressHttp" is an hashed version of the IP address.

plaperdr avatar Jul 31 '17 16:07 plaperdr

Okay. I will try doing that. Thank You!

ishagadekar avatar Aug 02 '17 15:08 ishagadekar