Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Compile Failed with both Import com & Import java com.google.gdata...  (Read 11664 times)
sheng l.
Posts: 10


« on: April 29, 2015, 06:48:57 am »

Hi all

I can not compile following code

import com
import util


##-----------------------------------------------------------------------------youtube_video_processed
function youtube_video_processed( youtube_video_id)

define
   youtube_video_id         string,
   req                     com.HTTPRequest,
   resp                  com.HTTPResponse,
   url                     string,
   api_key                  string


   let api_key = "myapikey"
   let url = sfmt('https://www.googleapis.com/youtube/v3/videos?id=%1&key=%2&part=snippet,contentDetails,statistics,status',
               youtube_video_id CLIPPED,
               api_key CLIPPED)

   let req = com.HTTPRequest.Create(  url  CLIPPED)
   call req.doRequest()
   let resp = req.getResponse()
   let text_response = resp.getTextResponse()

return ""
end function



| cannot find symbol HTTPRequest, location: package com.
| See error number -6632.
sheng l.
Posts: 10


« Reply #1 on: April 29, 2015, 07:00:48 am »

Hi

When I'm using youtube java libraries (name begin with com.somgthing) such as "import java com.google.gdata.client.youtube.YouTubeService", the compiler will be confused if I also use import com at the same time... and give me the error below


import com
import java com.google.gdata.client.youtube.YouTubeService


##-----------------------------------------------------------------------------youtube_video_processed
function youtube_video_processed( youtube_video_id)

define
   youtube_video_id         string,
   req                  com.HTTPRequest,
   resp                  com.HTTPResponse,
   url                  string,
   api_key               string,
   text_response            string


   let api_key = "myapikey"
   let url = sfmt('https://www.googleapis.com/youtube/v3/videos?id=%1&key=%2&part=snippet,contentDetails,statistics,status',
               youtube_video_id CLIPPED,
               api_key CLIPPED)

   let req = com.HTTPRequest.Create(  url  CLIPPED)
| cannot find symbol HTTPRequest, location: package com.
| See error number -6632.
   call req.doRequest()
   let resp = req.getResponse()
   let text_response = resp.getTextResponse()

        display text_response CLIPPED
 
return
end function



I have no idea how the first one was posted........  lol
Rene S.
Four Js
Posts: 112


« Reply #2 on: April 29, 2015, 09:49:46 am »

Hello,

this is a known bug: FGL-3887 IMPORT com and IMPORT JAVA com conflicts

Some details:

MPORT JAVA com.xxx.zzz adds the symbol "com" in the symbol table.
IMPORT com tries to add the symbol "com" again.

Compare this with:
Code
  1. DEFINE foo RECORD f1, f2 STRING END RECORD
  2. DEFINE foo INT
  3.  

Rene
sheng l.
Posts: 10


« Reply #3 on: April 29, 2015, 10:44:14 pm »

Ok, I will separate them into different modules for now.

Cheers!
Christine R.
Four Js
Posts: 444


« Reply #4 on: April 30, 2015, 03:01:50 pm »

Hello,

The workaround is effectively to separate the FGLGWS code in one file and the JAVA code in another one.
You then just need to link both files in the .42r.
Attached a little example showing this.

To compile it, run :
fgl2p -M -o jtest.42r jtest.4gl jtest2.4gl

Best regards,

Christine

* wa.zip (0.52 KB - downloaded 938 times.)
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines