{"record":{"id":"e97a3e4748feb31e","repo":"pinpoint-apm/pinpoint","slug":"illegal-load-loadfactor","errorCode":null,"errorMessage":"Illegal Load: +loadFactor","messagePattern":"Illegal Load: \\+loadFactor","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"commons/src/main/java/com/navercorp/pinpoint/common/util/apache/IntHashMap.java","lineNumber":126,"sourceCode":"        this(initialCapacity, 0.75f);\n    }\n\n    /**\n     * <p>Constructs a new, empty hashtable with the specified initial\n     * capacity and the specified load factor.</p>\n     *\n     * @param initialCapacity the initial capacity of the hashtable.\n     * @param loadFactor the load factor of the hashtable.\n     * @throws IllegalArgumentException  if the initial capacity is less\n     *             than zero, or if the load factor is nonpositive.\n     */\n    public IntHashMap(int initialCapacity, float loadFactor) {\n        super();\n        if (initialCapacity < 0) {\n            throw new IllegalArgumentException(\"Illegal Capacity: \" + initialCapacity);\n        }\n        if (loadFactor <= 0) {\n            throw new IllegalArgumentException(\"Illegal Load: \" + loadFactor);\n        }\n        if (initialCapacity == 0) {\n            initialCapacity = 1;\n        }\n\n        this.loadFactor = loadFactor;\n        table = new Entry[initialCapacity];\n        threshold = (int) (initialCapacity * loadFactor);\n    }\n\n    /**\n     * <p>Returns the number of keys in this hashtable.</p>\n     *\n     * @return  the number of keys in this hashtable.\n     */\n    public int size() {\n        return count;\n    }","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/commons/src/main/java/com/navercorp/pinpoint/common/util/apache/IntHashMap.java#L108-L144","documentation":"IntHashMap(int initialCapacity, float loadFactor) requires loadFactor > 0; a zero or negative load factor would break rehash growth. The constructor throws IllegalArgumentException ('Illegal Load: ...') to reject it, immediately after the capacity check.","triggerScenarios":"Constructing IntHashMap with loadFactor <= 0, e.g. 0 from an unparsed float config or a negative tuning value.","commonSituations":"Load-factor property missing/blank so parsed to 0.0; copy-paste tuning values with wrong sign.","solutions":["Pass a positive load factor (standard: 0.75f)","Validate the config float is > 0 before constructing","Fall back to a default load factor when config is absent"],"exampleFix":"// before\nfloat lf = Float.parseFloat(cfg.getProperty(\"map.loadfactor\", \"0\")); // 0.0\nIntHashMap map = new IntHashMap(16, lf); // throws\n// after\nfloat lf = Float.parseFloat(cfg.getProperty(\"map.loadfactor\", \"0.75\"));\nIntHashMap map = new IntHashMap(16, lf > 0 ? lf : 0.75f);","handlingStrategy":"validation","validationCode":"if (loadFactor <= 0f) loadFactor = 0.75f;\nIntHashMap map = new IntHashMap(initialCapacity, loadFactor);","typeGuard":null,"tryCatchPattern":"try {\n    map = new IntHashMap(initialCapacity, loadFactor);\n} catch (IllegalArgumentException e) {\n    logger.warn(\"IntHashMap load factor invalid: {}\", e.getMessage());\n    map = new IntHashMap(initialCapacity, 0.75f);\n}","preventionTips":["Use the standard 0.75f unless profiling says otherwise","Guard parsed float configs against 0/blank values","Never pass negative tuning factors"],"tags":["collections","argument-check","constructor"],"backgroundTag":"invalid-constructor-argument","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}