/*
 * Copyright 2013 Corpuslinguistic working group Humboldt University Berlin.
 *
 * 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.libgui.visualizers;

import java.io.Serializable;

/**
 * Hold the data and meta information for a resource needed by an iframe
 * based visualizer.
 * @author Thomas Krause <krauseto@hu-berlin.de>
 */
public class IFrameResource implements Serializable
{
  private byte[] data;
  private String mimeType;

  public byte[] getData()
  {
    return data;
  }

  public void setData(byte[] data)
  {
    this.data = data;
  }

  public String getMimeType()
  {
    return mimeType;
  }

  public void setMimeType(String mimeType)
  {
    this.mimeType = mimeType;
  }
  
  
}

@@ -699,16 +699,41 @@
 lizable;
+%0Aimport java.util.Arrays;
 %0A%0A/**%0A *
@@ -948,24 +948,38 @@
  byte%5B%5D data
+ = new byte%5B0%5D
 ;%0A  private 
@@ -1037,20 +1037,48 @@
  return 
-data
+Arrays.copyOf(data, data.length)
 ;%0A  %7D%0A%0A 
@@ -1123,25 +1123,140 @@
     
-this.data = data;
+if(data == null)%0A    %7B%0A      this.data = new byte%5B0%5D;%0A    %7D%0A    else%0A    %7B%0A      this.data = Arrays.copyOf(data, data.length);%0A    %7D
 %0A  %7D

copy iframe resource bytes to make the getter and setter functions more secure