+ UndefinedResourceSpec

This commit is contained in:
Ryszard Wiśniewski 2010-03-13 04:05:49 +01:00
parent 2ef47b3f60
commit 440140b082
2 changed files with 43 additions and 2 deletions

View File

@ -0,0 +1,40 @@
/*
* Copyright 2010 Ryszard Wiśniewski <brut.alll@gmail.com>.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* under the License.
*/
package brut.androlib.err;
import brut.androlib.AndrolibException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class UndefinedResourceSpec extends AndrolibException {
public UndefinedResourceSpec(Throwable cause) {
super(cause);
}
public UndefinedResourceSpec(String message, Throwable cause) {
super(message, cause);
}
public UndefinedResourceSpec(String message) {
super(message);
}
public UndefinedResourceSpec() {
}
}

View File

@ -17,6 +17,7 @@
package brut.androlib.res.data; package brut.androlib.res.data;
import brut.androlib.err.UndefinedResourceSpec;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
import brut.androlib.res.data.value.ResFileValue; import brut.androlib.res.data.value.ResFileValue;
import brut.androlib.res.data.value.ResValue; import brut.androlib.res.data.value.ResValue;
@ -58,10 +59,10 @@ public class ResPackage {
return mResSpecs.containsKey(resID); return mResSpecs.containsKey(resID);
} }
public ResResSpec getResSpec(ResID resID) throws AndrolibException { public ResResSpec getResSpec(ResID resID) throws UndefinedResourceSpec {
ResResSpec spec = mResSpecs.get(resID); ResResSpec spec = mResSpecs.get(resID);
if (spec == null) { if (spec == null) {
throw new AndrolibException("Undefined resource spec: " + resID); throw new UndefinedResourceSpec(resID.toString());
} }
return spec; return spec;
} }