Skip to content

Commit 7f073c6

Browse files
committed
chore: remove debug code from PropFindSaxHandler
- Remove empty debug if blocks - Remove DEBUG_XML constant and related debug logging - Remove all Log_OC.d() debug statements - Remove unused UNKNOWN_PATH constant Signed-off-by: dmiales <dmiales@gmail.com>
1 parent 9ecd36b commit 7f073c6

File tree

1 file changed

+0
-43
lines changed

1 file changed

+0
-43
lines changed

app/src/main/java/com/owncloud/android/lib/resources/files/PropFindSaxHandler.java

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,8 @@ public class PropFindSaxHandler extends DefaultHandler {
5959
private static final String ELEMENT_COMMENTS_UNREAD = "comments-unread";
6060
private static final String ELEMENT_STATUS = "status";
6161

62-
// Debug constants
63-
private static final boolean DEBUG_XML = true;
64-
6562
// String constants for logging
6663
private static final String LOG_EQUALS_QUOTE = " = '";
67-
private static final String UNKNOWN_PATH = "unknown";
6864

6965
// Maximum size for StringBuilder to prevent memory leaks
7066
private static final int MAX_STRING_BUILDER_SIZE = 1024 * 1024; // 1MB
@@ -145,19 +141,6 @@ public void characters(char[] ch, int start, int length) throws SAXException {
145141
public void endElement(String uri, String localName, String qName) throws SAXException {
146142
String text = currentText.toString().trim();
147143

148-
// Debug: Always log OC/NC elements
149-
if (NS_OC.equals(uri) || NS_NC.equals(uri)) {
150-
}
151-
152-
// Debug: Log all DAV elements that might contain size/preview info
153-
if (NS_DAV.equals(uri) && (
154-
"quota-used-bytes".equals(localName) ||
155-
"quota-available-bytes".equals(localName) ||
156-
"getcontentlength".equals(localName) ||
157-
"getcontenttype".equals(localName)
158-
)) {
159-
}
160-
161144
if (NS_DAV.equals(uri) && ELEMENT_RESPONSE.equals(localName)) {
162145
if (currentFile != null && currentHref != null) {
163146
String remotePath = extractPathFromHref(currentHref);
@@ -264,13 +247,9 @@ public void endElement(String uri, String localName, String qName) throws SAXExc
264247
inLock = false;
265248
lockText.setLength(0);
266249
} else if (inProp && currentFile != null && inPropstat) {
267-
// Process all properties regardless of status for debugging
268250
if (!propstatStatusOk) {
269251
Log_OC.w(TAG, "Processing properties for propstat with non-OK status: " + uri + ":" + localName + LOG_EQUALS_QUOTE + text + "'");
270252
}
271-
if (DEBUG_XML && (NS_OC.equals(uri) || NS_NC.equals(uri))) {
272-
Log_OC.d(TAG, "FOUND OC/NC ELEMENT in prop: " + uri + ":" + localName + LOG_EQUALS_QUOTE + text + "' (inProp=" + inProp + ", currentFile=" + (currentFile != null) + ", inPropstat=" + inPropstat + ")");
273-
}
274253
// Parse DAV properties
275254
if (NS_DAV.equals(uri) && ELEMENT_GETLASTMODIFIED.equals(localName)) {
276255
currentFile.setModifiedTimestamp(parseLastModified(text));
@@ -289,10 +268,8 @@ public void endElement(String uri, String localName, String qName) throws SAXExc
289268
currentFile.setMimeType(MimeType.DIRECTORY);
290269
currentResourceIsCollection = true;
291270
resourceTypeDetermined = true;
292-
Log_OC.d(TAG, "Detected folder from getcontenttype 'httpd/unix-directory' for: " + currentFile.getRemotePath());
293271
} else if (currentResourceIsCollection) {
294272
// Already determined this is a collection from resourcetype, keep DIRECTORY
295-
Log_OC.d(TAG, "Skipping getcontenttype '" + text + "' for already identified folder: " + currentFile.getRemotePath());
296273
} else {
297274
// This appears to be a file
298275
String currentMimeType = currentFile.getMimeType();
@@ -306,39 +283,26 @@ public void endElement(String uri, String localName, String qName) throws SAXExc
306283
if (!resourceTypeDetermined) {
307284
resourceTypeDetermined = true; // We now know this is a file
308285
}
309-
} else {
310-
// No content type specified or empty, will set default at end
311-
Log_OC.d(TAG, "Empty getcontenttype for file, will use default later");
312286
}
313287
}
314288
}
315289
}
316290
// Parse ownCloud/Nextcloud properties
317-
if (NS_OC.equals(uri) || NS_NC.equals(uri)) {
318-
Log_OC.d(TAG, "Processing OC/NC element: " + uri + ":" + localName + LOG_EQUALS_QUOTE + text + "'");
319-
}
320291
// Handle various possible id element names - try all possible variations
321292
// Nextcloud 31 might use different element names
322293
if ((NS_OC.equals(uri) || NS_NC.equals(uri)) &&
323294
("id".equals(localName) || "fileid".equals(localName) || "file-id".equals(localName) ||
324295
"fileId".equals(localName) || "resource-id".equals(localName) || "file_id".equals(localName) ||
325296
"nc:id".equals(localName) || "oc:id".equals(localName))) {
326-
Log_OC.d(TAG, "Processing id element: " + uri + ":" + localName + LOG_EQUALS_QUOTE + text + "' for file: " + (currentFile != null && currentFile.getRemotePath() != null ? currentFile.getRemotePath() : UNKNOWN_PATH));
327297
if (text != null && !text.isEmpty() && !"null".equals(text)) {
328298
// Only set if not already set or if this is a more specific id
329299
String currentRemoteId = currentFile.getRemoteId();
330300
if (currentRemoteId == null || currentRemoteId.isEmpty() || currentRemoteId.startsWith("/")) {
331301
currentFile.setRemoteId(text);
332-
Log_OC.d(TAG, "Set remoteId from " + uri + ":" + localName + ": " + text);
333-
} else {
334-
Log_OC.d(TAG, "remoteId already set to: " + currentRemoteId + ", skipping " + uri + ":" + localName);
335302
}
336-
} else {
337-
Log_OC.d(TAG, localName + " element found but text is empty, null, or 'null': '" + text + "'");
338303
}
339304
} else if ((NS_OC.equals(uri) || NS_NC.equals(uri)) && "fileid".equals(localName)) {
340305
// Additional check for fileid element
341-
Log_OC.d(TAG, "Found fileid element: " + uri + ":fileid" + LOG_EQUALS_QUOTE + text + "' for file: " + (currentFile != null && currentFile.getRemotePath() != null ? currentFile.getRemotePath() : UNKNOWN_PATH));
342306
if (text != null && !text.isEmpty() && !"null".equals(text)) {
343307
try {
344308
long fileIdLong = Long.parseLong(text);
@@ -348,16 +312,12 @@ public void endElement(String uri, String localName, String qName) throws SAXExc
348312
if (currentRemoteId == null || currentRemoteId.isEmpty() || currentRemoteId.startsWith("/")) {
349313
String fileIdStr = String.valueOf(fileIdLong);
350314
currentFile.setRemoteId(fileIdStr);
351-
Log_OC.d(TAG, "Set remoteId from fileid fallback: " + fileIdStr + " for file: " + (currentFile.getRemotePath() != null ? currentFile.getRemotePath() : UNKNOWN_PATH));
352-
} else {
353-
Log_OC.d(TAG, "remoteId already set, skipping fileid fallback for: " + currentRemoteId);
354315
}
355316
} catch (NumberFormatException e) {
356317
Log_OC.w(TAG, "Failed to parse fileid: '" + text + "'");
357318
}
358319
}
359320
} else if ((NS_OC.equals(uri) || NS_NC.equals(uri)) && ELEMENT_FILEID.equals(localName)) {
360-
Log_OC.d(TAG, "Processing " + uri + ":fileid element with text: '" + text + "'");
361321
try {
362322
long fileIdLong = Long.parseLong(text);
363323
currentFile.setLocalId(fileIdLong);
@@ -366,9 +326,6 @@ public void endElement(String uri, String localName, String qName) throws SAXExc
366326
if (currentRemoteId == null || currentRemoteId.isEmpty() || currentRemoteId.startsWith("/")) {
367327
String fileIdStr = String.valueOf(fileIdLong);
368328
currentFile.setRemoteId(fileIdStr);
369-
Log_OC.d(TAG, "Set remoteId from " + uri + ":fileid (fallback): " + fileIdStr + " for file: " + (currentFile.getRemotePath() != null ? currentFile.getRemotePath() : UNKNOWN_PATH));
370-
} else {
371-
Log_OC.d(TAG, "remoteId already set, skipping fileid fallback for: " + currentRemoteId);
372329
}
373330
} catch (NumberFormatException e) {
374331
Log_OC.w(TAG, "Failed to parse " + uri + ":fileid: '" + text + "'");

0 commit comments

Comments
 (0)