All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jetbrains.plugin.structure.base.problems.PluginFileError.kt Maven / Gradle / Ivy

Go to download

Base library for parsing JetBrains plugins. Used by other JetBrains Plugins structure libraries.

There is a newer version: 3.290
Show newest version
/*
 * Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 */

package com.jetbrains.plugin.structure.base.problems

import org.apache.commons.io.FileUtils

abstract class PluginFileError : PluginProblem() {
  override val level
    get() = Level.ERROR
}

class IncorrectPluginFile(
  private val fileName: String,
  private val expectedFileType: String
) : PluginFileError() {
  override val message
    get() = "The plugin archive contains an unexpected file $fileName: it must be a $expectedFileType."
}

class IncorrectZipOrJarFile(
  private val fileName: String
) : PluginFileError() {
  override val message
    get() = "The plugin archive contains an unexpected file $fileName: it must be .zip, .jar or a directory."
}

class UnableToExtractZip : PluginFileError() {
  override val message
    get() = "The plugin archive file cannot be extracted."
}

class PluginFileSizeIsTooLarge(private val sizeLimit: Long) : PluginFileError() {
  override val message
    get() = "The plugin file size exceeds the maximum limit of ${FileUtils.byteCountToDisplaySize(sizeLimit)}: ensure " +
            "that the plugin file is compressed and meets the maximum size limit."
}

class TooManyFiles(private val filesLimit: Long) : PluginProblem() {
  override val message: String
    get() = "The plugin has more files than allowed: $filesLimit."

  override val level = Level.ERROR
}

class FileTooBig(val file: String, private val fileSizeLimit: Long) : PluginProblem() {
  override val message: String
    get() = "The file $file is bigger than max allowed size: $fileSizeLimit."

  override val level = Level.ERROR
}

class MissedFile(val file: String) : PluginProblem() {
  override val message: String
    get() = "The file $file is missed."

  override val level = Level.ERROR
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy