Hi, Uwe. There're several places where forbiddenapis will give errors in Tika. I don't know if there is better way to fallback. E.g. in one of chm parser classes:
try { dle.setName(new String(bytes, "UTF-8")); catch (UnsupportedCharsetException e) { dle.setName(new String(bytes)); } Can you add special annotation parsing (like @SuppressWarnings("forbiddenapis") on element) to avoid emitting build error in special cases like above mentioned? -- Best regards, Konstantin Gribov Fri Jan 23 2015 at 15:10:18, Uwe Schindler <u...@thetaphi.de>: Here is the patch, mailing list swallowed it: > > Index: tika-parent/pom.xml > =================================================================== > --- tika-parent/pom.xml (revision 1654171) > +++ tika-parent/pom.xml (working copy) > @@ -274,7 +274,6 @@ > </properties> > > <build> > - <pluginManagement> > <plugins> > <plugin> > <artifactId>maven-compiler-plugin</artifactId> > @@ -287,7 +286,7 @@ > <plugin> > <groupId>de.thetaphi</groupId> > <artifactId>forbiddenapis</artifactId> > - <version>1.6.1</version> > + <version>1.7</version> > <configuration> > <targetVersion>${maven.compiler.target}</targetVersion> > <internalRuntimeForbidden>true</internalRuntimeForbidden> > @@ -322,7 +321,6 @@ > <version>2.3</version> > </plugin> > </plugins> > - </pluginManagement> > </build> > > <profiles> > > ----- > Uwe Schindler > H.-H.-Meier-Allee 63, D-28213 Bremen > http://www.thetaphi.de > eMail: u...@thetaphi.de > > > > -----Original Message----- > > From: Uwe Schindler [mailto:u...@thetaphi.de] > > Sent: Friday, January 23, 2015 1:08 PM > > To: dev@tika.apache.org > > Subject: RE: Forbidden-APIS no longer ran because of carzy POM change > > > > The attached patch reverts the change and updates the forbidden plugin. > > > > Uwe > > > > ----- > > Uwe Schindler > > H.-H.-Meier-Allee 63, D-28213 Bremen > > http://www.thetaphi.de > > eMail: u...@thetaphi.de > > > > > > > -----Original Message----- > > > From: Uwe Schindler [mailto:u...@thetaphi.de] > > > Sent: Friday, January 23, 2015 1:00 PM > > > To: dev@tika.apache.org > > > Subject: RE: Forbidden-APIS no longer ran because of carzy POM change > > > > > > Here ist he explanation why the plugin is no longer called because of > this: > > > > > > - Works for me too, but can anyone explain why? – Andrew Swan May 15 > > > '13 at 6:26 > > > - @Andrew I think this works because m2e is not looking for plugins in > > > pluginManagement, but only in build/plugins. In the Maven world, there > > > is a difference between the two - the former defines "if you happen to > > > use this plugin, here's the configuration to use", whereas the latter > > > states "use this plugin". See this post and its top two answers. – > > > GreenGiant Jul 5 '13 at 17:52 > > > - I agree with @GreenGiant. I tried this solution but it then breaks > > > the compilation since the aspectj plugin is not called before > > > compilation. – Pierre Aug 30 '13 at 20:21 > > > > > > This explains the change. In fact placing the plugins in > > > pluginManagements disables them unless explicitely configured in a > > > sub-module. So this commit should be reverted. > > > > > > > > > In fact the bug described here no longer applies to later M2E > > > installations. It still complains about plugins that Eclipse does not > > > know about, but this does not prevent you from using Eclipse. So I > > > would strongly ask to revert the commit because it breaks the build. > > > > > > Uwe > > > > > > ----- > > > Uwe Schindler > > > H.-H.-Meier-Allee 63, D-28213 Bremen > > > http://www.thetaphi.de > > > eMail: u...@thetaphi.de > > > > > > > > > > -----Original Message----- > > > > From: Uwe Schindler [mailto:u...@thetaphi.de] > > > > Sent: Friday, January 23, 2015 12:11 PM > > > > To: dev@tika.apache.org > > > > Subject: Forbidden-APIS no longer ran because of carzy POM change > > > > > > > > Hi, > > > > > > > > I just noticed while checking the problems around the > > > > ExternalParsers that the TIKA's build no longer runs the > > > > forbidden-apis Maven plugin, so we got a few new violation > > > > especially regarding the toUpper/LowerCase(). In fact the following > > commit broke this: > > > > > > > > Revision: 1624185 > > > > Author: mattmann > > > > Date: Donnerstag, 11. September 2014 05:11:19 > > > > Message: > > > > surround in plugin management to resolve > > > > http://stackoverflow.com/questions/6352208/how-to-solve-plugin- > > > > execution-not-covered-by-lifecycle-configuration-for-sprin > > > > ---- > > > > Modified : /tika/trunk/tika-parent/pom.xml > > > > > > > > Since that change, the plugin is no longer run by default. I have no > > > > idea, why this is like this, but in fact this broke some of the > > > > globally defined > > > check tasks. > > > > I have no idea how to reenable it easily. > > > > So I cannot help, but reverting that commit restores behavior. What > > > > is the reason for this commit, there is not even an issue about > > > > that. I think it seems to be a workaround for some Eclipse issue, > > > > but in fact this disables the whole plugins. To reenable > > > > forbidden-apis you have to now explicitely enable it in every module > > > > (because pluginManagement just gives the config of a plugin, where > > > > without that it also enables its > > > execution. > > > > > > > > In addition, there is already version 1.7 of forbiddenapis, so you > > > > can replace > > > > 1.6.1 of forbidden-apis with version 1.7 (which fixes a few bugs > > > > with Java 8 and Java 9). > > > > > > > > The following new violations were found -> and in fact those broke > > > > code in turkish locale: > > > > [INFO] > > > > -------------------------------------------------------------------- > > > > -- > > > > -- [INFO] Building Apache Tika core 1.8-SNAPSHOT [INFO] > > > > -------------------------- > > > > ---------------------------------------------- > > > > [INFO] > > > > [INFO] --- forbiddenapis:1.7:testCheck (default) @ tika-core --- > > > > [INFO] Scanning for classes to check... > > > > [INFO] Reading bundled API signatures: jdk-unsafe [INFO] Reading > > > > bundled API signatures: jdk-deprecated [INFO] Loading classes to > check... > > > > [INFO] Scanning for API signatures and dependencies... > > > > [ERROR] Forbidden method invocation: java.lang.String#toLowerCase() > > > > [Uses default locale] > > > > [ERROR] in org.apache.tika.sax.BasicContentHandlerFactoryTest > > > > (BasicContentHandlerFactoryTest.java:79) > > > > [ERROR] Forbidden method invocation: java.lang.String#toLowerCase() > > > > [Uses default locale] > > > > [ERROR] in org.apache.tika.sax.BasicContentHandlerFactoryTest > > > > (BasicContentHandlerFactoryTest.java:80) > > > > [ERROR] Forbidden method invocation: java.lang.String#toLowerCase() > > > > [Uses default locale] > > > > [ERROR] in org.apache.tika.sax.BasicContentHandlerFactoryTest > > > > (BasicContentHandlerFactoryTest.java:88) > > > > [ERROR] Forbidden method invocation: java.lang.String#toLowerCase() > > > > [Uses default locale] > > > > [ERROR] in org.apache.tika.sax.BasicContentHandlerFactoryTest > > > > (BasicContentHandlerFactoryTest.java:133) > > > > [ERROR] Forbidden method invocation: java.lang.String#toLowerCase() > > > > [Uses default locale] > > > > [ERROR] in org.apache.tika.sax.BasicContentHandlerFactoryTest > > > > (BasicContentHandlerFactoryTest.java:176) > > > > [ERROR] Forbidden method invocation: java.lang.String#toLowerCase() > > > > [Uses default locale] > > > > [ERROR] in org.apache.tika.sax.BasicContentHandlerFactoryTest > > > > (BasicContentHandlerFactoryTest.java:221) > > > > [ERROR] Forbidden method invocation: java.lang.String#toLowerCase() > > > > [Uses default locale] > > > > [ERROR] in org.apache.tika.sax.BasicContentHandlerFactoryTest > > > > (BasicContentHandlerFactoryTest.java:273) > > > > [ERROR] Scanned 52 (and 331 related) class file(s) for forbidden API > > > > invocations (in 0.16s), 7 error(s). > > > > [INFO] > > > > -------------------------------------------------------------------- > > > > -- > > > > -- > > > > [...] > > > > [INFO] > > > > -------------------------------------------------------------------- > > > > -- > > > > -- [INFO] Building Apache Tika parsers 1.8-SNAPSHOT [INFO] > > > > ---------------------- > > > > -------------------------------------------------- > > > > [INFO] > > > > [INFO] --- forbiddenapis:1.7:check (default-cli) @ tika-parsers --- > > > > [INFO] Scanning for classes to check... > > > > [INFO] Reading bundled API signatures: jdk-unsafe [INFO] Reading > > > > bundled API signatures: jdk-deprecated [INFO] Loading classes to > check... > > > > [INFO] Scanning for API signatures and dependencies... > > > > [ERROR] Forbidden method invocation: > > > > java.io.InputStreamReader#<init>(java.io.InputStream) [Uses default > > > > charset] > > > > [ERROR] in org.apache.tika.parser.ocr.TesseractOCRParser$2 > > > > (TesseractOCRParser.java:309) > > > > [ERROR] Forbidden method invocation: > > > > java.lang.String#<init>(byte[],int,int) > > > > [Uses default charset] > > > > [ERROR] in org.apache.tika.parser.chm.accessor. > ChmDirectoryListingSet > > > > (ChmDirectoryListingSet.java:240) > > > > [ERROR] Forbidden method invocation: > > > > java.text.SimpleDateFormat#<init>(java.lang.String) [Uses default > locale] > > > > [ERROR] in > > > > org.apache.tika.parser.image.ImageMetadataExtractor$ExifHandler$1 > > > > (ImageMetadataExtractor.java:304) > > > > [ERROR] Forbidden method invocation: > > > > java.lang.String#format(java.lang.String,java.lang.Object[]) [Uses > > > > default locale] > > > > [ERROR] in org.apache.tika.parser.ocr.TesseractOCRConfig > > > > (TesseractOCRConfig.java:214) > > > > [ERROR] Scanned 281 (and 813 related) class file(s) for forbidden > > > > API invocations (in 0.38s), 4 error(s). > > > > > > > > Uwe > > > > > > > > ----- > > > > Uwe Schindler > > > > H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de > > > > eMail: u...@thetaphi.de > > >