forked from Qortal/qortal
Fixed more bugs.
This commit is contained in:
parent
94f4c501fa
commit
c0f29f848f
@ -101,6 +101,10 @@ public class ArbitraryResourceMetadata {
|
||||
return this.category;
|
||||
}
|
||||
|
||||
public boolean hasMetadata() {
|
||||
return title != null || description != null || tags != null || category != null || files != null || mimeType != null;
|
||||
}
|
||||
|
||||
public void setArbitraryResourceData(ArbitraryResourceData arbitraryResourceData) {
|
||||
this.arbitraryResourceData = arbitraryResourceData;
|
||||
}
|
||||
|
@ -115,15 +115,15 @@ public abstract class RepositoryManager {
|
||||
}
|
||||
|
||||
repository.saveChanges();
|
||||
LOGGER.info("Completed build of initial arbitrary resources cache.");
|
||||
LOGGER.info("Completed build of arbitrary resources cache.");
|
||||
return true;
|
||||
}
|
||||
catch (DataException e) {
|
||||
LOGGER.info("Unable to build initial arbitrary resources cache: {}. The database may have been left in an inconsistent state.", e.getMessage());
|
||||
LOGGER.info("Unable to build arbitrary resources cache: {}. The database may have been left in an inconsistent state.", e.getMessage());
|
||||
|
||||
// Throw an exception so that the node startup is halted, allowing for a retry next time.
|
||||
repository.discardChanges();
|
||||
throw new DataException("Build of initial arbitrary resources cache failed.");
|
||||
throw new DataException("Build of arbitrary resources cache failed.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -391,7 +391,9 @@ public class HSQLDBArbitraryRepository implements ArbitraryRepository {
|
||||
if (tag5 != null) tags.add(tag5);
|
||||
metadata.setTags(!tags.isEmpty() ? tags : null);
|
||||
|
||||
arbitraryResourceData.metadata = metadata;
|
||||
if (metadata.hasMetadata()) {
|
||||
arbitraryResourceData.metadata = metadata;
|
||||
}
|
||||
|
||||
return arbitraryResourceData;
|
||||
} catch (SQLException e) {
|
||||
@ -465,7 +467,9 @@ public class HSQLDBArbitraryRepository implements ArbitraryRepository {
|
||||
if (tag5 != null) tags.add(tag5);
|
||||
metadata.setTags(!tags.isEmpty() ? tags : null);
|
||||
|
||||
arbitraryResourceData.metadata = metadata;
|
||||
if (metadata.hasMetadata()) {
|
||||
arbitraryResourceData.metadata = metadata;
|
||||
}
|
||||
|
||||
arbitraryResources.add(arbitraryResourceData);
|
||||
} while (resultSet.next());
|
||||
@ -608,7 +612,9 @@ public class HSQLDBArbitraryRepository implements ArbitraryRepository {
|
||||
if (tag5 != null) tags.add(tag5);
|
||||
metadata.setTags(!tags.isEmpty() ? tags : null);
|
||||
|
||||
arbitraryResourceData.metadata = metadata;
|
||||
if (metadata.hasMetadata()) {
|
||||
arbitraryResourceData.metadata = metadata;
|
||||
}
|
||||
}
|
||||
|
||||
arbitraryResources.add(arbitraryResourceData);
|
||||
@ -782,7 +788,9 @@ public class HSQLDBArbitraryRepository implements ArbitraryRepository {
|
||||
if (tag5 != null) tags.add(tag5);
|
||||
metadata.setTags(!tags.isEmpty() ? tags : null);
|
||||
|
||||
arbitraryResourceData.metadata = metadata;
|
||||
if (metadata.hasMetadata()) {
|
||||
arbitraryResourceData.metadata = metadata;
|
||||
}
|
||||
}
|
||||
|
||||
arbitraryResources.add(arbitraryResourceData);
|
||||
|
Loading…
Reference in New Issue
Block a user