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;
|
return this.category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasMetadata() {
|
||||||
|
return title != null || description != null || tags != null || category != null || files != null || mimeType != null;
|
||||||
|
}
|
||||||
|
|
||||||
public void setArbitraryResourceData(ArbitraryResourceData arbitraryResourceData) {
|
public void setArbitraryResourceData(ArbitraryResourceData arbitraryResourceData) {
|
||||||
this.arbitraryResourceData = arbitraryResourceData;
|
this.arbitraryResourceData = arbitraryResourceData;
|
||||||
}
|
}
|
||||||
|
@ -115,15 +115,15 @@ public abstract class RepositoryManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
repository.saveChanges();
|
repository.saveChanges();
|
||||||
LOGGER.info("Completed build of initial arbitrary resources cache.");
|
LOGGER.info("Completed build of arbitrary resources cache.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (DataException e) {
|
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.
|
// Throw an exception so that the node startup is halted, allowing for a retry next time.
|
||||||
repository.discardChanges();
|
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);
|
if (tag5 != null) tags.add(tag5);
|
||||||
metadata.setTags(!tags.isEmpty() ? tags : null);
|
metadata.setTags(!tags.isEmpty() ? tags : null);
|
||||||
|
|
||||||
arbitraryResourceData.metadata = metadata;
|
if (metadata.hasMetadata()) {
|
||||||
|
arbitraryResourceData.metadata = metadata;
|
||||||
|
}
|
||||||
|
|
||||||
return arbitraryResourceData;
|
return arbitraryResourceData;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@ -465,7 +467,9 @@ public class HSQLDBArbitraryRepository implements ArbitraryRepository {
|
|||||||
if (tag5 != null) tags.add(tag5);
|
if (tag5 != null) tags.add(tag5);
|
||||||
metadata.setTags(!tags.isEmpty() ? tags : null);
|
metadata.setTags(!tags.isEmpty() ? tags : null);
|
||||||
|
|
||||||
arbitraryResourceData.metadata = metadata;
|
if (metadata.hasMetadata()) {
|
||||||
|
arbitraryResourceData.metadata = metadata;
|
||||||
|
}
|
||||||
|
|
||||||
arbitraryResources.add(arbitraryResourceData);
|
arbitraryResources.add(arbitraryResourceData);
|
||||||
} while (resultSet.next());
|
} while (resultSet.next());
|
||||||
@ -608,7 +612,9 @@ public class HSQLDBArbitraryRepository implements ArbitraryRepository {
|
|||||||
if (tag5 != null) tags.add(tag5);
|
if (tag5 != null) tags.add(tag5);
|
||||||
metadata.setTags(!tags.isEmpty() ? tags : null);
|
metadata.setTags(!tags.isEmpty() ? tags : null);
|
||||||
|
|
||||||
arbitraryResourceData.metadata = metadata;
|
if (metadata.hasMetadata()) {
|
||||||
|
arbitraryResourceData.metadata = metadata;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
arbitraryResources.add(arbitraryResourceData);
|
arbitraryResources.add(arbitraryResourceData);
|
||||||
@ -782,7 +788,9 @@ public class HSQLDBArbitraryRepository implements ArbitraryRepository {
|
|||||||
if (tag5 != null) tags.add(tag5);
|
if (tag5 != null) tags.add(tag5);
|
||||||
metadata.setTags(!tags.isEmpty() ? tags : null);
|
metadata.setTags(!tags.isEmpty() ? tags : null);
|
||||||
|
|
||||||
arbitraryResourceData.metadata = metadata;
|
if (metadata.hasMetadata()) {
|
||||||
|
arbitraryResourceData.metadata = metadata;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
arbitraryResources.add(arbitraryResourceData);
|
arbitraryResources.add(arbitraryResourceData);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user