Skip to content

Commit 652d3ba

Browse files
committed
Merge branch 'release'
2 parents d369817 + 897b64c commit 652d3ba

File tree

3 files changed

+41
-17
lines changed

3 files changed

+41
-17
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/intellij/link/mysql/BasicLinkMySQLPanel.form

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,6 @@
161161
<text value="Env prefix:"/>
162162
</properties>
163163
</component>
164-
<component id="5f3cd" class="javax.swing.JTextPane" binding="testResultTextPane">
165-
<constraints>
166-
<grid row="9" column="1" row-span="2" col-span="3" vsize-policy="6" hsize-policy="0" anchor="0" fill="3" indent="0" use-parent-layout="false">
167-
<preferred-size width="150" height="50"/>
168-
</grid>
169-
</constraints>
170-
<properties/>
171-
</component>
172164
<component id="4b6c5" class="javax.swing.JTextField" binding="envPrefixTextField">
173165
<constraints>
174166
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false">
@@ -192,6 +184,22 @@
192184
<grid row="9" column="0" row-span="2" col-span="1" vsize-policy="0" hsize-policy="0" anchor="5" fill="0" indent="0" use-parent-layout="false"/>
193185
</constraints>
194186
</nested-form>
187+
<scrollpane id="4a8b8">
188+
<constraints>
189+
<grid row="9" column="1" row-span="2" col-span="3" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
190+
</constraints>
191+
<properties>
192+
<horizontalScrollBarPolicy value="31"/>
193+
<verticalScrollBarPolicy value="20"/>
194+
</properties>
195+
<border type="empty"/>
196+
<children>
197+
<component id="5f3cd" class="javax.swing.JTextPane" binding="testResultTextPane">
198+
<constraints/>
199+
<properties/>
200+
</component>
201+
</children>
202+
</scrollpane>
195203
</children>
196204
</grid>
197205
</form>

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/intellij/link/mysql/MySQLConnectionUtils.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818

1919
public class MySQLConnectionUtils {
2020

21+
private static final String CONNECTION_ISSUE_MESSAGE = "%s Please follow https://docs.microsoft.com/en-us/azure/mysql/howto-manage-firewall-using-portal "
22+
+ "to create a firewall rule to unblock your local access.";
23+
private static final int CONNECTION_ERROR_CODE = 9000;
24+
2125
public static boolean connect(String url, String username, String password) {
2226
try {
2327
Class.forName("com.mysql.jdbc.Driver");
@@ -48,14 +52,18 @@ public static ConnectResult connectWithPing(String url, String username, String
4852
pingCost = System.currentTimeMillis() - start;
4953
serverVersion = ((ConnectionImpl) connection).getServerVersion().toString();
5054
} catch (ClassNotFoundException | SQLException exception) {
51-
errorMessage = exception.getMessage();
55+
errorMessage = isConnectionIssue(exception) ? String.format(CONNECTION_ISSUE_MESSAGE, exception.getMessage()) : exception.getMessage();
5256
}
5357
EventUtil.logEvent(EventType.info, ActionConstants.parse(ActionConstants.MySQL.TEST_CONNECTION).getServiceName(),
5458
ActionConstants.parse(ActionConstants.MySQL.TEST_CONNECTION).getOperationName(),
5559
Collections.singletonMap("result", String.valueOf(connected)));
5660
return new ConnectResult(connected, errorMessage, pingCost, serverVersion);
5761
}
5862

63+
private static boolean isConnectionIssue(final Exception exception){
64+
return exception instanceof SQLException && ((SQLException) exception).getErrorCode() == CONNECTION_ERROR_CODE;
65+
}
66+
5967
@Getter
6068
@AllArgsConstructor
6169
public static class ConnectResult {

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/intellij/link/mysql/PasswordDialog.form

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@
3939
<text value=""/>
4040
</properties>
4141
</component>
42-
<component id="e626c" class="javax.swing.JTextPane" binding="testResultTextPane">
43-
<constraints>
44-
<grid row="3" column="1" row-span="2" col-span="3" vsize-policy="6" hsize-policy="6" anchor="1" fill="1" indent="0" use-parent-layout="false">
45-
<preferred-size width="150" height="50"/>
46-
</grid>
47-
</constraints>
48-
<properties/>
49-
</component>
5042
<component id="22170" class="javax.swing.JButton" binding="testConnectionButton">
5143
<constraints>
5244
<grid row="2" column="1" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
@@ -93,6 +85,22 @@
9385
<grid row="3" column="0" row-span="2" col-span="1" vsize-policy="2" hsize-policy="0" anchor="5" fill="0" indent="0" use-parent-layout="false"/>
9486
</constraints>
9587
</nested-form>
88+
<scrollpane id="63832">
89+
<constraints>
90+
<grid row="3" column="1" row-span="2" col-span="3" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
91+
</constraints>
92+
<properties>
93+
<horizontalScrollBarPolicy value="31"/>
94+
<verticalScrollBarPolicy value="20"/>
95+
</properties>
96+
<border type="empty"/>
97+
<children>
98+
<component id="e626c" class="javax.swing.JTextPane" binding="testResultTextPane">
99+
<constraints/>
100+
<properties/>
101+
</component>
102+
</children>
103+
</scrollpane>
96104
</children>
97105
</grid>
98106
</form>

0 commit comments

Comments
 (0)