{"record":{"id":"5f73eb5b64b520cf","repo":"apache/pulsar","slug":"time-cannot-be-empty","errorCode":null,"errorMessage":"time cannot be empty","messagePattern":"time cannot be empty","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/converters/RelativeTimeUtil.java","lineNumber":30,"sourceCode":" * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.pulsar.cli.converters;\n\nimport java.math.BigDecimal;\nimport java.math.RoundingMode;\nimport java.util.concurrent.TimeUnit;\nimport lombok.experimental.UtilityClass;\n\n@UtilityClass\npublic class RelativeTimeUtil {\n    public static long parseRelativeTimeInSeconds(String relativeTime) {\n        if (relativeTime.isEmpty()) {\n            throw new IllegalArgumentException(\"time cannot be empty\");\n        }\n\n        int lastIndex = relativeTime.length() - 1;\n        char lastChar = relativeTime.charAt(lastIndex);\n        final char timeUnit;\n\n        if (!Character.isAlphabetic(lastChar)) {\n            // No unit specified, assume seconds\n            timeUnit = 's';\n            lastIndex = relativeTime.length();\n        } else {\n            timeUnit = Character.toLowerCase(lastChar);\n        }\n\n        long duration = Long.parseLong(relativeTime.substring(0, lastIndex));\n\n        switch (timeUnit) {\n        case 's':","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/converters/RelativeTimeUtil.java#L12-L48","documentation":"Null/empty guard at the top of RelativeTimeUtil.parseRelativeTimeInSeconds: the relativeTime argument is blank (null or empty), so no duration string exists to parse; callers passing an unset CLI option for a relative time (e.g. ttl or retention) hit this validation.","triggerScenarios":"Thrown at pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/converters/RelativeTimeUtil.java:30 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a non-empty duration like '30s', '5m', '2h', '7d'"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}