mirror of
https://github.com/Qortal/qortal.git
synced 2025-05-05 09:17:51 +00:00
Reduce log spam when a QDN resource can't be found due to it not being published.
This commit is contained in:
parent
0596a07c7d
commit
016191bdb0
@ -2,6 +2,7 @@ package org.qortal.arbitrary;
|
|||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.qortal.arbitrary.exception.DataNotPublishedException;
|
||||||
import org.qortal.arbitrary.exception.MissingDataException;
|
import org.qortal.arbitrary.exception.MissingDataException;
|
||||||
import org.qortal.arbitrary.metadata.ArbitraryDataMetadataCache;
|
import org.qortal.arbitrary.metadata.ArbitraryDataMetadataCache;
|
||||||
import org.qortal.arbitrary.misc.Service;
|
import org.qortal.arbitrary.misc.Service;
|
||||||
@ -88,7 +89,7 @@ public class ArbitraryDataBuilder {
|
|||||||
if (latestPut == null) {
|
if (latestPut == null) {
|
||||||
String message = String.format("Couldn't find PUT transaction for name %s, service %s and identifier %s",
|
String message = String.format("Couldn't find PUT transaction for name %s, service %s and identifier %s",
|
||||||
this.name, this.service, this.identifierString());
|
this.name, this.service, this.identifierString());
|
||||||
throw new DataException(message);
|
throw new DataNotPublishedException(message);
|
||||||
}
|
}
|
||||||
this.latestPutTransaction = latestPut;
|
this.latestPutTransaction = latestPut;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import org.apache.commons.io.FileUtils;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
import org.qortal.arbitrary.exception.DataNotPublishedException;
|
||||||
import org.qortal.arbitrary.exception.MissingDataException;
|
import org.qortal.arbitrary.exception.MissingDataException;
|
||||||
import org.qortal.arbitrary.misc.Service;
|
import org.qortal.arbitrary.misc.Service;
|
||||||
import org.qortal.controller.arbitrary.ArbitraryDataBuildManager;
|
import org.qortal.controller.arbitrary.ArbitraryDataBuildManager;
|
||||||
@ -169,10 +170,18 @@ public class ArbitraryDataReader {
|
|||||||
this.uncompress();
|
this.uncompress();
|
||||||
this.validate();
|
this.validate();
|
||||||
|
|
||||||
|
} catch (DataNotPublishedException e) {
|
||||||
|
if (e.getMessage() != null) {
|
||||||
|
// Log the message only, to avoid spamming the logs with a full stack trace
|
||||||
|
LOGGER.debug("DataNotPublishedException when trying to load QDN resource: {}", e.getMessage());
|
||||||
|
}
|
||||||
|
this.deleteWorkingDirectory();
|
||||||
|
throw e;
|
||||||
|
|
||||||
} catch (DataException e) {
|
} catch (DataException e) {
|
||||||
LOGGER.info("DataException when trying to load QDN resource", e);
|
LOGGER.info("DataException when trying to load QDN resource", e);
|
||||||
this.deleteWorkingDirectory();
|
this.deleteWorkingDirectory();
|
||||||
throw new DataException(e.getMessage());
|
throw e;
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
this.postExecute();
|
this.postExecute();
|
||||||
|
@ -3,6 +3,7 @@ package org.qortal.arbitrary;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.qortal.arbitrary.ArbitraryDataFile.ResourceIdType;
|
import org.qortal.arbitrary.ArbitraryDataFile.ResourceIdType;
|
||||||
|
import org.qortal.arbitrary.exception.DataNotPublishedException;
|
||||||
import org.qortal.arbitrary.metadata.ArbitraryDataTransactionMetadata;
|
import org.qortal.arbitrary.metadata.ArbitraryDataTransactionMetadata;
|
||||||
import org.qortal.arbitrary.misc.Service;
|
import org.qortal.arbitrary.misc.Service;
|
||||||
import org.qortal.controller.arbitrary.ArbitraryDataBuildManager;
|
import org.qortal.controller.arbitrary.ArbitraryDataBuildManager;
|
||||||
@ -325,7 +326,7 @@ public class ArbitraryDataResource {
|
|||||||
if (latestPut == null) {
|
if (latestPut == null) {
|
||||||
String message = String.format("Couldn't find PUT transaction for name %s, service %s and identifier %s",
|
String message = String.format("Couldn't find PUT transaction for name %s, service %s and identifier %s",
|
||||||
this.resourceId, this.service, this.identifierString());
|
this.resourceId, this.service, this.identifierString());
|
||||||
throw new DataException(message);
|
throw new DataNotPublishedException(message);
|
||||||
}
|
}
|
||||||
this.latestPutTransaction = latestPut;
|
this.latestPutTransaction = latestPut;
|
||||||
|
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
package org.qortal.arbitrary.exception;
|
||||||
|
|
||||||
|
import org.qortal.repository.DataException;
|
||||||
|
|
||||||
|
public class DataNotPublishedException extends DataException {
|
||||||
|
|
||||||
|
public DataNotPublishedException() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataNotPublishedException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataNotPublishedException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataNotPublishedException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user