/[gzz]/gzz/gzz/mediaserver/MediaserverFiler.java
ViewVC logotype

Diff of /gzz/gzz/mediaserver/MediaserverFiler.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by benja, Tue Oct 1 17:40:36 2002 UTC revision 1.11 by benja, Wed Oct 2 17:29:17 2002 UTC
# Line 24  package gzz.mediaserver; Line 24  package gzz.mediaserver;
24  import gzz.media.MediaInputStream;  import gzz.media.MediaInputStream;
25  import gzz.media.MediaOutputStream;  import gzz.media.MediaOutputStream;
26    
27    import gzz.util.CopyUtil;
28  import gzz.util.Filer;  import gzz.util.Filer;
29  import gzz.util.HeaderUtil;  import gzz.util.HeaderUtil;
30  import gzz.util.Version;  import gzz.util.Version;
# Line 33  import java.io.*; Line 34  import java.io.*;
34  import java.util.*;  import java.util.*;
35    
36  public class MediaserverFiler implements Filer {  public class MediaserverFiler implements Filer {
37        public static boolean dbg = false;
38        private static void pa(String s) { System.out.println(s); }
39    
40      public static final String versionContentType = "application/x-GZZ2-version";      public static final String versionContentType = "application/x-GZZ2-version";
41      public static final String diffContentType = "application/x-GZZ2-msfiler-diff";      public static final String diffContentType = "application/x-GZZ2-msfiler-diff";
# Line 112  public class MediaserverFiler implements Line 115  public class MediaserverFiler implements
115                  Version.Diff diff = fmt.readDiff(is);                  Version.Diff diff = fmt.readDiff(is);
116                  Version v = diff.applyTo(from);                  Version v = diff.applyTo(from);
117    
118                  if(!id.equals(getVersionId(v, headerTo)))                  if(!id.equals(getVersionId(v, headerTo))) {
119                        if(dbg) {
120                            pa("============= DIFF ===============");
121                            pa(new String(CopyUtil.readBytes(diffBlock.getInputStream())));
122                            pa("==================================");
123                            pa("Diff: "+diff);
124                            pa("");
125                            pa("From: "+from);
126                            pa("");
127                            pa("Gives: "+v);
128                            pa("============== BAD ===============");
129                            ByteArrayOutputStream bos = new ByteArrayOutputStream();
130                            fmt.writeVersion(bos, v);
131                            pa(new String(bos.toByteArray()));
132                            pa("==================================");
133                        }
134                      throw new IOException("Version doesn't match: "+v+"\n"+                      throw new IOException("Version doesn't match: "+v+"\n"+
135                          "Wanted id =      "+id+"\n"+                          "Wanted id =      "+id+"\n"+
136                          "Regenerated id = "+getVersionId(v, headerTo)+"\n"+                          "Regenerated id = "+getVersionId(v, headerTo)+"\n"+
137                          "Using diff: "+diffId+"\n");                          "Using diff: "+diffId+"\n");
138                    }
139    
140                  if(hdr != null)                  if(hdr != null)
141                      hdr[0] = headerTo;                      hdr[0] = headerTo;
# Line 195  public class MediaserverFiler implements Line 214  public class MediaserverFiler implements
214              fmt.writeVersion(bos, v);              fmt.writeVersion(bos, v);
215              ms.addDatum(bos.toByteArray(),              ms.addDatum(bos.toByteArray(),
216                          versionContentType, current);                          versionContentType, current);
217                if(dbg) {
218                    pa("============ CORRECT =============");
219                    pa(new String(bos.toByteArray()));
220                    pa("==================================");
221                }
222              t.printStackTrace();              t.printStackTrace();
223              throw new Error("Problem with re-loading: "+t);              throw new Error("Problem with re-loading: "+t);
224          }          }

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26