Changeset a3e146a8 for core


Ignore:
Timestamp:
Apr 9, 2017 6:52:22 AM (3 years ago)
Author:
str4d <str4d@…>
Branches:
master
Children:
f541dbe
Parents:
fa6fc84 (diff), dd8f763 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

propagate from branch 'i2p.i2p' (head 5d56a7eb371dddb9336e596bda69f99c91294b05)

to branch 'i2p.i2p.str4d.ui' (head 3aeafcdb5c0ffbc9c77f574558f8438d3e81133e)

Location:
core/java/src
Files:
1 added
18 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/freenet/support/CPUInformation/AMDInfoImpl.java

    rfa6fc84 ra3e146a8  
    454454          }
    455455          break;
     456
     457        //Ryzen 7 (model 1), Ryzen 5 TBD
     458        // untested
     459          case 23: {
     460            // Quote wikipedia:
     461            // Zen is a clean sheet design that differs from the long-standing Bulldozer architecture.
     462            // All models support: x87, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AES, CLMUL,
     463            // AVX, AVX2, FMA, CVT16/F16C, ABM, BMI1, BMI2, SHA.
     464            isK6Compatible = true;
     465            isK6_2_Compatible = true;
     466            isK6_3_Compatible = true;
     467            isAthlonCompatible = true;
     468            isAthlon64Compatible = true;
     469            // Pending testing of the bulldozer jbigi
     470            //isPiledriverCompatible = true;
     471            //isSteamrollerCompatible = true;
     472            //isExcavatorCompatible = true;
     473            //isBulldozerCompatible = true;
     474            if (model == 1)
     475               modelString = "Ryzen 7";
     476            else
     477               modelString = "Ryzen model " + model;
     478          }
     479          break;
    456480        }
    457481        return modelString;
  • core/java/src/freenet/support/CPUInformation/CPUID.java

    rfa6fc84 ra3e146a8  
    5252                                    I2PAppContext.getGlobalContext().isRouterContext();
    5353
    54     private static final boolean isX86 = System.getProperty("os.arch").contains("86") ||
    55                                          System.getProperty("os.arch").equals("amd64");
     54    private static final boolean isX86 = SystemVersion.isX86();
    5655    private static final boolean isWindows = SystemVersion.isWindows();
    57     private static final String libPrefix = isWindows ? "" : "lib";
    58     private static final String libSuffix = isWindows ? ".dll" : ".so";
    5956    private static final boolean isLinux = System.getProperty("os.name").toLowerCase(Locale.US).contains("linux");
    6057    private static final boolean isKFreebsd = System.getProperty("os.name").toLowerCase(Locale.US).contains("kfreebsd");
     
    305302    public static CPUInfo getInfo() throws UnknownCPUException
    306303    {
    307         if(!_nativeOk)
    308             throw new UnknownCPUException("Failed to read CPU information from the system. Please verify the existence of the jcpuid dll/so.");
     304        if(!_nativeOk) {
     305            throw new UnknownCPUException("Failed to read CPU information from the system. Please verify the existence of the " +
     306                                          getLibraryPrefix() + "jcpuid " + getLibrarySuffix() + " file.");
     307        }
    309308        String id = getCPUVendorID();
    310309        if(id.equals("CentaurHauls"))
    311310            return new VIAInfoImpl();
    312311        if(!isX86)
    313             throw new UnknownCPUException("Failed to read CPU information from the system. The CPUID instruction exists on x86 CPU's only");
     312            throw new UnknownCPUException("Failed to read CPU information from the system. The CPUID instruction exists on x86 CPUs only.");
    314313        if(id.equals("AuthenticAMD"))
    315314            return new AMDInfoImpl();
     
    322321    public static void main(String args[])
    323322    {
    324         _doLog = true;
    325         if(!_nativeOk){
    326             System.out.println("**Failed to retrieve CPUInfo. Please verify the existence of jcpuid dll/so**");
     323        _doLog = true; // this is too late to log anything from above
     324        String path = System.getProperty("java.library.path");
     325        String name = getLibraryPrefix() + "jcpuid" + getLibrarySuffix();
     326        System.out.println("Native library search path: " + path);
     327        if (_nativeOk) {
     328            String sep = System.getProperty("path.separator");
     329            String[] paths = DataHelper.split(path, sep);
     330            for (String p : paths) {
     331                File f = new File(p, name);
     332                if (f.exists()) {
     333                    System.out.println("Found native library: " + f);
     334                    break;
     335                }
     336            }
     337        } else {
     338            System.out.println("Failed to retrieve CPUInfo. Please verify the existence of the " +
     339                               name + " file in the library path, or set -Djava.library.path=. in the command line");
    327340        }
    328341        System.out.println("JCPUID Version: " + _jcpuidVersion);
     
    499512     */
    500513    private static final boolean loadFromResource() {
     514        // Mac info:
     515        // Through 0.9.25, we had a libjcpuid-x86_64-osx.jnilib and a libjcpuid-x86-osx.jnilib file.
     516        // As of 0.9.26, we have a single libjcpuid-x86_64-osx.jnilib fat binary that has both 64- and 32-bit support.
     517        // For updates, the 0.9.27 update contained the new jbigi.jar.
     518        // However, in rare cases, a user may have skipped that update, going straight
     519        // from 0.9.26 to 0.9.28. Since we can't be sure, always try both for Mac.
     520        // getResourceName64() returns non-null for 64-bit OR for 32-bit Mac.
     521
    501522        // try 64 bit first, if getResourceName64() returns non-null
    502523        String resourceName = getResourceName64();
     
    505526            if (success)
    506527                return true;
     528            if (_doLog)
     529                System.err.println("WARNING: Resource name [" + resourceName + "] was not found");
    507530        }
    508531
     
    512535        if (success)
    513536            return true;
    514 
    515537        if (_doLog)
    516538            System.err.println("WARNING: Resource name [" + resourceName + "] was not found");
     
    532554        File outFile = null;
    533555        FileOutputStream fos = null;
    534         String filename = libPrefix + "jcpuid" + libSuffix;
     556        String filename = getLibraryPrefix() + "jcpuid" + getLibrarySuffix();
    535557        try {
    536558            InputStream libStream = resource.openStream();
     
    572594    private static final String getResourceName()
    573595    {
    574         return getLibraryPrefix()+getLibraryMiddlePart()+"."+getLibrarySuffix();
    575     }
    576 
    577     /**
    578      * @return null if not on a 64 bit platform
     596        return getLibraryPrefix() + getLibraryMiddlePart() + getLibrarySuffix();
     597    }
     598
     599    /**
     600     * @return null if not on a 64 bit platform (except Mac)
    579601     * @since 0.8.7
    580602     */
    581603    private static final String getResourceName64() {
    582         if (!is64)
     604        // As of GMP 6,
     605        // libjcpuid-x86_64-osx.jnilib file is a fat binary that contains both 64- and 32-bit binaries
     606        // See loadFromResource() for more info.
     607        if (!is64 && !isMac)
    583608            return null;
    584         return getLibraryPrefix() + get64LibraryMiddlePart() + "." + getLibrarySuffix();
     609        return getLibraryPrefix() + get64LibraryMiddlePart() + getLibrarySuffix();
    585610    }
    586611
     
    598623        if(isMac) {
    599624            if(isX86) {
    600                 return "jcpuid-x86-osx";  // The convention on Intel Macs
     625                // As of GMP6,
     626                // our libjcpuid-x86_64.osx.jnilib is a fat binary,
     627                // with the 32-bit lib in it also.
     628                // Not sure if that was on purpose...
     629                return "jcpuid-x86_64-osx";  // The convention on Intel Macs
    601630            }
     631            // this will fail, we don't have any ppc libs, but we can't return null here.
     632            return "jcpuid-ppc-osx";
    602633        }
    603634        if(isKFreebsd)
     
    632663                return "jcpuid-x86_64-osx";
    633664            }
     665            // this will fail, we don't have any ppc libs, but we can't return null here.
     666            return "jcpuid-ppc_64-osx";
    634667        }
    635668        if(isSunos)
     
    642675    {
    643676        if(isWindows)
    644             return "dll";
     677            return ".dll";
    645678        if(isMac)
    646             return "jnilib";
     679            return ".jnilib";
    647680        else
    648             return "so";
     681            return ".so";
    649682    }
    650683}
  • core/java/src/net/i2p/I2PAppContext.java

    rfa6fc84 ra3e146a8  
    99
    1010import net.i2p.app.ClientAppManager;
     11import net.i2p.app.ClientAppManagerImpl;
    1112import net.i2p.client.naming.NamingService;
    1213import net.i2p.crypto.AESEngine;
     
    117118    private volatile File _tmpDir;
    118119    private final Random _tmpDirRand = new Random();
     120    private final ClientAppManager _appManager;
    119121    // split up big lock on this to avoid deadlocks
    120122    private final Object _lock1 = new Object(), _lock2 = new Object(), _lock3 = new Object(), _lock4 = new Object(),
     
    199201        _shutdownTasks = new ConcurrentHashSet<Runnable>(32);
    200202        _portMapper = new PortMapper(this);
     203        _appManager = isRouterContext() ? null : new ClientAppManagerImpl(this);
    201204   
    202205   /*
     
    10081011
    10091012    /**
    1010      *  The RouterAppManager in RouterContext, null always in I2PAppContext
    1011      *  @return null always
     1013     *  As of 0.9.30, returns non-null in I2PAppContext, null in RouterContext.
     1014     *  Prior to that, returned null always.
     1015     *  Overridden in RouterContext to return the RouterAppManager.
     1016     *
     1017     *  @return As of 0.9.30, returns non-null in I2PAppContext, null in RouterContext
    10121018     *  @since 0.9.11, in RouterContext since 0.9.4
    10131019     */
    10141020    public ClientAppManager clientAppManager() {
    1015         return null;
     1021        return _appManager;
    10161022    }
    10171023}
  • core/java/src/net/i2p/client/I2PSession.java

    rfa6fc84 ra3e146a8  
    273273
    274274    /**
    275      * Actually connect the session and start receiving/sending messages
    276      *
     275     * Actually connect the session and start receiving/sending messages.
     276     * Connecting a primary session will not automatically connect subsessions.
     277     * Connecting a subsession will automatically connect the primary session
     278     * if not previously connected.
    277279     */
    278280    public void connect() throws I2PSessionException;
  • core/java/src/net/i2p/client/impl/I2PSessionImpl.java

    rfa6fc84 ra3e146a8  
    548548     * Disconnect / destroy from another thread may be called simultaneously and
    549549     * will (should?) interrupt the connect.
     550     *
     551     * Connecting a primary session will not automatically connect subsessions.
     552     * Connecting a subsession will automatically connect the primary session
     553     * if not previously connected.
    550554     *
    551555     * @throws I2PSessionException if there is a configuration error or the router is
  • core/java/src/net/i2p/client/impl/SubSession.java

    rfa6fc84 ra3e146a8  
    9393     * Disconnect / destroy from another thread may be called simultaneously and
    9494     * will (should?) interrupt the connect.
     95     *
     96     * Connecting a subsession will automatically connect the primary session
     97     * if not previously connected.
    9598     *
    9699     * @throws I2PSessionException if there is a configuration error or the router is
  • core/java/src/net/i2p/client/naming/BlockfileNamingService.java

    rfa6fc84 ra3e146a8  
    1616import java.io.InputStreamReader;
    1717import java.io.IOException;
     18import java.io.Writer;
    1819import java.util.ArrayList;
    1920import java.util.Collections;
     
    419420            // support multiple destinations per hostname
    420421            if (VersionComparator.comp(_version, "4") < 0) {
    421                 // Upgrade of 4K entry DB on RPi 2 is over 2 1/2 minutes, disable for now
    422                 if (SystemVersion.isAndroid() || SystemVersion.isARM()) {
     422                // Upgrade of 4K entry DB on RPi 2 is over 2 1/2 minutes, probably worse on Android, disable for now
     423                if (SystemVersion.isAndroid()) {
    423424                    if (_log.shouldWarn())
    424                         _log.warn("Deferring upgrade to version 4 on Android/ARM");
     425                        _log.warn("Deferring upgrade to version 4 on Android");
    425426                    return true;
    426427                }
     
    12861287                _log.error("DB lookup error", re);
    12871288                return Collections.emptyMap();
     1289            } finally {
     1290                deleteInvalid();
     1291            }
     1292        }
     1293    }
     1294
     1295    /**
     1296     *  Export in a hosts.txt format.
     1297     *  Output is sorted.
     1298     *  Caller must close writer.
     1299     *
     1300     *  @param options If non-null and contains the key "list", get
     1301     *                from that list (default "hosts.txt", NOT all lists)
     1302     *                Key "search": return only those matching substring
     1303     *                Key "startsWith": return only those starting with
     1304     *                                  ("[0-9]" allowed)
     1305     *                Key "beginWith": start here in the iteration
     1306     *  @since 0.9.30 override NamingService to add stored authentication strings
     1307     */
     1308    @Override
     1309    public void export(Writer out, Properties options) throws IOException {
     1310        String listname = FALLBACK_LIST;
     1311        String search = null;
     1312        String startsWith = null;
     1313        String beginWith = null;
     1314        if (options != null) {
     1315            String ln = options.getProperty("list");
     1316            if (ln != null)
     1317                listname = ln;
     1318            search = options.getProperty("search");
     1319            startsWith = options.getProperty("startsWith");
     1320            beginWith = options.getProperty("beginWith");
     1321            if (beginWith == null && startsWith != null) {
     1322                if (startsWith.equals("[0-9]"))
     1323                    beginWith = "0";
     1324                else
     1325                    beginWith = startsWith;
     1326            }
     1327        }
     1328        out.write("# Address book: ");
     1329        out.write(getName());
     1330        out.write(" (" + listname + ')');
     1331        final String nl = System.getProperty("line.separator", "\n");
     1332        out.write(nl);
     1333        out.write("# Exported: ");
     1334        out.write((new Date()).toString());
     1335        out.write(nl);
     1336        synchronized(_bf) {
     1337            if (_isClosed)
     1338                return;
     1339            try {
     1340                SkipList<String, DestEntry> sl = _bf.getIndex(listname, _stringSerializer, _destSerializer);
     1341                if (sl == null) {
     1342                    if (_log.shouldLog(Log.WARN))
     1343                        _log.warn("No skiplist found for lookup in " + listname);
     1344                    return;
     1345                }
     1346                if (beginWith == null && search == null) {
     1347                    int sz = sl.size();
     1348                    if (sz <= 0) {
     1349                        out.write("# No entries");
     1350                        out.write(nl);
     1351                        return;
     1352                    }
     1353                    if (sz > 1) {
     1354                        // actually not right due to multidest
     1355                        out.write("# " + sz + " entries");
     1356                        out.write(nl);
     1357                    }
     1358                }
     1359                SkipIterator<String, DestEntry> iter;
     1360                if (beginWith != null)
     1361                    iter = sl.find(beginWith);
     1362                else
     1363                    iter = sl.iterator();
     1364                int cnt = 0;
     1365                while (iter.hasNext()) {
     1366                    String key = iter.nextKey();
     1367                    if (startsWith != null) {
     1368                        if (startsWith.equals("[0-9]")) {
     1369                            if (key.charAt(0) > '9')
     1370                                break;
     1371                        } else if (!key.startsWith(startsWith)) {
     1372                            break;
     1373                        }
     1374                    }
     1375                    DestEntry de = iter.next();
     1376                    if (!validate(key, de, listname))
     1377                        continue;
     1378                    if (search != null && key.indexOf(search) < 0)
     1379                        continue;
     1380                    int dsz = de.destList != null ? de.destList.size() : 1;
     1381                    // new non-DSA dest is put first, so put in reverse
     1382                    // order so importers will see the older dest first
     1383                    for (int i = dsz - 1; i >= 0; i--) {
     1384                        Properties p;
     1385                        Destination d;
     1386                        if (i == 0) {
     1387                            p = de.props;
     1388                            d = de.dest;
     1389                        } else {
     1390                            p = de.propsList.get(i);
     1391                            d = de.destList.get(i);
     1392                        }
     1393                        out.write(key);
     1394                        out.write('=');
     1395                        out.write(d.toBase64());
     1396                        if (p != null)
     1397                            SingleFileNamingService.writeOptions(p, out);
     1398                        out.write(nl);
     1399                        cnt++;
     1400                    }
     1401                }
     1402                if (beginWith != null || search != null) {
     1403                    if (cnt <= 0) {
     1404                        out.write("# No entries");
     1405                        out.write(nl);
     1406                        return;
     1407                    }
     1408                    if (cnt > 1) {
     1409                        out.write("# " + cnt + " entries");
     1410                        out.write(nl);
     1411                    }
     1412                }
     1413            } catch (RuntimeException re) {
     1414                throw new IOException("DB lookup error", re);
    12881415            } finally {
    12891416                deleteInvalid();
     
    15791706                    storedOptions.remove(i);
    15801707                    removeReverseEntry(hostname, d);
     1708                    if (options != null) {
     1709                        String list = options.getProperty("list");
     1710                        if (list != null)
     1711                            storedOptions.get(0).setProperty("list", list);
     1712                    }
    15811713                    return put(hostname, newDests, storedOptions, false);
    15821714                }
  • core/java/src/net/i2p/client/naming/SingleFileNamingService.java

    rfa6fc84 ra3e146a8  
    269269     *
    270270     *  @param options non-null
    271      *  @since 0.9.26
    272      */
    273     private static void writeOptions(Properties options, Writer out) throws IOException {
     271     *  @since 0.9.26, package private since 0.9.30
     272     */
     273    static void writeOptions(Properties options, Writer out) throws IOException {
    274274        boolean started = false;
    275275        for (Map.Entry<Object, Object> e : options.entrySet()) {
  • core/java/src/net/i2p/crypto/KeyGenerator.java

    rfa6fc84 ra3e146a8  
    117117    /** @since 0.9.8 */
    118118    private static final boolean DEFAULT_USE_LONG_EXPONENT =
    119                                                    NativeBigInteger.isNative() &&
    120                                                    SystemVersion.is64Bit() &&
    121                                                    !SystemVersion.isGNU() &&
    122                                                    !SystemVersion.isApache() &&
    123                                                    !SystemVersion.isARM();
     119                                                   !SystemVersion.isSlow();
    124120
    125121    /**
  • core/java/src/net/i2p/crypto/KeyStoreUtil.java

    rfa6fc84 ra3e146a8  
    423423            String s = "Rejecting expired X509 Certificate: " + file.getAbsolutePath();
    424424            // Android often has old system certs
    425             if (SystemVersion.isAndroid())
     425            // our SSL certs may be old also
     426            //if (SystemVersion.isAndroid())
    426427                warn(s, cee);
    427             else
    428                 error(s, cee);
     428            //else
     429            //    error(s, cee);
    429430            return false;
    430431        } catch (CertificateNotYetValidException cnyve) {
  • core/java/src/net/i2p/crypto/TrustedUpdate.java

    rfa6fc84 ra3e146a8  
    2424import net.i2p.util.SecureFileOutputStream;
    2525import net.i2p.util.VersionComparator;
    26 import net.i2p.util.ZipFileComment;
     26//import net.i2p.util.ZipFileComment;
    2727
    2828/**
     
    612612     * @since 0.8.8
    613613     */
     614    @SuppressWarnings("deprecation")
    614615    private boolean verifyVersionMatch(File signedFile) {
    615616        try {
    616              String zipComment = ZipFileComment.getComment(signedFile, VERSION_BYTES, HEADER_BYTES);
     617             String zipComment = net.i2p.util.ZipFileComment.getComment(signedFile, VERSION_BYTES, HEADER_BYTES);
    617618             return zipComment.equals(_newVersion);
    618619        } catch (IOException ioe) {}
  • core/java/src/net/i2p/data/DataHelper.java

    rfa6fc84 ra3e146a8  
    4747import net.i2p.util.ReusableGZIPOutputStream;
    4848import net.i2p.util.SecureFileOutputStream;
     49import net.i2p.util.SystemVersion;
    4950import net.i2p.util.Translate;
    5051
     
    5556 */
    5657public class DataHelper {
     58
     59    /** See storeProps(). 600-750 ms on RPi. */
     60    private static final boolean SHOULD_SYNC = !(SystemVersion.isAndroid() || SystemVersion.isARM());
    5761
    5862    /**
     
    6973            // SSU RouterAddress options
    7074            "key", "mtu",
    71             "ihost0", "iport0", "ikey0", "itag0",
    72             "ihost1", "iport1", "ikey1", "itag1",
    73             "ihost2", "iport2", "ikey2", "itag2",
     75            "ihost0", "iport0", "ikey0", "itag0", "iexp0",
     76            "ihost1", "iport1", "ikey1", "itag1", "iexp1",
     77            "ihost2", "iport2", "ikey2", "itag2", "iexp2",
    7478            // RouterInfo options
    7579            "caps", "coreVersion", "netId", "router.version",
     
    515519                out.println(name + "=" + val);
    516520            }
    517             out.flush();
    518             fos.getFD().sync();
     521            if (SHOULD_SYNC) {
     522                out.flush();
     523                fos.getFD().sync();
     524            }
    519525            out.close();
    520526            if (out.checkError()) {
  • core/java/src/net/i2p/time/BuildTime.java

    rfa6fc84 ra3e146a8  
    3535    private static final long YEARS_25 = 25L*365*24*60*60*1000;
    3636    /** update this periodically */
    37     private static final String EARLIEST = "2016-02-19 12:00:00 UTC";
     37    private static final String EARLIEST = "2017-03-27 12:00:00 UTC";
     38    // fallback if parse fails ticket #1976
     39    // date -d 201x-xx-xx +%s
     40    private static final long EARLIEST_LONG = 1490587200 * 1000L;
    3841
    3942    static {
     
    4649            Date date = fmt.parse(EARLIEST);
    4750            if (date == null)
    48                 throw new RuntimeException("BuildTime FAIL");
    49             min = date.getTime();
     51                min = EARLIEST_LONG;
     52            else
     53                min = date.getTime();
    5054        } catch (ParseException pe) {
    5155            System.out.println("BuildTime FAIL");
    52             pe.printStackTrace();
    53             throw new RuntimeException("BuildTime FAIL", pe);
     56            // Old Android, ticket #1976
     57            //pe.printStackTrace();
     58            //throw new RuntimeException("BuildTime FAIL", pe);
     59            min = EARLIEST_LONG;
    5460        }
    5561        long max = min + YEARS_25;
  • core/java/src/net/i2p/util/ByteCache.java

    rfa6fc84 ra3e146a8  
    8888            cache = new ByteCache(cacheSize, size);
    8989            _caches.put(sz, cache);
    90 ;       }
     90        }
    9191        cache.resize(cacheSize);
    9292        //I2PAppContext.getGlobalContext().logManager().getLog(ByteCache.class).error("ByteCache size: " + size + " max: " + cacheSize, new Exception("from"));
  • core/java/src/net/i2p/util/FortunaRandomSource.java

    rfa6fc84 ra3e146a8  
    109109        // get at least 4 extra bits if possible for better
    110110        // distribution after the %
     111        // No extra needed if power of two.
    111112        int numBits;
    112         if (n > 0xfffff)
     113        if (n > 0x100000)
    113114            numBits = 31;
    114         else if (n > 0xfff)
     115        else if (n > 0x1000)
    115116            numBits = 24;
    116         else if (n > 0xf)
     117        else if (n > 0x10)
    117118            numBits = 16;
    118119        else
  • core/java/src/net/i2p/util/NativeBigInteger.java

    rfa6fc84 ra3e146a8  
    210210     * outweigh the implementation time.
    211211     */
     212
     213    // none -> {"none"), since 0.9.30
     214    private final static String[] JBIGI_COMPAT_LIST_NONE          = {JBIGI_OPTIMIZATION_X86};
    212215    private final static String[] JBIGI_COMPAT_LIST_PPC           = {JBIGI_OPTIMIZATION_PPC};
    213216    private final static String[] JBIGI_COMPAT_LIST_ARM           = {JBIGI_OPTIMIZATION_ARM_CORTEX_A15, JBIGI_OPTIMIZATION_ARM_CORTEX_A9, JBIGI_OPTIMIZATION_ARM_CORTEX_A8,
     
    232235                                                                     JBIGI_OPTIMIZATION_COREI, JBIGI_OPTIMIZATION_CORE2, JBIGI_OPTIMIZATION_PENTIUMM,
    233236                                                                     JBIGI_OPTIMIZATION_PENTIUM3, JBIGI_OPTIMIZATION_X86};
     237
    234238    /**
    235239     * The mapping between CPU architecture and its compatibility list.
     
    237241    @SuppressWarnings("serial")
    238242    private final static HashMap<String, String[]> JBIGI_COMPAT_MAP = new HashMap<String, String[]>() {{
     243        // none -> {"none"), since 0.9.30
     244        put(JBIGI_OPTIMIZATION_X86, JBIGI_COMPAT_LIST_NONE);
    239245        put(JBIGI_OPTIMIZATION_PPC, JBIGI_COMPAT_LIST_PPC);
    240246
     
    407413                        return JBIGI_OPTIMIZATION_PENTIUM;
    408414                }
    409                 return null;
    410415            } catch (UnknownCPUException e) {
    411                 return null;
    412             }
     416            }
     417            // always try "none" if we don't know the x86 type,
     418            // in case of CPUID fail or not finding compatibility above
     419            return JBIGI_OPTIMIZATION_X86;
    413420        } else if (_isArm) {
    414421            if (_isWin)
     
    740747    public static void main(String args[]) {
    741748        _doLog = true;
     749        String path = System.getProperty("java.library.path");
     750        String name = _libPrefix + "jbigi" + _libSuffix;
     751        System.out.println("Native library search path: " + path);
     752        if (_nativeOk) {
     753            String sep = System.getProperty("path.separator");
     754            String[] paths = DataHelper.split(path, sep);
     755            for (String p : paths) {
     756                File f = new File(p, name);
     757                if (f.exists()) {
     758                    System.out.println("Found native library: " + f);
     759                    break;
     760                }
     761            }
     762        } else {
     763            System.out.println("Failed to load native library. Please verify the existence of the " +
     764                               name + " file in the library path, or set -Djava.library.path=. in the command line");
     765        }
    742766        boolean nativeOnly = args.length > 0 && args[0].equals("-n");
    743767        if (nativeOnly && !_nativeOk) {
    744             System.out.println("Failed to load native library");
    745768            System.exit(1);
    746769        }
     
    960983                    debug("loadResource list to try is: " + toTry);
    961984                    for (String s : toTry) {
    962                         System.out.println("trying to load resource: " + s);
     985                        debug("Trying to load resource " + s);
    963986                        if (loadFromResource(s)) {
    964987                            _nativeOk = true;
     
    10931116        URL resource = ClassLoader.getSystemResource(resourceName);
    10941117        if (resource == null) {
    1095             System.out.println("Resource name [" + resourceName + "] was not found");
     1118            info("Resource name [" + resourceName + "] was not found");
    10961119            return false;
    10971120        }
     
    11081131            fos = null;
    11091132            System.load(outFile.getAbsolutePath()); //System.load requires an absolute path to the lib
    1110             System.out.println("Loaded library: " + resource);
     1133            info("Loaded library: " + resource);
    11111134        } catch (UnsatisfiedLinkError ule) {
    11121135            // don't include the exception in the message - too much
    1113             System.out.println("Failed to load the resource " + resourceName + " - not a valid library for this platform");
     1136            warn("Failed to load the resource " + resourceName + " - not a valid library for this platform");
    11141137            if (outFile != null)
    11151138                outFile.delete();
    11161139            return false;
    11171140        } catch (IOException ioe) {
    1118             System.out.println("Problem writing out the temporary native library data: " + ioe.toString());
     1141            warn("Problem writing out the temporary native library data: " + ioe);
    11191142            if (outFile != null)
    11201143                outFile.delete();
     
    11421165        List<String> rv = new ArrayList<String>(20);
    11431166        String primary = getMiddleName2(true);
     1167        // primary may be null
    11441168        String[] compatList = JBIGI_COMPAT_MAP.get(primary);
    11451169
     
    12231247     *  @return may be null if optimized is true; returns jbigi-xxx-none if optimize is false
    12241248     */
     1249/****
    12251250    private static final String getMiddleName(boolean optimized) {
    12261251        String m2 = getMiddleName2(optimized);
     
    12291254        return getMiddleName1() + m2;
    12301255    }
     1256****/
    12311257
    12321258    /**
  • core/java/src/net/i2p/util/SystemVersion.java

    rfa6fc84 ra3e146a8  
    4040    private static final boolean _hasWrapper = System.getProperty("wrapper.version") != null;
    4141    private static final boolean _isLinuxService;
     42    private static final boolean _isSlow;
    4243
    4344    private static final boolean _oneDotSix;
     
    7071                          (DAEMON_USER.equals(System.getProperty("user.name")) ||
    7172                           (_isGentoo && GENTOO_USER.equals(System.getProperty("user.name"))));
     73        _isSlow = _isAndroid || _isApache || _isArm || _isGNU || getMaxMemory() < 48*1024*1024L;
    7274
    7375        int sdk = 0;
     
    155157
    156158    /**
     159     *  Our best guess on whether this is a slow architecture / OS / JVM,
     160     *  using some simple heuristics.
     161     *
     162     *  @since 0.9.30
     163     */
     164    public static boolean isSlow() {
     165        // we don't put the NBI call in the static field,
     166        // to prevent a circular initialization with NBI.
     167        return _isSlow || !NativeBigInteger.isNative();
     168    }
     169
     170    /**
    157171     *  Better than (new VersionComparator()).compare(System.getProperty("java.version"), "1.6") &gt;= 0
    158172     *  as it handles Android also, where java.version = "0".
     
    291305        System.out.println("Mac      : " + isMac());
    292306        System.out.println("OpenJDK  : " + isOpenJDK());
     307        System.out.println("Slow     : " + isSlow());
    293308        System.out.println("Windows  : " + isWindows());
    294309        System.out.println("Wrapper  : " + hasWrapper());
  • core/java/src/net/i2p/util/ZipFileComment.java

    rfa6fc84 ra3e146a8  
    2020 * Beerware.
    2121 *
    22  * since 0.8.8
     22 * @deprecated scheduled for removal late 2017, not for external use
     23 * @since 0.8.8
    2324 */
     25@Deprecated
    2426public abstract class ZipFileComment {
    2527
Note: See TracChangeset for help on using the changeset viewer.