-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix for - Indention not working if custom CharacterEscapeHandler i…
…s set and encoding is set to 'UTF-8 (#1156) Bugfix + unit test for "Indention not working if custom CharacterEscapeHandler is set and encoding is set to 'UTF-8" bug. Signed-off-by: Radek Felcman <[email protected]>
- Loading branch information
Showing
3 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...t/src/org/eclipse/persistence/testing/oxm/xmlmarshaller/CustomCharacterEscapeHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, | ||
* or the Eclipse Distribution License v. 1.0 which is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
*/ | ||
|
||
// Contributors: | ||
// Oracle - initial API and implementation | ||
package org.eclipse.persistence.testing.oxm.xmlmarshaller; | ||
|
||
import org.eclipse.persistence.oxm.CharacterEscapeHandler; | ||
|
||
import java.io.IOException; | ||
import java.io.Writer; | ||
|
||
public class CustomCharacterEscapeHandler implements CharacterEscapeHandler { | ||
|
||
@Override | ||
public void escape(char[] buf, int start, int len, boolean isAttValue, Writer out) throws IOException { | ||
for (int i = start; i < start + len; i++) { | ||
char ch = buf[i]; | ||
if (ch == '%') { | ||
out.write("*"); | ||
continue; | ||
} | ||
out.write(ch); | ||
} | ||
String end = ""; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters