id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
9,201
public static String detectJarVersion(@NotNull String detectionClass, @NotNull List<VirtualFile> files) { VirtualFile jarRoot = LibrariesHelper.getInstance().findRootByClass(files, detectionClass); return jarRoot != null && jarRoot.getFileSystem() instanceof JarFileSystem ? JdkUtil.getJarMainAttribute(jarRoot, Attributes.Name.IMPLEMENTATION_VERSION) : null; } <BUG>@SuppressWarnings("UnusedDeclaration") </BUG> public static String detectJarVersion(@Nullable com.intellij.openapi.vfs.JarFile zipFile) { if (zipFile == null) { return null;
@SuppressWarnings({"UnusedDeclaration", "deprecation"})
9,202
public static final String JAR_SEPARATOR = URLUtil.JAR_SEPARATOR; public static JarFileSystem getInstance() { return (JarFileSystem)VirtualFileManager.getInstance().getFileSystem(PROTOCOL); } @Nullable <BUG>public abstract VirtualFile getVirtualFileForJar(@Nullable VirtualFile entryVFile); public abstract JarFile getJarFile(@NotNull VirtualFile entryVFile) throws IOException;</BUG> @SuppressWarnings("MethodMayBeStatic") @Nullable public VirtualFile getJarRootForLocalFile(@NotNull VirtualFile virtualFile) {
@SuppressWarnings({"UnusedDeclaration", "deprecation"}) public abstract JarFile getJarFile(@NotNull VirtualFile entryVFile) throws IOException;
9,203
VirtualFile virtualFileToLoad = myFilesToLoadQueue.poll(); if (virtualFileToLoad != null) { FileContent content = new FileContent(virtualFileToLoad); if (isValidFile(virtualFileToLoad)) { try { <BUG>content.getBytes(); } catch (Throwable t) { if (t instanceof IOException || t instanceof InvalidVirtualFileAccessException) { LOG.info(t);</BUG> }
return content;
9,204
package com.intellij.openapi.vfs.impl.jar; import com.intellij.openapi.diagnostic.LogUtil; import com.intellij.openapi.diagnostic.Logger; <BUG>import com.intellij.openapi.util.io.BufferExposingByteArrayInputStream; import com.intellij.openapi.util.io.FileAttributes; import com.intellij.openapi.util.io.FileSystemUtil; import com.intellij.openapi.util.io.FileUtil; </BUG> import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.io.*;
9,205
getOrCreate(entry, map, zip); }</BUG> myRelPathsToEntries = new SoftReference<Map<String, EntryInfo>>(Collections.unmodifiableMap(map)); } <BUG>else { map = Collections.emptyMap(); } }</BUG> }
Map<String, EntryInfo> map = SoftReference.dereference(myRelPathsToEntries); if (map == null) { synchronized (myLock) { map = SoftReference.dereference(myRelPathsToEntries); if (map == null) { if (myCorruptedJar) {
9,206
EntryInfo parentInfo = getOrCreate(parentName, map, zip); info = new EntryInfo(parentInfo, shortName, true, DEFAULT_LENGTH, DEFAULT_TIMESTAMP); map.put(entryName, info); } if (!info.isDirectory) { <BUG>LOG.info(zip.getZipFile().getName() + ": " + entryName + " should be a directory"); info = new EntryInfo(info.parent, info.shortName, true, info.length, info.timestamp);</BUG> map.put(entryName, info); } return info;
if (".".equals(shortName)) { return parentInfo; info = new EntryInfo(parentInfo, shortName, isDirectory, entry.getSize(), entry.getTime());
9,207
public boolean isDirectory(@NotNull VirtualFile file) { if (file.getParent() == null) return true; EntryInfo info = getEntryInfo(file); return info == null || info.isDirectory; } <BUG>public boolean exists(@NotNull VirtualFile file) { if (file.getParent() == null) { return myJarFile.get() != null || getOriginalFile().exists(); } return getEntryInfo(file) != null;</BUG> }
if (file.getParent() == null) return getOriginalFile().exists(); return info != null;
9,208
public InputStream getInputStream(@NotNull VirtualFile file) throws IOException { return new BufferExposingByteArrayInputStream(contentsToByteArray(file)); } @NotNull public byte[] contentsToByteArray(@NotNull VirtualFile file) throws IOException { <BUG>JarFile jar = getJar(); if (jar != null) { JarFile.JarEntry entry = jar.getEntry(getRelativePath(file)); if (entry != null) { InputStream stream = jar.getInputStream(entry); </BUG> if (stream != null) {
ZipFile zip = getZipFile();
9,209
finally { stream.close(); } } } <BUG>} return ArrayUtil.EMPTY_BYTE_ARRAY; } private static class MyJarFile implements JarFile {</BUG> private static class MyJarEntry implements JarFile.JarEntry {
ZipFileCache.release(zip); @SuppressWarnings("deprecation") private static class MyJarFile implements JarFile {
9,210
import board.items.BrdItem; import board.items.BrdTracep; import board.varie.BrdKeepPoint; import freert.planar.PlaDirection; import freert.planar.PlaLimits; <BUG>import freert.planar.PlaLineInt; import freert.planar.PlaPoint;</BUG> import freert.planar.PlaPointFloat; import freert.planar.PlaPointInt; import freert.planar.PlaSide;
import freert.planar.PlaLineIntAlist; import freert.planar.PlaPoint;
9,211
for (int index = 1; index < line_arr.length - 2; ++index) </BUG> { <BUG>PlaDirection d1 = line_arr[index].direction(); PlaDirection d2 = line_arr[index + 1].direction(); </BUG> if (d1.is_multiple_of_45_degree() && d2.is_multiple_of_45_degree() && d1.projection(d2) != Signum.POSITIVE) {
boolean polyline_changed = true; while (polyline_changed) if (p_polyline.plaline_len() < 4) return p_polyline; polyline_changed = false; PlaLineIntAlist line_arr = p_polyline.alist_copy(0); for (int index = 1; index < line_arr.size() - 2; ++index) PlaDirection d1 = line_arr.get(index).direction(); PlaDirection d2 = line_arr.get(index + 1).direction();
9,212
if (!(prev_line.is_diagonal() && next_line.is_diagonal())) { return null; } PlaPointFloat curr_corner = prev_line.intersection_approx(next_line); <BUG>PlaPointFloat prev_corner = prev_line.intersection_approx(p_line_arr[p_no - 1]); PlaPointFloat next_corner = next_line.intersection_approx(p_line_arr[p_no + 2]); </BUG> PlaLineInt result = null;
PlaPointFloat prev_corner = prev_line.intersection_approx(p_line_arr.get(p_no - 1)); PlaPointFloat next_corner = next_line.intersection_approx(p_line_arr.get(p_no + 2));
9,213
if (translate_line.side_of(next_corner) == PlaSide.ON_THE_LEFT) { max_translate_dist = -max_translate_dist; } PlaLineInt[] check_lines = new PlaLineInt[3]; <BUG>check_lines[0] = p_line_arr[p_no]; check_lines[2] = p_line_arr[p_no + 1]; </BUG> double translate_dist = max_translate_dist;
check_lines[0] = p_line_arr.get(p_no); check_lines[2] = p_line_arr.get(p_no + 1);
9,214
double delta_dist = max_translate_dist; PlaSide side_of_nearest_point = translate_line.side_of(nearest_point); int sign = Signum.as_int(max_translate_dist); PlaLineInt new_line = null; PlaLineInt[] check_lines = new PlaLineInt[3]; <BUG>check_lines[0] = p_line_arr[p_no - 1]; check_lines[2] = p_line_arr[p_no + 1]; </BUG> boolean first_time = true;
check_lines[0] = p_line_arr.get(p_no - 1); check_lines[2] = p_line_arr.get(p_no + 1);
9,215
return new_line; } private Polyline reposition_lines(Polyline p_polyline) { if (p_polyline.plaline_len() < 5) return p_polyline; <BUG>PlaLineInt[] line_arr = p_polyline.alist_to_array(); </BUG> for (int index = 2; index < p_polyline.plaline_len(-2); ++index) { PlaLineInt new_line = reposition_line(line_arr, index);
PlaLineIntAlist line_arr = p_polyline.alist_copy(0);
9,216
</BUG> for (int index = 2; index < p_polyline.plaline_len(-2); ++index) { PlaLineInt new_line = reposition_line(line_arr, index); if (new_line == null) continue; <BUG>line_arr[index] = new_line; </BUG> Polyline result = new Polyline(line_arr); return skip_segments_of_length_0(result); }
return new_line; private Polyline reposition_lines(Polyline p_polyline) if (p_polyline.plaline_len() < 5) return p_polyline; PlaLineIntAlist line_arr = p_polyline.alist_copy(0); line_arr.set(index, new_line);
9,217
return new Polyline(new_lines); } } else if (bend) { <BUG>PlaLineInt[] check_line_arr = new PlaLineInt[trace_polyline.plaline_len(+1)]; for (int index = 0; index < trace_polyline.plaline_len(-1); ++index) { check_line_arr[index] = trace_polyline.plaline(index); } check_line_arr[check_line_arr.length - 2] = other_trace_line; check_line_arr[check_line_arr.length - 1] = other_prev_trace_line;</BUG> PlaLineInt new_line = reposition_line(check_line_arr, trace_polyline.plaline_len(-2));
PlaLineIntAlist check_line_arr = new PlaLineIntAlist(trace_polyline.plaline_len(+1)); trace_polyline.alist_append_to(check_line_arr, 0,trace_polyline.plaline_len(-1)); check_line_arr.add( other_trace_line); check_line_arr.add( other_prev_trace_line);
9,218
chart.addYAxisLabels(AxisLabelsFactory.newAxisLabels(labels)); chart.addXAxisLabels(AxisLabelsFactory.newNumericRangeAxisLabels(0, max)); chart.setBarWidth(BarChart.AUTO_RESIZE); chart.setSize(600, 500); chart.setHorizontal(true); <BUG>chart.setTitle("Total Evaluations by User"); showChartImg(resp, chart.toURLString()); }</BUG> private List<Entry<String, Integer>> sortEntries(Collection<Entry<String, Integer>> entries) { List<Entry<String, Integer>> result = new ArrayList<Entry<String, Integer>>(entries);
chart.setDataEncoding(DataEncoding.TEXT); return chart; }
9,219
checkEvaluationsEqual(eval4, foundissueProto.getEvaluations(0)); checkEvaluationsEqual(eval5, foundissueProto.getEvaluations(1)); } public void testGetRecentEvaluationsNoneFound() throws Exception { DbIssue issue = createDbIssue("fad", persistenceHelper); <BUG>DbEvaluation eval1 = createEvaluation(issue, "someone", 100); DbEvaluation eval2 = createEvaluation(issue, "someone", 200); DbEvaluation eval3 = createEvaluation(issue, "someone", 300); issue.addEvaluations(eval1, eval2, eval3);</BUG> getPersistenceManager().makePersistent(issue);
[DELETED]
9,220
public int read() throws IOException { return inputStream.read(); } }); } <BUG>} protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) {</BUG> DbUser user; Query query = getPersistenceManager().newQuery("select from " + persistenceHelper.getDbUserClass().getName() + " where openid == :myopenid");
@SuppressWarnings({"unchecked"}) protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) {
9,221
eval.setComment("my comment"); eval.setDesignation("MUST_FIX"); eval.setIssue(issue); eval.setWhen(when); eval.setWho(user.createKeyObject()); <BUG>eval.setEmail(who); return eval;</BUG> } protected PersistenceManager getPersistenceManager() { return testHelper.getPersistenceManager();
issue.addEvaluation(eval); return eval;
9,222
this.tasks = tasks; this.rootBuildScriptDir = rootBuildScriptDir; this.buildFile = buildFile; this.useWrapper = useWrapper; this.gradleName = gradleName; // May be null <BUG>this.wrapperScript = wrapperScript; // May be null </BUG> this.makeExecutable = Boolean.TRUE.equals(makeExecutable); // May be null this.useWorkspaceAsHome = useWorkspaceAsHome; this.passAsProperties = passAsProperties;
this.wrapperLocation = wrapperLocation; // May be null
9,223
rootBuildScriptNormalized = Util.replaceMacro(rootBuildScriptNormalized, build.getBuildVariableResolver()); normalizedRootBuildScriptDir = new FilePath(build.getModuleRoot(), rootBuildScriptNormalized); } ArgumentListBuilder args = new ArgumentListBuilder(); if (useWrapper) { <BUG>FilePath gradleWrapperFile = getGradleWrapperFile(build, launcher, env); </BUG> if( !gradleWrapperFile.exists() ) { listener.fatalError("Unable to find Gradle Wrapper"); return false;
FilePath gradleWrapperFile = getGradleWrapperFile(build, launcher, env, normalizedRootBuildScriptDir);
9,224
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.List; <BUG>import java.util.Optional; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandDelete extends FCCommandBase { private static final FlagMapper MAPPER = map -> key -> value -> { map.put(key, value);
import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
9,225
.append(Text.of(TextColors.GREEN, "Usage: ")) .append(getUsage(source)) .build()); return CommandResult.empty(); } else if (isIn(REGIONS_ALIASES, parse.args[0])) { <BUG>if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); IRegion region = FGManager.getInstance().getRegion(parse.args[1]); </BUG> boolean isWorldRegion = false; if (region == null) {
String regionName = parse.args[1]; IRegion region = FGManager.getInstance().getRegion(regionName).orElse(null);
9,226
</BUG> isWorldRegion = true; } if (region == null) <BUG>throw new CommandException(Text.of("No region exists with the name \"" + parse.args[1] + "\"!")); if (region instanceof GlobalWorldRegion) { </BUG> throw new CommandException(Text.of("You may not delete the global region!")); }
if (world == null) throw new CommandException(Text.of("No world exists with name \"" + worldName + "\"!")); if (world == null) throw new CommandException(Text.of("Must specify a world!")); region = FGManager.getInstance().getWorldRegion(world, regionName).orElse(null); throw new CommandException(Text.of("No region exists with the name \"" + regionName + "\"!")); if (region instanceof IGlobal) {
9,227
source.getName() + " deleted " + (isWorldRegion ? "world" : "") + "region" ); return CommandResult.success(); } else if (isIn(HANDLERS_ALIASES, parse.args[0])) { if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); <BUG>IHandler handler = FGManager.getInstance().gethandler(parse.args[1]); if (handler == null) throw new ArgumentParseException(Text.of("No handler exists with that name!"), parse.args[1], 1); if (handler instanceof GlobalHandler)</BUG> throw new CommandException(Text.of("You may not delete the global handler!"));
Optional<IHandler> handlerOpt = FGManager.getInstance().gethandler(parse.args[1]); if (!handlerOpt.isPresent()) IHandler handler = handlerOpt.get(); if (handler instanceof GlobalHandler)
9,228
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
9,229
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
9,230
@Dependency(id = "foxcore") }, description = "A world protection plugin built for SpongeAPI. Requires FoxCore.", authors = {"gravityfox"}, url = "https://github.com/FoxDenStudio/FoxGuard") <BUG>public final class FoxGuardMain { public final Cause pluginCause = Cause.builder().named("plugin", this).build(); private static FoxGuardMain instanceField;</BUG> @Inject private Logger logger;
private static FoxGuardMain instanceField;
9,231
private UserStorageService userStorage; private EconomyService economyService = null; private boolean loaded = false; private FCCommandDispatcher fgDispatcher; public static FoxGuardMain instance() { <BUG>return instanceField; }</BUG> @Listener public void construct(GameConstructionEvent event) { instanceField = this;
} public static Cause getCause() { return instance().pluginCause; }
9,232
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
[DELETED]
9,233
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.*; <BUG>import java.util.stream.Collectors; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandHere extends FCCommandBase { private static final String[] PRIORITY_ALIASES = {"priority", "prio", "p"}; private static final FlagMapper MAPPER = map -> key -> value -> {
import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
9,234
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index > 0) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
9,235
private static FGStorageManager instance; private final Logger logger = FoxGuardMain.instance().getLogger();</BUG> private final Set<LoadEntry> loaded = new HashSet<>(); private final Path directory = getDirectory(); private final Map<String, Path> worldDirectories; <BUG>private FGStorageManager() { defaultModifiedMap = new CacheMap<>((k, m) -> {</BUG> if (k instanceof IFGObject) { m.put((IFGObject) k, true); return true;
public final HashMap<IFGObject, Boolean> defaultModifiedMap; private final UserStorageService userStorageService; private final Logger logger = FoxGuardMain.instance().getLogger(); userStorageService = FoxGuardMain.instance().getUserStorage(); defaultModifiedMap = new CacheMap<>((k, m) -> {
9,236
String name = fgObject.getName(); Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving handler \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
UUID owner = fgObject.getOwner(); boolean isOwned = !owner.equals(SERVER_UUID); Optional<User> userOwner = userStorageService.get(owner); String logName = (userOwner.isPresent() ? userOwner.get().getName() + ":" : "") + (isOwned ? owner + ":" : "") + name; if (fgObject.autoSave()) { Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving handler " + logName + " in directory: " + singleDir);
9,237
if (fgObject.autoSave()) { Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving world region \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir);
9,238
public synchronized void loadRegionLinks() { logger.info("Loading region links"); try (DB mainDB = DBMaker.fileDB(directory.resolve("regions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getRegion(entry.getKey()); if (region != null) { logger.info("Loading links for region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IRegion> regionOpt = FGManager.getInstance().getRegion(entry.getKey()); if (regionOpt.isPresent()) { IRegion region = regionOpt.get(); logger.info("Loading links for region \"" + region.getName() + "\"");
9,239
public synchronized void loadWorldRegionLinks(World world) { logger.info("Loading world region links for world \"" + world.getName() + "\""); try (DB mainDB = DBMaker.fileDB(worldDirectories.get(world.getName()).resolve("wregions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (region != null) { logger.info("Loading links for world region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IWorldRegion> regionOpt = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (regionOpt.isPresent()) { IWorldRegion region = regionOpt.get(); logger.info("Loading links for world region \"" + region.getName() + "\"");
9,240
StringBuilder builder = new StringBuilder(); for (Iterator<IHandler> it = handlers.iterator(); it.hasNext(); ) { builder.append(it.next().getName()); if (it.hasNext()) builder.append(","); } <BUG>return builder.toString(); }</BUG> private final class LoadEntry { public final String name; public final Type type;
public enum Type { REGION, WREGION, HANDLER
9,241
.autoCloseQuotes(true) .leaveFinalAsIs(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "worldregion", "handler", "controller").stream() </BUG> .filter(new StartsWithPredicate(parse.current.token)) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "worldregion", "handler", "controller")
9,242
import java.sql.SQLException; import java.sql.Statement; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; <BUG>import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set;</BUG> import java.util.concurrent.locks.Lock;
import java.util.HashMap; import java.util.Map; import java.util.Set;
9,243
if (msgin != null) { try { msgin.close(); } catch (IOException e) { } <BUG>} } } protected void updateSourceSequence(SourceSequence seq) </BUG> throws SQLException {
releaseResources(stmt, null); protected void storeMessage(Identifier sid, RMMessage msg, boolean outbound) throws IOException, SQLException { storeMessage(connection, sid, msg, outbound); protected void updateSourceSequence(Connection con, SourceSequence seq)
9,244
} catch (SQLException ex) { if (!isTableExistsError(ex)) { throw ex; } else { LOG.fine("Table CXF_RM_SRC_SEQUENCES already exists."); <BUG>verifyTable(SRC_SEQUENCES_TABLE_NAME, SRC_SEQUENCES_TABLE_COLS); </BUG> } } finally { stmt.close();
verifyTable(con, SRC_SEQUENCES_TABLE_NAME, SRC_SEQUENCES_TABLE_COLS);
9,245
} catch (SQLException ex) { if (!isTableExistsError(ex)) { throw ex; } else { LOG.fine("Table CXF_RM_DEST_SEQUENCES already exists."); <BUG>verifyTable(DEST_SEQUENCES_TABLE_NAME, DEST_SEQUENCES_TABLE_COLS); </BUG> } } finally { stmt.close();
LOG.fine("Table CXF_RM_SRC_SEQUENCES already exists."); verifyTable(con, SRC_SEQUENCES_TABLE_NAME, SRC_SEQUENCES_TABLE_COLS);
9,246
} } finally { stmt.close(); } for (String tableName : new String[] {OUTBOUND_MSGS_TABLE_NAME, INBOUND_MSGS_TABLE_NAME}) { <BUG>stmt = connection.createStatement(); try {</BUG> stmt.executeUpdate(MessageFormat.format(CREATE_MESSAGES_TABLE_STMT, tableName)); } catch (SQLException ex) { if (!isTableExistsError(ex)) {
stmt = con.createStatement(); try { stmt.executeUpdate(CREATE_DEST_SEQUENCES_TABLE_STMT);
9,247
throw ex; } else { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Table " + tableName + " already exists."); } <BUG>verifyTable(tableName, MESSAGES_TABLE_COLS); </BUG> } } finally { stmt.close();
LOG.fine("Table CXF_RM_SRC_SEQUENCES already exists."); verifyTable(con, SRC_SEQUENCES_TABLE_NAME, SRC_SEQUENCES_TABLE_COLS);
9,248
if (newCols.size() > 0) { if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Table " + tableName + " needs additional columns"); } for (String[] newCol : newCols) { <BUG>Statement st = connection.createStatement(); try {</BUG> st.executeUpdate(MessageFormat.format(ALTER_TABLE_STMT_STR, tableName, newCol[0], newCol[1])); if (LOG.isLoggable(Level.FINE)) {
Statement st = con.createStatement(); try {
9,249
if (nextReconnectAttempt < System.currentTimeMillis()) { nextReconnectAttempt = System.currentTimeMillis() + reconnectDelay; reconnectDelay = reconnectDelay * useExponentialBackOff; } } <BUG>} public static void deleteDatabaseFiles() {</BUG> deleteDatabaseFiles(DEFAULT_DATABASE_NAME, true); } public static void deleteDatabaseFiles(String dbName, boolean now) {
public static void deleteDatabaseFiles() {
9,250
} pt = pt_iterator.next(); p = p_iterator.next();</BUG> { SNode _nodeToCheck_1029348928467 = invoke; <BUG>BaseIntentionProvider intentionProvider = null; typeCheckingContext.createLessThanInequation(typeCheckingContext.typeOf(p, "r:00000000-0000-4000-0000-011c89590337(jetbrains.mps.baseLanguage.closures.typesystem)", "1202920138888", true), pt, _nodeToCheck_1029348928467, null, "r:00000000-0000-4000-0000-011c89590337(jetbrains.mps.baseLanguage.closures.typesystem)", "1202920135673", false, 0, intentionProvider); } } } } }, "r:00000000-0000-4000-0000-011c89590337(jetbrains.mps.baseLanguage.closures.typesystem)", "1199567113016");</BUG> }
public void applyRule(final SNode invoke, final TypeCheckingContext typeCheckingContext) { List<SNode> ptypes = new ArrayList<SNode>(); for(SNode p : SLinkOperations.getTargets(invoke, "parameter", true)) { ptypes.add(typeCheckingContext.typeOf(p, "r:00000000-0000-4000-0000-011c89590337(jetbrains.mps.baseLanguage.closures.typesystem)", "1225470166988", true)); final SNode ret_typevar_1225470166995 = typeCheckingContext.createNewRuntimeTypesVariable(); typeCheckingContext.createEquation(typeCheckingContext.typeOf(invoke, "r:00000000-0000-4000-0000-011c89590337(jetbrains.mps.baseLanguage.closures.typesystem)", "1225470167000", true), typeCheckingContext.getEquationManager().getRepresentator(ret_typevar_1225470166995), _nodeToCheck_1029348928467, null, "r:00000000-0000-4000-0000-011c89590337(jetbrains.mps.baseLanguage.closures.typesystem)", "1225470166996", intentionProvider);
9,251
SNode st = SConceptOperations.createNewNode("jetbrains.mps.baseLanguage.collections.structure.SequenceType", null); SLinkOperations.setTarget(st, "elementType", typeCheckingContext.getEquationManager().getRepresentator(YLCS_typevar_1221579075693), true); { SNode _nodeToCheck_1029348928467 = closure; BaseIntentionProvider intentionProvider = null; <BUG>typeCheckingContext.createEquation(typeCheckingContext.typeOf(closure, "r:00000000-0000-4000-0000-011c89590337(jetbrains.mps.baseLanguage.closures.typesystem)", "1221579075903", true), new _Quotations.QuotationClass_5().createNode(paramTypes, st, realThrows, typeCheckingContext), _nodeToCheck_1029348928467, null, "r:00000000-0000-4000-0000-011c89590337(jetbrains.mps.baseLanguage.closures.typesystem)", "1221579075901", intentionProvider); </BUG> } } else {
typeCheckingContext.createEquation(typeCheckingContext.typeOf(closure, "r:00000000-0000-4000-0000-011c89590337(jetbrains.mps.baseLanguage.closures.typesystem)", "1221579075903", true), new _Quotations.QuotationClass_7().createNode(paramTypes, st, realThrows, typeCheckingContext), _nodeToCheck_1029348928467, null, "r:00000000-0000-4000-0000-011c89590337(jetbrains.mps.baseLanguage.closures.typesystem)", "1221579075901", intentionProvider);
9,252
List<SNode> paramTypes = new ArrayList<SNode>(); for(SNode p : SLinkOperations.getTargets(md, "parameter", true)) { paramTypes.add(ClassifierTypeUtil.resolveType(SLinkOperations.getTarget(p, "type", true), ct)); } SNode resType = ClassifierTypeUtil.resolveType(SLinkOperations.getTarget(md, "returnType", true), ct); <BUG>supertypes = Collections.singletonList(new _Quotations.QuotationClass_0().createNode(paramTypes, resType)); </BUG> } } return supertypes;
supertypes = Collections.singletonList(new _Quotations.QuotationClass_2().createNode(paramTypes, resType));
9,253
List<SNode> supertypes = Collections.emptyList(); String rtSig = "_FunctionTypes." + FunctionType_Behavior.call_getRuntimeSignature_1213877404927(ft); List<SNode> interfaces = RulesUtil_Closures.getInterfaces(); for(SNode ice : interfaces) { if (rtSig.equals(SPropertyOperations.getString(ice, "name"))) { <BUG>SNode ct = new _Quotations.QuotationClass_1().createNode(ice); </BUG> if ((SLinkOperations.getTarget(ft, "resultType", true) != null) && !(SNodeOperations.isInstanceOf(SLinkOperations.getTarget(ft, "resultType", true), "jetbrains.mps.baseLanguage.structure.VoidType"))) { SLinkOperations.addChild(ct, "parameter", SNodeOperations.copyNode(SLinkOperations.getTarget(ft, "resultType", true))); }
SNode ct = new _Quotations.QuotationClass_3().createNode(ice);
9,254
import jetbrains.mps.lang.typesystem.runtime.AbstractInferenceRule_Runtime; import jetbrains.mps.lang.typesystem.runtime.InferenceRule_Runtime; import jetbrains.mps.smodel.SNode; import jetbrains.mps.typesystem.inference.TypeCheckingContext; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations; <BUG>import jetbrains.mps.intentions.BaseIntentionProvider; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; import java.util.Iterator;</BUG> import jetbrains.mps.smodel.SModelUtil_new; public class typeof_InvokeExpression_InferenceRule extends AbstractInferenceRule_Runtime implements InferenceRule_Runtime {
import java.util.List; import java.util.ArrayList;
9,255
public void applyRule(final SNode invoke, final TypeCheckingContext typeCheckingContext) { final SNode cl = SNodeOperations.getAncestor(invoke, "jetbrains.mps.baseLanguage.closures.structure.ClosureLiteral", false, false); if (!((cl != null))) { BaseIntentionProvider intentionProvider = null; typeCheckingContext.reportTypeError(invoke, "Must be within ClosureLiteral", "r:00000000-0000-4000-0000-011c89590337(jetbrains.mps.baseLanguage.closures.typesystem)", "1199711581032", intentionProvider); <BUG>} { final SNode _representatorVar1 = typeCheckingContext.typeOf(cl, "r:00000000-0000-4000-0000-011c89590337(jetbrains.mps.baseLanguage.closures.typesystem)", "1199711625694", true); typeCheckingContext.whenConcrete(_representatorVar1, new Runnable() { public void run() { SNode ft = typeCheckingContext.typeOf(cl, "r:00000000-0000-4000-0000-011c89590337(jetbrains.mps.baseLanguage.closures.typesystem)", "1199711616632", true); {</BUG> SNode _nodeToCheck_1029348928467 = invoke;
[DELETED]
9,256
if (connect(isProducer)) { break; } } catch (InvalidSelectorException e) { throw new ConnectionException( <BUG>"Connection to JMS failed. Invalid message selector"); } catch (JMSException | NamingException e) { logger.log(LogLevel.ERROR, "RECONNECTION_EXCEPTION", </BUG> new Object[] { e.toString() });
Messages.getString("CONNECTION_TO_JMS_FAILED_INVALID_MSG_SELECTOR")); //$NON-NLS-1$ logger.log(LogLevel.ERROR, "RECONNECTION_EXCEPTION", //$NON-NLS-1$
9,257
private synchronized void createConnectionNoRetry() throws ConnectionException { if (!isConnectValid()) { try { connect(isProducer); } catch (JMSException e) { <BUG>logger.log(LogLevel.ERROR, "Connection to JMS failed", new Object[] { e.toString() }); throw new ConnectionException( "Connection to JMS failed. Did not try to reconnect as the policy is reconnection policy does not apply here."); }</BUG> }
logger.log(LogLevel.ERROR, "CONNECTION_TO_JMS_FAILED", new Object[] { e.toString() }); //$NON-NLS-1$ Messages.getString("CONNECTION_TO_JMS_FAILED_NO_RECONNECT_AS_RECONNECT_POLICY_DOES_NOT_APPLY")); //$NON-NLS-1$
9,258
boolean res = false; int count = 0; do { try { if(count > 0) { <BUG>logger.log(LogLevel.INFO, "ATTEMPT_TO_RESEND_MESSAGE", new Object[] { count }); </BUG> Thread.sleep(messageRetryDelay); } synchronized (getSession()) {
logger.log(LogLevel.INFO, "ATTEMPT_TO_RESEND_MESSAGE", new Object[] { count }); //$NON-NLS-1$
9,259
getProducer().send(message); res = true; } } catch (JMSException e) { <BUG>logger.log(LogLevel.WARN, "ERROR_DURING_SEND", new Object[] { e.toString() }); logger.log(LogLevel.INFO, "ATTEMPT_TO_RECONNECT"); </BUG> setConnect(null);
logger.log(LogLevel.WARN, "ERROR_DURING_SEND", new Object[] { e.toString() }); //$NON-NLS-1$ logger.log(LogLevel.INFO, "ATTEMPT_TO_RECONNECT"); //$NON-NLS-1$
9,260
import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import com.ibm.streams.operator.Attribute; import com.ibm.streams.operator.StreamSchema; import com.ibm.streams.operator.Type; <BUG>import com.ibm.streams.operator.Type.MetaType; class ConnectionDocumentParser {</BUG> private static final Set<String> supportedSPLTypes = new HashSet<String>(Arrays.asList("int8", "uint8", "int16", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ "uint16", "int32", "uint32", "int64", "float32", "float64", "boolean", "blob", "rstring", "uint64", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ "decimal32", "decimal64", "decimal128", "ustring", "timestamp", "xml")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
import com.ibm.streamsx.messaging.jms.Messages; class ConnectionDocumentParser {
9,261
return msgClass; } private void convertProviderURLPath(File applicationDir) throws ParseConnectionDocumentException { if(!isAMQ()) { if(this.providerURL == null || this.providerURL.trim().length() == 0) { <BUG>throw new ParseConnectionDocumentException("A value must be specified for provider_url attribute in connection document"); }</BUG> try { URL url = new URL(providerURL); if("file".equalsIgnoreCase(url.getProtocol())) { //$NON-NLS-1$
throw new ParseConnectionDocumentException(Messages.getString("PROVIDER_URL_MUST_BE_SPECIFIED_IN_CONN_DOC")); //$NON-NLS-1$
9,262
URL absProviderURL = new URL(url.getProtocol(), url.getHost(), applicationDir.getAbsolutePath() + File.separator + path); this.providerURL = absProviderURL.toExternalForm(); } } } catch (MalformedURLException e) { <BUG>throw new ParseConnectionDocumentException("Invalid provider_url value detected: " + e.getMessage()); }</BUG> } } public void parseAndValidateConnectionDocument(String connectionDocument, String connection, String access,
throw new ParseConnectionDocumentException(Messages.getString("INVALID_PROVIDER_URL", e.getMessage())); //$NON-NLS-1$
9,263
for (int j = 0; j < accessSpecChildNodes.getLength(); j++) { if (accessSpecChildNodes.item(j).getNodeName().equals("destination")) { //$NON-NLS-1$ destIndex = j; } else if (accessSpecChildNodes.item(j).getNodeName().equals("uses_connection")) { //$NON-NLS-1$ if (!connection.equals(accessSpecChildNodes.item(j).getAttributes().getNamedItem("connection") //$NON-NLS-1$ <BUG>.getNodeValue())) { throw new ParseConnectionDocumentException("The value of the connection parameter " + connection + " is not the same as the connection used by access element " + access + " as mentioned in the uses_connection element in connections document");</BUG> }
throw new ParseConnectionDocumentException(Messages.getString("VALUE_OF_CONNECTION_PARAM_NOT_THE_SAME_AS_CONN_USED_BY_ACCESS_ELEMENT", connection, access )); //$NON-NLS-1$
9,264
nativeSchema = access_specification.item(i).getChildNodes().item(nativeSchemaIndex); } break; } } <BUG>if (!accessFound) { throw new ParseConnectionDocumentException("The value of the access parameter " + access + " is not found in the connections document");</BUG> } return nativeSchema;
throw new ParseConnectionDocumentException(Messages.getString("VALUE_OF_ACCESS_PARAM_NOT_FOUND_IN_CONN_DOC", access )); //$NON-NLS-1$
9,265
nativeAttrLength = Integer.parseInt((attrList.item(i).getAttributes().getNamedItem("length") //$NON-NLS-1$ .getNodeValue())); } if ((msgClass == MessageClass.wbe || msgClass == MessageClass.wbe22) && ((streamSchema.getAttribute(nativeAttrName) != null) && (streamSchema <BUG>.getAttribute(nativeAttrName).getType().getMetaType() == Type.MetaType.BLOB))) { throw new ParseConnectionDocumentException(" Blob data type is not supported for message class " + msgClass);</BUG> } Iterator<NativeSchema> it = nativeSchemaObjects.iterator();
throw new ParseConnectionDocumentException(Messages.getString("BLOB_NOT_SUPPORTED_FOR_MSG_CLASS", msgClass)); //$NON-NLS-1$
9,266
throw new ParseConnectionDocumentException(" Blob data type is not supported for message class " + msgClass);</BUG> } Iterator<NativeSchema> it = nativeSchemaObjects.iterator(); while (it.hasNext()) { <BUG>if (it.next().getName().equals(nativeAttrName)) { throw new ParseConnectionDocumentException("Parameter name: " + nativeAttrName + " is appearing more than once In native schema file");</BUG> } }
nativeAttrLength = Integer.parseInt((attrList.item(i).getAttributes().getNamedItem("length") //$NON-NLS-1$ .getNodeValue())); if ((msgClass == MessageClass.wbe || msgClass == MessageClass.wbe22) && ((streamSchema.getAttribute(nativeAttrName) != null) && (streamSchema .getAttribute(nativeAttrName).getType().getMetaType() == Type.MetaType.BLOB))) { throw new ParseConnectionDocumentException(Messages.getString("BLOB_NOT_SUPPORTED_FOR_MSG_CLASS", msgClass)); //$NON-NLS-1$ throw new ParseConnectionDocumentException(Messages.getString("PARAMETER_NOT_UNIQUE_IN_NATIVE_SCHEMA", nativeAttrName )); //$NON-NLS-1$
9,267
if (msgClass == MessageClass.text) { typesWithLength = new HashSet<String>(Arrays.asList("Bytes")); //$NON-NLS-1$ } Set<String> typesWithoutLength = new HashSet<String>(Arrays.asList("Byte", "Short", "Int", "Long", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ "Float", "Double", "Boolean")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ <BUG>if (typesWithoutLength.contains(nativeAttrType) && nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA) { throw new ParseConnectionDocumentException("Length attribute should not be present for parameter: " + nativeAttrName + " In native schema file");</BUG> } if ((nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA)
throw new ParseConnectionDocumentException(Messages.getString("LENGTH_ATTRIB_SHOULD_NOT_BE_PRESENT_FOR_PARAM_IN_NATIVE_SCHEMA", nativeAttrName )); //$NON-NLS-1$
9,268
if ((nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA) && (msgClass == MessageClass.wbe || msgClass == MessageClass.wbe22 || msgClass == MessageClass.xml) && (streamSchema.getAttribute(nativeAttrName) != null) && (streamSchema.getAttribute(nativeAttrName).getType().getMetaType() != Type.MetaType.RSTRING) && (streamSchema.getAttribute(nativeAttrName).getType().getMetaType() != Type.MetaType.USTRING) <BUG>&& (streamSchema.getAttribute(nativeAttrName).getType().getMetaType() != Type.MetaType.BLOB)) { throw new ParseConnectionDocumentException("Length attribute should not be present for parameter: " + nativeAttrName + " In native schema file");</BUG> } if (streamSchema.getAttribute(nativeAttrName) != null) {
throw new ParseConnectionDocumentException(Messages.getString("LENGTH_ATTRIB_SHOULD_NOT_BE_PRESENT_FOR_PARAM_IN_NATIVE_SCHEMA", nativeAttrName )); //$NON-NLS-1$
9,269
if (streamSchema.getAttribute(nativeAttrName) != null) { MetaType metaType = streamSchema.getAttribute(nativeAttrName).getType().getMetaType(); if (metaType == Type.MetaType.DECIMAL32 || metaType == Type.MetaType.DECIMAL64 || metaType == Type.MetaType.DECIMAL128 || metaType == Type.MetaType.TIMESTAMP) { if (nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA) { <BUG>throw new ParseConnectionDocumentException( "Length attribute should not be present for parameter: " + nativeAttrName + " with type " + metaType + " in native schema file.");</BUG> } if (msgClass == MessageClass.bytes) {
Messages.getString("LENGTH_ATTRIB_SHOULD_NOT_BE_PRESENT_FOR_PARAM_WITH_TYPE_IN_NATIVE_SCHEMA", nativeAttrName, metaType )); //$NON-NLS-1$
9,270
nativeAttrLength = -4; } } } if (typesWithLength.contains(nativeAttrType)) { <BUG>if (nativeAttrLength == LENGTH_ABSENT_IN_NATIVE_SCHEMA && msgClass == MessageClass.bytes) { throw new ParseConnectionDocumentException("Length attribute should be present for parameter: " + nativeAttrName + " In native schema file for message class bytes");</BUG> } if ((nativeAttrLength < 0) && nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA) {
throw new ParseConnectionDocumentException(Messages.getString("LENGTH_ATTRIB_SHOULD_NOT_BE_PRESENT_FOR_PARAM_IN_NATIVE_SCHEMA_FOR_MSG_CLASS_BYTES", nativeAttrName )); //$NON-NLS-1$
9,271
if (streamSchema.getAttribute(nativeAttrName) != null) { streamAttrName = streamSchema.getAttribute(nativeAttrName).getName(); streamAttrMetaType = streamSchema.getAttribute(nativeAttrName).getType().getMetaType(); if ((msgClass == MessageClass.stream || msgClass == MessageClass.map) && !mapSPLToNativeSchemaDataTypesForOtherMsgClass.get(streamAttrMetaType.getLanguageType()) <BUG>.equals(nativeAttrType)) { throw new ParseConnectionDocumentException("Attribute Name: " + nativeAttrName + " with type:" + nativeAttrType + " in the native schema cannot be mapped with attribute: " + streamAttrName + " with type : " + streamAttrMetaType.getLanguageType());</BUG> }
throw new ParseConnectionDocumentException(Messages.getString("ATTRIB_WITH_TYPE_IN_NATIVE_SCHEMA_CANNOT_BE_MAPPED_TO_ATTRIB_WITH_TYPE", nativeAttrName, nativeAttrType, streamAttrName, streamAttrMetaType.getLanguageType())); //$NON-NLS-1$
9,272
+ nativeAttrType + " in the native schema cannot be mapped with attribute: " + streamAttrName + " with type : " + streamAttrMetaType.getLanguageType());</BUG> } else if (msgClass == MessageClass.bytes && !mapSPLToNativeSchemaDataTypesForBytes.get(streamAttrMetaType.getLanguageType()).equals( <BUG>nativeAttrType)) { throw new ParseConnectionDocumentException("Attribute Name: " + nativeAttrName + " with type:" + nativeAttrType + " in the native schema cannot be mapped with attribute: " + streamAttrName + " with type : " + streamAttrMetaType.getLanguageType());</BUG> }
if (streamSchema.getAttribute(nativeAttrName) != null) { streamAttrName = streamSchema.getAttribute(nativeAttrName).getName(); streamAttrMetaType = streamSchema.getAttribute(nativeAttrName).getType().getMetaType(); if ((msgClass == MessageClass.stream || msgClass == MessageClass.map) && !mapSPLToNativeSchemaDataTypesForOtherMsgClass.get(streamAttrMetaType.getLanguageType()) .equals(nativeAttrType)) { throw new ParseConnectionDocumentException(Messages.getString("ATTRIB_WITH_TYPE_IN_NATIVE_SCHEMA_CANNOT_BE_MAPPED_TO_ATTRIB_WITH_TYPE", nativeAttrName, nativeAttrType, streamAttrName, streamAttrMetaType.getLanguageType())); //$NON-NLS-1$ throw new ParseConnectionDocumentException(Messages.getString("ATTRIB_WITH_TYPE_IN_NATIVE_SCHEMA_CANNOT_BE_MAPPED_TO_ATTRIB_WITH_TYPE", nativeAttrName, nativeAttrType, streamAttrName, streamAttrMetaType.getLanguageType())); //$NON-NLS-1$
9,273
package com.ibm.streamsx.messaging.i18n; import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; public class Messages { <BUG>private static final String BUNDLE_NAME = "com.ibm.streamsx.messaging.mqtt.MQTTMessages"; //$NON-NLS-1$ </BUG> private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle .getBundle(BUNDLE_NAME); private Messages() {
private static final String BUNDLE_NAME = "com.ibm.streamsx.messaging.i18n.CommonMessages"; //$NON-NLS-1$
9,274
eExisting = (EventStat) c.list().get(0); } if(eExisting == null) eExisting = eUpdate; else <BUG>eExisting.setCount(eExisting.getCount() + eUpdate.getCount()); session.saveOrUpdate(eExisting);</BUG> } } private void doUpdateResourceStatObjects(Session session, Collection<ResourceStat> objects) {
String eExistingSiteId = eExisting.getSiteId(); if ((eExistingSiteId!=null) && (eExistingSiteId.trim().length()>0)) session.saveOrUpdate(eExisting);
9,275
eExisting = (ResourceStat) c.list().get(0); } if(eExisting == null) eExisting = eUpdate; else <BUG>eExisting.setCount(eExisting.getCount() + eUpdate.getCount()); session.saveOrUpdate(eExisting);</BUG> } } private void doUpdateSiteActivityObjects(Session session, Collection<SiteActivity> objects) {
String eExistingSiteId = eExisting.getSiteId(); if ((eExistingSiteId!=null) && (eExistingSiteId.trim().length()>0)) session.saveOrUpdate(eExisting);
9,276
eExisting = (SiteActivity) c.list().get(0); } if(eExisting == null) eExisting = eUpdate; else <BUG>eExisting.setCount(eExisting.getCount() + eUpdate.getCount()); session.saveOrUpdate(eExisting);</BUG> } } private void doUpdateSiteVisitsObjects(Session session, Collection<SiteVisits> objects, Map<UniqueVisitsKey, Integer> map) {
String eExistingSiteId = eExisting.getSiteId(); if ((eExistingSiteId!=null) && (eExistingSiteId.trim().length()>0)) session.saveOrUpdate(eExisting);
9,277
else return null; }else { ToolInfo toolInfo = eventIdToolMap.get(eventId); EventParserTip parserTip = toolInfo.getEventParserTip(); <BUG>if(parserTip != null && parserTip.getFor().equals(StatsManager.PARSERTIP_FOR_CONTEXTID)) { int index = Integer.parseInt(parserTip.getIndex()); return eventRef.split(parserTip.getSeparator())[index]; }else {</BUG> return eventRef.split("/")[3];
eExisting.setCount(eExisting.getCount() + eUpdate.getCount()); String eExistingSiteId = eExisting.getSiteId(); if ((eExistingSiteId!=null) && (eExistingSiteId.trim().length()>0)) session.saveOrUpdate(eExisting);
9,278
import com.dsh105.echopet.compat.api.event.PetTeleportEvent; import com.dsh105.echopet.compat.api.plugin.EchoPet; import com.dsh105.echopet.compat.api.plugin.uuid.UUIDMigration; import com.dsh105.echopet.compat.api.reflection.ReflectionConstants; import com.dsh105.echopet.compat.api.reflection.SafeMethod; <BUG>import com.dsh105.echopet.compat.api.util.Lang; import com.dsh105.echopet.compat.api.util.PetNames;</BUG> import com.dsh105.echopet.compat.api.util.PlayerUtil; import com.dsh105.echopet.compat.api.util.ReflectionUtil; import com.dsh105.echopet.compat.api.util.StringSimplifier;
import com.dsh105.echopet.compat.api.util.INMS; import com.dsh105.echopet.compat.api.util.PetNames;
9,279
this.getRider().removePet(false); } new BukkitRunnable() { @Override public void run() { <BUG>method.invoke(PlayerUtil.playerToEntityPlayer(getOwner()), getEntityPet()); ownerIsMounting = false;</BUG> if (getEntityPet() instanceof IEntityNoClipPet) { ((IEntityNoClipPet) getEntityPet()).noClip(false); }
INMS.getInstance().mount(getOwner(), getEntityPet().getBukkitEntity()); ownerIsMounting = false;
9,280
@Override public void onEnable() { EchoPet.setPlugin(this); isUsingNetty = CommonReflection.isUsingNetty(); this.configManager = new YAMLConfigManager(this); <BUG>COMMAND_MANAGER = new CommandManager(this); try { Class.forName(ReflectionUtil.COMPAT_NMS_PATH + ".SpawnUtil"); } catch (ClassNotFoundException e) {</BUG> EchoPet.LOG.log(ChatColor.RED + "SonarPet " + ChatColor.GOLD
if (!INMS.isSupported()) {
9,281
</BUG> import com.jolbox.bonecp.BoneCP; import org.bukkit.plugin.Plugin; public interface IEchoPetPlugin extends Plugin { <BUG>public ISpawnUtil getSpawnUtil(); </BUG> public String getPrefix(); public String getCommandString(); public String getAdminCommandString(); PetRegistry getPetRegistry();
import com.dsh105.commodus.config.YAMLConfig; import com.dsh105.echopet.compat.api.config.ConfigOptions; import com.dsh105.echopet.compat.api.plugin.hook.IVanishProvider; import com.dsh105.echopet.compat.api.plugin.hook.IWorldGuardProvider; import com.dsh105.echopet.compat.api.registration.PetRegistry; import com.dsh105.echopet.compat.api.util.INMS; public INMS getSpawnUtil();
9,282
Integer datasetId; String datasetUrn; String capacityName; String capacityType; String capacityUnit; <BUG>String capacityLow; String capacityHigh; </BUG> Long modifiedTime;
Long capacityLow; Long capacityHigh;
9,283
import com.fasterxml.jackson.databind.ObjectMapper; public class DatasetFieldPathRecord { String fieldPath; String role; public DatasetFieldPathRecord() { <BUG>} @Override public String toString() { try { return new ObjectMapper().writeValueAsString(this); } catch (JsonProcessingException ex) { return null; }</BUG> }
[DELETED]
9,284
new DatabaseWriter(JdbcUtil.wherehowsJdbcTemplate, DATASET_INVENTORY_TABLE); public static final String GET_DATASET_DEPLOYMENT_BY_DATASET_ID = "SELECT * FROM " + DATASET_DEPLOYMENT_TABLE + " WHERE dataset_id = :dataset_id"; public static final String GET_DATASET_DEPLOYMENT_BY_URN = "SELECT * FROM " + DATASET_DEPLOYMENT_TABLE + " WHERE dataset_urn = :dataset_urn"; <BUG>public static final String DELETE_DATASET_DEPLOYMENT_BY_URN = "DELETE FROM " + DATASET_DEPLOYMENT_TABLE + " WHERE dataset_urn=?"; </BUG> public static final String GET_DATASET_CAPACITY_BY_DATASET_ID =
public static final String DELETE_DATASET_DEPLOYMENT_BY_DATASET_ID = "DELETE FROM " + DATASET_DEPLOYMENT_TABLE + " WHERE dataset_id=?";
9,285
</BUG> public static final String GET_DATASET_CAPACITY_BY_DATASET_ID = "SELECT * FROM " + DATASET_CAPACITY_TABLE + " WHERE dataset_id = :dataset_id"; public static final String GET_DATASET_CAPACITY_BY_URN = "SELECT * FROM " + DATASET_CAPACITY_TABLE + " WHERE dataset_urn = :dataset_urn"; <BUG>public static final String DELETE_DATASET_CAPACITY_BY_URN = "DELETE FROM " + DATASET_CAPACITY_TABLE + " WHERE dataset_urn=?"; </BUG> public static final String GET_DATASET_TAG_BY_DATASET_ID =
new DatabaseWriter(JdbcUtil.wherehowsJdbcTemplate, DATASET_INVENTORY_TABLE); public static final String GET_DATASET_DEPLOYMENT_BY_DATASET_ID = "SELECT * FROM " + DATASET_DEPLOYMENT_TABLE + " WHERE dataset_id = :dataset_id"; public static final String GET_DATASET_DEPLOYMENT_BY_URN = "SELECT * FROM " + DATASET_DEPLOYMENT_TABLE + " WHERE dataset_urn = :dataset_urn"; public static final String DELETE_DATASET_DEPLOYMENT_BY_DATASET_ID = "DELETE FROM " + DATASET_DEPLOYMENT_TABLE + " WHERE dataset_id=?"; public static final String DELETE_DATASET_CAPACITY_BY_DATASET_ID = "DELETE FROM " + DATASET_CAPACITY_TABLE + " WHERE dataset_id=?";
9,286
"SELECT * FROM " + DATASET_CASE_SENSITIVE_TABLE + " WHERE dataset_urn = :dataset_urn"; public static final String GET_DATASET_REFERENCE_BY_DATASET_ID = "SELECT * FROM " + DATASET_REFERENCE_TABLE + " WHERE dataset_id = :dataset_id"; public static final String GET_DATASET_REFERENCE_BY_URN = "SELECT * FROM " + DATASET_REFERENCE_TABLE + " WHERE dataset_urn = :dataset_urn"; <BUG>public static final String DELETE_DATASET_REFERENCE_BY_URN = "DELETE FROM " + DATASET_REFERENCE_TABLE + " WHERE dataset_urn=?"; </BUG> public static final String GET_DATASET_PARTITION_BY_DATASET_ID =
public static final String DELETE_DATASET_REFERENCE_BY_DATASET_ID = "DELETE FROM " + DATASET_REFERENCE_TABLE + " WHERE dataset_id=?";
9,287
"SELECT * FROM " + DATASET_SECURITY_TABLE + " WHERE dataset_urn = :dataset_urn"; public static final String GET_DATASET_OWNER_BY_DATASET_ID = "SELECT * FROM " + DATASET_OWNER_TABLE + " WHERE dataset_id = :dataset_id ORDER BY sort_id"; public static final String GET_DATASET_OWNER_BY_URN = "SELECT * FROM " + DATASET_OWNER_TABLE + " WHERE dataset_urn = :dataset_urn ORDER BY sort_id"; <BUG>public static final String DELETE_DATASET_OWNER_BY_URN = "DELETE FROM " + DATASET_OWNER_TABLE + " WHERE dataset_urn=?"; </BUG> public static final String GET_USER_BY_USER_ID = "SELECT * FROM " + EXTERNAL_USER_TABLE + " WHERE user_id = :user_id";
public static final String DELETE_DATASET_OWNER_BY_DATASET_ID = "DELETE FROM " + DATASET_OWNER_TABLE + " WHERE dataset_id=?";
9,288
"SELECT app_id FROM " + EXTERNAL_GROUP_TABLE + " WHERE group_id = :group_id GROUP BY group_id"; public static final String GET_DATASET_CONSTRAINT_BY_DATASET_ID = "SELECT * FROM " + DATASET_CONSTRAINT_TABLE + " WHERE dataset_id = :dataset_id"; public static final String GET_DATASET_CONSTRAINT_BY_URN = "SELECT * FROM " + DATASET_CONSTRAINT_TABLE + " WHERE dataset_urn = :dataset_urn"; <BUG>public static final String DELETE_DATASET_CONSTRAINT_BY_URN = "DELETE FROM " + DATASET_CONSTRAINT_TABLE + " WHERE dataset_urn=?"; </BUG> public static final String GET_DATASET_INDEX_BY_DATASET_ID =
public static final String DELETE_DATASET_CONSTRAINT_BY_DATASET_ID = "DELETE FROM " + DATASET_CONSTRAINT_TABLE + " WHERE dataset_id=?";
9,289
</BUG> public static final String GET_DATASET_INDEX_BY_DATASET_ID = "SELECT * FROM " + DATASET_INDEX_TABLE + " WHERE dataset_id = :dataset_id"; public static final String GET_DATASET_INDEX_BY_URN = "SELECT * FROM " + DATASET_INDEX_TABLE + " WHERE dataset_urn = :dataset_urn"; <BUG>public static final String DELETE_DATASET_INDEX_BY_URN = "DELETE FROM " + DATASET_INDEX_TABLE + " WHERE dataset_urn=?"; </BUG> public static final String GET_DATASET_SCHEMA_BY_DATASET_ID =
"SELECT app_id FROM " + EXTERNAL_GROUP_TABLE + " WHERE group_id = :group_id GROUP BY group_id"; public static final String GET_DATASET_CONSTRAINT_BY_DATASET_ID = "SELECT * FROM " + DATASET_CONSTRAINT_TABLE + " WHERE dataset_id = :dataset_id"; public static final String GET_DATASET_CONSTRAINT_BY_URN = "SELECT * FROM " + DATASET_CONSTRAINT_TABLE + " WHERE dataset_urn = :dataset_urn"; public static final String DELETE_DATASET_CONSTRAINT_BY_DATASET_ID = "DELETE FROM " + DATASET_CONSTRAINT_TABLE + " WHERE dataset_id=?"; public static final String DELETE_DATASET_INDEX_BY_DATASET_ID = "DELETE FROM " + DATASET_INDEX_TABLE + " WHERE dataset_id=?";
9,290
DatasetSecurityRecord record = om.convertValue(security, DatasetSecurityRecord.class); record.setDatasetId(datasetId); record.setDatasetUrn(urn); record.setModifiedTime(System.currentTimeMillis() / 1000); try { <BUG>Map<String, Object> result = getDatasetSecurityByDatasetId(datasetId); </BUG> String[] columns = record.getDbColumnNames(); Object[] columnValues = record.getAllValuesToString(); String[] conditions = {"dataset_id"};
DatasetSecurityRecord result = getDatasetSecurityByDatasetId(datasetId);
9,291
"confidential_flags", "is_recursive", "partitioned", "indexed", "namespace", "default_comment_id", "comment_ids"}; } @Override public List<Object> fillAllFields() { return null; <BUG>} public String[] getFieldDetailColumns() {</BUG> return new String[]{"dataset_id", "sort_id", "parent_sort_id", "parent_path", "field_name", "fields_layout_id", "field_label", "data_type", "data_size", "data_precision", "data_fraction", "is_nullable", "is_indexed", "is_partitioned", "is_recursive", "confidential_flags", "default_value", "namespace", "default_comment_id",
@JsonIgnore public String[] getFieldDetailColumns() {
9,292
partitioned != null && partitioned ? "Y" : "N", isRecursive != null && isRecursive ? "Y" : "N", confidentialFlags, defaultValue, namespace, defaultCommentId, commentIds}; } public DatasetFieldSchemaRecord() { } <BUG>@Override public String toString() { try { return new ObjectMapper().writeValueAsString(this.getFieldValueMap()); } catch (Exception ex) { return null; } }</BUG> public Integer getDatasetId() {
[DELETED]
9,293
String fieldPath; String descend; Integer prefixLength; String filter; public DatasetFieldIndexRecord() { <BUG>} @Override public String toString() { try { return new ObjectMapper().writeValueAsString(this); } catch (JsonProcessingException ex) { return null; }</BUG> }
[DELETED]
9,294
String actorUrn; String type; Long time; String note; public DatasetChangeAuditStamp() { <BUG>} @Override public String toString() { try { return new ObjectMapper().writeValueAsString(this); } catch (JsonProcessingException ex) { return null; }</BUG> }
[DELETED]
9,295
package wherehows.common.schemas; <BUG>import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.reflect.Field; import java.util.HashMap;</BUG> import java.util.List; import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.util.Date; import java.util.Collection; import java.util.HashMap;
9,296
private PreparedStatement findOne; private PreparedStatement deleteOne; private PreparedStatement upsert; private PreparedStatement addPassword; private void prepareStatements() { <BUG>findOne = session.prepare(select().all() .from(USER)</BUG> .where(eq(USERNAME, bindMarker(USERNAME))) .and(eq(REALM, realmName))) .setConsistencyLevel(cassandraProperties.getReadConsistencyLevel());
findOne = session.prepare(select() .column(PASSWORD_HASHES) .column(SCOPES) .column(CREATED_BY) .column(LAST_MODIFIED_BY) .from(USER)
9,297
private int srcImageID; // ID of source image private ImagePlus srcImp; // source image for live histograms private Thread bgThread; // thread background drawing private boolean doUpdate; // tells background thread to update private int channel; // RGB channel <BUG>private String blankLabel; public HistogramWindow(ImagePlus imp) {</BUG> super(NewImage.createRGBImage("Histogram of "+imp.getShortTitle(), WIN_WIDTH, WIN_HEIGHT, 1, NewImage.FILL_WHITE)); showHistogram(imp, 256, 0.0, 0.0); }
private boolean stackHistogram; public HistogramWindow(ImagePlus imp) {
9,298
stats = imp2.getStatistics(AREA+MEAN+MODE+MIN_MAX, bins, histMin, histMax); } else stats = imp.getStatistics(AREA+MEAN+MODE+MIN_MAX+(limitToThreshold?LIMIT:0), bins, histMin, histMax); showHistogram(imp, stats); } <BUG>public void showHistogram(ImagePlus imp, ImageStatistics stats) { if (list==null)</BUG> setup(imp); this.stats = stats; cal = imp.getCalibration();
stackHistogram = stats.stackStatistics; if (list==null)
9,299
setOverlay(overlay2); if (unlocked) unlock(); } public void close() { ImageWindow win = getWindow(); <BUG>if (win!=null) { win.close(); } else { if (WindowManager.getCurrentImage()==this)</BUG> WindowManager.setTempCurrentImage(null);
if (win!=null) if (WindowManager.getCurrentImage()==this)
9,300
if (ox>xMax) ox = xMax; if (oy>yMax) oy = yMax; if (ox!=xp[nPoints-1]+x || oy!=yp[nPoints-1]+y) { xp[nPoints] = ox-x; yp[nPoints] = oy-y; <BUG>nPoints++; if (nPoints==xp.length)</BUG> enlargeArrays(); drawLine(); }
if (IJ.altKeyDown()) wipeBack(); if (nPoints==xp.length)