<s> package org . eclipse . jdt . core ; import java . io . IOException ; import java . util . Enumeration ; import java . util . zip . ZipEntry ; import java . util . zip . ZipException ; import java . util . zip . ZipFile ; import org . apache . tools . ant . BuildException ; import org . apache . tools . ant . Task ; import org . eclipse . jdt . core . util . IClassFileReader ; import org . eclipse . jdt . core . util . ICodeAttribute ; import org . eclipse . jdt . core . util . IMethodInfo ; import org . eclipse . jdt . internal . antadapter . AntAdapterMessages ; public final class CheckDebugAttributes extends Task { private String file ; private String property ; public void execute ( ) throws BuildException { if ( this . file == null ) { throw new BuildException ( AntAdapterMessages . getString ( "" ) ) ; } if ( this . property == null ) { throw new BuildException ( AntAdapterMessages . getString ( "" ) ) ; } try { boolean hasDebugAttributes = false ; if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( this . file ) ) { IClassFileReader classFileReader = ToolFactory . createDefaultClassFileReader ( this . file , IClassFileReader . ALL ) ; hasDebugAttributes = checkClassFile ( classFileReader ) ; } else { ZipFile jarFile = null ; try { jarFile = new ZipFile ( this . file ) ; } catch ( ZipException e ) { throw new BuildException ( AntAdapterMessages . getString ( "" ) ) ; } for ( Enumeration entries = jarFile . entries ( ) ; ! hasDebugAttributes && entries . hasMoreElements ( ) ; ) { ZipEntry entry = ( ZipEntry ) entries . nextElement ( ) ; if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( entry . getName ( ) ) ) { IClassFileReader classFileReader = ToolFactory . createDefaultClassFileReader ( this . file , entry . getName ( ) , IClassFileReader . ALL ) ; hasDebugAttributes = checkClassFile ( classFileReader ) ; } } } if ( hasDebugAttributes ) { getProject ( ) . setUserProperty ( this . property , "has debug" ) ; } } catch ( IOException e ) { throw new BuildException ( AntAdapterMessages . getString ( "" ) + this . file ) ; } } private boolean checkClassFile ( IClassFileReader classFileReader ) { IMethodInfo [ ] methodInfos = classFileReader . getMethodInfos ( ) ; for ( int i = 0 , max = methodInfos . length ; i < max ; i ++ ) { ICodeAttribute codeAttribute = methodInfos [ i ] . getCodeAttribute ( ) ; if ( codeAttribute != null && codeAttribute . getLineNumberAttribute ( ) != null ) { return true ; } } return false ; } public void setFile ( String value ) { this . file = value ; } public void setProperty ( String value ) { this . property = value ; } } </s>