OSDN Git Service

Deleting print job files when we do not have to.
authorSvetoslav Ganov <svetoslavganov@google.com>
Fri, 4 Oct 2013 15:49:03 +0000 (08:49 -0700)
committerSvetoslav Ganov <svetoslavganov@google.com>
Fri, 4 Oct 2013 15:49:32 +0000 (08:49 -0700)
The print job file name was not properly parsed. This resulted
in incorrect mapping from file to print job, thus deleting the
file when we do not have to.

bug:11069354

Change-Id: I7b8a7a7f98dd77b34119f2a9cd16a6ec3c22b63b

packages/PrintSpooler/src/com/android/printspooler/PrintSpoolerService.java

index d1d71cd..d1b42bc 100644 (file)
@@ -440,8 +440,9 @@ public final class PrintSpoolerService extends Service {
                     if (fileForJobMap == null) {
                         fileForJobMap = new ArrayMap<PrintJobId, File>();
                     }
-                    String printJobIdString = file.getName().substring(0,
-                            PRINT_JOB_FILE_PREFIX.length());
+                    String printJobIdString = file.getName().substring(
+                            PRINT_JOB_FILE_PREFIX.length(),
+                            file.getName().indexOf('.'));
                     PrintJobId printJobId = PrintJobId.unflattenFromString(
                             printJobIdString);
                     fileForJobMap.put(printJobId, file);