File: fix-FTBFS-exception.patch

package info (click to toggle)
filius 2.9.4%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,760 kB
  • sloc: java: 36,441; xml: 1,141; sh: 33; makefile: 5
file content (48 lines) | stat: -rw-r--r-- 1,801 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Description: Add exceptions back that have been removed upstream.
Author: Andreas B. Mundt <andi@debian.org>
Forwarded: not-needed
Last-Update: 2023-10-29
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/main/java/filius/rahmenprogramm/ResourceUtil.java
+++ b/src/main/java/filius/rahmenprogramm/ResourceUtil.java
@@ -22,9 +22,13 @@
         String urlEncodedPath = getResourceUrlEncodedPath(relativePath);
         String path = null;
         if (urlEncodedPath != null) {
-            LOG.debug(urlEncodedPath);
-            path = UriUtils.decode(urlEncodedPath, "utf8");
-            LOG.debug("Resolved path: " + path);
+            try {
+                LOG.debug(urlEncodedPath);
+                path = UriUtils.decode(urlEncodedPath, "utf8");
+                LOG.debug("Resolved path: " + path);
+            } catch (Exception e) {
+                LOG.debug("Resource " + relativePath + " could not be resolved (" + urlEncodedPath + ")");
+            }
         }
         return path;
     }
--- a/src/main/java/filius/software/www/HTTPNachricht.java
+++ b/src/main/java/filius/software/www/HTTPNachricht.java
@@ -413,12 +413,18 @@
     }
 
     protected static String encodePath(String path) {
-        String urlEncodedPath = UriUtils.encodePath(path, "utf8");
+        String urlEncodedPath = "";
+        try {
+            urlEncodedPath = UriUtils.encodePath(path, "utf8");
+        } catch (Exception e) {}
         return urlEncodedPath;
     }
 
     protected static String decodePath(String urlEncodedPath) {
-        String path = UriUtils.decode(urlEncodedPath, "utf8");
+        String path = "";
+        try {
+            path = UriUtils.decode(urlEncodedPath, "utf8");
+        } catch (Exception e) {}
         return path;
     }
 }