Index: dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/util/ResourceServerHandler.java |
=================================================================== |
--- dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/util/ResourceServerHandler.java (revision 31466) |
+++ dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/util/ResourceServerHandler.java (working copy) |
@@ -117,10 +117,9 @@ |
} else if (index == str.length() - 1) { |
result.add(new int[] {Integer.parseInt(str.substring(0, index)), -1}); |
} else if (index != -1) { |
- result.add( |
- new int[] { |
- Integer.parseInt(str.substring(0, index)), |
- Integer.parseInt(str.substring(index + 1))}); |
+ result.add(new int[] { |
+ Integer.parseInt(str.substring(0, index)), |
+ Integer.parseInt(str.substring(index + 1))}); |
} |
} catch (NumberFormatException nfe) { |
@@ -233,16 +232,15 @@ |
{"/favicon.ico", TYPE_GIF, "/resources/favicon.ico"}, |
{"/dart_16_16.gif", TYPE_GIF, "/resources/dart_16_16.gif"}, |
{"/dart_32_32.gif", TYPE_GIF, "/resources/dart_32_32.gif"}, |
- {"/agent.html", TYPE_HTML, "agent.html"}, {"/agent.js", TYPE_JS, "agent.js"}, { |
- "/apple-touch-icon-precomposed.png", TYPE_PNG, |
- "/resources/apple-touch-icon-precomposed.png"}}; |
+ {"/agent.html", TYPE_HTML, "agent.html"}, |
+ {"/agent.js", TYPE_JS, "agent.js"}, |
+ {"/apple-touch-icon-precomposed.png", TYPE_PNG, "/resources/apple-touch-icon-precomposed.png"}}; |
@SuppressWarnings("unused") |
private static byte[] getJSAgentContent() { |
if (AGENT_CONTENT == null) { |
try { |
- AGENT_CONTENT = ByteStreams.toByteArray( |
- ResourceServer.class.getResourceAsStream("agent.js")); |
+ AGENT_CONTENT = ByteStreams.toByteArray(ResourceServer.class.getResourceAsStream("agent.js")); |
} catch (IOException e) { |
DartDebugCorePlugin.logError(e); |
@@ -257,8 +255,8 @@ |
extraMappings = new HashMap<String, String>(); |
try { |
- BufferedReader reader = new BufferedReader( |
- new InputStreamReader(ResourceServerHandler.class.getResourceAsStream("mime.txt"))); |
+ BufferedReader reader = new BufferedReader(new InputStreamReader( |
+ ResourceServerHandler.class.getResourceAsStream("mime.txt"))); |
String line = reader.readLine(); |
@@ -468,9 +466,8 @@ |
response.headers.put(CONTENT_LENGTH, Long.toString(rangeData.length)); |
// Content-Range: bytes X-Y/Z |
int[] range = ranges.get(0); |
- response.headers.put( |
- CONTENT_RANGE, |
- "bytes " + range[0] + "-" + range[1] + "/" + rangeData.length); |
+ response.headers.put(CONTENT_RANGE, "bytes " + range[0] + "-" + range[1] + "/" |
+ + rangeData.length); |
} else { |
response.responseBodyStream = new FileInputStream(javaFile); |
} |
@@ -500,8 +497,7 @@ |
return response; |
} |
- private HttpResponse createPOSTResponse(HttpHeader header, DataInputStream in) |
- throws IOException { |
+ private HttpResponse createPOSTResponse(HttpHeader header, DataInputStream in) throws IOException { |
// This 200000 value matches Jetty's setting. |
final int MAX_POST = 200000 + 100; |
@@ -675,8 +671,9 @@ |
if (DartDebugCorePlugin.getPlugin().getUserAgentManager() != null) { |
String userAgent = header.headers.get(USER_AGENT); |
- boolean allowed = DartDebugCorePlugin.getPlugin() |
- .getUserAgentManager().allowUserAgent(remoteAddress, userAgent); |
+ boolean allowed = DartDebugCorePlugin.getPlugin().getUserAgentManager().allowUserAgent( |
+ remoteAddress, |
+ userAgent); |
if (allowed) { |
resourceServer.loadingContentFrom(remoteAddress.getHostAddress(), userAgent); |
@@ -758,10 +755,11 @@ |
if (!file.exists() && childPath.toString().contains(DartCore.PACKAGES_DIRECTORY_PATH)) { |
int packagesIndex = childPath.toString().indexOf(DartCore.PACKAGES_DIRECTORY_PATH); |
- String pathString = childPath.toString() |
- .substring(packagesIndex + DartCore.PACKAGES_DIRECTORY_PATH.length()); |
- IFileInfo fileInfo = DartCore.getProjectManager() |
- .resolveUriToFileInfo(project, DartCore.PACKAGE_SCHEME_SPEC + pathString); |
+ String pathString = childPath.toString().substring( |
+ packagesIndex + DartCore.PACKAGES_DIRECTORY_PATH.length()); |
+ IFileInfo fileInfo = DartCore.getProjectManager().resolveUriToFileInfo( |
+ project, |
+ DartCore.PACKAGE_SCHEME_SPEC + pathString); |
if (fileInfo != null) { |
file = fileInfo.getFile(); |
} |
@@ -771,8 +769,8 @@ |
} |
private IResource locateMappedFile(File file) { |
- IResource resource = ResourcesPlugin.getWorkspace() |
- .getRoot().getFileForLocation(Path.fromOSString(file.getAbsolutePath())); |
+ IResource resource = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation( |
+ Path.fromOSString(file.getAbsolutePath())); |
if (resource instanceof IFile) { |
IFile resourceFile = (IFile) resource; |
@@ -780,8 +778,8 @@ |
String mappingPath = DartCore.getResourceRemapping(resourceFile); |
if (mappingPath != null) { |
- IResource mappedResource = ResourcesPlugin.getWorkspace() |
- .getRoot().findMember(Path.fromPortableString(mappingPath)); |
+ IResource mappedResource = ResourcesPlugin.getWorkspace().getRoot().findMember( |
+ Path.fromPortableString(mappingPath)); |
if (mappedResource != null && mappedResource.exists()) { |
return mappedResource; |