Display 类中捕获异常

发布于 2024-10-21 20:30:29 字数 9029 浏览 7 评论 0原文

嘿嘿朋友们我的代码出错了。我的项目编译成功&从一开始就运行良好,但是当我触发移动中键时,它会显示这样的错误......

TRACE: <at java.lang.Error: ClassFormatError:  56>, Exception caught in Display class
java.lang.Error: ClassFormatError:  56
        at java.lang.Class.invoke_verify(), bci=0
        at java.lang.Class.initialize(), bci=117
        at com.ui.PreviewPageUI.getPreviewData(), bci=0
        at com.ui.PreviewPageUI.keyPressedMainCatFire(), bci=54
        at com.ui.PreviewPageUI.keyPressedFire(PreviewPageUI.java:451)
        at com.ui.PreviewPageUI.keyPressed(PreviewPageUI.java:284)
        at javax.microedition.lcdui.CanvasLFImpl.uCallKeyPressed(), bci=19
        at javax.microedition.lcdui.DisplayableLFImpl.uCallKeyEvent(), bci=146
        at javax.microedition.lcdui.Display$DisplayEventConsumerImpl.handleKeyEvent(), bci=30
        at com.sun.midp.lcdui.DisplayEventListener.process(), bci=277
        at com.sun.midp.events.EventQueue.run(), bci=179
        at java.lang.Thread.run(Thread.java:662)

请帮助我如何删除此错误......谢谢 这是我的功能代码

private void getPreviewData(final String cat) {
        Thread th = new Thread() {

            public void run() {
                try {
                    if (cat.equals("VD")) {
                        if (videoHastable == null || videoHastable.isEmpty()) {
                            initializeWaiting();
                            ParseUrl parsedata=new ParseUrl();
                            json=new JSONObject();
                            try {
                                json.put("phonetype",Midlet.PHONE_TYPE);
                                json.put("cat","VD");
                            } catch (JSONException ex) {
                                System.out.println(ex.toString());
                            }
                            String url="http://localhost:8084/MagicWeb/pappilon1?json="+json.toString();

                            videoHastable =parsedata.coonectHttp(url,cat);
                            circularLoading = false;
                        }
                        if (videoHastable != null) {
                            Midlet.display.setCurrent(new WallPapersCanvas(2, "VIDEOS", videoHastable));
                        } else {
                            initializeError("MESSAGE", "COULD NOT POPULATE DATA FROM THE SERVER", MAIN_CATEGORIES);
                        }
                    } else if (cat.equals("WP")) {
                        if (wallHastable == null || wallHastable.isEmpty()) {
                            initializeWaiting();

                            ParseUrl parsedata=new ParseUrl();
                            json=new JSONObject();
                            try {
                                json.put("phonetype",Midlet.PHONE_TYPE);
                                json.put("cat","WP");
                            }catch(JSONException e){
                                System.out.println("json excep:"+e.toString());
                            }catch(Exception e){
                                System.out.println("error in wp getpriview:"+e.toString());
                            }
                            String url="http://localhost:8084/MagicWeb/pappilon1?json="+json.toString();
                            System.out.println("I am in wallpaper getpreiview");
                            wallHastable =parsedata.coonectHttp(url,cat);
                            circularLoading = false;
                        }
                        if (wallHastable != null) {
                            Midlet.display.setCurrent(new WallPapersCanvas(2, "WALLPAPERS", wallHastable));
                        } else {
                            initializeError("MESSAGE", "COULD NOT POPULATE DATA FROM THE SERVER", MAIN_CATEGORIES);
                        }
                    } else if (cat.equals("GM")) {
                        if (gamesHastable == null || gamesHastable.isEmpty()) {
                            initializeWaiting();

                            ParseUrl parsedata=new ParseUrl();
                            json=new JSONObject();
                            try {
                                json.put("phonetype",Midlet.PHONE_TYPE);
                                json.put("cat","GM");
                            } catch (JSONException ex) {
                                System.out.println(ex.toString());
                            }
                            String url="http://localhost:8084/MagicWeb/pappilon1?json="+json.toString();
                            gamesHastable =parsedata.coonectHttp(url,cat);
                            circularLoading = false;
                        }
                        if (gamesHastable != null) {
                            Midlet.display.setCurrent(new WallPapersCanvas(2, "GAMES", gamesHastable));
                        } else {
                            initializeError("MESSAGE", "COULD NOT POPULATE DATA FROM THE SERVER", MAIN_CATEGORIES);
                        }
                    } else if (cat.equals("TH")) {
                        if (themesHastable == null || themesHastable.isEmpty()) {
                            initializeWaiting();

                            ParseUrl parsedata=new ParseUrl();
                            json=new JSONObject();
                            try {
                                json.put("phonetype",Midlet.PHONE_TYPE);
                                json.put("cat","TH");
                            } catch (JSONException ex) {
                                System.out.println(ex.toString());
                            }
                            String url="http://localhost:8084/MagicWeb/pappilon1?json="+json.toString();
                            themesHastable =parsedata.coonectHttp(url,cat);
                            circularLoading = false;
                        }
                        if (themesHastable != null) {
                            Midlet.display.setCurrent(new WallPapersCanvas(2, "THEMES", themesHastable));
                        } else {
                            initializeError("MESSAGE", "COULD NOT POPULATE DATA FROM THE SERVER", MAIN_CATEGORIES);
                        }
                    } else if (cat.equals("AN")) {
                        if (animateHastable == null || animateHastable.isEmpty()) {
                            initializeWaiting();

                            ParseUrl parsedata=new ParseUrl();
                            json=new JSONObject();
                            try {
                                json.put("phonetype",Midlet.PHONE_TYPE);
                                json.put("cat","AN");
                            } catch (JSONException ex) {
                                System.out.println(ex.toString());
                            }
                            String url="http://localhost:8084/MagicWeb/pappilon1?json="+json.toString();
                            animateHastable =parsedata.coonectHttp(url,cat);
                            circularLoading = false;
                        }
                        if (animateHastable != null) {
                            Midlet.display.setCurrent(new WallPapersCanvas(2, "ANIMATIONS", animateHastable));
                        } else {
                            initializeError("MESSAGE", "COULD NOT POPULATE DATA FROM THE SERVER", MAIN_CATEGORIES);
                        }
                    } else if (cat.equals("FS")) {
                        if (freeHastable == null || freeHastable.isEmpty()) {
                            initializeWaiting();

                            ParseUrl parsedata=new ParseUrl();
                            json=new JSONObject();
                            try {
                                json.put("phonetype",Midlet.PHONE_TYPE);
                                json.put("cat","FS");
                            } catch (JSONException ex) {
                                System.out.println(ex.toString());
                            }
                            String url="http://localhost:8084/MagicWeb/pappilon1?json="+json.toString();
                            freeHastable =parsedata.coonectHttp(url,cat);
                            circularLoading = false;
                        }
                        if (freeHastable != null) {
                            Midlet.display.setCurrent(new WallPapersCanvas(2, "FREE GIFTS", freeHastable));
                        } else {
                            initializeError("MESSAGE", "COULD NOT POPULATE DATA FROM THE SERVER", MAIN_CATEGORIES);
                        }
                    } else {
                        initializeError("MESSAGE", "CATEGORY NAME DOES NOT EXIST", MAIN_CATEGORIES);
                    }
                } catch (Exception e) {
                    System.out.println("error @ getPreviewData");
                    e.printStackTrace();
                }
            }
        };
        th.start();
    }

Hey Hi Friends I got Error in my code. My Project compiling Successfully & Running from starting good but when I am Firing Mobile Middle key that time it shows error like that.....

TRACE: <at java.lang.Error: ClassFormatError:  56>, Exception caught in Display class
java.lang.Error: ClassFormatError:  56
        at java.lang.Class.invoke_verify(), bci=0
        at java.lang.Class.initialize(), bci=117
        at com.ui.PreviewPageUI.getPreviewData(), bci=0
        at com.ui.PreviewPageUI.keyPressedMainCatFire(), bci=54
        at com.ui.PreviewPageUI.keyPressedFire(PreviewPageUI.java:451)
        at com.ui.PreviewPageUI.keyPressed(PreviewPageUI.java:284)
        at javax.microedition.lcdui.CanvasLFImpl.uCallKeyPressed(), bci=19
        at javax.microedition.lcdui.DisplayableLFImpl.uCallKeyEvent(), bci=146
        at javax.microedition.lcdui.Display$DisplayEventConsumerImpl.handleKeyEvent(), bci=30
        at com.sun.midp.lcdui.DisplayEventListener.process(), bci=277
        at com.sun.midp.events.EventQueue.run(), bci=179
        at java.lang.Thread.run(Thread.java:662)

Please help me how to remove this error... Thanks
This is my Function Code

private void getPreviewData(final String cat) {
        Thread th = new Thread() {

            public void run() {
                try {
                    if (cat.equals("VD")) {
                        if (videoHastable == null || videoHastable.isEmpty()) {
                            initializeWaiting();
                            ParseUrl parsedata=new ParseUrl();
                            json=new JSONObject();
                            try {
                                json.put("phonetype",Midlet.PHONE_TYPE);
                                json.put("cat","VD");
                            } catch (JSONException ex) {
                                System.out.println(ex.toString());
                            }
                            String url="http://localhost:8084/MagicWeb/pappilon1?json="+json.toString();

                            videoHastable =parsedata.coonectHttp(url,cat);
                            circularLoading = false;
                        }
                        if (videoHastable != null) {
                            Midlet.display.setCurrent(new WallPapersCanvas(2, "VIDEOS", videoHastable));
                        } else {
                            initializeError("MESSAGE", "COULD NOT POPULATE DATA FROM THE SERVER", MAIN_CATEGORIES);
                        }
                    } else if (cat.equals("WP")) {
                        if (wallHastable == null || wallHastable.isEmpty()) {
                            initializeWaiting();

                            ParseUrl parsedata=new ParseUrl();
                            json=new JSONObject();
                            try {
                                json.put("phonetype",Midlet.PHONE_TYPE);
                                json.put("cat","WP");
                            }catch(JSONException e){
                                System.out.println("json excep:"+e.toString());
                            }catch(Exception e){
                                System.out.println("error in wp getpriview:"+e.toString());
                            }
                            String url="http://localhost:8084/MagicWeb/pappilon1?json="+json.toString();
                            System.out.println("I am in wallpaper getpreiview");
                            wallHastable =parsedata.coonectHttp(url,cat);
                            circularLoading = false;
                        }
                        if (wallHastable != null) {
                            Midlet.display.setCurrent(new WallPapersCanvas(2, "WALLPAPERS", wallHastable));
                        } else {
                            initializeError("MESSAGE", "COULD NOT POPULATE DATA FROM THE SERVER", MAIN_CATEGORIES);
                        }
                    } else if (cat.equals("GM")) {
                        if (gamesHastable == null || gamesHastable.isEmpty()) {
                            initializeWaiting();

                            ParseUrl parsedata=new ParseUrl();
                            json=new JSONObject();
                            try {
                                json.put("phonetype",Midlet.PHONE_TYPE);
                                json.put("cat","GM");
                            } catch (JSONException ex) {
                                System.out.println(ex.toString());
                            }
                            String url="http://localhost:8084/MagicWeb/pappilon1?json="+json.toString();
                            gamesHastable =parsedata.coonectHttp(url,cat);
                            circularLoading = false;
                        }
                        if (gamesHastable != null) {
                            Midlet.display.setCurrent(new WallPapersCanvas(2, "GAMES", gamesHastable));
                        } else {
                            initializeError("MESSAGE", "COULD NOT POPULATE DATA FROM THE SERVER", MAIN_CATEGORIES);
                        }
                    } else if (cat.equals("TH")) {
                        if (themesHastable == null || themesHastable.isEmpty()) {
                            initializeWaiting();

                            ParseUrl parsedata=new ParseUrl();
                            json=new JSONObject();
                            try {
                                json.put("phonetype",Midlet.PHONE_TYPE);
                                json.put("cat","TH");
                            } catch (JSONException ex) {
                                System.out.println(ex.toString());
                            }
                            String url="http://localhost:8084/MagicWeb/pappilon1?json="+json.toString();
                            themesHastable =parsedata.coonectHttp(url,cat);
                            circularLoading = false;
                        }
                        if (themesHastable != null) {
                            Midlet.display.setCurrent(new WallPapersCanvas(2, "THEMES", themesHastable));
                        } else {
                            initializeError("MESSAGE", "COULD NOT POPULATE DATA FROM THE SERVER", MAIN_CATEGORIES);
                        }
                    } else if (cat.equals("AN")) {
                        if (animateHastable == null || animateHastable.isEmpty()) {
                            initializeWaiting();

                            ParseUrl parsedata=new ParseUrl();
                            json=new JSONObject();
                            try {
                                json.put("phonetype",Midlet.PHONE_TYPE);
                                json.put("cat","AN");
                            } catch (JSONException ex) {
                                System.out.println(ex.toString());
                            }
                            String url="http://localhost:8084/MagicWeb/pappilon1?json="+json.toString();
                            animateHastable =parsedata.coonectHttp(url,cat);
                            circularLoading = false;
                        }
                        if (animateHastable != null) {
                            Midlet.display.setCurrent(new WallPapersCanvas(2, "ANIMATIONS", animateHastable));
                        } else {
                            initializeError("MESSAGE", "COULD NOT POPULATE DATA FROM THE SERVER", MAIN_CATEGORIES);
                        }
                    } else if (cat.equals("FS")) {
                        if (freeHastable == null || freeHastable.isEmpty()) {
                            initializeWaiting();

                            ParseUrl parsedata=new ParseUrl();
                            json=new JSONObject();
                            try {
                                json.put("phonetype",Midlet.PHONE_TYPE);
                                json.put("cat","FS");
                            } catch (JSONException ex) {
                                System.out.println(ex.toString());
                            }
                            String url="http://localhost:8084/MagicWeb/pappilon1?json="+json.toString();
                            freeHastable =parsedata.coonectHttp(url,cat);
                            circularLoading = false;
                        }
                        if (freeHastable != null) {
                            Midlet.display.setCurrent(new WallPapersCanvas(2, "FREE GIFTS", freeHastable));
                        } else {
                            initializeError("MESSAGE", "COULD NOT POPULATE DATA FROM THE SERVER", MAIN_CATEGORIES);
                        }
                    } else {
                        initializeError("MESSAGE", "CATEGORY NAME DOES NOT EXIST", MAIN_CATEGORIES);
                    }
                } catch (Exception e) {
                    System.out.println("error @ getPreviewData");
                    e.printStackTrace();
                }
            }
        };
        th.start();
    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沉默的熊 2024-10-28 20:30:29

当 Java 虚拟机尝试读取类文件并确定该文件格式错误或无法解释为类文件时抛出。

链接
...您可以输入您的代码吗?

Thrown when the Java Virtual Machine attempts to read a class file and determines that the file is malformed or otherwise cannot be interpreted as a class file.

Link
... Could you please put your code?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文