Bonjour à tous,
Je suis un nouveau en programmation J2ME et je suis face à un problème.
Je dois capturer le cell Id dans les gsm mais je ne trouve pas les api nécessaires. Alors j'ai décidé de décompiler le JSR179 (capable de le faire mais pour les gsm sophistiqués).
Mon problème maintenant est qu'un des fichiers décompilés représente des instructions comme goto, break Label que mon compilateur ne peut pas compiler.

Alors j'ai besoin d'aide si quelqu'un peut m'aider!!!!

voici le code:
import java.util.Vector;

// Referenced classes of package com.sun.kvem.location:
// PortingLayer

public abstract class LocationProviderImpl extends LocationProvider
implements Runnable
{

public LocationProviderImpl()
{
}

public abstract boolean matchesCriteria(Criteria criteria1);

public abstract int getDefaultInterval();

public abstract int getDefaultMaxAge();

public abstract int getDefaultTimeout();

abstract String getName();

public static Location getLastKnownLocation()
{
PortingLayer.getInstance().checkForPermission(36);
return getLastKnownLocationImpl();
}

static Location getLastKnownLocationImpl()
{
return LastKnownLocation;
}

protected static void setLastKnownLocation(Location newLoc)
{
if(newLoc != null)
LastKnownLocation = newLoc;
}

public Location getLocation(int timeout)
throws LocationException, InterruptedException
{
PortingLayer.getInstance().checkForPermission(36);
Location loc = getLocationImpl(timeout);
setLastKnownLocation(loc);
return loc;
}

protected abstract Location getLocationImpl(int i)
throws LocationException, InterruptedException;

public static LocationProvider getInstance(Criteria criteria)
throws LocationException
{
int oos = 0;
LocationProviderImpl found[] = new LocationProviderImpl[3];
if(criteria == null)
criteria = new Criteria();
LocationProviderImpl providers[] = PortingLayer.getInstance().getProviders();
for(int i = 0; i < providers.length; i++)
{
LocationProviderImpl provider = providers[i];
if(provider.matchesCriteria(criteria))
found[provider.getState() - 1] = provider;
if(provider.getState() == 3)
oos++;
}

if(oos == providers.length)
throw new LocationException("All providers are out of service");
Instance = null;
if(found[0] != null)
Instance = found[0];
else
if(found[1] != null)
Instance = found[1];
return Instance;
}

public LocationListener getLocationListener()
{
return locationListener;
}

public void setLocationListener(LocationListener listener, int interval, int timeout, int maxAge)
{
PortingLayer.getInstance().checkForPermission(36);
PortingLayer.getInstance().registerLocationListener(listener, this);
if(listener == null)
{
locationListener = null;
return;
}
if(interval < -1 || interval != -1 && (timeout > interval || maxAge > interval || timeout < 1 && timeout != -1 || maxAge < 1 && maxAge != -1))
throw new IllegalArgumentException();
if(interval == 0)
{
locationListener = listener;
return;
}
if(interval == -1)
{
interval = getDefaultInterval();
maxAge = getDefaultMaxAge();
timeout = getDefaultTimeout();
}
if(maxAge == -1)
maxAge = getDefaultMaxAge();
if(timeout == -1)
timeout = getDefaultTimeout();
locationListener = listener;
this.interval = interval;
this.timeout = timeout;
this.maxAge = maxAge;
initial = true;
synchronized(this)
{
notify();
}
}

public void run()
{
_L2:{
long clock;
long time;
try
{
label0:{
clock = interval * 1000;
if(locationListener == null || interval == 0)
break MISSING_BLOCK_LABEL_176;
if(clock <= 0L)
break MISSING_BLOCK_LABEL_74;
synchronized(this)
{
initialLocationNotification();
wait(clock);
if(locationListener != null && interval != 0)
break label0;
}
continue; /* Loop/switch isn't completed */
}
}
catch(LocationException le)
{
continue; /* Loop/switch isn't completed */
}
catch(Exception e)
{
e.printStackTrace();
}
continue; /* Loop/switch isn't completed */
LocationProviderImpl locationproviderimpl ;
JVM INSTR monitorexit ;
break MISSING_BLOCK_LABEL_74;
locationproviderimpl;
JVM INSTR monitorexit ;
break MISSING_BLOCK_LABEL_74;
exception;
throw exception;
time = System.currentTimeMillis();
if(currentLocation != null)
{
if(System.currentTimeMillis() - currentLocation.getTimestamp() > (long)(maxAge * 1000))
currentLocation = getLocation(timeout);
} else
{
currentLocation = getLocation(timeout);
}
LastKnownLocation = currentLocation;
locationListener.locationUpdated(this, currentLocation);
clock = (long)(interval * 1000) - (System.currentTimeMillis() - time);
continue; /* Loop/switch isn't completed */
synchronized(this)
{
wait();
}
initialLocationNotification();
continue; /* Loop/switch isn't completed */
if(true){
goto _L2;
}
else{
goto _L1;
}
}
_L1:{}
}

private void initialLocationNotification()
throws LocationException, InterruptedException
{
if(initial)
{
currentLocation = getLocation(timeout);
LastKnownLocation = currentLocation;
locationListener.locationUpdated(this, currentLocation);
initial = false;
}
}

private static Vector proximityListeners = new Vector();
private static Location LastKnownLocation;
private static LocationProviderImpl Instance;
protected LocationListener locationListener;
private int interval;
private int timeout;
private int maxAge;
private Location currentLocation;
protected Criteria criteria;
protected Thread locationThread;
private boolean initial;

}

j'utilise eclipse 3.1, wtk22 , j2sdk1.4.2_12 et DJDec39 comme décompilateur
à +
Miora