Commit 68e481788976ae619e65962d34428424f75a48da

Authored by perry.werneck@gmail.com
1 parent fad6aa49

Módulo java volta a funcionar em linux

Showing 2 changed files with 31 additions and 81 deletions   Show diff stats
src/java/call.cc
... ... @@ -50,62 +50,6 @@ namespace PW3270_NAMESPACE {
50 50 if(jvm || load_jvm(widget)) {
51 51  
52 52 v3270_set_script(widget,'J',TRUE);
53   -/*
54   -
55   - gchar * dirname = g_path_get_dirname(filename);
56   - gchar * classname = g_path_get_basename(filename);
57   -
58   - gchar * ptr = strrchr(classname,'.');
59   - if(ptr) {
60   - *ptr = 0;
61   - }
62   -
63   - gchar * classpath;
64   -
65   -#ifdef _WIN32
66   -
67   - char buffer[1024];
68   - gchar * exports;
69   -
70   - if(GetModuleFileName(NULL,buffer,sizeof(buffer)) < sizeof(buffer)) {
71   -
72   - gchar * ptr = strrchr(buffer,G_DIR_SEPARATOR);
73   - if(ptr) {
74   - *ptr = 0;
75   - exports = g_build_filename(buffer,"jvm-exports",NULL);
76   - } else {
77   - exports = g_build_filename(".","jvm-exports",NULL);
78   - }
79   -
80   -
81   - } else {
82   -
83   - exports = g_build_filename(".","jvm-exports",NULL);
84   -
85   - }
86   -
87   - debug("myDir=%s",myDir);
88   -
89   - g_mkdir_with_parents(exports,0777);
90   -
91   -#ifdef DEBUG
92   - classpath = g_strdup_printf("%s;%s;.bin/java",dirname,exports);
93   -#else
94   - classpath = g_strdup_printf("%s;%s",dirname,exports);
95   -#endif
96   -
97   - g_free(exports);
98   -#else
99   -
100   -#ifdef DEBUG
101   - classpath = g_strdup_printf("%s:%s:.bin/java",dirname,JARDIR);
102   -#else
103   - classpath = g_strdup_printf("%s:%s",dirname,JARDIR);
104   -#endif
105   -
106   -#endif // _WIN32
107   -
108   -*/
109 53  
110 54 try {
111 55  
... ... @@ -158,7 +102,38 @@ namespace PW3270_NAMESPACE {
158 102 env->CallStaticVoidMethod(cls, mid, args);
159 103  
160 104 // Check for exception
  105 + jthrowable exc = env->ExceptionOccurred();
  106 + env->ExceptionClear();
  107 +
  108 + if (exc) {
  109 + jclass throwable_class = env->FindClass("java/lang/Throwable");
  110 +
  111 + jmethodID jni_getMessage = env->GetMethodID(throwable_class,"getMessage","()Ljava/lang/String;");
  112 + jstring j_msg = (jstring) env->CallObjectMethod(exc,jni_getMessage);
  113 +
  114 + GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(widget)),
  115 + GTK_DIALOG_DESTROY_WITH_PARENT,
  116 + GTK_MESSAGE_ERROR,
  117 + GTK_BUTTONS_OK_CANCEL,
  118 + _( "Java application \"%s\" has failed." ), classname );
161 119  
  120 + gtk_window_set_title(GTK_WINDOW(dialog), _( "Java error" ));
  121 +
  122 + if(!env->IsSameObject(j_msg,NULL)) {
  123 +
  124 + const char * msg = env->GetStringUTFChars(j_msg, 0);
  125 +
  126 + gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"%s",msg);
  127 +
  128 + env->ReleaseStringUTFChars( j_msg, msg);
  129 + }
  130 +
  131 + if(gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_CANCEL)
  132 + gtk_main_quit();
  133 + gtk_widget_destroy(dialog);
  134 +
  135 +
  136 + }
162 137  
163 138 // And finish
164 139 env->DeleteLocalRef(args);
... ...
src/plugins/hllapi/client.h
... ... @@ -46,31 +46,6 @@
46 46 extern "C" {
47 47 #endif
48 48  
49   -/*
50   - void * hllapi_pipe_init(const char *id);
51   - void hllapi_pipe_deinit(void *h);
52   - const char * hllapi_pipe_get_revision(void);
53   - void hllapi_pipe_release_memory(void *p);
54   - int hllapi_pipe_connect(void *h, const char *n, int wait);
55   - void hllapi_pipe_disconnect(void *h);
56   - LIB3270_MESSAGE hllapi_pipe_get_message(void *h);
57   - char * hllapi_pipe_get_text_at(void *h, int row, int col, int len);
58   - char * hllapi_pipe_get_text(void *h, int offset, int len);
59   - int hllapi_pipe_enter(void *h);
60   - int hllapi_pipe_erase_eof(void *h);
61   - int hllapi_pipe_set_text_at(void *h, int row, int col, const unsigned char *str);
62   - int hllapi_pipe_cmp_text_at(void *h, int row, int col, const char *text);
63   - int hllapi_pipe_pfkey(void *h, int key);
64   - int hllapi_pipe_pakey(void *h, int key);
65   - int hllapi_pipe_wait_for_ready(void *h, int seconds);
66   - int hllapi_pipe_sleep(void *h, int seconds);
67   - int hllapi_pipe_is_connected(void *h);
68   - int hllapi_pipe_getcursor(void *h);
69   - int hllapi_pipe_setcursor(void *h, int baddr);
70   - int hllapi_pipe_emulate_input(void *hSession, const char *s, int len, int pasting);
71   - int hllapi_pipe_print(void *h);
72   -*/
73   -
74 49 char * hllapi_get_string(int offset, size_t len);
75 50 void hllapi_free(void *p);
76 51  
... ...