Skip to content

Commit

Permalink
Merge pull request #92 from fangyincheng/master
Browse files Browse the repository at this point in the history
Mod:add some exception
  • Loading branch information
wongoo authored Jul 3, 2019
2 parents 7b207b3 + e547dfe commit 96f6e8c
Show file tree
Hide file tree
Showing 88 changed files with 1,471 additions and 128 deletions.
41 changes: 32 additions & 9 deletions java_exception.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ package hessian

import "github.com/dubbogo/hessian2/java_exception"

////////////////////////////
// Throwable interface
////////////////////////////

type Throwabler interface {
Error() string
JavaClassName() string
}

func init() {
RegisterPOJO(&java_exception.Class{})
RegisterPOJO(&java_exception.Throwable{})
Expand Down Expand Up @@ -81,4 +72,36 @@ func init() {
RegisterPOJO(&java_exception.NegativeArraySizeException{})
RegisterPOJO(&java_exception.UnsupportedOperationException{})
RegisterPOJO(&java_exception.ArithmeticException{})
RegisterPOJO(&java_exception.InputMismatchException{})
RegisterPOJO(&java_exception.ExecutionException{})
RegisterPOJO(&java_exception.InvalidPreferencesFormatException{})
RegisterPOJO(&java_exception.TimeoutException{})
RegisterPOJO(&java_exception.BackingStoreException{})
RegisterPOJO(&java_exception.DataFormatException{})
RegisterPOJO(&java_exception.BrokenBarrierException{})
RegisterPOJO(&java_exception.TooManyListenersException{})
RegisterPOJO(&java_exception.InvalidPropertiesFormatException{})
RegisterPOJO(&java_exception.ZipException{})
RegisterPOJO(&java_exception.JarException{})
RegisterPOJO(&java_exception.IllegalClassFormatException{})
RegisterPOJO(&java_exception.ReflectiveOperationException{})
RegisterPOJO(&java_exception.InvocationTargetException{})
RegisterPOJO(&java_exception.NoSuchMethodException{})
RegisterPOJO(&java_exception.NoSuchFieldException{})
RegisterPOJO(&java_exception.IllegalAccessException{})
RegisterPOJO(&java_exception.ClassNotFoundException{})
RegisterPOJO(&java_exception.InstantiationException{})
RegisterPOJO(&java_exception.DateTimeException{})
RegisterPOJO(&java_exception.UnsupportedTemporalTypeException{})
RegisterPOJO(&java_exception.ZoneRulesException{})
RegisterPOJO(&java_exception.DateTimeParseException{})
RegisterPOJO(&java_exception.FormatterClosedException{})
RegisterPOJO(&java_exception.CancellationException{})
RegisterPOJO(&java_exception.UnknownFormatConversionException{})
RegisterPOJO(&java_exception.UnknownFormatFlagsException{})
RegisterPOJO(&java_exception.IllegalFormatFlagsException{})
RegisterPOJO(&java_exception.IllegalFormatPrecisionException{})
RegisterPOJO(&java_exception.IllegalFormatCodePointException{})
RegisterPOJO(&java_exception.MissingFormatArgumentException{})
RegisterPOJO(&java_exception.MissingFormatWidthException{})
}
4 changes: 2 additions & 2 deletions java_exception/arithmetic_exception.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type ArithmeticException struct {
SerialVersionUID int64
DetailMessage string
StackTrace []StackTraceElement
SuppressedExceptions []ArithmeticException
Cause *ArithmeticException
SuppressedExceptions []Throwabler
Cause Throwabler
}

func NewArithmeticException(detailMessage string) *ArithmeticException {
Expand Down
4 changes: 2 additions & 2 deletions java_exception/array_index_out_of_bounds_exception.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type ArrayIndexOutOfBoundsException struct {
SerialVersionUID int64
DetailMessage string
StackTrace []StackTraceElement
SuppressedExceptions []ArrayIndexOutOfBoundsException
Cause *ArrayIndexOutOfBoundsException
SuppressedExceptions []Throwabler
Cause Throwabler
}

func NewArrayIndexOutOfBoundsException(detailMessage string) *ArrayIndexOutOfBoundsException {
Expand Down
4 changes: 2 additions & 2 deletions java_exception/array_store_exception.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type ArrayStoreException struct {
SerialVersionUID int64
DetailMessage string
StackTrace []StackTraceElement
SuppressedExceptions []ArrayStoreException
Cause *ArrayStoreException
SuppressedExceptions []Throwabler
Cause Throwabler
}

func NewArrayStoreException(detailMessage string) *ArrayStoreException {
Expand Down
35 changes: 35 additions & 0 deletions java_exception/backing_store_exception.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2016-2019 Yincheng Fang
//
// 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.

package java_exception

type BackingStoreException struct {
SerialVersionUID int64
DetailMessage string
SuppressedExceptions []Throwabler
StackTrace []StackTraceElement
Cause Throwabler
}

func NewBackingStoreException(detailMessage string) *BackingStoreException {
return &BackingStoreException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}}
}

func (e BackingStoreException) Error() string {
return e.DetailMessage
}

func (BackingStoreException) JavaClassName() string {
return "java.util.prefs.BackingStoreException"
}
35 changes: 35 additions & 0 deletions java_exception/broken_barrier_exception.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2016-2019 Yincheng Fang
//
// 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.

package java_exception

type BrokenBarrierException struct {
SerialVersionUID int64
DetailMessage string
SuppressedExceptions []Throwabler
StackTrace []StackTraceElement
Cause Throwabler
}

func NewBrokenBarrierException(detailMessage string) *BrokenBarrierException {
return &BrokenBarrierException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}}
}

func (e BrokenBarrierException) Error() string {
return e.DetailMessage
}

func (BrokenBarrierException) JavaClassName() string {
return "java.util.concurrent.BrokenBarrierException"
}
35 changes: 35 additions & 0 deletions java_exception/cancellation_exception.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2016-2019 Yincheng Fang
//
// 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.

package java_exception

type CancellationException struct {
SerialVersionUID int64
DetailMessage string
SuppressedExceptions []Throwabler
StackTrace []StackTraceElement
Cause Throwabler
}

func NewCancellationException(detailMessage string) *CancellationException {
return &CancellationException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}}
}

func (e CancellationException) Error() string {
return e.DetailMessage
}

func (CancellationException) JavaClassName() string {
return "java.util.concurrent.CancellationException"
}
36 changes: 36 additions & 0 deletions java_exception/class_not_found_exception.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2016-2019 Yincheng Fang
//
// 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.

package java_exception

type ClassNotFoundException struct {
SerialVersionUID int64
DetailMessage string
SuppressedExceptions []Throwabler
StackTrace []StackTraceElement
Cause Throwabler
Ex Throwabler
}

func NewClassNotFoundException(detailMessage string, ex Throwabler) *ClassNotFoundException {
return &ClassNotFoundException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}, Ex: ex}
}

func (e ClassNotFoundException) Error() string {
return e.DetailMessage
}

func (ClassNotFoundException) JavaClassName() string {
return "java.lang.ClassNotFoundException"
}
4 changes: 2 additions & 2 deletions java_exception/classc_cast_exception.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type ClassCastException struct {
SerialVersionUID int64
DetailMessage string
StackTrace []StackTraceElement
SuppressedExceptions []ClassCastException
Cause *ClassCastException
SuppressedExceptions []Throwabler
Cause Throwabler
}

func NewClassCastException(detailMessage string) *ClassCastException {
Expand Down
4 changes: 2 additions & 2 deletions java_exception/clone_not_supported_exception.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ package java_exception
type CloneNotSupportedException struct {
SerialVersionUID int64
DetailMessage string
SuppressedExceptions []CloneNotSupportedException
SuppressedExceptions []Throwabler
StackTrace []StackTraceElement
Cause *CloneNotSupportedException
Cause Throwabler
}

func NewCloneNotSupportedException(detailMessage string) *CloneNotSupportedException {
Expand Down
4 changes: 2 additions & 2 deletions java_exception/completion_exception.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ package java_exception
type CompletionException struct {
SerialVersionUID int64
DetailMessage string
SuppressedExceptions []Exception
SuppressedExceptions []Throwabler
StackTrace []StackTraceElement
Cause *Throwable
Cause Throwabler
}

func (e CompletionException) Error() string {
Expand Down
4 changes: 2 additions & 2 deletions java_exception/concurrent_modification_exception.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ package java_exception
type ConcurrentModificationException struct {
SerialVersionUID int64
DetailMessage string
SuppressedExceptions []Exception
SuppressedExceptions []Throwabler
StackTrace []StackTraceElement
Cause *ConcurrentModificationException
Cause Throwabler
}

func (e ConcurrentModificationException) Error() string {
Expand Down
35 changes: 35 additions & 0 deletions java_exception/data_format_exception.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2016-2019 Yincheng Fang
//
// 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.

package java_exception

type DataFormatException struct {
SerialVersionUID int64
DetailMessage string
SuppressedExceptions []Throwabler
StackTrace []StackTraceElement
Cause Throwabler
}

func NewDataFormatException(detailMessage string) *DataFormatException {
return &DataFormatException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}}
}

func (e DataFormatException) Error() string {
return e.DetailMessage
}

func (DataFormatException) JavaClassName() string {
return "java.util.zip.DataFormatException"
}
35 changes: 35 additions & 0 deletions java_exception/date_time_exception.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2016-2019 Yincheng Fang
//
// 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.

package java_exception

type DateTimeException struct {
SerialVersionUID int64
DetailMessage string
SuppressedExceptions []Throwabler
StackTrace []StackTraceElement
Cause Throwabler
}

func NewDateTimeException(detailMessage string) *DateTimeException {
return &DateTimeException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}}
}

func (e DateTimeException) Error() string {
return e.DetailMessage
}

func (DateTimeException) JavaClassName() string {
return "java.time.DateTimeException"
}
37 changes: 37 additions & 0 deletions java_exception/date_time_parse_exception.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2016-2019 Yincheng Fang
//
// 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.

package java_exception

type DateTimeParseException struct {
SerialVersionUID int64
DetailMessage string
SuppressedExceptions []Throwabler
StackTrace []StackTraceElement
Cause Throwabler
ParsedString string
ErrorIndex int32
}

func NewDateTimeParseException(detailMessage string, parsedString string, errorIndex int32) *DateTimeParseException {
return &DateTimeParseException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}, ParsedString: parsedString, ErrorIndex: errorIndex}
}

func (e DateTimeParseException) Error() string {
return e.DetailMessage
}

func (DateTimeParseException) JavaClassName() string {
return "java.time.format.DateTimeParseException"
}
4 changes: 2 additions & 2 deletions java_exception/duplicate_format_flags_exception.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ type DuplicateFormatFlagsException struct {
SerialVersionUID int64
Flags string
DetailMessage string
SuppressedExceptions []Exception
SuppressedExceptions []Throwabler
StackTrace []StackTraceElement
Cause *DuplicateFormatFlagsException
Cause Throwabler
}

func (e DuplicateFormatFlagsException) Error() string {
Expand Down
Loading

0 comments on commit 96f6e8c

Please sign in to comment.