id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
4,501
return m_request; } public ICMPEchoPacket getResponse() { return m_response; } <BUG>public int getRetries() { return m_retries; } public long getTimeout() { return m_timeout; }</BUG> public long getExpiration() {
[DELETED]
4,502
} catch (Throwable t) { m_callback.handleError(this, t); }</BUG> } public void processResponse(ICMPEchoPacket packet) { <BUG>m_response = packet; m_callback.handleResponse(packet);</BUG> } public PingRequest processTimeout() { PingRequest returnval = null;
ICMPEchoPacket iPkt = new ICMPEchoPacket(getTid()); iPkt.setIdentity(FILTER_ID); iPkt.setSequenceId(getSequenceId()); iPkt.computeChecksum(); m_request = iPkt; log().info(System.currentTimeMillis()+": Ping Response Received "+this); m_callback.handleResponse(packet);
4,503
} public PingRequest processTimeout() { PingRequest returnval = null; if (this.isExpired()) { if (this.getRetries() > 0) { <BUG>returnval = new PingRequest(getAddress(), getTimeout(), getRetries() - 1, getTid(), getSequenceId(), m_callback); } else { m_callback.handleTimeout(getRequest());</BUG> }
private DatagramPacket createDatagram() { byte[] data = m_request.toBytes(); DatagramPacket packet = new DatagramPacket(data, data.length, getAddress(), 0); return packet;
4,504
soi.getSharedObject().sendMessage("userJoin", list); } } public void left(String room, Integer participant){ log.debug("Participant $user leaving"); <BUG>SharedObjectInfo soi = voiceRooms.get(room); </BUG> if (soi != null) { List<String> list = new ArrayList<String>(); list.add(participant.toString());
RoomInfo soi = voiceRooms.get(room);
4,505
soi.getSharedObject().sendMessage("userLeft", list); } } public void muted(String room, Integer participant, Boolean muted){ log.debug("Participant $user mute $muted"); <BUG>SharedObjectInfo soi = voiceRooms.get(room); </BUG> if (soi != null) { List<String> list = new ArrayList<String>(); list.add(participant.toString());
RoomInfo soi = voiceRooms.get(room);
4,506
soi.getSharedObject().sendMessage("userMute", list); } } public void talking(String room, Integer participant, Boolean talking){ log.debug("Participant $user talk $talking"); <BUG>SharedObjectInfo soi = voiceRooms.get(room); </BUG> if (soi != null) { List<String> list = new ArrayList<String>(); list.add(participant.toString());
RoomInfo soi = voiceRooms.get(room);
4,507
import com.google.api.codegen.py.PythonGapicContext; import com.google.api.codegen.py.PythonInterfaceInitializer; import com.google.api.codegen.py.PythonProtoFileInitializer; import com.google.api.codegen.py.PythonSnippetSetRunner; import com.google.api.codegen.rendering.CommonSnippetSetRunner; <BUG>import com.google.api.codegen.ruby.RubyGapicContext; import com.google.api.codegen.ruby.RubySnippetSetRunner;</BUG> import com.google.api.codegen.transformer.csharp.CSharpGapicClientTransformer; import com.google.api.codegen.transformer.csharp.CSharpGapicSnippetsTransformer; import com.google.api.codegen.transformer.go.GoGapicSurfaceTestTransformer;
[DELETED]
4,508
import com.google.api.codegen.transformer.php.PhpGapicSurfaceTestTransformer; import com.google.api.codegen.transformer.php.PhpGapicSurfaceTransformer; import com.google.api.codegen.transformer.php.PhpPackageMetadataTransformer; import com.google.api.codegen.transformer.py.PythonPackageMetadataTransformer; import com.google.api.codegen.transformer.ruby.RubyGapicSurfaceDocTransformer; <BUG>import com.google.api.codegen.transformer.ruby.RubyGapicSurfaceTestTransformer; import com.google.api.codegen.transformer.ruby.RubyPackageMetadataTransformer;</BUG> import com.google.api.codegen.util.CommonRenderingUtil; import com.google.api.codegen.util.csharp.CSharpNameFormatter; import com.google.api.codegen.util.csharp.CSharpRenderingUtil;
import com.google.api.codegen.transformer.ruby.RubyGapicSurfaceTransformer; import com.google.api.codegen.transformer.ruby.RubyPackageMetadataTransformer;
4,509
.setPrefix("lib") .setShouldAppendPackage(true) .setPackageFilePathNameFormatter(new RubyNameFormatter()) .build(); GapicProvider<? extends Object> mainProvider = <BUG>CommonGapicProvider.<Interface>newBuilder() .setModel(model) .setView(new InterfaceView()) .setContext(new RubyGapicContext(model, apiConfig, packageConfig)) .setSnippetSetRunner( new RubySnippetSetRunner<Interface>(SnippetSetRunner.SNIPPET_RESOURCE_ROOT)) .setSnippetFileNames(Arrays.asList("ruby/main.snip")) .setCodePathMapper(rubyPathMapper)</BUG> .build();
ViewModelGapicProvider.newBuilder() .setApiConfig(apiConfig) .setSnippetSetRunner(new CommonSnippetSetRunner(new CommonRenderingUtil())) .setModelToViewTransformer( new RubyGapicSurfaceTransformer(rubyPathMapper, packageConfig))
4,510
JApiMethod jApiMethod = getJApiMethod(jApiClass.getMethods(), "method"); assertThat(jApiMethod.getCompatibilityChanges().size(), is(0)); assertThat(jApiMethod.isBinaryCompatible(), is(true)); assertThat(jApiMethod.isSourceCompatible(), is(true)); } <BUG>@Test public void testClassNowCheckedException() throws Exception {</BUG> JarArchiveComparatorOptions options = new JarArchiveComparatorOptions(); options.setAccessModifier(AccessModifier.PRIVATE); List<JApiClass> jApiClasses = ClassesHelper.compareClasses(options, new ClassesHelper.ClassesGenerator() {
assertThat(jApiMethod.getCompatibilityChanges(), hasItem(JApiCompatibilityChange.METHOD_ADDED_TO_INTERFACE)); assertThat(jApiMethod.isSourceCompatible(), is(false)); public void testAbstractClassNowExtendsAnotherAbstractClass() throws Exception { options.setIncludeSynthetic(true);
4,511
if (postAnalysisFilterScript != null) { if (Files.exists(Paths.get(postAnalysisFilterScript))) { ScriptEngine scriptEngine = new ScriptEngineManager().getEngineByName("groovy"); Bindings bindings = scriptEngine.createBindings(); bindings.put("jApiClasses", jApiClasses); <BUG>try { Object returnValue = scriptEngine.eval(new FileReader(postAnalysisFilterScript), bindings); </BUG> if (returnValue instanceof List) { List returnedList = (List) returnValue;
try (InputStreamReader fileReader = new InputStreamReader(new FileInputStream(postAnalysisFilterScript), Charset.forName("UTF-8"))) { Object returnValue = scriptEngine.eval(fileReader, bindings);
4,512
throw new MojoFailureException("Post-analysis script does not return a list."); } } catch (ScriptException e) { throw new MojoFailureException("Execution of post-analysis script failed: " + e.getMessage(), e); } catch (FileNotFoundException e) { <BUG>throw new MojoFailureException("Post-analysis script '" + postAnalysisFilterScript + " does not exist."); }</BUG> } else { throw new MojoFailureException("Post-analysis script '" + postAnalysisFilterScript + " does not exist."); }
} catch (IOException e) { throw new MojoFailureException("Failed to load post-analysis script '" + postAnalysisFilterScript + ": " + e.getMessage(), e);
4,513
private String generateDiffOutput(List<JApiClass> jApiClasses, Options options) { StdoutOutputGenerator stdoutOutputGenerator = new StdoutOutputGenerator(options, jApiClasses); return stdoutOutputGenerator.generate(); } private XmlOutput generateXmlOutput(List<JApiClass> jApiClasses, File jApiCmpBuildDir, Options options, MavenParameters mavenParameters, PluginParameters pluginParameters) throws IOException, MojoFailureException { <BUG>String filename = createFilename(mavenParameters); options.setXmlOutputFile(Optional.of(jApiCmpBuildDir.getCanonicalPath() + File.separator + filename + ".xml")); options.setHtmlOutputFile(Optional.of(jApiCmpBuildDir.getCanonicalPath() + File.separator + filename + ".html")); SemverOut semverOut = new SemverOut(options, jApiClasses);</BUG> XmlOutputGeneratorOptions xmlOutputGeneratorOptions = new XmlOutputGeneratorOptions();
if (!skipXmlReport(pluginParameters)) { if (!skipHtmlReport(pluginParameters)) { SemverOut semverOut = new SemverOut(options, jApiClasses);
4,514
} else { if (getLog().isDebugEnabled()) { getLog().debug("Element <dependencies/> found. Using " + JApiCli.ClassPathMode.ONE_COMMON_CLASSPATH); } for (Dependency dependency : pluginParameters.getDependenciesParam()) { <BUG>List<File> files = resolveDependencyToFile("dependencies", dependency, mavenParameters, true, pluginParameters); </BUG> for (File file : files) { comparatorOptions.getClassPathEntries().add(file.getAbsolutePath()); }
List<File> files = resolveDependencyToFile("dependencies", dependency, mavenParameters, true, pluginParameters, ConfigurationVersion.NEW);
4,515
Set<Artifact> dependencyArtifacts = mavenParameters.getMavenProject().getArtifacts(); Set<String> classPathEntries = new HashSet<>(); for (Artifact artifact : dependencyArtifacts) { String scope = artifact.getScope(); if (!"test".equals(scope) && !artifact.isOptional()) { <BUG>Set<Artifact> artifacts = resolveArtifact(artifact, mavenParameters, false, pluginParameters); </BUG> for (Artifact resolvedArtifact : artifacts) { File resolvedFile = resolvedArtifact.getFile(); if (resolvedFile != null) {
Set<Artifact> artifacts = resolveArtifact(artifact, mavenParameters, false, pluginParameters, configurationVersion);
4,516
} for (String classPathEntry : classPathEntries) { comparatorOptions.getClassPathEntries().add(classPathEntry); } } <BUG>private List<File> retrieveFileFromConfiguration(DependencyDescriptor dependencyDescriptor, String parameterName, MavenParameters mavenParameters, PluginParameters pluginParameters) throws MojoFailureException { </BUG> List<File> files; if (dependencyDescriptor instanceof Dependency) { Dependency dependency = (Dependency) dependencyDescriptor;
comparatorOptions.setClassPathMode(JarArchiveComparatorOptions.ClassPathMode.ONE_COMMON_CLASSPATH);
4,517
throw new MojoFailureException("Missing configuration parameter 'dependency'."); } } throw new MojoFailureException(String.format("Missing configuration parameter: %s", parameterName)); } <BUG>private List<File> resolveConfigurationFileToFile(String parameterName, ConfigurationFile configurationFile) throws MojoFailureException { </BUG> String path = configurationFile.getPath(); if (path == null) { throw new MojoFailureException(String.format("The path element in the configuration of the plugin is missing for %s.", parameterName));
private List<File> resolveConfigurationFileToFile(String parameterName, ConfigurationFile configurationFile, ConfigurationVersion configurationVersion, PluginParameters pluginParameters) throws MojoFailureException {
4,518
String path = configurationFile.getPath(); if (path == null) { throw new MojoFailureException(String.format("The path element in the configuration of the plugin is missing for %s.", parameterName)); } File file = new File(path); <BUG>if (!file.exists()) { throw new MojoFailureException(String.format("The path '%s' does not point to an existing file.", path)); } if (!file.isFile() || !file.canRead()) { throw new MojoFailureException(String.format("The file given by path '%s' is either not a file or is not readable.", path)); } return Collections.singletonList(file);</BUG> }
[DELETED]
4,519
throw new MojoFailureException(String.format("The file given by path '%s' is either not a file or is not readable.", path)); } return Collections.singletonList(file);</BUG> } <BUG>private List<File> resolveDependencyToFile(String parameterName, Dependency dependency, MavenParameters mavenParameters, boolean transitively, PluginParameters pluginParameters) throws MojoFailureException { </BUG> List<File> files = new ArrayList<>(); if (getLog().isDebugEnabled()) { getLog().debug("Trying to resolve dependency '" + dependency + "' to file."); }
return Collections.singletonList(file); private List<File> resolveDependencyToFile(String parameterName, Dependency dependency, MavenParameters mavenParameters, boolean transitively, PluginParameters pluginParameters, ConfigurationVersion configurationVersion) throws MojoFailureException {
4,520
getLog().debug("Trying to resolve dependency '" + dependency + "' to file."); } if (dependency.getSystemPath() == null) { String descriptor = dependency.getGroupId() + ":" + dependency.getArtifactId() + ":" + dependency.getVersion(); getLog().debug(parameterName + ": " + descriptor); <BUG>Set<Artifact> artifacts = resolveArtifact(dependency, mavenParameters, transitively, pluginParameters); </BUG> for (Artifact artifact : artifacts) { File file = artifact.getFile(); if (file != null) {
Set<Artifact> artifacts = resolveArtifact(dependency, mavenParameters, transitively, pluginParameters, configurationVersion);
4,521
throw new MojoFailureException(String.format("Could not resolve dependency with descriptor '%s'.", descriptor)); } } if (files.size() == 0) { String message = String.format("Could not resolve dependency with descriptor '%s'.", descriptor); <BUG>if (ignoreNonResolvableArtifacts(pluginParameters)) { getLog().warn(message);</BUG> } else { throw new MojoFailureException(message); }
if (ignoreNonResolvableArtifacts(pluginParameters) || ignoreMissingOldVersion(pluginParameters, configurationVersion)) { getLog().warn(message);
4,522
} retval.append(kss.getDataContents() + NEWLINE); if (typeIn.equals(KickstartScript.TYPE_POST) && ksdata.getPostLog()) { addLogEnd(retval, POST_LOG_FILE + "." + kss.getPosition(), <BUG>StringUtils.isBlank(kss.getInterpreter())); }</BUG> else if (typeIn.equals(KickstartScript.TYPE_PRE) && ksdata.getPreLog()) { addLogEnd(retval, PRE_LOG_FILE + "." + kss.getPosition(),
if (!StringUtils.isBlank(kss.getInterpreter())) { retval.append("%" + typeIn + SPACE + INTERPRETER_OPT + SPACE + kss.getInterpreter());
4,523
else { retval.append("%" + KickstartScript.TYPE_POST + SPACE + NOCHROOT); } if (ksdata.getNonChrootPost()) { <BUG>addLogBegin(retval, POST_LOG_NOCHROOT_FILE + "." + kss.getPosition(), StringUtils.isBlank(kss.getInterpreter()));</BUG> retval.append(RHN_TRACE); }
retval.append("%" + typeIn); if (typeIn.equals(KickstartScript.TYPE_POST) && ksdata.getPostLog()) { addLogBegin(retval, POST_LOG_FILE + "." + kss.getPosition(), kss.getInterpreter()); else if (typeIn.equals(KickstartScript.TYPE_PRE) && ksdata.getPreLog()) { addLogBegin(retval, PRE_LOG_FILE + "." + kss.getPosition(), kss.getInterpreter());
4,524
addCobblerSnippet(retval, DEFAULT_MOTD); addCobblerSnippet(retval, REDHAT_REGISTER_SNIPPET); retval.append("# end cobbler snippet" + NEWLINE); retval.append(NEWLINE); retval.append(RHNCHECK + NEWLINE); <BUG>addLogEnd(retval, RHN_LOG_FILE, true); </BUG> retval.append(NEWLINE); if (!this.ksdata.getKickstartDefaults().getKstree().getChannel(). getChannelArch().getName().startsWith("s390")) {
addLogEnd(retval, RHN_LOG_FILE, "");
4,525
return new PointerReader(segment, location, nestingLimit); } public boolean isNull() { return this.segment.buffer.getLong(this.pointer) == 0; } <BUG>public StructReader getStruct() { return WireHelpers.readStructPointer(this.segment, this.pointer,</BUG> null, 0,
public <T> T getStruct(FromStructReader<T> factory) { return WireHelpers.readStructPointer(factory, this.pointer,
4,526
public final PointerReader reader; public Reader(PointerReader reader) { this.reader = reader; } public final <T> T getAsStruct(FromStructReader<T> factory) { <BUG>return factory.fromStructReader(this.reader.getStruct()); }</BUG> public final <T> T getAsList(FromPointerReader<T> factory) { return factory.fromPointerReader(this.reader, null, 0); }
return this.reader.getStruct(factory);
4,527
public final PointerBuilder builder; public Builder(PointerBuilder builder) { this.builder = builder; } public final <T> T initAsStruct(FromStructBuilder<T> factory) { <BUG>return factory.fromStructBuilder(this.builder.initStruct(factory.structSize())); }</BUG> public final void clear() { this.builder.clear(); }
return this.builder.initStruct(factory);
4,528
public int idx = 0; public Iterator(Reader<T> list) { this.list = list; } public T next() { <BUG>return list.factory.fromStructReader(list.reader.getStructElement(idx++)); }</BUG> public boolean hasNext() { return idx < list.size(); }
return list.reader.getStructElement(factory, idx++);
4,529
public int idx = 0; public Iterator(Builder<T> list) { this.list = list; } public T next() { <BUG>return list.factory.fromStructBuilder(list.builder.getStructElement(idx++)); }</BUG> public boolean hasNext() { return idx < list.size(); }
public Iterator(Reader<T> list) { return list.reader.getStructElement(factory, idx++);
4,530
package org.capnproto; <BUG>public final class StructBuilder { final SegmentBuilder segment; final int data; // byte offset to data section final int pointers; // word offset of pointer section final int dataSize; // in bits final short pointerCount; final byte bit0Offset; </BUG> public StructBuilder(SegmentBuilder segment, int data,
public class StructBuilder { protected final SegmentBuilder segment; protected final int data; // byte offset to data section protected final int pointers; // word offset of pointer section protected final int dataSize; // in bits protected final short pointerCount; protected final byte bit0Offset;
4,531
this.pointers = pointers; this.dataSize = dataSize; this.pointerCount = pointerCount; this.bit0Offset = bit0Offset; } <BUG>public final StructReader asReader() { return new StructReader(this.segment, this.data, this.pointers, this.dataSize, this.pointerCount, this.bit0Offset, 0x7fffffff); } public final boolean getBooleanField(int offset) { </BUG> int bitOffset = (offset == 0 ? this.bit0Offset : offset);
public final boolean _getBooleanField(int offset) {
4,532
private static final String DATASET_CAPACITY_TABLE = "dataset_capacity"; private static final String DATASET_TAG_TABLE = "dataset_tag"; private static final String DATASET_CASE_SENSITIVE_TABLE = "dataset_case_sensitivity"; private static final String DATASET_REFERENCE_TABLE = "dataset_reference"; private static final String DATASET_PARTITION_TABLE = "dataset_partition"; <BUG>private static final String DATASET_SECURITY_TABLE = "dataset_security"; </BUG> private static final String DATASET_OWNER_TABLE = "dataset_owner"; private static final String DATASET_OWNER_UNMATCHED_TABLE = "stg_dataset_owner_unmatched"; private static final String DATASET_CONSTRAINT_TABLE = "dataset_constraint";
private static final String DATASET_SECURITY_TABLE = "dataset_security_info";
4,533
throw new IllegalArgumentException( "Dataset deployment info update fail, " + "Json missing necessary fields: " + root.toString()); </BUG> } <BUG>final Object[] idUrn = findIdAndUrn(idNode, urnNode); final Integer datasetId = (Integer) idUrn[0];</BUG> final String urn = (String) idUrn[1]; ObjectMapper om = new ObjectMapper(); for (final JsonNode deploymentInfo : deployment) { DatasetDeploymentRecord record = om.convertValue(deploymentInfo, DatasetDeploymentRecord.class);
"Dataset deployment info update error, missing necessary fields: " + root.toString()); final Object[] idUrn = findDataset(root); if (idUrn[0] == null || idUrn[1] == null) { throw new IllegalArgumentException("Cannot identify dataset from id/uri/urn: " + root.toString()); final Integer datasetId = (Integer) idUrn[0];
4,534
rec.setModifiedTime(System.currentTimeMillis() / 1000); if (datasetId == 0) { DatasetRecord record = new DatasetRecord(); record.setUrn(urn); record.setSourceCreatedTime("" + rec.getCreateTime() / 1000); <BUG>record.setSchema(rec.getOriginalSchema()); record.setSchemaType(rec.getFormat()); </BUG> record.setFields((String) StringUtil.objectToJsonString(rec.getFieldSchema()));
record.setSchema(rec.getOriginalSchema().getText()); record.setSchemaType(rec.getOriginalSchema().getFormat());
4,535
datasetId = Integer.valueOf(DatasetDao.getDatasetByUrn(urn).get("id").toString()); rec.setDatasetId(datasetId); } else { DICT_DATASET_WRITER.execute(UPDATE_DICT_DATASET_WITH_SCHEMA_CHANGE, <BUG>new Object[]{rec.getOriginalSchema(), rec.getFormat(), StringUtil.objectToJsonString(rec.getFieldSchema()), "API", System.currentTimeMillis() / 1000, datasetId}); }</BUG> List<Map<String, Object>> oldInfo; try {
new Object[]{rec.getOriginalSchema().getText(), rec.getOriginalSchema().getFormat(), StringUtil.objectToJsonString(rec.getFieldSchema()), "API", System.currentTimeMillis() / 1000, datasetId});
4,536
case "deploymentInfo": try { DatasetInfoDao.updateDatasetDeployment(rootNode); } catch (Exception ex) { Logger.debug("Metadata change exception: deployment ", ex); <BUG>} break; case "caseSensitivity": try { DatasetInfoDao.updateDatasetCaseSensitivity(rootNode); } catch (Exception ex) { Logger.debug("Metadata change exception: case sensitivity ", ex);</BUG> }
[DELETED]
4,537
String command = null; String result = null; Socket socket; while (continueListenning() && (socket = getSocket()) != null) { try { <BUG>time = System.currentTimeMillis(); try {</BUG> InputStream inputStream = socket.getInputStream(); InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "ISO-8859-1"); BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
InetAddress ipAddress = socket.getInetAddress();
4,538
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "ISO-8859-1"); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); command = bufferedReader.readLine(); if (command == null) { command = "DISCONNECTED"; <BUG>} else { result = AdministrationTCP.this.processCommand(command); </BUG> OutputStream outputStream = socket.getOutputStream(); outputStream.write(result.getBytes("ISO-8859-1"));
Client client = Client.get(ipAddress); User user = client == null ? null : client.getUser(); result = AdministrationTCP.this.processCommand(user, command);
4,539
} catch (SocketException ex) { Server.logDebug("interrupted " + getName() + " connection."); result = "INTERRUPTED\n"; } finally { socket.close(); <BUG>InetAddress address = socket.getInetAddress(); </BUG> clearSocket(); Server.logAdministration( time,
InetAddress address = ipAddress;
4,540
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; <BUG>public class OpenInvEntityListener implements Listener{ OpenInv plugin; public OpenInvEntityListener(OpenInv scrap) { plugin = scrap;</BUG> }
public class OpenInvEntityListener implements Listener public OpenInvEntityListener(OpenInv scrap) plugin = scrap;
4,541
package lishid.openinv; import lishid.openinv.commands.*; <BUG>import lishid.openinv.utils.Metrics; import org.bukkit.ChatColor;</BUG> import org.bukkit.entity.Player; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginManager;
import java.util.HashMap; import lishid.openinv.utils.OpenInvPlayerInventory; import org.bukkit.ChatColor;
4,542
mainPlugin.getConfig().set("AnyChest." + name.toLowerCase() + ".toggle", status); mainPlugin.saveConfig(); } public static int GetItemOpenInvItem() { <BUG>if(mainPlugin.getConfig().get("ItemOpenInvItemID") == null) </BUG> { SaveToConfig("ItemOpenInvItemID", 280); }
if (mainPlugin.getConfig().get("ItemOpenInvItemID") == null)
4,543
package com.projecttango.examples.java.augmentedreality; import com.google.atap.tangoservice.Tango; import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoCameraIntrinsics; import com.google.atap.tangoservice.TangoConfig; <BUG>import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoEvent;</BUG> import com.google.atap.tangoservice.TangoOutOfDateException; import com.google.atap.tangoservice.TangoPoseData; import com.google.atap.tangoservice.TangoXyzIjData;
import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
4,544
super.onResume(); if (!mIsConnected) { mTango = new Tango(AugmentedRealityActivity.this, new Runnable() { @Override public void run() { <BUG>try { connectTango();</BUG> setupRenderer(); mIsConnected = true; } catch (TangoOutOfDateException e) {
TangoSupport.initialize(); connectTango();
4,545
if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) { mRenderer.updateRenderCameraPose(lastFramePose, mExtrinsics); mCameraPoseTimestamp = lastFramePose.timestamp;</BUG> } else { <BUG>Log.w(TAG, "Can't get device pose at time: " + mRgbTimestampGlThread); }</BUG> } } } @Override
mRenderer.updateRenderCameraPose(lastFramePose); mCameraPoseTimestamp = lastFramePose.timestamp; Log.w(TAG, "Can't get device pose at time: " +
4,546
import org.rajawali3d.materials.Material; import org.rajawali3d.materials.methods.DiffuseMethod; import org.rajawali3d.materials.textures.ATexture; import org.rajawali3d.materials.textures.StreamingTexture; import org.rajawali3d.materials.textures.Texture; <BUG>import org.rajawali3d.math.Matrix4; import org.rajawali3d.math.vector.Vector3;</BUG> import org.rajawali3d.primitives.ScreenQuad; import org.rajawali3d.primitives.Sphere; import org.rajawali3d.renderer.RajawaliRenderer;
import org.rajawali3d.math.Quaternion; import org.rajawali3d.math.vector.Vector3;
4,547
translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE); translationMoon.setTransformable3D(moon); getCurrentScene().registerAnimation(translationMoon); translationMoon.play(); } <BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) { Pose cameraPose = ScenePoseCalculator.toOpenGlCameraPose(devicePose, extrinsics); getCurrentCamera().setRotation(cameraPose.getOrientation()); getCurrentCamera().setPosition(cameraPose.getPosition()); }</BUG> public int getTextureId() {
public void updateRenderCameraPose(TangoPoseData cameraPose) { float[] rotation = cameraPose.getRotationAsFloats(); float[] translation = cameraPose.getTranslationAsFloats(); Quaternion quaternion = new Quaternion(rotation[3], rotation[0], rotation[1], rotation[2]); getCurrentCamera().setRotation(quaternion.conjugate()); getCurrentCamera().setPosition(translation[0], translation[1], translation[2]);
4,548
package com.projecttango.examples.java.helloareadescription; import com.google.atap.tangoservice.Tango; <BUG>import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoConfig;</BUG> import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
import com.google.atap.tangoservice.TangoAreaDescriptionMetaData; import com.google.atap.tangoservice.TangoConfig;
4,549
package com.eucalyptus.ws.handlers; import java.io.StringReader; <BUG>import java.net.URLDecoder; import java.security.PublicKey;</BUG> import java.security.Signature; import java.security.cert.X509Certificate; import java.util.ArrayList;
import java.security.GeneralSecurityException; import java.security.PublicKey;
4,550
package org.jetlang.web; <BUG>import org.jetlang.core.Disposable; import org.jetlang.core.Scheduler;</BUG> import org.jetlang.fibers.NioFiber; import java.io.IOException; import java.net.SocketAddress;
import org.jetlang.core.DisposingExecutor; import org.jetlang.core.Scheduler;
4,551
import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; <BUG>public class WebSocketConnection implements Scheduler { </BUG> public static final byte OPCODE_CONT = 0x0; public static final byte OPCODE_TEXT = 0x1; public static final byte OPCODE_BINARY = 0x2;
public class WebSocketConnection implements Scheduler, DisposingExecutor {
4,552
return send(OPCODE_TEXT, bytes, 0, bytes.length); } public SendResult sendPong(byte[] bytes, int offset, int length) { return send(OPCODE_PONG, bytes, offset, length); } <BUG>void onClose() { closed = true; }</BUG> enum SizeType { Small(125, 1) {
synchronized (disposables) { disposables.forEach(Disposable::dispose);
4,553
<BUG>package gov.nysenate.openleg.service.spotcheck.senatesite; import gov.nysenate.openleg.client.view.base.MapView;</BUG> import gov.nysenate.openleg.client.view.bill.*; import gov.nysenate.openleg.client.view.entity.MemberView; import gov.nysenate.openleg.model.base.Version;
import com.google.common.collect.ImmutableList; import gov.nysenate.openleg.client.view.base.ListView; import gov.nysenate.openleg.client.view.base.MapView;
4,554
import gov.nysenate.openleg.model.spotcheck.senatesite.SenateSiteBill; import gov.nysenate.openleg.service.bill.data.BillAmendNotFoundEx; import gov.nysenate.openleg.service.spotcheck.base.BaseSpotCheckService; import org.apache.commons.lang3.NotImplementedException; import org.apache.commons.lang3.StringUtils; <BUG>import org.springframework.stereotype.Service; import java.time.LocalDateTime;</BUG> import java.util.Collections; import java.util.List; import java.util.Optional;
import java.time.LocalDate; import java.time.LocalDateTime;
4,555
checkText(amendment, reference, observation); checkMemo(amendment, reference, observation); checkCoSponsors(amendment, reference, observation); checkMultiSponsors(amendment, reference, observation); checkHasSameAs(amendment, reference, observation); <BUG>checkSameAs(amendment, reference, observation); return observation;</BUG> } private void checkBasePrintNo(BillView content, SenateSiteBill reference, SpotCheckObservation<BillId> observation) { checkString(content.getBasePrintNo(), reference.getBasePrintNo(), observation, BILL_BASE_PRINT_NO);
checkLawCode(amendment, reference, observation); checkLawSection(amendment, reference, observation); return observation;
4,556
private void checkActiveVersion(BillView content, SenateSiteBill reference, SpotCheckObservation<BillId> observation) { checkObject(content.getActiveVersion(), StringUtils.upperCase(reference.getActiveVersion()), observation, BILL_ACTIVE_AMENDMENT); } private void checkSameAs(BillAmendmentView content, SenateSiteBill reference, SpotCheckObservation<BillId> observation) { <BUG>TreeSet<BillId> olSameAs = content.getSameAs().getItems().stream() .map(BillIdView::toBillId)</BUG> .collect(Collectors.toCollection(TreeSet::new)); TreeSet<BillId> refSameAs = new TreeSet<>(reference.getSameAs()); checkCollection(olSameAs, refSameAs, observation, BILL_SAME_AS);
TreeSet<BillId> olSameAs = Optional.ofNullable(content.getSameAs()) .map(ListView::getItems) .orElse(ImmutableList.of()) .map(BillIdView::toBillId)
4,557
.collect(Collectors.toCollection(TreeSet::new)); TreeSet<BillId> refSameAs = new TreeSet<>(reference.getSameAs()); checkCollection(olSameAs, refSameAs, observation, BILL_SAME_AS); } private void checkPrevVersions(BillView content, SenateSiteBill reference, SpotCheckObservation<BillId> observation) { <BUG>TreeSet<BillId> olPrevVers = content.getPreviousVersions().getItems().stream() .map(BillIdView::toBillId)</BUG> .collect(Collectors.toCollection(TreeSet::new)); TreeSet<BillId> refPrevVers = new TreeSet<>(reference.getPreviousVersions());
TreeSet<BillId> olPrevVers = Optional.ofNullable(content.getPreviousVersions()) .map(ListView::getItems) .orElse(ImmutableList.of()) .map(BillIdView::toBillId)
4,558
action.getChamber() + " " + action.getDate() + " " + action.getText(); } private void checkActions(BillView content, SenateSiteBill reference, SpotCheckObservation<BillId> observation) { <BUG>List<BillAction> contentActions = content.getActions().getItems().stream() .map(BillActionView::toBillAction)</BUG> .collect(Collectors.toList()); checkCollection(contentActions, reference.getActions(), observation, BILL_ACTION, this::billActionToString, "\n");
List<BillAction> contentActions = Optional.ofNullable(content.getActions()) .map(ListView::getItems) .orElse(ImmutableList.of()) .map(BillActionView::toBillAction)
4,559
status.getActionDate() + " " + status.getCommitteeName() + " " + status.getStatusType() + " " + status.getStatusDesc(); } <BUG>private void checkMilestones(BillView content, SenateSiteBill reference, SpotCheckObservation<BillId> observation) { checkCollection(content.getMilestones().getItems(), reference.getMilestones(), observation, BILL_MILESTONES, this::billStatusToString, "\n");</BUG> } private void checkLastStatus(BillView content, SenateSiteBill reference, SpotCheckObservation<BillId> observation) {
List<BillStatusView> contentMilestones = Optional.ofNullable(content.getMilestones()) .map(ListView::getItems) .orElse(ImmutableList.of()); checkCollection(contentMilestones, reference.getMilestones(), observation, BILL_MILESTONES, this::billStatusToString, "\n");
4,560
package com.projecttango.examples.java.augmentedreality; import com.google.atap.tangoservice.Tango; import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoCameraIntrinsics; import com.google.atap.tangoservice.TangoConfig; <BUG>import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoEvent;</BUG> import com.google.atap.tangoservice.TangoOutOfDateException; import com.google.atap.tangoservice.TangoPoseData; import com.google.atap.tangoservice.TangoXyzIjData;
import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
4,561
super.onResume(); if (!mIsConnected) { mTango = new Tango(AugmentedRealityActivity.this, new Runnable() { @Override public void run() { <BUG>try { connectTango();</BUG> setupRenderer(); mIsConnected = true; } catch (TangoOutOfDateException e) {
TangoSupport.initialize(); connectTango();
4,562
if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) { mRenderer.updateRenderCameraPose(lastFramePose, mExtrinsics); mCameraPoseTimestamp = lastFramePose.timestamp;</BUG> } else { <BUG>Log.w(TAG, "Can't get device pose at time: " + mRgbTimestampGlThread); }</BUG> } } } @Override
mRenderer.updateRenderCameraPose(lastFramePose); mCameraPoseTimestamp = lastFramePose.timestamp; Log.w(TAG, "Can't get device pose at time: " +
4,563
import org.rajawali3d.materials.Material; import org.rajawali3d.materials.methods.DiffuseMethod; import org.rajawali3d.materials.textures.ATexture; import org.rajawali3d.materials.textures.StreamingTexture; import org.rajawali3d.materials.textures.Texture; <BUG>import org.rajawali3d.math.Matrix4; import org.rajawali3d.math.vector.Vector3;</BUG> import org.rajawali3d.primitives.ScreenQuad; import org.rajawali3d.primitives.Sphere; import org.rajawali3d.renderer.RajawaliRenderer;
import org.rajawali3d.math.Quaternion; import org.rajawali3d.math.vector.Vector3;
4,564
translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE); translationMoon.setTransformable3D(moon); getCurrentScene().registerAnimation(translationMoon); translationMoon.play(); } <BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) { Pose cameraPose = ScenePoseCalculator.toOpenGlCameraPose(devicePose, extrinsics); getCurrentCamera().setRotation(cameraPose.getOrientation()); getCurrentCamera().setPosition(cameraPose.getPosition()); }</BUG> public int getTextureId() {
public void updateRenderCameraPose(TangoPoseData cameraPose) { float[] rotation = cameraPose.getRotationAsFloats(); float[] translation = cameraPose.getTranslationAsFloats(); Quaternion quaternion = new Quaternion(rotation[3], rotation[0], rotation[1], rotation[2]); getCurrentCamera().setRotation(quaternion.conjugate()); getCurrentCamera().setPosition(translation[0], translation[1], translation[2]);
4,565
package com.projecttango.examples.java.helloareadescription; import com.google.atap.tangoservice.Tango; <BUG>import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoConfig;</BUG> import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
import com.google.atap.tangoservice.TangoAreaDescriptionMetaData; import com.google.atap.tangoservice.TangoConfig;
4,566
result_ = multiline_value_assignment(builder_, level_ + 1); } else if (root_ == OBJECT_PATH) { result_ = object_path(builder_, level_ + 1); } <BUG>else if (root_ == ONE_LINE_COMMENT_ELEMENT) { result_ = one_line_comment_element(builder_, level_ + 1); }</BUG> else if (root_ == UNSETTING) { result_ = unsetting(builder_, level_ + 1);
[DELETED]
4,567
else if (root_ == VALUE_MODIFICATION) { result_ = value_modification(builder_, level_ + 1); } else { Marker marker_ = builder_.mark(); <BUG>result_ = c_style_comment_element(builder_, level_ + 1); while (builder_.getTokenType() != null) {</BUG> builder_.advanceLexer(); } marker_.done(root_);
result_ = parse_root_(root_, builder_, level_); while (builder_.getTokenType() != null) {
4,568
result_ = assignment(builder_, level_ + 1); if (!result_) result_ = value_modification(builder_, level_ + 1); if (!result_) result_ = multiline_value_assignment(builder_, level_ + 1); if (!result_) result_ = copying(builder_, level_ + 1); if (!result_) result_ = unsetting(builder_, level_ + 1); <BUG>if (!result_) result_ = code_block(builder_, level_ + 1); if (!result_) {</BUG> marker_.rollbackTo(); } else {
if (!result_) result_ = condition_element(builder_, level_ + 1); if (!result_) result_ = include_statement_element(builder_, level_ + 1); if (!result_) {
4,569
else { marker_.drop(); } return result_; } <BUG>private static boolean multiline_value_assignment_4(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "multiline_value_assignment_4")) return false; </BUG> consumeToken(builder_, IGNORED_TEXT);
marker_.rollbackTo(); result_ = exitErrorRecordingSection(builder_, result_, level_, pinned_, _SECTION_GENERAL_, null); return result_ || pinned_; private static boolean multiline_value_assignment_2(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "multiline_value_assignment_2")) return false;
4,570
if (!recursion_guard_(builder_, level_, "one_line_comment_element")) return false; if (!nextTokenIs(builder_, ONE_LINE_COMMENT)) return false;</BUG> boolean result_ = false; <BUG>final Marker marker_ = builder_.mark(); result_ = consumeToken(builder_, ONE_LINE_COMMENT); if (result_) { marker_.done(ONE_LINE_COMMENT_ELEMENT); } else {</BUG> marker_.rollbackTo();
if (!recursion_guard_(builder_, level_, "object_path_1_0")) return false; return object_path_1_0_0(builder_, level_ + 1); private static boolean object_path_1_0_0(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "object_path_1_0_0")) return false; boolean pinned_ = false; enterErrorRecordingSection(builder_, level_, _SECTION_GENERAL_); result_ = consumeToken(builder_, OBJECT_PATH_ENTITY); result_ = result_ && consumeToken(builder_, OBJECT_PATH_SEPARATOR); pinned_ = result_; // pin = 2 if (!result_ && !pinned_) {
4,571
} else { updateMemo(); callback.updateMemo(); } dismiss(); <BUG>}else{ </BUG> Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show(); } }
[DELETED]
4,572
} @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_memo); <BUG>ChinaPhoneHelper.setStatusBar(this,true); </BUG> topicId = getIntent().getLongExtra("topicId", -1); if (topicId == -1) { finish();
ChinaPhoneHelper.setStatusBar(this, true);
4,573
MemoEntry.COLUMN_REF_TOPIC__ID + " = ?" , new String[]{String.valueOf(topicId)}); } public Cursor selectMemo(long topicId) { Cursor c = db.query(MemoEntry.TABLE_NAME, null, MemoEntry.COLUMN_REF_TOPIC__ID + " = ?", new String[]{String.valueOf(topicId)}, null, null, <BUG>MemoEntry._ID + " DESC", null); </BUG> if (c != null) { c.moveToFirst(); }
MemoEntry.COLUMN_ORDER + " ASC", null);
4,574
MemoEntry._ID + " = ?", new String[]{String.valueOf(memoId)}); } public long updateMemoContent(long memoId, String memoContent) { ContentValues values = new ContentValues(); <BUG>values.put(MemoEntry.COLUMN_CONTENT, memoContent); return db.update(</BUG> MemoEntry.TABLE_NAME, values, MemoEntry._ID + " = ?",
return db.update(
4,575
import android.widget.RelativeLayout; import android.widget.TextView; import com.kiminonawa.mydiary.R; import com.kiminonawa.mydiary.db.DBManager; import com.kiminonawa.mydiary.shared.EditMode; <BUG>import com.kiminonawa.mydiary.shared.ThemeManager; import java.util.List; public class MemoAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements EditMode { </BUG> private List<MemoEntity> memoList;
import com.marshalchen.ultimaterecyclerview.dragsortadapter.DragSortAdapter; public class MemoAdapter extends DragSortAdapter<DragSortAdapter.ViewHolder> implements EditMode {
4,576
private DBManager dbManager; private boolean isEditMode = false; private EditMemoDialogFragment.MemoCallback callback; private static final int TYPE_HEADER = 0; private static final int TYPE_ITEM = 1; <BUG>public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback) { this.mActivity = activity;</BUG> this.topicId = topicId; this.memoList = memoList;
public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback, RecyclerView recyclerView) { super(recyclerView); this.mActivity = activity;
4,577
this.memoList = memoList; this.dbManager = dbManager; this.callback = callback; } @Override <BUG>public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { </BUG> View view; if (isEditMode) { if (viewType == TYPE_HEADER) {
public DragSortAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
4,578
editMemoDialogFragment.show(mActivity.getSupportFragmentManager(), "editMemoDialogFragment"); } }); } } <BUG>protected class MemoViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private View rootView; private TextView TV_memo_item_content;</BUG> private ImageView IV_memo_item_delete;
protected class MemoViewHolder extends DragSortAdapter.ViewHolder implements View.OnClickListener, View.OnLongClickListener { private ImageView IV_memo_item_dot; private TextView TV_memo_item_content;
4,579
protected boolean publicScope; protected String overview; protected String doctitle; protected boolean verbose; protected String complianceLevel; <BUG>private List ajcOptions = new ArrayList(); private List pluginArtifacts; protected void executeReport( Locale locale )</BUG> throws MavenReportException
private List<String> ajcOptions = new ArrayList<String>(); private List<Artifact> pluginArtifacts; @SuppressWarnings( "unchecked" ) protected void executeReport( Locale locale )
4,580
</BUG> arguments.add( "-classpath" ); arguments.add( AjcHelper.createClassPath( project, pluginArtifacts, getClasspathDirectories() ) ); arguments.addAll( ajcOptions ); <BUG>Set includes; </BUG> try { if ( null != ajdtBuildDefFile ) {
throws MavenReportException getLog().info( "Starting generating ajdoc" ); project.getCompileSourceRoots().add( basedir.getAbsolutePath() + "/" + aspectDirectory ); project.getTestCompileSourceRoots().add( basedir.getAbsolutePath() + "/" + testAspectDirectory ); List<String> arguments = new ArrayList<String>(); Set<String> includes;
4,581
public static String createClassPath( MavenProject project, List pluginArtifacts, List outDirs ) </BUG> { String cp = new String(); <BUG>Set classPathElements = Collections.synchronizedSet( new LinkedHashSet() ); Set dependencyArtifacts = project.getDependencyArtifacts(); classPathElements.addAll( dependencyArtifacts == null ? Collections.EMPTY_SET : dependencyArtifacts ); </BUG> classPathElements.addAll( project.getArtifacts() );
import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.StringUtils; public class AjcHelper public static final String DEFAULT_INCLUDES = "**/*.java, **/*.aj"; public static final String DEFAULT_EXCLUDES = ""; @SuppressWarnings( "unchecked" ) public static String createClassPath( MavenProject project, List<Artifact> pluginArtifacts, List<String> outDirs ) Set<Artifact> classPathElements = Collections.synchronizedSet( new LinkedHashSet<Artifact>() ); Set<Artifact> dependencyArtifacts = project.getDependencyArtifacts(); classPathElements.addAll( dependencyArtifacts == null ? Collections.<Artifact>emptySet() : dependencyArtifacts );
4,582
import org.apache.xerces.parsers.DOMParser; import org.apache.xerces.dom.DocumentImpl; public class DbLoader { private static String portalBaseDir; <BUG>private static String propertiesUri; private static Connection con;</BUG> private static Statement stmt; private static PreparedStatement pstmt; private static RdbmServices rdbmService;
private static String tablesUri; private static String tablesXslUri; private static Connection con;
4,583
createScript = Boolean.valueOf(PropertiesHandler.properties.getCreateScript()).booleanValue(); if (createScript) initScript(); try { <BUG>String tablesURI = UtilitiesBean.fixURI(PropertiesHandler.properties.getTablesUri()); DOMParser domParser = new DOMParser(); domParser.parse(tablesURI);</BUG> tablesDoc = domParser.getDocument(); }
tablesUri = UtilitiesBean.fixURI(PropertiesHandler.properties.getTablesUri()); domParser.parse(tablesURI);
4,584
public ReportElement getBase() { return base; } @Override public float print(PDDocument document, PDPageContentStream stream, int pageNumber, float startX, float startY, float allowedWidth) throws IOException { <BUG>PDPage currPage = (PDPage) document.getDocumentCatalog().getPages().get(pageNo); PDPageContentStream pageStream = new PDPageContentStream(document, currPage, true, false); </BUG> base.print(document, pageStream, pageNo, x, y, width); pageStream.close();
PDPage currPage = document.getDocumentCatalog().getPages().get(pageNo); PDPageContentStream pageStream = new PDPageContentStream(document, currPage, PDPageContentStream.AppendMode.APPEND, false);
4,585
public PdfTextStyle(String config) { Assert.hasText(config); String[] split = config.split(","); Assert.isTrue(split.length == 3, "config must look like: 10,Times-Roman,#000000"); fontSize = Integer.parseInt(split[0]); <BUG>font = resolveStandard14Name(split[1]); color = new Color(Integer.valueOf(split[2].substring(1), 16));</BUG> } public int getFontSize() { return fontSize;
font = getFont(split[1]); color = new Color(Integer.valueOf(split[2].substring(1), 16));
4,586
package cc.catalysts.boot.report.pdf.elements; import cc.catalysts.boot.report.pdf.config.PdfTextStyle; import cc.catalysts.boot.report.pdf.utils.ReportAlignType; import org.apache.pdfbox.pdmodel.PDPageContentStream; <BUG>import org.apache.pdfbox.pdmodel.font.PDFont; import org.slf4j.Logger;</BUG> import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; import java.io.IOException;
import org.apache.pdfbox.pdmodel.font.PDType1Font; import org.apache.pdfbox.util.Matrix; import org.slf4j.Logger;
4,587
addTextSimple(stream, textConfig, textX, nextLineY, ""); return nextLineY; } try { <BUG>String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, fixedText); </BUG> float x = calculateAlignPosition(textX, align, textConfig, allowedWidth, split[0]); if (!underline) { addTextSimple(stream, textConfig, x, nextLineY, split[0]); } else {
String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, text);
4,588
public static void addTextSimple(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) { try { stream.setFont(textConfig.getFont(), textConfig.getFontSize()); stream.setNonStrokingColor(textConfig.getColor()); stream.beginText(); <BUG>stream.newLineAtOffset(textX, textY); stream.showText(text);</BUG> } catch (Exception e) { LOG.warn("Could not add text: " + e.getClass() + " - " + e.getMessage()); }
stream.setTextMatrix(new Matrix(1,0,0,1, textX, textY)); stream.showText(text);
4,589
public static void addTextSimpleUnderlined(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) { addTextSimple(stream, textConfig, textX, textY, text); try { float lineOffset = textConfig.getFontSize() / 8F; stream.setStrokingColor(textConfig.getColor()); <BUG>stream.setLineWidth(0.5F); stream.drawLine(textX, textY - lineOffset, textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset); </BUG> stream.stroke(); } catch (IOException e) {
stream.moveTo(textX, textY - lineOffset); stream.lineTo(textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset);
4,590
list.add(text.length()); return list; } public static String[] splitText(PDFont font, int fontSize, float allowedWidth, String text) { String endPart = ""; <BUG>String shortenedText = text; List<String> breakSplitted = Arrays.asList(shortenedText.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList()); if (breakSplitted.size() > 1) {</BUG> String[] splittedFirst = splitText(font, fontSize, allowedWidth, breakSplitted.get(0)); StringBuilder remaining = new StringBuilder(splittedFirst[1] == null ? "" : splittedFirst[1] + "\n");
List<String> breakSplitted = Arrays.asList(text.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList()); if (breakSplitted.size() > 1) {
4,591
package cc.catalysts.boot.report.pdf.elements; import org.apache.pdfbox.pdmodel.PDDocument; <BUG>import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; import java.io.IOException;</BUG> import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList;
import org.apache.pdfbox.pdmodel.PDPageContentStream; import java.io.IOException;
4,592
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
4,593
final int lineStride = dst.getScanlineStride(); final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final byte[][] data = dst.getByteDataArrays(); final float[] warpData = new float[2 * dstWidth]; <BUG>int lineOffset = 0; if (ctable == null) { // source does not have IndexColorModel if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset;
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
4,594
pixelOffset += pixelStride; } // COLS LOOP } // ROWS LOOP } } else {// source has IndexColorModel <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
} else if (caseB) { for (int h = 0; h < dstHeight; h++) {
4,595
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
4,596
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final short[][] data = dst.getShortDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
4,597
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
4,598
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final short[][] data = dst.getShortDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
4,599
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
4,600
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final int[][] data = dst.getIntDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {