Skip to content

Commit 81a2559

Browse files
committed
Back to hitting no class def found exceptions at runtime.
1 parent 85772c0 commit 81a2559

File tree

6 files changed

+51
-49
lines changed

6 files changed

+51
-49
lines changed

src/ServiceStackEclipse/.classpath

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
<classpathentry kind="lib" path="libs/maven-core-3.0.5.jar"/>
77
<classpathentry kind="lib" path="libs/maven-model-3.0.5.jar"/>
88
<classpathentry kind="lib" path="libs/plexus-utils-2.0.6.jar"/>
9+
<classpathentry kind="lib" path="libs/httpclient-4.3.3.jar"/>
910
<classpathentry kind="output" path="bin"/>
1011
</classpath>

src/ServiceStackEclipse/META-INF/MANIFEST.MF

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@ Require-Bundle: org.eclipse.ui,
1010
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
1111
Import-Package: org.eclipse.core.runtime,
1212
org.eclipse.jdt.core
13+
Bundle-ClassPath: .,
14+
libs/httpclient-4.3.3.jar,
15+
libs/maven-core-3.0.5.jar,
16+
libs/maven-model-3.0.5.jar,
17+
libs/plexus-utils-2.0.6.jar

src/ServiceStackEclipse/build.properties

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@ source.. = src/
22
output.. = bin/
33
bin.includes = plugin.xml,\
44
META-INF/,\
5-
.
5+
.,\
6+
libs/httpclient-4.3.3.jar,\
7+
libs/maven-core-3.0.5.jar,\
8+
libs/maven-model-3.0.5.jar,\
9+
libs/plexus-utils-2.0.6.jar
576 KB
Binary file not shown.

src/ServiceStackEclipse/src/net/servicestack/eclipse/nativetypes/JavaNativeTypesHandler.java

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package net.servicestack.eclipse.nativetypes;
22

3-
//import org.apache.http.client.utils.URIBuilder;
3+
import org.apache.http.client.utils.URIBuilder;
44

55
import java.io.BufferedReader;
66
import java.io.IOException;
@@ -38,33 +38,32 @@ public String generateUrl(String baseUrl, Map<String, String> options) {
3838
if (!baseUrl.endsWith("/")) {
3939
baseUrl += "/";
4040
}
41-
return null;
4241

43-
// URIBuilder builder;
44-
// try {
45-
// builder = new URIBuilder(baseUrl);
46-
// } catch (URISyntaxException e) {
47-
// //Log error to IDEA warning bubble/window.
48-
// return null;
49-
// }
50-
//
51-
// String existingPath = builder.getPath();
52-
// if (existingPath == null || existingPath.equals("/")) {
53-
// builder.setPath("/types/java");
54-
// } else {
55-
// builder.setPath(existingPath + "/types/java");
56-
// }
57-
// if(options != null) {
58-
// for (Map.Entry<String, String> item : options.entrySet()) {
59-
// builder.addParameter(item.getKey(), item.getValue().trim());
60-
// }
61-
// }
62-
// try {
63-
// return builder.build().toString();
64-
// } catch (URISyntaxException e) {
65-
// e.printStackTrace();
66-
// return null;
67-
// }
42+
URIBuilder builder;
43+
try {
44+
builder = new URIBuilder(baseUrl);
45+
} catch (URISyntaxException e) {
46+
//Log error to IDEA warning bubble/window.
47+
return null;
48+
}
49+
50+
String existingPath = builder.getPath();
51+
if (existingPath == null || existingPath.equals("/")) {
52+
builder.setPath("/types/java");
53+
} else {
54+
builder.setPath(existingPath + "/types/java");
55+
}
56+
if(options != null) {
57+
for (Map.Entry<String, String> item : options.entrySet()) {
58+
builder.addParameter(item.getKey(), item.getValue().trim());
59+
}
60+
}
61+
try {
62+
return builder.build().toString();
63+
} catch (URISyntaxException e) {
64+
e.printStackTrace();
65+
return null;
66+
}
6867
}
6968

7069

src/ServiceStackEclipse/src/net/servicestack/eclipse/wizard/AddReferenceWizard.java

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public class AddReferenceWizard extends Wizard {
2626
private boolean _hasPomFile;
2727
private File _pomFile;
2828

29+
private String errorMessage;
30+
2931
private static final String dependencyGroupId = "net.servicestack";
3032
private static final String dependencyPackageId = "android";
3133
private static final String dependencyVersion = "1.0.10";
@@ -65,38 +67,36 @@ public boolean accept(File dir, String name) {
6567
@Override
6668
public boolean performFinish() {
6769
// TODO Auto-generated method stub
70+
final String addressUrl = _page.getAddressUrl();
71+
final String fileName = _page.getFileName();
6872
try {
69-
getContainer().run(true, true, new IRunnableWithProgress() {
70-
public void run(IProgressMonitor monitor) throws InterruptedException {
71-
monitor.beginTask("Adding ServiceStack Reference: ", 5);
72-
monitor.worked(1);
73-
monitor.subTask("Validating endpoint...");
73+
getShell().getDisplay().asyncExec(new Runnable() {
74+
public void run(){
75+
7476
INativeTypesHandler nativeTypesHandler = new JavaNativeTypesHandler();
7577
try {
76-
boolean validUrl = nativeTypesHandler.validateServiceStackEndpoint(_page.getAddressUrl());
78+
boolean validUrl = nativeTypesHandler.validateServiceStackEndpoint(addressUrl);
7779
if(!validUrl) {
78-
_page.setErrorMessage("Invalid ServiceStack endpoint.");
80+
_page.setErrorMessage(errorMessage = "Invalid ServiceStack endpoint.");
7981
}
8082
} catch (IOException e1) {
8183
// TODO Auto-generated catch block
8284
_page.setErrorMessage("Error occurred trying to validate the ServiceStack endpoint - " + e1.getMessage());
8385
e1.printStackTrace();
8486
return;
8587
}
86-
monitor.worked(1);
87-
monitor.subTask("Fetching DTOs...");
88+
8889
String code = null;
8990
try {
90-
code = nativeTypesHandler.getUpdatedCode(_page.getAddressUrl(), null);
91+
code = nativeTypesHandler.getUpdatedCode(addressUrl, null);
9192
} catch (IOException e1) {
9293
// TODO Auto-generated catch block
9394
_page.setErrorMessage("Error occurred trying to fetch ServiceStack DTOs - " + e1.getMessage());
9495
e1.printStackTrace();
9596
return;
9697
}
9798
if(_hasPomFile) {
98-
monitor.worked(1);
99-
monitor.subTask("Adding Maven dependency...");
99+
100100
EclipseMavenHelper mavenHelper = new EclipseMavenHelper();
101101
try {
102102
// if(mavenHelper.addMavenDependencyIfRequired(_pomFile, dependencyGroupId, clientPackageId, dependencyVersion)) {
@@ -107,20 +107,13 @@ public void run(IProgressMonitor monitor) throws InterruptedException {
107107
e.printStackTrace();
108108
}
109109
}
110-
111-
monitor.done();
110+
112111
}
113112
});
114113

115114

116-
} catch (InvocationTargetException e) {
117-
// TODO Auto-generated catch block
118-
e.printStackTrace();
119-
} catch (InterruptedException e) {
120-
// TODO Auto-generated catch block
121-
e.printStackTrace();
122115
} catch (Exception e) {
123-
116+
_page.setErrorMessage("Failed " + e.getMessage());
124117
}
125118

126119
return false;

0 commit comments

Comments
 (0)