Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Less Logging
Browse files Browse the repository at this point in the history
  • Loading branch information
aldrinleal committed Sep 7, 2023
1 parent 8dbc49f commit 69e9c65
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
11 changes: 11 additions & 0 deletions src/main/java/io/github/pixee/maven/operator/Ignorable.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.github.pixee.maven.operator

import org.slf4j.Logger
import org.slf4j.LoggerFactory

/**
* Internal Tag Object for Ignorable Messages
*/
object Ignorable {
internal val LOGGER: Logger = LoggerFactory.getLogger(Ignorable::class.java)
}
14 changes: 10 additions & 4 deletions src/main/java/io/github/pixee/maven/operator/POMScanner.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.pixee.maven.operator

import org.apache.maven.model.building.ModelBuildingException
import org.dom4j.Element
import org.slf4j.Logger
import org.slf4j.LoggerFactory
Expand All @@ -21,7 +22,11 @@ object POMScanner {
val parentPoms: List<File> = try {
getParentPoms(originalFile)
} catch (e: Exception) {
LOGGER.warn("While trying embedder: ", e)
if (e is ModelBuildingException) {
Ignorable.LOGGER.debug("mbe (you can ignore): ", e)
} else {
LOGGER.warn("While trying embedder: ", e)
}

return legacyScanFrom(originalFile, topLevelDirectory)
}
Expand Down Expand Up @@ -133,9 +138,10 @@ object POMScanner {


private fun getParentPoms(originalFile: File): List<File> {
val embedderFacadeResponse = EmbedderFacade.invokeEmbedder(
EmbedderFacadeRequest(offline = true, pomFile = originalFile)
)
val embedderFacadeResponse =
EmbedderFacade.invokeEmbedder(
EmbedderFacadeRequest(offline = true, pomFile = originalFile)
)

val res = embedderFacadeResponse.modelBuildingResult

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class QueryByResolver : AbstractQueryCommand() {
try {
embedderFacadeResponse = EmbedderFacade.invokeEmbedder(req)
} catch (mbe: ModelBuildingException) {
LOGGER.warn("Oops:", mbe)
Ignorable.LOGGER.debug("mbe (you can ignore): ", mbe)

return false
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.pixee.maven.operator

import org.apache.maven.model.building.ModelBuildingException
import org.codehaus.plexus.util.xml.Xpp3Dom
import org.slf4j.Logger
import org.slf4j.LoggerFactory
Expand All @@ -13,7 +14,12 @@ class UnwrapEffectivePom : AbstractVersionCommand() {
try {
executeInternal(pm)
} catch (e: Exception) {
LOGGER.warn("Failure", e)

if (e is ModelBuildingException) {
Ignorable.LOGGER.debug("mbe (you can ignore): ", e)
} else {
LOGGER.warn("While trying embedder: ", e)
}
false
}

Expand Down

0 comments on commit 69e9c65

Please sign in to comment.