Changeset dc6ab70


Ignore:
Timestamp:
Oct 31, 2017 8:24:34 AM (3 years ago)
Author:
str4d <str4d@…>
Branches:
master
Children:
73ab3e8, db17aa0
Parents:
670e56d
Message:

I2PSnark: Use reflection to access ConfigUIHelper in standalone build

This fixes a "Class not found" error in some build systems

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java

    r670e56d rdc6ab70  
    55import java.io.PrintWriter;
    66import java.io.Serializable;
     7import java.lang.reflect.InvocationTargetException;
     8import java.lang.reflect.Method;
    79import java.text.DecimalFormat;
    810import java.text.SimpleDateFormat;
     
    2729
    2830import net.i2p.CoreVersion;
     31import net.i2p.I2PAppContext;
    2932import net.i2p.data.Base32;
    3033import net.i2p.data.Base64;
     
    4952import org.klomp.snark.comments.Comment;
    5053import org.klomp.snark.comments.CommentSet;
    51 import org.klomp.snark.standalone.ConfigUIHelper;
    5254
    5355/**
     
    23452347        if (!_context.isRouterContext()) {
    23462348            try {
     2349                // class only in standalone builds
     2350                Class helper = Class.forName("org.klomp.snark.standalone.ConfigUIHelper");
     2351                Method getLangSettings = helper.getMethod("getLangSettings", I2PAppContext.class);
     2352                String langSettings = (String) getLangSettings.invoke(null, _context);
     2353                // If we get to here, we have the language settings
    23472354                out.write("<tr><td>");
    23482355                out.write(_t("Language"));
    23492356                out.write(": <td colspan=\"2\">");
    2350                 // class only in standalone builds
    2351                 out.write(ConfigUIHelper.getLangSettings(_context));
    2352             } catch (Throwable t) {}
     2357                out.write(langSettings);
     2358            } catch (ClassNotFoundException e) {
     2359            } catch (NoSuchMethodException e) {
     2360            } catch (IllegalAccessException e) {
     2361            } catch (InvocationTargetException e) {
     2362            }
    23532363        }
    23542364
  • history.txt

    r670e56d rdc6ab70  
     12017-10-31 str4d
     2 * I2PSnark: Use reflection to access ConfigUIHelper in standalone build
     3
    142017-10-25 str4d
    25 * Console:
Note: See TracChangeset for help on using the changeset viewer.