Skip to content

Commit

Permalink
防止数据参数被替换
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheedon committed Aug 28, 2020
1 parent a7cfb61 commit a873ee4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
6 changes: 3 additions & 3 deletions seriallibrary/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 6
versionName "1.2.1"
versionCode 7
versionName "1.2.2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
Expand All @@ -31,5 +31,5 @@ dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

implementation 'com.github.Sheedon:SerialDispatcher:1.2.1'
implementation 'com.github.Sheedon:SerialDispatcher:1.3'
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,13 @@ public String getEndBit() {
public void setEndBit(String endBit) {
this.endBit = endBit;
}

public SerialMessage clone(){
SerialMessage message = new SerialMessage();
message.startBit = startBit;
message.messageBit = messageBit;
message.parityBit = parityBit;
message.endBit = endBit;
return message;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ final class ServiceMethod<R, T> {

Request toRequest(@Nullable Object... args) throws IOException {

RequestBuilder requestBuilder = new RequestBuilder(this,serialMessage,
RequestBuilder requestBuilder = new RequestBuilder(this, serialMessage.clone(),
bindCallback);

@SuppressWarnings("unchecked") // It is an error to invoke a method with the wrong arg types.
Expand All @@ -106,7 +106,7 @@ T adapt(Call<R> call) {
return callAdapter.adapt(call);
}

T adapt(Observable<R> observable){
T adapt(Observable<R> observable) {
return callAdapter.adapt(observable);
}

Expand All @@ -124,7 +124,7 @@ String toParityBit(SerialMessage serialMessage) {
return parityBitConverter.convert(serialMessage);
}

String toRequestBody(SerialMessage serialMessage){
String toRequestBody(SerialMessage serialMessage) {
return requestBodyConverter.convert(serialMessage);
}

Expand Down Expand Up @@ -341,7 +341,7 @@ private ParameterHandler<?> parseParameterAnnotation(

Converter<?, String> converter = retrofit.stringConverter(type, annotations);
return new ParameterHandler.Path<>(name, converter, path.encoded());
}else if(annotation instanceof BackPath){
} else if (annotation instanceof BackPath) {
BackPath path = (BackPath) annotation;
String name = path.value();
Converter<?, String> converter = retrofit.stringConverter(type, annotations);
Expand Down

0 comments on commit a873ee4

Please sign in to comment.