-1

この例外が発生します

    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisO
peration.java:413) ~[axis2_1.6.1-wso2v7.jar:na]
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(Out
InAxisOperation.java:224) ~[axis2_1.6.1-wso2v7.jar:na]
Caused by: org.apache.axiom.om.OMException: Stream Errorjava.io.IOException: Bad
 chunk size:
    at org.apache.axiom.attachments.Attachments.<init>(Attachments.java:242)
 ~[axiom_1.2.11-wso2v3.jar:na]
    at org.apache.axis2.builder.BuilderUtil.createAttachments(BuilderUtil.ja
va:594) ~[axis2_1.6.1-wso2v7.jar:na]
    at org.apache.axis2.builder.BuilderUtil.createAttachmentsMap(BuilderUtil
.java:545) ~[axis2_1.6.1-wso2v7.jar:na]
    at org.apache.axis2.builder.MIMEBuilder.processDocument(MIMEBuilder.java
:39) ~[axis2_1.6.1-wso2v7.jar:na]
    at org.apache.axis2.transport.TransportUtils.createDocumentElement(Trans
portUtils.java:179) ~[axis2_1.6.1-wso2v7.jar:na]
    at org.apache.axis2.transport.TransportUtils.createSOAPMessage(Transport
Utils.java:145) ~[axis2_1.6.1-wso2v7.jar:na]
Caused by: java.io.IOException: Bad chunk size:
    at org.apache.commons.httpclient.ChunkedInputStream.getChunkSizeFromInpu
tStream(ChunkedInputStream.java:306) ~[commons-httpclient_3.1.0-wso2v2.jar:na]
    at org.apache.commons.httpclient.ChunkedInputStream.nextChunk(ChunkedInp
utStream.java:221) ~[commons-httpclient_3.1.0-wso2v2.jar:na]
    at org.apache.commons.httpclient.ChunkedInputStream.read(ChunkedInputStr
eam.java:146) ~[commons-httpclient_3.1.0-wso2v2.jar:na]
    at java.io.FilterInputStream.read(FilterInputStream.java:83) ~[na:1.7.0_
04]
    at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInpu
tStream.java:88) ~[commons-httpclient_3.1.0-wso2v2.jar:na]
    at java.io.FilterInputStream.read(FilterInputStream.java:83) ~[na:1.7.0_
04]
org.wso2.carbon.governance.api.exception.GovernanceException: Error in retrievin
g governance artifact by path. path: /trunk/schemas/com/mycorp/xmlns/common/faul
t/v1/common_fault_v1.2.xsd.
    at org.wso2.carbon.governance.api.util.GovernanceUtils.retrieveGovernanc
eArtifactByPath(GovernanceUtils.java:805)
    at org.wso2.carbon.governance.api.schema.SchemaManager.getAllSchemas(Sch
emaManager.java:385)
    at org.wso2.carbon.governance.api.schema.SchemaManager.findSchemas(Schem
aManager.java:351)
    at wso2client.SchemaDAO.getReusableSchemas(SchemaDAO.java:62)

クラス wso2client.SchemaDAO で次のコードを実行すると:

public static List<models.domain.Schema> getReusableSchemas() {
    List<models.domain.Schema> domainSchemas = null;
    try {
        registry = Util.initialize();
        governanceRegistry = Util.getGovernanceRegistry(registry);

        // starting with the schema manager created with governanceRegistry
        schemaManager = new SchemaManager(governanceRegistry);

        // get schemas with attribute "creator" == "yyy"
        List<Schema> schemas = Arrays.asList(
            schemaManager.findSchemas(new ReusableSchemaFilter())
        );

        System.out.println("Number of matches:" + schemas.size());
        domainSchemas = DTOMapper.Wso2Schemas2DomainSchemas(schemas);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } 
    return domainSchemas;
}

private static class ReusableSchemaFilter implements SchemaFilter {

    @Override
    public boolean matches(Schema wso2Schema) throws GovernanceException {
        boolean schemaIsReusable = false;
        // in order to read the properties (not attributes!) of the schema I need to retrieve the resource.
        try {
            Resource resource = governanceRegistry.get(wso2Schema.getPath());

            boolean isDeprecated = "Deprecated".equals(wso2Schema.getLifecycleState());
            boolean isCanonical = "canonicalInformation1".equals(resource.getProperty("informationModelRelation"));
            schemaIsReusable = (isCanonical && !isDeprecated);
        } catch (RegistryException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return schemaIsReusable;
    }

}

何が問題なのか分かりますか?

4

1 に答える 1

0

フィルタを次のように変更しました。

private static class ReusableSchemaFilter implements SchemaFilter {

    @Override
    public boolean matches(Schema wso2Schema) throws GovernanceException {
        boolean schemaIsReusable = false;
        // in order to read the properties (not attributes!) of the schema I need to retrieve the resource.
        try {
            //Resource resource = governanceRegistry.get(wso2Schema.getPath());

            boolean isDeprecated = "Deprecated".equals(wso2Schema.getLifecycleState());
            boolean isCanonical = "canonicalInformation1".equals(wso2Schema.getAttribute("informationModelRelation"));
            schemaIsReusable = (isCanonical && !isDeprecated);
        } catch (RegistryException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return schemaIsReusable;
    }

}

つまり、Resource クラスの getProperty を使用する代わりに、WSO2 スキーマ クラスで getAttribute を使用したため、例外は発生しませんでした。

getAttribute メソッドを使用してスキーマのプロパティ値を取得できる理由について、まだ混乱しています。setAttribute メソッドを使用して同じプロパティを設定することはできません。そのためには、setProperty を使用する必要があります。

于 2013-04-25T09:11:05.003 に答える