ProcessorState(Processor p, Log log, Source source, ProcessingEnvironment env) {
      processor = p;
      contributed = false;

      try {
        processor.init(env);

        checkSourceVersionCompatibility(source, log);

        supportedAnnotationPatterns = new ArrayList<Pattern>();
        for (String importString : processor.getSupportedAnnotationTypes()) {
          supportedAnnotationPatterns.add(importStringToPattern(importString, processor, log));
        }

        supportedOptionNames = new ArrayList<String>();
        for (String optionName : processor.getSupportedOptions()) {
          if (checkOptionName(optionName, log)) supportedOptionNames.add(optionName);
        }

      } catch (ClientCodeException e) {
        throw e;
      } catch (Throwable t) {
        throw new AnnotationProcessingError(t);
      }
    }
Example #2
0
 static Method[] getOverridableMethods(Class c) {
   ArrayList<Method> list = new ArrayList<Method>();
   HashSet<String> skip = new HashSet<String>();
   while (c != null) {
     Method[] methods = c.getDeclaredMethods();
     for (int i = 0; i < methods.length; i++) {
       String methodKey =
           methods[i].getName() + getMethodSignature(methods[i], methods[i].getParameterTypes());
       if (skip.contains(methodKey)) continue; // skip this method
       int mods = methods[i].getModifiers();
       if (Modifier.isStatic(mods)) continue;
       if (Modifier.isFinal(mods)) {
         // Make sure we don't add a final method to the list
         // of overridable methods.
         skip.add(methodKey);
         continue;
       }
       if (Modifier.isPublic(mods) || Modifier.isProtected(mods)) {
         list.add(methods[i]);
         skip.add(methodKey);
       }
     }
     c = c.getSuperclass();
   }
   return list.toArray(new Method[list.size()]);
 }
Example #3
0
 private ArrayList<Element> serializeFields(
     Field[] fields, Object object, Document doc) // serializes the fields
     {
   Class currentClass = object.getClass();
   ArrayList<Element> elements = new ArrayList<Element>();
   for (Field f : fields) {
     try {
       if (!f.getType().isPrimitive()) // Field not primitive, is a reference to another object
       {
       } else // field is primitive
       {
         Element newField = new Element("field");
         newField.setAttribute("name", f.getName());
         newField.setAttribute("declaringclass", f.getDeclaringClass().getName());
         Element newValue = new Element("value");
         newValue.addContent(f.get(object).toString());
         newField.addContent(newValue);
         elements.add(newField);
       }
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
   return elements;
 }
Example #4
0
  public List getEntries(int startIndex, int endIndex) {
    // User code starts here
    if (agentName.initTopo()) {
      ArrayList arrayList = new ArrayList();
      int noOfObj = getCount();
      String[] name = {""}; // No I18N

      for (int i = 0; i < noOfObj; i++) {
        if (name[0].trim().equals("")) // No I18N
        {
          getFirstMo(name);
        } else {
          getNextMo(name);
        }

        if ((i + 1 >= startIndex) && (i + 1 <= endIndex)) {
          Object[] indx = new Object[] {name[0]};
          arrayList.add(indx);
          if (i + 1 == endIndex) break;
        }
      }
      return arrayList;
    }

    // User code ends here
    return null;
  }
  /* Check that all descriptors have been returned */
  private static void checkDescriptors(
      ModelMBeanInfo modelMBeanInfo, Descriptor[] descriptors, String string) {
    int errCount = 0;
    final ArrayList<Descriptor> list = new ArrayList<Descriptor>(descriptors.length);
    list.addAll(Arrays.asList(descriptors));
    System.out.println("Got " + list.size() + " descriptors for " + string);

    // checks that MBean's descriptor is returned.
    //
    final Descriptor mbd = ((MBeanInfo) modelMBeanInfo).getDescriptor();
    if (!mbd.equals(remove(list, mbd))) {
      System.err.println("modelMBeanInfo.getDescriptor(): not found");
      errCount++;
    }

    // checks that MBean's attributes descriptors are returned.
    //
    final MBeanAttributeInfo[] attrs = modelMBeanInfo.getAttributes();
    for (MBeanAttributeInfo att : attrs) {
      final Descriptor ad = att.getDescriptor();
      final String name = att.getName();
      if (!ad.equals(remove(list, ad))) {
        System.err.println("attInfo.getDescriptor(): not found for " + name);
        errCount++;
      }
    }

    // checks that MBean's operations descriptors are returned.
    //
    final MBeanOperationInfo[] ops = modelMBeanInfo.getOperations();
    for (MBeanOperationInfo op : ops) {
      final Descriptor od = op.getDescriptor();
      final String name = op.getName();
      if (!od.equals(remove(list, od))) {
        System.err.println("opInfo.getDescriptor(): not found for " + name);
        errCount++;
      }
    }

    // checks that MBean's notifications descriptors are returned.
    //
    final MBeanNotificationInfo[] ntfs = modelMBeanInfo.getNotifications();
    for (MBeanNotificationInfo ntf : ntfs) {
      final Descriptor nd = ntf.getDescriptor();
      final String name = ntf.getName();
      if (!nd.equals(remove(list, nd))) {
        System.err.println("notifInfo.getDescriptor(): not found for " + name);
        errCount++;
      }
    }
    if (errCount > 0) {
      throw new RuntimeException(string + ": failed with " + errCount + " errors");
    } else if (list.size() != 0) {
      // Check that there are no additional descriptors
      //
      throw new RuntimeException(string + ": Unexpected remaining descriptors: " + list);
    } else System.out.println(string + ": PASSED");
  }
Example #6
0
  public void removePhaseListener(PhaseListener listener) {
    if (listener == null) throw new NullPointerException();

    synchronized (_phaseList) {
      _phaseList.remove(listener);
      _phaseListeners = new PhaseListener[_phaseList.size()];
      _phaseList.toArray(_phaseListeners);
    }
  }
 public Object getChild(Object parent, int index) {
   ArrayList<Field> fields = ((Variable) parent).getFields();
   Field f = (Field) fields.get(index);
   Object parentValue = ((Variable) parent).getValue();
   try {
     return new Variable(f.getType(), f.getName(), f.get(parentValue));
   } catch (IllegalAccessException e) {
     return null;
   }
 }
 private static Field[] getAllFields(Class cls) {
   ArrayList<Field> res = new ArrayList<>();
   Class c = cls;
   while (c != View.class) {
     assert Utils.check(c != null);
     res.addAll(Arrays.asList(c.getDeclaredFields()));
     c = c.getSuperclass();
   }
   return res.toArray(new Field[res.size()]);
 }
Example #9
0
  @Override
  Object decodeArray(Decoder r) throws Exception {
    ArrayList<Object> list = new ArrayList<Object>();
    r.codec.parseArray(list, componentType, r);
    Object array = Array.newInstance(r.codec.getRawClass(componentType), list.size());
    int n = 0;
    for (Object o : list) Array.set(array, n++, o);

    return array;
  }
Example #10
0
 protected Object _setValue(int index, Object value) {
   if (auxillary != null) return auxillary.setValue(index, value); // I think this is right
   try {
     if (setMethods.get(index) == null) return null;
     ((Method) (setMethods.get(index))).invoke(object, new Object[] {value});
     return getValue(index);
   } catch (Exception e) {
     e.printStackTrace();
     return null;
   }
 }
Example #11
0
 public String getDescription(int index) {
   if (auxillary != null) return auxillary.getDescription(index);
   if (index < 0 || index >= numProperties()) return null;
   try {
     if (desMethods.get(index) == null) return null;
     return (String) (((Method) (desMethods.get(index))).invoke(object, new Object[0]));
   } catch (Exception e) {
     e.printStackTrace();
     return null;
   }
 }
Example #12
0
 public Object getDomain(int index) {
   if (auxillary != null) return auxillary.getDomain(index);
   if (index < 0 || index >= numProperties()) return null;
   try {
     if (domMethods.get(index) == null) return null;
     return ((Method) (domMethods.get(index))).invoke(object, new Object[0]);
   } catch (Exception e) {
     e.printStackTrace();
     return null;
   }
 }
Example #13
0
 public boolean isHidden(int index) {
   if (auxillary != null) return auxillary.isHidden(index);
   if (index < 0 || index >= numProperties()) return false;
   try {
     if (hideMethods.get(index) == null) return false;
     return ((Boolean) ((Method) (hideMethods.get(index))).invoke(object, new Object[0]))
         .booleanValue();
   } catch (Exception e) {
     e.printStackTrace();
     return false;
   }
 }
 private Object[] fillResultWithAllParamProviderMethods(Class<?> sourceClass) {
   ArrayList<Object> result = new ArrayList<Object>();
   while (sourceClass.getSuperclass() != null) {
     result.addAll(gatherParamsFromAllMethodsFrom(sourceClass));
     sourceClass = sourceClass.getSuperclass();
   }
   if (result.isEmpty())
     throw new RuntimeException(
         "No methods starting with provide or they return no result in the parameters source class: "
             + sourceClass.getName());
   return result.toArray(new Object[] {});
 }
 public Filter createBaseFilter() {
   if (auxiliaryClasses.length == 0) {
     return Filter.createEqualityFilter("objectClass", structuralClass);
   } else {
     final ArrayList<Filter> comps = new ArrayList<Filter>(1 + auxiliaryClasses.length);
     comps.add(Filter.createEqualityFilter("objectClass", structuralClass));
     for (final String s : auxiliaryClasses) {
       comps.add(Filter.createEqualityFilter("objectClass", s));
     }
     return Filter.createANDFilter(comps);
   }
 }
Example #16
0
  // Expand grid search related argument sets
  @Override
  protected NanoHTTPD.Response serveGrid(NanoHTTPD server, Properties parms, RequestType type) {
    String[][] values = new String[_arguments.size()][];
    boolean gridSearch = false;
    for (int i = 0; i < _arguments.size(); i++) {
      Argument arg = _arguments.get(i);
      if (arg._gridable) {
        String value = _parms.getProperty(arg._name);
        if (value != null) {
          // Skips grid if argument is an array, except if imbricated expression
          // Little hackish, waiting for real language
          boolean imbricated = value.contains("(");
          if (!arg._field.getType().isArray() || imbricated) {
            values[i] = split(value);
            if (values[i] != null && values[i].length > 1) gridSearch = true;
          } else if (arg._field.getType().isArray()
              && !imbricated) { // Copy values which are arrays
            values[i] = new String[] {value};
          }
        }
      }
    }
    if (!gridSearch) return superServeGrid(server, parms, type);

    // Ignore destination key so that each job gets its own
    _parms.remove("destination_key");
    for (int i = 0; i < _arguments.size(); i++)
      if (_arguments.get(i)._name.equals("destination_key")) values[i] = null;

    // Iterate over all argument combinations
    int[] counters = new int[values.length];
    ArrayList<Job> jobs = new ArrayList<Job>();
    for (; ; ) {
      Job job = (Job) create(_parms);
      Properties combination = new Properties();
      for (int i = 0; i < values.length; i++) {
        if (values[i] != null) {
          String value = values[i][counters[i]];
          value = value.trim();
          combination.setProperty(_arguments.get(i)._name, value);
          _arguments.get(i).reset();
          _arguments.get(i).check(job, value);
        }
      }
      job._parms = combination;
      jobs.add(job);
      if (!increment(counters, values)) break;
    }
    GridSearch grid = new GridSearch();
    grid.jobs = jobs.toArray(new Job[jobs.size()]);
    return grid.superServeGrid(server, parms, type);
  }
Example #17
0
 static Method[] getOverridableMethods(Class c) {
   ArrayList list = new ArrayList();
   while (c != null) {
     Method[] methods = c.getDeclaredMethods();
     for (int i = 0; i < methods.length; i++) {
       int mods = methods[i].getModifiers();
       if (Modifier.isStatic(mods) || Modifier.isFinal(mods)) continue;
       if (Modifier.isPublic(mods) || Modifier.isProtected(mods)) list.add(methods[i]);
     }
     c = c.getSuperclass();
   }
   return (Method[]) list.toArray(new Method[list.size()]);
 }
Example #18
0
  public Document serialize(Object object, Document doc) {
    Class c = object.getClass();
    Integer id = getID(object);
    map.put(object, id);
    String mapSize = Integer.toString(map.size());

    // creating serialization objects
    Element objectElement = new Element("object");
    objectElement.setAttribute(new Attribute("class", c.getName()));
    objectElement.setAttribute(new Attribute("id", mapSize));
    doc.getRootElement().addContent(objectElement);

    if (!c.isArray()) // class is not an array
    {
      Field[] fields = c.getDeclaredFields();
      ArrayList<Element> fieldXML = serializeFields(fields, object, doc);
      for (int i = 0; i < fieldXML.size(); i++) {
        objectElement.addContent(fieldXML.get(i));
      }
    } else // class is an array
    {
      Object array = object;
      objectElement.setAttribute(new Attribute("length", Integer.toString(Array.getLength(array))));
      if (c.getComponentType().isPrimitive()) // class is array of primitives
      {
        for (int i = 0; i < Array.getLength(array); i++) {
          Element value = new Element("value");
          value.setText(Array.get(c, i).toString());
          objectElement.addContent(value);
        }
      } else // class is array of references
      {
        for (int j = 0; j < Array.getLength(array); j++) {
          Element ref = new Element("reference");
          id = getID(Array.get(c, j));
          if (id != -1) {
            ref.setText(Integer.toString(id));
          }
        }
        for (int k = 0; k < Array.getLength(array); k++) {
          serialize(Array.get(array, k), doc);
        }
      }
    }
    if (currentElement == 0) {
      referenceID = 0;
    }

    return doc;
  }
Example #19
0
  @Override
  public JapaneseTokenizer init(final byte[] txt) {
    String source = string(txt);
    if (wc) { // convert wide-space to space
      source = source.replace('\u3000', '\u0020');
    }
    final ArrayList<?> morpheme = (ArrayList<?>) Reflect.invoke(parse, tagger, source);
    final ArrayList<Morpheme> list = new ArrayList<>();
    try {
      int prev = 0;
      final int ms = morpheme.size();
      for (int i = 0; i < ms; i++) {
        final Object m = morpheme.get(i);
        final String srfc = surface.get(m).toString();
        final String ftr = feature.get(m).toString();
        final int strt = start.getInt(m);
        if (i != 0) {
          final int l = strt - prev;
          if (l != 0) {
            list.add(new Morpheme(source.substring(strt - 1, strt + l - 1), KIGOU_FEATURE));
          }
        }
        prev = srfc.length() + strt;

        // separates continuous mark (ASCII)
        boolean cont = true;
        final ArrayList<Morpheme> marks = new ArrayList<>();
        final int sl = srfc.length();
        for (int s = 0; s < sl; s++) {
          final String c = String.valueOf(srfc.charAt(s));
          final byte[] t = token(c);
          if (t.length == 1) {
            if (letter(t[0]) || digit(t[0])) cont = false;
            else marks.add(new Morpheme(c, KIGOU_FEATURE));
          } else {
            cont = false;
          }
        }

        if (cont) list.addAll(marks);
        else list.add(new Morpheme(srfc, ftr));
      }
    } catch (final Exception ex) {
      Util.errln(Util.className(this) + ": " + ex);
    }
    tokenList = list;
    tokens = list.iterator();

    return this;
  }
  String constructDN(final T o, final String parentDN, final Map<String, Attribute> attrMap)
      throws LDAPPersistException {
    final String existingDN = getEntryDN(o);
    if (existingDN != null) {
      return existingDN;
    }

    final ArrayList<String> rdnNameList = new ArrayList<String>(1);
    final ArrayList<byte[]> rdnValueList = new ArrayList<byte[]>(1);
    for (final FieldInfo i : rdnFields) {
      final Attribute a = attrMap.get(toLowerCase(i.getAttributeName()));
      if (a == null) {
        throw new LDAPPersistException(
            ERR_OBJECT_HANDLER_RDN_FIELD_MISSING_VALUE.get(type.getName(), i.getField().getName()));
      }

      rdnNameList.add(a.getName());
      rdnValueList.add(a.getValueByteArray());
    }

    for (final GetterInfo i : rdnGetters) {
      final Attribute a = attrMap.get(toLowerCase(i.getAttributeName()));
      if (a == null) {
        throw new LDAPPersistException(
            ERR_OBJECT_HANDLER_RDN_GETTER_MISSING_VALUE.get(
                type.getName(), i.getMethod().getName()));
      }

      rdnNameList.add(a.getName());
      rdnValueList.add(a.getValueByteArray());
    }

    final String[] rdnNames = new String[rdnNameList.size()];
    rdnNameList.toArray(rdnNames);

    final byte[][] rdnValues = new byte[rdnNames.length][];
    rdnValueList.toArray(rdnValues);

    final RDN rdn = new RDN(rdnNames, rdnValues);

    if (parentDN == null) {
      return new DN(rdn, defaultParentDN).toString();
    } else {
      try {
        final DN parsedParentDN = new DN(parentDN);
        return new DN(rdn, parsedParentDN).toString();
      } catch (LDAPException le) {
        debugException(le);
        throw new LDAPPersistException(
            ERR_OBJECT_HANDLER_INVALID_PARENT_DN.get(type.getName(), parentDN, le.getMessage()),
            le);
      }
    }
  }
Example #21
0
 static Method[] getOverridableMethods(Class<?> clazz) {
   ArrayList<Method> list = new ArrayList<Method>();
   HashSet<String> skip = new HashSet<String>();
   // Check superclasses before interfaces so we always choose
   // implemented methods over abstract ones, even if a subclass
   // re-implements an interface already implemented in a superclass
   // (e.g. java.util.ArrayList)
   for (Class<?> c = clazz; c != null; c = c.getSuperclass()) {
     appendOverridableMethods(c, list, skip);
   }
   for (Class<?> c = clazz; c != null; c = c.getSuperclass()) {
     for (Class<?> intf : c.getInterfaces()) appendOverridableMethods(intf, list, skip);
   }
   return list.toArray(new Method[list.size()]);
 }
 /** Execute the system command 'cmd' and fill an ArrayList with the results. */
 public static ArrayList<String> executeSystemCommand(String cmd) {
   if (debug) System.out.println("cmd: " + cmd);
   ArrayList<String> list = new ArrayList<>();
   try (BufferedReader br =
       new BufferedReader(
           new InputStreamReader(RUNTIME.exec(/*comSpec +*/ cmd).getInputStream()))) {
     for (String line = null; (line = br.readLine()) != null; ) {
       if (debug) System.out.println(line);
       list.add(line);
     }
   } catch (IOException e) {
     e.printStackTrace();
   }
   return list;
 }
Example #23
0
  /**
   * Returns the return type of the property (see the TYPE_... values) Returns -1 if the index is
   * out of the range [0 ... numProperties() - 1 ]
   */
  public Class getType(int index) {
    if (auxillary != null) return auxillary.getType(index);
    if (index < 0 || index >= numProperties()) return null;
    Class returnType = ((Method) (getMethods.get(index))).getReturnType();

    return getTypeConversion(returnType);
  }
Example #24
0
  /** Splits into */
  public static String[] split(String input, String delimiters) {
    if (input == null || input.equals("")) {
      return new String[] {""};
    }

    if (delimiters == null || delimiters.equals("")) {
      return new String[] {input};
    }

    StringTokenizer tokenizer = new StringTokenizer(input, delimiters);
    ArrayList<String> values = new ArrayList<String>();

    while (tokenizer.hasMoreTokens()) values.add(tokenizer.nextToken());

    String[] array = new String[values.size()];

    return values.toArray(array);
  }
 public JSONObject describeClass(Class<?> clazz) throws Exception {
   JSONObject desc = new JSONObject();
   desc.put("name", clazz.getName());
   if (clazz.isEnum()) {
     @SuppressWarnings("unchecked")
     Class<Enum<?>> enumClass = (Class<Enum<?>>) clazz;
     ArrayList<String> enumNames = Lists.newArrayList();
     for (Enum<?> e : enumClass.getEnumConstants()) {
       enumNames.add(e.name());
     }
     desc.put("enum", enumNames);
   }
   UI_TYPE ui_type = UI_TYPE.getEnumFor(clazz);
   if (ui_type != null) {
     desc.put("uiType", ui_type.getName());
   }
   desc.put("properties", getClassProperties(clazz, 0));
   return desc;
 }
  void decode(final T o, final Entry e) throws LDAPPersistException {
    if (superclassHandler != null) {
      superclassHandler.decode(o, e);
    }

    setDNAndEntryFields(o, e);

    final ArrayList<String> failureReasons = new ArrayList<String>(5);
    boolean successful = true;

    for (final FieldInfo i : fieldMap.values()) {
      successful &= i.decode(o, e, failureReasons);
    }

    for (final SetterInfo i : setterMap.values()) {
      successful &= i.invokeSetter(o, e, failureReasons);
    }

    Throwable cause = null;
    if (postDecodeMethod != null) {
      try {
        postDecodeMethod.invoke(o);
      } catch (final Throwable t) {
        debugException(t);

        if (t instanceof InvocationTargetException) {
          cause = ((InvocationTargetException) t).getTargetException();
        } else {
          cause = t;
        }

        successful = false;
        failureReasons.add(
            ERR_OBJECT_HANDLER_ERROR_INVOKING_POST_DECODE_METHOD.get(
                postDecodeMethod.getName(), type.getName(), getExceptionMessage(t)));
      }
    }

    if (!successful) {
      throw new LDAPPersistException(concatenateStrings(failureReasons), o, cause);
    }
  }
 private ArrayList<Object> gatherParamsFromAllMethodsFrom(Class<?> sourceClass) {
   ArrayList<Object> result = new ArrayList<Object>();
   Method[] methods = sourceClass.getDeclaredMethods();
   for (Method method : methods) {
     if (method.getName().startsWith("provide")) {
       if (!Modifier.isStatic(method.getModifiers()))
         throw new RuntimeException(
             "Parameters source method "
                 + method.getName()
                 + " is not declared as static. Modify it to a static method.");
       try {
         result.addAll(Arrays.asList(processParamsIfSingle((Object[]) method.invoke(null))));
       } catch (Exception e) {
         throw new RuntimeException(
             "Cannot invoke parameters source method: " + method.getName(), e);
       }
     }
   }
   return result;
 }
Example #28
0
 /**
  * Creates any missing folders in the specified path.
  *
  * @param path the path to construct
  */
 public static void createFolders(String path) {
   // work way up path to find existing folder
   File dir = new File(path);
   ArrayList dirs = new ArrayList(); // list of needed directories
   while (!dir.exists()) {
     dirs.add(0, dir);
     int j = path.lastIndexOf("/"); // $NON-NLS-1$
     if (j == -1) {
       break;
     }
     path = path.substring(0, j);
     dir = new File(path);
   }
   // work back down path and create needed directories
   Iterator it = dirs.iterator();
   while (it.hasNext()) {
     dir = (File) it.next();
     dir.mkdir();
   }
 }
  /**
   * 描画用オブジェクト情報を作成する
   *
   * @param mqoMats MQOファイルから読み込んだマテリアル情報配列
   * @param mqoObjs MQOファイルのオブジェクト情報
   * @return 描画用オブジェクト情報
   */
  private GLObject makeObjs(GL10 gl, material mqoMats[], objects mqoObjs) {
    GLObject ret = null;
    ArrayList<GLMaterial> mats = new ArrayList<GLMaterial>();
    GLMaterial mr;
    KGLPoint[] vn = null;
    vn = vNormal(mqoObjs);
    for (int m = 0; m < mqoMats.length; m++) {
      mr = makeMats(gl, mqoMats[m], m, mqoObjs, vn);
      if (mr != null) {
        mats.add(mr);
      }
    }
    if (mats.size() == 0) return null;
    ret = new GLObject();
    ret.name = mqoObjs.name;
    ret.mat = mats.toArray(new GLMaterial[0]);
    ret.isVisible = (mqoObjs.data.visible != 0);

    return ret;
  }
 protected synchronized Message receiveMessage() throws IOException {
   if (messageBuffer.size() > 0) {
     Message m = (Message) messageBuffer.get(0);
     messageBuffer.remove(0);
     return m;
   }
   try {
     InetSocketAddress remoteAddress = (InetSocketAddress) channel.receive(receiveBuffer);
     if (remoteAddress != null) {
       int len = receiveBuffer.position();
       receiveBuffer.rewind();
       receiveBuffer.get(buf, 0, len);
       try {
         IP address = IP.fromInetAddress(remoteAddress.getAddress());
         int port = remoteAddress.getPort();
         extractor.appendData(buf, 0, len, new SocketDescriptor(address, port));
         receiveBuffer.clear();
         extractor.updateAvailableMessages();
         return extractor.nextMessage();
       } catch (EOFException exc) {
         exc.printStackTrace();
         System.err.println(buf.length + ", " + len);
       } catch (InvocationTargetException exc) {
         exc.printStackTrace();
       } catch (IllegalAccessException exc) {
         exc.printStackTrace();
       } catch (InstantiationException exc) {
         exc.printStackTrace();
       } catch (IllegalArgumentException e) {
         e.printStackTrace();
       } catch (InvalidCompressionMethodException e) {
         e.printStackTrace();
       }
     }
   } catch (ClosedChannelException exc) {
     if (isKeepAlive()) {
       throw exc;
     }
   }
   return null;
 }