From 32b9a662e933b3e56942af836847d60860977af5 Mon Sep 17 00:00:00 2001 From: Bryant Date: Tue, 27 Aug 2019 09:11:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20sonar?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/syntax/ui/rtextarea/RTextAreaEditorKit.java | 2 ++ .../VolatileImageBackgroundPainterStrategy.java | 10 ++++++---- .../src/main/java/com/fr/design/icon/LockIcon.java | 6 ++++++ .../src/main/java/com/fr/design/icon/WarningIcon.java | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaEditorKit.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaEditorKit.java index f95aa1260..277064c2f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaEditorKit.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaEditorKit.java @@ -902,6 +902,8 @@ public class RTextAreaEditorKit extends DefaultEditorKit { } } catch (BadLocationException bl) { } + }else if (textArea == null) { + throw new IllegalArgumentException("RTextArea can not be null!"); } if (beep) diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/VolatileImageBackgroundPainterStrategy.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/VolatileImageBackgroundPainterStrategy.java index 11aaca364..c7be420de 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/VolatileImageBackgroundPainterStrategy.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/VolatileImageBackgroundPainterStrategy.java @@ -9,6 +9,8 @@ */ package com.fr.design.gui.syntax.ui.rtextarea; +import com.fr.log.FineLoggerFactory; + import java.awt.Graphics; import java.awt.Image; import java.awt.image.VolatileImage; @@ -95,9 +97,9 @@ public class VolatileImageBackgroundPainterStrategy try { tracker.waitForID(1); } catch (InterruptedException e) { - e.printStackTrace(); + FineLoggerFactory.getLogger().error(e.getMessage(),e); bgImage = null; - return; + Thread.currentThread().interrupt(); } finally { tracker.removeImage(i, 1); } @@ -106,9 +108,9 @@ public class VolatileImageBackgroundPainterStrategy try { tracker.waitForID(0); } catch (InterruptedException e) { - e.printStackTrace(); + FineLoggerFactory.getLogger().error(e.getMessage(),e); bgImage = null; - return; + Thread.currentThread().interrupt(); } finally { tracker.removeImage(bgImage, 0); } diff --git a/designer-base/src/main/java/com/fr/design/icon/LockIcon.java b/designer-base/src/main/java/com/fr/design/icon/LockIcon.java index 934d53b08..ee54b6ea8 100644 --- a/designer-base/src/main/java/com/fr/design/icon/LockIcon.java +++ b/designer-base/src/main/java/com/fr/design/icon/LockIcon.java @@ -34,6 +34,7 @@ public class LockIcon extends ImageIcon { } } + @Override public void paintIcon(Component c, Graphics g, int x, int y) { if (mainImage != null) { g.drawImage(mainImage, x, y, c); @@ -48,6 +49,7 @@ public class LockIcon extends ImageIcon { * * @param image the image */ + @Override protected void loadImage(Image image) { synchronized (tracker) { tracker.addImage(image, 0); @@ -55,6 +57,7 @@ public class LockIcon extends ImageIcon { tracker.waitForID(0, 0); } catch (InterruptedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); + Thread.currentThread().interrupt(); } loadStatus = tracker.statusID(0, false); @@ -70,6 +73,7 @@ public class LockIcon extends ImageIcon { * * @return the Image object for this ImageIcon */ + @Override public Image getImage() { return mainImage; } @@ -85,6 +89,7 @@ public class LockIcon extends ImageIcon { * * @return the width in pixels of this icon */ + @Override public int getIconWidth() { return width; } @@ -94,6 +99,7 @@ public class LockIcon extends ImageIcon { * * @return the height in pixels of this icon */ + @Override public int getIconHeight() { return height; } diff --git a/designer-base/src/main/java/com/fr/design/icon/WarningIcon.java b/designer-base/src/main/java/com/fr/design/icon/WarningIcon.java index 9b22b4035..d70d62225 100644 --- a/designer-base/src/main/java/com/fr/design/icon/WarningIcon.java +++ b/designer-base/src/main/java/com/fr/design/icon/WarningIcon.java @@ -59,6 +59,7 @@ public class WarningIcon extends ImageIcon { tracker.waitForID(0, 0); } catch (InterruptedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); + Thread.currentThread().interrupt(); } tracker.statusID(0, false);