{"record":{"id":"f900ffef489737d8","repo":"DrKLO/Telegram","slug":"invalid-orientation-f900ff","errorCode":null,"errorMessage":"invalid orientation","messagePattern":"invalid orientation","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"TMessagesProj/src/main/java/androidx/recyclerview/widget/OrientationHelper.java","lineNumber":247,"sourceCode":"     */\n    public abstract int getModeInOther();\n\n    /**\n     * Creates an OrientationHelper for the given LayoutManager and orientation.\n     *\n     * @param layoutManager LayoutManager to attach to\n     * @param orientation   Desired orientation. Should be {@link #HORIZONTAL} or {@link #VERTICAL}\n     * @return A new OrientationHelper\n     */\n    public static OrientationHelper createOrientationHelper(\n            RecyclerView.LayoutManager layoutManager, @RecyclerView.Orientation int orientation) {\n        switch (orientation) {\n            case HORIZONTAL:\n                return createHorizontalHelper(layoutManager);\n            case VERTICAL:\n                return createVerticalHelper(layoutManager);\n        }\n        throw new IllegalArgumentException(\"invalid orientation\");\n    }\n\n    /**\n     * Creates a horizontal OrientationHelper for the given LayoutManager.\n     *\n     * @param layoutManager The LayoutManager to attach to.\n     * @return A new OrientationHelper\n     */\n    public static OrientationHelper createHorizontalHelper(\n            RecyclerView.LayoutManager layoutManager) {\n        return new OrientationHelper(layoutManager) {\n            @Override\n            public int getEndAfterPadding() {\n                return mLayoutManager.getWidth() - mLayoutManager.getPaddingRight();\n            }\n\n            @Override\n            public int getEnd() {","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/src/main/java/androidx/recyclerview/widget/OrientationHelper.java#L229-L265","documentation":"OrientationHelper.createOrientationHelper() is the factory used by layout managers to obtain a per-axis helper. Its switch covers only HORIZONTAL and VERTICAL; any other orientation falls through to an unconditional IllegalArgumentException('invalid orientation') with no value echo. This is a defensive guard: OrientationHelper cannot operate without a known axis.","triggerScenarios":"An internal call path (usually setOrientation or LayoutManager construction) that supplies an int other than 0/1 to createOrientationHelper. A custom LayoutManager that builds its own OrientationHelper with a bad constant.","commonSituations":"Almost always a downstream symptom of error 21 (invalid orientation passed to LinearLayoutManager). A custom LayoutManager copied from a fork that uses different orientation constant values.","solutions":["Fix the orientation at its origin — pass LinearLayoutManager.HORIZONTAL or VERTICAL.","If writing a custom LayoutManager, use OrientationHelper.createHorizontalHelper / createVerticalHelper directly instead of the generic factory when the axis is known statically.","Add a precondition check before createOrientationHelper so the bad value never reaches it."],"exampleFix":"// before\nOrientationHelper h = OrientationHelper.createOrientationHelper(this, axisFromConfig);\n\n// after\nint axis = (axisFromConfig == LinearLayoutManager.HORIZONTAL)\n    ? LinearLayoutManager.HORIZONTAL : LinearLayoutManager.VERTICAL;\nOrientationHelper h = OrientationHelper.createOrientationHelper(this, axis);","handlingStrategy":"validation","validationCode":"static OrientationHelper safeHelper(RecyclerView.LayoutManager lm, int orientation) {\n    switch (orientation) {\n        case OrientationHelper.HORIZONTAL: return OrientationHelper.createHorizontalHelper(lm);\n        case OrientationHelper.VERTICAL:   return OrientationHelper.createVerticalHelper(lm);\n        default: throw new IllegalArgumentException(\"orientation must be HORIZONTAL or VERTICAL\");\n    }\n}","typeGuard":"static boolean isValidOrientation(int o) {\n    return o == OrientationHelper.HORIZONTAL || o == OrientationHelper.VERTICAL;\n}","tryCatchPattern":"null","preventionTips":["Prefer createHorizontalHelper/createVerticalHelper directly when the axis is known.","Validate orientation at the source (setOrientation) so it never reaches createOrientationHelper invalid."],"tags":["recyclerview","orientationhelper","layoutmanager","validation"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}