├── .asf.yaml ├── .github ├── ISSUE_TEMPLATE │ ├── bug-report.md │ └── enhancement.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ └── github-actions.yml ├── .gitignore ├── .golangci.yml ├── CHANGE.md ├── LICENSE ├── Makefile ├── NOTICE ├── README.md ├── array.go ├── array_test.go ├── before_validate_license.sh ├── binary.go ├── binary_test.go ├── boolean.go ├── boolean_test.go ├── codec.go ├── codec_test.go ├── const.go ├── contributing.md ├── date.go ├── date_test.go ├── decode.go ├── decode_test.go ├── doc.go ├── double.go ├── double_test.go ├── encode.go ├── encode_test.go ├── go.mod ├── go.sum ├── hessian_demo └── loop_encode_decode_test.go ├── hessian_test ├── dup_struct_name_test.go └── hessian_test │ └── dupclass.go ├── int.go ├── int_test.go ├── java8_time.go ├── java8_time ├── duration.go ├── instant.go ├── local_date.go ├── local_date_time.go ├── local_time.go ├── month_day.go ├── offset_date_time.go ├── offset_time.go ├── period.go ├── year.go ├── year_month.go ├── zone_off_set.go └── zoned_date_time.go ├── java8_time_test.go ├── java_collection.go ├── java_collection_test.go ├── java_exception.go ├── java_exception ├── annotation_type_mismatch_exception.go ├── arithmetic_exception.go ├── array_index_out_of_bounds_exception.go ├── array_store_exception.go ├── backing_store_exception.go ├── broken_barrier_exception.go ├── cancellation_exception.go ├── class_not_found_exception.go ├── classc_cast_exception.go ├── clone_not_supported_exception.go ├── completion_exception.go ├── concurrent_modification_exception.go ├── data_format_exception.go ├── date_time_exception.go ├── date_time_parse_exception.go ├── dubbo_generic_exception.go ├── duplicate_format_flags_exception.go ├── empty_stack_exception.go ├── enum_constant_not_present_exception.go ├── eof_exception.go ├── exception.go ├── execution_exception.go ├── file_not_found_exception.go ├── formatter_closed_exception.go ├── illegal_access_exception.go ├── illegal_argument_exception.go ├── illegal_classFormat_exception.go ├── illegal_format_code_point_exception.go ├── illegal_format_conversion_exception.go ├── illegal_format_flags_exception.go ├── illegal_format_precision_exception.go ├── illegal_format_width_exception.go ├── illegal_monitor_state_exception.go ├── illegal_state_exception.go ├── illegal_thread_state_exception.go ├── illformed_locale_exception.go ├── incomplete_annotation_exception.go ├── index_out_of_bounds_exception.go ├── input_mismatch_exception.go ├── instantiation_exception.go ├── interrupted_exception.go ├── interrupted_io_exception.go ├── invalid_class_exception.go ├── invalid_object_exception.go ├── invalid_preferences_format_exception.go ├── invalid_properties_format_exception.go ├── invocation_target_exception.go ├── io_exception.go ├── jar_exception.go ├── lambda_conversion_exception.go ├── malformed_parameterized_type_exception.go ├── malformed_parameters_exception.go ├── missing_format_argument_exception.go ├── missing_format_width_exception.go ├── missing_resource_exception.go ├── negative_array_size_exception.go ├── no_such_element_exception.go ├── no_such_field_exception.go ├── no_such_method_exception.go ├── not_active_exception.go ├── not_serializable_exception.go ├── null_pointer_exception.go ├── number_format_exception.go ├── object_stream_exception.go ├── optional_data_exception.go ├── reflective_operation_exception.go ├── rejected_execution_exception.go ├── runtime_exception.go ├── security_exception.go ├── stream_corrupted_exception.go ├── string_index_out_of_bounds_exception.go ├── sync_failed_exception.go ├── timeout_exception.go ├── too_many_listeners_exception.go ├── type_not_present_exception.go ├── unchecked_IO_exception.go ├── undeclared_throwable_exception.go ├── unknown_format_conversion_exception.go ├── unknown_format_flags_exception.go ├── unmodifiable_class_exception.go ├── unsupported_operation_exception.go ├── unsupported_temporal_type_exception.go ├── utf_data_format_exception.go ├── write_aborted_exception.go ├── wrong_method_type_exception.go ├── zip_exception.go └── zone_rules_exception.go ├── java_exception_test.go ├── java_lang.go ├── java_lang_test.go ├── java_sql_time.go ├── java_sql_time ├── date.go ├── java_sql_time.go └── time.go ├── java_sql_time_test.go ├── java_unknown_exception.go ├── java_unknown_exception_test.go ├── java_util.go ├── java_util ├── README.md ├── README_CN.md ├── locale.go └── uuid.go ├── java_util_test.go ├── list.go ├── list_test.go ├── long.go ├── long_test.go ├── map.go ├── map_test.go ├── null.go ├── null_test.go ├── object.go ├── object_test.go ├── output ├── output.go └── testfuncs │ ├── java8_time.go │ ├── java_exception.go │ ├── list.go │ ├── object.go │ ├── string.go │ ├── user.go │ └── wrapper_class_array.go ├── param.go ├── pojo.go ├── pojo_test.go ├── ref.go ├── ref_test.go ├── serialize.go ├── serialize_test.go ├── string.go ├── string_test.go ├── test_dubbo ├── .gitignore ├── README.md ├── pom.xml └── src │ └── main │ └── java │ └── test │ ├── Dubbo.java │ ├── SimpleChannel.java │ └── TestDubbo.java ├── test_hessian ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ └── java │ │ └── test │ │ ├── Hessian.java │ │ ├── HessianTool.java │ │ ├── HexTool.java │ │ ├── TestCustomDecode.java │ │ ├── TestCustomReply.java │ │ ├── TestJava8Time.java │ │ ├── TestJavaSqlTime.java │ │ ├── TestString.java │ │ ├── TestThrowable.java │ │ ├── TestWrapperClassArray.java │ │ ├── UserDefindException.java │ │ ├── generic │ │ ├── BusinessData.java │ │ └── Response.java │ │ ├── model │ │ ├── CustomMap.java │ │ ├── DateDemo.java │ │ ├── JavaLangObjectHolder.java │ │ └── User.java │ │ ├── tuple │ │ ├── Tuple.java │ │ ├── TupleProvider.java │ │ └── TupleProviderImpl.java │ │ └── util │ │ └── JavaHessianUtil.java │ └── test │ └── java │ └── unit │ ├── GoJava8TimeTest.java │ ├── GoJavaExceptionTest.java │ ├── GoObjectTest.java │ ├── GoStringTest.java │ ├── GoTestUtil.java │ ├── GoUserListTest.java │ └── GoWrapperClassArrayTest.java ├── testcases ├── issue340 │ └── issue340_test.go ├── issue356 │ └── issue356_test.go └── user │ ├── user.go │ └── user_test.go └── tools └── gen-go-enum ├── README.md └── main.go /.asf.yaml: -------------------------------------------------------------------------------- 1 | notifications: 2 | commits: commits@dubbo.apache.org 3 | issues: notifications@dubbo.apache.org 4 | pullrequests: notifications@dubbo.apache.org 5 | jira_options: link label link label 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Report a bug 4 | labels: kind/bug 5 | 6 | --- 7 | 8 | 11 | 12 | 13 | **What happened**: 14 | 15 | **What you expected to happen**: 16 | 17 | **How to reproduce it (as minimally and precisely as possible)**: 18 | 19 | **Anything else we need to know?**: 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/enhancement.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Enhancement Request 3 | about: Suggest an enhancement 4 | labels: kind/feature 5 | 6 | --- 7 | 8 | 9 | **What would you like to be added**: 10 | 11 | **Why is this needed**: -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 3 | 4 | **What this PR does**: 5 | 6 | **Which issue(s) this PR fixes**: 7 | 12 | Fixes # 13 | 14 | **Special notes for your reviewer**: 15 | 16 | **Does this PR introduce a user-facing change?**: 17 | 22 | ```release-note 23 | 24 | ``` -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | vendor 3 | coverage.txt 4 | -------------------------------------------------------------------------------- /.golangci.yml: -------------------------------------------------------------------------------- 1 | linters-settings: 2 | govet: 3 | check-shadowing: true 4 | golint: 5 | min-confidence: 0 6 | gocyclo: 7 | min-complexity: 10 8 | maligned: 9 | suggest-new: true 10 | dupl: 11 | threshold: 100 12 | goconst: 13 | min-len: 2 14 | min-occurrences: 2 15 | depguard: 16 | list-type: blacklist 17 | packages: 18 | # logging is allowed only by logutils.Log, logrus 19 | # is allowed to use only in logutils package 20 | - github.com/sirupsen/logrus 21 | misspell: 22 | locale: US 23 | lll: 24 | line-length: 140 25 | goimports: 26 | local-prefixes: github.com/golangci/golangci-lint 27 | gocritic: 28 | enabled-tags: 29 | - performance 30 | - style 31 | - experimental 32 | disabled-checks: 33 | - wrapperFunc 34 | 35 | linters: 36 | disable-all: true 37 | enable: 38 | - govet 39 | - staticcheck 40 | - ineffassign 41 | - misspell 42 | 43 | run: 44 | skip-dirs: 45 | - test/testdata_etc 46 | - pkg/golinters/goanalysis/(checker|passes) 47 | 48 | issues: 49 | exclude-rules: 50 | - text: "weak cryptographic primitive" 51 | linters: 52 | - gosec 53 | 54 | # golangci.com configuration 55 | # https://github.com/golangci/golangci/wiki/Configuration 56 | service: 57 | golangci-lint-version: 1.15.x # use the fixed version to not introduce new linters unexpectedly 58 | prepare: 59 | - echo "here I can run custom commands, but no preparation needed for this repo" 60 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | lint: 17 | gometalinter ./ | grep -v ALL_CAPS|grep -v underscores|grep -v unhandled|grep -v 'not checked' |grep -v unsafe | grep -v unused 18 | 19 | lint2: 20 | golangci-lint run 21 | 22 | format: 23 | gofmt -l -w . 24 | 25 | test: 26 | go test ./... -v 27 | 28 | all: format test -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Apache Dubbo Go Hessian2 2 | Copyright 2018-2020 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /before_validate_license.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | remoteLicenseCheckerPath="https://github.com/dubbogo/resources/raw/master/tools/license" 18 | remoteLicenseCheckerName="license-header-checker" 19 | remoteLicenseCheckerURL="${remoteLicenseCheckerPath}/${remoteLicenseCheckerName}" 20 | remoteLicenseName="license.txt" 21 | remoteLicenseURL="${remoteLicenseCheckerPath}/${remoteLicenseName}" 22 | 23 | licensePath="/tmp/tools/license" 24 | mkdir -p ${licensePath} 25 | wget -P "${licensePath}" ${remoteLicenseCheckerURL} 26 | wget -P "${licensePath}" ${remoteLicenseURL} 27 | -------------------------------------------------------------------------------- /boolean.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package hessian 19 | 20 | ///////////////////////////////////////// 21 | // Bool 22 | ///////////////////////////////////////// 23 | 24 | // # boolean true/false 25 | // ::= 'T' 26 | // ::= 'F' 27 | func encBool(b []byte, v bool) []byte { 28 | c := BC_FALSE 29 | if v { 30 | c = BC_TRUE 31 | } 32 | 33 | return append(b, c) 34 | } 35 | -------------------------------------------------------------------------------- /boolean_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package hessian 19 | 20 | import ( 21 | "testing" 22 | ) 23 | 24 | func TestEncBool(t *testing.T) { 25 | var ( 26 | e *Encoder 27 | want []byte 28 | ) 29 | 30 | e = NewEncoder() 31 | e.Encode(true) 32 | if e.Buffer()[0] != 'T' { 33 | t.Fail() 34 | } 35 | want = []byte{0x54} 36 | assertEqual(want, e.Buffer(), t) 37 | 38 | e = NewEncoder() 39 | e.Encode(false) 40 | if e.Buffer()[0] != 'F' { 41 | t.Fail() 42 | } 43 | want = []byte{0x46} 44 | assertEqual(want, e.Buffer(), t) 45 | } 46 | 47 | func TestBoolean(t *testing.T) { 48 | testDecodeFramework(t, "replyFalse", false) 49 | testDecodeFramework(t, "replyTrue", true) 50 | } 51 | 52 | func TestBooleanEncode(t *testing.T) { 53 | testJavaDecode(t, "argFalse", false) 54 | testJavaDecode(t, "argTrue", true) 55 | } 56 | -------------------------------------------------------------------------------- /doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package hessian 19 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/apache/dubbo-go-hessian2 2 | 3 | require ( 4 | github.com/dubbogo/gost v1.13.1 5 | github.com/pkg/errors v0.9.1 6 | github.com/stretchr/testify v1.7.0 7 | ) 8 | -------------------------------------------------------------------------------- /hessian_test/dup_struct_name_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package hessian_test 19 | 20 | import ( 21 | "testing" 22 | ) 23 | 24 | import ( 25 | "github.com/apache/dubbo-go-hessian2" 26 | dupclass "github.com/apache/dubbo-go-hessian2/hessian_test/hessian_test" 27 | ) 28 | 29 | import ( 30 | "github.com/stretchr/testify/assert" 31 | ) 32 | 33 | const ( 34 | ExpectedErrorMsg = "reflect.Set: value of type hessian_test.CaseZ is not assignable to type hessian_test.CaseZ" 35 | ) 36 | 37 | type CaseZ struct { 38 | Name string 39 | } 40 | 41 | func (CaseZ) JavaClassName() string { 42 | return "com.test.caseZ" 43 | } 44 | 45 | func TestDuplicatedClassGetGoType(t *testing.T) { 46 | assert.Equal(t, "github.com/apache/dubbo-go-hessian2/hessian_test_test/hessian_test.CaseZ", hessian.GetGoType(&CaseZ{})) 47 | assert.Equal(t, "github.com/apache/dubbo-go-hessian2/hessian_test/hessian_test/hessian_test.CaseZ", hessian.GetGoType(&dupclass.CaseZ{})) 48 | } 49 | -------------------------------------------------------------------------------- /hessian_test/hessian_test/dupclass.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package hessian_test 19 | 20 | type CaseZ struct { 21 | Name string 22 | Age int 23 | } 24 | 25 | func (CaseZ) JavaClassName() string { 26 | return "com.test.caseZz" 27 | } 28 | -------------------------------------------------------------------------------- /java8_time/duration.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java8_time 19 | 20 | type Duration struct { 21 | Seconds int64 `hessian:"seconds"` 22 | Nanos int32 `hessian:"nanos"` 23 | } 24 | 25 | func (Duration) JavaClassName() string { 26 | return "com.alibaba.com.caucho.hessian.io.java8.DurationHandle" 27 | } 28 | 29 | func (Duration) Error() string { 30 | return "encode Duration error" 31 | } 32 | -------------------------------------------------------------------------------- /java8_time/instant.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java8_time 19 | 20 | type Instant struct { 21 | Seconds int64 `hessian:"seconds"` 22 | Nanos int32 `hessian:"nanos"` 23 | } 24 | 25 | func (Instant) JavaClassName() string { 26 | return "com.alibaba.com.caucho.hessian.io.java8.InstantHandle" 27 | } 28 | 29 | func (Instant) Error() string { 30 | return "encode Instant error" 31 | } 32 | -------------------------------------------------------------------------------- /java8_time/local_date.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java8_time 19 | 20 | type LocalDate struct { 21 | Year int32 `hessian:"year"` 22 | Month int32 `hessian:"month"` 23 | Day int32 `hessian:"day"` 24 | } 25 | 26 | func (LocalDate) JavaClassName() string { 27 | return "com.alibaba.com.caucho.hessian.io.java8.LocalDateHandle" 28 | } 29 | 30 | func (LocalDate) Error() string { 31 | return "encode LocalDate error" 32 | } 33 | -------------------------------------------------------------------------------- /java8_time/local_date_time.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java8_time 19 | 20 | type LocalDateTime struct { 21 | Date LocalDate `hessian:"date"` 22 | Time LocalTime `hessian:"time"` 23 | } 24 | 25 | func (LocalDateTime) JavaClassName() string { 26 | return "com.alibaba.com.caucho.hessian.io.java8.LocalDateTimeHandle" 27 | } 28 | 29 | func (LocalDateTime) Error() string { 30 | return "encode LocalDateTime error" 31 | } 32 | -------------------------------------------------------------------------------- /java8_time/local_time.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java8_time 19 | 20 | type LocalTime struct { 21 | Hour int32 `hessian:"hour"` 22 | Minute int32 `hessian:"minute"` 23 | Second int32 `hessian:"second"` 24 | Nano int32 `hessian:"nano"` 25 | } 26 | 27 | func (LocalTime) JavaClassName() string { 28 | return "com.alibaba.com.caucho.hessian.io.java8.LocalTimeHandle" 29 | } 30 | 31 | func (LocalTime) Error() string { 32 | return "encode LocalTime error" 33 | } 34 | -------------------------------------------------------------------------------- /java8_time/month_day.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java8_time 19 | 20 | type MonthDay struct { 21 | Month int32 `hessian:"month"` 22 | Day int32 `hessian:"day"` 23 | } 24 | 25 | func (MonthDay) JavaClassName() string { 26 | return "com.alibaba.com.caucho.hessian.io.java8.MonthDayHandle" 27 | } 28 | 29 | func (MonthDay) Error() string { 30 | return "encode MonthDay error" 31 | } 32 | -------------------------------------------------------------------------------- /java8_time/offset_date_time.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java8_time 19 | 20 | type OffsetDateTime struct { 21 | DateTime LocalDateTime `hessian:"dateTime"` 22 | Offset ZoneOffSet `hessian:"offset"` 23 | } 24 | 25 | func (OffsetDateTime) JavaClassName() string { 26 | return "com.alibaba.com.caucho.hessian.io.java8.OffsetDateTimeHandle" 27 | } 28 | 29 | func (OffsetDateTime) Error() string { 30 | return "encode OffsetDateTime error" 31 | } 32 | -------------------------------------------------------------------------------- /java8_time/offset_time.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java8_time 19 | 20 | type OffsetTime struct { 21 | LocalTime LocalTime `hessian:"localTime"` 22 | ZoneOffset ZoneOffSet `hessian:"zoneOffset"` 23 | } 24 | 25 | func (OffsetTime) JavaClassName() string { 26 | return "com.alibaba.com.caucho.hessian.io.java8.OffsetTimeHandle" 27 | } 28 | 29 | func (OffsetTime) Error() string { 30 | return "encode OffsetDateTime error" 31 | } 32 | -------------------------------------------------------------------------------- /java8_time/period.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package java8_time 18 | 19 | // java8-time java.time.Period 20 | type Period struct { 21 | Days int32 `hessian:"days"` 22 | Months int32 `hessian:"months"` 23 | Years int32 `hessian:"years"` 24 | } 25 | 26 | func (Period) JavaClassName() string { 27 | return "com.alibaba.com.caucho.hessian.io.java8.PeriodHandle" 28 | } 29 | 30 | func (Period) Error() string { 31 | return "encode Period error" 32 | } 33 | -------------------------------------------------------------------------------- /java8_time/year.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package java8_time 18 | 19 | // java8-time java.time.Year 20 | type Year struct { 21 | Year int32 `hessian:"year"` 22 | } 23 | 24 | func (Year) JavaClassName() string { 25 | return "com.alibaba.com.caucho.hessian.io.java8.YearHandle" 26 | } 27 | 28 | func (Year) Error() string { 29 | return "encode Year error" 30 | } 31 | -------------------------------------------------------------------------------- /java8_time/year_month.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package java8_time 18 | 19 | // java8-time java.time.YearMonth 20 | type YearMonth struct { 21 | Month int32 `hessian:"month"` 22 | Year int32 `hessian:"year"` 23 | } 24 | 25 | func (YearMonth) JavaClassName() string { 26 | return "com.alibaba.com.caucho.hessian.io.java8.YearMonthHandle" 27 | } 28 | 29 | func (YearMonth) Error() string { 30 | return "encode YearMonth error" 31 | } 32 | -------------------------------------------------------------------------------- /java8_time/zone_off_set.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java8_time 19 | 20 | type ZoneOffSet struct { 21 | Seconds int32 `hessian:"seconds"` 22 | } 23 | 24 | func (ZoneOffSet) JavaClassName() string { 25 | return "com.alibaba.com.caucho.hessian.io.java8.ZoneOffsetHandle" 26 | } 27 | 28 | func (ZoneOffSet) Error() string { 29 | return "encode ZoneOffSet error" 30 | } 31 | -------------------------------------------------------------------------------- /java8_time/zoned_date_time.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java8_time 19 | 20 | type ZonedDateTime struct { 21 | DateTime LocalDateTime `hessian:"dateTime"` 22 | Offset ZoneOffSet `hessian:"offset"` 23 | ZoneId string `hessian:"zoneId"` 24 | } 25 | 26 | func (ZonedDateTime) JavaClassName() string { 27 | return "com.alibaba.com.caucho.hessian.io.java8.ZonedDateTimeHandle" 28 | } 29 | 30 | func (ZonedDateTime) Error() string { 31 | return "encode ZonedDateTime error" 32 | } 33 | -------------------------------------------------------------------------------- /java_collection_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package hessian 19 | 20 | import ( 21 | "testing" 22 | ) 23 | 24 | func init() { 25 | SetCollectionSerialize(&JavaHashSet{}) 26 | } 27 | 28 | type JavaHashSet struct { 29 | value []interface{} 30 | } 31 | 32 | func (j *JavaHashSet) Get() []interface{} { 33 | return j.value 34 | } 35 | 36 | func (j *JavaHashSet) Set(v []interface{}) { 37 | j.value = v 38 | } 39 | 40 | func (j *JavaHashSet) JavaClassName() string { 41 | return "java.util.HashSet" 42 | } 43 | 44 | func TestListJavaCollectionEncode(t *testing.T) { 45 | inside := make([]interface{}, 2) 46 | inside[0] = int32(0) 47 | inside[1] = int32(1) 48 | hashSet := JavaHashSet{value: inside} 49 | testJavaDecode(t, "customArgTypedFixedList_HashSet", &hashSet) 50 | } 51 | 52 | func TestListJavaCollectionDecode(t *testing.T) { 53 | inside := make([]interface{}, 2) 54 | inside[0] = int32(0) 55 | inside[1] = int32(1) 56 | hashSet := JavaHashSet{value: inside} 57 | testDecodeFramework(t, "customReplyTypedFixedList_HashSet", &hashSet) 58 | } 59 | -------------------------------------------------------------------------------- /java_exception/arithmetic_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // ArithmeticException represents an exception of the same name in java 21 | type ArithmeticException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewArithmeticException is the constructor 30 | func NewArithmeticException(detailMessage string) *ArithmeticException { 31 | return &ArithmeticException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e ArithmeticException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (ArithmeticException) JavaClassName() string { 41 | return "java.lang.ArithmeticException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e ArithmeticException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/array_index_out_of_bounds_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // ArrayIndexOutOfBoundsException represents an exception of the same name in java 21 | type ArrayIndexOutOfBoundsException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewArrayIndexOutOfBoundsException is the constructor 30 | func NewArrayIndexOutOfBoundsException(detailMessage string) *ArrayIndexOutOfBoundsException { 31 | return &ArrayIndexOutOfBoundsException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e ArrayIndexOutOfBoundsException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (ArrayIndexOutOfBoundsException) JavaClassName() string { 41 | return "java.lang.ArrayIndexOutOfBoundsException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e ArrayIndexOutOfBoundsException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/array_store_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // ArrayStoreException represents an exception of the same name in java 21 | type ArrayStoreException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewArrayStoreException is the constructor 30 | func NewArrayStoreException(detailMessage string) *ArrayStoreException { 31 | return &ArrayStoreException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e ArrayStoreException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (ArrayStoreException) JavaClassName() string { 41 | return "java.lang.ArrayStoreException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e ArrayStoreException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/backing_store_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // BackingStoreException represents an exception of the same name in java 21 | type BackingStoreException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewBackingStoreException is the constructor 30 | func NewBackingStoreException(detailMessage string) *BackingStoreException { 31 | return &BackingStoreException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e BackingStoreException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (BackingStoreException) JavaClassName() string { 41 | return "java.util.prefs.BackingStoreException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e BackingStoreException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/broken_barrier_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // BrokenBarrierException represents an exception of the same name in java 21 | type BrokenBarrierException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewBrokenBarrierException is the constructor 30 | func NewBrokenBarrierException(detailMessage string) *BrokenBarrierException { 31 | return &BrokenBarrierException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e BrokenBarrierException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (BrokenBarrierException) JavaClassName() string { 41 | return "java.util.concurrent.BrokenBarrierException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e BrokenBarrierException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/cancellation_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // CancellationException represents an exception of the same name in java 21 | type CancellationException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewCancellationException is the constructor 30 | func NewCancellationException(detailMessage string) *CancellationException { 31 | return &CancellationException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e CancellationException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (CancellationException) JavaClassName() string { 41 | return "java.util.concurrent.CancellationException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e CancellationException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/class_not_found_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // ClassNotFoundException represents an exception of the same name in java 21 | type ClassNotFoundException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | Ex Throwabler 28 | } 29 | 30 | // NewClassNotFoundException is the constructor 31 | func NewClassNotFoundException(detailMessage string, ex Throwabler) *ClassNotFoundException { 32 | return &ClassNotFoundException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}, Ex: ex} 33 | } 34 | 35 | // Error output error message 36 | func (e ClassNotFoundException) Error() string { 37 | return e.DetailMessage 38 | } 39 | 40 | // JavaClassName java fully qualified path 41 | func (ClassNotFoundException) JavaClassName() string { 42 | return "java.lang.ClassNotFoundException" 43 | } 44 | 45 | // equals to getStackTrace in java 46 | func (e ClassNotFoundException) GetStackTrace() []StackTraceElement { 47 | return e.StackTrace 48 | } 49 | -------------------------------------------------------------------------------- /java_exception/classc_cast_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // ClassCastException represents an exception of the same name in java 21 | type ClassCastException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewClassCastException is the constructor 30 | func NewClassCastException(detailMessage string) *ClassCastException { 31 | return &ClassCastException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e ClassCastException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (ClassCastException) JavaClassName() string { 41 | return "java.lang.ClassCastException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e ClassCastException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/completion_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // CompletionException represents an exception of the same name in java 21 | type CompletionException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // Error output error message 30 | func (e CompletionException) Error() string { 31 | return e.DetailMessage 32 | } 33 | 34 | // JavaClassName java fully qualified path 35 | func (CompletionException) JavaClassName() string { 36 | return "java.util.concurrent.CompletionException" 37 | } 38 | 39 | // NewCompletionException is the constructor 40 | func NewCompletionException(detailMessage string) *CompletionException { 41 | return &CompletionException{DetailMessage: detailMessage} 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e CompletionException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/concurrent_modification_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // ConcurrentModificationException represents an exception of the same name in java 21 | type ConcurrentModificationException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // Error output error message 30 | func (e ConcurrentModificationException) Error() string { 31 | return e.DetailMessage 32 | } 33 | 34 | // JavaClassName java fully qualified path 35 | func (ConcurrentModificationException) JavaClassName() string { 36 | return "java.util.ConcurrentModificationException" 37 | } 38 | 39 | // NewConcurrentModificationException is the constructor 40 | func NewConcurrentModificationException(detailMessage string) *ConcurrentModificationException { 41 | return &ConcurrentModificationException{DetailMessage: detailMessage} 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e ConcurrentModificationException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/data_format_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // DataFormatException represents an exception of the same name in java 21 | type DataFormatException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewDataFormatException is the constructor 30 | func NewDataFormatException(detailMessage string) *DataFormatException { 31 | return &DataFormatException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e DataFormatException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (DataFormatException) JavaClassName() string { 41 | return "java.util.zip.DataFormatException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e DataFormatException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/date_time_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // DateTimeException represents an exception of the same name in java 21 | type DateTimeException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewDateTimeException is the constructor 30 | func NewDateTimeException(detailMessage string) *DateTimeException { 31 | return &DateTimeException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e DateTimeException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (DateTimeException) JavaClassName() string { 41 | return "java.time.DateTimeException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e DateTimeException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/dubbo_generic_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // DubboGenericException represents an exception of the same name in java 21 | type DubboGenericException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | ExceptionClass string 28 | ExceptionMessage string 29 | } 30 | 31 | // NewDubboGenericException is the constructor 32 | func NewDubboGenericException(exceptionClass, exceptionMessage string) *DubboGenericException { 33 | return &DubboGenericException{ExceptionClass: exceptionClass, ExceptionMessage: exceptionMessage} 34 | } 35 | 36 | // Error output error message 37 | func (e DubboGenericException) Error() string { 38 | return e.DetailMessage 39 | } 40 | 41 | // JavaClassName java fully qualified path 42 | func (DubboGenericException) JavaClassName() string { 43 | return "com.alibaba.dubbo.rpc.service.GenericException" 44 | } 45 | 46 | // equals to getStackTrace in java 47 | func (e DubboGenericException) GetStackTrace() []StackTraceElement { 48 | return e.StackTrace 49 | } 50 | -------------------------------------------------------------------------------- /java_exception/empty_stack_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // EmptyStackException represents an exception of the same name in java 21 | type EmptyStackException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // Error output error message 30 | func (e EmptyStackException) Error() string { 31 | return "EmptyStackException" 32 | } 33 | 34 | // JavaClassName java fully qualified path 35 | func (EmptyStackException) JavaClassName() string { 36 | return "java.util.EmptyStackException" 37 | } 38 | 39 | // NewEmptyStackException is the constructor 40 | func NewEmptyStackException(detailMessage string) *EmptyStackException { 41 | return &EmptyStackException{DetailMessage: detailMessage} 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e EmptyStackException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/eof_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // EOFException represents an exception of the same name in java 21 | type EOFException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewEOFException is the constructor 30 | func NewEOFException(detailMessage string) *EOFException { 31 | return &EOFException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e EOFException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (EOFException) JavaClassName() string { 41 | return "java.io.EOFException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e EOFException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/execution_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // ExecutionException represents an exception of the same name in java 21 | type ExecutionException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewExecutionException is the constructor 30 | func NewExecutionException(detailMessage string) *ExecutionException { 31 | return &ExecutionException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e ExecutionException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (ExecutionException) JavaClassName() string { 41 | return "java.util.concurrent.ExecutionException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e ExecutionException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/file_not_found_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // FileNotFoundException represents an exception of the same name in java 21 | type FileNotFoundException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewFileNotFoundException is the constructor 30 | func NewFileNotFoundException(detailMessage string) *FileNotFoundException { 31 | return &FileNotFoundException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e FileNotFoundException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (FileNotFoundException) JavaClassName() string { 41 | return "java.io.FileNotFoundException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e FileNotFoundException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/formatter_closed_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // FormatterClosedException represents an exception of the same name in java 21 | type FormatterClosedException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewFormatterClosedException is the constructor 30 | func NewFormatterClosedException() *FormatterClosedException { 31 | return &FormatterClosedException{StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e FormatterClosedException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (FormatterClosedException) JavaClassName() string { 41 | return "java.util.FormatterClosedException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e FormatterClosedException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/illegal_access_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // IllegalAccessException represents an exception of the same name in java 21 | type IllegalAccessException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewIllegalAccessException is the constructor 30 | func NewIllegalAccessException(detailMessage string) *IllegalAccessException { 31 | return &IllegalAccessException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e IllegalAccessException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (IllegalAccessException) JavaClassName() string { 41 | return "java.lang.IllegalAccessException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e IllegalAccessException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/illegal_argument_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // IllegalArgumentException represents an exception of the same name in java 21 | type IllegalArgumentException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewIllegalArgumentException is the constructor 30 | func NewIllegalArgumentException(detailMessage string) *IllegalArgumentException { 31 | return &IllegalArgumentException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e IllegalArgumentException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (IllegalArgumentException) JavaClassName() string { 41 | return "java.lang.IllegalArgumentException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e IllegalArgumentException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/illegal_classFormat_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // IllegalClassFormatException represents an exception of the same name in java 21 | type IllegalClassFormatException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewIllegalClassFormatException is the constructor 30 | func NewIllegalClassFormatException(detailMessage string) *IllegalClassFormatException { 31 | return &IllegalClassFormatException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e IllegalClassFormatException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (IllegalClassFormatException) JavaClassName() string { 41 | return "java.lang.instrument.IllegalClassFormatException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e IllegalClassFormatException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/illegal_format_flags_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | import "fmt" 21 | 22 | // IllegalFormatFlagsException represents an exception of the same name in java 23 | type IllegalFormatFlagsException struct { 24 | SerialVersionUID int64 25 | DetailMessage string 26 | SuppressedExceptions []Throwabler 27 | StackTrace []StackTraceElement 28 | Cause Throwabler 29 | Flags string 30 | } 31 | 32 | // NewIllegalFormatFlagsException is the constructor 33 | func NewIllegalFormatFlagsException(flags string) *IllegalFormatFlagsException { 34 | return &IllegalFormatFlagsException{Flags: flags, StackTrace: []StackTraceElement{}} 35 | } 36 | 37 | // Error output error message 38 | func (e IllegalFormatFlagsException) Error() string { 39 | return fmt.Sprintf("Flags = '%s'", e.Flags) 40 | } 41 | 42 | // JavaClassName java fully qualified path 43 | func (IllegalFormatFlagsException) JavaClassName() string { 44 | return "java.util.IllegalFormatFlagsException" 45 | } 46 | 47 | // equals to getStackTrace in java 48 | func (e IllegalFormatFlagsException) GetStackTrace() []StackTraceElement { 49 | return e.StackTrace 50 | } 51 | -------------------------------------------------------------------------------- /java_exception/illegal_format_width_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | import "strconv" 21 | 22 | // IllegalFormatWidthException represents an exception of the same name in java 23 | type IllegalFormatWidthException struct { 24 | SerialVersionUID int64 25 | W int 26 | DetailMessage string 27 | SuppressedExceptions []Throwabler 28 | StackTrace []StackTraceElement 29 | Cause Throwabler 30 | } 31 | 32 | // Error output error message 33 | func (e IllegalFormatWidthException) Error() string { 34 | return strconv.Itoa(e.W) 35 | } 36 | 37 | // JavaClassName java fully qualified path 38 | func (IllegalFormatWidthException) JavaClassName() string { 39 | return "java.util.IllegalFormatWidthException" 40 | } 41 | 42 | // NewIllegalFormatWidthException is the constructor 43 | func NewIllegalFormatWidthException(w int) *IllegalFormatWidthException { 44 | return &IllegalFormatWidthException{W: w} 45 | } 46 | 47 | // equals to getStackTrace in java 48 | func (e IllegalFormatWidthException) GetStackTrace() []StackTraceElement { 49 | return e.StackTrace 50 | } 51 | -------------------------------------------------------------------------------- /java_exception/illegal_monitor_state_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // IllegalMonitorStateException represents an exception of the same name in java 21 | type IllegalMonitorStateException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewIllegalMonitorStateException is the constructor 30 | func NewIllegalMonitorStateException(detailMessage string) *IllegalMonitorStateException { 31 | return &IllegalMonitorStateException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e IllegalMonitorStateException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (IllegalMonitorStateException) JavaClassName() string { 41 | return "java.lang.IllegalMonitorStateException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e IllegalMonitorStateException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/illegal_state_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // IllegalStateException represents an exception of the same name in java 21 | type IllegalStateException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewIllegalStateException is the constructor 30 | func NewIllegalStateException(detailMessage string) *IllegalStateException { 31 | return &IllegalStateException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e IllegalStateException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (IllegalStateException) JavaClassName() string { 41 | return "java.lang.IllegalStateException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e IllegalStateException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/illegal_thread_state_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // IllegalThreadStateException represents an exception of the same name in java 21 | type IllegalThreadStateException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewIllegalThreadStateException is the constructor 30 | func NewIllegalThreadStateException(detailMessage string) *IllegalThreadStateException { 31 | return &IllegalThreadStateException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e IllegalThreadStateException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (IllegalThreadStateException) JavaClassName() string { 41 | return "java.lang.IllegalThreadStateException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e IllegalThreadStateException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/illformed_locale_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // IllformedLocaleException represents an exception of the same name in java 21 | type IllformedLocaleException struct { 22 | _errIdx int 23 | SerialVersionUID int64 24 | DetailMessage string 25 | SuppressedExceptions []Throwabler 26 | StackTrace []StackTraceElement 27 | Cause Throwabler 28 | } 29 | 30 | // Error output error message 31 | func (e IllformedLocaleException) Error() string { 32 | return e.DetailMessage 33 | } 34 | 35 | // JavaClassName java fully qualified path 36 | func (IllformedLocaleException) JavaClassName() string { 37 | return "java.util.IllformedLocaleException" 38 | } 39 | 40 | // NewIllformedLocaleException is the constructor 41 | func NewIllformedLocaleException(detailMessage string) *IllformedLocaleException { 42 | return &IllformedLocaleException{DetailMessage: detailMessage} 43 | } 44 | 45 | // equals to getStackTrace in java 46 | func (e IllformedLocaleException) GetStackTrace() []StackTraceElement { 47 | return e.StackTrace 48 | } 49 | -------------------------------------------------------------------------------- /java_exception/index_out_of_bounds_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // IndexOutOfBoundsException represents an exception of the same name in java 21 | type IndexOutOfBoundsException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewIndexOutOfBoundsException is the constructor 30 | func NewIndexOutOfBoundsException(detailMessage string) *IndexOutOfBoundsException { 31 | return &IndexOutOfBoundsException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e IndexOutOfBoundsException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (IndexOutOfBoundsException) JavaClassName() string { 41 | return "java.lang.IndexOutOfBoundsException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e IndexOutOfBoundsException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/input_mismatch_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // InputMismatchException represents an exception of the same name in java 21 | type InputMismatchException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewInputMismatchException is the constructor 30 | func NewInputMismatchException(detailMessage string) *InputMismatchException { 31 | return &InputMismatchException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e InputMismatchException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (InputMismatchException) JavaClassName() string { 41 | return "java.util.InputMismatchException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e InputMismatchException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/instantiation_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // InstantiationException represents an exception of the same name in java 21 | type InstantiationException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewInstantiationException is the constructor 30 | func NewInstantiationException(detailMessage string) *InstantiationException { 31 | return &InstantiationException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e InstantiationException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (InstantiationException) JavaClassName() string { 41 | return "java.lang.InstantiationException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e InstantiationException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/interrupted_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // ////////////////////////// 21 | // InterruptedException 22 | // ////////////////////////// 23 | // InterruptedException represents an exception of the same name in java 24 | type InterruptedException struct { 25 | SerialVersionUID int64 26 | DetailMessage string 27 | SuppressedExceptions []Throwabler 28 | StackTrace []StackTraceElement 29 | Cause Throwabler 30 | } 31 | 32 | // NewInterruptedException is the constructor 33 | func NewInterruptedException(detailMessage string) *InterruptedException { 34 | return &InterruptedException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 35 | } 36 | 37 | // Error output error message 38 | func (e InterruptedException) Error() string { 39 | return e.DetailMessage 40 | } 41 | 42 | // JavaClassName java fully qualified path 43 | func (InterruptedException) JavaClassName() string { 44 | return "java.lang.InterruptedException" 45 | } 46 | 47 | // equals to getStackTrace in java 48 | func (e InterruptedException) GetStackTrace() []StackTraceElement { 49 | return e.StackTrace 50 | } 51 | -------------------------------------------------------------------------------- /java_exception/invalid_object_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // InvalidObjectException represents an exception of the same name in java 21 | type InvalidObjectException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewInvalidObjectException is the constructor 30 | func NewInvalidObjectException(detailMessage string) *InvalidObjectException { 31 | return &InvalidObjectException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e InvalidObjectException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (InvalidObjectException) JavaClassName() string { 41 | return "java.io.InvalidObjectException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e InvalidObjectException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/invalid_properties_format_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // InvalidPropertiesFormatException represents an exception of the same name in java 21 | type InvalidPropertiesFormatException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewInvalidPropertiesFormatException is the constructor 30 | func NewInvalidPropertiesFormatException(detailMessage string) *InvalidPropertiesFormatException { 31 | return &InvalidPropertiesFormatException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e InvalidPropertiesFormatException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (InvalidPropertiesFormatException) JavaClassName() string { 41 | return "java.util.InvalidPropertiesFormatException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e InvalidPropertiesFormatException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/invocation_target_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // InvocationTargetException represents an exception of the same name in java 21 | type InvocationTargetException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | Target Throwabler 28 | } 29 | 30 | // NewInvocationTargetException is the constructor 31 | func NewInvocationTargetException(target Throwabler, detailMessage string) *InvocationTargetException { 32 | return &InvocationTargetException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}, Target: target} 33 | } 34 | 35 | // Error output error message 36 | func (e InvocationTargetException) Error() string { 37 | return e.DetailMessage 38 | } 39 | 40 | // JavaClassName java fully qualified path 41 | func (InvocationTargetException) JavaClassName() string { 42 | return "java.lang.reflect.InvocationTargetException" 43 | } 44 | 45 | // equals to getStackTrace in java 46 | func (e InvocationTargetException) GetStackTrace() []StackTraceElement { 47 | return e.StackTrace 48 | } 49 | -------------------------------------------------------------------------------- /java_exception/io_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // IOException represents an exception of the same name in java 21 | type IOException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewIOException is the constructor 30 | func NewIOException(detailMessage string) *IOException { 31 | return &IOException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e IOException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (IOException) JavaClassName() string { 41 | return "java.io.IOException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e IOException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/jar_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // JarException represents an exception of the same name in java 21 | type JarException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewJarException is the constructor 30 | func NewJarException(detailMessage string) *JarException { 31 | return &JarException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e JarException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (JarException) JavaClassName() string { 41 | return "java.util.jar.JarException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e JarException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/malformed_parameters_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // MalformedParametersException represents an exception of the same name in java 21 | type MalformedParametersException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // Error output error message 30 | func (e MalformedParametersException) Error() string { 31 | return e.DetailMessage 32 | } 33 | 34 | // JavaClassName java fully qualified path 35 | func (MalformedParametersException) JavaClassName() string { 36 | return "java.lang.reflect.MalformedParametersException" 37 | } 38 | 39 | // NewMalformedParametersException is the constructor 40 | func NewMalformedParametersException(detailMessage string) *MalformedParametersException { 41 | return &MalformedParametersException{DetailMessage: detailMessage} 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e MalformedParametersException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/missing_format_width_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // MissingFormatWidthException represents an exception of the same name in java 21 | type MissingFormatWidthException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | S string 28 | } 29 | 30 | // NewMissingFormatWidthException is the constructor 31 | func NewMissingFormatWidthException(s string) *MissingFormatWidthException { 32 | return &MissingFormatWidthException{S: s, StackTrace: []StackTraceElement{}} 33 | } 34 | 35 | // Error output error message 36 | func (e MissingFormatWidthException) Error() string { 37 | return e.S 38 | } 39 | 40 | // JavaClassName java fully qualified path 41 | func (MissingFormatWidthException) JavaClassName() string { 42 | return "java.util.MissingFormatWidthException" 43 | } 44 | 45 | // equals to getStackTrace in java 46 | func (e MissingFormatWidthException) GetStackTrace() []StackTraceElement { 47 | return e.StackTrace 48 | } 49 | -------------------------------------------------------------------------------- /java_exception/missing_resource_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // MissingResourceException represents an exception of the same name in java 21 | type MissingResourceException struct { 22 | ClassName string 23 | Key string 24 | SerialVersionUID int64 25 | DetailMessage string 26 | SuppressedExceptions []Throwabler 27 | StackTrace []StackTraceElement 28 | Cause Throwabler 29 | } 30 | 31 | // Error output error message 32 | func (e MissingResourceException) Error() string { 33 | return e.DetailMessage 34 | } 35 | 36 | // JavaClassName java fully qualified path 37 | func (MissingResourceException) JavaClassName() string { 38 | return "java.util.MissingResourceException" 39 | } 40 | 41 | // NewMissingResourceException is the constructor 42 | func NewMissingResourceException(detailMessage, classname, key string) *MissingResourceException { 43 | return &MissingResourceException{DetailMessage: detailMessage, ClassName: classname, Key: key} 44 | } 45 | 46 | // equals to getStackTrace in java 47 | func (e MissingResourceException) GetStackTrace() []StackTraceElement { 48 | return e.StackTrace 49 | } 50 | -------------------------------------------------------------------------------- /java_exception/negative_array_size_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // NegativeArraySizeException represents an exception of the same name in java 21 | type NegativeArraySizeException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewNegativeArraySizeException is the constructor 30 | func NewNegativeArraySizeException(detailMessage string) *NegativeArraySizeException { 31 | return &NegativeArraySizeException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e NegativeArraySizeException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (NegativeArraySizeException) JavaClassName() string { 41 | return "java.lang.NegativeArraySizeException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e NegativeArraySizeException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/no_such_element_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // NoSuchElementException represents an exception of the same name in java 21 | type NoSuchElementException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // Error output error message 30 | func (e NoSuchElementException) Error() string { 31 | return e.DetailMessage 32 | } 33 | 34 | // JavaClassName java fully qualified path 35 | func (NoSuchElementException) JavaClassName() string { 36 | return "java.util.NoSuchElementException" 37 | } 38 | 39 | // NewNoSuchElementException is the constructor 40 | func NewNoSuchElementException(detailMessage string) *NoSuchElementException { 41 | return &NoSuchElementException{DetailMessage: detailMessage} 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e NoSuchElementException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/no_such_field_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // NoSuchFieldException represents an exception of the same name in java 21 | type NoSuchFieldException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewNoSuchFieldException is the constructor 30 | func NewNoSuchFieldException(detailMessage string) *NoSuchFieldException { 31 | return &NoSuchFieldException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e NoSuchFieldException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (NoSuchFieldException) JavaClassName() string { 41 | return "java.lang.NoSuchFieldException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e NoSuchFieldException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/no_such_method_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // NoSuchMethodException represents an exception of the same name in java 21 | type NoSuchMethodException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewNoSuchMethodException is the constructor 30 | func NewNoSuchMethodException(detailMessage string) *NoSuchMethodException { 31 | return &NoSuchMethodException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e NoSuchMethodException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (NoSuchMethodException) JavaClassName() string { 41 | return "java.lang.NoSuchMethodException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e NoSuchMethodException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/not_active_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // NotActiveException represents an exception of the same name in java 21 | type NotActiveException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewNotActiveException is the constructor 30 | func NewNotActiveException(detailMessage string) *NotActiveException { 31 | return &NotActiveException{DetailMessage: detailMessage} 32 | } 33 | 34 | // Error output error message 35 | func (e NotActiveException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (NotActiveException) JavaClassName() string { 41 | return "java.io.NotActiveException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e NotActiveException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/not_serializable_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // NotSerializableException represents an exception of the same name in java 21 | type NotSerializableException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewNotSerializableException is the constructor 30 | func NewNotSerializableException(detailMessage string) *NotActiveException { 31 | return &NotActiveException{DetailMessage: detailMessage} 32 | } 33 | 34 | // Error output error message 35 | func (e NotSerializableException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (NotSerializableException) JavaClassName() string { 41 | return "java.io.NotSerializableException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e NotSerializableException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/null_pointer_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // NullPointerException represents an exception of the same name in java 21 | type NullPointerException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewNullPointerException is the constructor 30 | func NewNullPointerException(detailMessage string) *NullPointerException { 31 | return &NullPointerException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e NullPointerException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (e NullPointerException) JavaClassName() string { 41 | return "java.lang.NullPointerException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e NullPointerException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/number_format_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // NumberFormatException represents an exception of the same name in java 21 | type NumberFormatException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewNumberFormatException is the constructor 30 | func NewNumberFormatException(detailMessage string) *NumberFormatException { 31 | return &NumberFormatException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e NumberFormatException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (NumberFormatException) JavaClassName() string { 41 | return "java.lang.NumberFormatException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e NumberFormatException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/object_stream_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // ObjectStreamException represents an exception of the same name in java 21 | type ObjectStreamException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewObjectStreamException is the constructor 30 | func NewObjectStreamException(detailMessage string) *ObjectStreamException { 31 | return &ObjectStreamException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e ObjectStreamException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (ObjectStreamException) JavaClassName() string { 41 | return "java.io.ObjectStreamException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e ObjectStreamException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/optional_data_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // OptionalDataException represents an exception of the same name in java 21 | type OptionalDataException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | Eof bool 28 | Length int 29 | } 30 | 31 | // NewOptionalDataException is the constructor 32 | func NewOptionalDataException(eof bool, length int) *OptionalDataException { 33 | return &OptionalDataException{Eof: eof, Length: length} 34 | } 35 | 36 | // Error output error message 37 | func (e OptionalDataException) Error() string { 38 | return e.DetailMessage 39 | } 40 | 41 | // JavaClassName java fully qualified path 42 | func (OptionalDataException) JavaClassName() string { 43 | return "java.io.OptionalDataException" 44 | } 45 | 46 | // equals to getStackTrace in java 47 | func (e OptionalDataException) GetStackTrace() []StackTraceElement { 48 | return e.StackTrace 49 | } 50 | -------------------------------------------------------------------------------- /java_exception/reflective_operation_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // ReflectiveOperationException represents an exception of the same name in java 21 | type ReflectiveOperationException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewReflectiveOperationException is the constructor 30 | func NewReflectiveOperationException(detailMessage string) *ReflectiveOperationException { 31 | return &ReflectiveOperationException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e ReflectiveOperationException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (ReflectiveOperationException) JavaClassName() string { 41 | return "java.lang.ReflectiveOperationException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e ReflectiveOperationException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/rejected_execution_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // RejectedExecutionException represents an exception of the same name in java 21 | type RejectedExecutionException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // Error output error message 30 | func (e RejectedExecutionException) Error() string { 31 | return e.DetailMessage 32 | } 33 | 34 | // JavaClassName java fully qualified path 35 | func (RejectedExecutionException) JavaClassName() string { 36 | return "java.util.concurrent.RejectedExecutionException" 37 | } 38 | 39 | // NewRejectedExecutionException is the constructor 40 | func NewRejectedExecutionException(detailMessage string) *RejectedExecutionException { 41 | return &RejectedExecutionException{DetailMessage: detailMessage} 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e RejectedExecutionException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/runtime_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // RuntimeException represents an exception of the same name in java 21 | type RuntimeException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewRuntimeException is the constructor 30 | func NewRuntimeException(detailMessage string) *RuntimeException { 31 | return &RuntimeException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e RuntimeException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (RuntimeException) JavaClassName() string { 41 | return "java.lang.RuntimeException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e RuntimeException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/security_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // SecurityException represents an exception of the same name in java 21 | type SecurityException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewSecurityException is the constructor 30 | func NewSecurityException(detailMessage string) *SecurityException { 31 | return &SecurityException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e SecurityException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (SecurityException) JavaClassName() string { 41 | return "java.lang.SecurityException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e SecurityException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/stream_corrupted_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // StreamCorruptedException represents an exception of the same name in java 21 | type StreamCorruptedException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewStreamCorruptedException is the constructor 30 | func NewStreamCorruptedException(detailMessage string) *StreamCorruptedException { 31 | return &StreamCorruptedException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e StreamCorruptedException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (StreamCorruptedException) JavaClassName() string { 41 | return "java.io.StreamCorruptedException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e StreamCorruptedException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/string_index_out_of_bounds_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // StringIndexOutOfBoundsException represents an exception of the same name in java 21 | type StringIndexOutOfBoundsException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewStringIndexOutOfBoundsException is the constructor 30 | func NewStringIndexOutOfBoundsException(detailMessage string) *StringIndexOutOfBoundsException { 31 | return &StringIndexOutOfBoundsException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e StringIndexOutOfBoundsException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (StringIndexOutOfBoundsException) JavaClassName() string { 41 | return "java.lang.StringIndexOutOfBoundsException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e StringIndexOutOfBoundsException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/sync_failed_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // SyncFailedException represents an exception of the same name in java 21 | type SyncFailedException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewSyncFailedException is the constructor 30 | func NewSyncFailedException(detailMessage string) *SyncFailedException { 31 | return &SyncFailedException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e SyncFailedException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (SyncFailedException) JavaClassName() string { 41 | return "java.io.SyncFailedException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e SyncFailedException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/timeout_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // TimeoutException represents an exception of the same name in java 21 | type TimeoutException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewTimeoutException is the constructor 30 | func NewTimeoutException(detailMessage string) *TimeoutException { 31 | return &TimeoutException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e TimeoutException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (TimeoutException) JavaClassName() string { 41 | return "java.util.concurrent.TimeoutException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e TimeoutException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/too_many_listeners_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // TooManyListenersException represents an exception of the same name in java 21 | type TooManyListenersException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewTooManyListenersException is the constructor 30 | func NewTooManyListenersException(detailMessage string) *TooManyListenersException { 31 | return &TooManyListenersException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e TooManyListenersException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (TooManyListenersException) JavaClassName() string { 41 | return "java.util.TooManyListenersException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e TooManyListenersException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/type_not_present_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // TypeNotPresentException represents an exception of the same name in java 21 | type TypeNotPresentException struct { 22 | TypeName string 23 | SerialVersionUID int64 24 | DetailMessage string 25 | SuppressedExceptions []Throwabler 26 | StackTrace []StackTraceElement 27 | Cause Throwabler 28 | } 29 | 30 | // Error output error message 31 | func (e TypeNotPresentException) Error() string { 32 | return e.DetailMessage 33 | } 34 | 35 | // JavaClassName java fully qualified path 36 | func (TypeNotPresentException) JavaClassName() string { 37 | return "java.lang.TypeNotPresentException" 38 | } 39 | 40 | // NewTypeNotPresentException is the constructor 41 | func NewTypeNotPresentException(typeName string, detailMessage string) *TypeNotPresentException { 42 | return &TypeNotPresentException{TypeName: typeName, DetailMessage: detailMessage} 43 | } 44 | 45 | // equals to getStackTrace in java 46 | func (e TypeNotPresentException) GetStackTrace() []StackTraceElement { 47 | return e.StackTrace 48 | } 49 | -------------------------------------------------------------------------------- /java_exception/unchecked_IO_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // UncheckedIOException represents an exception of the same name in java 21 | type UncheckedIOException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewUncheckedIOException is the constructor 30 | func NewUncheckedIOException(detailMessage string, cause Throwabler) (result *UncheckedIOException, err error) { 31 | if cause == nil { 32 | return nil, NullPointerException{} 33 | } 34 | return &UncheckedIOException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}, Cause: cause}, 35 | nil 36 | } 37 | 38 | // Error output error message 39 | func (e UncheckedIOException) Error() string { 40 | return e.DetailMessage 41 | } 42 | 43 | // JavaClassName java fully qualified path 44 | func (UncheckedIOException) JavaClassName() string { 45 | return "java.io.UncheckedIOException" 46 | } 47 | 48 | // equals to getStackTrace in java 49 | func (e UncheckedIOException) GetStackTrace() []StackTraceElement { 50 | return e.StackTrace 51 | } 52 | -------------------------------------------------------------------------------- /java_exception/undeclared_throwable_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // UndeclaredThrowableException represents an exception of the same name in java 21 | type UndeclaredThrowableException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | UndeclaredThrowable Throwabler 28 | } 29 | 30 | // Error output error message 31 | func (e UndeclaredThrowableException) Error() string { 32 | return e.DetailMessage 33 | } 34 | 35 | // JavaClassName java fully qualified path 36 | func (UndeclaredThrowableException) JavaClassName() string { 37 | return "java.lang.reflect.UndeclaredThrowableException" 38 | } 39 | 40 | // NewUndeclaredThrowableException is the constructor 41 | func NewUndeclaredThrowableException(detailMessage string) *UndeclaredThrowableException { 42 | return &UndeclaredThrowableException{DetailMessage: detailMessage, UndeclaredThrowable: Throwable{}} 43 | } 44 | 45 | // equals to getStackTrace in java 46 | func (e UndeclaredThrowableException) GetStackTrace() []StackTraceElement { 47 | return e.StackTrace 48 | } 49 | -------------------------------------------------------------------------------- /java_exception/unknown_format_flags_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // UnknownFormatFlagsException represents an exception of the same name in java 21 | type UnknownFormatFlagsException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | Flags string 28 | } 29 | 30 | // NewUnknownFormatFlagsException is the constructor 31 | func NewUnknownFormatFlagsException(flags string) *UnknownFormatFlagsException { 32 | return &UnknownFormatFlagsException{Flags: flags, StackTrace: []StackTraceElement{}} 33 | } 34 | 35 | // Error output error message 36 | func (e UnknownFormatFlagsException) Error() string { 37 | return "Flags = " + e.Flags 38 | } 39 | 40 | // JavaClassName java fully qualified path 41 | func (UnknownFormatFlagsException) JavaClassName() string { 42 | return "java.util.UnknownFormatFlagsException" 43 | } 44 | 45 | // equals to getStackTrace in java 46 | func (e UnknownFormatFlagsException) GetStackTrace() []StackTraceElement { 47 | return e.StackTrace 48 | } 49 | -------------------------------------------------------------------------------- /java_exception/unsupported_operation_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // UnsupportedOperationException represents an exception of the same name in java 21 | type UnsupportedOperationException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewUnsupportedOperationException is the constructor 30 | func NewUnsupportedOperationException(detailMessage string) *UnsupportedOperationException { 31 | return &UnsupportedOperationException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e UnsupportedOperationException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (UnsupportedOperationException) JavaClassName() string { 41 | return "java.lang.UnsupportedOperationException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e UnsupportedOperationException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/utf_data_format_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // UTFDataFormatException represents an exception of the same name in java 21 | type UTFDataFormatException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | SuppressedExceptions []Throwabler 26 | Cause Throwabler 27 | } 28 | 29 | // NewUTFDataFormatException is the constructor 30 | func NewUTFDataFormatException(detailMessage string) *UTFDataFormatException { 31 | return &UTFDataFormatException{DetailMessage: detailMessage} 32 | } 33 | 34 | // Error output error message 35 | func (e UTFDataFormatException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (UTFDataFormatException) JavaClassName() string { 41 | return "java.io.UTFDataFormatException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e UTFDataFormatException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/write_aborted_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // WriteAbortedException represents an exception of the same name in java 21 | type WriteAbortedException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | StackTrace []StackTraceElement 25 | Detail Throwabler 26 | SuppressedExceptions []Throwabler 27 | Cause Throwabler 28 | } 29 | 30 | // NewWriteAbortedException is the constructor 31 | func NewWriteAbortedException(detailMessage string, detail Throwabler) *WriteAbortedException { 32 | return &WriteAbortedException{ 33 | DetailMessage: detailMessage, StackTrace: nil, 34 | Detail: detail, 35 | } 36 | } 37 | 38 | // Error output error message 39 | func (e WriteAbortedException) Error() string { 40 | return e.DetailMessage 41 | } 42 | 43 | // JavaClassName java fully qualified path 44 | func (WriteAbortedException) JavaClassName() string { 45 | return "java.io.WriteAbortedException" 46 | } 47 | 48 | // equals to getStackTrace in java 49 | func (e WriteAbortedException) GetStackTrace() []StackTraceElement { 50 | return e.StackTrace 51 | } 52 | -------------------------------------------------------------------------------- /java_exception/wrong_method_type_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // WrongMethodTypeException represents an exception of the same name in java 21 | type WrongMethodTypeException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // Error output error message 30 | func (e WrongMethodTypeException) Error() string { 31 | return e.DetailMessage 32 | } 33 | 34 | // JavaClassName java fully qualified path 35 | func (WrongMethodTypeException) JavaClassName() string { 36 | return "java.lang.invoke.WrongMethodTypeException" 37 | } 38 | 39 | // NewWrongMethodTypeException is the constructor 40 | func NewWrongMethodTypeException(detailMessage string) *WrongMethodTypeException { 41 | return &WrongMethodTypeException{DetailMessage: detailMessage} 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e WrongMethodTypeException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/zip_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // ZipException represents an exception of the same name in java 21 | type ZipException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewZipException is the constructor 30 | func NewZipException(detailMessage string) *ZipException { 31 | return &ZipException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e ZipException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (ZipException) JavaClassName() string { 41 | return "java.util.zip.ZipException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e ZipException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_exception/zone_rules_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_exception 19 | 20 | // ZoneRulesException represents an exception of the same name in java 21 | type ZoneRulesException struct { 22 | SerialVersionUID int64 23 | DetailMessage string 24 | SuppressedExceptions []Throwabler 25 | StackTrace []StackTraceElement 26 | Cause Throwabler 27 | } 28 | 29 | // NewZoneRulesException is the constructor 30 | func NewZoneRulesException(detailMessage string) *ZoneRulesException { 31 | return &ZoneRulesException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}} 32 | } 33 | 34 | // Error output error message 35 | func (e ZoneRulesException) Error() string { 36 | return e.DetailMessage 37 | } 38 | 39 | // JavaClassName java fully qualified path 40 | func (ZoneRulesException) JavaClassName() string { 41 | return "java.time.zone.ZoneRulesException" 42 | } 43 | 44 | // equals to getStackTrace in java 45 | func (e ZoneRulesException) GetStackTrace() []StackTraceElement { 46 | return e.StackTrace 47 | } 48 | -------------------------------------------------------------------------------- /java_sql_time/date.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_sql_time 19 | 20 | import "time" 21 | 22 | type Date struct { 23 | time.Time 24 | } 25 | 26 | func (d *Date) GetTime() time.Time { 27 | return d.Time 28 | } 29 | 30 | func (d *Date) SetTime(time time.Time) { 31 | d.Time = time 32 | } 33 | 34 | func (Date) JavaClassName() string { 35 | return "java.sql.Date" 36 | } 37 | 38 | func (d *Date) ValueOf(dateStr string) error { 39 | time, err := time.Parse("2006-01-02", dateStr) 40 | if err != nil { 41 | return err 42 | } 43 | d.Time = time 44 | return nil 45 | } 46 | 47 | // nolint 48 | func (d *Date) Year() int { 49 | return d.Time.Year() 50 | } 51 | 52 | // nolint 53 | func (d *Date) Month() time.Month { 54 | return d.Time.Month() 55 | } 56 | 57 | // nolint 58 | func (d *Date) Day() int { 59 | return d.Time.Day() 60 | } 61 | -------------------------------------------------------------------------------- /java_sql_time/java_sql_time.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_sql_time 19 | 20 | import "time" 21 | 22 | type JavaSqlTime interface { 23 | // ValueOf parse time string which format likes '2006-01-02 15:04:05' 24 | ValueOf(timeStr string) error 25 | // SetTime for decode time 26 | SetTime(time time.Time) 27 | JavaClassName() string 28 | // GetTime used to time 29 | GetTime() time.Time 30 | } 31 | -------------------------------------------------------------------------------- /java_sql_time/time.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_sql_time 19 | 20 | import "time" 21 | 22 | type Time struct { 23 | time.Time 24 | } 25 | 26 | func (Time) JavaClassName() string { 27 | return "java.sql.Time" 28 | } 29 | 30 | func (t *Time) GetTime() time.Time { 31 | return t.Time 32 | } 33 | 34 | // nolint 35 | func (t *Time) Hour() int { 36 | return t.Time.Hour() 37 | } 38 | 39 | // nolint 40 | func (t *Time) Minute() int { 41 | return t.Time.Minute() 42 | } 43 | 44 | // nolint 45 | func (t *Time) Second() int { 46 | return t.Time.Second() 47 | } 48 | 49 | func (t *Time) SetTime(time time.Time) { 50 | t.Time = time 51 | } 52 | 53 | func (t *Time) ValueOf(timeStr string) error { 54 | time, err := time.Parse("15:04:05", timeStr) 55 | if err != nil { 56 | return err 57 | } 58 | t.Time = time 59 | return nil 60 | } 61 | -------------------------------------------------------------------------------- /java_unknown_exception_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package hessian 19 | 20 | import ( 21 | "testing" 22 | ) 23 | 24 | import ( 25 | "github.com/stretchr/testify/assert" 26 | ) 27 | 28 | func TestCheckAndGetException(t *testing.T) { 29 | clazzInfo1 := &ClassInfo{ 30 | javaName: "com.test.UserDefinedException", 31 | fieldNameList: []string{"detailMessage", "code", "suppressedExceptions", "stackTrace", "cause"}, 32 | } 33 | s, b := checkAndGetException(clazzInfo1) 34 | assert.True(t, b) 35 | 36 | assert.Equal(t, s.javaName, "com.test.UserDefinedException") 37 | assert.Equal(t, s.goName, "github.com/apache/dubbo-go-hessian2/hessian.UnknownException") 38 | 39 | clazzInfo2 := &ClassInfo{ 40 | javaName: "com.test.UserDefinedException", 41 | fieldNameList: []string{"detailMessage", "code", "suppressedExceptions", "cause"}, 42 | } 43 | s, b = checkAndGetException(clazzInfo2) 44 | assert.False(t, b) 45 | assert.Nil(t, s) 46 | } 47 | -------------------------------------------------------------------------------- /java_util.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package hessian 19 | 20 | import ( 21 | "github.com/apache/dubbo-go-hessian2/java_util" 22 | ) 23 | 24 | func init() { 25 | RegisterPOJO(&java_util.UUID{ 26 | Value: "", 27 | }) 28 | RegisterPOJO(&java_util.LocaleHandle{ 29 | Value: "", 30 | }) 31 | } 32 | -------------------------------------------------------------------------------- /java_util/README.md: -------------------------------------------------------------------------------- 1 | # UUID-info 2 | 3 | 1. explain dubbo-go-hessian2 strut UUID 4 | - JavaServer -> create UUID -> GO Client -> UUID struct (PASS) 5 | - dubbo-go-hessian2 cannot create UUID strut 6 | - see jdk source code of class:[java.util.UUID] learning how to create UUID struct 7 | - see https://github.com/satori/go.uuid 8 | 2. explain dubbo-go-hession2 strut locale 9 | -java object locale -> go struct Locale (PASS), but currently implemented are objects enumerated in java. See class:java.util.Locale 10 | -First convert to struct LocaleHandle and then call `GetLocaleFromHandler(localeHandler *LocaleHandle)` function to convert to struct Locale 11 | -You can use the `language.ParseBase("zh-CN")` function in the `golang.org/x/text/language` package to convert the value of `locale.String()` get go struct and do other things -------------------------------------------------------------------------------- /java_util/README_CN.md: -------------------------------------------------------------------------------- 1 | # 说明 2 | 3 | 1. dubbo-go-hessian2 中 UUID 目前解析情况 4 | - uuid.go 中提供了解析 Java 中生成好的 UUID 对象,测试通过,但是不提供生成 UUID 的功能 5 | - java-server 提供的 uuid 可以解析,可以通过 UUID 的 ToString()函数解析成字符串,但是 go 目前未提供生成 uuid 的功能 6 | - java uuid 生成可以参考 jdk 下 java.util.UUID 类的相关源码 7 | - uuid 结构体创建参考 https://github.com/satori/go.uuid 8 | 9 | 2. locale对象 10 | - Locale.java中的对象可以转换成go的结构体Locale,但目前实现的是java中枚举的对象,具体见 class:java.util.Locale 11 | - 先转换成LocaleHandle对象,然后调用 `GetLocaleFromHandler(localeHandler *LocaleHandle)` 函数转成Locale对象 12 | - 可以使用 `golang.org/x/text/language` 包中的 `language.ParseBase("zh-CN")` 函数将 `locale.String()` 值转成go中的相关对象进行后续操作 -------------------------------------------------------------------------------- /java_util/uuid.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java_util 19 | 20 | // java.util.UUID 21 | type UUID struct { 22 | Value string `hessian:"value"` 23 | } 24 | 25 | func (UUID) JavaClassName() string { 26 | return "java.util.UUID" 27 | } 28 | 29 | // String returns a string object representing this UUID. 30 | func (uuid UUID) String() string { 31 | return uuid.Value 32 | } 33 | -------------------------------------------------------------------------------- /null.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package hessian 19 | 20 | // /////////////////////////////////////// 21 | // Null 22 | // /////////////////////////////////////// 23 | func EncNull(b []byte) []byte { 24 | return append(b, BC_NULL) 25 | } 26 | -------------------------------------------------------------------------------- /output/testfuncs/java8_time.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package testfuncs 19 | 20 | import ( 21 | hessian "github.com/apache/dubbo-go-hessian2" 22 | "github.com/apache/dubbo-go-hessian2/java8_time" 23 | ) 24 | 25 | // Java8TimeYear is test java8 java.time.Year 26 | func Java8TimeYear() []byte { 27 | e := hessian.NewEncoder() 28 | year := java8_time.Year{Year: 2020} 29 | e.Encode(year) 30 | return e.Buffer() 31 | } 32 | 33 | // Java8LocalDate is test java8 java.time.LocalDate 34 | func Java8LocalDate() []byte { 35 | e := hessian.NewEncoder() 36 | date := java8_time.LocalDate{Year: 2020, Month: 9, Day: 12} 37 | e.Encode(date) 38 | return e.Buffer() 39 | } 40 | -------------------------------------------------------------------------------- /output/testfuncs/java_exception.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package testfuncs 19 | 20 | import ( 21 | hessian "github.com/apache/dubbo-go-hessian2" 22 | "github.com/apache/dubbo-go-hessian2/java_exception" 23 | ) 24 | 25 | // JavaException is test java Exception 26 | func JavaException() []byte { 27 | e := hessian.NewEncoder() 28 | exception := java_exception.NewException("java_exception") 29 | e.Encode(exception) 30 | return e.Buffer() 31 | } 32 | -------------------------------------------------------------------------------- /output/testfuncs/list.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package testfuncs 19 | 20 | import ( 21 | hessian "github.com/apache/dubbo-go-hessian2" 22 | ) 23 | 24 | func UserArray() []byte { 25 | e := hessian.NewEncoder() 26 | _ = e.Encode([]*User{ 27 | {"wongoo"}, {"alex"}, 28 | }) 29 | return e.Buffer() 30 | } 31 | 32 | func UserList() []byte { 33 | e := hessian.NewEncoder() 34 | _ = e.Encode([]interface{}{ 35 | &User{"wongoo"}, &User{"alex"}, 36 | }) 37 | return e.Buffer() 38 | } 39 | -------------------------------------------------------------------------------- /output/testfuncs/object.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package testfuncs 19 | 20 | import hessian "github.com/apache/dubbo-go-hessian2" 21 | 22 | type A0 struct{} 23 | 24 | // JavaClassName java fully qualified path 25 | func (*A0) JavaClassName() string { 26 | return "com.caucho.hessian.test.A0" 27 | } 28 | 29 | func ObjectA0() []byte { 30 | e := hessian.NewEncoder() 31 | var a = A0{} 32 | e.Encode(&a) 33 | return e.Buffer() 34 | } 35 | -------------------------------------------------------------------------------- /output/testfuncs/string.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package testfuncs 19 | 20 | import ( 21 | hessian "github.com/apache/dubbo-go-hessian2" 22 | ) 23 | 24 | func HelloWorldString() []byte { 25 | e := hessian.NewEncoder() 26 | e.Encode("hello world") 27 | return e.Buffer() 28 | } 29 | -------------------------------------------------------------------------------- /output/testfuncs/user.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package testfuncs 19 | 20 | import hessian "github.com/apache/dubbo-go-hessian2" 21 | 22 | type User struct { 23 | Name string 24 | } 25 | 26 | // JavaClassName java fully qualified path 27 | func (*User) JavaClassName() string { 28 | return "test.model.User" 29 | } 30 | 31 | func init() { 32 | hessian.RegisterPOJO(&User{}) 33 | } 34 | -------------------------------------------------------------------------------- /param.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package hessian 19 | 20 | // Param interface 21 | // !!! Pls attention that Every field name should be upper case. 22 | // specifies the Java method parameter type. 23 | // if this interface is not implemented, the pojo javaClassName is 24 | // used as the method parameter type by default 25 | type Param interface { 26 | POJO 27 | JavaParamName() string 28 | } 29 | -------------------------------------------------------------------------------- /pojo_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package hessian 19 | 20 | import ( 21 | "bytes" 22 | "container/list" 23 | "testing" 24 | "time" 25 | ) 26 | 27 | import ( 28 | "github.com/stretchr/testify/assert" 29 | ) 30 | 31 | import ( 32 | "github.com/apache/dubbo-go-hessian2/java_exception" 33 | "github.com/apache/dubbo-go-hessian2/java_util" 34 | ) 35 | 36 | func TestGetGoType(t *testing.T) { 37 | assert.Equal(t, "time.Time", GetGoType(time.Now())) 38 | assert.Equal(t, "bytes.Buffer", GetGoType(bytes.Buffer{})) 39 | assert.Equal(t, "container/list/list.List", GetGoType(list.New())) 40 | assert.Equal(t, "github.com/apache/dubbo-go-hessian2/hessian.BusinessData", GetGoType(&BusinessData{})) 41 | assert.Equal(t, "github.com/apache/dubbo-go-hessian2/java_util/java_util.UUID", GetGoType(&java_util.UUID{})) 42 | assert.Equal(t, "github.com/apache/dubbo-go-hessian2/java_exception/java_exception.ClassNotFoundException", GetGoType(&java_exception.ClassNotFoundException{})) 43 | 44 | assert.Equal(t, "[]github.com/apache/dubbo-go-hessian2/hessian.BusinessData", GetGoType([]*BusinessData{})) 45 | assert.Equal(t, "[][]github.com/apache/dubbo-go-hessian2/hessian.BusinessData", GetGoType([][]*BusinessData{})) 46 | } 47 | -------------------------------------------------------------------------------- /test_dubbo/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .gradle 3 | *.iml 4 | dependency-reduced-pom.xml 5 | out/ 6 | build/ 7 | target/ -------------------------------------------------------------------------------- /test_dubbo/README.md: -------------------------------------------------------------------------------- 1 | # Test Dubbo 2 | 3 | ## requirement 4 | 5 | - java 8 6 | - maven 3.6.1 7 | 8 | ## usage 9 | 10 | ``` 11 | $ cd test_dubbo 12 | $ mvn clean package 13 | $ java -jar target/test_dubbo-1.0.0.jar replyRequest 14 | ``` -------------------------------------------------------------------------------- /test_dubbo/src/main/java/test/Dubbo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package test; 19 | 20 | import org.apache.dubbo.remoting.Codec2; 21 | import org.apache.dubbo.rpc.protocol.dubbo.DubboCodec; 22 | import org.apache.dubbo.remoting.Channel; 23 | import org.apache.dubbo.remoting.buffer.ChannelBuffer; 24 | import org.apache.dubbo.remoting.buffer.DynamicChannelBuffer; 25 | 26 | import java.lang.reflect.Method; 27 | 28 | 29 | public class Dubbo { 30 | 31 | private static Object getReply(String methodString) throws Exception { 32 | Method method = TestDubbo.class.getMethod(methodString); 33 | TestDubbo testDubbo = new TestDubbo(); 34 | return method.invoke(testDubbo); 35 | } 36 | 37 | public static void main(String[] args) throws Exception { 38 | Channel channel = new SimpleChannel(); 39 | ChannelBuffer buffer = new DynamicChannelBuffer(4096); 40 | Object object = getReply(args[0]); 41 | 42 | Codec2 codec = new DubboCodec(); 43 | codec.encode(channel, buffer, object); 44 | 45 | System.out.write(buffer.array()); 46 | System.out.flush(); 47 | } 48 | } -------------------------------------------------------------------------------- /test_dubbo/src/main/java/test/TestDubbo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package test; 19 | 20 | import org.apache.dubbo.rpc.RpcInvocation; 21 | import org.apache.dubbo.remoting.exchange.Request; 22 | 23 | 24 | public class TestDubbo { 25 | 26 | public Request replyRequest() { 27 | RpcInvocation rpcInvocation = new RpcInvocation(); 28 | rpcInvocation.setMethodName("echo"); 29 | rpcInvocation.setParameterTypes(new Class[]{String.class}); 30 | rpcInvocation.setArguments(new Object[]{"hello world"}); 31 | rpcInvocation.setAttachment("path", "dubbo-x/dubbo.DubboService"); 32 | rpcInvocation.setAttachment("interface", "dubbo.DubboService"); 33 | 34 | Request request = new Request(1); 35 | request.setData(rpcInvocation); 36 | 37 | return request; 38 | } 39 | } -------------------------------------------------------------------------------- /test_hessian/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .gradle 3 | *.iml 4 | dependency-reduced-pom.xml 5 | out/ 6 | build/ 7 | target/ -------------------------------------------------------------------------------- /test_hessian/README.md: -------------------------------------------------------------------------------- 1 | # Test Hessian 2 | 3 | ## requirement 4 | 5 | - java 8 6 | - maven 3.6.1 7 | 8 | ## usage 9 | 10 | ``` 11 | $ cd test_hessian 12 | $ mvn clean package 13 | $ java -jar target/test_hessian-1.0.0.jar replyBinary_0 14 | ``` -------------------------------------------------------------------------------- /test_hessian/src/main/java/test/TestJavaSqlTime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package test; 19 | 20 | import java.sql.Date; 21 | import java.sql.Time; 22 | 23 | public class TestJavaSqlTime { 24 | 25 | public Object javaSql_decode_date() { 26 | return new Date(1596931200000L); 27 | } 28 | 29 | public Object javaSql_decode_time() { 30 | return new Time(852124546000L); 31 | } 32 | 33 | 34 | public TestJavaSqlTime() { 35 | } 36 | 37 | public static Object javaSql_encode_time(Object v) { 38 | return v.equals(new Time(852124546000L)); 39 | } 40 | 41 | public boolean javaSql_encode_date(Object v) { 42 | return v.equals(new Date(1596931200000L)); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /test_hessian/src/main/java/test/TestString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package test; 19 | 20 | public class TestString { 21 | 22 | public static String getEmojiTestString() { 23 | // 0x0001_f923 24 | String s = "emoji\uD83E\uDD23"; 25 | 26 | // see: http://www.unicode.org/glossary/#code_point 27 | int[] ucs4 = new int[]{0x0010_ffff}; 28 | String maxUnicode = new String(ucs4, 0, ucs4.length); 29 | 30 | return s + ",max" + maxUnicode; 31 | } 32 | 33 | /** 34 | * see https://github.com/apache/dubbo-go-hessian2/issues/252 35 | */ 36 | public static String getEmojiTestString2() { 37 | return "❄️\uD83D\uDEAB\uD83D\uDEAB\uD83D\uDEAB\uD83D\uDEAB 多次自我介绍、任务、动态和"; 38 | } 39 | 40 | public static String getComplexString() { 41 | String s = "킐\u0088中国你好!\u0088\u0088\u0088\u0088\u0088\u0088"; 42 | return s; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /test_hessian/src/main/java/test/TestWrapperClassArray.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package test; 19 | 20 | public class TestWrapperClassArray { 21 | 22 | public static Byte[] byteArray() { 23 | return new Byte[]{'A', 'B', 'C'}; 24 | } 25 | 26 | public static Short[] shortArray() { 27 | return new Short[]{1, 100, 10000}; 28 | } 29 | 30 | public static Integer[] integerArray() { 31 | return new Integer[]{1, 100, 10000}; 32 | } 33 | 34 | public static Long[] longArray() { 35 | return new Long[]{1L, 100L, 10000L}; 36 | } 37 | 38 | public static Boolean[] booleanArray() { 39 | return new Boolean[]{true, false, true}; 40 | } 41 | 42 | public static Float[] floatArray() { 43 | return new Float[]{1.0f, 100.0f, 10000.1f}; 44 | } 45 | 46 | public static Double[] doubleArray() { 47 | return new Double[]{1.0, 100.0, 10000.1}; 48 | } 49 | 50 | public static Character[] characterArray() { 51 | return new Character[]{'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'}; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /test_hessian/src/main/java/test/UserDefindException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package test; 19 | 20 | public class UserDefindException extends RuntimeException{ 21 | public UserDefindException(String dd){ 22 | super(dd); 23 | } 24 | } -------------------------------------------------------------------------------- /test_hessian/src/main/java/test/generic/BusinessData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package test.generic; 19 | 20 | import java.io.Serializable; 21 | 22 | public class BusinessData implements Serializable { 23 | 24 | private String name; 25 | private int count; 26 | 27 | public BusinessData() { 28 | } 29 | 30 | public BusinessData(String name, int count) { 31 | this.name = name; 32 | this.count = count; 33 | } 34 | 35 | public String getName() { 36 | return name; 37 | } 38 | 39 | public void setName(String name) { 40 | this.name = name; 41 | } 42 | 43 | public int getCount() { 44 | return count; 45 | } 46 | 47 | public void setCount(int count) { 48 | this.count = count; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /test_hessian/src/main/java/test/generic/Response.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package test.generic; 19 | 20 | import java.io.Serializable; 21 | 22 | public class Response implements Serializable { 23 | 24 | private int code; 25 | private T data; 26 | 27 | public int getCode() { 28 | return code; 29 | } 30 | 31 | public T getData() { 32 | return data; 33 | } 34 | 35 | public Response(int code, T data) { 36 | this.code = code; 37 | this.data = data; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test_hessian/src/main/java/test/model/CustomMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package test.model; 19 | 20 | import java.util.HashMap; 21 | 22 | public class CustomMap extends HashMap { 23 | } 24 | -------------------------------------------------------------------------------- /test_hessian/src/main/java/test/model/DateDemo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package test.model; 19 | 20 | import java.io.Serializable; 21 | import java.util.Date; 22 | 23 | public class DateDemo implements Serializable { 24 | private String name; 25 | private Date date; 26 | private Date date1; 27 | 28 | public String getName() { 29 | return name; 30 | } 31 | 32 | public DateDemo() {} 33 | 34 | public DateDemo(String name,Date date,Date date1) { 35 | this.name = name; 36 | this.date = date; 37 | this.date1 = date1; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | public Date getDate() { 44 | return date; 45 | } 46 | 47 | public void setDate(Date date) { 48 | this.date = date; 49 | } 50 | public Date getDate1() { 51 | return date1; 52 | } 53 | 54 | public void setDate1(Date date1) { 55 | this.date1 = date1; 56 | } 57 | 58 | } -------------------------------------------------------------------------------- /test_hessian/src/main/java/test/model/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package test.model; 19 | 20 | import java.io.Serializable; 21 | import java.util.List; 22 | 23 | public class User implements Serializable { 24 | private String name; 25 | 26 | private Integer id; 27 | 28 | private List list; 29 | 30 | public User() { 31 | } 32 | 33 | public User(String name) { 34 | this.name = name; 35 | } 36 | 37 | public String getName() { 38 | return name; 39 | } 40 | 41 | public void setName(String name) { 42 | this.name = name; 43 | } 44 | 45 | public Integer getId() { 46 | return id; 47 | } 48 | 49 | public void setId(Integer id) { 50 | this.id = id; 51 | } 52 | 53 | public List getList() { return list; } 54 | 55 | public void setList(List list) { this.list = list; } 56 | 57 | @Override 58 | public String toString() { 59 | return "User{" + 60 | "name='" + name + '\'' + 61 | "id='" + id + '\'' + 62 | '}'; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /test_hessian/src/main/java/test/tuple/TupleProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package test.tuple; 19 | 20 | public interface TupleProvider { 21 | 22 | Tuple getTheTuple(); 23 | } 24 | -------------------------------------------------------------------------------- /test_hessian/src/main/java/test/tuple/TupleProviderImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package test.tuple; 19 | 20 | public class TupleProviderImpl implements TupleProvider { 21 | 22 | @Override 23 | public Tuple getTheTuple() { 24 | Tuple result = new Tuple(); 25 | result.setB((byte) 1); 26 | result.setByte(Byte.valueOf("1")); 27 | result.setI(1); 28 | result.setInteger(Integer.valueOf("1")); 29 | result.setL(1L); 30 | result.setLong(Long.valueOf("1")); 31 | result.setS((short) 1); 32 | result.setShort(Short.valueOf("1")); 33 | result.setD(1.23); 34 | result.setDouble(Double.valueOf("1.23")); 35 | return result; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /test_hessian/src/test/java/unit/GoJava8TimeTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package unit; 18 | 19 | import junit.framework.Assert; 20 | import org.junit.Test; 21 | 22 | import java.time.LocalDate; 23 | import java.time.Year; 24 | 25 | /** 26 | * date 2020/9/12 11:09
27 | * description class
28 | * test java8 29 | * 30 | * @author zhangyanmingjiayou@163.com 31 | * @version 1.0 32 | * @since 1.0 33 | */ 34 | public class GoJava8TimeTest { 35 | 36 | /** 37 | * test java8 java.time.* object and go java8_time/* struct 38 | */ 39 | @Test 40 | public void testJava8Year() { 41 | Year year = Year.of(2020); 42 | Assert.assertEquals(year 43 | , GoTestUtil.readGoObject("Java8TimeYear")); 44 | LocalDate localDate = LocalDate.of(2020, 9, 12); 45 | Assert.assertEquals(localDate, GoTestUtil.readGoObject("Java8LocalDate")); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /test_hessian/src/test/java/unit/GoJavaExceptionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package unit; 18 | 19 | import junit.framework.Assert; 20 | import org.junit.Test; 21 | 22 | /** 23 | * date 2020/9/12 11:09
24 | * description class
25 | * test java8 26 | * 27 | * @author zhangyanmingjiayou@163.com 28 | * @version 1.0 29 | * @since 1.0 30 | */ 31 | public class GoJavaExceptionTest { 32 | 33 | /** 34 | * test java java.lang.Exception object and go java_exception Exception struct 35 | */ 36 | @Test 37 | public void testException() { 38 | Exception exception = new Exception("java_exception"); 39 | Object javaException = GoTestUtil.readGoObject("JavaException"); 40 | // assertEquals don't compare Exception object 41 | if (javaException instanceof Exception) { 42 | Assert.assertEquals(exception.getMessage(), ((Exception) javaException).getMessage()); 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /test_hessian/src/test/java/unit/GoObjectTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package unit; 19 | 20 | 21 | import com.caucho.hessian.test.A0; 22 | import junit.framework.Assert; 23 | import org.junit.Test; 24 | import test.util.JavaHessianUtil; 25 | 26 | /** 27 | * @author wongoo 28 | */ 29 | public class GoObjectTest { 30 | 31 | public GoObjectTest(){ 32 | JavaHessianUtil.removeTestClassLimitFromAllowList(); 33 | } 34 | 35 | @Test 36 | public void testObjectA0() { 37 | A0 a = new A0(); 38 | Assert.assertEquals(a, GoTestUtil.readGoObject("ObjectA0")); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /test_hessian/src/test/java/unit/GoStringTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package unit; 19 | 20 | 21 | import junit.framework.Assert; 22 | import org.junit.Test; 23 | 24 | /** 25 | * @author wongoo 26 | */ 27 | public class GoStringTest { 28 | 29 | @Test 30 | public void testHelloWordString() { 31 | Assert.assertEquals("hello world" 32 | , GoTestUtil.readGoObject("HelloWorldString")); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test_hessian/src/test/java/unit/GoUserListTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package unit; 19 | 20 | 21 | import org.junit.Test; 22 | import test.model.User; 23 | 24 | import java.util.Arrays; 25 | import java.util.List; 26 | 27 | /** 28 | * @author wongoo 29 | */ 30 | public class GoUserListTest { 31 | 32 | @Test 33 | public void testUserList() { 34 | User[] userArray = (User[]) GoTestUtil.readGoObject("UserArray"); 35 | System.out.println(Arrays.toString(userArray)); 36 | 37 | List userList = (List) GoTestUtil.readGoObject("UserList"); 38 | System.out.println(userList); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /testcases/issue356/issue356_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package issue356 19 | 20 | import ( 21 | "reflect" 22 | "testing" 23 | ) 24 | 25 | import ( 26 | hessian "github.com/apache/dubbo-go-hessian2" 27 | ) 28 | 29 | import ( 30 | "github.com/stretchr/testify/assert" 31 | ) 32 | 33 | type UserInfo struct { 34 | Name string 35 | Address map[string]string 36 | Family map[string]int 37 | } 38 | 39 | func (UserInfo) JavaClassName() string { 40 | return "com.test.UserInfo" 41 | } 42 | 43 | func TestIssue356Case(t *testing.T) { 44 | info := &UserInfo{ 45 | Name: "test", 46 | Address: nil, 47 | Family: nil, 48 | } 49 | 50 | hessian.RegisterPOJO(info) 51 | 52 | encoder := hessian.NewEncoder() 53 | err := encoder.Encode(info) 54 | if err != nil { 55 | t.Error(err) 56 | return 57 | } 58 | 59 | enBuf := encoder.Buffer() 60 | 61 | decoder := hessian.NewDecoder(enBuf) 62 | dec, err := decoder.Decode() 63 | assert.Nil(t, err) 64 | 65 | t.Log(dec) 66 | 67 | assert.True(t, reflect.DeepEqual(info, dec)) 68 | } 69 | -------------------------------------------------------------------------------- /testcases/user/user_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package user 19 | 20 | import ( 21 | "testing" 22 | "time" 23 | ) 24 | 25 | import ( 26 | hessian "github.com/apache/dubbo-go-hessian2" 27 | ) 28 | 29 | import ( 30 | "github.com/stretchr/testify/assert" 31 | ) 32 | 33 | func TestEnumConvert(t *testing.T) { 34 | var g interface{} 35 | g = WOMAN 36 | 37 | // new defined type cant be converted to the original type. 38 | failConvertedValue, ok := g.(hessian.JavaEnum) 39 | assert.False(t, ok) 40 | assert.Equal(t, hessian.JavaEnum(0), failConvertedValue) 41 | } 42 | 43 | func TestUserEncodeDecode(t *testing.T) { 44 | ts, _ := time.Parse("2006-01-02 15:04:05", "2019-01-01 12:34:56") 45 | u1 := &User{ID: "001", Name: "Lily", Age: 18, Time: ts.Local(), Sex: WOMAN} 46 | hessian.RegisterPOJO(u1) 47 | 48 | encoder := hessian.NewEncoder() 49 | err := encoder.Encode(u1) 50 | assert.Nil(t, err) 51 | 52 | buf := encoder.Buffer() 53 | decoder := hessian.NewDecoder(buf) 54 | dec, err := decoder.Decode() 55 | assert.Nil(t, err) 56 | 57 | assert.Equal(t, u1, dec) 58 | } 59 | --------------------------------------------------------------------------------