Skip to content

Commit 27ebbb2

Browse files
committed
formatting
1 parent 7ce7942 commit 27ebbb2

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

server/src/main/java/org/uiautomation/ios/mobileSafari/DefaultMessageHandler.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ private void process(String rawMessage) {
7171
responses.add(message);
7272
return;
7373
}
74+
7475
// not null, not a command response.
7576
// should be an event.
7677
Event e = EventFactory.createEvent(message);
77-
7878
if (isPageLoad(message)) {
7979
listener.onPageLoad();
8080
return;
@@ -106,7 +106,7 @@ private boolean isImportantDOMChange(Event e) {
106106

107107
private boolean isPageLoad(JSONObject message) {
108108
String method = message.optString("method");
109-
return "Page.loadEventFired".equals(method);
109+
return "Page.loadEventFired".equals(method); // || "Profiler.resetProfiles".equals(method);
110110
// return "Profiler.resetProfiles".equals(method) ||
111111
// "DOM.documentUpdated".equals(method);
112112
}

server/src/main/java/org/uiautomation/ios/mobileSafari/PlistManager.java

+10-5
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ public static String loadFromTemplate(String templatePath) {
4141
return cacheTemplate;
4242
}
4343

44-
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(templatePath);
44+
InputStream
45+
is =
46+
Thread.currentThread().getContextClassLoader().getResourceAsStream(templatePath);
4547
if (is == null) {
4648
throw new WebDriverException("cannot load : " + templatePath);
4749
}
@@ -55,8 +57,7 @@ public static String loadFromTemplate(String templatePath) {
5557
return content;
5658
}
5759

58-
59-
60+
6061
public String JSONCommand(JSONObject command) throws IOException {
6162
String json = command.toString();
6263
String s = Base64.encodeBase64String(json.getBytes());
@@ -72,7 +73,11 @@ public byte[] plistXmlToBinary(String msg) throws Exception {
7273
}
7374

7475
public String plistBinaryToXml(byte[] binary) throws Exception {
75-
NSObject object = BinaryPropertyListParser.parse(binary);
76-
return object.toXMLPropertyList();
76+
try {
77+
NSObject object = BinaryPropertyListParser.parse(binary);
78+
return object.toXMLPropertyList();
79+
} catch (Exception e) {
80+
return null;
81+
}
7782
}
7883
}

0 commit comments

Comments
 (0)