Author: hardy.ferentschik
Date: 2009-07-08 09:07:29 -0400 (Wed, 08 Jul 2009)
New Revision: 17046
Modified:
jpamodelgen/trunk/generator/src/main/java/org/hibernate/jpa/metamodel/ap/JPAMetaModelEntityProcessor.java
Log:
added comment about resource loading
Modified:
jpamodelgen/trunk/generator/src/main/java/org/hibernate/jpa/metamodel/ap/JPAMetaModelEntityProcessor.java
===================================================================
---
jpamodelgen/trunk/generator/src/main/java/org/hibernate/jpa/metamodel/ap/JPAMetaModelEntityProcessor.java 2009-07-08
12:27:16 UTC (rev 17045)
+++
jpamodelgen/trunk/generator/src/main/java/org/hibernate/jpa/metamodel/ap/JPAMetaModelEntityProcessor.java 2009-07-08
13:07:29 UTC (rev 17046)
@@ -11,7 +11,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.HashSet;
import javax.annotation.Generated;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.FilerException;
@@ -25,14 +24,14 @@
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.Elements;
+import javax.persistence.Embeddable;
+import javax.persistence.MappedSuperclass;
import javax.tools.Diagnostic;
import javax.tools.FileObject;
import javax.tools.StandardLocation;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
-import javax.persistence.MappedSuperclass;
-import javax.persistence.Embeddable;
import org.hibernate.jpa.metamodel.ap.annotation.MetaEntity;
import org.hibernate.jpa.metamodel.ap.xml.XmlMetaEntity;
@@ -269,7 +268,7 @@
String name = getRelativeName( resource );
processingEnv.getMessager()
.printMessage( Diagnostic.Kind.NOTE, "Checking for " + resource );
- InputStream ormStream;
+ InputStream ormStream = null;
try {
FileObject fileObject = processingEnv.getFiler().getResource(
StandardLocation.CLASS_OUTPUT, pkg, name );
ormStream = fileObject.openInputStream();
@@ -278,8 +277,14 @@
processingEnv.getMessager()
.printMessage(
Diagnostic.Kind.WARNING,
- "Could not load " + resource + " using Filer.getResource(). Trying
classpath..."
+ "Could not load " + resource + "from class output directory"
);
+
+ // TODO
+ // unfortunately, the Filer.getResource API seems not to be able to load from
/META-INF. One gets a
+ // FilerException with the message with "Illegal name /META-INF". This means
that we have to revert to
+ // using the classpath. This might mean that we find a persistence.xml which is
'part of another jar.
+ // Not sure what else we can do here
ormStream = this.getClass().getResourceAsStream( resource );
}
return ormStream;
Show replies by date