Author: ghjboss
Date: 2013-02-28 21:01:21 -0500 (Thu, 28 Feb 2013)
New Revision: 6022
Modified:
jcr/branches/1.14.6.GA-BZ892867/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
jcr/branches/1.14.6.GA-BZ892867/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCUtils.java
jcr/branches/1.14.6.GA-BZ892867/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java
Log:
commit the fix for BZ892867
Modified:
jcr/branches/1.14.6.GA-BZ892867/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
===================================================================
---
jcr/branches/1.14.6.GA-BZ892867/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2013-01-08
15:51:52 UTC (rev 6021)
+++
jcr/branches/1.14.6.GA-BZ892867/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2013-03-01
02:01:21 UTC (rev 6022)
@@ -293,7 +293,7 @@
*/
private void addValues(final Document doc, final PropertyData prop) throws
RepositoryException
{
- int propType = prop.getType();
+ int propType = prop.getType();
String fieldName =
resolver.createJCRName(prop.getQPath().getName()).getAsString();
if (propType == PropertyType.BINARY)
{
@@ -311,28 +311,28 @@
ItemType.PROPERTY);
}
- if (pmime != null)
+ if (pmime != null && pmime.getValues() != null &&
!pmime.getValues().isEmpty())
{
// ok, have a reader
// if the prop obtainer from cache it will contains a values,
// otherwise read prop with values from DM
PropertyData propData =
- prop.getValues().size() > 0 ? prop :
((PropertyData)stateProvider.getItemData(node, new QPathEntry(
- Constants.JCR_DATA, 0), ItemType.PROPERTY));
-
+ prop.getValues() != null && !prop.getValues().isEmpty() ? prop :
((PropertyData)stateProvider
+ .getItemData(node, new QPathEntry(Constants.JCR_DATA, 0),
ItemType.PROPERTY));
// index if have jcr:mimeType sibling for this binary property only
try
{
- DocumentReader dreader =
- extractor.getDocumentReader(new
String(pmime.getValues().get(0).getAsByteArray(),
- Constants.DEFAULT_ENCODING));
-
- data = propData.getValues();
-
- if (data == null)
+ if (propData == null || (data = propData.getValues()) == null ||
data.isEmpty())
{
- LOG.warn("null value found at property " +
prop.getQPath().getAsString());
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("No value found for the property located at "
+ prop.getQPath().getAsString());
+ }
+ return;
}
+ DocumentReader dreader =
+ extractor.getDocumentReader(new
String(pmime.getValues().get(0).getAsByteArray(),
+ Constants.DEFAULT_ENCODING));
// check the jcr:encoding property
PropertyData encProp =
node.getProperty(Constants.JCR_ENCODING.getAsString());
@@ -344,11 +344,18 @@
}
String encoding = null;
- if (encProp != null)
+ if (encProp != null && encProp.getValues() != null &&
!encProp.getValues().isEmpty())
{
// encoding parameter used
encoding = new String(encProp.getValues().get(0).getAsByteArray(),
Constants.DEFAULT_ENCODING);
}
+ else
+ {
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("No encoding found for the node located at " +
node.getQPath().getAsString());
+ }
+ }
if (dreader instanceof AdvancedDocumentReader)
{
@@ -445,6 +452,13 @@
+ ", propery id '" + propData.getIdentifier() +
"' : " + e, e);
}
}
+ else
+ {
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("no mime type found for the node located at " +
node.getQPath().getAsString());
+ }
+ }
}
}
@@ -456,14 +470,20 @@
// read prop with values from DM
// WARN. DON'T USE access item BY PATH - it's may be a node in case
of
// residual definitions in NT
- List<ValueData> data =
- prop.getValues().size() > 0 ? prop.getValues() :
((PropertyData)stateProvider.getItemData(prop
- .getIdentifier())).getValues();
+ PropertyData propData =
+ prop.getValues() != null && !prop.getValues().isEmpty() ? prop :
(PropertyData)stateProvider
+ .getItemData(prop.getIdentifier());
- if (data == null)
- {
- LOG.warn("null value found at property " +
prop.getQPath().getAsString());
- }
+ List<ValueData> data;
+
+ if (propData == null || (data = propData.getValues()) == null ||
data.isEmpty())
+ {
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("No value found for the property located at " +
prop.getQPath().getAsString());
+ }
+ return;
+ }
ExtendedValue val = null;
InternalQName name = prop.getQPath().getName();
Modified:
jcr/branches/1.14.6.GA-BZ892867/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCUtils.java
===================================================================
---
jcr/branches/1.14.6.GA-BZ892867/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCUtils.java 2013-01-08
15:51:52 UTC (rev 6021)
+++
jcr/branches/1.14.6.GA-BZ892867/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCUtils.java 2013-03-01
02:01:21 UTC (rev 6022)
@@ -53,8 +53,18 @@
ResultSet trs = null;
try
{
+ String dialect = DialectDetecter.detect(con.getMetaData());
+ String query;
+ if (DBConstants.DB_DIALECT_MYSQL.equals(dialect))
+ {
+ query = "SELECT count(*) from (SELECT 1 FROM " + tableName + "
LIMIT 1) T";
+ }
+ else
+ {
+ query = "SELECT count(*) FROM " + tableName;
+ }
stmt = con.createStatement();
- trs = stmt.executeQuery("SELECT count(*) FROM " + tableName);
+ trs = stmt.executeQuery(query);
return trs.next();
}
catch (SQLException e)
Modified:
jcr/branches/1.14.6.GA-BZ892867/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java
===================================================================
---
jcr/branches/1.14.6.GA-BZ892867/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java 2013-01-08
15:51:52 UTC (rev 6021)
+++
jcr/branches/1.14.6.GA-BZ892867/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java 2013-03-01
02:01:21 UTC (rev 6022)
@@ -87,7 +87,7 @@
* The length of time in milliseconds after which the snapshot of the statistics is
persisted.
*/
public static final long PERSISTENCE_TIMEOUT =
-
Long.valueOf(PrivilegedSystemHelper.getProperty("JCRStatisticsManager.persistence.timeout",
"5000"));
+
Long.valueOf(PrivilegedSystemHelper.getProperty("JCRStatisticsManager.persistence.timeout",
"15000"));
/**
* Default constructor.
Show replies by date