/*
 * Copyright 2015 SFB 632.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package annis.security;

import java.io.Serializable;
import org.apache.shiro.util.ByteSource;
import org.apache.shiro.util.SimpleByteSource;

/**
 * A wrapper around {@link SimpleByteSource} to make it {@link Serializable}
 * @author thomas
 */
public class SerializableByteSource extends SimpleByteSource implements Serializable
{
  public SerializableByteSource()
  {
    super(new byte[0]);
  }

  public SerializableByteSource(ByteSource source)
  {
    super(source);
  }
  
}

@@ -825,14 +825,45 @@
 hor 
-t
+T
 homas
+ Krause %3Ckrauseto@hu-berlin.de%3E
 %0A */
@@ -903,16 +903,98 @@
 rce 
-extend
+implement
 s 
+ByteSource, Serializable%0A%7B%0A  %0A  /**%0A   * The wrapped object.%0A   * Since %7B@link 
 Simp
@@ -1009,101 +1009,396 @@
 urce
+%7D
  i
-mplements Serializable%0A%7B%0A  public SerializableByteSource()%0A  %7B%0A    super(new byte%5B0%5D)
+s not serializable itself this field%0A   * is transient.%0A   * Therfore only access it with the %7B@link #getDelegate() %7D getter function.%0A   * %0A   */%0A  private transient SimpleByteSource delegate;%0A  %0A  private final byte%5B%5D bytes;%0A  %0A  public SerializableByteSource()%0A  %7B%0A    this.bytes = new byte%5B0%5D;%0A  %7D%0A  %0A  public SerializableByteSource(byte%5B%5D bytes)%0A  %7B%0A    this.bytes = bytes
 ;%0A  %7D%0A
+  
 %0A  p
@@ -1457,26 +1457,606 @@
     
-super(source);%0A  %7D
+if(source == null)%0A    %7B%0A      this.bytes = new byte%5B0%5D;%0A    %7D%0A    else%0A    %7B%0A      this.bytes = source.getBytes();%0A    %7D%0A  %7D%0A%0A  public SimpleByteSource getDelegate()%0A  %7B%0A    if(delegate == null)%0A    %7B%0A      delegate = new SimpleByteSource(bytes);%0A    %7D%0A    return delegate;%0A  %7D%0A%0A  @Override%0A  public byte%5B%5D getBytes()%0A  %7B%0A    return this.bytes;%0A  %7D%0A%0A  @Override%0A  public String toHex()%0A  %7B%0A    return getDelegate().toHex();%0A  %7D%0A%0A  @Override%0A  public String toBase64()%0A  %7B%0A    return getDelegate().toBase64();%0A  %7D%0A%0A  @Override%0A  public boolean isEmpty()%0A  %7B%0A    return getDelegate().isEmpty();%0A  %7D%0A
 %0A  %0A

fix serialization issues: don't inherit SimpleByteSource but use a transient delegate